class Controller(MakesmithInitFuncs): """ NonVisibleWidgets is a home for widgets which do not have a visible representation like the serial connection, but which still need to be tied in to the rest of the program. """ actions = Actions() gracefulKiller = GracefulKiller() logger = Logger() config = Config() watchdog = WatchDog() ui_queue = queue.Queue() message_queue = LoggingQueue(logger) def setUpData(self, data): """ The setUpData function is called when a widget is first created to give that widget access to the global data object. This should be replaced with a supper classed version of the __init__ function. """ self.data = data self.data.actions = self.actions self.data.gracefulKiller = self.gracefulKiller self.data.logger = self.logger self.data.config = self.config self.data.ui_queue = self.ui_queue self.data.message_queue = self.message_queue self.data.watchdog = self.watchdog self.actions.setUpData(data) self.gracefulKiller.setUpData(data) self.logger.setUpData(data) self.config.setUpData(data) self.watchdog.setUpData(data) self.watchdog.checkForRunningContainer()
class Data(EventDispatcher): ''' Data is a set of variables which are essentially global variables which hold information about the gcode file opened, the machine which is connected, and the user's settings. These variables are NOT thread-safe. The queue system should always be used for passing information between threads. ''' ''' Data available to all widgets ''' #Gcodes contains all of the lines of gcode in the opened file gcode = ObjectProperty([]) version = '1.28' #all of the available COM ports comPorts = [] #This defines which COM port is used comport = StringProperty("") #The index of the next unread line of Gcode gcodeIndex = NumericProperty(0) # Baud rate baudRate = NumericProperty(57600) #Index of changes in z zMoves = ObjectProperty([]) #Holds the current value of the feed rate feedRate = 20 #holds the address of the g-code file so that the gcode can be refreshed gcodeFile = StringProperty("") #the current position of the cutting head currentpos = [0.0, 0.0, 0.0] target = [0.0, 0.0, 0.0] units = OptionProperty("MM", options=["MM", "INCHES"]) tolerance = NumericProperty(0.5) gcodeShift = ObjectProperty( [0.0, 0.0]) #the amount that the gcode has been shifted logger = Logger( ) #the module which records the machines behavior to review later # Background image stuff, persist but not saved backgroundFile = None backgroundTexture = None backgroundManualReg = [] backgroundRedraw = BooleanProperty(False) ''' Flags ''' #sets a flag if the gcode is being uploaded currently uploadFlag = BooleanProperty(0) #this is used to determine the first time the position is received from the machine firstTimePosFlag = 0 #report if the serial connection is open connectionStatus = BooleanProperty(0) #is the calibration process currently underway 0 -> false calibrationInProcess = False ''' Pointers to Objects ''' config = None #pointer to the program configuration object...used for writing to settings serialPort = None #this is a pointer to the program serial port object ''' Colors ''' fontColor = StringProperty('[color=7a7a7a]') drawingColor = ObjectProperty([.47, .47, .47]) iconPath = StringProperty('./Images/Icons/normal/') posIndicatorColor = ObjectProperty([0, 0, 0]) targetInicatorColor = ObjectProperty([1, 0, 0]) ''' Misc UI bits that need to be saved between invocations (but not saved) ''' zPush = None zPushUnits = 'MM' zReadoutPos = 0.00 zPopupUnits = None zStepSizeVal = 0.1 ''' Queues ''' message_queue = LoggingQueue(logger) gcode_queue = Queue.Queue() quick_queue = Queue.Queue() def __init__(self): ''' Initializations. ''' self.logger.data = self
class Data: """ Data is a set of variables which are essentially global variables which hold information about the gcode file opened, the machine which is connected, and the user's settings. These variables are NOT thread-safe. The queue system should always be used for passing information between threads. """ """ Data available to all widgets """ # Gcodes contains all of the lines of gcode in the opened file clients = [] gcode = [] gcodeFileUnits = "INCHES" sentCustomGCode = "" compressedGCode = None compressedGCode3D = None version = "1.27" stockFirmwareVersion = None customFirmwareVersion = None holeyFirmwareVersion = None controllerFirmwareVersion = 0 ''' Version Updater ''' lastChecked = -1 pyInstallCurrentVersion = 0.94 pyInstallUpdateAvailable = False pyInstallUpdateBrowserUrl = "" pyInstallUpdateVersion = 0 pyInstallPlatform = "win" pyInstallType = "singlefile" pyInstallInstalledPath = "" # all of the available COM ports comPorts = [] # This defines which COM port is used comport = "" # stores value to indicate whether or not fake_servo is enabled fakeServoStatus = False # The index of the next unread line of Gcode gcodeIndex = 0 # Index of changes in z zMoves = [] # Holds the current value of the feed rate feedRate = 20 # holds the address of the g-code file so that the gcode can be refreshed gcodeFile = "" importFile = "" # holds the current gcode x,y,z position currentGcodePost = [0.0, 0.0, 0.0] # the current position of the cutting head currentpos = [0.0, 0.0, 0.0] target = [0.0, 0.0, 0.0] units = "MM" # Gcode positioning mode: # 0 = G90 (Absolute) # 1 = G91 (Relative) positioningMode = 0 tolerance = 0.5 gcodeShift = [0.0, 0.0] # the amount that the gcode has been shifted currentTool = 0 # current tool.. upon startup, 0 is the same value as what the controller would have. currentZTarget = 0 # current target for Z-Axis move. Need to track so if user pauses, we can move back to that spot. message = "" # used to update the client logger = Logger( ) # the module which records the machines behavior to review later config = Config() # Background image stuff, persist but not saved backgroundFile = None backgroundTexture = None backgroundManualReg = [] backgroundRedraw = False """ Flags """ # sets a flag if the gcode is being uploaded currently uploadFlag = 0 previousUploadStatus = 0 manualZAxisAdjust = False # this is used to determine the first time the position is received from the machine firstTimePosFlag = 0 # report if the serial connection is open connectionStatus = 0 # is the calibration process currently underway 0 -> false calibrationInProcess = False inPIDVelocityTest = False inPIDPositionTest = False PIDVelocityTestVersion = 0 PIDPositionTestVersion = 0 """ Pointers to Objects """ serialPort = None # this is a pointer to the program serial port object requestSerialClose = False # this is used to request the serialThread to gracefully close the port triangularCalibration = None # points to the triangular calibration object holeyCalibration = None # points to the triangular calibration object opticalCalibration = None # points to the optical calibration object opticalCalibrationImage = None # stores the current image opticalCalibrationImageUpdated = False # stores whether its been updated or not opticalCalibrationTestImage = None # stores the current image opticalCalibrationTestImageUpdated = False # stores whether its been updated or not cameraImage = None cameraImageUpdated = False continuousCamera = False gpioActions = None boardManager = None """ Colors """ fontColor = "[color=7a7a7a]" drawingColor = [0.47, 0.47, 0.47] posIndicatorColor = [0, 0, 0] targetIndicatorColor = [1, 0, 0] """ Misc UI bits that need to be saved between invocations (but not saved) """ zPush = None zPushUnits = "MM" zReadoutPos = 0.00 zPopupUnits = None zStepSizeVal = 0.1 """ Queues """ message_queue = LoggingQueue(logger) ui_controller_queue = queue.Queue() ui_queue1 = UIQueue() alog_streamer_queue = queue.Queue( 1000) # used for sending log to client screen.. limit to 1000 "items" log_streamer_queue = queue.Queue( 1000) # used for sending log to client screen.. limit to 1000 "items" console_queue = queue.Queue() # used for printing to terminal mcp_queue = queue.Queue( ) # used for sending messages to WebMCP(if enabled) webMCPActive = False # start false until WebMCP connects gcode_queue = queue.Queue() quick_queue = queue.Queue() """ Position and Error values """ xval = 0.0 yval = 0.0 zval = 0.0 xval_prev = -99990.0 yval_prev = -99990.0 zval_prev = -99990.0 leftError = 0.0 rightError = 0.0 leftError_prev = -99999.0 rightError_prev = -99999.9 """ Chain lengths as reported by controller """ leftChain = 1610 rightChain = 1610 """ Sled position computed from controller reported chain lengths """ computedX = 0 computedY = 0 """ Buffer size as reported by controller """ bufferSize = 127 pausedzval = None pausedPositioningMode = 0 pausedUnits = "INCHES" """ GCode Position Values """ previousPosX = 0.0 previousPosY = 0.0 previousPosZ = 0.0 """ Board data """ currentBoard = None shutdown = False hostAddress = "-" platform = "RPI" platformHome = "" def __init__(self): """ Initializations. """ self.logger.data = self self.config.data = self
class Data(EventDispatcher): ''' Data is a set of variables which are essentially global variables which hold information about the gcode file opened, the machine which is connected, and the user's settings. These variables are NOT thread-safe. The queue system should always be used for passing information between threads. ''' ''' Data available to all widgets ''' #Gcodes contains all of the lines of gcode in the opened file gcode = ObjectProperty([]) version = '0.89' #all of the available COM ports comPorts = [] #This defines which COM port is used comport = StringProperty("") #The index of the next unread line of Gcode gcodeIndex = NumericProperty(0) #Index of changes in z zMoves = ObjectProperty([]) #Holds the current value of the feed rate feedRate = 20 #holds the address of the g-code file so that the gcode can be refreshed gcodeFile = StringProperty("") #the current position of the cutting head currentpos = [0.0, 0.0, 0.0] target = [0.0, 0.0, 0.0] units = OptionProperty("MM", options=["MM", "INCHES"]) tolerance = NumericProperty(0.5) gcodeShift = ObjectProperty([0.0,0.0]) #the amount that the gcode has been shifted logger = Logger() #the module which records the machines behavior to review later ''' Flags ''' #sets a flag if the gcode is being uploaded currently uploadFlag = BooleanProperty(0) #this is used to determine the first time the position is received from the machine firstTimePosFlag = 0 #report if the serial connection is open connectionStatus = BooleanProperty(0) ''' Pointers to Objects ''' config = None #pointer to the program configuration object...used for writing to settings serialPort = None #this is a pointer to the program serial port object ''' Queues ''' message_queue = Queue.Queue() gcode_queue = Queue.Queue() quick_queue = Queue.Queue() def __init__(self): ''' Initializations. ''' self.logger.data = self
class Data: """ Data is a set of variables which are essentially global variables which hold information about the gcode file opened, the machine which is connected, and the user's settings. These variables are NOT thread-safe. The queue system should always be used for passing information between threads. """ """ Data available to all widgets """ # Gcodes contains all of the lines of gcode in the opened file clients = [] gcode = [] gcodeFileUnits = "INCHES" compressedGCode = None compressedGCode3D = None version = "101.25" stockFirmwareVersion = "" customFirmwareVersion = "" controllerFirmwareVersion = 0 # all of the available COM ports comPorts = [] # This defines which COM port is used comport = "" # The index of the next unread line of Gcode gcodeIndex = 0 # Index of changes in z zMoves = [] # Holds the current value of the feed rate feedRate = 20 # holds the address of the g-code file so that the gcode can be refreshed gcodeFile = "" importFile = "" # the current position of the cutting head currentpos = [0.0, 0.0, 0.0] target = [0.0, 0.0, 0.0] units = "MM" tolerance = 0.5 gcodeShift = [0.0, 0.0] # the amount that the gcode has been shifted message = "" # used to update the client logger = Logger( ) # the module which records the machines behavior to review later config = Config() # Background image stuff, persist but not saved backgroundFile = None backgroundTexture = None backgroundManualReg = [] backgroundRedraw = False """ Flags """ # sets a flag if the gcode is being uploaded currently uploadFlag = 0 previousUploadStatus = 0 manualZAxisAdjust = False # this is used to determine the first time the position is received from the machine firstTimePosFlag = 0 # report if the serial connection is open connectionStatus = 0 # is the calibration process currently underway 0 -> false calibrationInProcess = False inPIDVelocityTest = False inPIDPositionTest = False PIDVelocityTestVersion = 0 PIDPositionTestVersion = 0 """ Pointers to Objects """ serialPort = None # this is a pointer to the program serial port object requestSerialClose = False # this is used to request the serialThread to gracefully close the port triangularCalibration = None # points to the triangular calibration object opticalCalibration = None # points to the optical calibration object opticalCalibrationImage = None # stores the current image opticalCalibrationImageUpdated = False # stores whether its been updated or not opticalCalibrationTestImage = None # stores the current image opticalCalibrationTestImageUpdated = False # stores whether its been updated or not cameraImage = None cameraImageUpdated = False continuousCamera = False """ Colors """ fontColor = "[color=7a7a7a]" drawingColor = [0.47, 0.47, 0.47] posIndicatorColor = [0, 0, 0] targetIndicatorColor = [1, 0, 0] """ Misc UI bits that need to be saved between invocations (but not saved) """ zPush = None zPushUnits = "MM" zReadoutPos = 0.00 zPopupUnits = None zStepSizeVal = 0.1 """ Queues """ message_queue = LoggingQueue(logger) ui_controller_queue = queue.Queue() ui_queue1 = UIQueue() console_queue = queue.Queue() # used for printing to terminal mcp_queue = queue.Queue( ) # used for sending messages to WebMCP(if enabled) webMCPActive = False # start false until WebMCP connects gcode_queue = queue.Queue() quick_queue = queue.Queue() """ Position and Error values """ xval = 0.0 yval = 0.0 zval = 0.0 pausedzval = 0.0 previousPosX = 0.0 previousPosY = 0.0 previousPosZ = 0.0 shutdown = False def __init__(self): """ Initializations. """ self.logger.data = self self.config.data = self