summaryrefslogtreecommitdiff
path: root/lib/gui
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gui')
-rw-r--r--lib/gui/simulator/drawing_panel.py11
-rw-r--r--lib/gui/simulator/simulator_panel.py1
2 files changed, 10 insertions, 2 deletions
diff --git a/lib/gui/simulator/drawing_panel.py b/lib/gui/simulator/drawing_panel.py
index abe6fa0f..d6546c47 100644
--- a/lib/gui/simulator/drawing_panel.py
+++ b/lib/gui/simulator/drawing_panel.py
@@ -66,6 +66,11 @@ class DrawingPanel(wx.Panel):
self.show_page = global_settings['toggle_page_button_status']
self.background_color = None
+ # Set initial values as they may be accessed before a stitch plan is available
+ # for example through a focus action on the stitch box
+ self.num_stitches = 1
+ self.commands = [None]
+
# desired simulation speed in stitches per second
self.speed = global_settings['simulator_speed']
@@ -435,7 +440,11 @@ class DrawingPanel(wx.Panel):
def set_current_stitch(self, stitch):
self.current_stitch = stitch
self.clamp_current_stitch()
- command = self.commands[int(self.current_stitch)]
+ try:
+ command = self.commands[int(self.current_stitch)]
+ except IndexError:
+ # no stitch plan loaded yet, do nothing for now
+ return
self.control_panel.on_current_stitch(int(self.current_stitch), command)
statusbar = self.GetTopLevelParent().statusbar
statusbar.SetStatusText(_("Command: %s") % COMMAND_NAMES[command], 2)
diff --git a/lib/gui/simulator/simulator_panel.py b/lib/gui/simulator/simulator_panel.py
index 1cea9214..efbb2a62 100644
--- a/lib/gui/simulator/simulator_panel.py
+++ b/lib/gui/simulator/simulator_panel.py
@@ -58,7 +58,6 @@ class SimulatorPanel(wx.Panel):
(wx.ACCEL_SHIFT, ord('='), self.cp.animation_one_stitch_forward),
(wx.ACCEL_NORMAL, wx.WXK_ADD, self.cp.animation_one_stitch_forward),
(wx.ACCEL_NORMAL, wx.WXK_NUMPAD_ADD, self.cp.animation_one_stitch_forward),
- (wx.ACCEL_NORMAL, wx.WXK_NUMPAD_UP, self.cp.animation_one_stitch_forward),
(wx.ACCEL_NORMAL, ord('-'), self.cp.animation_one_stitch_backward),
(wx.ACCEL_NORMAL, ord('_'), self.cp.animation_one_stitch_backward),
(wx.ACCEL_NORMAL, wx.WXK_SUBTRACT, self.cp.animation_one_stitch_backward),