Example #1
0
    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)
Example #2
0
    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)
Example #3
0
    def _add(self, msg):
        """
        Add an episode to the list, but sort it first and
        add the item to the list later with the given index
        """
        ep = msg.data
        pos = 0

        # dynamically determine position
        if viewmgr.series_active():
            sortfunc = _sort_normal
        else:
            sortfunc = _sort_updated

        if self.GetItemCount() > 0:
            for idx in xrange(0, self.GetItemCount()):
                curr_ep = db.store.get(series_list.Episode,
                                       self.GetItemData(idx))
                if curr_ep:
                    if sortfunc(ep, curr_ep) <= 0:
                        pos = idx
                        break
                    pos += 1

        self._insertEpisode(ep, pos)
Example #4
0
    def _onGuiEdit(self, event = None):
        """ Event handler to edit a Series """

        # only edit when a genuine series is selected
        if viewmgr.series_active():
            sel_id = viewmgr._series_sel._selected_series_id
            if sel_id != -1:
                series = db.store.get(series_list.Series, sel_id)
                self._doEditSeries(series)
Example #5
0
    def _onGuiEdit(self, event=None):
        """ Event handler to edit a Series """

        # only edit when a genuine series is selected
        if viewmgr.series_active():
            sel_id = viewmgr._series_sel._selected_series_id
            if sel_id != -1:
                series = db.store.get(series_list.Series, sel_id)
                self._doEditSeries(series)
Example #6
0
 def _onClearCache(self, event):
     """
     Clear cache of one or all items
     """
     if viewmgr.series_active():
         if wx.MessageBox("Clearing the cache means that from this series, the downloaded episodes will\n" + \
                          "be deleted. On the next update, the series will be refreshed again.\n" + \
                          "Be aware that earlier downloaded items not found on the webpage(s), are lost forever.\n" +
                          "Would you like to do this?", "Warning", wx.ICON_WARNING | wx.YES_NO) == wx.YES:
             viewmgr.clear_current_cache()
Example #7
0
 def _onClearCache(self, event):
     """
     Clear cache of one or all items
     """
     if viewmgr.series_active():
         if wx.MessageBox("Clearing the cache means that from this series, the downloaded episodes will\n" + \
                          "be deleted. On the next update, the series will be refreshed again.\n" + \
                          "Be aware that earlier downloaded items not found on the webpage(s), are lost forever.\n" +
                          "Would you like to do this?", "Warning", wx.ICON_WARNING | wx.YES_NO) == wx.YES:
             viewmgr.clear_current_cache()
Example #8
0
    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)
Example #9
0
    def _onGuiDelete(self, event):
        """ Event handler for deleting a Series """

        if viewmgr.series_active():
            sel_id = viewmgr._series_sel._selected_series_id
            if sel_id != -1:
                series = db.store.get(series_list.Series, sel_id)

                if wx.MessageBox("Are you sure you want to delete this series?\n" + \
                                 "All gathered episodes will also be lost!", "Warning", wx.ICON_WARNING | wx.YES_NO) == wx.YES:
                    # delete
                    viewmgr.delete_series(series)
Example #10
0
    def _onGuiDelete(self, event):
        """ Event handler for deleting a Series """

        if viewmgr.series_active():
            sel_id = viewmgr._series_sel._selected_series_id
            if sel_id != -1:
                series = db.store.get(series_list.Series, sel_id)

                if wx.MessageBox("Are you sure you want to delete this series?\n" + \
                                 "All gathered episodes will also be lost!", "Warning", wx.ICON_WARNING | wx.YES_NO) == wx.YES:
                    # delete
                    viewmgr.delete_series(series)
Example #11
0
    def _add(self, msg):
        """
        Add an episode to the list, but sort it first and
        add the item to the list later with the given index
        """
        ep = msg.data
        pos = 0

        # dynamically determine position
        if viewmgr.series_active():
            sortfunc = _sort_normal
        else:
            sortfunc = _sort_updated

        if self.GetItemCount() > 0:
            for idx in xrange(0, self.GetItemCount()):
                curr_ep = db.store.get(series_list.Episode, self.GetItemData(idx))
                if curr_ep:
                    if sortfunc(ep, curr_ep) <= 0:
                        pos = idx
                        break
                    pos += 1

        self._insertEpisode(ep, pos)