chiark / gitweb /
Add already elapsed printing and estimated remaining printing time. Fix the capture...
authordaid303 <daid303@gmail.com>
Mon, 1 Oct 2012 12:51:59 +0000 (14:51 +0200)
committerdaid303 <daid303@gmail.com>
Mon, 1 Oct 2012 12:51:59 +0000 (14:51 +0200)
Cura/gui/printWindow.py
Cura/gui/webcam.py
Cura/util/machineCom.py

index a9846f09376d192793f6474b0cc2f7917d174881..5a1ef33859359c917954700fc28b14e21b727bbe 100644 (file)
@@ -181,15 +181,15 @@ class printWindow(wx.Frame):
                sizer.Add(PrintCommandButton(self, 'G1 X10 F6000', 'print-move-x10.png'), pos=(3,5))\r
                sizer.Add(PrintCommandButton(self, 'G1 X100 F6000', 'print-move-x100.png'), pos=(3,6))\r
 \r
-               sizer.Add(PrintCommandButton(self, 'G1 Z10 F200', 'print-move-z10.png'), pos=(0,7))\r
-               sizer.Add(PrintCommandButton(self, 'G1 Z1 F200', 'print-move-z1.png'), pos=(1,7))\r
-               sizer.Add(PrintCommandButton(self, 'G1 Z0.1 F200', 'print-move-z0.1.png'), pos=(2,7))\r
+               sizer.Add(PrintCommandButton(self, 'G1 Z10 F200', 'print-move-z10.png'), pos=(0,8))\r
+               sizer.Add(PrintCommandButton(self, 'G1 Z1 F200', 'print-move-z1.png'), pos=(1,8))\r
+               sizer.Add(PrintCommandButton(self, 'G1 Z0.1 F200', 'print-move-z0.1.png'), pos=(2,8))\r
 \r
-               sizer.Add(PrintCommandButton(self, 'G28 Z0', 'print-move-home.png'), pos=(3,7))\r
+               sizer.Add(PrintCommandButton(self, 'G28 Z0', 'print-move-home.png'), pos=(3,8))\r
 \r
-               sizer.Add(PrintCommandButton(self, 'G1 Z-0.1 F200', 'print-move-z-0.1.png'), pos=(4,7))\r
-               sizer.Add(PrintCommandButton(self, 'G1 Z-1 F200', 'print-move-z-1.png'), pos=(5,7))\r
-               sizer.Add(PrintCommandButton(self, 'G1 Z-10 F200', 'print-move-z-10.png'), pos=(6,7))\r
+               sizer.Add(PrintCommandButton(self, 'G1 Z-0.1 F200', 'print-move-z-0.1.png'), pos=(4,8))\r
+               sizer.Add(PrintCommandButton(self, 'G1 Z-1 F200', 'print-move-z-1.png'), pos=(5,8))\r
+               sizer.Add(PrintCommandButton(self, 'G1 Z-10 F200', 'print-move-z-10.png'), pos=(6,8))\r
 \r
                nb.AddPage(self.directControlPanel, 'Jog')\r
 \r
@@ -346,8 +346,13 @@ class printWindow(wx.Frame):
                        if self.gcodeList != None:\r
                                status += 'Line: -/%d\n' % (len(self.gcodeList))\r
                else:\r
+                       printTime = self.machineCom.getPrintTime() / 60\r
+                       printTimeTotal = printTime * len(self.gcodeList) / self.machineCom.getPrintPos()\r
+                       printTimeLeft = printTimeTotal - printTime\r
                        status += 'Line: %d/%d\n' % (self.machineCom.getPrintPos(), len(self.gcodeList))\r
                        status += 'Height: %f\n' % (self.currentZ)\r
+                       status += 'Print time: %02d:%02d\n' % (int(printTime / 60), int(printTime % 60))\r
+                       status += 'Print time left: %02d:%02d\n' % (int(printTimeLeft / 60), int(printTimeLeft % 60))\r
                        self.progress.SetValue(self.machineCom.getPrintPos())\r
                if self.machineCom != None:\r
                        if self.machineCom.getTemp() > 0:\r
index cf5448aace869d3d83fdc72ac216de6188d8dc6b..e511c18045f9fd89b45b58d9bfb1d15a138e954f 100644 (file)
@@ -63,7 +63,11 @@ class webcam(object):
                        if pageType == 0:\r
                                self._cam.displaycapturefilterproperties()\r
                        else:\r
-                               self._cam.displaycapturepinproperties()\r
+                               del self._cam\r
+                               self._cam = None\r
+                               tmp = win32vidcap.new_Dev(0, False)\r
+                               tmp.displaycapturepinproperties()\r
+                               self._cam = tmp\r
        \r
        def takeNewImage(self):\r
                if self._cam == None:\r
index b77ce98bdbe174506242e3b714aaec5f77b8d2ca..06567d3c26bb5412ab6abf6bf56b3f79096acfff 100644 (file)
@@ -239,6 +239,9 @@ class MachineCom(object):
        def getPrintPos(self):
                return self._gcodePos
        
+       def getPrintTime(self):
+               return time.time() - self._printStartTime
+       
        def isPaused(self):
                return self._state == self.STATE_PAUSED
        
@@ -433,6 +436,7 @@ class MachineCom(object):
                self._gcodePos = 0
                self._printSection = 'CUSTOM'
                self._changeState(self.STATE_PRINTING)
+               self._printStartTime = time.time()
                for i in xrange(0, 6):
                        self._sendNext()