From aee9ac1390410b1a751978da59ce10d6468cd551 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20=27Necoro=27=20Neumann?= Date: Wed, 18 Feb 2009 16:30:03 +0100 Subject: Show database types in the preferences - though nothing useful can be done atm ;) --- portato/gui/windows/preference.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'portato/gui/windows/preference.py') diff --git a/portato/gui/windows/preference.py b/portato/gui/windows/preference.py index df18e88..c8025d0 100644 --- a/portato/gui/windows/preference.py +++ b/portato/gui/windows/preference.py @@ -20,6 +20,7 @@ from .basic import AbstractDialog from ..dialogs import io_ex_dialog from ..utils import get_color from ...helper import debug +from ... import db class PreferenceWindow (AbstractDialog): """Window displaying some preferences.""" @@ -151,6 +152,16 @@ class PreferenceWindow (AbstractDialog): self.systemTabCombo.set_active(int(self.cfg.get("systemTabPos", section = "GUI"))-1) self.pkgTabCombo.set_active(int(self.cfg.get("packageTabPos", section = "GUI"))-1) + # the database combo + self.databaseCombo = self.tree.get_widget("databaseCombo") + model = gtk.ListStore(str, str, str) + + for k, (name, desc) in db.types.iteritems(): + model.append([name, desc, k]) + + self.databaseCombo.set_model(model) + self.databaseCombo.set_active(0) # XXX: just set one thing active - no meaning yet + self.window.show_all() def _save(self): -- cgit v1.2.3 From 796f983e0eb5889ee18169bfedfdef99e5b9e2ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20=27Necoro=27=20Neumann?= Date: Thu, 19 Feb 2009 23:52:52 +0100 Subject: Make combos work --- portato/gui/windows/preference.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'portato/gui/windows/preference.py') diff --git a/portato/gui/windows/preference.py b/portato/gui/windows/preference.py index c8025d0..a7661c5 100644 --- a/portato/gui/windows/preference.py +++ b/portato/gui/windows/preference.py @@ -144,10 +144,15 @@ class PreferenceWindow (AbstractDialog): self.pkgTabCombo = self.tree.get_widget("packageTabCombo") for c in (self.systemTabCombo, self.pkgTabCombo): - m = c.get_model() - m.clear() + model = gtk.ListStore(str) for i in (_("Top"), _("Bottom"), _("Left"), _("Right")): - m.append((i,)) + model.append((i,)) + + c.set_model(model) + + cell = gtk.CellRendererText() + c.pack_start(cell) + c.set_attributes(cell, text = 0) self.systemTabCombo.set_active(int(self.cfg.get("systemTabPos", section = "GUI"))-1) self.pkgTabCombo.set_active(int(self.cfg.get("packageTabPos", section = "GUI"))-1) @@ -161,6 +166,10 @@ class PreferenceWindow (AbstractDialog): self.databaseCombo.set_model(model) self.databaseCombo.set_active(0) # XXX: just set one thing active - no meaning yet + + cell = gtk.CellRendererText() + self.databaseCombo.pack_start(cell) + self.databaseCombo.set_attributes(cell, text = 0) self.window.show_all() -- cgit v1.2.3 From d3f2196d3c638222a8e96c3d61626a9ff8efb2e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20=27Necoro=27=20Neumann?= Date: Fri, 20 Feb 2009 00:29:36 +0100 Subject: Add color btns to the preferences, so they are configurable here too --- portato/gui/windows/preference.py | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) (limited to 'portato/gui/windows/preference.py') diff --git a/portato/gui/windows/preference.py b/portato/gui/windows/preference.py index a7661c5..4d3493f 100644 --- a/portato/gui/windows/preference.py +++ b/portato/gui/windows/preference.py @@ -61,7 +61,7 @@ class PreferenceWindow (AbstractDialog): 4 : gtk.POS_RIGHT } - def __init__ (self, parent, cfg, console_fn, linkbtn_fn, tabpos_fn, catmodel_fn): + def __init__ (self, parent, cfg, console_fn, linkbtn_fn, tabpos_fn, catmodel_fn, labelcolor_fn): """Constructor. @param parent: parent window @@ -75,7 +75,9 @@ class PreferenceWindow (AbstractDialog): @param tabpos_fn: function to call to set the tabposition of the notebooks @type tabpos_fn: function(gtk.ComboBox,int) @param catmodel_fn: function to call to set the model of the cat list (collapsed/not collapsed) - @type catmodel_fn: function()""" + @type catmodel_fn: function() + @param labelcolor_fn: function to call to set the color of the label + @type labelcolor_fn: function(gtk.gdk.Color)""" AbstractDialog.__init__(self, parent) @@ -102,6 +104,7 @@ class PreferenceWindow (AbstractDialog): self.linkbtn_fn = linkbtn_fn self.tabpos_fn = tabpos_fn self.catmodel_fn = catmodel_fn + self.labelcolor_fn = labelcolor_fn # set the bg-color of the hint hintEB = self.tree.get_widget("hintEB") @@ -110,20 +113,16 @@ class PreferenceWindow (AbstractDialog): # the checkboxes for box, val in self.checkboxes.iteritems(): if isinstance(val, tuple): - self.tree.get_widget(box).\ - set_active(self.cfg.get_boolean(val[0], section = val[1])) + self.tree.get_widget(box).set_active(self.cfg.get_boolean(val[0], section = val[1])) else: - self.tree.get_widget(box).\ - set_active(self.cfg.get_boolean(val)) + self.tree.get_widget(box).set_active(self.cfg.get_boolean(val)) # the edits for edit, val in self.edits.iteritems(): if isinstance(val,tuple): - self.tree.get_widget(edit).\ - set_text(self.cfg.get(val[0], section = val[1])) + self.tree.get_widget(edit).set_text(self.cfg.get(val[0], section = val[1])) else: - self.tree.get_widget(edit).\ - set_text(self.cfg.get(val)) + self.tree.get_widget(edit).set_text(self.cfg.get(val)) # the set list self.setList = self.tree.get_widget("setList") @@ -139,6 +138,13 @@ class PreferenceWindow (AbstractDialog): self.titleLengthSpinBtn = self.tree.get_widget("titleLengthSpinBtn") self.titleLengthSpinBtn.set_value(int(self.cfg.get("titlelength", section = "GUI"))) + # the color buttons + self.pkgTableColorBtn = self.tree.get_widget("pkgTableColorBtn") + self.pkgTableColorBtn.set_color(get_color(self.cfg, "packagetable")) + + self.prefColorBtn = self.tree.get_widget("prefColorBtn") + self.prefColorBtn.set_color(get_color(self.cfg, "prefhint")) + # the comboboxes self.systemTabCombo = self.tree.get_widget("systemTabCombo") self.pkgTabCombo = self.tree.get_widget("packageTabCombo") @@ -209,6 +215,14 @@ class PreferenceWindow (AbstractDialog): self.catmodel_fn() + # colors + c = self.pkgTableColorBtn.get_color() + self.cfg.set("packagetable", str(c)[1:], section = "COLORS") + self.labelcolor_fn(c) + + c = self.prefColorBtn.get_color() + self.cfg.set("prefhint", str(c)[1:], section = "COLORS") + def fill_setlist (self): store = gtk.ListStore(bool, str, str, str) -- cgit v1.2.3 From 9756f5649fc17b4be9b8f3f9a537ee027faabca2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20=27Necoro=27=20Neumann?= Date: Fri, 20 Feb 2009 00:58:36 +0100 Subject: Add database type to global config -- no user-config for the moment --- portato/gui/windows/preference.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'portato/gui/windows/preference.py') diff --git a/portato/gui/windows/preference.py b/portato/gui/windows/preference.py index 4d3493f..5b88b22 100644 --- a/portato/gui/windows/preference.py +++ b/portato/gui/windows/preference.py @@ -164,19 +164,28 @@ class PreferenceWindow (AbstractDialog): self.pkgTabCombo.set_active(int(self.cfg.get("packageTabPos", section = "GUI"))-1) # the database combo + dbtype = self.cfg.get("type", section = "DATABASE") self.databaseCombo = self.tree.get_widget("databaseCombo") model = gtk.ListStore(str, str, str) + ctr = 0 + active = 0 for k, (name, desc) in db.types.iteritems(): + if k == dbtype: + active = ctr + model.append([name, desc, k]) + ctr += 1 self.databaseCombo.set_model(model) - self.databaseCombo.set_active(0) # XXX: just set one thing active - no meaning yet + self.databaseCombo.set_active(active) cell = gtk.CellRendererText() self.databaseCombo.pack_start(cell) self.databaseCombo.set_attributes(cell, text = 0) + self.cb_db_combo_changed() + self.window.show_all() def _save(self): @@ -246,6 +255,13 @@ class PreferenceWindow (AbstractDialog): self.setList.set_model(store) + def cb_db_combo_changed (self, *args): + model = self.databaseCombo.get_model() + active = self.databaseCombo.get_active() + + descr = self.tree.get_widget("dbDescriptionLabel") + descr.set_markup("%s" % model[active][1]) + def cb_ok_clicked(self, button): """Saves, writes to config-file and closes the window.""" self._save() -- cgit v1.2.3