コード例 #1
0
ファイル: launchers.py プロジェクト: RogueScholar/debreate
    def SetCategory(self, event=None):
        try:
            ID = event.GetKeyCode()

        except AttributeError:
            ID = event.GetEventObject().GetId()

        cat = GetField(self, inputid.CAT).GetValue()
        cat = cat.split()
        cat = u''.join(cat)

        lst_categories = GetField(self, listid.CAT)

        if ID in (wx.ID_ADD, wx.WXK_RETURN, wx.WXK_NUMPAD_ENTER):
            lst_categories.InsertStringItem(lst_categories.GetItemCount(), cat)

        elif ID in (wx.ID_REMOVE, wx.WXK_DELETE):
            if lst_categories.GetItemCount(
            ) and lst_categories.GetSelectedItemCount():
                cur_cat = lst_categories.GetFirstSelected()
                lst_categories.DeleteItem(cur_cat)

        elif ID == wx.ID_CLEAR:
            if lst_categories.GetItemCount():
                if ConfirmationDialog(
                        GetMainWindow(), GT(u'Confirm'),
                        GT(u'Clear categories?')).ShowModal() in (wx.ID_OK,
                                                                  wx.OK):
                    lst_categories.DeleteAllItems()

        if event:
            event.Skip()
コード例 #2
0
ファイル: launchers.py プロジェクト: RogueScholar/debreate
    def OnClearCategories(self, event=None):
        cats = GetField(self, listid.CAT)

        if cats.GetItemCount():
            clear = ConfirmationDialog(GetMainWindow(), GT(u'Confirm'),
                                       GT(u'Clear categories?'))

            if clear.Confirmed():
                cats.DeleteAllItems()