示例#1
0
 def OnChangePass(self, evt):
     #create a new rev of password or add a pass if meta or username changes
     sel_item = self.GetSelection()
     if not sel_item.IsOk():
         wx.MessageBox(_("Select a line first!"), _("Error"),
                       0 | wx.ICON_ERROR, self)
         return
     i = self.GetItemData(sel_item)
     dlg = addDiag.AddPassDiag(self, self.passlist[i]['Meta'],
                               self.passlist[i]['Uname'],
                               self.passlist[i]['Pass'],
                               self.passlist[i]['Remark'],
                               self.passlist[i]['Kgroup'])
     if dlg.ShowModal() == wx.ID_OK:
         try:
             self.apc.add(dlg.meta, dlg.uname, dlg.upass, dlg.remark,
                          dlg.kgroup)
         except Exception as Err:
             wx.MessageBox(
                 _("Unable to save credential!\n") + unicode(Err),
                 _("Error"), 0 | wx.ICON_ERROR, self)
             return
         try:
             r = self.apc.get(dlg.meta, dlg.uname)
         except:
             wx.MessageBox(
                 _("Getting latest record failed!\n") + unicode(Err),
                 _("Error"), 0 | wx.ICON_ERROR, self)
             return
         r["PYS"] = self.cnsort.strToPYS(r["Meta"].lower())
         if not dlg.new_entry:
             del self.passlist[i]
         self.passlist.insert(i, r)
         self.reloadWithoutGet()
示例#2
0
 def OnShowCred(self,evt):
     sel_item=self.GetSelection()
     if not sel_item.IsOk():
         wx.MessageBox(_("Select a line first!"),_("Error"),0|wx.ICON_ERROR,self)
         return
     i=self.GetItemData(sel_item)
     dlg=addDiag.AddPassDiag(self,self.passlist[i]['Meta'],self.passlist[i]['Uname'],self.passlist[i]['Pass'],self.passlist[i]['Remark'],self.passlist[i]['Kgroup'],readonly=True)
     dlg.ShowModal()
     dlg.Destroy()
示例#3
0
 def OnShow(self, evt):
     i = self.choice_upass.GetSelection()
     dlg = addDiag.AddPassDiag(self,
                               self.plist[i]['Meta'],
                               self.plist[i]['Uname'],
                               self.plist[i]['Pass'],
                               self.plist[i]['Remark'],
                               self.plist[i]['Kgroup'],
                               readonly=True)
     dlg.ShowModal()
     dlg.Destroy()
示例#4
0
 def OnAdd(self,evt):
     dlg=addDiag.AddPassDiag(self)
     if dlg.ShowModal()==wx.ID_OK:
         #self.apc.add(dlg.meta,dlg.uname,dlg.upass)
         try:
             self.apc.add(dlg.meta,dlg.uname,dlg.upass,dlg.remark,dlg.kgroup)
         except Exception as Err:
             wx.MessageBox(_("Unable to save credential!\n")+unicode(Err),_("Error"),0|wx.ICON_ERROR,self)
             return
         try:
             r=self.apc.get(dlg.meta,dlg.uname)
             r["PYS"]=self.cnsort.strToPYS(r["Meta"].lower())
             self.passlist.insert(0,r)
             self.reloadWithoutGet()
         except:
             wx.MessageBox(_("Getting latest record failed!\n")+unicode(Err),_("Error"),0|wx.ICON_ERROR,self)
             return