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

⌈⌋ ⎇ branch:  streamtuner2


Check-in [2687258c8c]

Overview
Comment:Simplify appliation state restore. Don't override old .shown status / liststore position should be handled by GenericChannel. Suppress TreeView errors when clicking on empty station list area.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 2687258c8ccf5f995a1b315daba41afc91d95591
User & Date: mario on 2015-04-17 21:09:57
Other Links: manifest | tags
Context
2015-04-17
21:13
Make .current a dynamic property for debugging. Skip load() update for category==None calls (doesn't happen with previous appstate). Undo default category setting. Now main.appstate_init values are used again. Don't position category liststore selection to #0. Enable "Format" station column. check-in: 99ee6c4ef4 user: mario tags: trunk
21:09
Simplify appliation state restore. Don't override old .shown status / liststore position should be handled by GenericChannel. Suppress TreeView errors when clicking on empty station list area. check-in: 2687258c8c user: mario tags: trunk
21:07
Tested fixed-width for pixbuf cellrenderer in stream lists; little effect. Set .module attribute for auxiliary windows (unused). check-in: b434d63e4e user: mario tags: trunk
Changes

Modified st2.py from [b68d9a3628] to [828857aa59].

1
2
3
4
5
6
7
8

9
10
11
12
13
14
15
1
2
3
4
5
6
7

8
9
10
11
12
13
14
15







-
+







#!/usr/bin/env python
#
# encoding: UTF-8
# api: python
# type: application
# title: streamtuner2
# description: Directory browser for internet radio, audio and video streams
# version: 2.1.6
# version: 2.1.7
# state: beta
# author: Mario Salzer <mario@include-once.org>
# license: Public Domain
# url: http://freshcode.club/projects/streamtuner2
# config:  
#   { type: env, name: http_proxy, description: proxy for HTTP access }
#   { type: env, name: XDG_CONFIG_HOME, description: relocates user .config subdirectory }
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428










429
430
431
432
433
434
435
436
437
438
413
414
415
416
417
418
419









420
421
422
423
424
425
426
427
428
429



430
431
432
433
434
435
436







-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
-







                
            except Exception as e:
                __print__(dbg.INIT, "load_plugin_channels: error initializing:", name, ", exception:")
                traceback.print_exc()

    # load application state (widget sizes, selections, etc.)
    def init_app_state(self):
        try:
            winlayout = conf.load("window")
            if (winlayout):
                uikit.app_restore(self, winlayout)
            # selection values
            winstate = conf.load("state")
            if (winstate):
                for id in winstate.keys():
                    self.channels[id].current = winstate[id]["current"]

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

        winstate = conf.load("state")
        if (winstate):
            for id,prev in winstate.items():
                self.channels[id].current = prev["current"]
                    self.channels[id].shown = winlayout[id+"_list"].get("row:selected", 0)   # actually just used as boolean flag (for late loading of stream list), selection bar has been positioned before already
        except:
            pass # fails for disabled/reordered plugin channels

    # store window/widget states (sizes, selections, etc.)
    def 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]
453
454
455
456
457
458
459
460
461






462
463
464
465
466
467
468
451
452
453
454
455
456
457


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







-
-
+
+
+
+
+
+







            except:
                None
        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 event.button >= 3:
            path = treeview.get_path_at_pos(int(event.x), int(event.y))[0]
        if treeview and event and event.button >= 3:
            path = treeview.get_path_at_pos(int(event.x), int(event.y))
            if not path:
                return False
            else:
                path = path[0]
            treeview.grab_focus()
            treeview.set_cursor(path, None, False)
            self.streamactions.popup(
                  parent_menu_shell=None, parent_menu_item=None, func=None,
                  button=event.button, activate_time=event.time,
                  data=None
            )