Ejemplo n.º 1
0
    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
Ejemplo n.º 2
0
    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
Ejemplo n.º 3
0
    def _onMenuPopup(self, event):
        """
        Create popup menu to perform some options
        """
        self._se_lookup = dict()
        if self.GetFirstSelected() != wx.NOT_FOUND:
            se_dict = dict()
            menulst = list()
            addsep = False
            if viewmgr._series_sel._view_type == series_filter.VIEW_WHATS_NEW or \
               viewmgr._series_sel._view_type == series_filter.VIEW_WHATS_ON:
                menulst.append("s_todownload")
                addsep = True

            if viewmgr._series_sel._view_type == series_filter.VIEW_TO_DOWNLOAD:
                menulst.append("s_download")
                addsep = True

            if viewmgr._series_sel._view_type == series_filter.VIEW_DOWNLOADING:
                menulst.append("s_downloaded")
                addsep = True

            if viewmgr._series_sel._view_type == series_filter.VIEW_DOWNLOADED or \
                viewmgr._series_sel._view_type == series_filter.VIEW_WHATS_NEW:
                menulst.append("s_ready")
                addsep = True

            if addsep:
                menulst.append("-")

            se_items = list()
            idx = self.GetFirstSelected()
            if self.GetNextSelected(idx) == wx.NOT_FOUND:

                result = db.store.find(searches.Searches)
                lst = [s for s in result.order_by(searches.Searches.name)]
                if lst:
                    for se in lst:
                        se_dict[se.id] = (se.name, se.name, "", None,
                                          menuhelper.NORMAL, se)
                        se_items.append(se.id)

                menulst.append(
                    ("&Online Search", se_items + ["-", "searches"]))

                menulst.append("edit_episode")

                if viewmgr.appstate["series_id"] == -1:
                    se_dict["edit_series_special"] = ("&Edit This Series",
                                                      "Edit This Series",
                                                      "Edit This Series",
                                                      icon_edit.getBitmap(),
                                                      menuhelper.NORMAL)
                    menulst.append("edit_series_special")

                if viewmgr._series_sel._view_type != series_filter.VIEW_QUEUES:
                    menulst.append("-")

            menulst.append(("Mark Episode(s) As ...", [
                "s_todownload", "s_download", "s_downloaded", "s_ready",
                "s_seen"
            ]))
            mnu = wx.Menu()
            self._menu_data = menuhelper.populate(mnu, menulst, se_dict)

            for id in se_items:
                self.Bind(wx.EVT_MENU,
                          self._onSearchEntry,
                          id=self._menu_data[id].id)
            if "edit_series_special" in self._menu_data:
                self.Bind(wx.EVT_MENU,
                          self._onEditSeries,
                          id=self._menu_data["edit_series_special"].id)

            self.PopupMenu(mnu)
            mnu.Destroy()
Ejemplo n.º 4
0
    def _onMenuPopup(self, event):
        """
        Create popup menu to perform some options
        """
        self._se_lookup = dict()
        if self.GetFirstSelected() != wx.NOT_FOUND:
            se_dict = dict()
            menulst = list()
            addsep = False
            if viewmgr._series_sel._view_type == series_filter.VIEW_WHATS_NEW or \
               viewmgr._series_sel._view_type == series_filter.VIEW_WHATS_ON:
                menulst.append("s_todownload")
                addsep = True

            if viewmgr._series_sel._view_type == series_filter.VIEW_TO_DOWNLOAD:
                menulst.append("s_download")
                addsep = True

            if viewmgr._series_sel._view_type == series_filter.VIEW_DOWNLOADING:
                menulst.append("s_downloaded")
                addsep = True

            if viewmgr._series_sel._view_type == series_filter.VIEW_DOWNLOADED or \
                viewmgr._series_sel._view_type == series_filter.VIEW_WHATS_NEW:
                menulst.append("s_ready")
                addsep = True

            if addsep:
                menulst.append("-")

            se_items = list()
            idx = self.GetFirstSelected()
            if self.GetNextSelected(idx) == wx.NOT_FOUND:

                result = db.store.find(searches.Searches)
                lst = [s for s in result.order_by(searches.Searches.name)]
                if lst:
                    for se in lst:
                        se_dict[se.id] = (se.name, se.name, "", None, menuhelper.NORMAL, se)
                        se_items.append(se.id)

                menulst.append( ("&Online Search", se_items + ["-", "searches"]) )

                menulst.append("edit_episode")

                if viewmgr.appstate["series_id"] == -1:
                    se_dict["edit_series_special"] = ("&Edit This Series", "Edit This Series", "Edit This Series",
                                                      icon_edit.getBitmap(), menuhelper.NORMAL)
                    menulst.append("edit_series_special")

                if viewmgr._series_sel._view_type != series_filter.VIEW_QUEUES:
                    menulst.append("-")

            menulst.append(("Mark Episode(s) As ...", [ "s_todownload",
                                                        "s_download",
                                                        "s_downloaded",
                                                        "s_ready",
                                                        "s_seen" ] ))
            mnu = wx.Menu()
            self._menu_data = menuhelper.populate(mnu, menulst, se_dict)

            for id in se_items:
                self.Bind(wx.EVT_MENU, self._onSearchEntry, id = self._menu_data[id].id)
            if "edit_series_special" in self._menu_data:
                self.Bind(wx.EVT_MENU, self._onEditSeries, id = self._menu_data["edit_series_special"].id)

            self.PopupMenu(mnu)
            mnu.Destroy()