[orca] Fix for bug #577705 - When Orca starts doesn't get to the component with focus.



commit 122195bf2f9905df05462857e0c7a3de3448f132
Author: Alejandro Leiva <aleiva emergya es>
Date:   Thu Aug 5 13:09:28 2010 +0200

    Fix for bug #577705 - When Orca starts doesn't get to the component with focus.

 po/POTFILES.in              |    1 +
 src/orca/Makefile.am        |    9 +++-
 src/orca/orca-splash.png    |  Bin 0 -> 106028 bytes
 src/orca/orca-splash.ui     |   24 +++++++++
 src/orca/orca.py            |   20 +++++++
 src/orca/orca_gui_splash.py |  119 +++++++++++++++++++++++++++++++++++++++++++
 src/orca/settings.py        |    4 ++
 7 files changed, 176 insertions(+), 1 deletions(-)
---
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 93c9394..558961f 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -33,6 +33,7 @@ src/orca/orca.py
 [type: gettext/glade]src/orca/orca-preferences-warning.ui
 [type: gettext/glade]src/orca/orca-quit.ui
 [type: gettext/glade]src/orca/orca-setup.ui
+[type: gettext/glade]src/orca/orca-splash.ui
 src/orca/phonnames.py
 src/orca/rolenames.py
 src/orca/script_utilities.py
diff --git a/src/orca/Makefile.am b/src/orca/Makefile.am
index 80d2e07..5c3b714 100644
--- a/src/orca/Makefile.am
+++ b/src/orca/Makefile.am
@@ -3,6 +3,7 @@ orca_SCRIPTS = \
 
 orcadir=$(bindir)
 uidir=$(datadir)/orca/ui
+gfxdir=$(datadir)/orca/gfx
 
 orca_pathdir=$(pyexecdir)
 
@@ -47,6 +48,7 @@ orca_python_PYTHON = \
 	orca_gui_find.py \
 	orca_gui_main.py \
 	orca_gui_prefs.py \
+	orca_gui_splash.py \
 	orca_i18n.py \
 	orca_prefs.py \
 	orca_quit.py \
@@ -82,7 +84,12 @@ ui_DATA = \
 	orca-mainwin.ui \
 	orca-preferences-warning.ui \
 	orca-quit.ui \
-	orca-setup.ui
+	orca-setup.ui \
+	orca-splash.ui
+
+gfx_DATA = \
+	orca-splash.png
 
 EXTRA_DIST = \
 	$(ui_DATA)
+	$(gfx_DATA)
diff --git a/src/orca/orca-splash.png b/src/orca/orca-splash.png
new file mode 100644
index 0000000..a0d9919
Binary files /dev/null and b/src/orca/orca-splash.png differ
diff --git a/src/orca/orca-splash.ui b/src/orca/orca-splash.ui
new file mode 100644
index 0000000..19e609e
--- /dev/null
+++ b/src/orca/orca-splash.ui
@@ -0,0 +1,24 @@
+<?xml version="1.0"?>
+<!--*- mode: xml -*-->
+<interface>
+  <object class="GtkWindow" id="splashWindow">
+    <property name="title" translatable="yes">Orca</property>
+    <property name="modal">True</property>
+    <property name="window_position">center</property>
+    <property name="type_hint">splashscreen</property>
+    <property name="skip_taskbar_hint">True</property>
+    <property name="skip_pager_hint">True</property>
+    <property name="decorated">False</property>
+    <property name="deletable">False</property>
+    <accessibility>
+    </accessibility>
+    <child>
+      <object class="GtkVBox" id="splash_vbox">
+        <property name="visible">True</property>
+        <property name="orientation">vertical</property>
+        <accessibility>
+        </accessibility>
+      </object>
+    </child>
+  </object>
+</interface>
diff --git a/src/orca/orca.py b/src/orca/orca.py
index 330bc5a..c882140 100644
--- a/src/orca/orca.py
+++ b/src/orca/orca.py
@@ -1553,6 +1553,24 @@ def showFindGUI(script=None, inputEvent=None):
     except:
         debug.printException(debug.LEVEL_SEVERE)
 
+def showSplashGUI(script=None, inputEvent=None):
+    """Displays a splash screen.
+
+    Returns True to indicate the input event has been consumed.
+    """
+
+    try:
+        module = __import__(settings.splashModule,
+                            globals(),
+                            locals(),
+                            [''])
+        module.showSplashUI()
+    except:
+        debug.printException(debug.LEVEL_SEVERE)
+
+    return True
+
+
 # If True, this module has been initialized.
 #
 _initialized = False
@@ -1594,6 +1612,8 @@ def init(registry):
     registry.registerEventListener(_onMouseButton,
                                    "mouse:button")
 
+    showSplashGUI()
+
     loadUserSettings()
 
     masks = []
diff --git a/src/orca/orca_gui_splash.py b/src/orca/orca_gui_splash.py
new file mode 100644
index 0000000..8cef788
--- /dev/null
+++ b/src/orca/orca_gui_splash.py
@@ -0,0 +1,119 @@
+# Orca
+#
+# Copyright 2010 Consorcio Fernando de los Rios.
+# Author: Alejandro Leiva <aleiva emergya es>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Library General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Library General Public License for more details.
+#
+# You should have received a copy of the GNU Library General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., Franklin Street, Fifth Floor,
+# Boston MA  02110-1301 USA.
+
+"""Splash screen window."""
+
+__id__        = "$Id$"
+__version__   = "$Revision$"
+__date__      = "$Date$"
+__copyright__ = "Copyright (c) 2010 Consorcio Fernando de los Rios."
+__license__   = "LGPL"
+
+import os
+import sys
+import debug
+import gtk
+import gobject
+import locale
+
+import orca_gtkbuilder
+import orca_state
+import platform
+
+from orca_i18n import _
+
+OS = None
+
+class OrcaSplashGUI(orca_gtkbuilder.GtkBuilderWrapper):
+
+    def __init__(self, fileName, windowName):
+        """
+        Initialize the Orca splash GUI.
+
+        Arguments:
+        - fileName: name of the GtkBuilder file.
+        - windowName: name of the component to get from the GtkBuilder file.
+        """
+
+        orca_gtkbuilder.GtkBuilderWrapper.__init__(self, fileName, windowName)
+
+    def init(self):
+        """ Initialize the splash screen dialog. """
+
+        self.activeScript = orca_state.activeScript
+
+    def showGUI(self):
+        """ Show the splash screen dialog. """
+
+        imageFile = os.path.join(platform.prefix,
+                    platform.datadirname,
+                    platform.package,
+                    "gfx",
+                    "orca-splash.png")
+
+        image = gtk.Image()
+        image.set_from_file(imageFile)
+
+        splashScreen = self.get_widget("splashWindow")
+        box = self.get_widget("splash_vbox")
+        box.pack_start(image, True, True)
+
+        try:
+            splashScreen.realize()
+        except:
+            debug.printException(debug.LEVEL_FINEST)
+
+        splashScreen.set_transient_for(None)
+        box.grab_focus()
+        splashScreen.show_all()
+
+        while gtk.events_pending():
+            gtk.main_iteration()
+
+        gobject.timeout_add(3000, splashScreen.hide)
+
+        return splashScreen
+            
+
+def showSplashUI():
+    global OS
+
+    if not OS:
+        uiFile = os.path.join(platform.prefix,
+                platform.datadirname,
+                platform.package,
+                "ui",
+                "orca-splash.ui")
+
+        OS = OrcaSplashGUI(uiFile, "splashScreen")
+        OS.init()
+
+    OS.showGUI()
+
+def main():
+    locale.setlocale(locale.LC_ALL, '')
+
+    showSplashUI()
+
+    gtk.main()
+    sys.exit(0)
+
+if __name__ == "__main__":
+    main()
diff --git a/src/orca/settings.py b/src/orca/settings.py
index 07abc5f..6147c14 100644
--- a/src/orca/settings.py
+++ b/src/orca/settings.py
@@ -225,6 +225,10 @@ quitModule = "orca_quit"
 #
 findModule = "orca_gui_find"
 
+# The name of the module that holds the splash screen.
+#
+splashModule = "orca_gui_splash"
+
 # A list of keys that can serve as the Orca modifier key.  The list is
 # so we can provide better cross platform support (e.g., Sun keyboard
 # vs. PC-104 keyboard layouts).  When any of these keys is pressed,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]