Ejemplo n.º 1
0
class EditTaskUI(QtGui.QDialog):
    """
	Main Edit Task window.
	"""

    def __init__(self):
        # Setup the PyQt window
        QtGui.QMainWindow.__init__(self)
        self.ui = Ui_Dialog()
        self.ui.setupUi(self)

    def GetTaskInfo(self, taskid, modcode, taskinfo, duedate, status):
        # Passing data from the QTreeWidget into the edit task fields
        global taskid1
        taskid1 = taskid

        self.ui.moduleCode.setText(modcode)
        self.ui.taskDetails.setText(taskinfo)
        duedateconvert = QtCore.QDate.fromString(duedate, "dd/MM/yyyy")
        self.ui.taskDueDate.setDate(duedateconvert)
        if status == "True":
            self.ui.taskStatus.setChecked(1)
        else:
            self.ui.taskStatus.setChecked(0)

    def on_addTaskButton_released(self):
        tdetails = self.ui.taskDetails.text()
        tduedate = self.ui.taskDueDate.date().toString("dd/MM/yyyy")
        tmodulecode = self.ui.moduleCode.text()
        tstatus = self.ui.taskStatus.isChecked()
        _connection = dbconn
        if len(tdetails) < 2:
            BadTask.callPopup()
        elif len(tmodulecode) < 2:
            BadTask.callPopup()
        else:
            EditTask(taskid1, tmodulecode, tdetails, tduedate, tstatus)
            self.close()
Ejemplo n.º 2
0
class AddTaskUI(QtGui.QDialog):
	"""
	Main Add Task window.
	"""
	def __init__(self):
		# Setup the PyQt window
		QtGui.QMainWindow.__init__(self)
		self.ui=Ui_Dialog()
		self.ui.setupUi(self)

	def on_addTaskButton_released(self):
		tdetails = self.ui.taskDetails.text()
		tduedate = self.ui.taskDueDate.date().toString("dd/MM/yyyy")
		tmodulecode = self.ui.moduleCode.text()
		tstatus = self.ui.taskStatus.isChecked()
		_connection = dbconn
		if len(tdetails) < 2:
			callPopup()
		elif len(tmodulecode) < 2:
			callPopup()
		else:
			AddTask(str(tmodulecode), str(tdetails), str(tduedate), str(tstatus))
			self.close()