def refreshMainTreeView(self): self.mainList.clear() db=dbCtrl() db.dbInitMainTable() pwdList=db.dbGetMainTableName() for item in pwdList: self.mainList.append(item)
def on_mainDelPwd_clicked(self,*args): if(self.selectedRow==-1): return iter=self.mainList.get_iter(self.selectedRow) value=self.mainList.get_value(iter,0) db=dbCtrl() #print(value) db.dbDelPwd(value) self.refreshMainTreeView() self.selectedRow=-1
def on_mainGetPwd_clicked(self,*args): iter=self.mainList.get_iter(self.selectedRow) value=self.mainList.get_value(iter,0) db=dbCtrl() pwd=db.dbGetPwd(value) infoMsgBox=gtk.MessageDialog(None,gtk.DIALOG_MODAL, gtk.MESSAGE_INFO,gtk.BUTTONS_OK, u'您的密码') infoMsgBox.format_secondary_text(pwd) infoMsgBox.run() infoMsgBox.destroy()
def on_inputOK_clicked(self,*args): str_name=self.gladeMain.get_object('inputEntryName').get_text() str_pwd=self.gladeMain.get_object('inputEntryPwd').get_text() if(str_name==''): errorMsgBox=gtk.MessageDialog(None,gtk.DIALOG_MODAL, gtk.MESSAGE_ERROR,gtk.BUTTONS_OK, u'错误') errorMsgBox.format_secondary_text(u'条目不能为空') errorMsgBox.run() errorMsgBox.destroy() return None db=dbCtrl() if(self.newEntry==True): db.dbInsertIntoMainTable(str_name,str_pwd) else: db.dpUpdatePwd(str_name,str_pwd) gtk.Widget.destroy(self.mainWindow)
def __init__(self,str_name=None): self.gladeFile=sys.path[0]+"/src_Wnd.glade" self.gladeMain = gtk.Builder() self.gladeMain.add_from_file(self.gladeFile) self.gladeMain.connect_signals(self) self.mainWindow = self.gladeMain.get_object("inputWnd") self.mainWindow.set_position(gtk.WIN_POS_CENTER_ALWAYS) self.mainWindow.set_default_size(400,300) self.mainWindow.show() self.entryName=str_name self.entryPwd=None self.newEntry=True if(str_name!=None): self.newEntry=False self.gladeMain.get_object('inputEntryName').set_editable(False) db=dbCtrl() self.entryPwd=db.dbGetPwd(str_name) if(self.entryPwd==None): print("GetPwd returns a None") self.refresh(self.entryName,self.entryPwd) self.regenPwd()
# -*- encoding: utf-8 -*- import sys import os import pygtk import gtk import globeCtrl from db import dbCtrl from regWnd import regWnd from loginWnd import loginWnd from mainWnd import mainWnd pygtk.require('2.0') if(__name__ == "__main__"): db=dbCtrl() md5Pwd=db.dbGetSuperPwd() if(md5Pwd==None): newRegWnd=regWnd() newRegWnd.main() if(globeCtrl.gCtrl.quit==True): exit(0) #如果没有用户的密码,则要求注册 #然后登录 newloginWnd=loginWnd() newloginWnd.main() if(globeCtrl.gCtrl.quit==True or globeCtrl.gCtrl.loginSuccess==False):