Exemple #1
0
	def accountChanged(self, accountData):
		""" Account selection has changed

			Get settings for the account and create new model to decode the data
		"""
		self.beginResetModel()
		with utils.showWaitCursor():
			if accountData is None:
				self._root.reset()
				self._headers = range(self._root.maxColumns())
			else:
				dateField, descriptionField, creditField, debitField, currencySign, dateFormat = accountData
				self._root.formatItem(dateField, descriptionField, creditField, debitField, currencySign, dateFormat)
				self._headers = ['Status', 'Date', 'Credit', 'Debit', 'Description']

		self._numColumns = self._root.maxColumns()

		self.endResetModel()
Exemple #2
0
    def accountChanged(self, accountData):
        """ Account selection has changed

			Get settings for the account and create new model to decode the data
		"""
        self.beginResetModel()
        with utils.showWaitCursor():
            if accountData is None:
                self._root.reset()
                self._headers = range(self._root.maxColumns())
            else:
                dateField, descriptionField, creditField, debitField, currencySign, dateFormat = accountData
                self._root.formatItem(dateField, descriptionField, creditField,
                                      debitField, currencySign, dateFormat)
                self._headers = [
                    'Status', 'Date', 'Credit', 'Debit', 'Description'
                ]

        self._numColumns = self._root.maxColumns()

        self.endResetModel()
Exemple #3
0
	def activateConnection(self):
		db.database = self.databaseEdit.text()
		db.hostname = self.hostnameEdit.text()
		db.username = self.usernameEdit.text()
		db.password = self.passwordEdit.text()
		db.port = self.portSpinBox.value()

		try:
			with utils.showWaitCursor():
				db.connect()
		except DatabaseNotInitialisedException:
			if QtGui.QMessageBox.question(
					self, 'Database',
					'Database %s is empty, do you want to initialise it?' % db.database,
					QtGui.QMessageBox.Yes|QtGui.QMessageBox.No) == QtGui.QMessageBox.Yes:
				try:
					db.initialise()
				except ConnectionException, err:
					QtGui.QMessageBox.critical(self, 'Database ', str(err))
				else:
					QtGui.QMessageBox.information(self, 'Database', 'Database initialised successfully')
			else:
				return