def _prepare_button_box (self, container):
		"""
		Crea la button box
		"""
		
		bb = gtk.HButtonBox ()
		bb.set_layout (gtk.BUTTONBOX_END)

		btn = gtk.Button (stock=gtk.STOCK_ADD)
		btn.set_relief (gtk.RELIEF_NONE)
		btn.connect ('clicked', self._on_add)
		bb.pack_start (btn)

		btn = gtk.Button (stock=gtk.STOCK_REFRESH)
		btn.set_relief (gtk.RELIEF_NONE)
		btn.connect ('clicked', self._on_refresh)
		bb.pack_start (btn)

		btn = gtk.Button (stock=gtk.STOCK_REMOVE)
		btn.set_relief (gtk.RELIEF_NONE)
		btn.connect ('clicked', self._on_remove)
		bb.pack_start (btn)
		
		btn = utils.new_button (None, gtk.STOCK_DIALOG_AUTHENTICATION, True)
		btn.set_relief (gtk.RELIEF_NONE)
		btn.connect ('toggled', self._on_edit_mode, container, bb)
		bb.pack_start (btn)
		
		
		btn = utils.new_button (_("Filtro"), gtk.STOCK_APPLY)
		btn.set_relief (gtk.RELIEF_NONE)
		btn.connect ("clicked", self._on_filter_clicked)
		btn.connect ("button_press_event", self._on_popup)
		bb.pack_start (btn)
		
		return bb
Example #2
0
	def createIntro(self):
		tbl = self.createNewPage(
			gtk.ASSISTANT_PAGE_INTRO,
			_("Il wizard ti guidera' durante l'aggiornamento di pyacqua."),
			gtk.Table(2, 1)
		)

		tbl.attach(
			gtk.Label(_("Per controllare la presenza di aggiornamenti premere il bottone sotto.")),
			0, 1, 0, 1,
			xoptions=gtk.SHRINK | gtk.EXPAND
		)
		
		btn = utils.new_button("Controlla Aggiornamenti.", gtk.STOCK_REFRESH)
		btn.connect('clicked', self.onCheckUpdateCallback)
		tbl.attach(btn, 0, 1, 1, 2, xoptions=gtk.SHRINK | gtk.EXPAND, yoptions=gtk.SHRINK | gtk.EXPAND)
		
		tbl.show_all()
Example #3
0
	def __init__ (self, legend=False):
		gtk.ScrolledWindow.__init__ (self)
		
		self.set_policy (gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
		
		self.legend = legend
		
		tbl = gtk.Table (4, 2, False)
		
		self.menu = gtk.Menu ()
		
		for y in utils.get ('select * from vasca'):
			self.menu.append (gtk.CheckMenuItem (y[3]))
		
		al = gtk.Alignment(0, 0.5)
		btn = gtk.Button()
		btn.set_relief (gtk.RELIEF_NONE)
		hb = gtk.HBox (0, False)
		hb.add (gtk.Arrow (gtk.ARROW_RIGHT, gtk.SHADOW_ETCHED_IN))
		hb.add (gtk.Label (_("Selezione Vasche")))
		btn.add (hb)
		al.add (btn)
		
		btn.connect ('button_press_event', self.on_popup)
		
		bb = gtk.HButtonBox ()
		bb.set_layout (gtk.BUTTONBOX_EDGE)
		
		button = utils.new_button (_("Plot"), gtk.STOCK_ZOOM_IN)
		button.connect ('clicked', self.on_plot)
		
		bb.pack_start (button)
		
		self.m_box = gtk.VBox (False, 2)
		
		self.checks = []		
		labels = (_('Ph'), _('Kh'), _('Gh'), _('No2'), _('No3'),
			_('Conducibilita\''), _('Ammoniaca'), _('Ferro'), _('Rame'), _('Fosfati'),
			_('Calcio'), _('Magnesio'), _('Densita\''))
		
		x = 1
		funny_toggle = False
		
		for i in labels:
			widg = gtk.CheckButton (i)
			self.checks.append (widg)
			if not funny_toggle:
				tbl.attach (widg, 1, 2, x, x+1)
				x += 1
			else:
				tbl.attach (widg, 0, 1, x, x+1)
				
			funny_toggle = not funny_toggle
		
		tbl.attach (utils.new_label (_("Vasca:")), 0, 1, 0, 1)
		tbl.attach (utils.new_label (_("Valori:")), 0, 1, 1, 2)
		tbl.attach (al, 1, 2, 0, 1)
		tbl.attach (bb, 0, 2, x, x+1)
		
		self.add_with_viewport (tbl)
		
		self.show_all ()
	def __init__ (self):
		gtk.Window.__init__ (self)
		
		utils.set_icon (self)
		self.set_title (_("Web Update"))
		self.set_size_request (600, 400)
		
		vbox = gtk.VBox (False, 2)
		
		self.store = gtk.ListStore (
			gtk.gdk.Pixbuf, # icona
			str, # nome file
			int, # new_revision
			int, # bytes
			str, # md5
			int, # old_revision
			int, # old bytes
			str, # old_md5
			int, # percentuale scaricamento
			bool, #il bool finale: to_add?
			gtk.gdk.Color) # colre di background
		
		self.tree = gtk.TreeView (self.store)
		
		self.tree.append_column (gtk.TreeViewColumn ("", gtk.CellRendererPixbuf(), pixbuf=0))

		rend = gtk.CellRendererText (); id = 1
		for i in (_("File"), _("Rev"), _("Bytes"), _("MD5"), _("oldRev"), _("oldBytes"), _("oldMD5")):
			col = gtk.TreeViewColumn (i, rend, text=id)
			self.tree.append_column (col)
			id += 1

		rend = gtk.CellRendererProgress ()
		col = gtk.TreeViewColumn (_("%"), rend, value=8)
		self.tree.append_column (col)
		
		for i in self.tree.get_columns ():
			i.add_attribute (i.get_cell_renderers ()[0], 'cell_background-gdk', 10)
			
		sw = gtk.ScrolledWindow ()
		sw.add (self.tree)
		vbox.pack_start (sw)
		
		bb = gtk.HButtonBox ()
		bb.set_layout (gtk.BUTTONBOX_END)
		
		self.update_btn = btn = utils.new_button (_("Aggiorna"), gtk.STOCK_REFRESH)
		btn.connect ('clicked', self._on_start_update)
		bb.pack_start (btn)

		btn.set_sensitive (False)

		self.get_btn = btn = utils.new_button (_("Controlla Aggiornamenti"), gtk.STOCK_APPLY)
		btn.connect ('clicked', self._on_get_list)
		bb.pack_start (btn)
		
		vbox.pack_start (bb, False, False, 0)

		self.status = gtk.Statusbar ()
		vbox.pack_start (self.status, False, False, 0)

		self.add (vbox)
		self.show_all ()
		
		self.connect ('delete-event', self._on_delete_event)
		
		self.file = None
		self.it = None
		self.checklist = []
		
		self.actual_data = generate.Generator.ParseDir (utils.HOME_DIR)
		self.xml_util = generate.UpdateXML ()
		
		self.icon_add = gtk.gdk.pixbuf_new_from_file (os.path.join (utils.DPIXM_DIR, "add.png"))
		self.icon_del = gtk.gdk.pixbuf_new_from_file (os.path.join (utils.DPIXM_DIR, "del.png"))
		self.icon_done = gtk.gdk.pixbuf_new_from_file (os.path.join (utils.DPIXM_DIR, "done.png"))
		self.icon_error = gtk.gdk.pixbuf_new_from_file (os.path.join (utils.DPIXM_DIR, "error.png"))
		
		self.color_add = gtk.gdk.color_parse ('#70ef70')
		self.color_del = gtk.gdk.color_parse ('#ff8080')
		self.color_done = gtk.gdk.color_parse ('#bcfffc')
		self.color_error = gtk.gdk.color_parse ('#ff9060')
Example #5
0
	def __init__(self):
		gtk.Window.__init__(self)
		UpdateEngine.__init__(self)
		
		utils.set_icon(self)
		self.set_title(_("Web Update"))
		self.set_size_request(600, 400)
		
		vbox = gtk.VBox(False, 2)
		
		self.nb = gtk.Notebook()
		vbox.pack_start(self.nb)
		
		self.status = gtk.Statusbar()
		vbox.pack_start(self.status, False, False, 0)
		
		self.add(vbox)
		
		self.connect('delete-event', self._on_delete_event)
		
		# ---------------------------------------------------------------------------------------
		
		self.store = gtk.TreeStore(
			gtk.gdk.Pixbuf, # icona
			str, # nome file
			str, # new_revision
			str, # old_revision
			int, # bytes
			int, # percentuale scaricamento
			bool, # da scaricare
			gtk.gdk.Color # colre di background
		)
		
		self.tree = gtk.TreeView(self.store)
		self.tree.append_column(gtk.TreeViewColumn("", gtk.CellRendererPixbuf(), pixbuf=0))

		rend = gtk.CellRendererText(); id = 1
		
		for i in (_("File"), _("New"), _("Current"), _("Bytes")):
			col = gtk.TreeViewColumn(i, rend, text=id)
			self.tree.append_column(col)
			id += 1
			
		# Colonna percentuale
		rend = gtk.CellRendererProgress()
		col = gtk.TreeViewColumn(_("%"), rend, value=COL_PERC)
		
		self.tree.append_column(col)
		
		# Background su tutte le celle
		for i in self.tree.get_columns():
			i.add_attribute(i.get_cell_renderers()[0], 'cell_background-gdk', COL_COLO)
		
		sw = gtk.ScrolledWindow()
		sw.add(self.tree)
		
		vbox = gtk.VBox(False, 2)
		vbox.pack_start(sw)
		
		bb = gtk.HButtonBox()
		bb.set_layout(gtk.BUTTONBOX_END)
		
		self.update_btn = btn = utils.new_button(_("Aggiorna"), gtk.STOCK_REFRESH)
		btn.connect('clicked', self._on_start_update)
		bb.pack_start(btn)

		btn.set_sensitive(False)

		self.get_btn = btn = utils.new_button(_("Controlla Aggiornamenti"), gtk.STOCK_APPLY)
		btn.connect('clicked', self.onGetList)
		bb.pack_start(btn)
		
		vbox.pack_start(bb, False, False, 0)
		
		self.nb.append_page(vbox)
		
		self.file = None
		self.it = None
		
		self.program_list = None
		
		self.icon_add = gtk.gdk.pixbuf_new_from_file(os.path.join(utils.DPIXM_DIR, "add.png"))
		self.icon_del = gtk.gdk.pixbuf_new_from_file(os.path.join(utils.DPIXM_DIR, "del.png"))
		self.icon_done = gtk.gdk.pixbuf_new_from_file(os.path.join(utils.DPIXM_DIR, "done.png"))
		self.icon_error = gtk.gdk.pixbuf_new_from_file(os.path.join(utils.DPIXM_DIR, "error.png"))
		self.icon_program = gtk.gdk.pixbuf_new_from_file(os.path.join(utils.DPIXM_DIR, "program.png"))
		
		self.color_add = gtk.gdk.color_parse('#70ef70')
		self.color_del = gtk.gdk.color_parse('#ff8080')
		self.color_done = gtk.gdk.color_parse('#bcfffc')
		self.color_error = gtk.gdk.color_parse('#ff9060')
		self.color_wait = gtk.gdk.color_parse('#ebebeb')
		
		# ---------------------------------------------------------------------------------------

		# Dobbiamo inserire una checklist per scegliere quali componenti aggiornare.
		# Quindi facciamo un for sulle entry del database locale per creare la lista
		# dei vari programmi.
		
		vbox = gtk.VBox(False, 2)
		
		self.choice_store = gtk.ListStore(
			gtk.gdk.Pixbuf, # icona
			str, # nome programma
			bool, # checked
		)
		
		self.choice_tree = gtk.TreeView(self.choice_store)
		
		col = gtk.TreeViewColumn("", gtk.CellRendererPixbuf(), pixbuf=0)
		col.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
		col.set_fixed_width(50)
		
		self.choice_tree.append_column(col)
		
		col = gtk.TreeViewColumn(_("Program"), gtk.CellRendererText(), text=1)
		col.set_sizing(gtk.TREE_VIEW_COLUMN_GROW_ONLY)
		
		self.choice_tree.append_column(col)
		
		rend = gtk.CellRendererToggle()
		rend.connect('toggled', self.onToggled, self.choice_tree.get_model())
		
		col = gtk.TreeViewColumn("", rend, active=2)
		col.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
		col.set_fixed_width(50)
		
		self.choice_tree.append_column(col)
		
		sw = gtk.ScrolledWindow()
		sw.add(self.choice_tree)
		
		vbox.pack_start(sw)

		self.program_db = DatabaseWrapper(os.path.join(utils.DHOME_DIR, DB_FILE))
		self.program_iters = []
		
		self.lockInterface()
		self.fetchComponents(self.populateChoiceStore)
		
		bb = gtk.HButtonBox()
		bb.set_layout(gtk.BUTTONBOX_END)
		
		btn = utils.new_button(_("Procedi con l'aggiornamento"), gtk.STOCK_GO_FORWARD)
		btn.connect('clicked', self.onGoForward)
		bb.pack_start(btn)
		
		vbox.pack_start(bb, False, False, 0)
		
		self.nb.append_page(vbox)
		
		self.show_all()