Check-in [9a4aa0b793]
Overview
| Comment: | Moved add_plugin_defaults from main into GenericChannel constructor. Check for percentage>=0 in progress indicator of statusbar. |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
9a4aa0b793543675564ca75bf3886e47 |
| User & Date: | mario on 2015-04-01 15:47:36 |
| Other Links: | manifest | tags |
Context
|
2015-04-01
| ||
| 15:49 | Trim down plugin comment. check-in: c8c55c79da user: mario tags: trunk | |
| 15:47 | Moved add_plugin_defaults from main into GenericChannel constructor. Check for percentage>=0 in progress indicator of statusbar. check-in: 9a4aa0b793 user: mario tags: trunk | |
| 15:45 | Split extension_main and extension_context menus. Fix pixmap icon back. check-in: 04f454a7a3 user: mario tags: trunk | |
Changes
Modified channels/__init__.py from [d3c6459236] to [ed3951c050].
| ︙ | ︙ | |||
130 131 132 133 134 135 136 137 138 139 140 141 142 143 |
self.gtk_list = None
self.gtk_cat = None
self.module = self.__class__.__name__
self.meta = plugin_meta(None, inspect.getcomments(inspect.getmodule(self)))
self.config = self.meta.get("config", [])
self.title = self.meta.get("title", self.module)
# only if streamtuner2 is run in graphical mode
if (parent):
self.cache()
self.gui(parent)
pass
| > > > | 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 |
self.gtk_list = None
self.gtk_cat = None
self.module = self.__class__.__name__
self.meta = plugin_meta(None, inspect.getcomments(inspect.getmodule(self)))
self.config = self.meta.get("config", [])
self.title = self.meta.get("title", self.module)
# add default options values to config.conf.* dict
conf.add_plugin_defaults(self.meta["config"], self.module)
# only if streamtuner2 is run in graphical mode
if (parent):
self.cache()
self.gui(parent)
pass
|
| ︙ | ︙ | |||
193 194 195 196 197 198 199 |
# load default category
if (self.current):
self.load(self.current)
else:
uikit.columns(self.gtk_list, self.datamap, [])
# add to main menu
| | | 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 |
# load default category
if (self.current):
self.load(self.current)
else:
uikit.columns(self.gtk_list, self.datamap, [])
# add to main menu
uikit.add_menu([parent.channelmenuitems], self.meta["title"], lambda w: parent.channel_switch(w, self.module) or 1)
# make private copy of .datamap and modify field (title= only ATM)
def update_datamap(self, search="name", title=None):
if self.datamap == GenericChannel.datamap:
self.datamap = copy.deepcopy(self.datamap)
for i,row in enumerate(self.datamap):
|
| ︙ | ︙ | |||
584 585 586 587 588 589 590 |
# try to initialize superclass now, before adding to channel tabs
GenericChannel.gui(self, parent)
# add notebook tab
| | | 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 |
# try to initialize superclass now, before adding to channel tabs
GenericChannel.gui(self, parent)
# add notebook tab
tab = parent.notebook_channels.insert_page_menu(vbox, ev_label, plain_label, -1)
# double-click catch
# add module to list
|
| ︙ | ︙ |
Modified st2.py from [15304419e8] to [e68343b5e8].
| ︙ | ︙ | |||
94 95 96 97 98 99 100 |
# 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)
| < | | 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# 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.img_logo.set_from_pixbuf(uikit.pixbuf(logo.png))
# initialize built-in plugins
self.channels = {
"bookmarks": channels.bookmarks.bookmarks(parent=self), # this the remaining built-in channel
}
# dialogs that are connected to main
self.features = {
|
| ︙ | ︙ | |||
209 210 211 212 213 214 215 |
"streamedit_save": self.streamedit.save,
"streamedit_new": self.streamedit.new,
"streamedit_cancel": self.streamedit.cancel,
}, **self.add_signals))
# actually display main window
self.win_streamtuner2.show_all()
| | | | 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 |
"streamedit_save": self.streamedit.save,
"streamedit_new": self.streamedit.new,
"streamedit_cancel": self.streamedit.cancel,
}, **self.add_signals))
# actually display main window
self.win_streamtuner2.show_all()
gui_startup(100.0)
#-- Shortcut for glade.get_widget()
# Allows access to widgets as direct attributes instead of using .get_widget()
# Also looks in self.channels[] for the named channel plugins
def __getattr__(self, name):
if (name in self.channels):
return self.channels[name] # like self.shoutcast
|
| ︙ | ︙ | |||
389 390 391 392 393 394 395 |
sbar_cid = self.get_widget("statusbar").get_context_id("messages")
# remove text
while ((not text) and (type(text)==str) and len(sbar_msg)):
sbar_msg.pop()
uikit.do(lambda:self.statusbar.pop(sbar_cid))
# progressbar
if (type(text)==float):
| | | 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 |
sbar_cid = self.get_widget("statusbar").get_context_id("messages")
# remove text
while ((not text) and (type(text)==str) and len(sbar_msg)):
sbar_msg.pop()
uikit.do(lambda:self.statusbar.pop(sbar_cid))
# progressbar
if (type(text)==float):
if text >= 0.999 or text < 0.0: # completed
uikit.do(lambda:self.progress.hide())
else: # show percentage
uikit.do(lambda:self.progress.show_all() or self.progress.set_fraction(text))
if (text <= 0): # unknown state
uikit.do(lambda:self.progress.pulse())
# add text
elif (type(text)==str):
|
| ︙ | ︙ | |||
424 425 426 427 428 429 430 |
# load plugin
try:
plugin = __import__("channels."+module, globals(), None, [""])
#print [name for name,c in inspect.getmembers(plugin) if inspect.isclass(c)]
plugin_class = plugin.__dict__[module]
plugin_obj = plugin_class(parent=self)
| | < < | < | < < < | 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 |
# load plugin
try:
plugin = __import__("channels."+module, globals(), None, [""])
#print [name for name,c in inspect.getmembers(plugin) if inspect.isclass(c)]
plugin_class = plugin.__dict__[module]
plugin_obj = plugin_class(parent=self)
# add to .channels{}
if issubclass(plugin_class, channels.GenericChannel):
self.channels[module] = plugin_obj
if module not in self.channel_names: # skip (glade) built-in channels
self.channel_names.append(module)
# or .features{} for other plugin types
else:
self.features[module] = plugin_obj
except Exception as e:
__print__(dbg.INIT, "load_plugin_channels: error initializing:", module, ", exception:")
traceback.print_exc()
# store window/widget states (sizes, selections, etc.)
def app_state(self, widget):
# gtk widget states
widgetnames = ["win_streamtuner2", "toolbar", "notebook_channels", ] \
+ [id+"_list" for id in self.channel_names] \
+ [id+"_cat" for id in self.channel_names]
|
| ︙ | ︙ |