Ejemplo n.º 1
0
	def dataStoreAll(self):
		data = []
		Cal.getData(self.main.pcal,self.main.calIndex,data)
	
		#Store all organizers
		for organizer in data[0]:
			
			#Check if organizer is already in table
			if (not self.main.inTable(organizer[0])):
				self.main.addOrganizer(organizer)
		
		#Store all event information
		for event in data[1]:

			if (self.main.eventInTable(event[0],event[1])):
				continue
			
			#Get org_id
			self.main.cursor.execute("SELECT org_id FROM ORGANIZER WHERE name=%s",(event[3],))
			id = self.main.cursor.fetchone()
			
			#Clear cursor
			for i in self.main.cursor:
				j = i
			
			self.main.addEvent(event,id[0])
			
		#Store all events
		for todo in data[2]:
			
			if (self.main.todoInTable(todo[0])):
				continue
			
			#Get org_id
			self.main.cursor.execute("SELECT org_id FROM ORGANIZER WHERE name=%s",(todo[2],))	
			id = self.main.cursor.fetchone()
			
			#Clear cursor
			for i in self.main.cursor:
				j = i
			
			self.main.addTodo(todo,id[0])
			
		#Enable clear if not empty
		if (not self.main.isEmptyTable()):
			self.main.menuBar.enableClear()
			
		self.main.logWindow.printMessage(self.main.getStatus())
Ejemplo n.º 2
0
	def dataStoreSelected(self):
		
		dict = self.main.compWindow.compTree.item(self.main.compWindow.selectItem)
		index = (dict['text'])
		tuple = (index,)
		list = [tuple]
		
		data = []
		Cal.getData(self.main.pcal,list,data)
		
		#Store all organizers
		if (len(data[0]) > 0):
			for organizer in data[0]:
				
				#Check if organizer is already in table
				if (not self.main.inTable(organizer[0])):
					self.main.addOrganizer(organizer)
		
		#Store all event information
		for event in data[1]:
			
			if (event is None):
				continue
			
			if (self.main.eventInTable(event[0],event[1])):
				continue
			
			#Get org_id
			self.main.cursor.execute("SELECT org_id FROM ORGANIZER WHERE name=%s",(event[3],))
			id = self.main.cursor.fetchone()
			
			if (id is None):
				continue
			
			#Clear cursor
			for i in self.main.cursor:
				j = i
			
			self.main.addEvent(event,id[0])
			
		#Store all events
		for todo in data[2]:
			if (todo is None):
				continue
			
			if (self.main.todoInTable(todo[0])):
				continue
			
			#Get org_id
			self.main.cursor.execute("SELECT org_id FROM ORGANIZER WHERE name=%s",(todo[2],))	
			id = self.main.cursor.fetchone()
			
			#Clear cursor
			for i in self.main.cursor:
				j = i
		
			self.main.addTodo(todo,id[0])
	
		#Enable clear if not empty
		if (not self.main.isEmptyTable()):
			self.main.menuBar.enableClear()
			
		self.main.logWindow.printMessage(self.main.getStatus())