Check-in [f992b0792a]
Overview
Comment: | Introduce new hooks["switch"] for update_title(). Used by new `Channel homepage link` plugin, which brings back streamtuner1-style service homepage. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
f992b0792a2177c47b9987f3da2e1715 |
User & Date: | mario on 2015-05-17 19:11:44 |
Other Links: | manifest | tags |
Context
2015-05-17
| ||
19:12 | Typecast plugin options on initialization. Use SpinButton for `int` options instead of text label. check-in: cdafbe23ce user: mario tags: trunk | |
19:11 | Introduce new hooks["switch"] for update_title(). Used by new `Channel homepage link` plugin, which brings back streamtuner1-style service homepage. check-in: f992b0792a user: mario tags: trunk | |
19:10 | Add toolbar placeholder for channel-link. Change conf.max_streams to SpinButton. check-in: 5b2f021e96 user: mario tags: trunk | |
Changes
Added channels/ui_cht.py version [b9bdcb6542].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | # encoding: utf-8 # title: Channel toolbar link # description: Shows current channel and a link to online service in toolbar. # version: 1.0 # depends: streamtuner2 >= 2.1.9 # type: feature # category: ui # # Reintroduces the channel/service link in the toolbar, # just like in streamtuner1. import re # Channel Homepage in Toolbar class ui_cht(object): module = __name__ # Hook toolbar label def __init__(self, parent): self.label = parent.toolbar_link parent.hooks["switch"].append(self.switchy) # Update link label def switchy(self, meta, *x, **y): title = meta.get("title") url = meta.get("url") domain = re.sub("^.+?//|/.+$", "", url) self.label.set_markup("<big><b>{}</b></big>\n<a href='{}'>{}</a>".format(title, url, domain)) |
Modified st2.py from [ec315404d5] to [00795f8f6f].
︙ | ︙ | |||
72 73 74 75 76 77 78 79 80 81 82 83 84 85 | widgets = {} # non-glade widgets (any manually instantiated ones) channels = {} # channel modules features = {} # non-channel plugins #working = [] # threads hooks = { "play": [], # observers queue here "record": [], "init": [], "quit": [action.cleanup_tmp_files], "config_load": [], "config_save": [], } meta = plugin_meta() | > | 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | widgets = {} # non-glade widgets (any manually instantiated ones) channels = {} # channel modules features = {} # non-channel plugins #working = [] # threads hooks = { "play": [], # observers queue here "record": [], "switch": [], "init": [], "quit": [action.cleanup_tmp_files], "config_load": [], "config_save": [], } meta = plugin_meta() |
︙ | ︙ | |||
251 252 253 254 255 256 257 | ) # Invoked from the menu instead, uses module name instead of numeric tab id def channel_switch_by_name(self, name): self.notebook_channels.set_current_page(self.channel_names.index(name)) # Mirror selected channel tab into main window title | | > | > | 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 | ) # Invoked from the menu instead, uses module name instead of numeric tab id def channel_switch_by_name(self, name): self.notebook_channels.set_current_page(self.channel_names.index(name)) # Mirror selected channel tab into main window title def update_title(self, *x, **y): meta = self.channel().meta if conf.window_title: self.win_streamtuner2.set_title("Streamtuner2 - %s" % meta.get("title")) [cb(meta) for cb in self.hooks["switch"]] # Channel: row{} dict for current station def row(self): return self.channel().row() # Channel: fetch single varname from station row{} dict |
︙ | ︙ |