def __init__(self, controls): self.controls = controls box = Gtk.VBox(False, 0) box.hide() '''static_icon''' self.static_icon = IconBlock(_("Icon"), controls, FC().static_icon_entry) """dynamic icons""" self.play_icon = IconBlock(_("Play"), controls, FC().play_icon_entry) self.pause_icon = IconBlock(_("Pause"), controls, FC().pause_icon_entry) self.stop_icon = IconBlock(_("Stop"), controls, FC().stop_icon_entry) self.radio_icon = IconBlock(_("Radio"), controls, FC().radio_icon_entry) self.tray_icon_button = Gtk.CheckButton(label=_("Show tray icon"), use_underline=True) self.hide_in_tray_on_start = Gtk.CheckButton(label=_("Hide player in tray on start"), use_underline=True) #self.tray_icon_button.connect("clicked", self.on_show_tray_icon) self.close_button = Gtk.RadioButton(group=None, label=_("On close window - close player")) self.hide_button = Gtk.RadioButton(group=self.close_button, label=_("On close window - hide player")) self.hide_button.connect("toggled", self.on_show_tray_icon) self.minimize_button = Gtk.RadioButton(group=self.close_button, label=_("On close window - minimize player")) """system icon""" self.static_tray_icon = ChooseDecorator(None, FrameDecorator(_("System Icon Static"), self.static_icon)) """dynamic icons""" line = VBoxDecorator(self.play_icon, self.pause_icon, self.stop_icon, self.radio_icon) self.icon_controls = ChooseDecorator(self.static_tray_icon.get_radio_button(), FrameDecorator(_("System Icons Dynamic"), line)) """disc image icon""" image = ImageBase(ICON_BLANK_DISK, 30) self.change_tray_icon = ChooseDecorator(self.static_tray_icon.get_radio_button(), FrameDecorator(_("Disc cover image"), image)) self.notifier = Gtk.CheckButton(_("Notification pop-up")) self.notifier.connect("toggled", self.on_toggle) self.n_time = self.notify_time() box.pack_start(self.hide_in_tray_on_start, False, True, 0) box.pack_start(self.tray_icon_button, False, True, 0) box.pack_start(self.close_button, False, True, 0) box.pack_start(self.hide_button, False, True, 0) box.pack_start(self.minimize_button, False, True, 0) box.pack_start(self.static_tray_icon, True, True, 0) box.pack_start(self.icon_controls, True, True, 0) box.pack_start(self.change_tray_icon, False, False, 0) notifier_box = Gtk.VBox() notifier_box.pack_start(self.notifier, False, False, 0) notifier_box.pack_start(self.n_time, False, False, 0) box.pack_start(FrameDecorator(_("Notification"), notifier_box), False, False, 0) self.widget = box
def __init__(self, controls): Gtk.Frame.__init__(self) self.controls = controls self.set_size_request(100, 200) self.album_title = Gtk.Label.new(_("Album title")) self.set_label_align(0.5, 0.5) self.image = ImageBase(ICON_BLANK_DISK, size=FC().info_panel_image_size) self.image.set_from_pixbuf(self.get_pixbuf()) image_frame = FrameDecorator(_("Cover"), self.image, 0.5, 0.5) self.lyrics = TextArea() lyrics_frame = FrameDecorator(_("Lyric"), self.lyrics, 0.5, 0.5) vbox = Gtk.Box.new(Gtk.Orientation.VERTICAL, 5) vbox.pack_start(image_frame, False, False, 0) vbox.pack_start(lyrics_frame, True, True, 0) self.add(vbox) self.set_label_widget(self.album_title) self.show_all()
def dirs(self): frame_box = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 0) frame_box.set_border_width(5) frame_box.show() self.frame = FrameDecorator(_("Music dirs"), frame_box, 0.5, 0.5, border_width=0) self.frame.show() self.frame.set_no_show_all(True) self.tree_controller = SimpleListTreeControl(_("Paths"), None) """buttons""" button_box = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0) button_box.show() bt_add = Gtk.Button.new_with_label(_("Add")) bt_add.connect("clicked", self.add_dir) bt_add.set_size_request(80, -1) bt_add.show() bt_remove = Gtk.Button.new_with_label(_("Remove")) bt_remove.connect("clicked", self.remove_dir) bt_remove.set_size_request(80, -1) bt_remove.show() empty = Gtk.Label.new("") empty.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) 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) if FC().tabs_mode == "Multi": self.frame.hide() return self.frame
def formats(self): frame_box = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 0) frame_box.set_border_width(5) frame_box.show() frame = FrameDecorator(_("File Types"), frame_box, 0.5, 0.5, border_width=0) frame.show() self.files_controller = SimpleListTreeControl(_("Extensions"), None) """buttons""" button_box = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0) button_box.show() bt_add = Gtk.Button.new_with_label(_("Add")) bt_add.connect("clicked", self.on_add_file) bt_add.set_size_request(80, -1) bt_add.show() bt_remove = Gtk.Button.new_with_label(_("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.PolicyType.AUTOMATIC, Gtk.PolicyType.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) return frame
def formats(self): frame_box = Gtk.HBox(False, 0) frame_box.set_border_width(5) frame_box.show() frame = FrameDecorator(_("File Types"), frame_box, 0.5, 0.5, border_width=0) frame.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.PolicyType.AUTOMATIC, Gtk.PolicyType.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) return frame
def dirs(self): frame_box = Gtk.HBox(False, 0) frame_box.set_border_width(5) frame_box.show() self.frame = FrameDecorator(_("Music dirs"), frame_box, 0.5, 0.5, border_width=0) self.frame.show() self.frame.set_no_show_all(True) self.tree_controller = SimpleListTreeControl(_("Paths"), None) """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() 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) 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) if FC().tabs_mode == "Multi": self.frame.hide() return self.frame
def __init__(self, controls): HotKeysConfig.controls = controls box = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0) box.hide() self.tree_widget = Gtk.TreeView() self.tree_widget.connect("button-press-event", self.on_populate_click) self.tree_widget.show() self.model = Gtk.ListStore(str, str) self.title = None self.column1 = Gtk.TreeViewColumn(_("Action"), Gtk.CellRendererText(), text=0) self.column2 = Gtk.TreeViewColumn(_("Hotkey"), Gtk.CellRendererText(), text=1) self.tree_widget.append_column(self.column1) self.tree_widget.append_column(self.column2) self.tree_widget.set_model(self.model) hbox = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 0) hbox.show() add_button = Gtk.Button.new_with_label(_("Add")) add_button.set_size_request(80, -1) add_button.connect("clicked", self.on_add_row) add_button.show() remove_button = Gtk.Button.new_with_label(_("Remove")) remove_button.connect("clicked", self.on_remove_row) remove_button.set_size_request(80, -1) remove_button.show() hbox.pack_start(add_button, False, True, 0) hbox.pack_start(remove_button, False, True, 0) hotbox = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 0) hotbox.show() self.action_text = Gtk.Entry() self.action_text.set_size_request(150, -1) self.action_text.connect("button-press-event", self.on_mouse_click) self.hotkey_text = Gtk.Entry() self.hotkey_text.set_editable(False) self.hotkey_text.connect("key-press-event", self.on_key_press) self.hotkey_text.set_size_request(150, -1) self.hotkey_auto = Gtk.CheckButton.new_with_label(_("Auto key")) self.hotkey_auto.set_active(True) hotbox.pack_start(self.action_text, False, True, 0) hotbox.pack_start(self.hotkey_text, False, True, 0) hotbox.pack_start(self.hotkey_auto, False, True, 0) self.disable_mediakeys = Gtk.CheckButton.new_with_label(_("Disable Multimedia Keys")) self.disable_volume_keys = Gtk.CheckButton.new_with_label(_("Don't try to bind volume control keys")) def on_toggle(*a): if self.disable_mediakeys.get_active(): self.disable_volume_keys.set_sensitive(False) else: self.disable_volume_keys.set_sensitive(True) self.disable_mediakeys.connect("toggled", on_toggle) mmbox = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0) mmbox.pack_start(self.disable_mediakeys, False, False, 0) mmbox.pack_start(self.disable_volume_keys, False, False, 0) self.mm_frame_decorator = FrameDecorator(_("Multimedia keys"), mmbox, 0.5, 0.5) box.pack_start(self.tree_widget, False, True, 0) box.pack_start(hotbox, False, True, 0) box.pack_start(hbox, False, True, 0) box.pack_start(self.mm_frame_decorator, False, False, 0) self.widget = box self.menu = self.create_menu()
def __init__(self, controls): self.controls = controls box = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0) box.hide() df_vbox = Gtk.Box.new(Gtk.Orientation.VERTICAL, 5) df_vbox.set_border_width(4) download_frame = FrameDecorator(_("File downloads"), df_vbox, 0.5, 0.5) """save to""" hbox = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 5) self.online_dir = Gtk.FileChooserButton.new("Set place", Gtk.FileChooserAction.SELECT_FOLDER) self.online_dir.connect("current-folder-changed", self.on_change_folder) hbox.pack_start(Gtk.Label.new(_("Save online music to folder:")), False, True, 0) hbox.pack_start(self.online_dir, True, True, 0) """automatic save""" self.automatic_save_checkbutton = Gtk.CheckButton.new_with_label(_("Automatic online music save")) self.nosubfolder_checkbutton = Gtk.CheckButton.new_with_label(_("Save to one folder (no subfolders)")) """ Skype NowPlay """ self.skype_nowplay_checkbutton = Gtk.CheckButton(label=_("Set skype mood to current track"), use_underline=True) """download threads""" thbox = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 5) tab_label = Gtk.Label.new(_("Download in threads")) adjustment = Gtk.Adjustment(value=1, lower=1, upper=10, step_incr=1, page_incr=1, page_size=0) self.threads_count = Gtk.SpinButton.new(adjustment, 0.0, 0) thbox.pack_start(tab_label, False, False, 0) thbox.pack_start(self.threads_count, False, True, 0) df_vbox.pack_start(hbox, False, False, 2) df_vbox.pack_start(self.automatic_save_checkbutton, False, False, 2) df_vbox.pack_start(self.nosubfolder_checkbutton, False, False, 2) df_vbox.pack_start(self.skype_nowplay_checkbutton, False, False, 2) df_vbox.pack_start(thbox, False, False, 2) download_frame.show_all() """disc cover size""" cbox = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 5) cbox.set_border_width(4) dc_frame = FrameDecorator(_("Disc cover settings"), cbox, 0.5, 0.5) tab_label = Gtk.Label.new(_("Disc cover size:")) adjustment = Gtk.Adjustment(value=1, lower=100, upper=350, step_incr=20, page_incr=50, page_size=0) self.image_size_spin = Gtk.SpinButton.new(adjustment, 0.0, 0) cbox.pack_start(tab_label, False, False, 0) cbox.pack_start(self.image_size_spin, False, True, 0) dc_frame.show_all() """notification""" uhbox = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 5) uhbox.set_border_width(4) updates_frame = FrameDecorator(_("Updates"), uhbox, 0.5, 0.5) self.check_new_version = Gtk.CheckButton(label=_("Check for new foobnix release on start"), use_underline=True) demo = Gtk.Button.new_with_label(_("Check for update")) demo.connect("clicked", lambda * a: info_dialog_with_link_and_donate("foobnix [version]")) uhbox.pack_start(self.check_new_version, True, True, 0) uhbox.pack_start(demo, False, False, 0) updates_frame.show_all() """background image""" thvbox = Gtk.Box.new(Gtk.Orientation.VERTICAL, 1) thvbox.set_border_width(4) theme_frame = FrameDecorator(_("Theming"), thvbox, 0.5, 0.5) """menu position""" pbox = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 5) pbox.show() label = Gtk.Label.new(_("Menu type: ")) self.old_style = Gtk.RadioButton(_("Old Style (Menu Bar)")) self.new_style = Gtk.RadioButton.new_with_label_from_widget(self.old_style, _("New Style (Button)")) pbox.pack_start(label, False, False, 0) pbox.pack_start(self.new_style, False, True, 0) pbox.pack_start(self.old_style, False, False, 0) o_r_box = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 5) o_r_box.show() o_r_label = Gtk.Label.new(_("Order-Repeat Switcher Style:")) self.buttons = Gtk.RadioButton(None, _("Toggle Buttons")) self.labels = Gtk.RadioButton.new_with_label_from_widget(self.buttons, _("Text Labels")) o_r_box.pack_start(o_r_label, False, False, 0) o_r_box.pack_start(self.buttons, False, True, 0) o_r_box.pack_start(self.labels, False, False, 0) """opacity""" obox = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 5) obox.show() tab_label = Gtk.Label.new(_("Opacity:")) tab_label.show() adjustment = Gtk.Adjustment(value=1, lower=20, upper=100, step_incr=1, page_incr=1, page_size=0) self.opacity_size = Gtk.SpinButton.new(adjustment, 0.0, 0) self.opacity_size.connect("value-changed", self.on_chage_opacity) self.opacity_size.show() obox.pack_start(tab_label, False, False, 0) obox.pack_start(self.opacity_size, False, True, 0) self.fmgrs_combo = self.fmgr_combobox() hcombobox = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 5) hcombobox.pack_start(Gtk.Label.new(_('Choose your preferred file manager:')), False, False, 0) hcombobox.pack_start(self.fmgrs_combo, False, False, 0) self.disable_screensaver = Gtk.CheckButton(label=_("Disable Xscreensaver"), use_underline=True) thvbox.pack_start(pbox, False, False, 1) thvbox.pack_start(o_r_box, False, False, 1) thvbox.pack_start(obox, False, False, 1) thvbox.pack_start(hcombobox, False, False, 1) thvbox.pack_start(self.disable_screensaver, False, False, 0) theme_frame.show_all() """packaging""" box.pack_start(download_frame, False, True, 2) box.pack_start(dc_frame, False, True, 2) box.pack_start(theme_frame, False, False, 2) box.pack_start(updates_frame, False, True, 2) self.widget = box
def __init__(self, controls): self.controls = controls box = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0) box.hide() df_vbox = Gtk.Box.new(Gtk.Orientation.VERTICAL, 5) df_vbox.set_border_width(4) download_frame = FrameDecorator(_("File downloads"), df_vbox, 0.5, 0.5) """save to""" hbox = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 5) self.online_dir = Gtk.FileChooserButton.new("Set place", Gtk.FileChooserAction.SELECT_FOLDER) self.online_dir.connect("current-folder-changed", self.on_change_folder) hbox.pack_start(Gtk.Label.new(_("Save online music to folder:")), False, True, 0) hbox.pack_start(self.online_dir, True, True, 0) """automatic save""" self.automatic_save_checkbutton = Gtk.CheckButton.new_with_label(_("Automatic online music save")) self.nosubfolder_checkbutton = Gtk.CheckButton.new_with_label(_("Save to one folder (no subfolders)")) """download threads""" thbox = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 5) tab_label = Gtk.Label.new(_("Download in threads")) adjustment = Gtk.Adjustment(value=1, lower=1, upper=10, step_incr=1, page_incr=1, page_size=0) self.threads_count = Gtk.SpinButton.new(adjustment, 0.0, 0) thbox.pack_start(tab_label, False, False, 0) thbox.pack_start(self.threads_count, False, True, 0) df_vbox.pack_start(hbox, False, False, 2) df_vbox.pack_start(self.automatic_save_checkbutton, False, False, 2) df_vbox.pack_start(self.nosubfolder_checkbutton, False, False, 2) df_vbox.pack_start(thbox, False, False, 2) download_frame.show_all() """disc cover size""" cbox = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 5) cbox.set_border_width(4) dc_frame = FrameDecorator(_("Disc cover settings"), cbox, 0.5, 0.5) tab_label = Gtk.Label.new(_("Disc cover size:")) adjustment = Gtk.Adjustment(value=1, lower=100, upper=350, step_incr=20, page_incr=50, page_size=0) self.image_size_spin = Gtk.SpinButton.new(adjustment, 0.0, 0) cbox.pack_start(tab_label, False, False, 0) cbox.pack_start(self.image_size_spin, False, True, 0) dc_frame.show_all() """notification""" uhbox = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 5) uhbox.set_border_width(4) updates_frame = FrameDecorator(_("Updates"), uhbox, 0.5, 0.5) self.check_new_version = Gtk.CheckButton(label=_("Check for new foobnix release on start"), use_underline=True) demo = Gtk.Button.new_with_label(_("Check for update")) demo.connect("clicked", lambda * a: info_dialog_with_link_and_donate("foobnix [version]")) uhbox.pack_start(self.check_new_version, True, True, 0) uhbox.pack_start(demo, False, False, 0) updates_frame.show_all() """background image""" thvbox = Gtk.Box.new(Gtk.Orientation.VERTICAL, 1) thvbox.set_border_width(4) theme_frame = FrameDecorator(_("Theming"), thvbox, 0.5, 0.5) """menu position""" pbox = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 5) pbox.show() label = Gtk.Label.new(_("Menu type: ")) self.old_style = Gtk.RadioButton(_("Old Style (Menu Bar)")) self.new_style = Gtk.RadioButton.new_with_label_from_widget(self.old_style, _("New Style (Button)")) pbox.pack_start(label, False, False, 0) pbox.pack_start(self.new_style, False, True, 0) pbox.pack_start(self.old_style, False, False, 0) o_r_box = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 5) o_r_box.show() o_r_label = Gtk.Label.new(_("Order-Repeat Switcher Style:")) self.buttons = Gtk.RadioButton.new_with_label(None, _("Toggle Buttons")) self.labels = Gtk.RadioButton.new_with_label_from_widget(self.buttons, _("Text Labels")) o_r_box.pack_start(o_r_label, False, False, 0) o_r_box.pack_start(self.buttons, False, True, 0) o_r_box.pack_start(self.labels, False, False, 0) """opacity""" obox = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 5) obox.show() tab_label = Gtk.Label.new(_("Opacity:")) tab_label.show() adjustment = Gtk.Adjustment(value=1, lower=20, upper=100, step_incr=1, page_incr=1, page_size=0) self.opacity_size = Gtk.SpinButton.new(adjustment, 0.0, 0) self.opacity_size.connect("value-changed", self.on_chage_opacity) self.opacity_size.show() obox.pack_start(tab_label, False, False, 0) obox.pack_start(self.opacity_size, False, True, 0) self.fmgrs_combo = self.fmgr_combobox() hcombobox = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 5) hcombobox.pack_start(Gtk.Label.new(_('Choose your preferred file manager:')), False, False, 0) hcombobox.pack_start(self.fmgrs_combo, False, False, 0) self.disable_screensaver = Gtk.CheckButton(label=_("Disable Xscreensaver"), use_underline=True) thvbox.pack_start(pbox, False, False, 1) thvbox.pack_start(o_r_box, False, False, 1) thvbox.pack_start(obox, False, False, 1) thvbox.pack_start(hcombobox, False, False, 1) thvbox.pack_start(self.disable_screensaver, False, False, 0) theme_frame.show_all() """packaging""" box.pack_start(download_frame, False, True, 2) box.pack_start(dc_frame, False, True, 2) box.pack_start(theme_frame, False, False, 2) box.pack_start(updates_frame, False, True, 2) self.widget = box
def __init__(self, controls): self.controls = controls box = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0) box.hide() self.enable_proxy = Gtk.CheckButton.new_with_label( _("Enable HTTP proxy")) self.enable_proxy.connect("clicked", self.on_enable_http_proxy) self.enable_proxy.show() all = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0) all.show() self.frame = FrameDecorator(_("Proxy Settings"), all, 0.5, 0.5, border_width=0) self.frame.show() """URL""" proxy_box = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 0) proxy_box.show() proxy_lable = Gtk.Label.new(_("Server")) proxy_lable.set_size_request(150, -1) proxy_lable.show() self.proxy_server = Gtk.Entry() self.proxy_server.show() require = Gtk.Label.new(_("example: 66.42.182.178:3128")) require.show() proxy_box.pack_start(proxy_lable, False, False, 0) proxy_box.pack_start(self.proxy_server, False, True, 0) proxy_box.pack_start(require, False, True, 0) """LOGIN""" lbox = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 0) lbox.show() login = Gtk.Label.new(_("Login")) login.set_size_request(150, -1) login.show() self.login_text = Gtk.Entry() self.login_text.show() lbox.pack_start(login, False, False, 0) lbox.pack_start(self.login_text, False, True, 0) """PASSWORD""" pbox = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 0) pbox.show() password = Gtk.Label.new(_("Password")) password.set_size_request(150, -1) password.show() self.password_text = Gtk.Entry() self.password_text.set_visibility(False) self.password_text.set_invisible_char("*") self.password_text.show() pbox.pack_start(password, False, False, 0) pbox.pack_start(self.password_text, False, True, 0) """check""" check = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 0) check.show() self.vk_test = Gtk.Entry() self.vk_test.set_text("http://vk.com") self.vk_test.show() self.test_button = Gtk.Button.new_with_label(_("Check Connection")) self.test_button.set_size_request(150, -1) self.test_button.connect("clicked", self.text_connection) self.test_button.show() self.result = Gtk.Label.new(_("Result:")) self.result.show() check.pack_start(self.test_button, False, True, 0) check.pack_start(self.vk_test, False, False, 0) check.pack_start(self.result, False, True, 0) """global""" all.pack_start(self.enable_proxy, False, False, 0) all.pack_start(proxy_box, False, False, 0) all.pack_start(lbox, False, False, 0) all.pack_start(pbox, False, False, 0) all.pack_start(check, False, False, 0) frame_box = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 0) frame_box.set_border_width(5) frame_box.show() self.net_ping = Gtk.CheckButton.new_with_label( _("Show message on network disconnection")) box.pack_start(self.buffer_size(), False, True, 0) box.pack_start(self.net_ping, False, True, 0) box.pack_start(self.frame, False, True, 0) self.widget = box if FC().proxy_enable and FC().proxy_url: set_proxy_settings()
class NetworkConfig(ConfigPlugin): name = _("Network Settings") def __init__(self, controls): self.controls = controls box = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0) box.hide() self.enable_proxy = Gtk.CheckButton.new_with_label( _("Enable HTTP proxy")) self.enable_proxy.connect("clicked", self.on_enable_http_proxy) self.enable_proxy.show() all = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0) all.show() self.frame = FrameDecorator(_("Proxy Settings"), all, 0.5, 0.5, border_width=0) self.frame.show() """URL""" proxy_box = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 0) proxy_box.show() proxy_lable = Gtk.Label.new(_("Server")) proxy_lable.set_size_request(150, -1) proxy_lable.show() self.proxy_server = Gtk.Entry() self.proxy_server.show() require = Gtk.Label.new(_("example: 66.42.182.178:3128")) require.show() proxy_box.pack_start(proxy_lable, False, False, 0) proxy_box.pack_start(self.proxy_server, False, True, 0) proxy_box.pack_start(require, False, True, 0) """LOGIN""" lbox = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 0) lbox.show() login = Gtk.Label.new(_("Login")) login.set_size_request(150, -1) login.show() self.login_text = Gtk.Entry() self.login_text.show() lbox.pack_start(login, False, False, 0) lbox.pack_start(self.login_text, False, True, 0) """PASSWORD""" pbox = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 0) pbox.show() password = Gtk.Label.new(_("Password")) password.set_size_request(150, -1) password.show() self.password_text = Gtk.Entry() self.password_text.set_visibility(False) self.password_text.set_invisible_char("*") self.password_text.show() pbox.pack_start(password, False, False, 0) pbox.pack_start(self.password_text, False, True, 0) """check""" check = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 0) check.show() self.vk_test = Gtk.Entry() self.vk_test.set_text("http://vk.com") self.vk_test.show() self.test_button = Gtk.Button.new_with_label(_("Check Connection")) self.test_button.set_size_request(150, -1) self.test_button.connect("clicked", self.text_connection) self.test_button.show() self.result = Gtk.Label.new(_("Result:")) self.result.show() check.pack_start(self.test_button, False, True, 0) check.pack_start(self.vk_test, False, False, 0) check.pack_start(self.result, False, True, 0) """global""" all.pack_start(self.enable_proxy, False, False, 0) all.pack_start(proxy_box, False, False, 0) all.pack_start(lbox, False, False, 0) all.pack_start(pbox, False, False, 0) all.pack_start(check, False, False, 0) frame_box = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 0) frame_box.set_border_width(5) frame_box.show() self.net_ping = Gtk.CheckButton.new_with_label( _("Show message on network disconnection")) box.pack_start(self.buffer_size(), False, True, 0) box.pack_start(self.net_ping, False, True, 0) box.pack_start(self.frame, False, True, 0) self.widget = box if FC().proxy_enable and FC().proxy_url: set_proxy_settings() def text_connection(self, *a): self.on_save() set_proxy_settings() init = time.time() try: f = urllib.request.urlopen(self.vk_test.get_text()) f.read() f.close() except Exception as e: logging.error(e) self.result.set_text(str(e)) return None seconds = time.time() - init self.result.set_text( _("Result:") + _(" OK in seconds: ") + str(seconds)) def on_enable_http_proxy(self, *a): if self.enable_proxy.get_active(): self.frame.set_sensitive(True) else: self.frame.set_sensitive(False) def is_proxy_changed(self): if [ FC().proxy_enable, FC().proxy_url, FC().proxy_user, FC().proxy_password ] != [ self.enable_proxy.get_active(), self.proxy_server.get_text(), self.login_text.get_text(), self.password_text.get_text() ]: return True else: return False def buffer_size(self): label = Gtk.Label.new(_("Buffer size for network streams (KBytes)")) self.buffer_adjustment = Gtk.Adjustment.new(value=128, lower=16, upper=2048, step_increment=16, page_increment=0, page_size=0) buff_size = Gtk.SpinButton.new(self.buffer_adjustment, 0.0, 0) buff_size.show() hbox = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 10) hbox.pack_start(buff_size, False, False, 0) hbox.pack_start(label, False, False, 0) hbox.show_all() return hbox def on_load(self): self.enable_proxy.set_active(FC().proxy_enable) self.frame.set_sensitive(FC().proxy_enable) self.buffer_adjustment.set_value(FC().network_buffer_size) if FC().proxy_url: self.proxy_server.set_text(FC().proxy_url) if FC().proxy_user: self.login_text.set_text(FC().proxy_user) if FC().proxy_password: self.password_text.set_text(FC().proxy_password) if FC().net_ping: self.net_ping.set_active(True) def on_save(self): if not self.is_proxy_changed(): return proxy_url = self.proxy_server.get_text() if proxy_url: if not ":" in proxy_url: logging.error("No port specified") proxy_url = proxy_url + ":3128" FC().proxy_url = proxy_url.strip() else: FC().proxy_url = None if self.enable_proxy.get_active() and FC().proxy_url: FC().proxy_enable = True if not self.controls.lastfm_service.network: self.controls.lastfm_service = LastFmService(self.controls) else: self.controls.lastfm_service.network.enable_proxy( FC().proxy_url) else: FC().proxy_enable = False if not self.controls.lastfm_service.network: self.controls.lastfm_service = LastFmService(self.controls) else: self.controls.lastfm_service.network.disable_proxy() FC().network_buffer_size = self.buffer_adjustment.get_value() if self.login_text.get_text(): FC().proxy_user = self.login_text.get_text() else: FC().proxy_user = None if self.password_text.get_text(): FC().proxy_password = self.password_text.get_text() else: FC().proxy_password = None if self.net_ping.get_active(): self.controls.net_wrapper.set_ping(True) else: self.controls.net_wrapper.set_ping(False) set_proxy_settings() def set_new_vk_window(): pass
class MusicLibraryConfig(ConfigPlugin, FControl): name = CONFIG_MUSIC_LIBRARY enable = True def __init__(self, controls): FControl.__init__(self, controls) box = Gtk.VBox(False, 0) box.hide() box.pack_start(self.tabs_mode(), False, True, 0) box.pack_start(self.dirs(), False, True, 0) box.pack_start(self.formats(), False, True, 0) self.widget = box uhbox = Gtk.HBox() ulabel = Gtk.Label(_("Update library on start (more slow) ")) self.update_on_start = Gtk.CheckButton() uhbox.pack_start(ulabel, False, True, 0) uhbox.pack_start(self.update_on_start, False, False, 0) box.pack_start(uhbox, False, True, 0) box.pack_start(self.gap(), False, True, 0) def dirs(self): frame_box = Gtk.HBox(False, 0) frame_box.set_border_width(5) frame_box.show() self.frame = FrameDecorator(_("Music dirs"), frame_box, 0.5, 0.5, border_width=0) self.frame.show() self.frame.set_no_show_all(True) self.tree_controller = SimpleListTreeControl(_("Paths"), None) """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() 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) 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) if FC().tabs_mode == "Multi": self.frame.hide() return self.frame def reload_dir(self, *a): FCache().music_paths[0] = self.temp_music_paths[:] #create copy of list self.controls.update_music_tree() def on_load(self): self.tree_controller.clear_tree() for path in FCache().music_paths[0]: self.tree_controller.append(FDModel(os.path.basename(path), path).add_is_file(False)) self.files_controller.clear_tree() for ext in FC().all_support_formats: self.files_controller.append(FDModel(ext)) self.adjustment.set_value(FC().gap_secs) if FC().tabs_mode == "Single": self.singletab_button.set_active(True) self.controls.perspectives.get_perspective('fs').get_tabhelper().set_show_tabs(False) if FC().update_tree_on_start: self.update_on_start.set_active(True) self.temp_music_paths = FCache().music_paths[0][:] #create copy of list def on_save(self): FC().all_support_formats = self.files_controller.get_all_beans_text() FC().gap_secs = self.adjustment.get_value() if self.singletab_button.get_active(): '''for i in xrange(len(FCache().music_paths) - 1, 0, -1): del FCache().music_paths[i] del FCache().cache_music_tree_beans[i] del FCache().tab_names[i] self.controls.tabhelper.remove_page(i)''' FC().tabs_mode = "Single" self.controls.perspectives.get_perspective('fs').get_tabhelper().set_show_tabs(False) if self.temp_music_paths != FCache().music_paths[0]: self.reload_dir() else: FC().tabs_mode = "Multi" self.controls.perspectives.get_perspective('fs').get_tabhelper().set_show_tabs(True) if self.update_on_start.get_active(): FC().update_tree_on_start = True else: FC().update_tree_on_start = False def add_dir(self, *a): current_folder = FCache().last_music_path if FCache().last_music_path else None paths = directory_chooser_dialog(_("Choose directory with music"), current_folder) if not paths: return path = paths[0] FCache().last_music_path = path[:path.rfind("/")] for path in paths: if path not in self.temp_music_paths: self.tree_controller.append(FDModel(os.path.basename(path), path).add_is_file(False)) self.temp_music_paths.append(path) def remove_dir(self, *a): selection = self.tree_controller.get_selection() fm, paths = selection.get_selected_rows()#@UnusedVariable paths.reverse() for path in paths: del FCache().music_paths[0][path[0]] del FCache().cache_music_tree_beans[0][path[0]] self.tree_controller.delete_selected() remaining_beans = self.tree_controller.get_all_beans() if remaining_beans: self.temp_music_paths = [bean.path for bean in self.tree_controller.get_all_beans()] else: self.temp_music_paths = [] def formats(self): frame_box = Gtk.HBox(False, 0) frame_box.set_border_width(5) frame_box.show() frame = FrameDecorator(_("File Types"), frame_box, 0.5, 0.5, border_width=0) frame.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.PolicyType.AUTOMATIC, Gtk.PolicyType.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) return frame def on_add_file(self, *a): val = show_entry_dialog(_("Please add audio extension"), _("Extension should be like '.mp3'")) if val and val.find(".") >= 0 and len(val) <= 5 and val not in self.files_controller.get_all_beans_text(): self.files_controller.append(FDModel(val)) else: logging.info("Can't add your value" + val) def gap(self): label = Gtk.Label(_("Gap between tracks")) self.adjustment = Gtk.Adjustment(value=0, lower=0, upper=5, step_incr=0.5) gap_len = Gtk.SpinButton(adjustment=self.adjustment, climb_rate=0.0, digits=1) gap_len.show() hbox = Gtk.HBox(False, 10) hbox.pack_start(gap_len, False, False, 0) hbox.pack_start(label, False, False, 0) hbox.show_all() return hbox def tabs_mode(self): hbox = Gtk.HBox() self.multitabs_button = Gtk.RadioButton.new_with_label(None, _("Multi tab mode")) def on_toggle_multitab(widget, data=None): self.frame.hide() self.multitabs_button.connect("toggled", on_toggle_multitab) hbox.pack_start(self.multitabs_button, True, False, 0) self.singletab_button = Gtk.RadioButton.new_with_label_from_widget(self.multitabs_button, _("Single tab mode")) def on_toggle_singletab(widget, data=None): self.tree_controller.clear_tree() for path in FCache().music_paths[0]: self.tree_controller.append(FDModel(os.path.basename(path), path).add_is_file(False)) self.temp_music_paths = FCache().music_paths[0][:] self.frame.show() self.singletab_button.connect("toggled", on_toggle_singletab) hbox.pack_end(self.singletab_button, True, False, 0) return hbox
class NetworkConfig(ConfigPlugin): name = _("Network Settings") def __init__(self, controls): self.controls = controls box = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0) box.hide() self.enable_proxy = Gtk.CheckButton.new_with_label(_("Enable HTTP proxy")) self.enable_proxy.connect("clicked", self.on_enable_http_proxy) self.enable_proxy.show() all = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0) all.show() self.frame = FrameDecorator(_("Proxy Settings"), all, 0.5, 0.5, border_width=0) self.frame.show() """URL""" proxy_box = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 0) proxy_box.show() proxy_lable = Gtk.Label.new(_("Server")) proxy_lable.set_size_request(150, -1) proxy_lable.show() self.proxy_server = Gtk.Entry() self.proxy_server.show() require = Gtk.Label.new(_("example: 66.42.182.178:3128")) require.show() proxy_box.pack_start(proxy_lable, False, False, 0) proxy_box.pack_start(self.proxy_server, False, True, 0) proxy_box.pack_start(require, False, True, 0) """LOGIN""" lbox = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 0) lbox.show() login = Gtk.Label.new(_("Login")) login.set_size_request(150, -1) login.show() self.login_text = Gtk.Entry() self.login_text.show() lbox.pack_start(login, False, False, 0) lbox.pack_start(self.login_text, False, True, 0) """PASSWORD""" pbox = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 0) pbox.show() password = Gtk.Label.new(_("Password")) password.set_size_request(150, -1) password.show() self.password_text = Gtk.Entry() self.password_text.set_visibility(False) self.password_text.set_invisible_char("*") self.password_text.show() pbox.pack_start(password, False, False, 0) pbox.pack_start(self.password_text, False, True, 0) """check""" check = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 0) check.show() self.vk_test = Gtk.Entry() self.vk_test.set_text("http://vk.com") self.vk_test.show() self.test_button = Gtk.Button.new_with_label(_("Check Connection")) self.test_button.set_size_request(150, -1) self.test_button.connect("clicked", self.text_connection) self.test_button.show() self.result = Gtk.Label.new(_("Result:")) self.result.show() check.pack_start(self.test_button, False, True, 0) check.pack_start(self.vk_test, False, False, 0) check.pack_start(self.result, False, True, 0) """global""" all.pack_start(self.enable_proxy, False, False, 0) all.pack_start(proxy_box, False, False, 0) all.pack_start(lbox, False, False, 0) all.pack_start(pbox, False, False, 0) all.pack_start(check, False, False, 0) frame_box = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 0) frame_box.set_border_width(5) frame_box.show() self.net_ping = Gtk.CheckButton.new_with_label(_("Show message on network disconnection")) box.pack_start(self.buffer_size(), False, True, 0) box.pack_start(self.net_ping, False, True, 0) box.pack_start(self.frame, False, True, 0) self.widget = box if FC().proxy_enable and FC().proxy_url: set_proxy_settings() def text_connection(self, *a): self.on_save() set_proxy_settings() init = time.time() try: f = urllib2.urlopen(self.vk_test.get_text()) f.read() f.close() except Exception, e: logging.error(e) self.result.set_text(str(e)) return None seconds = time.time() - init self.result.set_text(_("Result:") + _(" OK in seconds: ") + str(seconds))
class MusicLibraryConfig(ConfigPlugin, FControl): name = CONFIG_MUSIC_LIBRARY enable = True def __init__(self, controls): FControl.__init__(self, controls) box = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0) box.hide() box.pack_start(self.tabs_mode(), False, True, 0) box.pack_start(self.dirs(), False, True, 0) box.pack_start(self.formats(), False, True, 0) self.widget = box uhbox = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 0) ulabel = Gtk.Label.new(_("Update library on start (more slow) ")) self.update_on_start = Gtk.CheckButton.new() uhbox.pack_start(ulabel, False, True, 0) uhbox.pack_start(self.update_on_start, False, False, 0) box.pack_start(uhbox, False, True, 0) box.pack_start(self.gap(), False, True, 0) def dirs(self): frame_box = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 0) frame_box.set_border_width(5) frame_box.show() self.frame = FrameDecorator(_("Music dirs"), frame_box, 0.5, 0.5, border_width=0) self.frame.show() self.frame.set_no_show_all(True) self.tree_controller = SimpleListTreeControl(_("Paths"), None) """buttons""" button_box = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0) button_box.show() bt_add = Gtk.Button.new_with_label(_("Add")) bt_add.connect("clicked", self.add_dir) bt_add.set_size_request(80, -1) bt_add.show() bt_remove = Gtk.Button.new_with_label(_("Remove")) bt_remove.connect("clicked", self.remove_dir) bt_remove.set_size_request(80, -1) bt_remove.show() empty = Gtk.Label.new("") empty.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) 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) if FC().tabs_mode == "Multi": self.frame.hide() return self.frame def reload_dir(self, *a): FCache( ).music_paths[0] = self.temp_music_paths[:] #create copy of list self.controls.update_music_tree() def on_load(self): self.tree_controller.clear_tree() for path in FCache().music_paths[0]: self.tree_controller.append( FDModel(os.path.basename(path), path).add_is_file(False)) self.files_controller.clear_tree() for ext in FC().all_support_formats: self.files_controller.append(FDModel(ext)) self.adjustment.set_value(FC().gap_secs) if FC().tabs_mode == "Single": self.singletab_button.set_active(True) self.controls.perspectives.get_perspective( 'fs').get_tabhelper().set_show_tabs(False) if FC().update_tree_on_start: self.update_on_start.set_active(True) self.temp_music_paths = FCache( ).music_paths[0][:] #create copy of list def on_save(self): FC().all_support_formats = self.files_controller.get_all_beans_text() FC().gap_secs = self.adjustment.get_value() if self.singletab_button.get_active(): '''for i in xrange(len(FCache().music_paths) - 1, 0, -1): del FCache().music_paths[i] del FCache().cache_music_tree_beans[i] del FCache().tab_names[i] self.controls.tabhelper.remove_page(i)''' FC().tabs_mode = "Single" self.controls.perspectives.get_perspective( 'fs').get_tabhelper().set_show_tabs(False) if self.temp_music_paths != FCache().music_paths[0]: self.reload_dir() else: FC().tabs_mode = "Multi" self.controls.perspectives.get_perspective( 'fs').get_tabhelper().set_show_tabs(True) if self.update_on_start.get_active(): FC().update_tree_on_start = True else: FC().update_tree_on_start = False def add_dir(self, *a): current_folder = FCache().last_music_path if FCache( ).last_music_path else None paths = directory_chooser_dialog(_("Choose directory with music"), current_folder) if not paths: return path = paths[0] FCache().last_music_path = path[:path.rfind("/")] for path in paths: if path not in self.temp_music_paths: self.tree_controller.append( FDModel(os.path.basename(path), path).add_is_file(False)) self.temp_music_paths.append(path) def remove_dir(self, *a): selection = self.tree_controller.get_selection() fm, paths = selection.get_selected_rows() #@UnusedVariable paths.reverse() for path in paths: del FCache().music_paths[0][path[0]] del FCache().cache_music_tree_beans[0][path[0]] self.tree_controller.delete_selected() remaining_beans = self.tree_controller.get_all_beans() if remaining_beans: self.temp_music_paths = [ bean.path for bean in self.tree_controller.get_all_beans() ] else: self.temp_music_paths = [] def formats(self): frame_box = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 0) frame_box.set_border_width(5) frame_box.show() frame = FrameDecorator(_("File Types"), frame_box, 0.5, 0.5, border_width=0) frame.show() self.files_controller = SimpleListTreeControl(_("Extensions"), None) """buttons""" button_box = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0) button_box.show() bt_add = Gtk.Button.new_with_label(_("Add")) bt_add.connect("clicked", self.on_add_file) bt_add.set_size_request(80, -1) bt_add.show() bt_remove = Gtk.Button.new_with_label(_("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.PolicyType.AUTOMATIC, Gtk.PolicyType.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) return frame def on_add_file(self, *a): val = show_entry_dialog(_("Please add audio extension"), _("Extension should be like '.mp3'")) if val and val.find(".") >= 0 and len( val ) <= 5 and val not in self.files_controller.get_all_beans_text(): self.files_controller.append(FDModel(val)) else: logging.info("Can't add your value" + val) def gap(self): label = Gtk.Label.new(_("Gap between tracks")) self.adjustment = Gtk.Adjustment(value=0, lower=0, upper=5, step_incr=0.5) gap_len = Gtk.SpinButton.new(self.adjustment, 0.0, 1) gap_len.show() hbox = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 10) hbox.pack_start(gap_len, False, False, 0) hbox.pack_start(label, False, False, 0) hbox.show_all() return hbox def tabs_mode(self): hbox = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 0) self.multitabs_button = Gtk.RadioButton.new_with_label( None, _("Multi tab mode")) def on_toggle_multitab(widget, data=None): self.frame.hide() self.multitabs_button.connect("toggled", on_toggle_multitab) hbox.pack_start(self.multitabs_button, True, False, 0) self.singletab_button = Gtk.RadioButton.new_with_label_from_widget( self.multitabs_button, _("Single tab mode")) def on_toggle_singletab(widget, data=None): self.tree_controller.clear_tree() for path in FCache().music_paths[0]: self.tree_controller.append( FDModel(os.path.basename(path), path).add_is_file(False)) self.temp_music_paths = FCache().music_paths[0][:] self.frame.show() self.singletab_button.connect("toggled", on_toggle_singletab) hbox.pack_end(self.singletab_button, True, False, 0) return hbox
def __init__(self, controls): self.controls = controls box = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0) box.hide() self.enable_proxy = Gtk.CheckButton(label=_("Enable HTTP proxy"), use_underline=True) self.enable_proxy.connect("clicked", self.on_enable_http_proxy) self.enable_proxy.show() all = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0) all.show() self.frame = FrameDecorator(_("Proxy Settings"), all, 0.5, 0.5, border_width=0) self.frame.show() """URL""" proxy_box = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 0) proxy_box.show() proxy_lable = Gtk.Label(_("Server")) proxy_lable.set_size_request(150, -1) proxy_lable.show() self.proxy_server = Gtk.Entry() self.proxy_server.show() require = Gtk.Label(_("example: 66.42.182.178:3128")) require.show() proxy_box.pack_start(proxy_lable, False, False, 0) proxy_box.pack_start(self.proxy_server, False, True, 0) proxy_box.pack_start(require, False, True, 0) """LOGIN""" lbox = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 0) lbox.show() login = Gtk.Label(_("Login")) login.set_size_request(150, -1) login.show() self.login_text = Gtk.Entry() self.login_text.show() lbox.pack_start(login, False, False, 0) lbox.pack_start(self.login_text, False, True, 0) """PASSWORD""" pbox = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 0) pbox.show() password = Gtk.Label(_("Password")) password.set_size_request(150, -1) password.show() self.password_text = Gtk.Entry() self.password_text.set_visibility(False) self.password_text.set_invisible_char("*") self.password_text.show() pbox.pack_start(password, False, False, 0) pbox.pack_start(self.password_text, False, True, 0) """check""" check = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 0) check.show() self.vk_test = Gtk.Entry() self.vk_test.set_text("http://vk.com") self.vk_test.show() self.test_button = Gtk.Button(_("Check Connection")) self.test_button.set_size_request(150, -1) self.test_button.connect("clicked", self.text_connection) self.test_button.show() self.result = Gtk.Label(_("Result:")) self.result.show() check.pack_start(self.test_button, False, True, 0) check.pack_start(self.vk_test, False, False, 0) check.pack_start(self.result, False, True, 0) """global""" all.pack_start(self.enable_proxy, False, False, 0) all.pack_start(proxy_box, False, False, 0) all.pack_start(lbox, False, False, 0) all.pack_start(pbox, False, False, 0) all.pack_start(check, False, False, 0) frame_box = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 0) frame_box.set_border_width(5) frame_box.show() self.net_ping = Gtk.CheckButton(label=_("Show message on network disconnection"), use_underline=True) box.pack_start(self.buffer_size(), False, True, 0) box.pack_start(self.net_ping, False, True, 0) box.pack_start(self.frame, False, True, 0) self.widget = box if FC().proxy_enable and FC().proxy_url: set_proxy_settings()
def __init__(self, controls): self.controls = controls box = VBox(self, Gtk.Orientation.VERTICAL, 0) box.hide() """LAST.FM""" l_layout = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0) l_frame = FrameDecorator(_("Last.FM"), l_layout, border_width=0) """LOGIN""" lbox = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 0) lbox.show() login = Gtk.Label.new(_("Login")) login.set_size_request(150, -1) login.show() self.login_text = Gtk.Entry() self.login_text.show() lbox.pack_start(login, False, False, 0) lbox.pack_start(self.login_text, False, True, 0) """PASSWORD""" pbox = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 0) pbox.show() password = Gtk.Label.new(_("Password")) password.set_size_request(150, -1) password.show() self.password_text = Gtk.Entry() self.password_text.set_visibility(False) self.password_text.set_invisible_char("*") self.password_text.show() limit_text = Gtk.Label.new(_("Limit search results: ")) limit_text.show() self.adjustment = Gtk.Adjustment(value=50, lower=10, upper=200, step_incr=10) limit = Gtk.SpinButton.new(self.adjustment, 0.0, 0) limit.show() limitbox = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 0) limitbox.pack_start(limit_text, False, False, 0) limitbox.pack_start(limit, False, False, 0) self.music_scrobbler = Gtk.CheckButton.new_with_label(_("Enable Music Scrobbler")) self.music_scrobbler.show() self.radio_scrobbler = Gtk.CheckButton.new_with_label(_("Enable Radio Scrobbler")) self.radio_scrobbler.show() pbox.pack_start(password, False, False, 0) pbox.pack_start(self.password_text, False, True, 0) l_layout.pack_start(lbox, False, True, 0) l_layout.pack_start(pbox, False, True, 0) l_layout.pack_start(limitbox, False, True, 10) l_layout.pack_start(self.music_scrobbler, False, True, 0) l_layout.pack_start(self.radio_scrobbler, False, True, 0) """VK""" vk_layout = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0) vk_frame = FrameDecorator(_("VKontakte"), vk_layout, border_width=0) self.default_label_value = _("Not connected") self.frase_begin = _("You vk account is:") self.vk_account_label = Gtk.Label.new(self.frase_begin + " %s" % self.default_label_value) self.reset_vk_auth_button = Gtk.Button.new_with_label(_("Reset vk authorization")) self.reset_vk_auth_button.connect("button-release-event", self.on_reset_vk_click) self.vk_autocomplete = Gtk.CheckButton.new_with_label(_("Enable VK autocomplete")) self.vk_autocomplete.show() vk_layout.pack_start(self.vk_account_label, False, False, 0) vk_layout.pack_start(self.reset_vk_auth_button, False, False, 0) vk_layout.pack_start(self.vk_autocomplete, False, False, 0) """all""" box.pack_start(l_frame, False, True, 0) box.pack_start(vk_frame, False, True, 0) self.widget = box
def __init__(self, controls): Gtk.Frame.__init__(self) FControl.__init__(self, controls) self.album_label = Gtk.Label.new(None) self.album_label.set_line_wrap(True) self.album_label.set_markup("<b></b>") self.set_label_widget(self.album_label) self.empty = TextArea() self.best_songs = SimpleTreeControl(_("Best Songs"), controls) self.best_songs.line_title = EventLabel(self.best_songs.get_title(), func=self.show_current, arg=self.best_songs, func1=self.show_best_songs) self.artists = SimpleTreeControl(_("Similar Artists"), controls) self.artists.line_title = EventLabel(self.artists.get_title(), func=self.show_current, arg=self.artists, func1=self.show_similar_artists) self.tracks = SimpleTreeControl(_("Similar Songs"), controls) self.tracks.line_title = EventLabel(self.tracks.get_title(), func=self.show_current, arg=self.tracks, func1=self.show_similar_tracks) self.tags = SimpleTreeControl(_("Similar Tags"), controls) self.tags.line_title = EventLabel(self.tags.get_title(), func=self.show_current, arg=self.tags, func1=self.show_similar_tags) self.lyrics = TextArea() lyric_title = _("Lyrics") self.lyrics.set_text("", lyric_title) self.lyrics.line_title = EventLabel(lyric_title, func=self.show_current, arg=self.lyrics, func1=self.show_similar_lyrics) """wiki""" wBox = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0) wiki_title = _("About Artist") self.wiki = TextArea() wBox.line_title = EventLabel(wiki_title, func=self.show_current, arg=wBox, func1=self.show_wiki_info) """info""" self.last_fm_label = Gtk.LinkButton.new_with_label( "http://www.last.fm", "Last.Fm") self.wiki_label = Gtk.LinkButton.new_with_label( "http://www.wikipedia.org", "Wikipedia") info_line = HBoxDecoratorTrue(self.last_fm_label, self.wiki_label) info_frame = FrameDecorator(_("Info"), info_line, 0.5, 0.5) """downloads""" self.exua_label = Gtk.LinkButton.new_with_label( "http://www.ex.ua", "EX.ua") self.rutracker_label = Gtk.LinkButton.new_with_label( "http://rutracker.org", "Rutracker") dm_line = HBoxDecoratorTrue(self.exua_label, self.rutracker_label) dm_frame = FrameDecorator(_("Downloads"), dm_line, 0.5, 0.5) self.wiki = TextArea() self.wiki.set_text("", wiki_title) wBox.pack_start(HBoxDecoratorTrue(info_frame, dm_frame), False, False, 0) wBox.pack_start(self.wiki, True, True, 0) wBox.scroll = wBox self.vpaned_small = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0) """image and similar artists""" ibox = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 0) self.image = ImageBase(ICON_BLANK_DISK, FC().info_panel_image_size) lbox = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0) self.left_widget = [ wBox, self.artists, self.tracks, self.tags, self.lyrics, self.best_songs ] for l_widget in self.left_widget: lbox.pack_start(l_widget.line_title, True, True, 0) ibox.pack_start(self.image, False, False, 0) ibox.pack_start(lbox, True, True, 0) """image and similar artists""" sbox = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0) for l_widget in self.left_widget: sbox.pack_start(l_widget.scroll, True, True, 0) sbox.pack_end(self.empty.scroll, True, True, 0) self.vpaned_small.pack_start(ibox, False, False, 0) self.vpaned_small.pack_start(sbox, True, True, 0) self.add(self.vpaned_small) self.bean = None self.info_cache = InfoCache() self.update_lock = threading.Lock() self.clear()