Index: st2.py ================================================================== --- st2.py +++ st2.py @@ -3,11 +3,11 @@ # 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 # license: Public Domain # url: http://freshcode.club/projects/streamtuner2 # config: @@ -415,22 +415,20 @@ __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"] - 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 + + 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"] # store window/widget states (sizes, selections, etc.) def app_state(self, widget): # gtk widget states widgetnames = ["win_streamtuner2", "toolbar", "notebook_channels", ] \ @@ -455,12 +453,16 @@ 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,