Check-in [306eba6f98]
Overview
Comment: | Break out _on_reload thread callback. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
306eba6f98e590544da431067d9d461b |
User & Date: | mario on 2015-05-11 20:29:46 |
Other Links: | manifest | tags |
Context
2015-05-12
| ||
20:01 | Split up post-proccessing filters (run after load/update_streams), use filter callback list now. Separate prepare display filters as well (so to hook dedicated favicon callback into). Move conf.show_favicons option into uikit.columns() signature. check-in: 475f736d5d user: mario tags: trunk | |
2015-05-11
| ||
20:29 | Break out _on_reload thread callback. check-in: 306eba6f98 user: mario tags: trunk | |
20:29 | Remove _ prefix from ls, rowmap, pix_entry, as features/search was already depending on literal rowmap. check-in: 6d1bd944fb user: mario tags: trunk | |
Changes
Modified st2.py from [35aa375d2a] to [63cc7f21fd].
︙ | ︙ | |||
68 69 70 71 72 73 74 | # and shares most application behaviour with the channel modules. class StreamTunerTwo(gtk.Builder): # object containers widgets = {} # non-glade widgets (any manually instantiated ones) channels = {} # channel modules features = {} # non-channel plugins | | | 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | # and shares most application behaviour with the channel modules. class StreamTunerTwo(gtk.Builder): # object containers 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": [], |
︙ | ︙ | |||
210 211 212 213 214 215 216 217 218 219 220 221 222 223 | # Custom-named widgets are available from .widgets{} not via .get_widget() def get_widget(self, name): if name in self.widgets: return self.widgets[name] else: return gtk.Builder.get_object(self, name) # Returns the currently selected directory/channel object (remembered position) def channel(self): return self.channels[self.current_channel] # List of module titles for channel tabs @property | > > > > > > > > > | 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 | # Custom-named widgets are available from .widgets{} not via .get_widget() def get_widget(self, name): if name in self.widgets: return self.widgets[name] else: return gtk.Builder.get_object(self, name) # Run a function in thread def thread(self, target, *args, **kwargs): if conf.nothreads: return target(*args, **kwargs) thread = Thread(target=target, args=args, kwargs=kwargs) thread.start() #self.working.append(thread) # Returns the currently selected directory/channel object (remembered position) def channel(self): return self.channels[self.current_channel] # List of module titles for channel tabs @property |
︙ | ︙ | |||
260 261 262 263 264 265 266 | # Play button def on_play_clicked(self, widget, event=None, *args): self.status("Starting player...") channel = self.channel() | | | 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 | # Play button def on_play_clicked(self, widget, event=None, *args): self.status("Starting player...") channel = self.channel() pixstore = [channel.ls, channel.pix_entry, channel.rowno()] row = channel.play() self.status("") [callback(row, pixstore=pixstore) for callback in self.hooks["play"]] # Recording: invoke streamripper for current stream URL def on_record_clicked(self, widget): self.status("Recording station...") |
︙ | ︙ | |||
287 288 289 290 291 292 293 | log.UI("dblclick") url = self.channel().meta.get("url", "https://duckduckgo.com/?q=" + self.channel().module) action.browser(url) # Reload stream list in current channel-category def on_reload_clicked(self, widget=None, reload=1): log.UI("on_reload_clicked()", "reload=", reload, "current_channel=", self.current_channel, "c=", self.channels[self.current_channel], "cat=", self.channel().current) | < | < | < | < < | < < < | | | | | 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 | log.UI("dblclick") url = self.channel().meta.get("url", "https://duckduckgo.com/?q=" + self.channel().module) action.browser(url) # Reload stream list in current channel-category def on_reload_clicked(self, widget=None, reload=1): log.UI("on_reload_clicked()", "reload=", reload, "current_channel=", self.current_channel, "c=", self.channels[self.current_channel], "cat=", self.channel().current) self.thread(self._on_reload, self.channel(), reload) def _on_reload(self, channel, reload): self.channel().load(channel.current, force=reload) if reload: try: self.bookmarks.heuristic_update(self.current_channel, channel.category) except: pass # Click in category list def on_category_clicked(self, widget, event, *more): category = self.channel().currentcat() log.UI("on_category_clicked", category, self.current_channel) self.on_reload_clicked(None, reload=0) pass # Add current selection to bookmark store def bookmark(self, widget): self.bookmarks.add(self.row()) self.channel().row_icon(gtk.STOCK_ABOUT) # refresh bookmarks tab self.bookmarks.load(self.bookmarks.default) # Reload category tree def update_categories(self, widget): self.thread(self.channel().reload_categories) # Menu invocation: refresh favicons for all stations in current streams category def update_favicons(self, widget): if "favicon" in self.features: ch = self.channel() self.features["favicon"].update_all(entries=ch.stations(), pixstore=[ch.ls, ch.pix_entry, None]) # Save stream to file (.m3u) def save_as(self, widget): row = self.row() default_fn = row["title"] + ".m3u" fn = uikit.save_file("Save Stream", None, default_fn, [(".m3u","*m3u"),(".pls","*pls"),(".xspf","*xspf"),(".jspf","*jspf"),(".smil","*smil"),(".asx","*asx"),("all files","*")]) if fn: |
︙ | ︙ |