From 812107917a840fc743926d5b3a0fe6f679cb2072 Mon Sep 17 00:00:00 2001 From: daid303 Date: Wed, 3 Oct 2012 10:55:58 +0200 Subject: [PATCH] Update on the machine checkup wizard, better indicate what is happening. --- Cura/example/Attribution.txt | 2 +- Cura/gui/configWizard.py | 170 ++++++++++++++++++++++++++++++++--- Cura/images/attention.png | Bin 0 -> 712 bytes Cura/images/busy-0.png | Bin 0 -> 617 bytes Cura/images/busy-1.png | Bin 0 -> 505 bytes Cura/images/busy-2.png | Bin 0 -> 614 bytes Cura/images/busy-3.png | Bin 0 -> 471 bytes Cura/images/error.png | Bin 0 -> 656 bytes Cura/images/ready.png | Bin 0 -> 1152 bytes 9 files changed, 158 insertions(+), 14 deletions(-) create mode 100644 Cura/images/attention.png create mode 100644 Cura/images/busy-0.png create mode 100644 Cura/images/busy-1.png create mode 100644 Cura/images/busy-2.png create mode 100644 Cura/images/busy-3.png create mode 100644 Cura/images/error.png create mode 100644 Cura/images/ready.png diff --git a/Cura/example/Attribution.txt b/Cura/example/Attribution.txt index 1ff46805..27be0baa 100644 --- a/Cura/example/Attribution.txt +++ b/Cura/example/Attribution.txt @@ -9,4 +9,4 @@ The below models are shared under the CC BY-NC 3.0 license (http://creativecommo The below models are shared under the CC BY-SA 3.0 license (http://creativecommons.org/licenses/by-sa/3.0/), and can be shared and used freely as long as attribution is added: * UltimakerHandle.stl: Ultimaker handle by Silvius - http://www.thingiverse.com/thing:22819 \ No newline at end of file + http://www.thingiverse.com/thing:22819 diff --git a/Cura/gui/configWizard.py b/Cura/gui/configWizard.py index 0d49af30..105e77f8 100644 --- a/Cura/gui/configWizard.py +++ b/Cura/gui/configWizard.py @@ -9,6 +9,70 @@ from gui import toolbarUtil from util import machineCom from util import profile +class InfoBox(wx.Panel): + def __init__(self, parent): + super(InfoBox, self).__init__(parent) + self.SetBackgroundColour('#FFFF80') + + self.sizer = wx.GridBagSizer(5, 5) + self.SetSizer(self.sizer) + + self.attentionBitmap = toolbarUtil.getBitmapImage('attention.png') + self.errorBitmap = toolbarUtil.getBitmapImage('error.png') + self.readyBitmap = toolbarUtil.getBitmapImage('ready.png') + self.busyBitmap = [toolbarUtil.getBitmapImage('busy-0.png'), toolbarUtil.getBitmapImage('busy-1.png'), toolbarUtil.getBitmapImage('busy-2.png'), toolbarUtil.getBitmapImage('busy-3.png')] + + self.bitmap = wx.StaticBitmap(self, -1, wx.EmptyBitmapRGBA(24, 24, red=255, green=255, blue=255, alpha=1)) + self.text = wx.StaticText(self, -1, '') + self.sizer.Add(self.bitmap, pos=(0,0), flag=wx.ALL, border=5) + self.sizer.Add(self.text, pos=(0,1), flag=wx.TOP|wx.BOTTOM|wx.ALIGN_CENTER_VERTICAL, border=5) + + self.busyState = None + self.timer = wx.Timer(self) + self.Bind(wx.EVT_TIMER, self.doBusyUpdate, self.timer) + self.timer.Start(100) + + def SetInfo(self, info): + self.SetBackgroundColour('#FFFF80') + self.text.SetLabel(info) + self.Refresh() + + def SetError(self, info): + self.SetBackgroundColour('#FF8080') + self.text.SetLabel(info) + self.SetErrorIndicator() + self.Refresh() + + def SetAttention(self, info): + self.SetBackgroundColour('#FFFF80') + self.text.SetLabel(info) + self.SetAttentionIndicator() + self.Refresh() + + def SetBusyIndicator(self): + self.busyState = 0 + self.bitmap.SetBitmap(self.busyBitmap[self.busyState]) + + def doBusyUpdate(self, e): + if self.busyState == None: + return + self.busyState += 1 + if self.busyState >= len(self.busyBitmap): + self.busyState = 0 + self.bitmap.SetBitmap(self.busyBitmap[self.busyState]) + + def SetReadyIndicator(self): + self.busyState = None + self.bitmap.SetBitmap(self.readyBitmap) + + def SetErrorIndicator(self): + self.busyState = None + self.bitmap.SetBitmap(self.errorBitmap) + + def SetAttentionIndicator(self): + self.busyState = None + self.bitmap.SetBitmap(self.attentionBitmap) + class InfoPage(wx.wizard.WizardPageSimple): def __init__(self, parent, title): wx.wizard.WizardPageSimple.__init__(self, parent) @@ -37,6 +101,12 @@ class InfoPage(wx.wizard.WizardPageSimple): def AddHiddenSeperator(self): self.AddText('') + + def AddInfoBox(self): + infoBox = InfoBox(self) + self.GetSizer().Add(infoBox, pos=(self.rowNr, 0), span=(1,2), flag=wx.LEFT|wx.RIGHT|wx.EXPAND) + self.rowNr += 1 + return infoBox def AddRadioButton(self, label, style = 0): radio = wx.RadioButton(self, -1, label, style=style) @@ -221,9 +291,16 @@ class UltimakerCheckupPage(InfoPage): self.tempState = self.AddCheckmark('Temperature:', self.unknownBitmap) self.stopState = self.AddCheckmark('Endstops:', self.unknownBitmap) self.AddSeperator() - self.checkState = self.AddText('') + self.infoBox = self.AddInfoBox() self.machineState = self.AddText('') self.temperatureLabel = self.AddText('') + self.AddSeperator() + self.xMinState = self.AddCheckmark('X stop left:', self.unknownBitmap) + self.xMaxState = self.AddCheckmark('X stop right:', self.unknownBitmap) + self.yMinState = self.AddCheckmark('Y stop front:', self.unknownBitmap) + self.yMaxState = self.AddCheckmark('Y stop back:', self.unknownBitmap) + self.zMinState = self.AddCheckmark('Z stop top:', self.unknownBitmap) + self.zMaxState = self.AddCheckmark('Z stop bottom:', self.unknownBitmap) self.comm = None self.xMinStop = False self.xMaxStop = False @@ -232,6 +309,10 @@ class UltimakerCheckupPage(InfoPage): self.zMinStop = False self.zMaxStop = False + def __del__(self): + if self.comm != None: + self.comm.close() + def AllowNext(self): return False @@ -242,7 +323,8 @@ class UltimakerCheckupPage(InfoPage): if self.comm != None: self.comm.close() del self.comm - wx.CallAfter(self.checkState.SetLabel, 'Connecting to machine.') + self.infoBox.SetInfo('Connecting to machine.') + self.infoBox.SetBusyIndicator() self.commState.SetBitmap(self.unknownBitmap) self.tempState.SetBitmap(self.unknownBitmap) self.stopState.SetBitmap(self.unknownBitmap) @@ -250,56 +332,60 @@ class UltimakerCheckupPage(InfoPage): self.comm = machineCom.MachineCom(callbackObject=self) def mcLog(self, message): - print message + pass def mcTempUpdate(self, temp, bedTemp): if self.checkupState == 0: self.tempCheckTimeout = 20 if temp > 70: self.checkupState = 1 - wx.CallAfter(self.checkState.SetLabel, 'Cooldown before temperature check.') + wx.CallAfter(self.infoBox.SetInfo, 'Cooldown before temperature check.') self.comm.sendCommand('M104 S0') self.comm.sendCommand('M104 S0') else: self.startTemp = temp self.checkupState = 2 - wx.CallAfter(self.checkState.SetLabel, 'Checking the heater and temperature sensor.') + wx.CallAfter(self.infoBox.SetInfo, 'Checking the heater and temperature sensor.') self.comm.sendCommand('M104 S200') self.comm.sendCommand('M104 S200') elif self.checkupState == 1: if temp < 60: self.startTemp = temp self.checkupState = 2 - wx.CallAfter(self.checkState.SetLabel, 'Checking the heater and temperature sensor.') + wx.CallAfter(self.infoBox.SetInfo, 'Checking the heater and temperature sensor.') self.comm.sendCommand('M104 S200') self.comm.sendCommand('M104 S200') elif self.checkupState == 2: + print "WARNING, TEMPERATURE TEST DISABLED FOR TESTING!" if temp > self.startTemp:# + 40: self.checkupState = 3 - wx.CallAfter(self.checkState.SetLabel, 'Testing the endstops...') + wx.CallAfter(self.infoBox.SetAttention, 'Please make sure none of the endstops are pressed.') self.comm.sendCommand('M104 S0') self.comm.sendCommand('M104 S0') self.comm.sendCommand('M119') - self.tempState.SetBitmap(self.checkBitmap) + wx.CallAfter(self.tempState.SetBitmap, self.checkBitmap) else: self.tempCheckTimeout -= 1 if self.tempCheckTimeout < 1: self.checkupState = -1 - self.tempState.SetBitmap(self.crossBitmap) - wx.CallAfter(self.checkState.SetLabel, 'Temperature measurement FAILED!') + wx.CallAfter(self.tempState.SetBitmap, self.crossBitmap) + wx.CallAfter(self.infoBox.SetError, 'Temperature measurement FAILED!') self.comm.sendCommand('M104 S0') self.comm.sendCommand('M104 S0') wx.CallAfter(self.temperatureLabel.SetLabel, 'Head temperature: %d' % (temp)) def mcStateChange(self, state): + if self.comm == None: + return if self.comm.isOperational(): - self.commState.SetBitmap(self.checkBitmap) + wx.CallAfter(self.commState.SetBitmap, self.checkBitmap) elif self.comm.isError(): - self.commState.SetBitmap(self.crossBitmap) + wx.CallAfter(self.commState.SetBitmap, self.crossBitmap) + wx.CallAfter(self.infoBox.SetError, 'Failed to establish connection with the printer.') wx.CallAfter(self.machineState.SetLabel, 'Communication State: %s' % (self.comm.getStateString())) def mcMessage(self, message): - if self.checkupState >= 3 and 'x_min' in message: + if self.checkupState >= 3 and self.checkupState < 10 and 'x_min' in message: for data in message.split(' '): if ':' in data: tag, value = data.split(':', 2) @@ -316,6 +402,64 @@ class UltimakerCheckupPage(InfoPage): if tag == 'z_max': self.zMaxStop = (value == 'H') self.comm.sendCommand('M119') + + if self.xMinStop: + self.xMinState.SetBitmap(self.checkBitmap) + else: + self.xMinState.SetBitmap(self.crossBitmap) + if self.xMaxStop: + self.xMaxState.SetBitmap(self.checkBitmap) + else: + self.xMaxState.SetBitmap(self.crossBitmap) + if self.yMinStop: + self.yMinState.SetBitmap(self.checkBitmap) + else: + self.yMinState.SetBitmap(self.crossBitmap) + if self.yMaxStop: + self.yMaxState.SetBitmap(self.checkBitmap) + else: + self.yMaxState.SetBitmap(self.crossBitmap) + if self.zMinStop: + self.zMinState.SetBitmap(self.checkBitmap) + else: + self.zMinState.SetBitmap(self.crossBitmap) + if self.zMaxStop: + self.zMaxState.SetBitmap(self.checkBitmap) + else: + self.zMaxState.SetBitmap(self.crossBitmap) + + if self.checkupState == 3: + if not self.xMinStop and not self.xMaxStop and not self.yMinStop and not self.yMaxStop and not self.zMinStop and not self.zMaxStop: + self.checkupState = 4 + wx.CallAfter(self.infoBox.SetAttention, 'Please press the left X endstop.') + elif self.checkupState == 4: + if self.xMinStop and not self.xMaxStop and not self.yMinStop and not self.yMaxStop and not self.zMinStop and not self.zMaxStop: + self.checkupState = 5 + wx.CallAfter(self.infoBox.SetAttention, 'Please press the right X endstop.') + elif self.checkupState == 5: + if not self.xMinStop and self.xMaxStop and not self.yMinStop and not self.yMaxStop and not self.zMinStop and not self.zMaxStop: + self.checkupState = 6 + wx.CallAfter(self.infoBox.SetAttention, 'Please press the front Y endstop.') + elif self.checkupState == 6: + if not self.xMinStop and not self.xMaxStop and self.yMinStop and not self.yMaxStop and not self.zMinStop and not self.zMaxStop: + self.checkupState = 7 + wx.CallAfter(self.infoBox.SetAttention, 'Please press the back Y endstop.') + elif self.checkupState == 7: + if not self.xMinStop and not self.xMaxStop and not self.yMinStop and self.yMaxStop and not self.zMinStop and not self.zMaxStop: + self.checkupState = 8 + wx.CallAfter(self.infoBox.SetAttention, 'Please press the top Z endstop.') + elif self.checkupState == 8: + if not self.xMinStop and not self.xMaxStop and not self.yMinStop and not self.yMaxStop and self.zMinStop and not self.zMaxStop: + self.checkupState = 9 + wx.CallAfter(self.infoBox.SetAttention, 'Please press the bottom Z endstop.') + elif self.checkupState == 9: + if not self.xMinStop and not self.xMaxStop and not self.yMinStop and not self.yMaxStop and not self.zMinStop and self.zMaxStop: + self.checkupState = 10 + self.comm.close() + wx.CallAfter(self.infoBox.SetInfo, 'Checkup finished') + wx.CallAfter(self.infoBox.SetReadyIndicator) + wx.CallAfter(self.stopState.SetBitmap, self.checkBitmap) + wx.CallAfter(self.OnSkipClick, None) def mcProgress(self, lineNr): pass diff --git a/Cura/images/attention.png b/Cura/images/attention.png new file mode 100644 index 0000000000000000000000000000000000000000..6856987a0c0bb92b9d2280da25761a36d4011fd7 GIT binary patch literal 712 zcmV;(0yq7MP)0$vkD>p$Muv&;}-rp=JyW|5x?V*ip6lJreJy+ zA`x(1h{bRnhm?r;Kivah(-_=B0lmCz-&%Kf(Lw<=1{c`;REdBIW2ht&E$Q~w1MKa! zv_t|mh6*q-G(d#IK!8TM+>#z1Jix(0ODmVrK!An_heH8?IlxV&Jh@o(07pljo=TyB z3(O4+u$G%}n0l?|$&Zg7;P}|nYc(_+rfw}a0|9^)Kr@+-rl%(laCY|5mdUhjD}4dL zsN?V)jne%0GA}P4AeZY*JQ}6xI6MQR{Q&DCxcPi%fY(Uv~z};PUpLiU#mN#I$10ce_-%q1d>izFsT%ac>==*zjd#Qx_{WL__{{R4H zMR1eJ-oYysbYlZuTWj^BmtQj3F4b%sU@cdn5RGcJ_rcRsuS8p0z5S|HG!&v?Emx|F z5s~F)lZA8|>+|)VSz}|~x4+ML^Z6j1#x|QQh{&=y4o@>POq`$hpRB5o%R!|Ai;FNa u($5=~mT-$je#_sqzikQd1F+u|zy1gE$G~!>GQ{Tq0000ogbu literal 0 HcmV?d00001 diff --git a/Cura/images/busy-0.png b/Cura/images/busy-0.png new file mode 100644 index 0000000000000000000000000000000000000000..dfb9142d4c14700b31ca946998aaf8e9a533956b GIT binary patch literal 617 zcmV-v0+#)WP)|WK~zYIm6X3qD^U=}f5!-d2#FAGW2KFq;0s8aJb|TfTPwko zrcWCzQwvu51{MK(k#ySR0g@uuB9bC9x7b-Tdz`bo4oq{-%zX3r3nD^FLI_RZFK`AN z0Y@UTpLFmcs?A(0 zX_U;6mjpnr3k|*tyaC7B(jm~QT9TjvT2#wBaIf}HBJy6thfu~v1;Y@IfiAEQTxca# z@~_Svw8+}A)Sz!XpRn)&EVV7 zF^(O8E04HhZV}+p*yL}c1b5{GxdfV)&j)N+(dq=V=jMHlImU>E`@pT`q60F5^7`0` z0u(O3a!HJ1myBu)+~Q;yC-8&2TmW^xHXth^;z|Haaah;|FqO=JL1M$aHuh5h+e9KF zPa%X;;3NJ^$S3e8^;w%Lz8ykXkhNtBJOg(kl1%15whs{fgppOC00000NkvXXu0mjf Df|dDD literal 0 HcmV?d00001 diff --git a/Cura/images/busy-1.png b/Cura/images/busy-1.png new file mode 100644 index 0000000000000000000000000000000000000000..1a917f4f4d36a7875a93c419fb304cafb3b7ca49 GIT binary patch literal 505 zcmVZ@C&d3 zu2psKi|=~X0ae|L$Ph>zILUpX_)dsmwu;332}ESvz*|RRRSi|e-eCg#0P`Gkd_7h6&;46q;3il&&e|lv%<;`U;`v$R71{^BY6yiS zz{tTz0dY0WKESkrP)I^n5bt(60rC7y^T5QeU{!j|a*`#m^oZ|FV`iEiDR;7n^ngpU zs!D+i`-xlN)o7={4R8RS$O>QuJgDk-K`&xdoB&sr?AhRR6TMf}4_|z2C;!_jvnX&y zpGJEldyj*Nc&`Xreq=a8nYP<#t&fVM47=9HwL=(}gA7k=t{`pT7BmWtrmBzBTN;T~ vG-5k>5{XqTxK-HNva!#?+9D#|&}Q)qzQg~32C17300000NkvXXu0mjfx8v2? literal 0 HcmV?d00001 diff --git a/Cura/images/busy-2.png b/Cura/images/busy-2.png new file mode 100644 index 0000000000000000000000000000000000000000..9de5bd8ca04032b307d85c2a21cd970d025b4b19 GIT binary patch literal 614 zcmV-s0-61ZP)of2Jb*M#UOsz zkAerAmjD=~g8u<%&DX|b0eS@hi=yB$Kn=LlvSa~XfrzM_B8Vl>;q^-02`nc`JV#|BeCmr?Vth-HMjti2wTTtW-GXy7*CU0+$MQ?0h=SqEW(m1w5$#lZdQJWdF1}n7wDCtu%wr<(7T>^@I*tI*?+N?q8WQb^1#oQyUl1)3ep)sWK!g2s zg=Ore0P0FP2v<&9l!*iY{Wmlco0Ad9;5@~zcTN@YOSClrDjY6juphka)N)dhpm?yM z#>QLyTLWiD0r1))DFF4!YS#|vACxE&yvkmZ%=F@RdAdDaTG$T?RBu7C@m19U{BnS5ZJUx)fYh{RvXj{pDw07*qoM6N<$f*gqb ADF6Tf literal 0 HcmV?d00001 diff --git a/Cura/images/busy-3.png b/Cura/images/busy-3.png new file mode 100644 index 0000000000000000000000000000000000000000..d61f905d10315fc630e0ab1ce698739034292aad GIT binary patch literal 471 zcmV;|0Vw{7P)!%z^$e=lUwjZ|5^=r+q9 z!VB~aE$##tt-V3Fg%(keqMJA_oMIB^#fK(1Fc4&5yWKoDOLdX?M94L|lC+c}1c?>WG zmb&a=ahQh4rMf-P&*2Z1YY9x9ek6R^8*r!Fa1N|Qn+a8FWQhbW?9;ba!ELWdL_~cP?peYja~^ zaAhuUa%Y?FJQ@H10u4z-K~zYIwUxh098na;f9KwDXIKzHND&BV5N$*VX@ZT7n!*%5 zgjnq>q!ChzjrbCRl_bcfvP@+Xv~iGtq%j~YTg{F;ds0j$j_bWMBP0jD=HAQs&Yyd} zBdW^(w7_*JA{JN&qK1AF;Ipb`k8V`;5r7>FSsT(Ou#f>ePG1h^GZqGi7S*5`4lQb7 z0L;`9wBTr27&LWWU|ATn;HZ)SSTQg9wG*q&|=hA&ua){7n}PWZjx9uB?B^3Uu=ZXTaivL9=i$FC=#rX$v_nJtTJl zIxi#^4qTHwJpuiF&#-+f4cb=^!M;H!pbt#@#I7?5>8&S=Pd10^?lwRtbD8K=si}=1 z?ijMVMvkLn$RdaVTeoo53}ik*bK(5Hv1{Z0#I^Jzk&iEhw{JWDaz6gQBl*xD#Ibs zA>u?FL!}RML$_+d6a_fg%v>j|KsA`Yrc)L~g_eljrKl z2JusIpNP}~hX4!_u|%XXb~I*Ax9878MNI{mCc?W&XeMAmNSn}?Yk~1r6 z`Nfo|AtH6f4Fz!ib{M=gNY(l(>c6OG;adyYbb1rB7tW@yxew2M+NxZCj?`x45@0KE zcF)~CC6Agr;xc$?kcWRhr2MsVs@|-^@ITEy)1Co=P$YyFlyowUsUfT~d$@C$?BjULp$$d$N zJBRt#cpP}1;hc>7Dr%=`I6YYsyQeUmaU#nMzi|@b^)*dvjGFgqm{Bp~nZ!@BPw4%w zm#d9eJ(TV#EpwbmiRsUJbynVrTK>?gkN{+EWYkXC&ZEB`y}0TBN9ce5w)_M2{0qJM S-?;by0000 literal 0 HcmV?d00001 -- 2.30.2