Delete ocarina/info.py
This commit is contained in:
parent
4657c96179
commit
04b24f94e3
126
ocarina/info.py
126
ocarina/info.py
|
@ -1,126 +0,0 @@
|
|||
# Bryan Schumaker (8/22/2010)
|
||||
|
||||
import ocarina
|
||||
gtk = ocarina.gtk
|
||||
pango = ocarina.pango
|
||||
libsaria = ocarina.libsaria
|
||||
button = None
|
||||
entry = None
|
||||
pbar = None
|
||||
label = None
|
||||
image = None
|
||||
|
||||
lib_get_cur_id = libsaria.sources.lib_get_cur_id
|
||||
get_attrs = libsaria.sources.get_attrs
|
||||
file_to_id = libsaria.sources.file_to_id
|
||||
|
||||
info = None
|
||||
|
||||
class InfoTab(gtk.Notebook):
|
||||
def __init__(self, down_button):
|
||||
gtk.Notebook.__init__(self)
|
||||
|
||||
hbox = gtk.HBox()
|
||||
hbox.show()
|
||||
|
||||
hbox.pack_start(label.TimeLabel())
|
||||
hbox.pack_start(pbar.PBar(), True, True)
|
||||
hbox.pack_start(button.PlayButton())
|
||||
hbox.pack_start(button.PauseButton())
|
||||
hbox.pack_start(button.StopButton())
|
||||
hbox.pack_start(button.NextButton())
|
||||
hbox.pack_start(button.DownButton(down_button))
|
||||
self.set_action_widget(hbox, gtk.PACK_END)
|
||||
|
||||
self.down_button = down_button
|
||||
self.cur_page = 0
|
||||
self.connect("switch_page", self.switched_pages)
|
||||
|
||||
def add_page(self, content, label):
|
||||
self.prepend_page(content, label)
|
||||
self.set_current_page(0)
|
||||
|
||||
def switched_pages(self, notebook, page, page_num):
|
||||
new_page = self.get_nth_page(page_num)
|
||||
self.cur_page = page_num
|
||||
|
||||
|
||||
class NowPlaying(gtk.HBox):
|
||||
def __init__(self):
|
||||
gtk.HBox.__init__(self, False, 5)
|
||||
inner = gtk.HBox(True, 5)
|
||||
|
||||
tsw = gtk.ScrolledWindow()
|
||||
tsw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_NEVER)
|
||||
view = gtk.Viewport()
|
||||
view.set_shadow_type(gtk.SHADOW_NONE)
|
||||
tags = gtk.VBox(True)
|
||||
tags.pack_start(label.TitleLabel())
|
||||
tags.pack_start(label.ArtistLabel())
|
||||
tags.pack_start(label.AlbumLabel())
|
||||
view.add(tags)
|
||||
tsw.add(view)
|
||||
inner.pack_start(tsw)
|
||||
|
||||
attrs = gtk.VBox()
|
||||
attrs.pack_start(label.YearLabel())
|
||||
attrs.pack_start(label.LengthLabel())
|
||||
attrs.pack_start(label.CountLabel())
|
||||
inner.pack_start(attrs)
|
||||
|
||||
self.pack_start(image.AlbumArt(), False, False)
|
||||
self.pack_start(inner)
|
||||
self.show_all()
|
||||
|
||||
|
||||
class TwoWayPane(InfoBar):
|
||||
def __init__(self):
|
||||
InfoBar.__init__(self, self.up_button)
|
||||
self.bar = self.contents
|
||||
self.tab = InfoTab(self.down_button)
|
||||
self.pack_start(self.tab)
|
||||
if libsaria.prefs.get_pref("ocarina.infopane.up") == True:
|
||||
self.up_button()
|
||||
else:
|
||||
self.down_button()
|
||||
|
||||
def up_button(self):
|
||||
self.bar.hide()
|
||||
self.tab.show()
|
||||
libsaria.prefs.set_pref("ocarina.infopane.up", True)
|
||||
|
||||
def down_button(self):
|
||||
self.bar.show()
|
||||
self.tab.hide()
|
||||
libsaria.prefs.set_pref("ocarina.infopane.up", False)
|
||||
|
||||
|
||||
def init():
|
||||
global button
|
||||
global entry
|
||||
global pbar
|
||||
global label
|
||||
global image
|
||||
|
||||
from components import button
|
||||
from components import entry
|
||||
from components import pbar
|
||||
from components import label
|
||||
from components import image
|
||||
|
||||
libsaria.init_pref("INFOPANEUP", False)
|
||||
info = TwoWayPane()
|
||||
add_info_page("Now Playing", NowPlaying())
|
||||
|
||||
def get_info():
|
||||
global info
|
||||
return info
|
||||
|
||||
def add_info_page(label, content):
|
||||
global info
|
||||
if label.__class__ == str:
|
||||
label = gtk.Label(label)
|
||||
label.show()
|
||||
content.show()
|
||||
info.tab.add_page(content, label)
|
||||
|
Loading…
Reference in New Issue