Example #1
0
    def __init__(self):

        if USE_MOTORS:
            self.mZAxis = MotorAxis(2)
            self.mYAxis = MotorAxis(1)
            self.mRotAxis = MotorAxis(3)
            can_control.enableMotors()

        self.MOTOR1_MAPPINGS = [
            self.mZAxis, self.mYAxis, self.mRotAxis, self.mZAxis,
            self.mRotAxis, self.mZAxis
        ]
        self.MOTOR2_MAPPINGS = [
            None, None, None, self.mYAxis, self.mZAxis, self.mRotAxis
        ]

        self.builder = gtk.Builder()
        self.builder.add_from_file("diff_control.glade")
        self.init_values()  # init values before connecting the fields

        self.builder.connect_signals(self)
        self.mScanRunning = False

        for i in NUM_SIGNED_FLOAT_FIELD_NAMES:
            entry = self.builder.get_object(i)
            self.numerify_float_signed(entry)

        for i in NUM_FLOAT_FIELD_NAMES:
            entry = self.builder.get_object(i)
            self.numerify_float(entry)

        for i in NUM_INTEGER_FIELD_NAMES:
            entry = self.builder.get_object(i)
            self.numerify_integer(entry)

        entry = self.builder.get_object('acq_filename_entry')
        self.constrain_filename(entry)
        self.update_view()
        self.mLastLoadedConfigFileName = ''

        # if threads do not wor, pygtk may have been compiled without thread support
        #        gtk.gdk.threads_init() # Needed for pygtk and threads to work and able to touch GUI
        gobject.threads_init()  # Alternatively, threads do not touch GUI
Example #2
0
    def __init__(self):
        # initialize the axes
        self.mAxRot = MotorAxis(3)
        self.mMode = RotationApp.MODE_WAITING
        self.mIsRunning = True

        self.builder = gtk.Builder()
        self.builder.add_from_file("continuous_rotation_app.glade")
        self.builder.connect_signals(self)
        self.read_values_from_canbus()
        self.builder.get_object("startStopButton").set_label("Start")

        gtk.gdk.threads_init()

        self.mControlThread = threading.Thread(target=self.controlMethod)
        self.mControlThread.start()