forward/backward one frame support

pull/284/head
Lex Neva 2018-08-26 14:43:23 -04:00
rodzic 8351cf21a0
commit 79e8ad5b31
2 zmienionych plików z 50 dodań i 47 usunięć

Wyświetl plik

@ -35,7 +35,7 @@ class ControlPanel(wx.Panel):
self.slider = wx.Slider(self, -1, value=1, minValue=1, maxValue=self.num_stitches,
style=wx.SL_HORIZONTAL | wx.SL_LABELS)
self.slider.Bind(wx.EVT_SLIDER, self.on_slider)
self.stitchBox = IntCtrl(self, -1, value=0, min=0, max=self.num_stitches, limited=True, allow_none=False)
self.stitchBox = IntCtrl(self, -1, value=1, min=0, max=self.num_stitches, limited=True, allow_none=False)
self.stitchBox.Bind(wx.EVT_TEXT, self.on_stitch_box)
self.speedST = wx.StaticText(self, -1, label='', style=wx.ALIGN_CENTER)
@ -67,16 +67,16 @@ class ControlPanel(wx.Panel):
(wx.ACCEL_NORMAL, wx.WXK_NUMPAD_UP, self.animation_speed_up),
(wx.ACCEL_NORMAL, wx.WXK_DOWN, self.animation_slow_down),
(wx.ACCEL_NORMAL, wx.WXK_NUMPAD_DOWN, self.animation_slow_down),
(wx.ACCEL_NORMAL, ord('+'), self.animation_one_frame_forward),
(wx.ACCEL_NORMAL, ord('='), self.animation_one_frame_forward),
(wx.ACCEL_SHIFT, ord('='), self.animation_one_frame_forward),
(wx.ACCEL_NORMAL, wx.WXK_ADD, self.animation_one_frame_forward),
(wx.ACCEL_NORMAL, wx.WXK_NUMPAD_ADD, self.animation_one_frame_forward),
(wx.ACCEL_NORMAL, wx.WXK_NUMPAD_UP, self.animation_one_frame_forward),
(wx.ACCEL_NORMAL, ord('-'), self.animation_one_frame_backward),
(wx.ACCEL_NORMAL, ord('_'), self.animation_one_frame_backward),
(wx.ACCEL_NORMAL, wx.WXK_SUBTRACT, self.animation_one_frame_backward),
(wx.ACCEL_NORMAL, wx.WXK_NUMPAD_SUBTRACT, self.animation_one_frame_backward),
(wx.ACCEL_NORMAL, ord('+'), self.animation_one_stitch_forward),
(wx.ACCEL_NORMAL, ord('='), self.animation_one_stitch_forward),
(wx.ACCEL_SHIFT, ord('='), self.animation_one_stitch_forward),
(wx.ACCEL_NORMAL, wx.WXK_ADD, self.animation_one_stitch_forward),
(wx.ACCEL_NORMAL, wx.WXK_NUMPAD_ADD, self.animation_one_stitch_forward),
(wx.ACCEL_NORMAL, wx.WXK_NUMPAD_UP, self.animation_one_stitch_forward),
(wx.ACCEL_NORMAL, ord('-'), self.animation_one_stitch_backward),
(wx.ACCEL_NORMAL, ord('_'), self.animation_one_stitch_backward),
(wx.ACCEL_NORMAL, wx.WXK_SUBTRACT, self.animation_one_stitch_backward),
(wx.ACCEL_NORMAL, wx.WXK_NUMPAD_SUBTRACT, self.animation_one_stitch_backward),
(wx.ACCEL_NORMAL, ord('r'), self.animation_restart),
(wx.ACCEL_NORMAL, ord('p'), self.on_pause_start_button),
(wx.ACCEL_NORMAL, wx.WXK_SPACE, self.on_pause_start_button),
@ -92,6 +92,7 @@ class ControlPanel(wx.Panel):
accel_table = wx.AcceleratorTable(accel_entries)
self.SetAcceleratorTable(accel_table)
self.current_stitch = 1
self.set_speed(16)
self.SetFocus()
@ -124,8 +125,10 @@ class ControlPanel(wx.Panel):
self.drawing_panel.set_current_stitch(stitch)
def on_current_stitch(self, stitch):
self.slider.SetValue(stitch)
self.stitchBox.SetValue(stitch)
if self.current_stitch != stitch:
self.current_stitch = stitch
self.slider.SetValue(stitch)
self.stitchBox.SetValue(stitch)
def set_stitch_label(self, stitch):
self.st1.SetLabel("Stitch # %d/%d" % (stitch, self.num_stitches))
@ -158,11 +161,11 @@ class ControlPanel(wx.Panel):
else:
self.animation_start()
def animation_one_frame_forward(self, event):
pass
def animation_one_stitch_forward(self, event):
self.drawing_panel.one_stitch_forward()
def animation_one_frame_backward(self, event):
pass
def animation_one_stitch_backward(self, event):
self.drawing_panel.one_stitch_backward()
def animation_quit(self, event):
self.parent.quit()
@ -231,7 +234,6 @@ class DrawingPanel(wx.Panel):
elif self.direction == 1 and self.current_stitch < self.num_stitches:
self.go()
def animate(self):
if not self.animating:
return
@ -246,15 +248,7 @@ class DrawingPanel(wx.Panel):
#print >> sys.stderr, time.time(), "animate", self.current_stitch, stitch_increment, self.last_frame_duration, frame_time
self.current_stitch += self.direction * stitch_increment
self.clamp_current_stitch()
self.stop_if_at_end()
if self.control_panel:
self.control_panel.on_current_stitch(self.current_stitch)
self.Refresh()
self.set_current_stitch(self.current_stitch + self.direction * stitch_increment)
wx.CallLater(int(1000 * frame_time), self.animate)
def OnPaint(self, e):
@ -352,6 +346,9 @@ class DrawingPanel(wx.Panel):
self.stop_if_at_end()
self.Refresh()
if self.control_panel:
self.control_panel.on_current_stitch(self.current_stitch)
def restart(self):
if self.direction == 1:
self.current_stitch = 0
@ -360,6 +357,12 @@ class DrawingPanel(wx.Panel):
self.go()
def one_stitch_forward(self):
self.set_current_stitch(self.current_stitch + 1)
def one_stitch_backward(self):
self.set_current_stitch(self.current_stitch - 1)
class SimulatorPanel(wx.Panel):
""""""

Wyświetl plik

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2018-08-26 14:32-0400\n"
"POT-Creation-Date: 2018-08-26 14:43-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -674,79 +674,79 @@ msgstr ""
msgid "Generate INX files"
msgstr ""
#: lib/simulator.py:460
#: lib/simulator.py:463
msgid "<<"
msgstr ""
#: lib/simulator.py:460
#: lib/simulator.py:463
msgid "Play reverse (arrow left)"
msgstr ""
#: lib/simulator.py:461
#: lib/simulator.py:464
msgid "-"
msgstr ""
#: lib/simulator.py:461
#: lib/simulator.py:464
msgid "Play one frame backward (+)"
msgstr ""
#: lib/simulator.py:462
#: lib/simulator.py:465
msgid "+"
msgstr ""
#: lib/simulator.py:462
#: lib/simulator.py:465
msgid "Play one frame forward (+)"
msgstr ""
#: lib/simulator.py:463
#: lib/simulator.py:466
msgid ">>"
msgstr ""
#: lib/simulator.py:463
#: lib/simulator.py:466
msgid "Play forward (arrow right)"
msgstr ""
#: lib/simulator.py:464
#: lib/simulator.py:467
msgid "^"
msgstr ""
#: lib/simulator.py:464
#: lib/simulator.py:467
msgid "Speed up (arrow up)"
msgstr ""
#: lib/simulator.py:465
#: lib/simulator.py:468
msgid "v"
msgstr ""
#: lib/simulator.py:465
#: lib/simulator.py:468
msgid "Slow down (arrow down)"
msgstr ""
#: lib/simulator.py:466
#: lib/simulator.py:469
msgid "Pause"
msgstr ""
#: lib/simulator.py:466
#: lib/simulator.py:469
msgid "Pause (P)"
msgstr ""
#: lib/simulator.py:467
#: lib/simulator.py:470
msgid "Restart"
msgstr ""
#: lib/simulator.py:467
#: lib/simulator.py:470
msgid "Restart (R)"
msgstr ""
#: lib/simulator.py:468
#: lib/simulator.py:471
msgid "Quit"
msgstr ""
#: lib/simulator.py:468
#: lib/simulator.py:471
msgid "Close (Q)"
msgstr ""
#: lib/simulator.py:646
#: lib/simulator.py:649
msgid "Stitch # "
msgstr ""