示例#1
0
	def treeview_cursor_changed(self, widget):
		#some 'return' appear here all because of the trigger of this method on 			window closing.

		if hasattr(self, 'unlock_button') and \
			self.win.get_focus() and \
			self.current_work != None and \
			self.unlock_button.get_active():

			question = QuestionDialog(self.win, Gtk.ButtonsType.YES_NO, QuestionDialog.UNSAVED_Q)

			result = question.display()
			if result == True:
				self.tool_save_clicked(self.tool_save)

		path, col = widget.get_cursor()
		if path == None:
			return 
		if path.get_depth() == 1:
			return 

		model = widget.get_model()

		for work in self.worklist:
			if work._title == model[path][0]:
				self.show_work(work)
				self.current_work = work
示例#2
0
	def tool_new_clicked(self, widget):
		now = datetime.datetime.now().timetuple()
		start = '-'.join([str(x) for x in now[0:5]])
		work = Work(title='Untitled', start_time=start, alarm_time='9999-12-31-23-59', work_content=' ')

		if self.unlock_button.get_active() == True:

			question = QuestionDialog(self.win, Gtk.ButtonsType.YES_NO, QuestionDialog.UNSAVED_Q)

			result = question.display()
			if result == True:
				self.tool_save_clicked(self.tool_save)

		w_id = self.parser.add(work)
		work.set_id(w_id)
		self.current_work = work
		self.show_work(self.current_work)
		self.enable_edit(True)