Internet radio browser GUI for music/video streams from various directory services.

⌈⌋ ⎇ branch:  streamtuner2


Diff

Differences From Artifact [3eb72c0f83]:

To Artifact [a5bfd28a13]:


362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
    # Either pass a string "" or a float 0.5, the message and pulse will be automatically
    # removed after 5 seconds now.
    def status(self, text=None, timeout=3):
        self.status_last = time.time() + timeout

        # progressbar
        if isinstance(text, (int, float)):
            log.FLOAT(text)
            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)

        # timeout
        if not text or time.time() >= self.status_last:
            self.statusbar.set_text("")
            self.progress.hide()
            return False







<









|







362
363
364
365
366
367
368

369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
    # Either pass a string "" or a float 0.5, the message and pulse will be automatically
    # removed after 5 seconds now.
    def status(self, text=None, timeout=3):
        self.status_last = time.time() + timeout

        # 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)):
            uikit.do(self.statusbar.set_text, text)

        # timeout
        if not text or time.time() >= self.status_last:
            self.statusbar.set_text("")
            self.progress.hide()
            return False
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450

    # load application state (widget sizes, selections, etc.)
    def init_app_state(self):

        winlayout = conf.load("window")
        if (winlayout):
            try: uikit.app_restore(self, winlayout)
            except Exception as e: log.APPRESTORE(e) # may fail for disabled/reordered plugin channels

        winstate = conf.load("state")
        if (winstate):
            for id,prev in winstate.items():
                try: self.channels[id].current = prev["current"]
                except Exception as e: log.APPSTATE(e)

    # store window/widget states (sizes, selections, etc.)
    def save_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]







|





|







429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449

    # load application state (widget sizes, selections, etc.)
    def init_app_state(self):

        winlayout = conf.load("window")
        if (winlayout):
            try: uikit.app_restore(self, winlayout)
            except Exception as e: log.APPSTATE_RESTORE(e) # may fail for disabled/reordered plugin channels

        winstate = conf.load("state")
        if (winstate):
            for id,prev in winstate.items():
                try: self.channels[id].current = prev["current"]
                except Exception as e: log.APPSTATE_RESTORE(e)

    # store window/widget states (sizes, selections, etc.)
    def save_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]
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473

    # end application and gtk+ main loop
    def gtk_main_quit(self, widget, *x):
        if conf.auto_save_appstate:
            try:  # doesn't work with gtk3 yet (probably just hooking at the wrong time)
                self.save_app_state(widget)
            except Exception as e:
                log.ERR(e)
        gtk.main_quit()


    # Right clicking a stream/station in the treeview to make context menu pop out.
    def station_context_menu(self, treeview, event):
        if treeview and event and event.button >= 3:
            path = treeview.get_path_at_pos(int(event.x), int(event.y))







|







458
459
460
461
462
463
464
465
466
467
468
469
470
471
472

    # end application and gtk+ main loop
    def gtk_main_quit(self, widget, *x):
        if conf.auto_save_appstate:
            try:  # doesn't work with gtk3 yet (probably just hooking at the wrong time)
                self.save_app_state(widget)
            except Exception as e:
                log.ERR("st2.gtk_main_quit", e)
        gtk.main_quit()


    # Right clicking a stream/station in the treeview to make context menu pop out.
    def station_context_menu(self, treeview, event):
        if treeview and event and event.button >= 3:
            path = treeview.get_path_at_pos(int(event.x), int(event.y))