Ejemplo n.º 1
0
 def __set_available_options(self):
     """
     Set the sensitive state of various components based on the current
     selection of other components. 
     """
     
     sel_type = self.__get_selected_type();
     uinput_type = g15profile.is_uinput_type(sel_type)
     opposite_state = g15driver.KEY_STATE_UP if \
                            self.editing_macro.activate_on == \
                            g15driver.KEY_STATE_HELD else \
                            g15driver.KEY_STATE_HELD
     key_conflict = self.selected_profile.get_macro(opposite_state, \
                                        self.editing_macro.memory,
                                        self.editing_macro.keys) is not None
     
     self.__uinput_tree.set_sensitive(uinput_type)
     self.__run_in_background.set_sensitive(sel_type == g15profile.MACRO_COMMAND)
     self.__command.set_sensitive(sel_type == g15profile.MACRO_COMMAND)
     self.__browse_for_command.set_sensitive(sel_type == g15profile.MACRO_COMMAND)
     self.__simple_macro.set_sensitive(sel_type == g15profile.MACRO_SIMPLE)
     self.__macro_script.set_sensitive(sel_type == g15profile.MACRO_SCRIPT)
     self.__action_tree.set_sensitive(sel_type == g15profile.MACRO_ACTION)
     self.__activate_on_combo.set_sensitive(not uinput_type and not key_conflict)
     self.__repeat_mode_combo.set_sensitive(self.__activate_on_combo.get_active() != 2)
     self.__override_default_repeat.set_sensitive(self.editing_macro.repeat_mode != g15profile.NO_REPEAT)
     self.__turbo_box.set_sensitive(self.editing_macro.repeat_mode != g15profile.NO_REPEAT and self.__override_default_repeat.get_active())
     
     self.__simple_box.set_visible(sel_type == g15profile.MACRO_SIMPLE)
     self.__command_box.set_visible(sel_type == g15profile.MACRO_COMMAND)
     self.__action_box.set_visible(sel_type == g15profile.MACRO_ACTION)
     self.__script_box.set_visible(sel_type == g15profile.MACRO_SCRIPT)
     self.__show_script_editor.set_visible(sel_type == g15profile.MACRO_SCRIPT)
     self.__uinput_box.set_visible(uinput_type)
Ejemplo n.º 2
0
    def __set_available_options(self):
        """
        Set the sensitive state of various components based on the current
        selection of other components. 
        """

        sel_type = self.__get_selected_type()
        uinput_type = g15profile.is_uinput_type(sel_type)
        opposite_state = g15driver.KEY_STATE_UP if \
                               self.editing_macro.activate_on == \
                               g15driver.KEY_STATE_HELD else \
                               g15driver.KEY_STATE_HELD
        key_conflict = self.selected_profile.get_macro(opposite_state, \
                                           self.editing_macro.memory,
                                           self.editing_macro.keys) is not None

        self.__uinput_tree.set_sensitive(uinput_type)
        self.__run_in_background.set_sensitive(
            sel_type == g15profile.MACRO_COMMAND)
        self.__command.set_sensitive(sel_type == g15profile.MACRO_COMMAND)
        self.__browse_for_command.set_sensitive(
            sel_type == g15profile.MACRO_COMMAND)
        self.__simple_macro.set_sensitive(sel_type == g15profile.MACRO_SIMPLE)
        self.__macro_script.set_sensitive(sel_type == g15profile.MACRO_SCRIPT)
        self.__action_tree.set_sensitive(sel_type == g15profile.MACRO_ACTION)
        self.__activate_on_combo.set_sensitive(not uinput_type
                                               and not key_conflict)
        self.__repeat_mode_combo.set_sensitive(
            self.__activate_on_combo.get_active() != 2)
        self.__override_default_repeat.set_sensitive(
            self.editing_macro.repeat_mode != g15profile.NO_REPEAT)
        self.__turbo_box.set_sensitive(
            self.editing_macro.repeat_mode != g15profile.NO_REPEAT
            and self.__override_default_repeat.get_active())

        self.__simple_box.set_visible(sel_type == g15profile.MACRO_SIMPLE)
        self.__command_box.set_visible(sel_type == g15profile.MACRO_COMMAND)
        self.__action_box.set_visible(sel_type == g15profile.MACRO_ACTION)
        self.__script_box.set_visible(sel_type == g15profile.MACRO_SCRIPT)
        self.__show_script_editor.set_visible(
            sel_type == g15profile.MACRO_SCRIPT)
        self.__uinput_box.set_visible(uinput_type)
Ejemplo n.º 3
0
 def __load_keys(self):
     """
     Load the available keys for the selected macro type
     """
     sel_type = self.__get_selected_type()
     filter_text = self.__filter.get_text().strip().lower()
     if g15profile.is_uinput_type(sel_type):
         (model, path) = self.__uinput_tree.get_selection().get_selected()
         sel = None
         if path:
             sel = model[path][0]
         model.clear()
         found = False
         for n, v in g15uinput.get_buttons(sel_type):
             if len(filter_text) == 0 or filter_text in n.lower():
                 model.append([n, v])
                 if n == sel:
                     self.__select_tree_row(self.__uinput_tree, len(model))
                     found = True
         (model, path) = self.__uinput_tree.get_selection().get_selected()
         if not found and len(model) > 0:
             self.__select_tree_row(self.__uinput_tree, 0)
Ejemplo n.º 4
0
 def __load_keys(self):
     """
     Load the available keys for the selected macro type
     """
     sel_type = self.__get_selected_type()
     filter_text = self.__filter.get_text().strip().lower()
     if g15profile.is_uinput_type(sel_type):
         (model, path) = self.__uinput_tree.get_selection().get_selected()
         sel = None
         if path:
             sel = model[path][0]
         model.clear()
         found = False
         for n, v in g15uinput.get_buttons(sel_type):
             if len(filter_text) == 0 or filter_text in n.lower(): 
                 model.append([n, v])
                 if n == sel:
                     self.__select_tree_row(self.__uinput_tree, len(model))
                     found  = True
         (model, path) = self.__uinput_tree.get_selection().get_selected()
         if not found and len(model) > 0:
             self.__select_tree_row(self.__uinput_tree, 0)