def context_menu_create_presets(self, slider, popup_menu): presets_menu = Gtk.Menu() presets_menu_item = Gtk.MenuItem() presets_menu_item.set_label(i18n("Preset")) presets_menu_item.set_submenu(presets_menu) popup_menu.append(presets_menu_item) if slider.is_ladspa(): if slider.module_proxy.is_ladspa_preset(): save = Gtk.MenuItem() save.set_label(i18n("Save")) presets_menu.append(save) save.connect("activate", self.on_save_preset_clicked) saveas = Gtk.MenuItem() saveas.set_label(i18n("Save As...")) presets_menu.append(saveas) saveas.connect("activate", self.on_save_as_preset_clicked) separator = Gtk.SeparatorMenuItem() presets_menu.append(separator) self.presets_slider = slider for preset in LADSPAPresetLoader().presets(): action = Gtk.CheckMenuItem() action.set_draw_as_radio(True) action.set_label(preset["preset_name"]) presets_menu.append(action) if slider.get_selected_preset() == preset["preset_name"]: action.set_active(True) action.connect("activate", self.on_preset_clicked, preset)
def help(self): uri = "ghelp:scribes" from gtk import show_uri, get_current_event_time result = show_uri(self.window.get_screen(), uri, get_current_event_time()) from gettext import gettext as i18n message = i18n("Launching user guide") if result else i18n("Failed to launch user guide") image = "help" if result else "fail" self.update_message(message, image, 10) return
def help(self): uri = "ghelp:scribes" from gtk import show_uri, get_current_event_time result = show_uri(self.window.get_screen(), uri, get_current_event_time()) from gettext import gettext as i18n message = i18n("Launching user guide") if result else i18n( "Failed to launch user guide") image = "help" if result else "fail" self.update_message(message, image, 10) return
def context_menu_create_volume_meter(self, sink, popup_menu): item = Gtk.CheckMenuItem() item.set_active(sink.has_monitor()) #item.set_draw_as_radio(True) item.set_label(i18n("Volume meter")) item.connect("activate", self.on_volume_meter_clicked, sink) popup_menu.append(item)
def context_menu_create_mute(self, sink, popup_menu): item = Gtk.CheckMenuItem() item.set_active(sink.isMuted()) #item.set_draw_as_radio(True) item.set_label(i18n("Mute")) item.connect("activate", self.on_mute_clicked, sink) popup_menu.append(item)
def context_menu_create_sounddevices(self, sink, popup_menu): self.card_settings = {} self.menus = [] for card in self.card_infos.values(): current = self.get_card_info_for(sink) card_menu = None if current != None and current.get_description() == card.get_description(): card_menu = Gtk.Menu() card_menu_item = Gtk.MenuItem() card_menu_item.set_label(i18n("Profile")) card_menu_item.set_submenu(card_menu) popup_menu.append(card_menu_item) else: card_menu = Gtk.Menu() card_menu_item = Gtk.MenuItem() card_menu_item.set_label(card.get_description()) card_menu_item.set_submenu(card_menu) self.menus.append(card_menu_item) active_profile_name = card.get_active_profile_name() self.profiles = card.get_profiles() for profile in self.profiles: action = Gtk.CheckMenuItem() action.set_draw_as_radio(True) action.set_label(profile.description) self.card_settings[action] = card if profile.name == active_profile_name: action.set_active(True) action.connect("activate", self.on_card_profile_clicked, sink) card_menu.append(action)
def context_menu_create_expand(self, slider_widget, popup_menu): item = Gtk.CheckMenuItem() #item.set_draw_as_radio(True) item.set_label(i18n("Unlock Channels")) item.set_active(slider_widget.is_expanded()) item.connect("activate", self.on_expand_clicked, slider_widget) popup_menu.append(item)
def context_menu_create_presets_and_effects(self, sink, popup_menu): effects_menu = Gtk.Menu() effects_menu_item = Gtk.MenuItem() effects_menu_item.set_label(i18n("Add Effect")) effects_menu_item.set_submenu(effects_menu) popup_menu.append(effects_menu_item) self.context_menu_create_presets(sink, effects_menu) self.context_menu_create_effects(sink, effects_menu)
def __init__(self, bus): dbus.service.Object.__init__ (self, bus, "/", DBUS_INTERFACE) self.window = Gtk.Window(title=i18n("Veromix"),type =Gtk.WindowType.TOPLEVEL) self.window.set_icon_name("veromix") self.window.connect('delete-event', self.on_delete_event) self.window.set_default_size(430, 180) veromix = Veromix(self.window, bus) self.window.add(veromix) self.create_indicator(veromix) self.window.show_all()
def __init__(self, bus): dbus.service.Object.__init__(self, bus, "/", DBUS_INTERFACE) self.window = Gtk.Window(title=i18n("Veromix"), type=Gtk.WindowType.TOPLEVEL) self.window.set_icon_name("veromix") self.window.connect('delete-event', self.on_delete_event) self.window.set_default_size(430, 180) veromix = Veromix(self.window, bus) self.window.add(veromix) self.create_indicator(veromix) self.window.show_all()
def context_menu_create_effects(self, slider, popup_menu): effects_menu = Gtk.Menu() effects_menu_item = Gtk.MenuItem() effects_menu_item.set_label(i18n("Effect")) effects_menu_item.set_submenu(effects_menu) popup_menu.append(effects_menu_item) self.effect_slider = slider for preset in LADSPAEffects().effects(): action = Gtk.CheckMenuItem() action.set_draw_as_radio(True) action.set_label(preset["preset_name"]) effects_menu.append(action) if slider.get_selected_effect() == preset["label"]: action.set_active(True) action.connect("activate", self.on_effect_clicked, preset)
def create_menu_sinks(self, proxy, popup_menu): moveto_menu = Gtk.Menu() moveto_menu_item = Gtk.MenuItem(i18n("Move To")) moveto_menu_item.set_submenu(moveto_menu) self.sink_actions = {} sinks = self.veromix.get_sink_widgets() for sink in sinks: action = Gtk.CheckMenuItem() action.set_draw_as_radio(True) action.set_label(sink.pa_sink_proxy().get_nice_title()) self.sink_actions[action] = sink.pa_sink_proxy() if proxy.get_output_index() == sink.pa_sink_proxy().get_index(): action.set_active(True) moveto_menu.append(action) action.connect("activate", self.on_moveto_sink_clicked, proxy) popup_menu.append(moveto_menu_item)
def __init__(self, parent): Gtk.MessageDialog.__init__(self, 0, Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT, Gtk.MessageType.QUESTION, Gtk.ButtonsType.OK_CANCEL, i18n("Save Preset")) self.set_markup('Please enter a <b>name</b> for the preset:') self.entry = Gtk.Entry() self.entry.connect("activate", self.save_and_close, self, Gtk.ResponseType.OK) hbox = Gtk.HBox() hbox.pack_start(Gtk.Label("Name:"), False, 5, 5) hbox.pack_end(self.entry, True, 5, 5) self.format_secondary_markup("It will be save in ~/.pulse/presets") self.vbox.pack_end(hbox, True, True, 0) self.show_all()
def context_menu_create_ports(self, sink, popup_menu): self.port_actions = {} if len(sink.ports.keys()) > 1: ports_menu = Gtk.Menu() ports_menu_item = Gtk.MenuItem(i18n("Ports")) ports_menu_item.set_submenu(ports_menu) ports = sink.ports for port in ports.keys(): action = Gtk.CheckMenuItem() action.set_draw_as_radio(True) action.set_label(ports[port]) self.port_actions[action]=port if port == sink.active_port: action.set_active(True) ports_menu.append(action) action.connect("activate", self.on_card_port_clicked, sink) popup_menu.append(ports_menu_item)
def _(string): return utf8(i18n(string))
def context_menu_create_defaultsink(self, sink, popup_menu): item = Gtk.CheckMenuItem() item.set_active(sink.is_default()) item.set_label(i18n("Default device")) item.connect("activate", self.on_defaultsink_clicked, sink) popup_menu.append(item)
def context_menu_create_kill(self, sink, popup_menu): item = Gtk.MenuItem() item.set_label(i18n("Disconnect/kill")) item.connect("activate", self.on_kill_clicked, sink) popup_menu.append(item)