#!/usr/bin/env python3 import gi, sys, os # import dbus # import dbus.service, dbus.mainloop.glib from pprint import pprint as print gi.require_version('Gtk', '3.0') from gi.repository import Gtk, Gdk, GLib, GdkPixbuf from window import SonistWindow # from mpd.asyncio import MPDClient from mpd.base import MPDClient app_id = 'fun.wkit.sonist' class Application(Gtk.Application): def __init__(self): Gtk.Application.__init__(self, application_id = app_id) self.window = SonistWindow() self.mpc = MPDClient() self.mpc.timeout = 10 self.mpc.connect("localhost", 6600) def do_activate(self): print('hello mpc') # self.window.show_all() """ class ApplicationService(dbus.service.Object): def __init__(self, app): self.app = app bus_name = dbus.service.BusName(app_id, bus = dbus.SessionBus()) dbus.service.Object.__init__(self, bus_name, '/') @dbus.service.method(app_id) def call_app(self): self.app.present() """ if __name__ == "__main__": # dbus.mainloop.glib.DBusGMainLoop(set_as_default = True) # bus = dbus.SessionBus() # try: # obj = bus.get_object(app_id, '/') # obj.call_app() # sys.exit(0) # except dbus.DBusException: # pass app = Application() app.run(sys.argv) # ApplicationService(app) Gtk.main()