Make 4.10 less likely to crash
I used it over christmas, but I didn't want it to blow up when setting album art.
This commit is contained in:
parent
798134b910
commit
a84bd85a04
|
@ -18,6 +18,9 @@ def stock_image(stock_item):
|
|||
img = gtk.image_new_from_stock(stock_item, SIZE)
|
||||
return img
|
||||
|
||||
def big_image(stock_item):
|
||||
return gtk.image_new_from_stock(stock_item, gtk.ICON_SIZE_DND)
|
||||
|
||||
def file_image(file):
|
||||
img = gtk.image_new_from_file(file)
|
||||
return img
|
||||
|
@ -43,6 +46,12 @@ def make_button(stock_item, func, tooltip, show):
|
|||
default_button_attrs(b, stock_image(stock_item), tooltip, show)
|
||||
return b
|
||||
|
||||
def make_big_button(stock_item, func, tooltip, show):
|
||||
b = gtk.Button()
|
||||
b.connect("clicked", on_click, func)
|
||||
default_button_attrs(b, big_image(stock_item), tooltip, show)
|
||||
return b
|
||||
|
||||
def toggle_connect(button, func):
|
||||
button.t_id = button.connect("toggled", on_toggle, func)
|
||||
button.t_func = func
|
||||
|
@ -61,22 +70,22 @@ def make_toggle(img_file, func, tooltip, is_active, show):
|
|||
|
||||
|
||||
def rewind_button(show):
|
||||
return make_button(gtk.STOCK_MEDIA_REWIND, controls.seek_backward, "Rewind", show)
|
||||
return make_big_button(gtk.STOCK_MEDIA_REWIND, controls.seek_backward, "Rewind", show)
|
||||
|
||||
def forward_button(show):
|
||||
return make_button(gtk.STOCK_MEDIA_FORWARD, controls.seek_forward, "Fast Forward", show)
|
||||
return make_big_button(gtk.STOCK_MEDIA_FORWARD, controls.seek_forward, "Fast Forward", show)
|
||||
|
||||
def play_button(show):
|
||||
return make_button(gtk.STOCK_MEDIA_PLAY, controls.play, "Play", show)
|
||||
return make_big_button(gtk.STOCK_MEDIA_PLAY, controls.play, "Play", show)
|
||||
|
||||
def pause_button(show):
|
||||
return make_button(gtk.STOCK_MEDIA_PAUSE, controls.pause, "Pause", show)
|
||||
return make_big_button(gtk.STOCK_MEDIA_PAUSE, controls.pause, "Pause", show)
|
||||
|
||||
def stop_button(show):
|
||||
return make_button(gtk.STOCK_MEDIA_STOP, controls.stop, "Stop", show)
|
||||
return make_big_button(gtk.STOCK_MEDIA_STOP, controls.stop, "Stop", show)
|
||||
|
||||
def next_button(show):
|
||||
return make_button(gtk.STOCK_MEDIA_NEXT, controls.next, "Next", show)
|
||||
return make_big_button(gtk.STOCK_MEDIA_NEXT, controls.next, "Next", show)
|
||||
|
||||
def update_button(show):
|
||||
return make_button(gtk.STOCK_REFRESH, sources.library.update_lib, "Update Library", show)
|
||||
|
|
|
@ -32,7 +32,7 @@ def slider_tooltip(slider, event):
|
|||
slider.set_tooltip_text(audio.get_time_at(prcnt))
|
||||
|
||||
slider = gtk.HScale( gtk.Adjustment(0.0, 0.0, 100.0, 0.1, 1.0, 1.0) )
|
||||
slider.set_size_request(150, 20)
|
||||
slider.set_size_request(800, 20)
|
||||
slider.set_draw_value(False)
|
||||
slider.set_range(0, 101)
|
||||
slider.set_update_policy(gtk.UPDATE_DISCONTINUOUS)
|
||||
|
@ -51,7 +51,6 @@ add_button( "PLAY", button.play_button)
|
|||
add_button( "PAUSE", button.pause_button, False)
|
||||
add_button( "STOP", button.stop_button)
|
||||
add_button( "NEXT", button.next_button)
|
||||
add_button( "DOWN", button.down_button)
|
||||
action.show()
|
||||
|
||||
detailed.set_action_widget(action, gtk.PACK_END)
|
||||
|
@ -62,7 +61,7 @@ def set_art(path):
|
|||
|
||||
def update_pos(time):
|
||||
slider_update(slider)
|
||||
cur_pos.set_text(time)
|
||||
cur_pos.set_markup("<span size='x-large'>%s</span>" % time)
|
||||
|
||||
def on_play():
|
||||
PLAY.hide()
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
# Bryan Schumaker (4 / 21 / 2011)
|
||||
|
||||
import gtk
|
||||
import gobject
|
||||
from libsaria import controls
|
||||
from ocarina.body import button
|
||||
from ocarina.body import image
|
||||
|
||||
page = gtk.HBox(False, 5)
|
||||
label = gtk.Label("Now Playing")
|
||||
label.set_markup("<span size='x-large'>Now Playing</span>")
|
||||
|
||||
ARTWORK = image.Image()
|
||||
page.pack_start(ARTWORK, False, False)
|
||||
|
@ -42,10 +44,6 @@ page.pack_start(attr_box)
|
|||
|
||||
LIKE = button.like_button(True)
|
||||
DISLIKE = button.dislike_button(True)
|
||||
buttons = gtk.HBox(True)
|
||||
buttons.pack_start( LIKE, False, False)
|
||||
buttons.pack_start(DISLIKE, False, False)
|
||||
page.pack_start(buttons, False, False)
|
||||
|
||||
page.show_all()
|
||||
label.show()
|
||||
|
@ -57,7 +55,7 @@ def resize_art(*args):
|
|||
sa_id = page.connect("size-allocate", resize_art)
|
||||
|
||||
def set_art(path):
|
||||
ARTWORK.set_image(path, 64)
|
||||
ARTWORK.set_image(path, 128)
|
||||
|
||||
def on_like(like):
|
||||
def _on_like1(like):
|
||||
|
@ -67,12 +65,16 @@ def on_like(like):
|
|||
button.toggle_call_unconnected(DISLIKE, _on_like1, like)
|
||||
button.toggle_call_unconnected(LIKE, _on_like0, like)
|
||||
|
||||
def set_tag(label, text):
|
||||
markup = gobject.markup_escape_text(text)
|
||||
label.set_markup("<span size='xx-large'>%s</span>" % markup)
|
||||
|
||||
def on_load(attrs):
|
||||
TITLE.set_text(attrs["title"])
|
||||
ARTIST.set_text("by %s" % attrs["artist"])
|
||||
ALBUM.set_text("from %s" % attrs["album"])
|
||||
YEAR.set_text("Year: %s" % attrs["year"])
|
||||
LENGTH.set_text("Length: %s" % attrs["lenstr"])
|
||||
COUNT.set_text("Play count: %s" % attrs["count"])
|
||||
set_tag(TITLE, attrs["title"])
|
||||
set_tag(ARTIST, attrs["artist"])
|
||||
set_tag(ALBUM, attrs["album"])
|
||||
set_tag(YEAR, "Year: %s" % attrs["year"])
|
||||
set_tag(LENGTH, "Length: %s" % attrs["lenstr"])
|
||||
set_tag(COUNT, "Count: %s" % attrs["count"])
|
||||
set_art(attrs["art"])
|
||||
on_like(attrs["like"])
|
||||
|
|
|
@ -18,16 +18,16 @@ def add_button(name, button):
|
|||
header_body.pack_start(button, False, False)
|
||||
|
||||
header_body.pack_start(entry.entry)
|
||||
add_button( "OPEN", button.open_button(True))
|
||||
add_button( "SAVE", button.save_button(True))
|
||||
#add_button( "OPEN", button.open_button(True))
|
||||
#add_button( "SAVE", button.save_button(True))
|
||||
add_button( "PREFS", button.prefs_button(True))
|
||||
|
||||
sep = gtk.VSeparator()
|
||||
sep.show()
|
||||
header_body.pack_start(sep, False, False)
|
||||
|
||||
add_button("UPDATE", button.update_button(True))
|
||||
add_button( "CLEAR", button.clear_button(True))
|
||||
#add_button("UPDATE", button.update_button(True))
|
||||
#add_button( "CLEAR", button.clear_button(True))
|
||||
add_button( "GOTO", button.goto_button(True))
|
||||
add_button("RANDOM", button.random_button(prefs.get("libsaria.random"), True))
|
||||
add_button("VOLUME", button.volume_button(prefs.get("libsaria.audio.volume"), True))
|
||||
|
|
|
@ -4,10 +4,11 @@ import gtk
|
|||
|
||||
attrs = ("id", "track", "title", "lenstr", "artist", "album", "year")
|
||||
columns = ["Id", "#", "Title", "Length", "Artist", "Album", "Year"]
|
||||
col_width = [ 2, 20, 300, 60, 125, 125, 50]
|
||||
col_width = [ 2, 30, 500, 75, 325, 310, 30]
|
||||
|
||||
cell = gtk.CellRendererText()
|
||||
cell.set_fixed_height_from_font(1)
|
||||
cell.set_property("size-points", 12)
|
||||
|
||||
class Column(gtk.TreeViewColumn):
|
||||
def __init__(self, index, label):
|
||||
|
|
Loading…
Reference in New Issue