Exemple #1
0
 def _make_mi_instance(index):
     """ Helper method used by on_cbMI_toggled and load_cbMIs """
     # label,				class, icon, *init_parameters
     label, order, cls, icon, parameter = GlobalSettings.DEFAULT_MENU_OPTIONS[
         index]
     if cls == MenuItem:
         instance = MenuItem("item_i%s" % (index, ),
                             label,
                             parameter,
                             icon=icon)
     elif cls == Submenu:
         instance = Submenu(parameter, label, icon=icon)
     else:
         instance = cls(parameter)
         instance.icon = icon
         instance.label = label
     return instance
Exemple #2
0
 def on_action_chosen(self, id, a, mark_changed=True):
     model = self.builder.get_object("tvItems").get_model()
     for i in model:
         item = i[0].item
         if item.id == id:
             if isinstance(item, Separator):
                 item.label = a.get_name()
             elif isinstance(item, Submenu):
                 i[0].item = item = Submenu(
                     a.get_current_page().get_selected_menu(), a.get_name())
             elif isinstance(item, RecentListMenuGenerator):
                 i[0].item = item = RecentListMenuGenerator(
                     rows=a.get_current_page().get_row_count())
             elif isinstance(item, MenuItem):
                 item.action = a
                 item.label = item.action.describe(Action.AC_OSD)
             else:
                 raise TypeError("Edited %s" % (item.__class__.__name__))
             i[1] = item.describe()
             break
 def on_mnuAddSubmenu_clicked(self, *a):
     """ Handler for "Add Separator" menu item """
     self._add_menuitem(Submenu(""))