1 __copyright__ = "Copyright (C) 2013 David Braam - Released under terms of the AGPLv3 License"
5 import httplib as httpclient
9 from Cura.util.printerConnection import printerConnectionBase
11 #Dummy printer class which is always
12 class dummyConnection(printerConnectionBase.printerConnectionBase):
14 super(dummyConnection, self).__init__()
16 self._printing = False
18 self._progressLine = 0
20 self.printThread = threading.Thread(target=self._dummyThread)
21 self.printThread.daemon = True
22 self.printThread.start()
24 #Load the file into memory for printing.
25 def loadFile(self, filename):
29 f = open(filename, "r")
31 #Strip out comments, we do not need to send comments
33 line = line[:line.index(';')]
34 #Strip out whitespace at the beginning/end this saves data to send.
43 #Start printing the previously loaded file
45 if self._printing or self._lineCount < 1:
47 self._progressLine = 0
50 #Abort the previously loaded print file
51 def cancelPrint(self):
52 self._printing = False
57 #Amount of progression of the current print file. 0.0 to 1.0
58 def getPrintProgress(self):
59 if self._lineCount < 1:
61 return float(self._progressLine) / float(self._lineCount)
63 # Return if the printer with this connection type is available
64 def isAvailable(self):
67 # Get the connection status string. This is displayed to the user and can be used to communicate
68 # various information to the user.
69 def getStatusString(self):
70 return "DUMMY!\n%i %i\n%i" % (self._progressLine, self._lineCount, self._printing)
72 def _dummyThread(self):
74 if not self._printing:
79 self._progressLine += 1
80 if self._progressLine == self._lineCount:
81 self._printing = False