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:
|
||||
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 player
|
||||
player.set_state(gst.STATE_PLAYING)
|
||||
return get_state_locked() == gst.STATE_PLAYING
|
||||
|
||||
def play():
|
||||
global lock
|
||||
lock.acquire()
|
||||
play_locked()
|
||||
ret = play_locked()
|
||||
lock.release()
|
||||
return ret
|
||||
|
||||
|
||||
def pause_locked():
|
||||
global gst
|
||||
global player
|
||||
player.set_state(gst.STATE_PAUSED)
|
||||
return get_state_locked() == gst.STATE_PAUSED
|
||||
|
||||
def pause():
|
||||
global lock
|
||||
lock.acquire()
|
||||
pause_locked()
|
||||
ret = pause_locked()
|
||||
lock.release()
|
||||
return ret
|
||||
|
||||
def stop_locked():
|
||||
pause_locked()
|
||||
|
|
|
@ -17,7 +17,7 @@ class Button(gtk.Button):
|
|||
self.set_relief(gtk.RELIEF_NONE)
|
||||
self.click_id = self.connect("clicked", self.clicked)
|
||||
if show == True:
|
||||
self.show()
|
||||
Button.show(self)
|
||||
self.set_alignment(0,0)
|
||||
|
||||
def clicked(self, button):
|
||||
|
@ -38,7 +38,12 @@ class PlayButton(Button):
|
|||
LS.event.invite("POSTSTOP", self.show)
|
||||
def clicked(self, button):
|
||||
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):
|
||||
def __init__(self):
|
||||
|
@ -48,6 +53,12 @@ class PauseButton(Button):
|
|||
LS.event.invite("POSTSTOP", self.hide)
|
||||
def clicked(self, button):
|
||||
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):
|
||||
|
|
|
@ -15,19 +15,22 @@ class Image(gtk.Image):
|
|||
def set_height(self, new_h):
|
||||
buf = self.get_pixbuf()
|
||||
if buf == None:
|
||||
return
|
||||
return False
|
||||
w = buf.get_width()
|
||||
h = buf.get_height()
|
||||
if h == new_h:
|
||||
return
|
||||
return False
|
||||
if h == 0:
|
||||
h = 1
|
||||
new_w = (float(w) / float(h)) * new_h
|
||||
if new_w > 0 and new_h > 0:
|
||||
buf = buf.scale_simple(int(new_w), int(new_h), gtk.gdk.INTERP_HYPER)
|
||||
if buf != None:
|
||||
self.set_from_pixbuf(buf)
|
||||
if new_w <= 0 or new_h <= 0:
|
||||
return False
|
||||
|
||||
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):
|
||||
def __init__(self):
|
||||
|
@ -43,14 +46,16 @@ class AlbumArt(Image):
|
|||
|
||||
def set(self, file=None):
|
||||
gdk.threads_enter()
|
||||
if file != None:
|
||||
for i in xrange(2):
|
||||
self.file = file
|
||||
self.set_from_file(self.file)
|
||||
self.set_height(64)
|
||||
self.set_from_file(self.file)
|
||||
if self.set_height(64) == True:
|
||||
break
|
||||
file = "images/ocarina.png"
|
||||
gdk.threads_leave()
|
||||
|
||||
def set_height(self, new_h):
|
||||
size = self.size_request()
|
||||
if size[1] == new_h:
|
||||
return
|
||||
Image.set_height(self, new_h)
|
||||
return Image.set_height(self, new_h)
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# Bryan Schumaker (10/30/2010)
|
||||
|
||||
import ocarina
|
||||
gdk = ocarina.gdk
|
||||
libsaria = ocarina.libsaria
|
||||
lib_find_id = libsaria.collection.lib_find_id
|
||||
lib_get_attr = libsaria.collection.lib_get_attr
|
||||
|
@ -8,10 +9,11 @@ invite = libsaria.event.invite
|
|||
|
||||
|
||||
def tweak_icon(file):
|
||||
if file != None:
|
||||
ocarina.set_window_icon(file)
|
||||
else:
|
||||
ocarina.set_window_icon("images/ocarina.png")
|
||||
if file == None:
|
||||
file = "images/ocarina.png"
|
||||
gdk.threads_enter()
|
||||
ocarina.set_window_icon(file)
|
||||
gdk.threads_leave()
|
||||
|
||||
def tweak_title(filepath):
|
||||
if filepath != None:
|
||||
|
|
Loading…
Reference in New Issue