chiark / gitweb /
Add image to show which endstop to press.
authordaid303 <daid303@gmail.com>
Wed, 3 Oct 2012 16:46:37 +0000 (18:46 +0200)
committerdaid303 <daid303@gmail.com>
Wed, 3 Oct 2012 16:46:37 +0000 (18:46 +0200)
Cura/gui/configWizard.py

index b1e64747163840cdf6144b85b761d4a41c235982..e11bb47250300f4b3201769d0b8b4ce9b26e958e 100644 (file)
@@ -159,11 +159,17 @@ class InfoPage(wx.wizard.WizardPageSimple):
                self.rowNr += 1\r
                return text, button\r
 \r
+       def AddBitmap(self, bitmap):\r
+               bitmap = wx.StaticBitmap(self, -1, bitmap)\r
+               self.GetSizer().Add(bitmap, pos=(self.rowNr, 0), span=(1,2), flag=wx.LEFT|wx.RIGHT)\r
+               self.rowNr += 1\r
+               return bitmap\r
+\r
        def AddCheckmark(self, label, bitmap):\r
                check = wx.StaticBitmap(self, -1, bitmap)\r
                text = wx.StaticText(self, -1, label)\r
                self.GetSizer().Add(text, pos=(self.rowNr, 0), span=(1,1), flag=wx.LEFT|wx.RIGHT)\r
-               self.GetSizer().Add(check, pos=(self.rowNr, 1), span=(1,2), flag=wx.ALL)\r
+               self.GetSizer().Add(check, pos=(self.rowNr, 1), span=(1,1), flag=wx.ALL)\r
                self.rowNr += 1\r
                return check\r
                \r
@@ -279,14 +285,23 @@ class FirmwareUpgradePage(InfoPage):
 class UltimakerCheckupPage(InfoPage):\r
        def __init__(self, parent):\r
                super(UltimakerCheckupPage, self).__init__(parent, "Ultimaker Checkup")\r
+\r
+               self.checkBitmap = toolbarUtil.getBitmapImage('checkmark.png')\r
+               self.crossBitmap = toolbarUtil.getBitmapImage('cross.png')\r
+               self.unknownBitmap = toolbarUtil.getBitmapImage('question.png')\r
+               self.endStopNoneBitmap = toolbarUtil.getBitmapImage('endstop_none.png')\r
+               self.endStopXMinBitmap = toolbarUtil.getBitmapImage('endstop_xmin.png')\r
+               self.endStopXMaxBitmap = toolbarUtil.getBitmapImage('endstop_xmax.png')\r
+               self.endStopYMinBitmap = toolbarUtil.getBitmapImage('endstop_ymin.png')\r
+               self.endStopYMaxBitmap = toolbarUtil.getBitmapImage('endstop_ymax.png')\r
+               self.endStopZMinBitmap = toolbarUtil.getBitmapImage('endstop_zmin.png')\r
+               self.endStopZMaxBitmap = toolbarUtil.getBitmapImage('endstop_zmax.png')\r
+\r
                self.AddText('It is a good idea to do a few sanity checks now on your Ultimaker.\nYou can skip these if you know your machine is functional.')\r
                b1, b2 = self.AddDualButton('Run checks', 'Skip checks')\r
                b1.Bind(wx.EVT_BUTTON, self.OnCheckClick)\r
                b2.Bind(wx.EVT_BUTTON, self.OnSkipClick)\r
                self.AddSeperator()\r
-               self.checkBitmap = toolbarUtil.getBitmapImage('checkmark.png')\r
-               self.crossBitmap = toolbarUtil.getBitmapImage('cross.png')\r
-               self.unknownBitmap = toolbarUtil.getBitmapImage('question.png')\r
                self.commState = self.AddCheckmark('Communication:', self.unknownBitmap)\r
                self.tempState = self.AddCheckmark('Temperature:', self.unknownBitmap)\r
                self.stopState = self.AddCheckmark('Endstops:', self.unknownBitmap)\r
@@ -295,12 +310,7 @@ class UltimakerCheckupPage(InfoPage):
                self.machineState = self.AddText('')\r
                self.temperatureLabel = self.AddText('')\r
                self.AddSeperator()\r
-               self.xMinState = self.AddCheckmark('X stop left:', self.unknownBitmap)\r
-               self.xMaxState = self.AddCheckmark('X stop right:', self.unknownBitmap)\r
-               self.yMinState = self.AddCheckmark('Y stop front:', self.unknownBitmap)\r
-               self.yMaxState = self.AddCheckmark('Y stop back:', self.unknownBitmap)\r
-               self.zMinState = self.AddCheckmark('Z stop top:', self.unknownBitmap)\r
-               self.zMaxState = self.AddCheckmark('Z stop bottom:', self.unknownBitmap)\r
+               self.endstopBitmap = self.AddBitmap(self.endStopNoneBitmap)\r
                self.comm = None\r
                self.xMinStop = False\r
                self.xMaxStop = False\r
@@ -314,6 +324,7 @@ class UltimakerCheckupPage(InfoPage):
                        self.comm.close()\r
        \r
        def AllowNext(self):\r
+               self.endstopBitmap.Show(False)\r
                return False\r
        \r
        def OnSkipClick(self, e):\r
@@ -356,10 +367,12 @@ class UltimakerCheckupPage(InfoPage):
                                self.comm.sendCommand('M104 S200')\r
                                self.comm.sendCommand('M104 S200')\r
                elif self.checkupState == 2:\r
-                       print "WARNING, TEMPERATURE TEST DISABLED FOR TESTING!"\r
-                       if temp > self.startTemp:# + 40:\r
+                       #print "WARNING, TEMPERATURE TEST DISABLED FOR TESTING!"\r
+                       if temp > self.startTemp + 40:\r
                                self.checkupState = 3\r
                                wx.CallAfter(self.infoBox.SetAttention, 'Please make sure none of the endstops are pressed.')\r
+                               wx.CallAfter(self.endstopBitmap.Show, True)\r
+                               wx.CallAfter(self.Layout)\r
                                self.comm.sendCommand('M104 S0')\r
                                self.comm.sendCommand('M104 S0')\r
                                self.comm.sendCommand('M119')\r
@@ -403,61 +416,43 @@ class UltimakerCheckupPage(InfoPage):
                                                self.zMaxStop = (value == 'H')\r
                        self.comm.sendCommand('M119')\r
                        \r
-                       if self.xMinStop:\r
-                               self.xMinState.SetBitmap(self.checkBitmap)\r
-                       else:\r
-                               self.xMinState.SetBitmap(self.crossBitmap)\r
-                       if self.xMaxStop:\r
-                               self.xMaxState.SetBitmap(self.checkBitmap)\r
-                       else:\r
-                               self.xMaxState.SetBitmap(self.crossBitmap)\r
-                       if self.yMinStop:\r
-                               self.yMinState.SetBitmap(self.checkBitmap)\r
-                       else:\r
-                               self.yMinState.SetBitmap(self.crossBitmap)\r
-                       if self.yMaxStop:\r
-                               self.yMaxState.SetBitmap(self.checkBitmap)\r
-                       else:\r
-                               self.yMaxState.SetBitmap(self.crossBitmap)\r
-                       if self.zMinStop:\r
-                               self.zMinState.SetBitmap(self.checkBitmap)\r
-                       else:\r
-                               self.zMinState.SetBitmap(self.crossBitmap)\r
-                       if self.zMaxStop:\r
-                               self.zMaxState.SetBitmap(self.checkBitmap)\r
-                       else:\r
-                               self.zMaxState.SetBitmap(self.crossBitmap)\r
-                       \r
                        if self.checkupState == 3:\r
                                if not self.xMinStop and not self.xMaxStop and not self.yMinStop and not self.yMaxStop and not self.zMinStop and not self.zMaxStop:\r
                                        self.checkupState = 4\r
                                        wx.CallAfter(self.infoBox.SetAttention, 'Please press the left X endstop.')\r
+                                       wx.CallAfter(self.endstopBitmap.SetBitmap, self.endStopXMinBitmap)\r
                        elif self.checkupState == 4:\r
                                if self.xMinStop and not self.xMaxStop and not self.yMinStop and not self.yMaxStop and not self.zMinStop and not self.zMaxStop:\r
                                        self.checkupState = 5\r
                                        wx.CallAfter(self.infoBox.SetAttention, 'Please press the right X endstop.')\r
+                                       wx.CallAfter(self.endstopBitmap.SetBitmap, self.endStopXMaxBitmap)\r
                        elif self.checkupState == 5:\r
                                if not self.xMinStop and self.xMaxStop and not self.yMinStop and not self.yMaxStop and not self.zMinStop and not self.zMaxStop:\r
                                        self.checkupState = 6\r
                                        wx.CallAfter(self.infoBox.SetAttention, 'Please press the front Y endstop.')\r
+                                       wx.CallAfter(self.endstopBitmap.SetBitmap, self.endStopYMinBitmap)\r
                        elif self.checkupState == 6:\r
                                if not self.xMinStop and not self.xMaxStop and self.yMinStop and not self.yMaxStop and not self.zMinStop and not self.zMaxStop:\r
                                        self.checkupState = 7\r
                                        wx.CallAfter(self.infoBox.SetAttention, 'Please press the back Y endstop.')\r
+                                       wx.CallAfter(self.endstopBitmap.SetBitmap, self.endStopYMaxBitmap)\r
                        elif self.checkupState == 7:\r
                                if not self.xMinStop and not self.xMaxStop and not self.yMinStop and self.yMaxStop and not self.zMinStop and not self.zMaxStop:\r
                                        self.checkupState = 8\r
                                        wx.CallAfter(self.infoBox.SetAttention, 'Please press the top Z endstop.')\r
+                                       wx.CallAfter(self.endstopBitmap.SetBitmap, self.endStopZMinBitmap)\r
                        elif self.checkupState == 8:\r
                                if not self.xMinStop and not self.xMaxStop and not self.yMinStop and not self.yMaxStop and self.zMinStop and not self.zMaxStop:\r
                                        self.checkupState = 9\r
                                        wx.CallAfter(self.infoBox.SetAttention, 'Please press the bottom Z endstop.')\r
+                                       wx.CallAfter(self.endstopBitmap.SetBitmap, self.endStopZMaxBitmap)\r
                        elif self.checkupState == 9:\r
                                if not self.xMinStop and not self.xMaxStop and not self.yMinStop and not self.yMaxStop and not self.zMinStop and self.zMaxStop:\r
                                        self.checkupState = 10\r
                                        self.comm.close()\r
                                        wx.CallAfter(self.infoBox.SetInfo, 'Checkup finished')\r
                                        wx.CallAfter(self.infoBox.SetReadyIndicator)\r
+                                       wx.CallAfter(self.endstopBitmap.Show, False)\r
                                        wx.CallAfter(self.stopState.SetBitmap, self.checkBitmap)\r
                                        wx.CallAfter(self.OnSkipClick, None)\r
 \r