mirror of
https://github.com/SoongNoonien/mpdevil.git
synced 2023-08-10 21:12:44 +03:00
added protocol version to 'Server stats'
This commit is contained in:
parent
9744d9810e
commit
ee534c5279
@ -2705,6 +2705,7 @@ class ProfileSelect(Gtk.ComboBoxText):
|
|||||||
class ServerStats(Gtk.Dialog):
|
class ServerStats(Gtk.Dialog):
|
||||||
def __init__(self, parent, client):
|
def __init__(self, parent, client):
|
||||||
Gtk.Dialog.__init__(self, title=_("Stats"), transient_for=parent)
|
Gtk.Dialog.__init__(self, title=_("Stats"), transient_for=parent)
|
||||||
|
self.add_buttons(Gtk.STOCK_OK, Gtk.ResponseType.OK)
|
||||||
|
|
||||||
#adding vars
|
#adding vars
|
||||||
self.client=client
|
self.client=client
|
||||||
@ -2717,29 +2718,39 @@ class ServerStats(Gtk.Dialog):
|
|||||||
self.treeview=Gtk.TreeView(model=self.store)
|
self.treeview=Gtk.TreeView(model=self.store)
|
||||||
self.treeview.set_can_focus(False)
|
self.treeview.set_can_focus(False)
|
||||||
self.treeview.set_search_column(-1)
|
self.treeview.set_search_column(-1)
|
||||||
|
self.treeview.set_headers_visible(False)
|
||||||
|
|
||||||
|
#selection
|
||||||
sel=self.treeview.get_selection()
|
sel=self.treeview.get_selection()
|
||||||
sel.set_mode(Gtk.SelectionMode.NONE)
|
sel.set_mode(Gtk.SelectionMode.NONE)
|
||||||
|
|
||||||
#Column
|
#Column
|
||||||
renderer_text=Gtk.CellRendererText()
|
renderer_text=Gtk.CellRendererText()
|
||||||
|
renderer_text_ralign=Gtk.CellRendererText(xalign=1.0)
|
||||||
|
|
||||||
self.column_tag=Gtk.TreeViewColumn(_("Tag"), renderer_text, text=0)
|
self.column_tag=Gtk.TreeViewColumn("", renderer_text_ralign, text=0)
|
||||||
self.treeview.append_column(self.column_tag)
|
self.treeview.append_column(self.column_tag)
|
||||||
|
|
||||||
self.column_value=Gtk.TreeViewColumn(_("Value"), renderer_text, text=1)
|
self.column_value=Gtk.TreeViewColumn("", renderer_text, text=1)
|
||||||
self.treeview.append_column(self.column_value)
|
self.treeview.append_column(self.column_value)
|
||||||
|
|
||||||
|
self.store.append(["protocol:", str(self.client.mpd_version)])
|
||||||
|
|
||||||
stats=self.client.stats()
|
stats=self.client.stats()
|
||||||
for key in stats:
|
for key in stats:
|
||||||
|
print_key=key+":"
|
||||||
if key == "uptime" or key == "playtime" or key == "db_playtime":
|
if key == "uptime" or key == "playtime" or key == "db_playtime":
|
||||||
self.store.append([key, str(datetime.timedelta(seconds=int(stats[key])))])
|
self.store.append([print_key, str(datetime.timedelta(seconds=int(stats[key])))])
|
||||||
elif key == "db_update":
|
elif key == "db_update":
|
||||||
self.store.append([key, str(datetime.datetime.fromtimestamp(int(stats[key])))])
|
self.store.append([print_key, str(datetime.datetime.fromtimestamp(int(stats[key])))])
|
||||||
else:
|
else:
|
||||||
self.store.append([key, stats[key]])
|
self.store.append([print_key, stats[key]])
|
||||||
|
frame=Gtk.Frame()
|
||||||
self.vbox.pack_start(self.treeview, True, True, 0)
|
frame.add(self.treeview)
|
||||||
|
self.vbox.pack_start(frame, True, True, 0)
|
||||||
|
self.vbox.set_spacing(6)
|
||||||
self.show_all()
|
self.show_all()
|
||||||
|
self.run()
|
||||||
|
|
||||||
class SearchWindow(Gtk.Window):
|
class SearchWindow(Gtk.Window):
|
||||||
def __init__(self, client):
|
def __init__(self, client):
|
||||||
@ -3021,7 +3032,6 @@ class MainWindow(Gtk.ApplicationWindow):
|
|||||||
def on_stats(self, action, param):
|
def on_stats(self, action, param):
|
||||||
if self.client.connected():
|
if self.client.connected():
|
||||||
stats=ServerStats(self, self.client)
|
stats=ServerStats(self, self.client)
|
||||||
stats.run()
|
|
||||||
stats.destroy()
|
stats.destroy()
|
||||||
|
|
||||||
def on_update(self, action, param):
|
def on_update(self, action, param):
|
||||||
|
Loading…
Reference in New Issue
Block a user