Exemplo n.º 1
0
class winloginDataDialog(QtGui.QDialog):
    def __init__(self, loginData, parent=None):
        QtGui.QDialog.__init__(self, parent)
        self.ui = Ui_loginDataDialog()
        self.ui.setupUi(self)
        self.loginData = loginData
        for account in self.loginData:
            QtGui.QListWidgetItem(account, self.ui.loginDataList)
        QtCore.QObject.connect(self.ui.addButton, QtCore.SIGNAL("clicked()"),
                               self.showEntryDialog)
        QtCore.QObject.connect(self.ui.editButton, QtCore.SIGNAL("clicked()"),
                               self.showEditEntryDialog)
        QtCore.QObject.connect(self.ui.loginDataList,
                               QtCore.SIGNAL("doubleClicked(QModelIndex)"),
                               self.showEditEntryDialog)
        QtCore.QObject.connect(self.ui.deleteButton,
                               QtCore.SIGNAL("clicked()"), self.deleteAccount)
        QtCore.QObject.connect(self.ui.okButton, QtCore.SIGNAL("clicked()"),
                               self.close)

    def deleteAccount(self):
        currentAccount = str(self.ui.loginDataList.currentItem().text())
        if currentAccount != '':
            del (self.loginData[currentAccount])
        self.ui.loginDataList.clear()
        for account in self.loginData:
            QtGui.QListWidgetItem(account, self.ui.loginDataList)

    def showEntryDialog(self):
        self.loginValues = [[]]
        self.loginEntryDialogInstance = winloginEntryDialog(self.loginValues)
        self.loginEntryDialogInstance.exec_()
        if self.loginValues != [[]]:
            self.loginData[self.loginValues[0][0]] = self.loginValues[0][1]
        del (self.loginEntryDialogInstance)
        self.ui.loginDataList.clear()
        for account in self.loginData:
            QtGui.QListWidgetItem(account, self.ui.loginDataList)

    def showEditEntryDialog(self):
        currentAccount = str(self.ui.loginDataList.currentItem().text())
        if currentAccount != '':
            self.loginValues = [[
                currentAccount, self.loginData[currentAccount]
            ]]
            self.loginEntryDialogInstance = winloginEntryDialog(
                self.loginValues)
            self.loginEntryDialogInstance.exec_()

            ##Edit info only if dialog box wasn't cancelled
            if self.loginValues != [[]]:
                del (self.loginData[currentAccount])
                self.loginData[self.loginValues[0][0]] = self.loginValues[0][1]

            del (self.loginEntryDialogInstance)
            self.ui.loginDataList.clear()
            for account in self.loginData:
                QtGui.QListWidgetItem(account, self.ui.loginDataList)
Exemplo n.º 2
0
class winloginDataDialog(QtGui.QDialog):
	def __init__(self,loginData,parent=None):
		QtGui.QDialog.__init__(self,parent)
		self.ui=Ui_loginDataDialog()
		self.ui.setupUi(self)
		self.loginData=loginData
		for account in self.loginData:
			QtGui.QListWidgetItem(account,self.ui.loginDataList)
		QtCore.QObject.connect(self.ui.addButton,QtCore.SIGNAL("clicked()"),self.showEntryDialog)
		QtCore.QObject.connect(self.ui.editButton,QtCore.SIGNAL("clicked()"),self.showEditEntryDialog)
		QtCore.QObject.connect(self.ui.loginDataList,QtCore.SIGNAL("doubleClicked(QModelIndex)"),self.showEditEntryDialog)
		QtCore.QObject.connect(self.ui.deleteButton,QtCore.SIGNAL("clicked()"),self.deleteAccount)
		QtCore.QObject.connect(self.ui.okButton,QtCore.SIGNAL("clicked()"),self.close)
		
	def deleteAccount(self):
		currentAccount=str(self.ui.loginDataList.currentItem().text())
		if currentAccount!='':
			del(self.loginData[currentAccount])
		self.ui.loginDataList.clear()
		for account in self.loginData:
			QtGui.QListWidgetItem(account,self.ui.loginDataList)
	
	def showEntryDialog(self):
		self.loginValues=[[]]
		self.loginEntryDialogInstance=winloginEntryDialog(self.loginValues)
		self.loginEntryDialogInstance.exec_()
		if self.loginValues!=[[]]:
			self.loginData[self.loginValues[0][0]]=self.loginValues[0][1]
		del(self.loginEntryDialogInstance)
		self.ui.loginDataList.clear()
		for account in self.loginData:
			QtGui.QListWidgetItem(account,self.ui.loginDataList)

	def showEditEntryDialog(self):
		currentAccount=str(self.ui.loginDataList.currentItem().text())
		if currentAccount!='':
			self.loginValues=[[currentAccount,self.loginData[currentAccount]]]
			self.loginEntryDialogInstance=winloginEntryDialog(self.loginValues)
			self.loginEntryDialogInstance.exec_()
		
			##Edit info only if dialog box wasn't cancelled
			if self.loginValues!=[[]]:
				del(self.loginData[currentAccount])
				self.loginData[self.loginValues[0][0]]=self.loginValues[0][1]
		
			del(self.loginEntryDialogInstance)
			self.ui.loginDataList.clear()
			for account in self.loginData:
				QtGui.QListWidgetItem(account,self.ui.loginDataList)
Exemplo n.º 3
0
 def __init__(self, loginData, parent=None):
     QtGui.QDialog.__init__(self, parent)
     self.ui = Ui_loginDataDialog()
     self.ui.setupUi(self)
     self.loginData = loginData
     for account in self.loginData:
         QtGui.QListWidgetItem(account, self.ui.loginDataList)
     QtCore.QObject.connect(self.ui.addButton, QtCore.SIGNAL("clicked()"),
                            self.showEntryDialog)
     QtCore.QObject.connect(self.ui.editButton, QtCore.SIGNAL("clicked()"),
                            self.showEditEntryDialog)
     QtCore.QObject.connect(self.ui.loginDataList,
                            QtCore.SIGNAL("doubleClicked(QModelIndex)"),
                            self.showEditEntryDialog)
     QtCore.QObject.connect(self.ui.deleteButton,
                            QtCore.SIGNAL("clicked()"), self.deleteAccount)
     QtCore.QObject.connect(self.ui.okButton, QtCore.SIGNAL("clicked()"),
                            self.close)
Exemplo n.º 4
0
	def __init__(self,loginData,parent=None):
		QtGui.QDialog.__init__(self,parent)
		self.ui=Ui_loginDataDialog()
		self.ui.setupUi(self)
		self.loginData=loginData
		for account in self.loginData:
			QtGui.QListWidgetItem(account,self.ui.loginDataList)
		QtCore.QObject.connect(self.ui.addButton,QtCore.SIGNAL("clicked()"),self.showEntryDialog)
		QtCore.QObject.connect(self.ui.editButton,QtCore.SIGNAL("clicked()"),self.showEditEntryDialog)
		QtCore.QObject.connect(self.ui.loginDataList,QtCore.SIGNAL("doubleClicked(QModelIndex)"),self.showEditEntryDialog)
		QtCore.QObject.connect(self.ui.deleteButton,QtCore.SIGNAL("clicked()"),self.deleteAccount)
		QtCore.QObject.connect(self.ui.okButton,QtCore.SIGNAL("clicked()"),self.close)