Merge branch 'master' of file:///home/bjschuma/public_html/git/ocarina
Conflicts: ocarina/image.py
This commit is contained in:
commit
2b7b38da4f
12
Makefile
12
Makefile
|
@ -1,4 +1,16 @@
|
||||||
|
|
||||||
|
all:
|
||||||
|
python2 ocarina.py
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm `find . | grep .pyc`
|
rm `find . | grep .pyc`
|
||||||
|
|
||||||
|
install:
|
||||||
|
cd /opt/ && git clone http://lavos.homelinux.com/~bjschuma/git/ocarina.git
|
||||||
|
cd /usr/bin && ln -s /opt/ocarina/bin/ocarina .
|
||||||
|
|
||||||
|
uninstall:
|
||||||
|
rm -rIf /opt/ocarina
|
||||||
|
rm -f /usr/bin/ocarina
|
||||||
|
update:
|
||||||
|
cd /opt/ocarina && git pull
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
#!/bin/bash
|
||||||
|
cd /opt/ocarina && `which python2` ocarina.py $*
|
|
@ -127,24 +127,28 @@ def play_locked():
|
||||||
global gst
|
global gst
|
||||||
global player
|
global player
|
||||||
player.set_state(gst.STATE_PLAYING)
|
player.set_state(gst.STATE_PLAYING)
|
||||||
|
return get_state_locked() == gst.STATE_PLAYING
|
||||||
|
|
||||||
def play():
|
def play():
|
||||||
global lock
|
global lock
|
||||||
lock.acquire()
|
lock.acquire()
|
||||||
play_locked()
|
ret = play_locked()
|
||||||
lock.release()
|
lock.release()
|
||||||
|
return ret
|
||||||
|
|
||||||
|
|
||||||
def pause_locked():
|
def pause_locked():
|
||||||
global gst
|
global gst
|
||||||
global player
|
global player
|
||||||
player.set_state(gst.STATE_PAUSED)
|
player.set_state(gst.STATE_PAUSED)
|
||||||
|
return get_state_locked() == gst.STATE_PAUSED
|
||||||
|
|
||||||
def pause():
|
def pause():
|
||||||
global lock
|
global lock
|
||||||
lock.acquire()
|
lock.acquire()
|
||||||
pause_locked()
|
ret = pause_locked()
|
||||||
lock.release()
|
lock.release()
|
||||||
|
return ret
|
||||||
|
|
||||||
def stop_locked():
|
def stop_locked():
|
||||||
pause_locked()
|
pause_locked()
|
||||||
|
|
|
@ -17,7 +17,7 @@ class Button(gtk.Button):
|
||||||
self.set_relief(gtk.RELIEF_NONE)
|
self.set_relief(gtk.RELIEF_NONE)
|
||||||
self.click_id = self.connect("clicked", self.clicked)
|
self.click_id = self.connect("clicked", self.clicked)
|
||||||
if show == True:
|
if show == True:
|
||||||
self.show()
|
Button.show(self)
|
||||||
self.set_alignment(0,0)
|
self.set_alignment(0,0)
|
||||||
|
|
||||||
def clicked(self, button):
|
def clicked(self, button):
|
||||||
|
@ -38,7 +38,12 @@ class PlayButton(Button):
|
||||||
LS.event.invite("POSTSTOP", self.show)
|
LS.event.invite("POSTSTOP", self.show)
|
||||||
def clicked(self, button):
|
def clicked(self, button):
|
||||||
LS.music.play()
|
LS.music.play()
|
||||||
|
def hide(self, playing):
|
||||||
|
if playing == True:
|
||||||
|
Button.hide(self)
|
||||||
|
def show(self, paused):
|
||||||
|
if paused == True:
|
||||||
|
Button.show(self)
|
||||||
|
|
||||||
class PauseButton(Button):
|
class PauseButton(Button):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
@ -48,6 +53,12 @@ class PauseButton(Button):
|
||||||
LS.event.invite("POSTSTOP", self.hide)
|
LS.event.invite("POSTSTOP", self.hide)
|
||||||
def clicked(self, button):
|
def clicked(self, button):
|
||||||
LS.music.pause()
|
LS.music.pause()
|
||||||
|
def hide(self, paused):
|
||||||
|
if paused == True:
|
||||||
|
Button.hide(self)
|
||||||
|
def show(self, playing):
|
||||||
|
if playing == True:
|
||||||
|
Button.show(self)
|
||||||
|
|
||||||
|
|
||||||
class StopButton(Button):
|
class StopButton(Button):
|
||||||
|
|
|
@ -15,19 +15,22 @@ class Image(gtk.Image):
|
||||||
def set_height(self, new_h):
|
def set_height(self, new_h):
|
||||||
buf = self.get_pixbuf()
|
buf = self.get_pixbuf()
|
||||||
if buf == None:
|
if buf == None:
|
||||||
return
|
return False
|
||||||
w = buf.get_width()
|
w = buf.get_width()
|
||||||
h = buf.get_height()
|
h = buf.get_height()
|
||||||
if h == new_h:
|
if h == new_h:
|
||||||
return
|
return False
|
||||||
if h == 0:
|
if h == 0:
|
||||||
h = 1
|
h = 1
|
||||||
new_w = (float(w) / float(h)) * new_h
|
new_w = (float(w) / float(h)) * new_h
|
||||||
if new_w > 0 and new_h > 0:
|
if new_w <= 0 or new_h <= 0:
|
||||||
buf = buf.scale_simple(int(new_w), int(new_h), gtk.gdk.INTERP_HYPER)
|
return False
|
||||||
if buf != None:
|
|
||||||
self.set_from_pixbuf(buf)
|
|
||||||
|
|
||||||
|
buf = buf.scale_simple(int(new_w), int(new_h), gtk.gdk.INTERP_HYPER)
|
||||||
|
if buf == None:
|
||||||
|
return False
|
||||||
|
self.set_from_pixbuf(buf)
|
||||||
|
return True
|
||||||
|
|
||||||
class AlbumArt(Image):
|
class AlbumArt(Image):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
@ -43,14 +46,16 @@ class AlbumArt(Image):
|
||||||
|
|
||||||
def set(self, file=None):
|
def set(self, file=None):
|
||||||
gdk.threads_enter()
|
gdk.threads_enter()
|
||||||
if file != None:
|
for i in xrange(2):
|
||||||
self.file = file
|
self.file = file
|
||||||
self.set_from_file(self.file)
|
self.set_from_file(self.file)
|
||||||
self.set_height(64)
|
if self.set_height(64) == True:
|
||||||
|
break
|
||||||
|
file = "images/ocarina.png"
|
||||||
gdk.threads_leave()
|
gdk.threads_leave()
|
||||||
|
|
||||||
def set_height(self, new_h):
|
def set_height(self, new_h):
|
||||||
size = self.size_request()
|
size = self.size_request()
|
||||||
if size[1] == new_h:
|
if size[1] == new_h:
|
||||||
return
|
return
|
||||||
Image.set_height(self, new_h)
|
return Image.set_height(self, new_h)
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
# Bryan Schumaker (10/30/2010)
|
# Bryan Schumaker (10/30/2010)
|
||||||
|
|
||||||
import ocarina
|
import ocarina
|
||||||
|
gdk = ocarina.gdk
|
||||||
libsaria = ocarina.libsaria
|
libsaria = ocarina.libsaria
|
||||||
lib_find_id = libsaria.collection.lib_find_id
|
lib_find_id = libsaria.collection.lib_find_id
|
||||||
lib_get_attr = libsaria.collection.lib_get_attr
|
lib_get_attr = libsaria.collection.lib_get_attr
|
||||||
|
@ -8,10 +9,11 @@ invite = libsaria.event.invite
|
||||||
|
|
||||||
|
|
||||||
def tweak_icon(file):
|
def tweak_icon(file):
|
||||||
if file != None:
|
if file == None:
|
||||||
ocarina.set_window_icon(file)
|
file = "images/ocarina.png"
|
||||||
else:
|
gdk.threads_enter()
|
||||||
ocarina.set_window_icon("images/ocarina.png")
|
ocarina.set_window_icon(file)
|
||||||
|
gdk.threads_leave()
|
||||||
|
|
||||||
def tweak_title(filepath):
|
def tweak_title(filepath):
|
||||||
if filepath != None:
|
if filepath != None:
|
||||||
|
|
Loading…
Reference in New Issue