Ejemplo n.º 1
0
	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))
Ejemplo n.º 2
0
	def OpenPopupNote(self,note,project):
		if note!="--":
			try:
				note=project.notes[note]
				guihelpers.message(self.tr("Assigned Note"),note,True)
			except:
				guihelpers.message(self.tr("Error"),self.tr("Something goes wrong. You've apparently deleted that note"),True)
Ejemplo n.º 3
0
	def on_docOpen_clicked(self):
		item=self.ui.docslist.currentItem()
		if item==None:
			guihelpers.message(self.tr("Error"),self.tr("No document selected"),True)
		else:
			text=self.project.documents[unicode(item.text())]
			subprocess.Popen(["xdg-open",text])
			self.logs.add(self.tr("Document '%s' opened" %text))
Ejemplo n.º 4
0
	def on_projectCreate_clicked(self):
		name=unicode(self.ui.newProject.text())
		name=name.strip()
		if name=="" or name in self.collection.projects:
			guihelpers.message(self.tr("Error"),self.tr("No name specified or project already exists"),True)
		else:
			self.collection.create_project(name)
			self.ui.projectslist.addItem(name)
			self.ui.newProject.clear()
			self.logs.add(self.tr("Project '%s' created" %name))
Ejemplo n.º 5
0
	def on_docDelete_clicked(self):
		item=self.ui.docslist.currentItem()
		n=self.ui.docslist.currentRow()

		if item==None:
			guihelpers.message(self.tr("Error"),self.tr("No document selected"),True)
		else:
			ret=guihelpers.message(self.tr("Warning"),self.tr("This application only removes \"")+item.text()+self.tr("\" from list. Proceed?"))
			if ret==0:			
				self.ui.docslist.takeItem(n)
				del self.project.documents[unicode(item.text())]
				self.project.Save("documents")
				self.ui.doctext.clear()
				self.updateStats()
				self.logs.add(self.tr("Document '%s' deleted" %item.text()))
Ejemplo n.º 6
0
	def on_jobAddToTodays_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:
			name=unicode(item.text(0))
			if self.todays.check_job(name,self.project.name):
				guihelpers.message(self.tr("Error"),self.tr("Task already on the list"),True)
			else:
				p=todays.TodaysJob([self.project.name,name])
				self.todays.jobs.append(p)
				self.todays.save_jobs()
				self.loadTodays()
				self.logs.add(self.tr("Task '%s' added to Todays list" %item.text(0)))
Ejemplo n.º 7
0
	def on_todaysDelete_clicked(self):
		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:
			project=unicode(item.text(0))
			name=unicode(item.text(1))

			for job in self.todays.jobs:
				if job.name==name and job.project==project:
					self.todays.jobs.pop(self.todays.jobs.index(job))
			self.todays.save_jobs()
			self.loadTodays()
			self.logs.add(self.tr("Task '%s' deleted from todays list" %item.text(0)))
Ejemplo n.º 8
0
	def on_linkDelete_clicked(self):
		item=self.ui.linkslist.currentItem()
		n=self.ui.linkslist.indexOfTopLevelItem(item)

		if item==None:
			guihelpers.message(self.tr("Error"),self.tr("No link selected"),True)
		else:
			ret=guihelpers.message(self.tr("Warning"),self.tr("Do you really want to delete link \"")+item.text(0)+"\" ?")
			if ret==0:	
				del self.project.links[unicode(item.text(0))]
				self.ui.linkslist.takeTopLevelItem(n)

				self.project.Save("links")
				self.logs.add(self.tr("Link deleted"))

		self.updateStats()
Ejemplo n.º 9
0
	def create_project(self,name):
		workpath=os.environ['HOME']+"/.lbpm/"
		path=workpath+self.collection+"/"+name
		if os.path.isdir(path):
			import guihelpers
			guihelpers.message("Warning","Project directory already exists - using it.",True)
		else:
			os.makedirs(path)
			
		pr=Project(name)
		pr.notes=self.getList("notes",name)
		pr.documents=self.getList("documents",name)
		pr.jobs=self.getList("jobs",name)
		pr.links=self.getList("links",name)
		self.projects[name]=pr
		self.save_project_list()
Ejemplo n.º 10
0
	def on_jobDelete_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:
			ret=guihelpers.message(self.tr("Warning"),self.tr("Do you really want to delete task \"")+item.text(0)+"\" ?")
			if ret==0:	
				del self.project.jobs[unicode(item.text(0))]
				self.ui.jobslist.takeTopLevelItem(n)

				self.project.Save("jobs")
				self.updateStats()
				self.updateJobsStats()
				self.logs.add(self.tr("Task '%s' deleted" %item.text(0)))
Ejemplo n.º 11
0
	def on_noteDelete_clicked(self):
		item=self.ui.noteslist.currentItem()
		n=self.ui.noteslist.currentRow()
		
		if item==None:
			guihelpers.message(self.tr("Error"),self.tr("No note selected"),True)
		else:
			ret=guihelpers.message(self.tr("Warning"),self.tr("Do you really want to delete note \"")+item.text()+"\" ?")
			if ret==0:
				self.ui.noteslist.takeItem(n)
				del self.project.notes[unicode(item.text())]
				self.project.Save("notes")
				self.ui.notetext.clear()
				self.ui.notetext.setDisabled(True)
				self.updateStats()
				self.jobNotesUpdate()
				self.logs.add(self.tr("Note '%s' deleted" %item.text()))
Ejemplo n.º 12
0
	def on_projectDelete_clicked(self):
		item=self.ui.projectslist.currentItem()
		n=self.ui.projectslist.currentRow()

		if item==None:
			guihelpers.message(self.tr("Error"),self.tr("No project selected"),True)
		else:
			ret=guihelpers.message(self.tr("Warning"),self.tr("Do you really want to delete project \"")+item.text()+"\" ?")
			if ret==0:
				try:
					project=self.project
				except:
					project=None
				if self.collection.projects[unicode(item.text())]==project:
					self.clearall()
					self.ui.tabs.setDisabled(True)
					
				self.ui.projectslist.takeItem(n)
				self.collection.delete_project(unicode(item.text()))
				self.logs.add(self.tr("Project '%s' deleted" %item.text()))
Ejemplo n.º 13
0
	def on_jobAssignNote_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:
			note=unicode(self.ui.jobNotes.currentText())
			if note==self.tr("None"): note="--"
			item=self.ui.jobslist.takeTopLevelItem(n)
			
			self.project.jobs[unicode(item.text(0))][2]=note
			item.setText(3,note)
			
			self.ui.jobslist.insertTopLevelItem(n,item)
			self.ui.jobslist.setCurrentItem(item)

			self.project.Save("jobs")
			self.loadTodays()
			self.logs.add(self.tr("Note '%s' assigned to task '%s'" %(note,item.text(0))))
Ejemplo n.º 14
0
	def on_linkCreate_clicked(self):
		name=self.ui.linkUrl.text()
		name=unicode(name).strip()
		desc=self.ui.linkDesc.text()
		desc=unicode(desc).strip()
		if not name.startswith("http://"): name="http://"+name

		if name=="http://" or name in self.project.links:
			guihelpers.message(self.tr("Error"),self.tr("No link specified or already exists"),True)
	
		else:
			a = QtGui.QTreeWidgetItem(self.ui.linkslist)
			a.setText(0, name)
			a.setText(1, desc)
			self.project.links[name]=desc
			self.project.Save("links")
			self.ui.linkUrl.clear()
			self.ui.linkDesc.clear()
			self.updateStats()
			self.logs.add(self.tr("Link created"))
Ejemplo n.º 15
0
	def on_noteslist_itemActivated(self,e):
		if self.ui.noteSave.isEnabled():
			ret=guihelpers.message(self.tr("Warning"),self.tr("All changes made in previous note will be lost. Proceed?"))
			if ret!=0: return 0
		note=unicode(e.text())
		text=self.project.notes[note]
		self.ui.notetext.clear()
		self.ui.notetext.append(text.replace("<br/>","\n"))
		self.note=note
		self.ui.notetext.setDisabled(False)
		self.ui.noteSave.setEnabled(False)
		self.logs.add(self.tr("Note '%s' opened" %e.text()))
Ejemplo n.º 16
0
	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)))
Ejemplo n.º 17
0
	def on_noteCreate_clicked(self):
		name=self.ui.newnote.text()
		name=unicode(name).strip()
		if name=="" or name in self.project.notes:
			guihelpers.message(self.tr("Error"),self.tr("No name specified or already exists"),True)
	
		else:
			if self.ui.noteSave.isEnabled():
				ret=guihelpers.message(self.tr("Warning"),self.tr("All changes made in previous note will be lost. Proceed?"))
				if ret!=0: return 0
			self.ui.noteslist.addItem(name)
			self.project.notes[name]=""
			self.project.Save("notes")
			self.ui.newnote.clear()
			i=self.ui.noteslist.count()
			self.ui.noteslist.setCurrentRow(i-1)
			self.ui.notetext.clear()
			self.note=name
			self.ui.notetext.setDisabled(False)
			self.logs.add(self.tr("Note '%s' created" %name))

		self.updateStats()
		self.jobNotesUpdate()
Ejemplo n.º 18
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)))