summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornecoro <>2007-08-10 02:22:40 +0000
committernecoro <>2007-08-10 02:22:40 +0000
commita6a5cace4864c37b7a820c89540f85069d842521 (patch)
tree72379c0060510ee05635466fcb41c86191497077
parente3e2339cf2156a12b61b91f56c9ea596df57198e (diff)
downloadportato-a6a5cace4864c37b7a820c89540f85069d842521.tar.gz
portato-a6a5cace4864c37b7a820c89540f85069d842521.tar.bz2
portato-a6a5cace4864c37b7a820c89540f85069d842521.zip
add splash screen
Diffstat (limited to '')
-rw-r--r--doc/Changelog1
-rw-r--r--i18n/de_DE.po93
-rw-r--r--i18n/messages.pot83
-rw-r--r--portato/backend/__init__.py5
-rw-r--r--portato/backend/package.py2
-rw-r--r--portato/backend/system_interface.py2
-rw-r--r--portato/constants.py2
-rw-r--r--portato/gui/gtk/__init__.py20
-rw-r--r--portato/gui/gtk/basic.py94
-rw-r--r--portato/gui/gtk/splash.py49
-rw-r--r--portato/gui/gtk/windows.py104
-rw-r--r--portato/gui/templates/portato.glade58
12 files changed, 355 insertions, 158 deletions
diff --git a/doc/Changelog b/doc/Changelog
index fe86098..0893e48 100644
--- a/doc/Changelog
+++ b/doc/Changelog
@@ -3,6 +3,7 @@ next:
- i18n
- new threading model for the emerge process
- minor enhancements
+- added splash screen
0.8.1:
- bugfixes
diff --git a/i18n/de_DE.po b/i18n/de_DE.po
index 3f1a053..f61b737 100644
--- a/i18n/de_DE.po
+++ b/i18n/de_DE.po
@@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Portato\n"
"POT-Creation-Date: \n"
-"PO-Revision-Date: 2007-08-07 00:07-0800\n"
+"PO-Revision-Date: 2007-08-09 20:20-0800\n"
"Last-Translator: René 'Necoro' Neumann <necoro@necoro.net>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@@ -36,7 +36,7 @@ msgstr "_Emerge"
#: portato/gui/templates/portato.glade:89
#: portato/gui/templates/portato.glade:719
-#: portato/gui/gtk/windows.py:764
+#: portato/gui/gtk/windows.py:690
msgid "E_merge"
msgstr "E_merge"
@@ -133,26 +133,26 @@ msgid "Installed"
msgstr "Installiert"
#: portato/gui/templates/portato.glade:641
-#: portato/gui/gtk/windows.py:741
-#: portato/gui/gtk/windows.py:744
-#: portato/gui/gtk/windows.py:747
-#: portato/gui/gtk/windows.py:852
-#: portato/gui/gtk/windows.py:855
-#: portato/gui/gtk/windows.py:862
-#: portato/gui/gtk/windows.py:866
+#: portato/gui/gtk/windows.py:667
+#: portato/gui/gtk/windows.py:670
+#: portato/gui/gtk/windows.py:673
+#: portato/gui/gtk/windows.py:778
+#: portato/gui/gtk/windows.py:781
+#: portato/gui/gtk/windows.py:788
+#: portato/gui/gtk/windows.py:792
msgid "Masked"
msgstr "Masked"
#: portato/gui/templates/portato.glade:655
-#: portato/gui/gtk/windows.py:754
-#: portato/gui/gtk/windows.py:757
-#: portato/gui/gtk/windows.py:824
-#: portato/gui/gtk/windows.py:829
+#: portato/gui/gtk/windows.py:680
+#: portato/gui/gtk/windows.py:683
+#: portato/gui/gtk/windows.py:750
+#: portato/gui/gtk/windows.py:755
msgid "Testing"
msgstr "Testing"
#: portato/gui/templates/portato.glade:682
-#: portato/gui/gtk/windows.py:201
+#: portato/gui/gtk/windows.py:127
msgid "Package"
msgstr "Paket"
@@ -161,12 +161,12 @@ msgid "_Remove"
msgstr "_Löschen"
#: portato/gui/templates/portato.glade:777
-#: portato/gui/gtk/windows.py:1067
+#: portato/gui/gtk/windows.py:1003
msgid "Queue"
msgstr "Queue"
#: portato/gui/templates/portato.glade:805
-#: portato/gui/gtk/windows.py:1164
+#: portato/gui/gtk/windows.py:1100
msgid "Console"
msgstr "Konsole"
@@ -364,74 +364,94 @@ msgstr "Kann etc-proposals nicht starten. Kein grafisches Frontend installiert."
msgid "Cannot start etc-proposals. Not root!"
msgstr "Kann etc-proposals nicht starten. Nur root kann das!"
-#: portato/gui/gtk/windows.py:146
+#: portato/gui/gtk/windows.py:72
msgid "Plugin"
msgstr "Plugin"
-#: portato/gui/gtk/windows.py:149
+#: portato/gui/gtk/windows.py:75
msgid "Authors"
msgstr "Entwickler"
-#: portato/gui/gtk/windows.py:154
-#: portato/gui/gtk/windows.py:200
-#: portato/gui/gtk/windows.py:615
+#: portato/gui/gtk/windows.py:80
+#: portato/gui/gtk/windows.py:126
+#: portato/gui/gtk/windows.py:541
msgid "Enabled"
msgstr "Aktiviert"
-#: portato/gui/gtk/windows.py:299
+#: portato/gui/gtk/windows.py:225
msgid "Results"
msgstr "Ergebnisse"
-#: portato/gui/gtk/windows.py:568
+#: portato/gui/gtk/windows.py:494
msgid "<no description>"
msgstr "<keine Beschreibung>"
-#: portato/gui/gtk/windows.py:597
+#: portato/gui/gtk/windows.py:523
msgid "This is an expanded use flag and cannot be selected"
msgstr "Dies ist ein \"Expanded Use Flag\" und kann daher nicht ausgewählt werden."
-#: portato/gui/gtk/windows.py:616
+#: portato/gui/gtk/windows.py:542
msgid "Flag"
msgstr "Flag"
-#: portato/gui/gtk/windows.py:617
+#: portato/gui/gtk/windows.py:543
msgid "Description"
msgstr "Beschreibung"
-#: portato/gui/gtk/windows.py:696
+#: portato/gui/gtk/windows.py:622
#, python-format
msgid "Package could not be found: %s"
msgstr "Paket konnte nicht gefunden werden: %s"
-#: portato/gui/gtk/windows.py:767
+#: portato/gui/gtk/windows.py:693
msgid "Re_merge"
msgstr "Re_merge"
-#: portato/gui/gtk/windows.py:1070
+#: portato/gui/gtk/windows.py:890
+msgid "Creating Database"
+msgstr "Erstelle Datenbank"
+
+#: portato/gui/gtk/windows.py:895
+msgid "Loading Config"
+msgstr "Lade Konfiguration"
+
+#: portato/gui/gtk/windows.py:906
+msgid "Loading Plugins"
+msgstr "Lade Plugins"
+
+#: portato/gui/gtk/windows.py:919
+msgid "Finishing startup"
+msgstr "Erledige letzte Handgriffe :)"
+
+#: portato/gui/gtk/windows.py:1006
msgid "Options"
msgstr "Optionen"
-#: portato/gui/gtk/windows.py:1088
+#: portato/gui/gtk/windows.py:1024
msgid "Categories"
msgstr "Kategorien"
-#: portato/gui/gtk/windows.py:1103
+#: portato/gui/gtk/windows.py:1039
msgid "Packages"
msgstr "Pakete"
-#: portato/gui/gtk/windows.py:1166
+#: portato/gui/gtk/windows.py:1102
#, python-format
msgid "Console (%(title)s)"
msgstr "Konsole (%(title)s)"
-#: portato/gui/gtk/windows.py:1218
+#: portato/gui/gtk/windows.py:1154
msgid "use flags"
msgstr "Use Flags"
-#: portato/gui/gtk/windows.py:1225
+#: portato/gui/gtk/windows.py:1161
msgid "masking keywords"
msgstr "Masking Keywords"
+#: portato/gui/gtk/__init__.py:20
+msgid "Loading Portage"
+msgstr "Lade Portage"
+
#: portato/gui/gtk/wrapper.py:37
msgid "oneshot"
msgstr "oneshot"
@@ -527,6 +547,11 @@ msgstr ""
"Exception:\n"
"%s"
+#: portato/gui/gtk/splash.py:34
+#, python-format
+msgid "... is starting up: %s"
+msgstr "... startet: %s"
+
#: portato/gui/gui_helper.py:240
#, python-format
msgid "Catched KeyError => %s seems not to be an available category. Have you played with rsync-excludes?"
diff --git a/i18n/messages.pot b/i18n/messages.pot
index aa542b1..272221d 100644
--- a/i18n/messages.pot
+++ b/i18n/messages.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2007-08-07 00:06-0700\n"
+"POT-Creation-Date: 2007-08-09 20:17-0700\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -39,7 +39,7 @@ msgid "_Emerge"
msgstr ""
#: portato/gui/templates/portato.glade:89
-#: portato/gui/templates/portato.glade:719 portato/gui/gtk/windows.py:764
+#: portato/gui/templates/portato.glade:719 portato/gui/gtk/windows.py:690
msgid "E_merge"
msgstr ""
@@ -135,20 +135,20 @@ msgstr ""
msgid "Installed"
msgstr ""
-#: portato/gui/templates/portato.glade:641 portato/gui/gtk/windows.py:741
-#: portato/gui/gtk/windows.py:744 portato/gui/gtk/windows.py:747
-#: portato/gui/gtk/windows.py:852 portato/gui/gtk/windows.py:855
-#: portato/gui/gtk/windows.py:862 portato/gui/gtk/windows.py:866
+#: portato/gui/templates/portato.glade:641 portato/gui/gtk/windows.py:667
+#: portato/gui/gtk/windows.py:670 portato/gui/gtk/windows.py:673
+#: portato/gui/gtk/windows.py:778 portato/gui/gtk/windows.py:781
+#: portato/gui/gtk/windows.py:788 portato/gui/gtk/windows.py:792
msgid "Masked"
msgstr ""
-#: portato/gui/templates/portato.glade:655 portato/gui/gtk/windows.py:754
-#: portato/gui/gtk/windows.py:757 portato/gui/gtk/windows.py:824
-#: portato/gui/gtk/windows.py:829
+#: portato/gui/templates/portato.glade:655 portato/gui/gtk/windows.py:680
+#: portato/gui/gtk/windows.py:683 portato/gui/gtk/windows.py:750
+#: portato/gui/gtk/windows.py:755
msgid "Testing"
msgstr ""
-#: portato/gui/templates/portato.glade:682 portato/gui/gtk/windows.py:201
+#: portato/gui/templates/portato.glade:682 portato/gui/gtk/windows.py:127
msgid "Package"
msgstr ""
@@ -156,11 +156,11 @@ msgstr ""
msgid "_Remove"
msgstr ""
-#: portato/gui/templates/portato.glade:777 portato/gui/gtk/windows.py:1067
+#: portato/gui/templates/portato.glade:777 portato/gui/gtk/windows.py:1003
msgid "Queue"
msgstr ""
-#: portato/gui/templates/portato.glade:805 portato/gui/gtk/windows.py:1164
+#: portato/gui/templates/portato.glade:805 portato/gui/gtk/windows.py:1100
msgid "Console"
msgstr ""
@@ -350,73 +350,93 @@ msgstr ""
msgid "Cannot start etc-proposals. Not root!"
msgstr ""
-#: portato/gui/gtk/windows.py:146
+#: portato/gui/gtk/windows.py:72
msgid "Plugin"
msgstr ""
-#: portato/gui/gtk/windows.py:149
+#: portato/gui/gtk/windows.py:75
msgid "Authors"
msgstr ""
-#: portato/gui/gtk/windows.py:154 portato/gui/gtk/windows.py:200
-#: portato/gui/gtk/windows.py:615
+#: portato/gui/gtk/windows.py:80 portato/gui/gtk/windows.py:126
+#: portato/gui/gtk/windows.py:541
msgid "Enabled"
msgstr ""
-#: portato/gui/gtk/windows.py:299
+#: portato/gui/gtk/windows.py:225
msgid "Results"
msgstr ""
-#: portato/gui/gtk/windows.py:568
+#: portato/gui/gtk/windows.py:494
msgid "<no description>"
msgstr ""
-#: portato/gui/gtk/windows.py:597
+#: portato/gui/gtk/windows.py:523
msgid "This is an expanded use flag and cannot be selected"
msgstr ""
-#: portato/gui/gtk/windows.py:616
+#: portato/gui/gtk/windows.py:542
msgid "Flag"
msgstr ""
-#: portato/gui/gtk/windows.py:617
+#: portato/gui/gtk/windows.py:543
msgid "Description"
msgstr ""
-#: portato/gui/gtk/windows.py:696
+#: portato/gui/gtk/windows.py:622
#, python-format
msgid "Package could not be found: %s"
msgstr ""
-#: portato/gui/gtk/windows.py:767
+#: portato/gui/gtk/windows.py:693
msgid "Re_merge"
msgstr ""
-#: portato/gui/gtk/windows.py:1070
+#: portato/gui/gtk/windows.py:890
+msgid "Creating Database"
+msgstr ""
+
+#: portato/gui/gtk/windows.py:895
+msgid "Loading Config"
+msgstr ""
+
+#: portato/gui/gtk/windows.py:906
+msgid "Loading Plugins"
+msgstr ""
+
+#: portato/gui/gtk/windows.py:919
+msgid "Finishing startup"
+msgstr ""
+
+#: portato/gui/gtk/windows.py:1006
msgid "Options"
msgstr ""
-#: portato/gui/gtk/windows.py:1088
+#: portato/gui/gtk/windows.py:1024
msgid "Categories"
msgstr ""
-#: portato/gui/gtk/windows.py:1103
+#: portato/gui/gtk/windows.py:1039
msgid "Packages"
msgstr ""
-#: portato/gui/gtk/windows.py:1166
+#: portato/gui/gtk/windows.py:1102
#, python-format
msgid "Console (%(title)s)"
msgstr ""
-#: portato/gui/gtk/windows.py:1218
+#: portato/gui/gtk/windows.py:1154
msgid "use flags"
msgstr ""
-#: portato/gui/gtk/windows.py:1225
+#: portato/gui/gtk/windows.py:1161
msgid "masking keywords"
msgstr ""
+#: portato/gui/gtk/__init__.py:20
+msgid "Loading Portage"
+msgstr ""
+
#: portato/gui/gtk/wrapper.py:37
msgid "oneshot"
msgstr ""
@@ -508,6 +528,11 @@ msgid ""
"%s"
msgstr ""
+#: portato/gui/gtk/splash.py:34
+#, python-format
+msgid "... is starting up: %s"
+msgstr ""
+
#: portato/gui/gui_helper.py:240
#, python-format
msgid ""
diff --git a/portato/backend/__init__.py b/portato/backend/__init__.py
index c3de443..d1d61e8 100644
--- a/portato/backend/__init__.py
+++ b/portato/backend/__init__.py
@@ -16,14 +16,13 @@ from system_interface import SystemInterface
SYSTEM = "portage" # the name of the current system
_sys = None # the SystemInterface-instance
-class SystemWrapper (object, SystemInterface):
+class SystemWrapper (SystemInterface):
"""This is a wrapper to the different system interfaces, allowing the direct import via C{from portato.backend import system}.
With this wrapper a change of the system is propagated to all imports."""
def __getattribute__ (self, name):
"""Just pass all attribute accesses directly to _sys."""
- global _sys
- return eval ("_sys.%s" % name)
+ return getattr(_sys, name)
def set_system (new_sys):
"""Sets the current system to a new one.
diff --git a/portato/backend/package.py b/portato/backend/package.py
index 72cd671..ef0be11 100644
--- a/portato/backend/package.py
+++ b/portato/backend/package.py
@@ -13,7 +13,7 @@
from portato.backend import system
import flags
-class Package:
+class Package (object):
"""This is a class abstracting a normal package which can be installed."""
def __init__ (self, cpv):
diff --git a/portato/backend/system_interface.py b/portato/backend/system_interface.py
index 3ce401c..4e9618b 100644
--- a/portato/backend/system_interface.py
+++ b/portato/backend/system_interface.py
@@ -10,7 +10,7 @@
#
# Written by René 'Necoro' Neumann <necoro@necoro.net>
-class SystemInterface:
+class SystemInterface (object):
def split_cpv (self, cpv):
"""Splits a cpv into all its parts.
diff --git a/portato/constants.py b/portato/constants.py
index 80e7452..c21b0a5 100644
--- a/portato/constants.py
+++ b/portato/constants.py
@@ -32,6 +32,8 @@ These should be set during the installation.
@type ICON_DIR: string
@var APP_ICON: the path of the application icon
@type APP_ICON: 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
diff --git a/portato/gui/gtk/__init__.py b/portato/gui/gtk/__init__.py
index 41161d6..0714f39 100644
--- a/portato/gui/gtk/__init__.py
+++ b/portato/gui/gtk/__init__.py
@@ -10,21 +10,29 @@
#
# Written by René 'Necoro' Neumann <necoro@necoro.net>
-import gtk
-from portato import plugin
-from portato.backend import system
-from windows import MainWindow, SearchWindow, EbuildWindow
+from gettext import lgettext as _
+
from exception_handling import register_ex_handler
def run ():
+ from splash import SplashScreen
try:
- m = MainWindow()
+ s = SplashScreen(_("Loading Portage"))
register_ex_handler()
+ s.show()
+ from windows import MainWindow
+ m = MainWindow(s)
+ s.hide()
m.main()
except KeyboardInterrupt:
pass
-def show_ebuild (pkg):
+def show_ebuild (pkg):
+ import gtk
+ from portato import plugin
+ from portato.backend import system
+ from windows import SearchWindow, EbuildWindow
+
plugin.load_plugins("gtk")
register_ex_handler()
diff --git a/portato/gui/gtk/basic.py b/portato/gui/gtk/basic.py
new file mode 100644
index 0000000..882e40a
--- /dev/null
+++ b/portato/gui/gtk/basic.py
@@ -0,0 +1,94 @@
+# -*- coding: utf-8 -*-
+#
+# File: portato/gui/gtk/basic.py
+# This file is part of the Portato-Project, a graphical portage-frontend.
+#
+# Copyright (C) 2006-2007 René 'Necoro' Neumann
+# This is free software. You may redistribute copies of it under the terms of
+# the GNU General Public License version 2.
+# There is NO WARRANTY, to the extent permitted by law.
+#
+# Written by René 'Necoro' Neumann <necoro@necoro.net>
+
+# gtk stuff
+import gtk
+import gtk.glade
+import gobject
+
+from portato.constants import DATA_DIR, APP_ICON, APP, LOCALE_DIR
+
+gtk.glade.bindtextdomain (APP, LOCALE_DIR)
+gtk.glade.textdomain (APP)
+GLADE_FILE = DATA_DIR+"portato.glade"
+
+class Window (object):
+ def __init__ (self):
+ self.tree = self.get_tree(self.__class__.__name__)
+ self.tree.signal_autoconnect(self)
+ self.window = self.tree.get_widget(self.__class__.__name__)
+ self.window.set_icon_from_file(APP_ICON)
+
+ @staticmethod
+ def watch_cursor (func):
+ """This is a decorator for functions being so time consuming, that it is appropriate to show the watch-cursor.
+ @attention: this function relies on the gtk.Window-Object being stored as self.window"""
+ def wrapper (self, *args, **kwargs):
+ ret = None
+ def cb_idle():
+ try:
+ ret = func(self, *args, **kwargs)
+ finally:
+ self.window.window.set_cursor(None)
+ return False
+
+ watch = gtk.gdk.Cursor(gtk.gdk.WATCH)
+ self.window.window.set_cursor(watch)
+ gobject.idle_add(cb_idle)
+ return ret
+
+ wrapper.__dict__ = func.__dict__
+ wrapper.__name__ = func.__name__
+ wrapper.__doc__ = func.__doc__
+ return wrapper
+
+ def get_tree (self, name):
+ return gtk.glade.XML(GLADE_FILE, name)
+
+class AbstractDialog (Window):
+ """A class all our dialogs get derived from. It sets useful default vars and automatically handles the ESC-Button."""
+
+ def __init__ (self, parent):
+ """Constructor.
+
+ @param parent: the parent window
+ @type parent: gtk.Window"""
+
+ Window.__init__(self)
+
+ # set parent
+ self.window.set_transient_for(parent)
+
+ # catch the ESC-key
+ self.window.connect("key-press-event", self.cb_key_pressed)
+
+ def cb_key_pressed (self, widget, event):
+ """Closes the window if ESC is pressed."""
+ keyname = gtk.gdk.keyval_name(event.keyval)
+ if keyname == "Escape":
+ self.close()
+ return True
+ else:
+ return False
+
+ def close (self, *args):
+ self.window.destroy()
+
+class Popup (object):
+
+ def __init__ (self, name, parent):
+ self.tree = gtk.glade.XML(GLADE_FILE, root = name)
+ self.tree.signal_autoconnect(parent)
+ self._popup = self.tree.get_widget(name)
+
+ def popup (self, *args):
+ self._popup.popup(*args)
diff --git a/portato/gui/gtk/splash.py b/portato/gui/gtk/splash.py
new file mode 100644
index 0000000..aa4a3ea
--- /dev/null
+++ b/portato/gui/gtk/splash.py
@@ -0,0 +1,49 @@
+# -*- coding: utf-8 -*-
+#
+# File: portato/gui/gtk/splash.py
+# This file is part of the Portato-Project, a graphical portage-frontend.
+#
+# Copyright (C) 2007 René 'Necoro' Neumann
+# This is free software. You may redistribute copies of it under the terms of
+# the GNU General Public License version 2.
+# There is NO WARRANTY, to the extent permitted by law.
+#
+# Written by René 'Necoro' Neumann <necoro@necoro.net>
+import gtk
+import gobject
+from gettext import lgettext as _
+
+from portato.constants import VERSION, APP_ICON
+from basic import Window
+
+class SplashScreen (Window):
+
+ def __init__ (self, startStr = ""):
+ Window.__init__(self)
+
+ self.image = self.tree.get_widget("image")
+ self.genLabel = self.tree.get_widget("generalLabel")
+ self.descrLabel = self.tree.get_widget("descrLabel")
+
+ self.image.set_from_file(APP_ICON)
+ self.genLabel.set_label("<b><big>Portato %s ...</big></b>" % VERSION)
+
+ self.set_descr(startStr)
+
+ def set_descr (self, string):
+ self.descrLabel.set_label(_("... is starting up: %s") % string)
+ self.do_iteration()
+
+ def do_iteration (self):
+ while gtk.events_pending():
+ gtk.main_iteration()
+
+ def show (self):
+ self.window.show_all()
+ self.do_iteration()
+
+ def hide (self):
+ self.window.hide()
+ self.do_iteration()
+
+ __call__ = set_descr
diff --git a/portato/gui/gtk/windows.py b/portato/gui/gtk/windows.py
index 5d61f92..74f7058 100644
--- a/portato/gui/gtk/windows.py
+++ b/portato/gui/gtk/windows.py
@@ -11,14 +11,17 @@
# Written by René 'Necoro' Neumann <necoro@necoro.net>
# gtk stuff
-import pygtk
import gtk
-import gtk.glade
import gobject
+# other
+import types, logging
+from subprocess import Popen
+from gettext import lgettext as _
+
# our backend stuff
from portato.helper import *
-from portato.constants import CONFIG_LOCATION, VERSION, DATA_DIR, APP_ICON, APP, LOCALE_DIR
+from portato.constants import CONFIG_LOCATION, VERSION, APP_ICON
from portato.backend import flags, system
from portato.backend.exceptions import *
@@ -27,89 +30,12 @@ from portato import plugin
# more GUI stuff
from portato.gui.gui_helper import Database, Config, EmergeQueue
+from basic import Window, AbstractDialog, Popup
from dialogs import *
from wrapper import GtkTree, GtkConsole
from usetips import UseTips
from exception_handling import GtkThread
-# other
-import types, logging
-from subprocess import Popen
-from gettext import lgettext as _
-
-gtk.glade.bindtextdomain (APP, LOCALE_DIR)
-gtk.glade.textdomain (APP)
-GLADE_FILE = DATA_DIR+"portato.glade"
-
-class Window:
- def __init__ (self):
- self.tree = self.get_tree(self.__class__.__name__)
- self.tree.signal_autoconnect(self)
- self.window = self.tree.get_widget(self.__class__.__name__)
- self.window.set_icon_from_file(APP_ICON)
-
- @staticmethod
- def watch_cursor (func):
- """This is a decorator for functions being so time consuming, that it is appropriate to show the watch-cursor.
- @attention: this function relies on the gtk.Window-Object being stored as self.window"""
- def wrapper (self, *args, **kwargs):
- ret = None
- def cb_idle():
- try:
- ret = func(self, *args, **kwargs)
- finally:
- self.window.window.set_cursor(None)
- return False
-
- watch = gtk.gdk.Cursor(gtk.gdk.WATCH)
- self.window.window.set_cursor(watch)
- gobject.idle_add(cb_idle)
- return ret
- return wrapper
-
- def get_tree (self, name):
- return gtk.glade.XML(GLADE_FILE, name)
-
-class Popup:
-
- def __init__ (self, name, parent):
- self.tree = gtk.glade.XML(GLADE_FILE, root = name)
- self.tree.signal_autoconnect(parent)
- self._popup = self.tree.get_widget(name)
-
- def popup (self, *args):
- self._popup.popup(*args)
-
-
-class AbstractDialog (Window):
- """A class all our dialogs get derived from. It sets useful default vars and automatically handles the ESC-Button."""
-
- def __init__ (self, parent):
- """Constructor.
-
- @param parent: the parent window
- @type parent: gtk.Window"""
-
- Window.__init__(self)
-
- # set parent
- self.window.set_transient_for(parent)
-
- # catch the ESC-key
- self.window.connect("key-press-event", self.cb_key_pressed)
-
- def cb_key_pressed (self, widget, event):
- """Closes the window if ESC is pressed."""
- keyname = gtk.gdk.keyval_name(event.keyval)
- if keyname == "Escape":
- self.close()
- return True
- else:
- return False
-
- def close (self, *args):
- self.window.destroy()
-
class AboutWindow (AbstractDialog):
"""A window showing the "about"-informations."""
@@ -935,9 +861,12 @@ class MainWindow (Window):
QUEUE_PAGE = 1
CONSOLE_PAGE = 2
- def __init__ (self):
+ def __init__ (self, splash = None):
"""Build up window"""
+ if splash is None:
+ splash = lambda x: True
+
# the title
self.main_title = "Portato (%s)" % VERSION
@@ -958,10 +887,12 @@ class MainWindow (Window):
self.logWindow = LogWindow(self.window)
# package db
+ splash(_("Creating Database"))
self.db = Database()
self.db.populate()
# config
+ splash(_("Loading Config"))
try:
self.cfg = Config(CONFIG_LOCATION)
except IOError, e:
@@ -972,6 +903,8 @@ class MainWindow (Window):
gtk.link_button_set_uri_hook(lambda btn, x: Popen([self.cfg.get("browserCmd", section = "GUI"), btn.get_uri()]))
# set plugins and plugin-menu
+ splash(_("Loading Plugins"))
+
plugin.load_plugins("gtk")
menus = plugin.get_plugin_queue().get_plugin_menus()
if menus:
@@ -983,6 +916,8 @@ class MainWindow (Window):
item.connect("activate", m.call)
pluginMenu.append(item)
+ splash(_("Finishing startup"))
+
# set vpaned position
vpaned = self.tree.get_widget("vpaned")
vpaned.set_position(int(mHeight/2))
@@ -1006,7 +941,7 @@ class MainWindow (Window):
# notebook
self.notebook = self.tree.get_widget("notebook")
- self.window.show_all()
+ #self.window.show_all()
# table
self.packageTable = PackageTable(self)
@@ -1040,7 +975,8 @@ class MainWindow (Window):
self.queue = EmergeQueue(console = self.console, tree = self.queueTree, db = self.db, title_update = self.title_update, threadClass = GtkThread)
self.window.maximize()
-
+ self.window.show_all()
+
def show_package (self, *args, **kwargs):
self.packageTable.update(*args, **kwargs)
self.notebook.set_current_page(self.PKG_PAGE)
diff --git a/portato/gui/templates/portato.glade b/portato/gui/templates/portato.glade
index 31d5805..fe57c9a 100644
--- a/portato/gui/templates/portato.glade
+++ b/portato/gui/templates/portato.glade
@@ -1805,4 +1805,62 @@ uses code from: Daniel J. Popowich</property>
</widget>
</child>
</widget>
+ <widget class="GtkWindow" id="SplashScreen">
+ <property name="width_request">300</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="resizable">False</property>
+ <property name="window_position">GTK_WIN_POS_CENTER_ALWAYS</property>
+ <property name="type_hint">GDK_WINDOW_TYPE_HINT_SPLASHSCREEN</property>
+ <property name="skip_taskbar_hint">True</property>
+ <property name="skip_pager_hint">True</property>
+ <property name="urgency_hint">True</property>
+ <property name="focus_on_map">False</property>
+ <property name="decorated">False</property>
+ <property name="deletable">False</property>
+ <child>
+ <widget class="GtkAlignment" id="alignment7">
+ <property name="visible">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="top_padding">20</property>
+ <property name="bottom_padding">20</property>
+ <property name="left_padding">20</property>
+ <property name="right_padding">20</property>
+ <child>
+ <widget class="GtkVBox" id="vbox3">
+ <property name="visible">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <child>
+ <widget class="GtkImage" id="image">
+ <property name="visible">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="stock">gtk-missing-image</property>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="generalLabel">
+ <property name="visible">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="label">label</property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="descrLabel">
+ <property name="visible">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="label">label</property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
</glade-interface>