def dirs(self): self.frame = gtk.Frame(label=_("Music dirs")) self.frame.set_border_width(0) self.frame.show() self.frame.set_no_show_all(True) frame_box = gtk.HBox(False, 0) frame_box.set_border_width(5) frame_box.show() self.tree_controller = SimpleListTreeControl(_("Paths"), None) """reload button""" reload_button = gtk.Button(_("Reload")) reload_button.show() """buttons""" button_box = gtk.VBox(False, 0) button_box.show() bt_add = gtk.Button(_("Add")) bt_add.connect("clicked", self.add_dir) bt_add.set_size_request(80, -1) bt_add.show() bt_remove = gtk.Button(_("Remove")) bt_remove.connect("clicked", self.remove_dir) bt_remove.set_size_request(80, -1) bt_remove.show() empty = gtk.Label("") empty.show() #bt_reload = gtk.Button(label=_("Reload")) #bt_reload.connect("clicked", self.reload_dir) #bt_reload.set_size_request(80, -1) #bt_reload.show() button_box.pack_start(bt_add, False, False, 0) button_box.pack_start(bt_remove, False, False, 0) button_box.pack_start(empty, True, True, 0) #button_box.pack_start(bt_reload, False, False, 0) self.tree_controller.scroll.show_all() frame_box.pack_start(self.tree_controller.scroll, True, True, 0) frame_box.pack_start(button_box, False, False, 0) self.frame.add(frame_box) if FC().tabs_mode == "Multi": self.frame.hide() return self.frame
def formats(self): frame = gtk.Frame(label=_("File Types")) frame.set_border_width(0) frame.show() frame_box = gtk.HBox(False, 0) frame_box.set_border_width(5) frame_box.show() self.files_controller = SimpleListTreeControl(_("Extensions"), None) """buttons""" button_box = gtk.VBox(False, 0) button_box.show() bt_add = gtk.Button(_("Add")) bt_add.connect("clicked", self.on_add_file) bt_add.set_size_request(80, -1) bt_add.show() bt_remove = gtk.Button(_("Remove")) bt_remove.connect("clicked", lambda *a: self.files_controller.delete_selected()) bt_remove.set_size_request(80, -1) bt_remove.show() button_box.pack_start(bt_add, False, False, 0) button_box.pack_start(bt_remove, False, False, 0) scrool_tree = gtk.ScrolledWindow() scrool_tree.set_size_request(-1, 160) scrool_tree.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) scrool_tree.add_with_viewport(self.files_controller.scroll) scrool_tree.show() frame_box.pack_start(scrool_tree, True, True, 0) frame_box.pack_start(button_box, False, False, 0) frame.add(frame_box) return frame
class PreferencesWindow(ChildTopWindow, FControl, LoadSave): configs = [] POS_NAME = 0 def __init__(self, controls): FControl.__init__(self, controls) self.number_inits = 0 self.lazy_init() def lazy_init(self): self.number_inits += 1 controls = self.controls self.configs.append(MusicLibraryConfig(controls)) #self.configs.append(DMConfig(controls)) self.configs.append(TabsConfig(controls)) self.configs.append(LastFmConfig(controls)) #self.configs.append(VkontakteConfig(controls)) #self.configs.append(InfoPagenConfig(controls)) self.configs.append(TrayIconConfig(controls)) #self.configs.append(NetworkConfig(controls)) #self.configs.append(NotificationConfig(controls)) try: """check keybinder installed, debian""" import keybinder #@UnresolvedImport @UnusedImport from foobnix.preferences.configs.hotkey_conf import HotKeysConfig self.configs.append(HotKeysConfig(controls)) except Exception, e: logging.warn("Keybinder not installed" + str(e)) self.configs.append(OtherConfig(controls)) self.label = None mainVBox = gtk.VBox(False, 0) ChildTopWindow.__init__(self, _("Preferences"), 900, 500) paned = gtk.HPaned() paned.set_position(250) def func(): bean = self.navigation.get_selected_bean() if bean: self.populate_config_category(bean.text) self.navigation = SimpleListTreeControl(_("Categories"), controls, True) for plugin in self.configs: self.navigation.append(FDModel(plugin.name)) self.navigation.set_left_click_func(func) paned.add1(self.navigation.scroll) cbox = gtk.VBox(False, 0) for plugin in self.configs: cbox.pack_start(plugin.widget, False, True) self.container = self.create_container(cbox) paned.add2(self.container) mainVBox.pack_start(paned, True, True, 0) mainVBox.pack_start(self.create_save_cancel_buttons(), False, False, 0) self.add(mainVBox)