16
17
18
19
20
21
22
23
24
25
26
27
28
29
30 | # category: sound
# depends: pygtk | gi, threading, requests, pyquery, lxml
# id: streamtuner2
# pack: *.py, gtk*.xml, st2.py=/usr/bin/streamtuner2, channels/__init__.py, bundle/*.py,
# streamtuner2.desktop=/usr/share/applications/, README=/usr/share/doc/streamtuner2/,
# NEWS.gz=/usr/share/doc/streamtuner2/changelog.gz, help/streamtuner2.1=/usr/share/man/man1/,
# help/*page=/usr/share/doc/streamtuner2/help/, help/img/*=/usr/share/doc/streamtuner2/help/img/,
# streamtuner2.png, logo.png=/usr/share/pixmaps/streamtuner2.png,
# architecture: all
#
# Streamtuner2 is a GUI for browsing internet radio directories, music
# collections, and video services - grouped by genres or categories.
# It runs your preferred audio player, and streamripper for recording.
#
# It's an independent rewrite of streamtuner1. Being written in Python, |
|
| 16
17
18
19
20
21
22
23
24
25
26
27
28
29
30 | # category: sound
# depends: pygtk | gi, threading, requests, pyquery, lxml
# id: streamtuner2
# pack: *.py, gtk*.xml, st2.py=/usr/bin/streamtuner2, channels/__init__.py, bundle/*.py,
# streamtuner2.desktop=/usr/share/applications/, README=/usr/share/doc/streamtuner2/,
# NEWS.gz=/usr/share/doc/streamtuner2/changelog.gz, help/streamtuner2.1=/usr/share/man/man1/,
# help/*page=/usr/share/doc/streamtuner2/help/, help/img/*=/usr/share/doc/streamtuner2/help/img/,
# logo.png=/usr/share/pixmaps/streamtuner2.png,
# architecture: all
#
# Streamtuner2 is a GUI for browsing internet radio directories, music
# collections, and video services - grouped by genres or categories.
# It runs your preferred audio player, and streamripper for recording.
#
# It's an independent rewrite of streamtuner1. Being written in Python, |
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105 | current_channel = "bookmarks" # currently selected channel name (as index in self.channels{})
# constructor
def __init__(self):
# Load stylesheet, instantiate GtkBuilder in self, menu and logo hooks
gui_startup(0/20.0), self.load_theme()
gui_startup(1/20.0), gtk.Builder.__init__(self)
gui_startup(1/20.0), gtk.Builder.add_from_string(self, ui_xml)
gui_startup(3/20.0), self.extensionsCTM.set_submenu(self.extensions) # duplicates Station>Extension menu into stream context menu
self.img_logo.set_from_pixbuf(uikit.pixbuf(logo.png))
# initialize built-in plugins
self.channels = { |
|
| 91
92
93
94
95
96
97
98
99
100
101
102
103
104
105 | current_channel = "bookmarks" # currently selected channel name (as index in self.channels{})
# constructor
def __init__(self):
# Load stylesheet, instantiate GtkBuilder in self, menu and logo hooks
gui_startup(0/20.0), uikit.load_theme(conf.get("theme"))
gui_startup(1/20.0), gtk.Builder.__init__(self)
gui_startup(1/20.0), gtk.Builder.add_from_string(self, ui_xml)
gui_startup(3/20.0), self.extensionsCTM.set_submenu(self.extensions) # duplicates Station>Extension menu into stream context menu
self.img_logo.set_from_pixbuf(uikit.pixbuf(logo.png))
# initialize built-in plugins
self.channels = { |
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476 | # object vars
channelopts = {} #dict([(id, {"current":self.channels[id].current}) for id in self.channel_names])
for id in self.channels.keys():
if (self.channels[id]):
channelopts[id] = {"current":self.channels[id].current}
conf.save("state", channelopts, nice=1)
# apply gtkrc stylesheet
def load_theme(self):
if conf.get("theme"):
for dir in (conf.dir, conf.share, "/usr/share"):
f = dir + "/themes/" + conf.theme + "/gtk-2.0/gtkrc"
if os.path.exists(f):
gtk.rc_parse(f)
pass
# end application and gtk+ main loop
def gtk_main_quit(self, widget, *x):
if conf.auto_save_appstate:
try: # doesn't work with gtk3 yet (probably just hooking at the wrong time)
self.app_state(widget)
except: |
<
<
<
<
<
<
<
<
<
<
| 453
454
455
456
457
458
459
460
461
462
463
464
465
466 | # object vars
channelopts = {} #dict([(id, {"current":self.channels[id].current}) for id in self.channel_names])
for id in self.channels.keys():
if (self.channels[id]):
channelopts[id] = {"current":self.channels[id].current}
conf.save("state", channelopts, nice=1)
# end application and gtk+ main loop
def gtk_main_quit(self, widget, *x):
if conf.auto_save_appstate:
try: # doesn't work with gtk3 yet (probably just hooking at the wrong time)
self.app_state(widget)
except: |