def _onUpdateUI(self, event): """ This event is called periodically to allow the user to update the menu / toolbar / buttons based upon the internal application state. """ menuhelper.check(self, "to_tray", appcfg.options[appcfg.CFG_TRAY_MINIMIZE]) # sync the checkbox view based upon the view state of the panels for menu_id in self._toggleWindowLookup.iterkeys(): pane = self._aui.GetPane(self._toggleWindowLookup[menu_id]) menuhelper.check(self, menu_id, pane.IsShown()) sid = viewmgr.appstate["series_id"] menuhelper.enable(self, ["edit_series", "del_series", "clear_cache"], sid != -1) menuhelper.enable(self, ["s_todownload", "s_download", "s_downloaded", "s_ready", "s_seen"], viewmgr.appstate["epcount"] > 0) menuhelper.enable(self, "select_all", viewmgr.appstate["lstcount"] > 0) menuhelper.enable(self, "edit_episode", viewmgr.appstate["epcount"] == 1) view_enabled = viewmgr._series_sel._view_type != -1 menuhelper.enable(self, "update_all", not viewmgr.is_busy()) menuhelper.enable(self, "update", view_enabled and viewmgr.series_active()) menuhelper.enable(self, "dir_epfiles", view_enabled and viewmgr.series_active()) menuhelper.enable(self, "sync_series", sid != -1)
def _onUpdateUI(self, event): """ This event is called periodically to allow the user to update the menu / toolbar / buttons based upon the internal application state. """ menuhelper.check(self, "to_tray", appcfg.options[appcfg.CFG_TRAY_MINIMIZE]) # sync the checkbox view based upon the view state of the panels for menu_id in self._toggleWindowLookup.iterkeys(): pane = self._aui.GetPane(self._toggleWindowLookup[menu_id]) menuhelper.check(self, menu_id, pane.IsShown()) sid = viewmgr.appstate["series_id"] menuhelper.enable(self, ["edit_series", "del_series", "clear_cache"], sid != -1) menuhelper.enable(self, [ "s_todownload", "s_download", "s_downloaded", "s_ready", "s_seen" ], viewmgr.appstate["epcount"] > 0) menuhelper.enable(self, "select_all", viewmgr.appstate["lstcount"] > 0) menuhelper.enable(self, "edit_episode", viewmgr.appstate["epcount"] == 1) view_enabled = viewmgr._series_sel._view_type != -1 menuhelper.enable(self, "update_all", not viewmgr.is_busy()) menuhelper.enable(self, "update", view_enabled and viewmgr.series_active()) menuhelper.enable(self, "dir_epfiles", view_enabled and viewmgr.series_active()) menuhelper.enable(self, "sync_series", sid != -1)
def _onGuiUpdated(self, event): """ Called after every GUI update """ view_enabled = viewmgr._series_sel._view_type != -1 self._update_all.Enable(not viewmgr.is_busy()) self._update_one.Enable(view_enabled and viewmgr.series_active()) self._show_unseen.Enable(viewmgr._series_sel._view_type == series_filter.VIEW_SERIES) self._episodeFilter.Enable(viewmgr._series_sel._view_type == series_filter.VIEW_WHATS_ON)
def _onTimer(self, event): """ Periodic check function to update various GUI elements. We could use OnGUIUpdate but it is sent too sporadically """ series_title = viewmgr.get_current_title() if series_title: self._statusbar.SetStatusText("Processing: %s" % series_title, 1) else: if viewmgr.is_busy(): self._statusbar.SetStatusText("Working hard ..", 1) else: self._statusbar.SetStatusText("Idle ...", 1) pass
def CreatePopupMenu(self): """ Creates a popupmenu """ popmenu = [ "browser", "update_all", "-", "restore_wnd", "exit"] traymenu = wx.Menu() menu_data = menuhelper.populate(traymenu, popmenu) id = menu_data["restore_wnd"].id traymenu.Enable(id, not self._parent.IsShown()) self.Bind(wx.EVT_MENU, self._onRestoreWindow, id = id) id = menu_data["update_all"].id traymenu.Enable(id, not viewmgr.is_busy()) self.Bind(wx.EVT_MENU, self._onUpdateAll, id = id) self.Bind(wx.EVT_MENU, self._onBrowserStart, id = menu_data["browser"].id) self.Bind(wx.EVT_MENU, self._onExit, id = menu_data["exit"].id) return traymenu
def CreatePopupMenu(self): """ Creates a popupmenu """ popmenu = ["browser", "update_all", "-", "restore_wnd", "exit"] traymenu = wx.Menu() menu_data = menuhelper.populate(traymenu, popmenu) id = menu_data["restore_wnd"].id traymenu.Enable(id, not self._parent.IsShown()) self.Bind(wx.EVT_MENU, self._onRestoreWindow, id=id) id = menu_data["update_all"].id traymenu.Enable(id, not viewmgr.is_busy()) self.Bind(wx.EVT_MENU, self._onUpdateAll, id=id) self.Bind(wx.EVT_MENU, self._onBrowserStart, id=menu_data["browser"].id) self.Bind(wx.EVT_MENU, self._onExit, id=menu_data["exit"].id) return traymenu