1 __copyright__ = "Copyright (C) 2013 David Braam - Released under terms of the AGPLv3 License"
3 from Cura.util import version
4 from Cura.util.printerConnection import dummyConnection
5 from Cura.util.printerConnection import doodle3dConnect
7 class connectionEntry(object):
8 def __init__(self, name, priority, icon, connection):
10 self.priority = priority
12 self.connection = connection
15 def __cmp__(self, other):
16 return self.priority - other.priority
21 class PrinterConnectionManager(object):
23 self._connectionList = []
24 if version.isDevVersion():
25 self._connectionList.append(connectionEntry('Dummy', -1, 5, dummyConnection.dummyConnection()))
26 self._connectionList.append(connectionEntry('Doodle3D', 100, 27, doodle3dConnect.doodle3dConnect()))
28 #Sort the connections by highest priority first.
29 self._connectionList.sort(reverse=True)
31 #Return the highest priority available connection.
32 def getAvailableConnection(self):
33 for e in self._connectionList:
34 if e.connection.isAvailable():