class TrayIconConfig(ConfigPlugin): name = _("Tray Icon") def __init__(self, controls): self.controls = controls box = Gtk.Box.new(Gtk.Orientation.VERTICAL, 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.hide_in_tray_on_start = Gtk.CheckButton.new_with_label(_("Hide player in tray on start")) self.tray_icon_button = Gtk.CheckButton.new_with_label(_("Show tray icon")) #self.tray_icon_button.connect("clicked", self.on_show_tray_icon) self.close_button = Gtk.RadioButton.new_with_label(None, _("On close window - close player")) self.hide_button = Gtk.RadioButton.new_with_label_from_widget(self.close_button, _("On close window - hide player")) self.hide_button.connect("toggled", self.on_show_tray_icon) self.minimize_button = Gtk.RadioButton.new_with_label_from_widget(self.close_button,_("On close window - minimize player")) """system icon""" self.static_tray_icon = ChooseDecorator(None, FrameDecorator(_("System Icon Static"), self.static_icon, 0.5, 0.5)) """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, 0.5, 0.5)) """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, 0.5, 0.5)) self.notifier = Gtk.CheckButton.new_with_label(_("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.Box.new(Gtk.Orientation.VERTICAL, 0) 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, 0.5, 0.5), False, False, 0) self.widget = box def on_show_tray_icon(self, *args): if not self.tray_icon_button.get_active(): self.hide_button.set_sensitive(False) if self.hide_button.get_active(): self.minimize_button.set_active(True) self.controls.trayicon.hide() else: self.controls.trayicon.show() self.hide_button.set_sensitive(True) def on_static_icon(self): if FC().static_tray_icon: FC().static_icon_entry = self.static_icon.get_active_path() self.controls.trayicon.set_from_resource(FC().static_icon_entry) def check_active_dynamic_icon(self, icon_object): icon_name = icon_object.entry.get_text() try: path = get_foobnix_resourse_path_by_name(icon_name) self.controls.trayicon.set_image_from_path(path) except TypeError: pass def notify_time(self): label = Gtk.Label.new(_("Time Notification (sec): ")) self.adjustment = Gtk.Adjustment(value=0, lower=1, upper=10, step_incr=0.5) not_len = Gtk.SpinButton.new(self.adjustment, 0.0, 0) not_len.show() hbox = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 5) hbox.pack_start(label, False, False, 0) hbox.pack_start(not_len, False, False, 0) hbox.show_all() hbox.set_sensitive(False) return hbox def on_toggle(self, *a): if self.notifier.get_active(): self.n_time.set_sensitive(True) else: self.n_time.set_sensitive(False) def on_load(self): self.tray_icon_button.set_active(FC().show_tray_icon) self.static_tray_icon.button.set_active(FC().static_tray_icon) self.icon_controls.button.set_active(FC().system_icons_dinamic) self.change_tray_icon.button.set_active(FC().change_tray_icon) self.hide_in_tray_on_start.set_active(FC().hide_on_start) if FC().on_close_window == const.ON_CLOSE_CLOSE: self.close_button.set_active(True) elif FC().on_close_window == const.ON_CLOSE_HIDE: self.hide_button.set_active(True) elif FC().on_close_window == const.ON_CLOSE_MINIMIZE: self.minimize_button.set_active(True) if FC().notifier: self.notifier.set_active(True) self.n_time.set_sensitive(True) self.adjustment.set_value(FC().notify_time / 1000) self.static_icon.entry.set_text(FC().static_icon_entry) self.play_icon.entry.set_text(FC().play_icon_entry) self.pause_icon.entry.set_text(FC().pause_icon_entry) self.stop_icon.entry.set_text(FC().stop_icon_entry) self.radio_icon.entry.set_text(FC().radio_icon_entry) def on_save(self): FC().show_tray_icon = self.tray_icon_button.get_active() FC().hide_on_start = self.hide_in_tray_on_start.get_active() FC().static_tray_icon = self.static_tray_icon.button.get_active() if FC().static_tray_icon: self.on_static_icon() if FC().system_icons_dinamic: FC().play_icon_entry = self.play_icon.get_active_path() FC().pause_icon_entry = self.pause_icon.get_active_path() FC().stop_icon_entry = self.stop_icon.get_active_path() FC().radio_icon_entry = self.radio_icon.get_active_path() FC().system_icons_dinamic = self.icon_controls.button.get_active() FC().change_tray_icon = self.change_tray_icon.button.get_active() if self.close_button.get_active(): FC().on_close_window = const.ON_CLOSE_CLOSE elif self.hide_button.get_active(): FC().on_close_window = const.ON_CLOSE_HIDE elif self.minimize_button.get_active(): FC().on_close_window = const.ON_CLOSE_MINIMIZE if self.notifier.get_active(): FC().notifier = True else: FC().notifier = False FC().static_icon_entry = self.static_icon.entry.get_text() FC().play_icon_entry = self.play_icon.entry.get_text() FC().pause_icon_entry = self.pause_icon.entry.get_text() FC().stop_icon_entry = self.stop_icon.entry.get_text() FC().radio_icon_entry = self.radio_icon.entry.get_text() FC().notify_time = int(self.adjustment.get_value() * 1000) if IconBlock.temp_list != FC().all_icons: FC().all_icons = IconBlock.temp_list self.on_show_tray_icon()
class OtherConfig(ConfigPlugin): name = CONFIG_OTHER def __init__(self, controls): self.controls = controls box = gtk.VBox(False, 0) box.hide() """save to""" hbox = gtk.HBox(False, 5) self.online_dir = gtk.FileChooserButton("set place") self.online_dir.set_action(gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER) self.online_dir.connect("current-folder-changed", self.on_change_folder) self.online_dir.show() hbox.pack_start(gtk.Label(_("Save music to folder:")), False, True, 0) hbox.pack_start(self.online_dir, True, True, 0) """automatic save""" self.automatic_save_checkbutton = gtk.CheckButton( label=_("Automatic music save"), use_underline=True) """download threads""" thbox = gtk.HBox(False, 5) tab_label = gtk.Label(_("Download in threads")) tab_label.show() adjustment = gtk.Adjustment(value=1, lower=1, upper=10, step_incr=1, page_incr=1, page_size=0) self.threads_count = gtk.SpinButton(adjustment) self.threads_count.show() thbox.pack_start(tab_label, False, False) thbox.pack_start(self.threads_count, False, True) """disc cover size""" cbox = gtk.HBox(False, 5) cbox.show() tab_label = gtk.Label(_("Disc cover size:")) tab_label.show() adjustment = gtk.Adjustment(value=1, lower=100, upper=350, step_incr=20, page_incr=50, page_size=0) self.image_size_spin = gtk.SpinButton(adjustment) self.image_size_spin.show() cbox.pack_start(tab_label, False, False) cbox.pack_start(self.image_size_spin, False, True) """notification""" self.check_new_version = gtk.CheckButton( label=_("Check for new foobnix release on start"), use_underline=True) self.check_new_version.show() demo = gtk.Button(_("Show new foobnix release avaliable demo dialog")) demo.connect( "clicked", lambda *a: info_dialog_with_link_and_donate("foobnix [version]")) demo.show() """background image""" catbox = gtk.HBox(False, 5) self.bg_image = IconBlock("", controls, FC().background_image, FC().background_image_themes) self.is_show = gtk.CheckButton(label=_("Enable theme image"), use_underline=True) catbox.pack_start(self.is_show, False, True, 0) catbox.pack_start(self.bg_image, True, True, 0) """menu position""" pbox = gtk.HBox(False, 5) pbox.show() label = gtk.Label(_("Menu type: ")) self.old_style = gtk.RadioButton(None, _("Old Style (Menu Bar)")) self.new_style = gtk.RadioButton(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.HBox(False, 5) o_r_box.show() o_r_label = gtk.Label(_("Order-Repeat Switcher Style:")) self.buttons = gtk.RadioButton(None, _("Toggle Buttons")) self.labels = gtk.RadioButton(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.HBox(False, 5) obox.show() tab_label = gtk.Label(_("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(adjustment) 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.HBox(False, 5) hcombobox.pack_start( gtk.Label(_('Choose your preferred file manager:')), False, False) hcombobox.pack_start(self.fmgrs_combo, False, False) self.disable_screensaver = gtk.CheckButton( label=_("Disable Xscreensaver"), use_underline=True) self.net_ping = gtk.CheckButton(label=_("Enable Network Checker"), use_underline=True) """packaging""" box.pack_start(hbox, False, True, 0) box.pack_start(self.automatic_save_checkbutton, False, True, 0) box.pack_start(thbox, False, True, 0) box.pack_start(cbox, False, True, 0) box.pack_start(self.check_new_version, False, True, 0) box.pack_start(demo, False, False, 0) box.pack_start(catbox, False, False, 0) box.pack_start(pbox, False, False, 0) box.pack_start(o_r_box, False, False, 0) box.pack_start(obox, False, False, 0) box.pack_start(hcombobox, False, False, 0) box.pack_start(self.disable_screensaver) box.pack_start(self.net_ping) self.widget = box def on_chage_opacity(self, *a): opacity = self.opacity_size.get_value() / 100 self.controls.main_window.set_opacity(opacity) self.controls.preferences.set_opacity(opacity) def on_change_menu_type(self, *a): if self.old_style.get_active(): FC().menu_style = "old" elif self.new_style.get_active(): FC().menu_style = "new" self.controls.top_panel.update_menu_style() def on_change_folder(self, *a): path = self.online_dir.get_filename() FC().online_save_to_folder = path logging.info("Change music online folder: " + path) def on_load(self): self.online_dir.set_current_folder(FC().online_save_to_folder) self.online_dir.set_sensitive(FC().is_save_online) """disc""" self.image_size_spin.set_value(FC().info_panel_image_size) self.threads_count.set_value(FC().amount_dm_threads) self.opacity_size.set_value(int(FC().window_opacity * 100)) self.check_new_version.set_active(FC().check_new_version) if FC().background_image: self.is_show.set_active(True) if FC().automatic_online_save: self.automatic_save_checkbutton.set_active(True) """menu style""" if FC().menu_style == "new": self.new_style.set_active(True) else: self.old_style.set_active(True) if FC().order_repeat_style == "TextLabels": self.labels.set_active(True) self.fmgrs_combo.set_active(FC().active_manager[0]) if FC().antiscreensaver == True: self.disable_screensaver.set_active(True) antiscreensaver() if FC().net_ping == True: self.net_ping.set_active(True) def on_save(self): self.is_background_image = FC().background_image if self.is_show.get_active(): FC().background_image = self.bg_image.get_active_path() else: FC().background_image = None if self.buttons.get_active(): FC().order_repeat_style = "ToggleButtons" else: FC().order_repeat_style = "TextLabels" self.controls.os.on_load() FC().info_panel_image_size = self.image_size_spin.get_value_as_int() FC().amount_dm_threads = self.threads_count.get_value_as_int() FC().window_opacity = self.opacity_size.get_value() / 100 FC().check_new_version = self.check_new_version.get_active() FC( ).automatic_online_save = self.automatic_save_checkbutton.get_active() if self.is_background_image != FC().background_image: self.controls.change_backgound() self.controls.preferences.hide() self.controls.preferences.show() FC().active_manager = [ self.fmgrs_combo.get_active(), self.fmgrs_combo.get_active_text().lower() ] if self.disable_screensaver.get_active(): FC().antiscreensaver = True antiscreensaver() else: FC().antiscreensaver = False if self.net_ping.get_active(): FC().net_ping = True else: FC().net_ping = False self.on_change_menu_type() def fmgr_combobox(self): combobox = gtk.combo_box_new_text() combobox.append_text('--- Auto ---') combobox.append_text('Nautilus') combobox.append_text('Dolphin') combobox.append_text('Konqueror') combobox.append_text('Thunar') combobox.append_text('PCManFM') combobox.append_text('Krusader') combobox.append_text('Explorer') combobox.set_active(0) return combobox
class OtherConfig(ConfigPlugin): name = CONFIG_OTHER def __init__(self, controls): self.controls = controls box = gtk.VBox(False, 0) box.hide() """save to""" hbox = gtk.HBox(False, 0) self.online_dir = gtk.FileChooserButton("set place") self.online_dir.set_action(gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER) self.online_dir.connect("current-folder-changed", self.on_change_folder) self.online_dir.show() hbox.pack_start(gtk.Label(_("Save music to folder")), False, True, 0) hbox.pack_start(self.online_dir, True, True, 0) """disc cover size""" cbox = gtk.HBox(False, 0) cbox.show() tab_label = gtk.Label(_("Disc cover size")) tab_label.show() adjustment = gtk.Adjustment(value=1, lower=100, upper=350, step_incr=20, page_incr=50, page_size=0) self.image_size_spin = gtk.SpinButton(adjustment) self.image_size_spin.show() cbox.pack_start(tab_label, False, False, 0) cbox.pack_start(self.image_size_spin, False, True, 0) """notification""" self.check_new_version = gtk.CheckButton(label=_("Check for new foobnix release on start"), use_underline=True) self.check_new_version.show() demo = gtk.Button(_("Show new foobnix release avaliable demo dialog")) demo.connect("clicked", lambda * a:info_dialog_with_link_and_donate("foobnix [version]")) demo.show() """background image""" catbox = gtk.HBox(False, 0) self.bg_image = IconBlock("", controls, FC().background_image, FC().background_image_themes) self.is_show = gtk.CheckButton(label=_("Enable theme image"), use_underline=True) def on_change(*a): active = self.is_show.get_active() if not active: FC().background_image = None self.is_show.connect("clicked", on_change) catbox.pack_start(self.is_show, False, True, 0) catbox.pack_start(self.bg_image, True, True, 0) """menu position""" pbox = gtk.HBox(False, 0) pbox.show() label = gtk.Label(_("Menu type: ")) self.old_style = gtk.RadioButton(None, _("Old Style (Menu Bar)")) self.old_style.connect("toggled", self.on_change_menu_type) self.new_style = gtk.RadioButton(self.old_style, _("New Style (Button)")) self.new_style.connect("toggled", self.on_change_menu_type) 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.HBox() o_r_box.show() o_r_label = gtk.Label(_("Order-Repeat Switcher Style: ")) self.buttons = gtk.RadioButton(None, _("Toggle Buttons")) #self.buttons.connect("toggled", self.on_change_o_r_style) self.labels = gtk.RadioButton(self.buttons, _("Text Labels")) #self.labels.connect("toggled", self.on_change_o_r_style) 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.HBox(False, 0) obox.show() tab_label = gtk.Label(_("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(adjustment) 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) """packaging""" box.pack_start(hbox, False, True, 0) box.pack_start(cbox, False, True, 0) box.pack_start(self.check_new_version, False, True, 0) box.pack_start(demo, False, False, 0) box.pack_start(catbox, False, False, 0) box.pack_start(pbox, False, False, 0) box.pack_start(o_r_box, False, False, 0) box.pack_start(obox, False, False, 0) self.widget = box def on_chage_opacity(self, *a): opacity = self.opacity_size.get_value() / 100 self.controls.main_window.set_opacity(opacity) self.controls.preferences.set_opacity(opacity) def on_change_menu_type(self, *a): if self.old_style.get_active(): FC().menu_style = "old" elif self.new_style.get_active(): FC().menu_style = "new" self.controls.top_panel.update_menu_style() '''def on_change_o_r_style(self, *a): if self.buttons.get_active(): FC().order_repeat_style = "ToggleButtons" else: FC().order_repeat_style = "TextLabels"''' def on_change_folder(self, *a): path = self.online_dir.get_filename() FC().online_save_to_folder = path logging.info("Change music online folder: "+ path) def on_load(self): self.online_dir.set_current_folder(FC().online_save_to_folder) self.online_dir.set_sensitive(FC().is_save_online) """disc""" self.image_size_spin.set_value(FC().info_panel_image_size) self.opacity_size.set_value(int(FC().window_opacity * 100)) self.check_new_version.set_active(FC().check_new_version) if FC().background_image: self.is_show.set_active(True) """menu style""" if FC().menu_style == "new": self.new_style.set_active(True) else: self.old_style.set_active(True) if FC().order_repeat_style == "TextLabels": self.labels.set_active(True) def on_save(self): if self.is_show.get_active(): FC().background_image = self.bg_image.get_active_path() if self.buttons.get_active(): FC().order_repeat_style = "ToggleButtons" else: FC().order_repeat_style = "TextLabels" self.controls.os.on_load() FC().info_panel_image_size = self.image_size_spin.get_value_as_int() FC().window_opacity = self.opacity_size.get_value() / 100 FC().check_new_version = self.check_new_version.get_active() self.controls.change_backgound()
class TrayIconConfig(ConfigPlugin): name = _("Tray Icon") 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 on_show_tray_icon(self, *args): if not self.tray_icon_button.get_active(): self.hide_button.set_sensitive(False) if self.hide_button.get_active(): self.minimize_button.set_active(True) self.controls.trayicon.hide() else: self.controls.trayicon.show() self.hide_button.set_sensitive(True) def on_static_icon(self): if FC().static_tray_icon: FC().static_icon_entry = self.static_icon.get_active_path() self.controls.trayicon.set_from_resource(FC().static_icon_entry) def check_active_dynamic_icon(self, icon_object): icon_name = icon_object.entry.get_text() try: path = get_foobnix_resourse_path_by_name(icon_name) self.controls.trayicon.set_image_from_path(path) except TypeError: pass def notify_time(self): label = Gtk.Label(_("Time Notification (sec): ")) self.adjustment = Gtk.Adjustment(value=0, lower=1, upper=10, step_incr=0.5) not_len = Gtk.SpinButton(adjustment=self.adjustment, climb_rate=0.0, digits=1) not_len.show() hbox = Gtk.HBox(False, 5) hbox.pack_start(label, False, False, 0) hbox.pack_start(not_len, False, False, 0) hbox.show_all() hbox.set_sensitive(False) return hbox def on_toggle(self, *a): if self.notifier.get_active(): self.n_time.set_sensitive(True) else: self.n_time.set_sensitive(False) def on_load(self): self.tray_icon_button.set_active(FC().show_tray_icon) self.static_tray_icon.button.set_active(FC().static_tray_icon) self.icon_controls.button.set_active(FC().system_icons_dinamic) self.change_tray_icon.button.set_active(FC().change_tray_icon) self.hide_in_tray_on_start.set_active(FC().hide_on_start) if FC().on_close_window == const.ON_CLOSE_CLOSE: self.close_button.set_active(True) elif FC().on_close_window == const.ON_CLOSE_HIDE: self.hide_button.set_active(True) elif FC().on_close_window == const.ON_CLOSE_MINIMIZE: self.minimize_button.set_active(True) if FC().notifier: self.notifier.set_active(True) self.n_time.set_sensitive(True) self.adjustment.set_value(FC().notify_time / 1000) self.static_icon.entry.set_text(FC().static_icon_entry) self.play_icon.entry.set_text(FC().play_icon_entry) self.pause_icon.entry.set_text(FC().pause_icon_entry) self.stop_icon.entry.set_text(FC().stop_icon_entry) self.radio_icon.entry.set_text(FC().radio_icon_entry) def on_save(self): FC().show_tray_icon = self.tray_icon_button.get_active() FC().hide_on_start = self.hide_in_tray_on_start.get_active() FC().static_tray_icon = self.static_tray_icon.button.get_active() if FC().static_tray_icon: self.on_static_icon() if FC().system_icons_dinamic: FC().play_icon_entry = self.play_icon.get_active_path() FC().pause_icon_entry = self.pause_icon.get_active_path() FC().stop_icon_entry = self.stop_icon.get_active_path() FC().radio_icon_entry = self.radio_icon.get_active_path() FC().system_icons_dinamic = self.icon_controls.button.get_active() FC().change_tray_icon = self.change_tray_icon.button.get_active() if self.close_button.get_active(): FC().on_close_window = const.ON_CLOSE_CLOSE elif self.hide_button.get_active(): FC().on_close_window = const.ON_CLOSE_HIDE elif self.minimize_button.get_active(): FC().on_close_window = const.ON_CLOSE_MINIMIZE if self.notifier.get_active(): FC().notifier = True else: FC().notifier = False FC().static_icon_entry = self.static_icon.entry.get_text() FC().play_icon_entry = self.play_icon.entry.get_text() FC().pause_icon_entry = self.pause_icon.entry.get_text() FC().stop_icon_entry = self.stop_icon.entry.get_text() FC().radio_icon_entry = self.radio_icon.entry.get_text() FC().notify_time = int(self.adjustment.get_value() * 1000) if IconBlock.temp_list != FC().all_icons: FC().all_icons = IconBlock.temp_list self.on_show_tray_icon()
class OtherConfig(ConfigPlugin): name = CONFIG_OTHER def __init__(self, controls): self.controls = controls box = gtk.VBox(False, 0) box.hide() """save to""" hbox = gtk.HBox(False, 5) self.online_dir = gtk.FileChooserButton("set place") self.online_dir.set_action(gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER) self.online_dir.connect("current-folder-changed", self.on_change_folder) self.online_dir.show() hbox.pack_start(gtk.Label(_("Save music to folder:")), False, True, 0) hbox.pack_start(self.online_dir, True, True, 0) """automatic save""" self.automatic_save_checkbutton = gtk.CheckButton(label=_("Automatic music save"), use_underline=True) """download threads""" thbox = gtk.HBox(False, 5) tab_label = gtk.Label(_("Download in threads")) tab_label.show() adjustment = gtk.Adjustment(value=1, lower=1, upper=10, step_incr=1, page_incr=1, page_size=0) self.threads_count = gtk.SpinButton(adjustment) self.threads_count.show() thbox.pack_start(tab_label, False, False) thbox.pack_start(self.threads_count, False, True) """disc cover size""" cbox = gtk.HBox(False, 5) cbox.show() tab_label = gtk.Label(_("Disc cover size:")) tab_label.show() adjustment = gtk.Adjustment(value=1, lower=100, upper=350, step_incr=20, page_incr=50, page_size=0) self.image_size_spin = gtk.SpinButton(adjustment) self.image_size_spin.show() cbox.pack_start(tab_label, False, False) cbox.pack_start(self.image_size_spin, False, True) """notification""" self.check_new_version = gtk.CheckButton(label=_("Check for new foobnix release on start"), use_underline=True) self.check_new_version.show() demo = gtk.Button(_("Show new foobnix release avaliable demo dialog")) demo.connect("clicked", lambda * a:info_dialog_with_link_and_donate("foobnix [version]")) demo.show() """background image""" catbox = gtk.HBox(False, 5) self.bg_image = IconBlock("", controls, FC().background_image, FC().background_image_themes) self.is_show = gtk.CheckButton(label=_("Enable theme image"), use_underline=True) catbox.pack_start(self.is_show, False, True, 0) catbox.pack_start(self.bg_image, True, True, 0) """menu position""" pbox = gtk.HBox(False, 5) pbox.show() label = gtk.Label(_("Menu type: ")) self.old_style = gtk.RadioButton(None, _("Old Style (Menu Bar)")) self.new_style = gtk.RadioButton(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.HBox(False, 5) o_r_box.show() o_r_label = gtk.Label(_("Order-Repeat Switcher Style:")) self.buttons = gtk.RadioButton(None, _("Toggle Buttons")) self.labels = gtk.RadioButton(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.HBox(False, 5) obox.show() tab_label = gtk.Label(_("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(adjustment) 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.HBox(False, 5) hcombobox.pack_start(gtk.Label(_('Choose your preferred file manager:')), False, False) hcombobox.pack_start(self.fmgrs_combo, False, False) self.disable_screensaver = gtk.CheckButton(label=_("Disable Xscreensaver"), use_underline=True) self.net_ping = gtk.CheckButton(label=_("Enable Network Checker"), use_underline=True) """packaging""" box.pack_start(hbox, False, True, 0) box.pack_start(self.automatic_save_checkbutton, False, True, 0) box.pack_start(thbox, False, True, 0) box.pack_start(cbox, False, True, 0) box.pack_start(self.check_new_version, False, True, 0) box.pack_start(demo, False, False, 0) box.pack_start(catbox, False, False, 0) box.pack_start(pbox, False, False, 0) box.pack_start(o_r_box, False, False, 0) box.pack_start(obox, False, False, 0) box.pack_start(hcombobox, False, False, 0) box.pack_start(self.disable_screensaver) box.pack_start(self.net_ping) self.widget = box def on_chage_opacity(self, *a): opacity = self.opacity_size.get_value() / 100 self.controls.main_window.set_opacity(opacity) self.controls.preferences.set_opacity(opacity) def on_change_menu_type(self, *a): if self.old_style.get_active(): FC().menu_style = "old" elif self.new_style.get_active(): FC().menu_style = "new" self.controls.top_panel.update_menu_style() def on_change_folder(self, *a): path = self.online_dir.get_filename() FC().online_save_to_folder = path logging.info("Change music online folder: " + path) def on_load(self): self.online_dir.set_current_folder(FC().online_save_to_folder) self.online_dir.set_sensitive(FC().is_save_online) """disc""" self.image_size_spin.set_value(FC().info_panel_image_size) self.threads_count.set_value(FC().amount_dm_threads) self.opacity_size.set_value(int(FC().window_opacity * 100)) self.check_new_version.set_active(FC().check_new_version) if FC().background_image: self.is_show.set_active(True) if FC().automatic_online_save: self.automatic_save_checkbutton.set_active(True) """menu style""" if FC().menu_style == "new": self.new_style.set_active(True) else: self.old_style.set_active(True) if FC().order_repeat_style == "TextLabels": self.labels.set_active(True) self.fmgrs_combo.set_active(FC().active_manager[0]) if FC().antiscreensaver == True: self.disable_screensaver.set_active(True) antiscreensaver() if FC().net_ping == True: self.net_ping.set_active(True) def on_save(self): self.is_background_image = FC().background_image if self.is_show.get_active(): FC().background_image = self.bg_image.get_active_path() else: FC().background_image = None if self.buttons.get_active(): FC().order_repeat_style = "ToggleButtons" else: FC().order_repeat_style = "TextLabels" self.controls.os.on_load() FC().info_panel_image_size = self.image_size_spin.get_value_as_int() FC().amount_dm_threads = self.threads_count.get_value_as_int() FC().window_opacity = self.opacity_size.get_value() / 100 FC().check_new_version = self.check_new_version.get_active() FC().automatic_online_save = self.automatic_save_checkbutton.get_active() if self.is_background_image != FC().background_image: self.controls.change_backgound() self.controls.preferences.hide() self.controls.preferences.show() FC().active_manager = [self.fmgrs_combo.get_active(), self.fmgrs_combo.get_active_text().lower()] if self.disable_screensaver.get_active(): FC().antiscreensaver = True antiscreensaver() else: FC().antiscreensaver = False if self.net_ping.get_active(): FC().net_ping = True else: FC().net_ping = False self.on_change_menu_type() def fmgr_combobox(self): combobox = gtk.combo_box_new_text() combobox.append_text('--- Auto ---') combobox.append_text('Nautilus') combobox.append_text('Dolphin') combobox.append_text('Konqueror') combobox.append_text('Thunar') combobox.append_text('PCManFM') combobox.append_text('Krusader') combobox.append_text('Explorer') combobox.set_active(0) return combobox