示例#1
0
	def deleteTransaction(self):
		# Get transaction id
		row = self.table.selectedRow()
		if row == -1:
			return
		id = self.model.transactionIds[row]
		
		found = False
		for t in appGlobal.getApp().portfolio.getTransactions(getDeleted = True):
			if t.uniqueId == id:
				found = True
				break
		if not found:
			return

		# Ask for confirmation, then delete
		if t.deleted:
			res = QMessageBox(QMessageBox.Critical, "Undelete Transaction", "Are you sure you wish to undelete this transaction?", QMessageBox.Cancel | QMessageBox.Ok).exec_()
		else:
			res = QMessageBox(QMessageBox.Critical, "Delete Transaction", "Are you sure you wish to delete this transaction?", QMessageBox.Cancel | QMessageBox.Ok).exec_()
		if res == QMessageBox.Ok:
			if t.deleted:
				t.setDeleted(False)
			else:
				t.setDeleted()
			t.save(appGlobal.getApp().portfolio.db)
			appGlobal.getApp().portfolio.portPrefs.setDirty(True)
			appGlobal.getApp().portfolio.readFromDb()
			self.model.setTransactions()
			autoUpdater.wakeUp()
示例#2
0
    def checkStatus(self):
        app = appGlobal.getApp()

        # Return 10 by default
        ret = 10

        if appGlobal.getFailConnected():
            self.running = False
            return ret

        # Sleep twice to make sure everything was updated
        # 94 = slept once
        # 95 = slept twice
        if autoUpdater.sleeping():
            if self.sleptOnce:
                return 95
            else:
                self.sleptOnce = True
                autoUpdater.wakeUp()
                return 94

        ret = 10 + 84 * autoUpdater.percentDone() / 100
        return ret
	def checkStatus(self):
		app = appGlobal.getApp()

		# Return 10 by default
		ret = 10

		if appGlobal.getFailConnected():
			self.running = False
			return ret

		# Sleep twice to make sure everything was updated
		# 94 = slept once
		# 95 = slept twice
		if autoUpdater.sleeping():
			if self.sleptOnce:
				return 95
			else:
				self.sleptOnce = True
				autoUpdater.wakeUp()
				return 94
		
		ret = 10 + 84 * autoUpdater.percentDone() / 100
		return ret
    def deleteTransaction(self):
        # Get transaction id
        row = self.table.selectedRow()
        if row == -1:
            return
        id = self.model.transactionIds[row]

        found = False
        for t in appGlobal.getApp().portfolio.getTransactions(getDeleted=True):
            if t.uniqueId == id:
                found = True
                break
        if not found:
            return

        # Ask for confirmation, then delete
        if t.deleted:
            res = QMessageBox(
                QMessageBox.Critical, "Undelete Transaction",
                "Are you sure you wish to undelete this transaction?",
                QMessageBox.Cancel | QMessageBox.Ok).exec_()
        else:
            res = QMessageBox(
                QMessageBox.Critical, "Delete Transaction",
                "Are you sure you wish to delete this transaction?",
                QMessageBox.Cancel | QMessageBox.Ok).exec_()
        if res == QMessageBox.Ok:
            if t.deleted:
                t.setDeleted(False)
            else:
                t.setDeleted()
            t.save(appGlobal.getApp().portfolio.db)
            appGlobal.getApp().portfolio.portPrefs.setDirty(True)
            appGlobal.getApp().portfolio.readFromDb()
            self.model.setTransactions()
            autoUpdater.wakeUp()