mirror of
https://github.com/SoongNoonien/mpdevil.git
synced 2023-08-10 21:12:44 +03:00
changed client connect
This commit is contained in:
parent
b7d98a8ae9
commit
62d7ffb5ee
@ -83,6 +83,8 @@ class Client(MPDClient):
|
|||||||
MPDClient.__init__(self)
|
MPDClient.__init__(self)
|
||||||
self.settings = settings
|
self.settings = settings
|
||||||
self.song_to_delete=""
|
self.song_to_delete=""
|
||||||
|
self.try_connect_default()
|
||||||
|
self.settings.connect("changed::active-profile", self.on_settings_changed)
|
||||||
|
|
||||||
def try_connect_default(self):
|
def try_connect_default(self):
|
||||||
active=self.settings.get_int("active-profile")
|
active=self.settings.get_int("active-profile")
|
||||||
@ -134,6 +136,10 @@ class Client(MPDClient):
|
|||||||
self.add(song["file"])
|
self.add(song["file"])
|
||||||
self.play()
|
self.play()
|
||||||
|
|
||||||
|
def on_settings_changed(self, *args):
|
||||||
|
self.disconnect()
|
||||||
|
self.try_connect_default()
|
||||||
|
|
||||||
class Settings(Gio.Settings):
|
class Settings(Gio.Settings):
|
||||||
BASE_KEY = "org.mpdevil"
|
BASE_KEY = "org.mpdevil"
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@ -302,8 +308,6 @@ class ArtistView(Gtk.ScrolledWindow):
|
|||||||
#connect
|
#connect
|
||||||
self.treeview.connect("enter-notify-event", self.on_enter_event)
|
self.treeview.connect("enter-notify-event", self.on_enter_event)
|
||||||
|
|
||||||
self.refresh()
|
|
||||||
|
|
||||||
self.add(self.treeview)
|
self.add(self.treeview)
|
||||||
|
|
||||||
def clear(self):
|
def clear(self):
|
||||||
@ -1455,8 +1459,6 @@ class ProfileSelect(Gtk.ComboBoxText):
|
|||||||
def on_changed(self, *args):
|
def on_changed(self, *args):
|
||||||
active=self.get_active()
|
active=self.get_active()
|
||||||
self.settings.set_int("active-profile", active)
|
self.settings.set_int("active-profile", active)
|
||||||
self.client.disconnect()
|
|
||||||
self.client.try_connect_default()
|
|
||||||
|
|
||||||
class ServerStats(Gtk.Dialog):
|
class ServerStats(Gtk.Dialog):
|
||||||
def __init__(self, parent, client):
|
def __init__(self, parent, client):
|
||||||
@ -1622,9 +1624,6 @@ class LyricsWindow(Gtk.Window): #Lyrics view with own client because MPDClient i
|
|||||||
#adding vars
|
#adding vars
|
||||||
self.settings=settings
|
self.settings=settings
|
||||||
self.client=Client(self.settings)
|
self.client=Client(self.settings)
|
||||||
|
|
||||||
#connect client
|
|
||||||
self.client.try_connect_default()
|
|
||||||
self.current_song={}
|
self.current_song={}
|
||||||
|
|
||||||
#widgets
|
#widgets
|
||||||
@ -1635,7 +1634,6 @@ class LyricsWindow(Gtk.Window): #Lyrics view with own client because MPDClient i
|
|||||||
self.label.set_xalign(0)
|
self.label.set_xalign(0)
|
||||||
|
|
||||||
#connect
|
#connect
|
||||||
self.settings.connect("changed::active-profile", self.on_settings_changed)
|
|
||||||
self.connect("destroy", self.quit)
|
self.connect("destroy", self.quit)
|
||||||
|
|
||||||
#packing
|
#packing
|
||||||
@ -1706,10 +1704,6 @@ class LyricsWindow(Gtk.Window): #Lyrics view with own client because MPDClient i
|
|||||||
except:
|
except:
|
||||||
return output.encode('utf-8')
|
return output.encode('utf-8')
|
||||||
|
|
||||||
def on_settings_changed(self, *args):
|
|
||||||
self.client.disconnect()
|
|
||||||
self.client.try_connect_default()
|
|
||||||
|
|
||||||
class MainWindow(Gtk.ApplicationWindow):
|
class MainWindow(Gtk.ApplicationWindow):
|
||||||
def __init__(self, app, client, settings):
|
def __init__(self, app, client, settings):
|
||||||
Gtk.ApplicationWindow.__init__(self, title=("mpdevil"), application=app)
|
Gtk.ApplicationWindow.__init__(self, title=("mpdevil"), application=app)
|
||||||
@ -1809,9 +1803,6 @@ class MainWindow(Gtk.ApplicationWindow):
|
|||||||
|
|
||||||
self.add(self.vbox)
|
self.add(self.vbox)
|
||||||
|
|
||||||
#connect client
|
|
||||||
self.client.try_connect_default()
|
|
||||||
|
|
||||||
self.show_all()
|
self.show_all()
|
||||||
|
|
||||||
def update(self, app): #update title and send notify
|
def update(self, app): #update title and send notify
|
||||||
|
Loading…
Reference in New Issue
Block a user