275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292 | def selected(self, name="url"):
return self.row().get(name)
# Play button
def on_play_clicked(self, widget, event=None, *args):
self.status("Starting player...")
channel = self.channel()
row = channel.play()
self.status("")
[callback(row, channel=channel) for callback in self.hooks["play"]]
# Recording: invoke streamripper for current stream URL
def on_record_clicked(self, widget):
self.status("Recording station...")
row = self.channel().record()
[callback(row) for callback in self.hooks["record"]] |
|
|
| 275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292 | def selected(self, name="url"):
return self.row().get(name)
# Play button
def on_play_clicked(self, widget, event=None, *args):
self.status("Starting player...", timeout=1.25)
channel = self.channel()
row = channel.play()
#self.status("")
[callback(row, channel=channel) for callback in self.hooks["play"]]
# Recording: invoke streamripper for current stream URL
def on_record_clicked(self, widget):
self.status("Recording station...")
row = self.channel().record()
[callback(row) for callback in self.hooks["record"]] |
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394 | def switch_notebook_tabs_position(self, w, pos):
self.notebook_channels.set_tab_pos(pos);
# Shortcut to statusbar and progressbar (receives either a string, or a float).
def status(self, text=None, timeout=3):
self.status_last = time.time() + timeout
gobject.timeout_add(int(timeout*1000), self.status_clear)
#log.UI("progressbar := %s" %text)
# progressbar
if isinstance(text, (int, float)):
if (text <= 0): # unknown state
uikit.do(self.progress.pulse, immediate=1)
elif text >= 0.999 or text < 0.0: # completed
uikit.do(self.progress.hide)
else: # show percentage
uikit.do(self.progress.show, immediate=1)
uikit.do(self.progress.set_fraction, text, immediate=1)
# add text
elif isinstance(text, (str, unicode)):
uikit.do(self.statusbar.set_text, text)
# clean up
else:
self.status_clear(anyway=True)
# Clean up after 3 seconds
def status_clear(self, anyway=False):
if anyway or time.time() >= self.status_last: |
|
|
| 365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394 | def switch_notebook_tabs_position(self, w, pos):
self.notebook_channels.set_tab_pos(pos);
# Shortcut to statusbar and progressbar (receives either a string, or a float).
def status(self, text=None, timeout=3, markup=False):
self.status_last = time.time() + timeout
gobject.timeout_add(int(timeout*1000), self.status_clear)
#log.UI("progressbar := %s" %text)
# progressbar
if isinstance(text, (int, float)):
if (text <= 0): # unknown state
uikit.do(self.progress.pulse, immediate=1)
elif text >= 0.999 or text < 0.0: # completed
uikit.do(self.progress.hide)
else: # show percentage
uikit.do(self.progress.show, immediate=1)
uikit.do(self.progress.set_fraction, text, immediate=1)
# add text
elif isinstance(text, (str, unicode)):
uikit.do(self.statusbar.set_markup if markup else self.statusbar.set_text, text)
# clean up
else:
self.status_clear(anyway=True)
# Clean up after 3 seconds
def status_clear(self, anyway=False):
if anyway or time.time() >= self.status_last: |