kopia lustrzana https://github.com/inkstitch/inkstitch
adjust default simulation speed to always take ~5 seconds
rodzic
82fe2b7144
commit
c2388a53a6
|
@ -401,7 +401,7 @@ class SettingsFrame(wx.Frame):
|
|||
simulator_pos.x += 5
|
||||
|
||||
try:
|
||||
self.simulate_window = EmbroiderySimulator(None, -1, "Embroidery Simulator", simulator_pos, size=(300, 300), patches=patches, on_close=self.simulate_window_closed, stitches_per_frame=10)
|
||||
self.simulate_window = EmbroiderySimulator(None, -1, "Embroidery Simulator", simulator_pos, size=(300, 300), patches=patches, on_close=self.simulate_window_closed, target_duration=5)
|
||||
except:
|
||||
with open('/tmp/params_debug.log', 'a') as log:
|
||||
print >> log, traceback.format_exc()
|
||||
|
|
|
@ -14,6 +14,7 @@ class EmbroiderySimulator(wx.Frame):
|
|||
self.on_close_hook = kwargs.pop('on_close', None)
|
||||
self.frame_period = kwargs.pop('frame_period', 80)
|
||||
self.stitches_per_frame = kwargs.pop('stitches_per_frame', 1)
|
||||
self.target_duration = kwargs.pop('target_duration', None)
|
||||
|
||||
wx.Frame.__init__(self, *args, **kwargs)
|
||||
|
||||
|
@ -22,6 +23,9 @@ class EmbroiderySimulator(wx.Frame):
|
|||
|
||||
self.load(stitch_file, patches)
|
||||
|
||||
if self.target_duration:
|
||||
self.adjust_speed(self.target_duration)
|
||||
|
||||
self.buffer = wx.Bitmap(self.width, self.height)
|
||||
self.dc = wx.MemoryDC()
|
||||
self.dc.SelectObject(self.buffer)
|
||||
|
@ -51,6 +55,14 @@ class EmbroiderySimulator(wx.Frame):
|
|||
|
||||
self.width, self.height = self.get_dimensions()
|
||||
|
||||
def adjust_speed(self, duration):
|
||||
self.frame_period = 1000 * float(duration) / len(self.segments)
|
||||
self.stitches_per_frame = 1
|
||||
|
||||
while self.frame_period < 1.0:
|
||||
self.frame_period *= 2
|
||||
self.stitches_per_frame *= 2
|
||||
|
||||
def on_key_down(self, event):
|
||||
keycode = event.GetKeyCode()
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue