def on_treeview_button_press_event(self,widget,event):
		#
		# if event.button==1 and event.type==Gdk.BUTTON_PRESS:
		#
		# Gdk.EventType.2BUTTON_PRESS is not working in python because
		# it starts with number so use Gdk.EventType(value = 5) to construct
		# 2BUTTON_PRESS event type
		if event.button == 1 and event.type == Gdk.EventType(value=5):		
				model,iter = self.treeview.get_selection().get_selected()
				id = model.get_value(iter,0)
				snd = TaskDialog(id)
				snd.run()
				snd.destroy()
	def on_treeview_button_press_event(self,widget,event):
		#
		# if event.button==1 and event.type==Gdk.BUTTON_PRESS:
		#
		# Gdk.EventType.2BUTTON_PRESS is not working in python because
		# it starts with number so use Gdk.EventType(value = 5) to construct
		# 2BUTTON_PRESS event type
		if event.button == 1 and event.type == Gdk.EventType(value=5):		
				model,iter = self.treeview.get_selection().get_selected()
				id = model.get_value(iter,0)
				snd = TaskDialog(id)
				snd.run()
				snd.destroy()
	def menu_add_new_task(self,widget):
		widget.set_sensitive(False)
		annd = TaskDialog(tasks=self.tasks)
		if annd.run() == Gtk.ResponseType.ACCEPT:
			tasklist = self.tasks.tasklists[annd.get_tasklist_id()]
			atask = self.tasks.create_task(tasklist,annd.get_title())
			atask['notes'] = annd.get_notes()
			atask.set_completed(annd.is_completed())
			due = annd.get_due_date()
			if due is not None:
				atask.set_due(due)						
			self.menu_update()
		annd.destroy()		
		widget.set_sensitive(True)
예제 #4
0
 def menu_add_new_task(self, widget):
     widget.set_sensitive(False)
     annd = TaskDialog(tasks=self.tasks)
     if annd.run() == Gtk.ResponseType.ACCEPT:
         tasklist = self.tasks.tasklists[annd.get_tasklist_id()]
         atask = self.tasks.create_task(tasklist, annd.get_title())
         atask['notes'] = annd.get_notes()
         atask.set_completed(annd.is_completed())
         due = annd.get_due_date()
         if due is not None:
             atask.set_due(due)
         self.menu_update()
     annd.destroy()
     widget.set_sensitive(True)
	def on_button_edit_clicked(self,widget):
		selection = self.treeview.get_selection()
		if selection:
			model,iter = selection.get_selected()
			path = model.get_path(iter)
			atask = model.get_value(iter,0)
			p = TaskDialog(task = atask,tasks = self.tasks)
			if p.run() == Gtk.ResponseType.ACCEPT:
				p.hide()
				atask['title'] = p.get_title()
				atask['notes'] = p.get_notes()
				atask.set_completed(p.is_completed())
				due = p.get_due_date()
				if due is not None:
					atask.set_due(due)
				self.store.clear()
				self.read_notes()
				selection.select_path(path)
			p.destroy()
	def on_button_edit_clicked(self,widget):
		selection = self.treeview.get_selection()
		if selection:
			model,iter = selection.get_selected()
			path = model.get_path(iter)
			atask = model.get_value(iter,0)
			p = TaskDialog(task = atask,tasks = self.tasks)
			if p.run() == Gtk.ResponseType.ACCEPT:
				p.hide()
				atask['title'] = p.get_title()
				atask['notes'] = p.get_notes()
				atask.set_completed(p.is_completed())
				due = p.get_due_date()
				if due is not None:
					atask.set_due(due)
				self.store.clear()
				self.read_notes()
				selection.select_path(path)
			p.destroy()