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.
41 #Start printing the previously loaded file
43 if self._printing or self._lineCount < 1:
45 self._progressLine = 0
48 #Abort the previously loaded print file
49 def cancelPrint(self):
50 self._printing = False
55 #Amount of progression of the current print file. 0.0 to 1.0
56 def getPrintProgress(self):
57 if self._lineCount < 1:
59 return float(self._progressLine) / float(self._lineCount)
61 # Return if the printer with this connection type is available
62 def isAvailable(self):
65 # Get the connection status string. This is displayed to the user and can be used to communicate
66 # various information to the user.
67 def getStatusString(self):
70 def _dummyThread(self):
72 if not self._printing:
76 self._progressLine += 1
77 if self._progressLine == self._lineCount:
78 self._printing = False