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
395
396
397
398
399
400
401
402
403
404
|
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:
#log.UI("progressbar.hide()")
self.statusbar.set_text("")
self.progress.hide()
return False
else:
return True
# load plugins from /usr/share/streamtuner2/channels/
|
|
>
>
>
|
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
395
396
397
398
399
400
401
402
403
404
405
406
407
|
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, icon=None, *k, **kw):
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)
if icon:
uikit.do(lambda icon=icon, *x: self.statusbar_img.show() or self.statusbar_img.set_from_stock(icon, 2))
# 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:
#log.UI("progressbar.hide()")
self.statusbar.set_text("")
self.statusbar_img.hide()
self.progress.hide()
return False
else:
return True
# load plugins from /usr/share/streamtuner2/channels/
|
521
522
523
524
525
526
527
528
529
530
531
532
533
534
|
# prepare main window
main = StreamTunerTwo()
# first invocation
if (conf.get("firstrun")):
main.configwin.open(None)
del conf.firstrun
# run
gtk.main()
[callback() for callback in main.hooks["quit"]]
log.PROC(r"[31m gtk_main_quit [0m")
# invoke command-line interface
|
>
|
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
|
# prepare main window
main = StreamTunerTwo()
# first invocation
if (conf.get("firstrun")):
main.configwin.open(None)
del conf.firstrun
main.status("Initial startup, configure your audio players!", timeout=10, icon="gtk-dialog-error")
# run
gtk.main()
[callback() for callback in main.hooks["quit"]]
log.PROC(r"[31m gtk_main_quit [0m")
# invoke command-line interface
|