Commit f8d12bd9 authored by Rafaël Carré's avatar Rafaël Carré
Browse files

Updates dbus pygtk controller

parent 56299eb4
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
<!--Generated with glade3 3.2.0 on Sat Apr 7 01:02:24 2007 by fun@ubuntu-->
<!--Generated with glade3 3.3.3 on Wed Aug 22 03:00:39 2007 -->
<glade-interface>
<widget class="GtkWindow" id="window1">
<property name="resizable">False</property>
......@@ -19,6 +19,7 @@
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Previous</property>
<property name="relief">GTK_RELIEF_NONE</property>
<property name="response_id">0</property>
<child>
<widget class="GtkImage" id="image8">
<property name="visible">True</property>
......@@ -37,6 +38,7 @@
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Play/Pause</property>
<property name="relief">GTK_RELIEF_NONE</property>
<property name="response_id">0</property>
<child>
<widget class="GtkImage" id="image6">
<property name="visible">True</property>
......@@ -56,6 +58,7 @@
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Next</property>
<property name="relief">GTK_RELIEF_NONE</property>
<property name="response_id">0</property>
<child>
<widget class="GtkImage" id="image1">
<property name="visible">True</property>
......@@ -75,6 +78,7 @@
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Stop</property>
<property name="relief">GTK_RELIEF_NONE</property>
<property name="response_id">0</property>
<child>
<widget class="GtkImage" id="image9">
<property name="visible">True</property>
......@@ -95,6 +99,7 @@
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Quit vlc</property>
<property name="relief">GTK_RELIEF_NONE</property>
<property name="response_id">0</property>
<child>
<widget class="GtkImage" id="image5">
<property name="width_request">26</property>
......@@ -116,6 +121,7 @@
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Close controller</property>
<property name="relief">GTK_RELIEF_NONE</property>
<property name="response_id">0</property>
<child>
<widget class="GtkImage" id="image2">
<property name="visible">True</property>
......@@ -220,11 +226,13 @@
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Add MRL, or directory if empty</property>
<property name="relief">GTK_RELIEF_NONE</property>
<property name="response_id">0</property>
<child>
<widget class="GtkImage" id="image4">
<property name="width_request">100</property>
<property name="height_request">80</property>
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Add to playlist</property>
<property name="stock">gtk-add</property>
</widget>
</child>
......@@ -243,11 +251,25 @@
<property name="position">1</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="l_artist">
<property name="width_request">180</property>
<property name="height_request">20</property>
<property name="visible">True</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>
<property name="wrap">True</property>
<property name="ellipsize">PANGO_ELLIPSIZE_MIDDLE</property>
<property name="single_line_mode">True</property>
</widget>
<packing>
<property name="position">2</property>
</packing>
</child>
<child>
<widget class="GtkHBox" id="hbox3">
<property name="visible">True</property>
<child>
<widget class="GtkLabel" id="item">
<widget class="GtkLabel" id="l_title">
<property name="width_request">180</property>
<property name="height_request">20</property>
<property name="visible">True</property>
......@@ -264,6 +286,7 @@
<widget class="GtkImage" id="vlcicon">
<property name="visible">True</property>
<property name="events"></property>
<property name="tooltip" translatable="yes">Update meta info</property>
<property name="xpad">8</property>
<property name="icon_name">vlc</property>
</widget>
......@@ -275,7 +298,7 @@
</child>
</widget>
<packing>
<property name="position">2</property>
<property name="position">3</property>
</packing>
</child>
</widget>
......
......@@ -47,14 +47,19 @@ def itemchange_handler(item):
a = item["artist"]
except:
a = ""
if a == "":
a = item["URI"]
l_item.set_text(a)
try:
t = item["title"]
except:
t = ""
if t == "":
t = item["URI"]
l_artist.set_text(a)
l_title.set_text(t)
#connect to the bus
bus = dbus.SessionBus()
player_o = bus.get_object("org.freedesktop.MediaPlayer", "/Player")
tracklist_o = bus.get_object("org.freedesktop.MediaPlayer", "/TrackList")
player_o = bus.get_object("org.mpris.vlc", "/Player")
tracklist_o = bus.get_object("org.mpris.vlc", "/TrackList")
tracklist = dbus.Interface(tracklist_o, "org.freedesktop.MediaPlayer")
player = dbus.Interface(player_o, "org.freedesktop.MediaPlayer")
......@@ -68,6 +73,7 @@ def AddTrack(widget):
mrl = e_mrl.get_text()
if mrl != None and mrl != "":
tracklist.AddTrack(mrl, True)
e_mrl.set_text('')
else:
mrl = bt_file.get_filename()
if mrl != None and mrl != "":
......@@ -94,9 +100,13 @@ def update(widget):
try:
a = item["artist"]
except: a = ""
if a == "":
a = item["URI"]
l_item.set_text(a)
try:
t = item["title"]
except: t = ""
if t == "":
t = item["URI"]
l_artist.set_text(a)
l_title.set_text(t)
GetPlayStatus(0)
#get playing status from remote vlc
......@@ -112,7 +122,7 @@ def GetPlayStatus(widget):
def Quit(widget):
player.Quit(reply_handler=(lambda *args: None), error_handler=(lambda *args: None))
l_item.set_text("")
l_title.set_text("")
def Pause(widget):
player.Pause()
......@@ -174,12 +184,13 @@ xml = gtk.glade.XML('dbus-vlc.glade')
bt_close = xml.get_widget('close')
bt_quit = xml.get_widget('quit')
bt_file = xml.get_widget('ChooseFile')
bt_mrl = xml.get_widget('AddMRL')
bt_next = xml.get_widget('next')
bt_prev = xml.get_widget('prev')
bt_stop = xml.get_widget('stop')
bt_toggle = xml.get_widget('toggle')
l_item = xml.get_widget('item')
bt_mrl = xml.get_widget('AddMRL')
l_artist = xml.get_widget('l_artist')
l_title = xml.get_widget('l_title')
e_mrl = xml.get_widget('mrl')
window = xml.get_widget('window1')
img_bt_toggle=xml.get_widget('image6')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment