def install_quicklist(self): self.DBUSMENU_SUPPORT = True try: from gi.repository import Unity, Dbusmenu self.dbusmenu_checked = (Dbusmenu.MENUITEM_PROP_TOGGLE_STATE, Dbusmenu.MENUITEM_TOGGLE_STATE_CHECKED) self.dbusmenu_unchecked = (Dbusmenu.MENUITEM_PROP_TOGGLE_STATE, Dbusmenu.MENUITEM_TOGGLE_STATE_UNCHECKED) except: self.DBUSMENU_SUPPORT = False return self.launcher = Unity.LauncherEntry.get_for_desktop_id("veromix.desktop") self.quicklist = Dbusmenu.Menuitem.new() self.dbusmenu_mute = Dbusmenu.Menuitem.new() self.dbusmenu_mute.property_set(Dbusmenu.MENUITEM_PROP_LABEL, "Mute") self.dbusmenu_mute.property_set(Dbusmenu.MENUITEM_PROP_TOGGLE_TYPE, Dbusmenu.MENUITEM_TOGGLE_CHECK) self.dbusmenu_mute.property_set_int(Dbusmenu.MENUITEM_PROP_TOGGLE_STATE, Dbusmenu.MENUITEM_TOGGLE_STATE_UNCHECKED) self.dbusmenu_mute.property_set_bool(Dbusmenu.MENUITEM_PROP_VISIBLE, True) self.dbusmenu_mute.connect (Dbusmenu.MENUITEM_SIGNAL_ITEM_ACTIVATED, self.on_middle_click, None) self.quicklist.child_append(self.dbusmenu_mute) if not config().get_window_exit_on_close(): quit = Dbusmenu.Menuitem.new() quit.property_set (Dbusmenu.MENUITEM_PROP_LABEL, "Shutdown Veromix") quit.property_set_bool(Dbusmenu.MENUITEM_PROP_VISIBLE, True) quit.connect(Dbusmenu.MENUITEM_SIGNAL_ITEM_ACTIVATED, Gtk.main_quit, None) self.quicklist.child_append(quit) self.launcher.set_property("quicklist", self.quicklist)
def init_mpris2(self): if not config().get_media_player_enabled(): return self self.pa.enable_mpris2() for controller in self.pa.get_mpris2_players(): v = controller.get_name() # if self.in_mediaplayer_blacklist(v): # return self.sink_box.on_media_player_added(None, controller.get_name(), controller)
def __init__(self, veromix): self.window = veromix.window self.veromix = veromix self.menu = Gtk.Menu() self.indicator = None if config().get_indicator_type() != 'None': self.install_menu() self.install_quicklist() self.connect_events()
def install_menu(self): self.APPIND_SUPPORT = True try: from gi.repository import AppIndicator3 except: self.APPIND_SUPPORT = False if self.APPIND_SUPPORT and config().get_indicator_type( ) == 'AppIndicator': self.indicator = AppIndicator3.Indicator.new( "Veromix", "audio-volume-medium", AppIndicator3.IndicatorCategory.APPLICATION_STATUS) self.indicator.set_status(AppIndicator3.IndicatorStatus.ACTIVE) self.indicator.set_menu(self.menu) self.indicator.connect("scroll-event", self.on_scroll_wheel) # self.indicator.connect("menu-show", self.toggle_window) toggle = Gtk.MenuItem() toggle.set_label("Toggle Window") toggle.connect("activate", self.toggle_window) mute = Gtk.MenuItem() mute.set_label("Mute") mute.connect("activate", self.on_middle_click) self.menu.append(mute) self.indicator.set_secondary_activate_target(mute) self.menu.append(toggle) self.APPIND_SUPPORT = True elif config().get_indicator_type() == 'GtkStatusIcon': self.status_icon = Gtk.StatusIcon() self.status_icon.set_from_icon_name("audio-volume-medium") self.status_icon.connect('popup-menu', self.on_right_click_statusicon) self.status_icon.connect("activate", self.toggle_window) self.status_icon.connect('scroll_event', self.on_scroll_wheel) self.status_icon.connect("button_press_event", self.on_status_icon_clicked) self.APPIND_SUPPORT = False quit = Gtk.MenuItem() quit.set_label("Quit") quit.connect("activate", Gtk.main_quit) self.menu.append(quit) self.menu.show_all()
def install_menu(self): self.APPIND_SUPPORT = True try: from gi.repository import AppIndicator3 except: self.APPIND_SUPPORT = False if self.APPIND_SUPPORT and config().get_indicator_type() == 'AppIndicator': self.indicator = AppIndicator3.Indicator.new("Veromix", "audio-volume-medium", AppIndicator3.IndicatorCategory.APPLICATION_STATUS) self.indicator.set_status (AppIndicator3.IndicatorStatus.ACTIVE) self.indicator.set_menu(self.menu) self.indicator.connect("scroll-event", self.on_scroll_wheel) # self.indicator.connect("menu-show", self.toggle_window) toggle = Gtk.MenuItem() toggle.set_label("Toggle Window") toggle.connect("activate", self.toggle_window) mute = Gtk.MenuItem() mute.set_label("Mute") mute.connect("activate", self.on_middle_click) self.menu.append(mute) self.indicator.set_secondary_activate_target(mute) self.menu.append(toggle) self.APPIND_SUPPORT = True elif config().get_indicator_type() == 'GtkStatusIcon': self.status_icon = Gtk.StatusIcon() self.status_icon.set_from_icon_name("audio-volume-medium") self.status_icon.connect('popup-menu', self.on_right_click_statusicon) self.status_icon.connect("activate", self.toggle_window) self.status_icon.connect('scroll_event', self.on_scroll_wheel) self.status_icon.connect("button_press_event", self.on_status_icon_clicked) self.APPIND_SUPPORT = False quit = Gtk.MenuItem() quit.set_label("Quit") quit.connect("activate", Gtk.main_quit) self.menu.append(quit) self.menu.show_all()
def on_sink_info(self, index, info, sink_box): channel = sink_box.get_default_sink() if config().get_indicator_type() != 'None': if channel == None: return volume = channel.pa_sink_proxy().get_volume() if channel.pa_sink_proxy().is_muted(): self.set_icon("audio-volume-muted") elif volume > 75: self.set_icon("audio-volume-high") elif volume > 30: self.set_icon("audio-volume-medium") elif volume > -5: self.set_icon("audio-volume-low") if self.DBUSMENU_SUPPORT: if channel.pa_sink_proxy().is_muted(): self.dbusmenu_mute.property_set_int(self.dbusmenu_checked[0], self.dbusmenu_checked[1]) else: self.dbusmenu_mute.property_set_int(self.dbusmenu_unchecked[0], self.dbusmenu_unchecked[1])
def install_quicklist(self): self.DBUSMENU_SUPPORT = True try: from gi.repository import Unity, Dbusmenu self.dbusmenu_checked = (Dbusmenu.MENUITEM_PROP_TOGGLE_STATE, Dbusmenu.MENUITEM_TOGGLE_STATE_CHECKED) self.dbusmenu_unchecked = ( Dbusmenu.MENUITEM_PROP_TOGGLE_STATE, Dbusmenu.MENUITEM_TOGGLE_STATE_UNCHECKED) except: self.DBUSMENU_SUPPORT = False return self.launcher = Unity.LauncherEntry.get_for_desktop_id( "veromix.desktop") self.quicklist = Dbusmenu.Menuitem.new() self.dbusmenu_mute = Dbusmenu.Menuitem.new() self.dbusmenu_mute.property_set(Dbusmenu.MENUITEM_PROP_LABEL, "Mute") self.dbusmenu_mute.property_set(Dbusmenu.MENUITEM_PROP_TOGGLE_TYPE, Dbusmenu.MENUITEM_TOGGLE_CHECK) self.dbusmenu_mute.property_set_int( Dbusmenu.MENUITEM_PROP_TOGGLE_STATE, Dbusmenu.MENUITEM_TOGGLE_STATE_UNCHECKED) self.dbusmenu_mute.property_set_bool(Dbusmenu.MENUITEM_PROP_VISIBLE, True) self.dbusmenu_mute.connect(Dbusmenu.MENUITEM_SIGNAL_ITEM_ACTIVATED, self.on_middle_click, None) self.quicklist.child_append(self.dbusmenu_mute) if not config().get_window_exit_on_close(): quit = Dbusmenu.Menuitem.new() quit.property_set(Dbusmenu.MENUITEM_PROP_LABEL, "Shutdown Veromix") quit.property_set_bool(Dbusmenu.MENUITEM_PROP_VISIBLE, True) quit.connect(Dbusmenu.MENUITEM_SIGNAL_ITEM_ACTIVATED, Gtk.main_quit, None) self.quicklist.child_append(quit) self.launcher.set_property("quicklist", self.quicklist)
def Clustering_new(My_binded_data, my_section, nameOfthefile): #defining the styles and he features feature_order = cal_weight(my_section, nameOfthefile) print(feature_order) my_result = [] my_confid = [] my_result_confidence = [] for indx in range(0, len(My_binded_data)): #print(My_binded_data) play_feature_dic_new = config(my_section) selected_style, confid, styles_confidecs = extract_type( My_binded_data.iloc[indx, 0:len(My_binded_data.columns)], play_feature_dic_new, feature_order) my_result.append(selected_style) my_confid.append(confid) my_result_confidence.append(styles_confidecs) My_binded_data['Player_Type'] = my_result My_binded_data['Confidence'] = my_confid print(My_binded_data) return My_binded_data, my_result_confidence
def on_delete_event(self, widget, event): if config().get_window_exit_on_close(): Gtk.main_quit() self.window.hide() return True
def init_locales(): name = "veromix" directory = VEROMIX_BASEDIR + "/data/locale" if "usr/share/veromix" in VEROMIX_BASEDIR: directory = "/usr/share/locale" gettext.bindtextdomain(name, directory) gettext.textdomain(name) if __name__ == '__main__': # Veromix is dedicated to my girlfriend Véronique init_locales() Gdk.set_program_class("veromix") if not dbus.get_default_main_loop(): mainloop=dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) else: mainloop=dbus.mainloop.glib.DBusGMainLoop(set_as_default=False) bus = dbus.SessionBus() request = bus.request_name (DBUS_INTERFACE, dbus.bus.NAME_FLAG_DO_NOT_QUEUE) if request == dbus.bus.REQUEST_NAME_REPLY_EXISTS: obj = bus.get_object (DBUS_INTERFACE, "/") app = dbus.Interface (obj, DBUS_INTERFACE) app.show_window() Gdk.notify_startup_complete() else: createDbusServiceDescription(VEROMIX_BASEDIR + VEROMIX_SERVICE, False) LADSPAPresetLoader().install_ladspa_presets_if_needed() win = VeromixWindow(bus) win.show_window() Gtk.main() config().save()
name = "veromix" directory = VEROMIX_BASEDIR + "/data/locale" if "usr/share/veromix" in VEROMIX_BASEDIR: directory = "/usr/share/locale" gettext.bindtextdomain(name, directory) gettext.textdomain(name) if __name__ == '__main__': # Veromix is dedicated to my girlfriend Véronique init_locales() Gdk.set_program_class("veromix") if not dbus.get_default_main_loop(): mainloop = dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) else: mainloop = dbus.mainloop.glib.DBusGMainLoop(set_as_default=False) bus = dbus.SessionBus() request = bus.request_name(DBUS_INTERFACE, dbus.bus.NAME_FLAG_DO_NOT_QUEUE) if request == dbus.bus.REQUEST_NAME_REPLY_EXISTS: obj = bus.get_object(DBUS_INTERFACE, "/") app = dbus.Interface(obj, DBUS_INTERFACE) app.show_window() Gdk.notify_startup_complete() else: createDbusServiceDescription(VEROMIX_BASEDIR + VEROMIX_SERVICE, False) LADSPAPresetLoader().install_ladspa_presets_if_needed() win = VeromixWindow(bus) win.show_window() Gtk.main() config().save()