def on_jobCreate_clicked(self): name=self.ui.jobName.text() name=unicode(name).strip() if self.ui.jobTimeCheck.isChecked(): date=self.ui.jobTime.dateTime() date=date.toString("dd.MM.yyyy hh:mm") date=unicode(date) else: date="--" status=self.ui.jobStatus.currentText() status=unicode(status) content=[date,status,None] if name=="" or name in self.project.jobs: guihelpers.message(self.tr("Error"),self.tr("No task specified or already exists"),True) else: a = QtGui.QTreeWidgetItem(self.ui.jobslist) a.setText(0, name) a.setText(1, date) a.setText(2, status) a.setText(3, "--") a=guihelpers.jobStatusColor(a,status,self._statuses) self.project.jobs[name]=content self.project.Save("jobs") self.ui.jobName.clear() self.updateStats() self.updateJobsStats() self.logs.add(self.tr("Task '%s' created" %name))
def loadJobs(self,project): self.ui.jobslist.clear() for i in project.jobs: a = QtGui.QTreeWidgetItem(self.ui.jobslist) note=project.jobs[i][2] if note==None: note="--" a.setText(0, i) a.setText(1, project.jobs[i][0]) a.setText(2, project.jobs[i][1]) a.setText(3, note) status=project.jobs[i][1] a=guihelpers.jobStatusColor(a,status,self._statuses)
def loadTodays(self): self.ui.todaysJobsList.clear() for job in self.todays.jobs: project=job.project name=job.name try: status=self.collection.projects[project].jobs[name][1] notes=self.collection.projects[project].jobs[name][2] deadline=self.collection.projects[project].jobs[name][0] a = QtGui.QTreeWidgetItem(self.ui.todaysJobsList) a.setText(0,project) a.setText(1,name) a.setText(2,status) a.setText(3,deadline) a.setText(4,notes) a=guihelpers.jobStatusColor(a,status,self._statuses) except: deadline=None status=None
def on_jobEdit_clicked(self): item=self.ui.jobslist.currentItem() n=self.ui.jobslist.indexOfTopLevelItem(item) if item==None: guihelpers.message(self.tr("Error"),self.tr("No task selected"),True) else: item=self.ui.jobslist.takeTopLevelItem(n) status=self.ui.jobEditStatus.currentText() status=unicode(status) self.project.jobs[unicode(item.text(0))][1]=status item.setText(2,status) item=guihelpers.jobStatusColor(item,status,self._statuses) self.ui.jobslist.insertTopLevelItem(n,item) self.ui.jobslist.setCurrentItem(None) self.project.Save("jobs") self.updateJobsStats() self.loadTodays() self.logs.add(self.tr("Task '%s' edited" %item.text(0)))
def todaysJobEdit(self,status): item=self.ui.todaysJobsList.currentItem() n=self.ui.todaysJobsList.indexOfTopLevelItem(item) if item==None: guihelpers.message(self.tr("Error"),self.tr("No task selected"),True) else: item=self.ui.todaysJobsList.takeTopLevelItem(n) status=unicode(status) project=self.collection.projects[unicode(item.text(0))] project.jobs[unicode(item.text(1))][1]=status item.setText(2,status) item=guihelpers.jobStatusColor(item,status,self._statuses) self.ui.todaysJobsList.insertTopLevelItem(n,item) project.Save("jobs") try: self.updateJobsStats() self.loadJobs(self.project) except: pass self.loadTodays() self.logs.add(self.tr("Task '%s' edited" %item.text(0)))