Ejemplo n.º 1
0
    def __open_actuator_setup_window(self, menu_item):
        """ Opens the actuator setup window

        Keyword arguments:
        menu_item -- object the action occured on

        """
        # set the combo box values
        com_port_combo = self.__builder.get_object("com_port_combo")
        available_com_ports = facade.get_available_com_ports()
        com_port_liststore = self.__builder.get_object("com_port_liststore")
        com_port_liststore.clear()

        for com_port_info in available_com_ports:
            com_port_combo.append_text(com_port_info[0])

        com_port_combo.set_active(0)

        # set the current actuator step value in the textbox
        actuator_step_entry = self.__builder.get_object("actuator_step_entry")
        actuator_step_entry.set_text(str(facade.get_speed()))

        actuator_setup_window = self.__builder.get_object("actuator_setup_window")
        # do not listen for close events in order for the close button on the
        # window to work, as you are unable to add a signal to the close button
        actuator_setup_window.run()
        actuator_setup_window.hide()

        # sets the com-port for the actuators
        facade.set_com_port(com_port_combo.get_active_text())

        # sets the actuator step
        actuator_step = actuator_step_entry.get_text()

        if actuator_step.isdigit():
            facade.change_speed(int(actuator_step), None)
        else:
            log.log_error(
                "The magnitude of actuator step must be an integer," " '{0}' is not an integer.".format(magnitude)
            )

        # switches the actuator axis if the box was checked
        switch_actuator_axis = self.__builder.get_object("switch_actuator_axis")

        if switch_actuator_axis.get_active():
            facade.switch_actuator_axis()
            switch_actuator_axis.set_active(False)
Ejemplo n.º 2
0
    def __open_actuator_setup_window(self, menu_item):
        """ Opens the actuator setup window

        Keyword arguments:
        menu_item -- object the action occured on

        """
        #set the combo box values
        com_port_combo = self.__builder.get_object("com_port_combo")
        available_com_ports = facade.get_available_com_ports()
        com_port_liststore = self.__builder.get_object("com_port_liststore")
        com_port_liststore.clear()

        for com_port_info in available_com_ports:
            com_port_combo.append_text(com_port_info[0])

        com_port_combo.set_active(0)

        #set the current actuator step value in the textbox
        actuator_step_entry = self.__builder.get_object("actuator_step_entry")
        actuator_step_entry.set_text(str(facade.get_speed()))

        actuator_setup_window = self.__builder.get_object("actuator_setup_window")
        # do not listen for close events in order for the close button on the
        # window to work, as you are unable to add a signal to the close button
        actuator_setup_window.run()
        actuator_setup_window.hide()

        #sets the com-port for the actuators
        facade.set_com_port(com_port_combo.get_active_text())

        #sets the actuator step
        actuator_step = actuator_step_entry.get_text()

        if actuator_step.isdigit():
            facade.change_speed(int(actuator_step), None)
        else:
            log.log_error("The magnitude of actuator step must be an integer,"\
                          " '{0}' is not an integer.".format(magnitude))

        #switches the actuator axis if the box was checked
        switch_actuator_axis = self.__builder.get_object("switch_actuator_axis")

        if switch_actuator_axis.get_active():
            facade.switch_actuator_axis()
            switch_actuator_axis.set_active(False)
Ejemplo n.º 3
0
    def __initialize_com_port(self):
        """ Initializes to the first available COM port """
        available_com_ports = facade.get_available_com_ports()

        if len(available_com_ports) > 0:
            facade.set_com_port(available_com_ports[0][0])