From f523ff155c7d4ad9e2266147e10b88155b91db50 Mon Sep 17 00:00:00 2001 From: necoro <> Date: Tue, 15 May 2007 15:24:59 +0000 Subject: - added settings: gtk: console font - show emerge progress in window title --- portato/gui/gtk/windows.py | 62 +- portato/gui/gui_helper.py | 4 +- portato/gui/qt/windows.py | 21 +- portato/gui/templates/portato.glade | 941 ++++++++++++++------------- portato/gui/templates/ui/PreferenceWindow.ui | 502 +++++++------- 5 files changed, 812 insertions(+), 718 deletions(-) (limited to 'portato/gui') diff --git a/portato/gui/gtk/windows.py b/portato/gui/gtk/windows.py index c77787a..967a9d8 100644 --- a/portato/gui/gtk/windows.py +++ b/portato/gui/gtk/windows.py @@ -193,6 +193,7 @@ class PreferenceWindow (AbstractDialog): "minimizeCheck" : ("minimize_opt", "gui_sec"), "systrayCheck" : ("systray_opt", "gui_sec"), "testPerVersionCheck" : "testingPerVersion_opt", + "titleUpdateCheck" : ("updateTitle_opt", "gui_sec"), "usePerVersionCheck" : "usePerVersion_opt", "useTipsCheck" : ("useTips_opt", "gtk_sec") } @@ -206,31 +207,23 @@ class PreferenceWindow (AbstractDialog): "syncCommandEdit" : "syncCmd_opt" } - # mapping from the radio buttons to the system name - # widget name -> option - system_radios = { - "portageRadio" : "portage", - "pkgCoreRadio" : "pkgcore", - "paludisRadio" : "paludis" - } - - # mapping from the system name to the radio button - # option -> widget name - systems = {} - systems.update(zip(system_radios.values(), system_radios.keys())) - - def __init__ (self, parent, cfg): + def __init__ (self, parent, cfg, set_console_font): """Constructor. @param parent: parent window @type parent: gtk.Window @param cfg: configuration object - @type cfg: gui_helper.Config""" + @type cfg: gui_helper.Config + @param set_console_font: function to call to set the console font + @type set_console_font: function(string)""" AbstractDialog.__init__(self, parent) # our config self.cfg = cfg + + # the console font setter + self.set_console_font = set_console_font # set the bg-color of the hint hintEB = self.tree.get_widget("hintEB") @@ -251,8 +244,9 @@ class PreferenceWindow (AbstractDialog): self.tree.get_widget(edit).\ set_text(self.cfg.get(self.edits[edit])) - # the system radios - self.tree.get_widget(self.systems[self.cfg.get("system_opt").lower()]).set_active(True) + # the console font button + self.consoleFontBtn = self.tree.get_widget("consoleFontBtn") + self.consoleFontBtn.set_font_name(self.cfg.get("consolefont_opt", section = self.cfg.const["gtk_sec"])) self.window.show_all() @@ -269,10 +263,10 @@ class PreferenceWindow (AbstractDialog): for edit in self.edits: self.cfg.set(self.edits[edit],self.tree.get_widget(edit).get_text()) - for radio in self.system_radios: - if self.tree.get_widget(radio).get_active(): - self.cfg.set("system_opt", self.system_radios[radio]) - + font = self.consoleFontBtn.get_font_name() + self.cfg.set("consolefont_opt", font, section = self.cfg.const["gtk_sec"]) + self.set_console_font(font) + def cb_ok_clicked(self, button): """Saves, writes to config-file and closes the window.""" self._save() @@ -743,9 +737,12 @@ class MainWindow (Window): def __init__ (self): """Build up window""" + # the title + self.main_title = "Portato (%s)" % VERSION + # main window stuff Window.__init__(self) - self.window.set_title(("Portato (%s)" % VERSION)) + self.window.set_title(self.main_title) mHeight = 800 if gtk.gdk.screen_height() <= 800: mHeight = 600 self.window.set_geometry_hints (self.window, min_width = 600, min_height = mHeight, max_height = gtk.gdk.screen_height(), max_width = gtk.gdk.screen_width()) @@ -836,7 +833,7 @@ class MainWindow (Window): self.console.set_scrollback_lines(1024) self.console.set_scroll_on_output(True) - self.console.set_font_from_string("Monospace 11") + self.console.set_font_from_string(self.cfg.get("consolefont_opt", self.cfg.const["gtk_sec"])) self.console.connect("button-press-event", self.cb_right_click) termScroll = gtk.VScrollbar(self.console.get_adjustment()) self.termHB.pack_start(self.console, True, True) @@ -927,11 +924,26 @@ class MainWindow (Window): def title_update (self, title): + def window_title_update (title): + if title is None or not self.cfg.get_boolean("updateTitle_opt", self.cfg.const["gui_sec"]): + self.window.set_title(self.main_title) + else: + title = title.strip() + if title[0] == '*': + self.window.set_title(self.main_title) + else: + space_idx = title.rfind(" ") + if space_idx != -1: + title = title[:space_idx] + + self.window.set_title(("Portato >>> %s" % title)) + def __update(title): if self.tray: self.tray.set_tooltip(title) - if title == None: + window_title_update(title) + if title is None: title = "Console" else: title = ("Console (%s)" % title) @@ -1100,7 +1112,7 @@ class MainWindow (Window): SearchWindow(self.window, packages, self.jump_to) def cb_preferences_clicked (self, button): - PreferenceWindow(self.window, self.cfg) + PreferenceWindow(self.window, self.cfg, self.console.set_font_from_string) return True def cb_about_clicked (self, button): diff --git a/portato/gui/gui_helper.py b/portato/gui/gui_helper.py index 9907a1c..a4d333c 100644 --- a/portato/gui/gui_helper.py +++ b/portato/gui/gui_helper.py @@ -49,10 +49,12 @@ class Config: # XXX: This needs to be replaced - the const-dict is just messy "newuse_opt" : "newuse", "syncCmd_opt" : "synccommand", "useTips_opt" : "showusetips", + "consolefont_opt" : "consolefont", "pkgIcons_opt" : "packageIcons", "system_opt" : "system", "systray_opt" : "showsystray", - "minimize_opt" : "hideonminimize" + "minimize_opt" : "hideonminimize", + "updateTitle_opt" : "updatetitle" } def __init__ (self, cfgFile): diff --git a/portato/gui/qt/windows.py b/portato/gui/qt/windows.py index 104a1ab..3eb3d31 100644 --- a/portato/gui/qt/windows.py +++ b/portato/gui/qt/windows.py @@ -183,7 +183,8 @@ class PreferenceWindow (Window): "testingCheck" : "testingPerVersion_opt", "pkgIconsCheck" : ("pkgIcons_opt", "qt_sec"), "minimizeCheck" : ("minimize_opt", "gui_sec"), - "systrayCheck" : ("systray_opt", "gui_sec") + "systrayCheck" : ("systray_opt", "gui_sec"), + "titleUpdateCheck" : ("updateTitle_opt", "gui_sec") } # all edits in the window @@ -591,7 +592,8 @@ class MainWindow (Window): def __init__ (self): Window.__init__(self) - self.setWindowTitle(("Portato (%s)" % VERSION)) + self.main_title = "Portato (%s)" % VERSION + self.setWindowTitle(self.main_title) self.statusbar.showMessage("Portato - A Portage GUI") self.doUpdate = False @@ -658,6 +660,21 @@ class MainWindow (Window): def _title_update (self, title): + def window_update (title): + if title is None or not self.cfg.get_boolean("updateTitle_opt", self.cfg.const["gui_sec"]): + self.setWindowTitle(self.main_title) + else: + title = title.strip() + if title[0] == '*': + self.setWindowTitle(self.main_title) + else: + space_idx = title.rfind(" ") + if space_idx != -1: + title = title[:space_idx] + + self.setWindowTitle(("Portato >>> %s" % title)) + + window_update(title) if title is None: if self.systray: self.systray.setToolTip("") title = "Console" diff --git a/portato/gui/templates/portato.glade b/portato/gui/templates/portato.glade index 8433fa0..a8fa4d0 100644 --- a/portato/gui/templates/portato.glade +++ b/portato/gui/templates/portato.glade @@ -404,49 +404,73 @@ 4 2 - + True - 1 - True - - - True - True - Installed - True - - - - False - - + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC - + True - True - Masked - True - - - False - 1 - + + + 2 + 2 + 3 + 5 + 5 + + + + + True - - True - True - Testing - True - - - - False - 2 - + + + 1 + 2 + GTK_FILL + 5 + + + + + True + GTK_JUSTIFY_CENTER + True + + + 2 + GTK_FILL + + 10 + + + + + True + True + <span foreground='red'><b>MISSING KEYWORD</b></span> + True + + + 1 + 2 + 1 + 2 + GTK_FILL + + + + + True + True + <b>Installed, but not in portage anymore</b> + True + 1 2 @@ -510,79 +534,55 @@ - - True - True - <b>Installed, but not in portage anymore</b> - True - - - 1 - 2 - 1 - 2 - GTK_FILL - - - - - True - True - <span foreground='red'><b>MISSING KEYWORD</b></span> - True - - - 1 - 2 - 1 - 2 - GTK_FILL - - - - - True - GTK_JUSTIFY_CENTER - True - - - 2 - GTK_FILL - - 10 - - - - + True + 1 + True - + + True + True + Installed + True + + + + False + - - - 1 - 2 - GTK_FILL - 5 - - - - - True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - + + True + True + Masked + True + + + + False + 1 + + + + True + True + Testing + True + + + False + 2 + + 1 2 - 2 - 3 - 5 - 5 + 1 + 2 + GTK_FILL @@ -890,492 +890,509 @@ True 5 - - True - 0 - - - True - 12 - - - True - - - True - Debug - True - - - - - - - - - True - <b>General Options</b> - True - - - label_item - - - - - - + True + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0 - + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 12 + 5 - + True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - True - Turn Use-Tips on - True - - + 0 - + True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Enable systray - True + 12 + + + True + + + True + Debug + True + + + + - - 1 - - + True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Hide on minimization (only if systray is enabled) - True + <b>General Options</b> + True - 2 + label_item - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - <b>Visual Options</b> - True - - - label_item - - - - - 1 - - - - - False - True - 0 - - - True - 12 - + True + 0 - - True - Portage - True - True - - - - + True - False - pkgCore - True - portageRadio + 12 + + + True + + + True + --deep + True + + + False + + + + + True + --newuse + True + + + False + 1 + + + + - - 1 - - + True - False - Paludis - True - portageRadio + <b>Update World Options</b> + True - 2 + label_item + + 1 + - - - - - True - <b>System Options</b> - True - - - label_item - - - - - 2 - - - - - True - 0 - - - True - 5 - 12 - 5 - + True + 0 - + True - Sync command: + 5 + 12 + 5 + + + True + + + True + Sync command: + + + False + + + + + True + + + 1 + + + + - - False - - + True + <b>Sync Options</b> + True - 1 + label_item + + 2 + - - - - - True - <b>Sync Options</b> - True - - - label_item - - - - - 3 - - - - - True - 0 - - - True - 12 - + True + 0 - + True - --deep - True + 5 + 12 + 5 + + + True + 10 + 2 + + + + + + + + + + + + True + + + 1 + 2 + 3 + 4 + + + + + True + 0 + File name to use, if package.use is a directory: + True + + + 3 + 4 + + + + + True + Add only exact version to package.use + True + + + 2 + 2 + 3 + + + + + True + Add only exact version to package.keywords + True + + + 2 + 5 + 6 + + + + + True + 0 + File name to use, if package.keywords is a directory: + True + + + 6 + 7 + + + + + True + + + 1 + 2 + 6 + 7 + + + + + True + + + 1 + 2 + 9 + 10 + + + + + True + 0 + File name to use, if package.mask/package.unmask is a directory: + True + + + 9 + 10 + + + + + True + Add only exact version to package.mask/package.unmask + True + + + 2 + 8 + 9 + + + + + True + + + True + 0 + GTK_SHADOW_OUT + + + True + 0 + <u>You may use the following placeholders:</u> + +<i>$(cat)</i>: category +<i>$(pkg)</i>: package name +<i>$(cat-1)/$(cat-2)</i>: first/second part of the category + True + + + + + + label_item + + + + + + + 2 + + + + + True + 0 + 5 + <u><i>Use-Flags</i></u> + True + True + + + 1 + 2 + 6 + + + + + True + 0 + 5 + <u><i>Testing Keywords</i></u> + True + True + + + 4 + 5 + 5 + + + + + True + 0 + 5 + <u><i>Masking Keywords</i></u> + True + True + + + 7 + 8 + 5 + + + + - - False - - + True - --newuse - True + <b>Use Flag and Keyword Options</b> + True - False - 1 + label_item + + 3 + + + False + - + True - <b>Update World Options</b> - True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + General - label_item + tab + False + False - - - 4 - - - - - True - 0 - + True - 5 + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 5 12 - 5 + 12 - + True - 10 - 2 - - - - - - - - - - - - True - - - 1 - 2 - 3 - 4 - - - - - True - 0 - File name to use, if package.use is a directory: - True - - - 3 - 4 - - + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - + True - Add only exact version to package.use + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Show emerge progress in title - similar to the console tab True - 2 - 2 - 3 + False - + True - Add only exact version to package.keywords + Turn Use-Tips on True - 2 - 5 - 6 - - - - - True - 0 - File name to use, if package.keywords is a directory: - True - - - 6 - 7 - - - - - True - - - 1 - 2 - 6 - 7 - - - - - True - - - 1 - 2 - 9 - 10 + False + 1 - + True - 0 - File name to use, if package.mask/package.unmask is a directory: - True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Enable systray + True - 9 - 10 + False + 2 - + True - Add only exact version to package.mask/package.unmask + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Hide on minimization (only if systray is enabled) True - 2 - 8 - 9 + False + 3 - + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 5 - + True - 0 - GTK_SHADOW_OUT - - - True - 0 - <u>You may use the following placeholders:</u> - -<i>$(cat)</i>: category -<i>$(pkg)</i>: package name -<i>$(cat-1)/$(cat-2)</i>: first/second part of the category - True - - - - - - label_item - - + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + Console Font + + + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Chose a console font + True + True + False + + + 1 + + - 2 - - - - - True - 0 - 5 - <u><i>Use-Flags</i></u> - True - True - - - 1 - 2 - 6 - - - - - True - 0 - 5 - <u><i>Testing Keywords</i></u> - True - True - - - 4 - 5 - 5 - - - - - True - 0 - 5 - <u><i>Masking Keywords</i></u> - True - True - - - 7 - 8 - 5 + False + 5 + 4 + + 1 + False + - + True - <b>Use Flag and Keyword Options</b> - True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Visual - label_item + tab + 1 + False + False - - 5 - diff --git a/portato/gui/templates/ui/PreferenceWindow.ui b/portato/gui/templates/ui/PreferenceWindow.ui index fbc4a37..a7cf96f 100644 --- a/portato/gui/templates/ui/PreferenceWindow.ui +++ b/portato/gui/templates/ui/PreferenceWindow.ui @@ -5,8 +5,8 @@ 0 0 - 570 - 729 + 563 + 699 @@ -20,229 +20,217 @@ 6 - - - General Options + + + 1 - - Qt::AlignLeading - - - - 9 - - - 0 - - - - - Debug - - - - - - - - - - Visual Options - - - - 9 - - - 0 - - - - - Use icons in package list - - - - - - - Show systray icon - - - - - - - Minimize to systray (only if systray icon is activated) - - - - - - - - - - Sync Options - - - - 9 - - - 6 - - - - - Sync command: - - - - - - - - - - - - - Update World Options - - - - 9 - - - 0 - - - - - --deep - - - - - - - --newuse - - - - - - - - - - Use Flag and Keyword Options - - - - 9 - - - 6 - - - - - <u><i>Masking Keywords</u></i> - - - - - - - <i><u>Use Flags</u></i> - - - - - - - portato - - - - - - - Add only exact version to package.keywords - - - - - - - File name to use, if package.keywords is a directory - - - - - - - File name to use if package.mask/.unmask is a directory - - - - - - - Add only exact version to package.use - - - - - - - portato - - - - - - - <i><u>Testing Keywords</u></i> - - - - - - - File name to use, if package.use is a directory - - - - - - - Add only exact version to package.mask/.unmask - - - - - - - portato - - - - - - - true - - - QFrame::StyledPanel - - - QFrame::Raised - - - <html><head><meta name="qrichtext" content="1" /><style type="text/css"> + + + General + + + + 9 + + + 6 + + + + + Debug + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + Portage + + + + 9 + + + 6 + + + + + Sync Options + + + + 9 + + + 6 + + + + + Sync command: + + + + + + + + + + + + + Update World Options + + + + 9 + + + 0 + + + + + --deep + + + + + + + --newuse + + + + + + + + + + Use Flag and Keyword Options + + + + 9 + + + 6 + + + + + <u><i>Masking Keywords</u></i> + + + + + + + <i><u>Use Flags</u></i> + + + + + + + portato + + + + + + + Add only exact version to package.keywords + + + + + + + File name to use, if package.keywords is a directory + + + + + + + File name to use if package.mask/.unmask is a directory + + + + + + + Add only exact version to package.use + + + + + + + portato + + + + + + + <i><u>Testing Keywords</u></i> + + + + + + + File name to use, if package.use is a directory + + + + + + + Add only exact version to package.mask/.unmask + + + + + + + portato + + + + + + + true + + + QFrame::StyledPanel + + + QFrame::Raised + + + <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'Sans Serif'; font-size:11pt; font-weight:400; font-style:normal; text-decoration:none;"> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" text-decoration: underline;">You may use the following placeholders:</span> </p> @@ -250,10 +238,68 @@ p, li { white-space: pre-wrap; } <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-style:italic;">$(cat)</span>: category</p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-style:italic;">$(pkg)</span>: package name</p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-style:italic;">$(cat-1)/$(cat-2)</span>: first/second part of the category</p></body></html> - - - - + + + + + + + + + + + Visual + + + + 9 + + + 6 + + + + + Use icons in package list + + + + + + + Show emerge progress in title - similar to the console tab + + + + + + + Show systray icon + + + + + + + Minimize to systray (only if systray icon is activated) + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + -- cgit v1.2.3-54-g00ecf