From 14becdcb2d4c40becb3eb263aa3ff793d8aff3c9 Mon Sep 17 00:00:00 2001 From: Necoro <> Date: Mon, 15 Oct 2007 19:40:10 +0000 Subject: added tooltips, added ebuild.lang, restructured constants --- portato/constants.py | 72 +++++++++-------- portato/gui/gtk/basic.py | 4 +- portato/gui/gtk/windows.py | 7 +- portato/gui/templates/portato.glade | 150 +++++++++++++++++++++++++++++++++--- 4 files changed, 184 insertions(+), 49 deletions(-) (limited to 'portato') diff --git a/portato/constants.py b/portato/constants.py index 3aea05d..c76b737 100644 --- a/portato/constants.py +++ b/portato/constants.py @@ -14,62 +14,72 @@ Constants used through out the program. Mainly different pathes. These should be set during the installation. +@var APP: the application name +@type APP: string @var VERSION: the current version @type VERSION: string +@var HOME: shortcut to $HOME +@type HOME: string +@var SU_COMMAND: command to execute to "su" +@type SU_COMMAND: string +@var USE_CATAPULT: use the catapult backend or the normal ones +@type USE_CATAPULT: boolean + +@var FRONTENDS: the list of frontends which are installed +@type FRONTENDS: string[] +@var STD_FRONTEND: the frontend uses as the default, i.e. if no other one is given on the cmdline +@type STD_FRONTEND: string + @var CONFIG_DIR: The configuration directory. @type CONFIG_DIR: string @var CONFIG_LOCATION: L{CONFIG_DIR} plus name of the config file. @type CONFIG_LOCATION: string -@var DATA_DIR: Directory which contains several data files (e.g. ui-files). -@type DATA_DIR: string -@var PLUGIN_DIR: Directory containing the plugin xmls. -@type PLUGIN_DIR: string -@var XSD_DIR: Directory containing the plugin-xml schema. -@type XSD_DIR: string -@var XSD_LOCATION: Path of the plugin schema. -@type XSD_LOCATION: string + @var ICON_DIR: directory containing the icons @type ICON_DIR: string @var APP_ICON: the path of the application icon @type APP_ICON: string + +@var DATA_DIR: Directory which contains all shared files. +@type DATA_DIR: string @var LOCALE_DIR: the path to the directory where the locale files (*.mo) are stored. @type LOCALE_DIR: string -@var FRONTENDS: the list of frontends which are installed -@type FRONTENDS: string[] -@var STD_FRONTEND: the frontend uses as the default, i.e. if no other one is given on the cmdline -@type STD_FRONTEND: string -@var SU_COMMAND: command to execute to "su" -@type SU_COMMAND: string +@var PLUGIN_DIR: Directory containing the plugin xmls. +@type PLUGIN_DIR: string +@var SETTINGS_DIR: Directory containing the user specific settings. +@type SETTINGS_DIR: string +@var TEMPLATE_DIR: Directory containing the UI template files. +@type TEMPLATE_DIR: string +@var XSD_LOCATION: Path of the plugin schema. +@type XSD_LOCATION: string """ import os from os.path import join as pjoin -HOME = os.environ["HOME"] - +# general APP = "portato" VERSION = "9999" +HOME = os.environ["HOME"] +SU_COMMAND = "gksu -D 'Portato'" +USE_CATAPULT = True -SETTINGS_DIR = pjoin(HOME, "."+APP) +# frontends +FRONTENDS = ["gtk"] +STD_FRONTEND = "gtk" +# config CONFIG_DIR = "/etc/portato/" CONFIG_LOCATION = pjoin(CONFIG_DIR, "portato.cfg") -VAR_DIR = "/var/portato/" - -DATA_DIR = "portato/gui/templates/" -PLUGIN_DIR = "plugins/" - -XSD_DIR = "./" -XSD_LOCATION = pjoin(XSD_DIR, "plugin.xsd") - +# icons ICON_DIR = "icons/" APP_ICON = pjoin(ICON_DIR, "portato-icon.png") +# misc dirs +DATA_DIR = "./" LOCALE_DIR = "i18n/" +PLUGIN_DIR = pjoin(DATA_DIR, "plugins/") +SETTINGS_DIR = pjoin(HOME, "."+APP) +TEMPLATE_DIR = "portato/gui/templates/" -FRONTENDS = ["gtk"] -STD_FRONTEND = "gtk" - -SU_COMMAND = "gksu -D 'Portato'" - -USE_CATAPULT = True +XSD_LOCATION = pjoin(DATA_DIR, "plugin.xsd") diff --git a/portato/gui/gtk/basic.py b/portato/gui/gtk/basic.py index 3737607..02caaf5 100644 --- a/portato/gui/gtk/basic.py +++ b/portato/gui/gtk/basic.py @@ -19,11 +19,11 @@ import gobject from functools import wraps -from ...constants import DATA_DIR, APP_ICON, APP, LOCALE_DIR +from ...constants import TEMPLATE_DIR, APP_ICON, APP, LOCALE_DIR gtk.glade.bindtextdomain (APP, LOCALE_DIR) gtk.glade.textdomain (APP) -GLADE_FILE = DATA_DIR+"portato.glade" +GLADE_FILE = TEMPLATE_DIR+"portato.glade" class Window (object): def __init__ (self): diff --git a/portato/gui/gtk/windows.py b/portato/gui/gtk/windows.py index dc3dc35..456d962 100644 --- a/portato/gui/gtk/windows.py +++ b/portato/gui/gtk/windows.py @@ -28,7 +28,7 @@ from gettext import lgettext as _ # our backend stuff from ... import listener, plugin from ...helper import debug, warning, error, unique_array -from ...constants import CONFIG_LOCATION, VERSION, APP_ICON +from ...constants import CONFIG_LOCATION, VERSION, APP_ICON, DATA_DIR from ...backend import flags, system from ...backend.exceptions import PackageNotFoundException, BlockedException @@ -390,10 +390,11 @@ class EbuildWindow (AbstractDialog): self.view = gtk.TextView(self.buf) else: man = gtksourceview2.LanguageManager() + man.set_search_path(man.get_search_path()+[DATA_DIR]) language = man.get_language("ebuild") if language is None: - info(_("No ebuild language file installed. Falling back to shell.")) + warning(_("No ebuild language file installed. Falling back to shell.")) language = man.get_language("sh") # set buffer and view @@ -713,10 +714,8 @@ class PackageTable: if self.doEmerge: # set emerge-button-label if not self.actual_package().is_installed(): - self.emergeBtn.set_label(_("E_merge")) self.unmergeBtn.set_sensitive(False) else: - self.emergeBtn.set_label(_("Re_merge")) self.unmergeBtn.set_sensitive(True) self.table.show_all() diff --git a/portato/gui/templates/portato.glade b/portato/gui/templates/portato.glade index 76d437c..a42bc25 100644 --- a/portato/gui/templates/portato.glade +++ b/portato/gui/templates/portato.glade @@ -93,7 +93,7 @@ True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_ENTER_NOTIFY_MASK - gtk-go-forward + gtk-add @@ -107,7 +107,7 @@ True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_ENTER_NOTIFY_MASK - gtk-go-back + gtk-remove @@ -513,19 +513,69 @@ True - E_merge - True + Mark package for installation 0 + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + gtk-add + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + Add to E_merge Queue + True + True + + + 1 + + + + True - _Unmerge - True + Mark package for deinstallation 0 + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + gtk-remove + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + Add to _Unmerge Queue + True + True + + + 1 + + + + 1 @@ -534,10 +584,33 @@ True - Re_vert - True 0 + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + gtk-undo + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + Re_vert + True + + + 1 + + + + 2 @@ -546,6 +619,7 @@ True + Show the ebuild for this package E_build True 0 @@ -718,19 +792,69 @@ True - E_merge - True + Install all packages in the "Emerge Queue" 0 + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + gtk-add + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + E_merge + True + True + + + 1 + + + + True - _Unmerge - True + Deinstall all packages in the "Unmerge Queue" 0 + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + gtk-remove + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + _Unmerge + True + True + + + 1 + + + + 1 @@ -739,6 +863,7 @@ True + Calculate the packages which will be installed during an "update world" Update _World True 0 @@ -751,6 +876,7 @@ True + Remove the selected package from the queue _Remove True 0 -- cgit v1.2.3-54-g00ecf