Beispiel #1
0
	def __init__ (self):
		gtk.Window.__init__ (self)

		self.set_title (_("Importa/Esporta Database"))
		
		utils.set_icon (self)
		
		self.connect ('delete-event', self.exit)
	
		vbox = gtk.VBox()
		vbox.set_spacing(4)
		vbox.set_border_width(4)
		
		tbl = gtk.Table(2, 4)
		tbl.set_border_width(4)
		tbl.set_row_spacings(4)
		
		self.ver_sette = sette = gtk.RadioButton (None, _("Versione 0.8"))
		self.ver_otto = otto = gtk.RadioButton (sette, _("Versione attuale"))
		
		tbl.attach(utils.new_label(_("Importa:")), 0, 1, 0, 1, xpadding=8)
		
		tbl.attach(utils.new_label(_("Esporta:")), 0, 1, 1, 2, xpadding=8)
		
		self.importa_db = DbEntry ()
		self.esporta_db = DbEntryOut ()
		
		tbl.attach(self.importa_db, 1, 2, 0, 1)
		tbl.attach(self.esporta_db, 1, 2, 1, 2)

		frame = gtk.Frame ("Vecchia versione:")
		vbox = gtk.VBox(2, False)
		
		self.ver_sette = sette = gtk.RadioButton (None, _("Versione 0.8"))
		self.ver_otto = otto = gtk.RadioButton (sette, _("Versione attuale"))

		vbox.pack_start (sette, False, False, 0)
		vbox.pack_start (otto, False, False, 0)

		frame.add(vbox)

		tbl.attach(frame, 0, 2, 2, 3)

		bb = gtk.HButtonBox()
		bb.set_layout(gtk.BUTTONBOX_END)
		
		btn = gtk.Button(stock=gtk.STOCK_OK)
		btn.connect('clicked', self.on_ok)
		bb.pack_start(btn)
		
		btn = gtk.Button(stock=gtk.STOCK_CANCEL)
		btn.connect('clicked', self.on_cancel)
		bb.pack_start(btn)

		tbl.attach (bb, 0, 2, 3, 4, ypadding=4)

		self.add (tbl)
		self.set_resizable (False)

		self.show_all ()
Beispiel #2
0
	def __init__ (self):
		gtk.Window.__init__ (self)

		self.set_title (_("Selezione Lingua"))
		self.set_size_request (250, 100)
		
		utils.set_icon (self)
		
		self.connect ('delete-event', self._on_delete_event)

		mbox = gtk.VBox ()
		vbox = gtk.VBox ()

		mbox.set_border_width (4)
		vbox.set_border_width (4)

		self.it = it = gtk.RadioButton (None, _("Italiano"))
		self.en = en = gtk.RadioButton (it, _("Inglese"))

		it_icon = gtk.Image (); en_icon = gtk.Image ()
		
		it_icon.set_from_file (os.path.join (utils.DPIXM_DIR, "it.xpm"))
		en_icon.set_from_file (os.path.join (utils.DPIXM_DIR, "en.xpm"))

		box = gtk.HBox ()
		box.pack_start (it_icon, False, False, 0)
		box.pack_start (it)
		vbox.pack_start (box, False, False, 0)

		box = gtk.HBox ()
		box.pack_start (en_icon, False, False, 0)
		box.pack_start (en)
		vbox.pack_start (box, False, False, 0)

		frm = gtk.Frame (_("Seleziona Lingua:"))
		frm.add (vbox)

		mbox.pack_start (frm)

		bb = gtk.HButtonBox ()
		bb.set_layout (gtk.BUTTONBOX_END)

		btn = gtk.Button (stock=gtk.STOCK_CANCEL)
		btn.connect ('clicked', self._on_delete_event)
		bb.pack_start (btn)

		btn = gtk.Button (stock=gtk.STOCK_OK)
		btn.connect ('clicked', self._on_ok)
		bb.pack_start (btn)

		mbox.pack_start (bb, False, False, 0)

		self.add (mbox)

		if get("lang").lower () == "it":
			it.set_active (True)
		elif get("lang").lower () == "en":
			en.set_active (True)

		self.show_all ()
Beispiel #3
0
	def __init__ (self):
		
		self.manutenzione = manutenzione.Manutenzione (self)
		# id integer, vasca TEXT, date DATE, nome TEXT, litri TEXT, tipo TEXT, filtro TEXT, co TEXT, illuminazione TEXT, reattore TEXT, schiumatoio TEXT, riscaldamento TEXT, img TEXT
		lst = gtk.ListStore (int, str, str, str, float, str, str, str, str, str, str, str, str, gtk.gdk.Pixbuf, str)

		tmp = utils.Combo ([_("Dolce"), _("Dolce Tropicale"), _("Marino"), _("Marino Mediterraneo"), _("Paludario"), _("Salmastro")])
		tmp.connect ('changed', self._aggiorna)

		self.col_lst = [_('Id'), _('Vasca'), _('Data'), _('Nome'), _('Litri'),
			_('Modello Acquario'), _('Tipo Filtro'),
			_('Impianto Co2'), _('Illuminazione'), 
			_('Reattore di calcio'), _('Schiumatoio'), _('Riscaldamento Refrigerazione'), _("Note"), _("Immagine")]
		
		dbwindow.DBWindow.__init__ (self, 2, 5, self.col_lst,
				[tmp, utils.DataButton (), gtk.Entry (), utils.FloatEntry (),
				 gtk.Entry (), gtk.Entry (), gtk.Entry (), gtk.Entry (), gtk.Entry (),
				 gtk.Entry (), gtk.Entry (), utils.NoteEntry (), utils.ImgEntry ()], lst, True)
		
		self.view.get_column (12).get_cell_renderers ()[0].set_property ('ellipsize-set', True)
		self.view.get_column (12).get_cell_renderers ()[0].set_property ('ellipsize', pango.ELLIPSIZE_END)
		self.view.get_column (12).set_min_width (140)
		
		self.set_title (_("Vasche"))
		self.set_size_request (700, 500)
		
		utils.set_icon (self)
		
		self.manutenzione.bind_context ()
	def __init__(self):
		gtk.Window.__init__(self)
		self.set_title(_("Plug-in"))
		self.set_resizable(False)
		
		utils.set_icon (self)
		self.set_size_request(500, 150)
				
		box = gtk.VBox()
		
		self.store = gtk.ListStore(int, str, str, str, str)
		self.view = view = gtk.TreeView(self.store)
		lst = [_('Id'), _('Nome'), _('Descrizione'), _('Versione'), _('Autore')]
		
		render = gtk.CellRendererText()
		
		for i in lst:
			id = lst.index(i)
			col = gtk.TreeViewColumn(i, render, text = id)
			col.set_sort_column_id(id)
			col.set_clickable(True)
			col.set_resizable(True)
			view.append_column(col)
			
		sw = gtk.ScrolledWindow()
		sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
		sw.set_shadow_type(gtk.SHADOW_ETCHED_IN)
		
		sw.add(view)
		box.pack_start(sw)
		
		bb = gtk.HButtonBox()
		bb.set_layout(gtk.BUTTONBOX_END)
		
		btn = gtk.Button(stock=gtk.STOCK_ADD)
		btn.connect('clicked', self._on_add)
		bb.pack_start(btn)
		
		btn = gtk.Button(stock=gtk.STOCK_REMOVE)
		btn.connect('clicked', self._on_unload)
		bb.pack_start(btn)
		
		box.pack_start(bb, False, False, 0)
		
		self.connect ('delete-event', self._on_delete_event)
		
		self.add(box)
		self._fillstore()
		self.show_all()
Beispiel #5
0
	def __init__(self):

		# Controlliamo l'esistenza di un'altra istanza
		
		if not TipsDialog.exist:
			TipsDialog.exist = True
		else:
			return
		
		gtk.Dialog.__init__(self, _("Tips of the Day"), None, gtk.DIALOG_NO_SEPARATOR,
			(gtk.STOCK_OK, gtk.RESPONSE_OK, gtk.STOCK_GO_FORWARD, gtk.RESPONSE_NONE))
		
		
		self.textview = gtk.TextView()
		self.textview.set_wrap_mode(gtk.WRAP_WORD)
		self.textbuffer = self.textview.get_buffer()
		
		utils.set_icon (self)
		
		sw = gtk.ScrolledWindow()
		sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
		sw.set_shadow_type(gtk.SHADOW_ETCHED_IN)

		sw.add(self.textview)
		
		self.vbox.pack_start(sw)

		self.check = gtk.CheckButton(_('Non mostrare al prossimo avvio'))
		
		if get ("show_tips"):
			self.check.set_active(False)
		else:
			self.check.set_active(True)
		
		self.vbox.pack_start(self.check, False, False, 0)

		self.connect('response', self._on_response)
		self._tip()
		
		self.set_size_request(400, 250)
		self.show_all()
	def __init__(self):
		
		self.spesa = spesa.Spesa (self)
		
		lst = gtk.ListStore (int, str, str, int, str, str, gtk.gdk.Pixbuf, str)
		self.col_lst = [_('Id'), _('Data'), _('Vasca'), _('Quantita'), _('Nome'), _('Note'), _("Immagine")]
		
		dbwindow.DBWindow.__init__ (self, 2, 2, self.col_lst,
			[utils.DataButton (), utils.Combo (), utils.IntEntry (), gtk.Entry (), utils.NoteEntry (), utils.ImgEntry ()], lst)
					
		self.set_title (_("Piante"))
		self.set_size_request (600, 400)
		
		utils.set_icon (self)
		
		for y in app.App.p_backend.select ("*", "vasca"):
			w = gtk.CheckMenuItem (y[3])
			w.set_property ("active", True)
			self.filter_menu.append (w)
		
		self.spesa.bind_context ()
    def __init__(self):

        self.spesa = spesa.Spesa(self)

        lst = gtk.ListStore(int, str, str, int, str, str, gtk.gdk.Pixbuf, str)
        self.col_lst = [_("Id"), _("Data"), _("Vasca"), _("Quantita"), _("Nome"), _("Note"), _("Immagine")]

        dbwindow.DBWindow.__init__(
            self,
            2,
            2,
            self.col_lst,
            [utils.DataButton(), utils.Combo(), utils.IntEntry(), gtk.Entry(), utils.NoteEntry(), utils.ImgEntry()],
            lst,
        )

        self.set_title(_("Invertebrati"))
        self.set_size_request(600, 400)
        utils.set_icon(self)

        self.spesa.bind_context()
Beispiel #8
0
	def __init__(self):
		self.piante = piante.Piante (self)
		self.invert = invertebrati.Invertebrati (self)
		self.spesa  = spesa.Spesa (self)
		
		lst = gtk.ListStore (int, str, str, int, str, str, gtk.gdk.Pixbuf, str)
		
		self.col_lst = [
			_('Id'),
			_('Data'),
			_('Vasca'),
			_('Quantita'),
			_('Nome'),
			_('Note'),
			_("Immagine")
		]
		
		dbwindow.DBWindow.__init__ (self, 2, 2, self.col_lst,
			[
				utils.DataButton (),
				utils.Combo (),
				utils.IntEntry (),
				gtk.Entry (),
				utils.NoteEntry (),
				utils.ImgEntry ()
			],
			lst,
			True
		)
		
		self.set_title (_("Pesci"))
		self.set_size_request (600, 400)
		
		utils.set_icon (self)
		
		self.piante.bind_context ()
		self.invert.bind_context ()
		self.spesa.bind_context ()
Beispiel #9
0
    def get_output(self):
        '''
        Returns generated string for lemonbar.
        '''
        self.update() 

        string = self.value

        if self.icon:
            string = set_icon(string, self.icon)

        if self.bg:
            string = self.set_bg(string)
            
        if self.fg:
            string = self.set_fg(string)

        if self.gaps:
            string = self.set_gaps(string)

        if len(self.action):
            string = self.get_action(string)

        return string
Beispiel #10
0
	def __init__(self):
		gtk.Window.__init__(self)
		
		self.set_title('Py-Acqua')
		self.set_size_request(467, 332)
		self.set_resizable(False)
		
		self.p_window = {
			"calcoli" : None,
			"test" : None,
			"popolazione" : None,
			"vasca" : None,
			"skin" : None,
			"plugin" : None,
			"lang" : None,
			"update" : None
		}
		
		utils.set_icon (self)
		
		image = gtk.Image()

		# Settiamo lo skin

		file = os.path.join (utils.SKIN_DIR, os.path.join (get ("skin"), "main.png"))
		
		if not os.path.exists (file):
			file = os.path.join (utils.DSKIN_DIR, os.path.join (get ("skin"), "main.png"))
		
		if os.path.exists (file):
			image.set_from_file(file)
		
		# Proviamo ad applicare lo stile gtk se presente
		path = os.path.join (get ("skin"), "gtkrc")
		
		if os.path.exists (os.path.join (utils.SKIN_DIR, path)):
			path = os.path.join (utils.SKIN_DIR, path)
		elif os.path.exists (os.path.join (utils.DSKIN_DIR, path)):
			path = os.path.join (utils.DSKIN_DIR, path)
		else:
			path = None
		
		if path:
			gtk.rc_set_default_files ([path])
			gtk.rc_reparse_all_for_settings (gtk.settings_get_default (), True)
		
		# Menu
		self._create_menu()
		
		vbox = gtk.VBox()
		
		vbox.pack_start(self.ui.get_widget('/Menubar'), False, False, 0)
		vbox.pack_start(image)
		
		self.add (vbox)
		self.realize ()
		self.show_all ()
		
		if os.name == 'nt':
			self.connect ('delete_event', self.exit)
		else:
			self.connect ('destroy', self.exit)
		
		if get ("show_tips"):
			import tips
			tips.TipsDialog()
Beispiel #11
0
	def __init__ (self): 
		# id integer, date DATE, vasca FLOAT, ph FLOAT, kh FLOAT, gh
		# NUMERIC, no NUMERIC, noo NUMERIC, con NUMERIC, amm NUMERIC, fe
		# NUMERIC, ra NUMERIC, fo NUMERIC
		
		# Una liststore piu' grande dubito che esista 
		lst = gtk.ListStore (
			int,	# ID
			str,	# DATA
			str,	# VASCA
			
			float,	# PH
			float,	# KH
			float,	# GH
			float,	# NO2
			float,	# NO3
			float,	# COND
			float,	# AMMO
			float,	# FERRO
			float,	# RAME
			float,	# FOSFATI
			
			float,	# calcio
			float,	# magnesio
			float,	# densita
			str,	# Limiti
			
			gtk.gdk.Color,	# PH
			gtk.gdk.Color,	# KH
			gtk.gdk.Color,	# GH
			gtk.gdk.Color,	# NO2
			gtk.gdk.Color,	# NO3
			gtk.gdk.Color,	# COND
			gtk.gdk.Color,	# AMMO
			gtk.gdk.Color,	# FERRO
			gtk.gdk.Color,	# RAME
			gtk.gdk.Color,	# FOSFATI
			gtk.gdk.Color,	# CALCIO
			gtk.gdk.Color,	# MAGNESIO
			gtk.gdk.Color)	# DENSITA'

		cols = [_('Id'), _('Data'), _('Vasca'), _('Ph'), _('Kh'), _('Gh'), _('No2'), _('No3'),
			_('Conducibilita\''), _('Ammoniaca'), _('Ferro'), _('Rame'), _('Fosfati'),
			_('Calcio'), _('Magnesio'), _('Densita\''), _('Limiti')]
		
		inst = [utils.DataButton (), utils.Combo ()]
		
		for i in range (13):
			spin = utils.FloatEntry ()
			spin.connect ('output', self._on_spin_change)
			inst.append (spin)
		
		inst.append (utils.Combo ()) # Combo per i limiti

		dbwindow.DBWindow.__init__ (self, 2, 7, cols, inst, lst, True) # different renderer
		
		# Scan sulle colonne
		for i in self.view.get_columns ()[3:16]:
			i.add_attribute (i.get_cell_renderers ()[0], 'cell_background-gdk', self.view.get_columns().index (i) + 14)
		
		
		gcolor[3] = self.get_style ().copy ().bg[gtk.STATE_NORMAL]

		self.set_title (_("Test"))
		self.set_size_request (600, 400)
		
		utils.set_icon (self)
		
		self.note.set_current_page (0)
		self.show_all ()
Beispiel #12
0
	def __init__(self):
		gtk.Window.__init__ (self)
		self.create_gui ()
		self.set_title(_("AgDB Plugin"))
		#self.set_size_request (600, 400)
		utils.set_icon (self)
Beispiel #13
0
 def __init__(self):
     gtk.Window.__init__(self)
     self.create_gui()
     self.set_title(_("Database"))
     self.set_size_request(600, 400)
     utils.set_icon(self)
Beispiel #14
0
	def __init__(self): 
		gtk.Window.__init__(self)
		
		self.set_title(_("Calcoli"))
		self.set_resizable(False)
		
		utils.set_icon (self)
		
		vbox = gtk.VBox()
		vbox.set_spacing(4)
		vbox.set_border_width(4)
		
		# I due frame
		f1 = gtk.Frame(_('Valori')); f2 = gtk.Frame(_('Risultati'))
		
		# Pacchiamoli...
		vbox.pack_start(f1, False, False, 0)
		vbox.pack_start(f2, False, False, 0)
		
		# Tabella per i valori
		tbl_valori = gtk.Table(3, 2)
		tbl_valori.set_border_width(4)
		tbl_valori.set_row_spacings(4)
		
		# Le varie label
		tbl_valori.attach(utils.new_label(_("Vasca:")), 0, 1, 0, 1)
		tbl_valori.attach(utils.new_label(_("Lunghezza in cm:")), 0, 1, 1, 2)
		tbl_valori.attach(utils.new_label(_("Larghezza in cm:")), 0, 1, 2, 3)
		tbl_valori.attach(utils.new_label(_("Altezza in cm:")), 0, 1, 3, 4)
		
		# ComboBox
		self.e_vasca = utils.Combo()
		self.e_vasca.append_text(_("Dolce"))
		self.e_vasca.append_text(_("Marino"))
		self.e_vasca.set_active(0)

		# Quando si sceglie marino o dolce invochiamo aggiorna()
		self.e_vasca.connect('changed', self._on_change_vasca)
		
		# Creiamo le entry per la tabella valori
		self.e_altezza, self.e_lunghezza, self.e_larghezza = gtk.Entry(), gtk.Entry(), gtk.Entry()
		
		tbl_valori.attach(self.e_vasca, 1, 2, 0, 1, yoptions=0)
		tbl_valori.attach(self.e_lunghezza, 1, 2, 1, 2, yoptions=0)
		tbl_valori.attach(self.e_larghezza, 1, 2, 2, 3, yoptions=0)
		tbl_valori.attach(self.e_altezza, 1, 2, 3, 4, yoptions=0)
		
		# Creiamo un notebook di due schede contenenti le diverse
		# tabelle (per dolce e marino)
		self.notebook = gtk.Notebook()
		self.notebook.set_show_tabs(False)
		self.notebook.set_show_border(False)

		# Creiamo la tabella per il tipo Dolce
		tbl = gtk.Table(6, 2)
		tbl.set_border_width(4)
			
		self.dlc_volume = utils.new_label('0', False, labelCopy=_("Volume: %s"))
		self.dlc_piante_inseribili = utils.new_label('0', False, labelCopy=_("Piante inseribili: %s"))
		self.dlc_num_pesci_3_4 = utils.new_label('0', False, labelCopy=_("Numero di pesci 3-4 cm: %s"))
		
		tbl.attach(utils.new_label(_("Volume:")), 0, 1, 0, 1)
		tbl.attach(utils.new_label(_("Piante Inseribili:")), 0, 1, 1, 2)
		tbl.attach(utils.new_label(_("Numero di pesci 3-4 cm:")), 0 ,1, 2, 3)
		
		tbl.attach(self.dlc_volume, 1, 2, 0, 1)
		tbl.attach(self.dlc_piante_inseribili, 1, 2, 1, 2)
		tbl.attach(self.dlc_num_pesci_3_4, 1, 2, 2, 3)
		
		tbl.attach(utils.new_label(_("Numero di pesci 5-6 cm:")), 0, 1, 3, 4)
		tbl.attach(utils.new_label(_("Watt per piante esigenti:")), 0, 1, 4, 5)
		tbl.attach(utils.new_label(_("Watt per piante poco esigenti:")), 0, 1, 5, 6)
		
		self.dlc_num_pesci_5_6 = utils.new_label('0', False, labelCopy=_("Numero di pesci 5-6 cm: %s"))
		self.dlc_watt_esigenti = utils.new_label('0', False, labelCopy=_("Watt per piante esigenti: %s"))
		self.dlc_watt_poco_esigenti = utils.new_label('0', False, labelCopy=_("Watt per piante poco esigenti: %s"))
		
		tbl.attach(self.dlc_num_pesci_5_6, 1, 2, 3, 4)
		tbl.attach(self.dlc_watt_esigenti, 1, 2, 4, 5)
		tbl.attach(self.dlc_watt_poco_esigenti, 1, 2, 5, 6)

		box = gtk.VBox()
		box.pack_start(tbl, False, False, 0)

		# Aggiungiamo la table per il tipo dolce alla notebook
		self.notebook.append_page(box, None)

		# Creiamo la table per il tipo marino
		tbl = gtk.Table(2, 2)
		tbl.set_border_width(4)
		#tbl.set_row_spacings(4)
		
		self.mar_volume = utils.new_label('0', False, labelCopy=_("Volume %s"))
		self.luce_vasche_pesci = utils.new_label('0', False, labelCopy=_("Luce per vasche di pesci: %s"))
		self.luce_coralli_molli = utils.new_label('0', False, labelCopy=_("Luce per coralli molli: %s"))
		self.luce_coralli_duri = utils.new_label('0', False, labelCopy=_("Luce per coralli duri: %s"))
		self.totale_litri_movimento = utils.new_label('0', False, labelCopy=_("Totale l/h in movimento"))
		self.quantita_sabbia_dsb = utils.new_label('0', False, labelCopy=_("Quantita' di sabbia per dsb: %s"))
		
		tbl.attach(utils.new_label(_("Volume:")), 0, 1, 0, 1)
		tbl.attach(utils.new_label(_("Luce per vasche di pesci:")), 0, 1, 1, 2)
		tbl.attach(utils.new_label(_("Luce per coralli molli:")), 0, 1, 2, 3)
		tbl.attach(utils.new_label(_("Luce per coralli duri:")), 0, 1, 3, 4)
		tbl.attach(utils.new_label(_("Totale l/h in movimento:")), 0, 1, 4, 5)
		tbl.attach(utils.new_label(_("Quantita di sabbia per dsb:")), 0, 1, 5, 6)
		
		
		tbl.attach(self.mar_volume, 1, 2, 0, 1)
		tbl.attach(self.luce_vasche_pesci, 1, 2, 1, 2)
		tbl.attach(self.luce_coralli_molli, 1, 2, 2, 3)
		tbl.attach(self.luce_coralli_duri, 1, 2, 3, 4)
		tbl.attach(self.totale_litri_movimento, 1, 2, 4, 5)
		tbl.attach(self.quantita_sabbia_dsb, 1, 2, 5, 6)
		
		
		# Da definire cosa aggiungere.. ecc :p

		box = gtk.VBox()
		box.pack_start(tbl, False, False, 0)

		# Aggiungiamo la table per il tipo marino alla notebook
		self.notebook.append_page(box, None)

		# Pacchiamo la tabella dei valori
		f1.add(tbl_valori)

		# .. e la notebook
		f2.add(self.notebook)
		
		bb = gtk.HButtonBox()
		bb.set_layout(gtk.BUTTONBOX_END)
		
		btn = gtk.Button(stock=gtk.STOCK_REFRESH)
		btn.connect('clicked', self._on_refresh)
		bb.pack_start(btn)

		btn = gtk.Button(stock=gtk.STOCK_COPY)
		btn.connect('clicked', self._on_copy)
		bb.pack_start(btn)
		
		vbox.pack_start(bb, False, False, 0)
		
		self.add(vbox)
		
		self.connect ('delete-event', self._on_delete_event)
		
		self.show_all()
Beispiel #15
0
	def __init__(self):
		gtk.Window.__init__ (self)
		self.create_gui ()
		self.set_title(_("PyCalc"))
		self.set_size_request (400, 200)
		utils.set_icon (self)
	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')
Beispiel #17
0
    def __init__(self):
        gtk.Window.__init__(self)
        self.set_title(_("Skin"))

        utils.set_icon(self)

        self.set_resizable(False)

        self.path = utils.SKIN_DIR

        self.box = gtk.VBox()
        self.box.set_spacing(4)
        self.box.set_border_width(4)

        # Hbox per contenere una scrolled e un image
        hbox = gtk.HBox()

        # Una Scrolled Window per contenere
        # la Treeview

        sw = gtk.ScrolledWindow()
        sw.set_shadow_type(gtk.SHADOW_ETCHED_IN)
        sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)

        # Due colonne una per il nome dello skin
        # l'altra per il percorso al file main.png

        self.list = list = gtk.ListStore(str, str)
        self.view = view = gtk.TreeView(list)

        view.append_column(gtk.TreeViewColumn(_("Skin"), gtk.CellRendererText(), text=0))
        view.get_selection().connect("changed", self._on_selection_changed)

        sw.add(view)

        # Creiamo self.image

        self.image = gtk.Image()

        # Pacchiamo

        hbox.pack_start(sw, False, False, 0)
        hbox.pack_start(self.image)

        self.box.pack_start(hbox)

        self._reload()

        bb = gtk.HButtonBox()
        bb.set_layout(gtk.BUTTONBOX_END)
        bb.set_spacing(5)

        btn = gtk.Button(stock=gtk.STOCK_OK)
        btn.connect("clicked", self._on_skin_ok)
        bb.pack_start(btn)

        btn = gtk.Button(stock=gtk.STOCK_DELETE)
        btn.connect("clicked", self._on_delete)
        bb.pack_start(btn)

        btn = gtk.Button(stock=gtk.STOCK_CLOSE)
        btn.connect("clicked", self._on_delete_event)
        bb.pack_start(btn)

        btn = gtk.Button(stock=gtk.STOCK_ADD)
        btn.connect("clicked", self._insert_skin)
        bb.pack_start(btn)
        self.box.pack_start(bb, False, False, 0)

        self.connect("delete-event", self._on_delete_event)

        self.add(self.box)
        self.show_all()
Beispiel #18
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()