Esempio n. 1
0
	def run(self):
		""" Run the thread. """

		app = addapp.addapp() 

		# Set window sensitive False
		GObject.idle_add(self.parent.grid_inputs.set_sensitive, False)
		GObject.idle_add(self.parent.dialog_action_area.set_sensitive, False)

		# Get inputs
		name = self.parent.name_entry.get_text()
		url = self.parent.url_entry.get_text()
		width = self.parent.width_entry.get_text()
		height = self.parent.height_entry.get_text()
		catree = self.parent.cat_combo.get_active_iter()

		size = width+"x"+height

		if catree != None:
			model = self.parent.cat_combo.get_model()
			cat = model[catree][0]
		else:
			GObject.idle_add(self.parent.status, "inputs")
			GObject.idle_add(self.parent.grid_inputs.set_sensitive, True)
			GObject.idle_add(self.parent.dialog_action_area.set_sensitive, True)

			return False

		if not app.check(name,url,size,3):
			GObject.idle_add(self.parent.status, "inputs")
			GObject.idle_add(self.parent.grid_inputs.set_sensitive, True)
			GObject.idle_add(self.parent.dialog_action_area.set_sensitive, True)

			return False

		GObject.idle_add(self.parent.status, "getfavicon")

		#GObject.idle_add(app.getFavicon, url)
		
		favicon = app.getFavicon(url)

		if favicon == "applications-internet":
			GObject.idle_add(self.parent.status, "errfavicon")
		else:
			GObject.idle_add(self.parent.status, "succfavicon")

		time.sleep(1)
		lst, dic = app.getcat()

		# Get english name for the category
		cateng = dic[cat]

		if app.createdesktop(name,url,size,app.getTruecat(cateng),favicon):
			GObject.idle_add(self.parent.status, "success")
			GObject.idle_add(self.parent.grid_inputs.set_sensitive, True)
			GObject.idle_add(self.parent.dialog_action_area.set_sensitive, True)

		# close oneslip
		time.sleep(1)
		GObject.idle_add(self.parent.cancel)	
Esempio n. 2
0
	def setup(self):
		""" initialize GUI """

		getcat = addapp.addapp()
		lst, dic = getcat.getcat()
		
		listmodel = Gtk.ListStore(GObject.TYPE_STRING)

		for item in lst:
			listmodel.append((item,))
		#listmodel.append(("Fare soldi spammando",))

		self.cat_combo.set_model(listmodel)
		cell = Gtk.CellRendererText()
		self.cat_combo.pack_start(cell, True)
		self.cat_combo.add_attribute(cell, "text", 0)
		
		self.cat_combo.set_active(0)