from gui import icon\r
from gui import toolbarUtil\r
from gui import webcam\r
+from gui import taskbar\r
from util import machineCom\r
from util import profile\r
from util import gcodeInterpreter\r
else:\r
status += 'Print time left: %02d:%02d\n' % (int(printTimeLeft / 60), int(printTimeLeft % 60))\r
self.progress.SetValue(self.machineCom.getPrintPos())\r
+ taskbar.setProgress(self, self.machineCom.getPrintPos(), len(self.gcodeList))\r
if self.machineCom != None:\r
if self.machineCom.getTemp() > 0:\r
status += 'Temp: %d\n' % (self.machineCom.getTemp())\r
self.machineCom.close()\r
self.machineCom = machineCom.MachineCom(callbackObject=self)\r
self.UpdateButtonStates()\r
+ taskbar.setBusy(self, True)\r
\r
def OnLoad(self, e):\r
pass\r
wx.CallAfter(self.bedTemperatureSelect.SetValue, bedTargetTemp)\r
\r
def mcStateChange(self, state):\r
- if self.machineCom != None and state == self.machineCom.STATE_OPERATIONAL and self.cam != None:\r
- self.cam.endTimelaps()\r
+ if self.machineCom != None:\r
+ if state == self.machineCom.STATE_OPERATIONAL and self.cam != None:\r
+ self.cam.endTimelaps()\r
+ if state == self.machineCom.STATE_OPERATIONAL:\r
+ taskbar.setBusy(self, False)\r
+ if self.machineCom.isClosedOrError():\r
+ taskbar.setBusy(self, False)\r
+ if self.machineCom.isPaused():\r
+ taskbar.setPause(self, True)\r
wx.CallAfter(self.UpdateButtonStates)\r
wx.CallAfter(self.UpdateProgress)\r
\r
--- /dev/null
+try:
+ import comtypes.client as cc
+ cc.GetModule('taskbarlib.tlb')
+ import comtypes.gen.TaskbarLib as tbl
+
+ ITaskbarList3 = cc.CreateObject("{56FDF344-FD6D-11d0-958A-006097C9A090}", interface=tbl.ITaskbarList3)
+ ITaskbarList3.HrInit()
+
+ #Stops displaying progress and returns the button to its normal state. Call this method with this flag to dismiss the progress bar when the operation is complete or canceled.
+ TBPF_NOPROGRESS = 0x00000000
+ #The progress indicator does not grow in size, but cycles repeatedly along the length of the taskbar button. This indicates activity without specifying what proportion of the progress is complete. Progress is taking place, but there is no prediction as to how long the operation will take.
+ TBPF_INDETERMINATE = 0x00000001
+ #The progress indicator grows in size from left to right in proportion to the estimated amount of the operation completed. This is a determinate progress indicator; a prediction is being made as to the duration of the operation.
+ TBPF_NORMAL = 0x00000002
+ #The progress indicator turns red to show that an error has occurred in one of the windows that is broadcasting progress. This is a determinate state. If the progress indicator is in the indeterminate state, it switches to a red determinate display of a generic percentage not indicative of actual progress.
+ TBPF_ERROR = 0x00000004
+ #The progress indicator turns yellow to show that progress is currently stopped in one of the windows but can be resumed by the user. No error condition exists and nothing is preventing the progress from continuing. This is a determinate state. If the progress indicator is in the indeterminate state, it switches to a yellow determinate display of a generic percentage not indicative of actual progress.
+ TBPF_PAUSED = 0x00000008
+except:
+ #The taskbar API is only available for Windows7, on lower windows versions, linux or Mac it will cause an exception. Ignore the exception and don't use the API
+ ITaskbarList3 = None
+
+def setBusy(frame, busy):
+ if ITaskbarList3 != None:
+ if busy:
+ ITaskbarList3.SetProgressState(frame.GetHandle(), TBPF_INDETERMINATE)
+ else:
+ ITaskbarList3.SetProgressState(frame.GetHandle(), TBPF_NOPROGRESS)
+
+def setPause(frame, pause):
+ if ITaskbarList3 != None:
+ if pause:
+ ITaskbarList3.SetProgressState(frame.GetHandle(), TBPF_PAUSED)
+ else:
+ ITaskbarList3.SetProgressState(frame.GetHandle(), TBPF_NORMAL)
+
+def setProgress(frame, done, total):
+ if ITaskbarList3 != None:
+ ITaskbarList3.SetProgressState(frame.GetHandle(), TBPF_NORMAL)
+ ITaskbarList3.SetProgressValue(frame.GetHandle(), done, total)
except:
#If the log queue is full, remove the first message and append the new message again
self._logQueue.get()
- self._logQueue.put(message, False)
+ try:
+ self._logQueue.put(message, False)
+ except:
+ pass
def _readline(self):
if self._serial == None:
downloadURL http://sourceforge.net/projects/numpy/files/NumPy/1.6.2/numpy-1.6.2-win32-superpack-python2.7.exe
downloadURL http://videocapture.sourceforge.net/VideoCapture-0.9-5.zip
downloadURL http://ffmpeg.zeranoe.com/builds/win32/static/ffmpeg-20120927-git-13f0cd6-win32-static.7z
+ downloadURL http://sourceforge.net/projects/comtypes/files/comtypes/0.6.2/comtypes-0.6.2.win32.exe
#Get pypy
downloadURL https://bitbucket.org/pypy/pypy/downloads/pypy-${PYPY_VERSION}-win32.zip
else
extract VideoCapture-0.9-5.zip VideoCapture-0.9-5/Python27/DLLs/vidcap.pyd
extract ffmpeg-20120927-git-13f0cd6-win32-static.7z ffmpeg-20120927-git-13f0cd6-win32-static/bin/ffmpeg.exe
extract ffmpeg-20120927-git-13f0cd6-win32-static.7z ffmpeg-20120927-git-13f0cd6-win32-static/licenses
+ extract comtypes-0.6.2.win32.exe
mkdir -p ${TARGET_DIR}/python
mkdir -p ${TARGET_DIR}/Cura/
mv \$_OUTDIR/Lib/site-packages/wx* ${TARGET_DIR}/python/Lib/site-packages/
mv PURELIB/serial ${TARGET_DIR}/python/Lib
mv PURELIB/OpenGL ${TARGET_DIR}/python/Lib
+ mv PURELIB/comtypes ${TARGET_DIR}/python/Lib
mv PLATLIB/numpy ${TARGET_DIR}/python/Lib
mv VideoCapture-0.9-5/Python27/DLLs/vidcap.pyd ${TARGET_DIR}/python/DLLs
mv ffmpeg-20120927-git-13f0cd6-win32-static/bin/ffmpeg.exe ${TARGET_DIR}/Cura/