[orca] Fix for b.g.o. 586445 - Provide an 'About' dialog



commit 1a6ab966858944ed7c95f21b347bd671a6997e0a
Author: Joanmarie Diggs <joanmarie diggs gmail com>
Date:   Mon Jan 11 13:30:34 2010 -0500

    Fix for b.g.o. 586445 - Provide an 'About' dialog

 src/orca/orca-mainwin.ui  |   58 ++++++++++++++++++++----------
 src/orca/orca_gui_main.py |   85 ++++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 123 insertions(+), 20 deletions(-)
---
diff --git a/src/orca/orca-mainwin.ui b/src/orca/orca-mainwin.ui
index 5b8dddb..4cc941b 100644
--- a/src/orca/orca-mainwin.ui
+++ b/src/orca/orca-mainwin.ui
@@ -1,46 +1,48 @@
 <?xml version="1.0"?>
-<!--*- mode: xml -*-->
 <interface>
+  <!-- interface-requires gtk+ 2.12 -->
+  <!-- interface-naming-policy toplevel-contextual -->
   <object class="GtkWindow" id="mainWindow">
     <property name="width_request">0</property>
     <property name="height_request">0</property>
     <property name="title" translatable="yes">Orca Screen Reader / Magnifier</property>
     <property name="default_width">300</property>
     <property name="default_height">40</property>
-    <signal handler="mainWindowDestroyed" name="destroy"/>
+    <signal name="destroy" handler="mainWindowDestroyed"/>
     <child>
       <object class="GtkTable" id="table1">
         <property name="visible">True</property>
-        <property name="n_rows">1</property>
-        <property name="n_columns">4</property>
+        <property name="n_columns">5</property>
         <child>
           <object class="GtkButton" id="preferencesButton">
+            <property name="label">gtk-preferences</property>
             <property name="visible">True</property>
             <property name="can_focus">True</property>
-            <property name="label">gtk-preferences</property>
+            <property name="receives_default">False</property>
             <property name="use_stock">True</property>
-            <signal handler="preferencesButtonClicked" name="clicked"/>
+            <signal name="clicked" handler="preferencesButtonClicked"/>
           </object>
           <packing>
-            <property name="x_options"/>
-            <property name="y_options"/>
+            <property name="x_options"></property>
+            <property name="y_options"></property>
             <property name="x_padding">5</property>
             <property name="y_padding">5</property>
           </packing>
         </child>
         <child>
           <object class="GtkButton" id="helpButton">
+            <property name="label">gtk-help</property>
             <property name="visible">True</property>
             <property name="can_focus">True</property>
-            <property name="label">gtk-help</property>
+            <property name="receives_default">False</property>
             <property name="use_stock">True</property>
-            <signal handler="helpButtonClicked" name="clicked"/>
+            <signal name="clicked" handler="helpButtonClicked"/>
           </object>
           <packing>
-            <property name="left_attach">3</property>
-            <property name="right_attach">4</property>
-            <property name="x_options"/>
-            <property name="y_options"/>
+            <property name="left_attach">4</property>
+            <property name="right_attach">5</property>
+            <property name="x_options"></property>
+            <property name="y_options"></property>
             <property name="x_padding">5</property>
             <property name="y_padding">5</property>
           </packing>
@@ -54,23 +56,41 @@
           <packing>
             <property name="left_attach">2</property>
             <property name="right_attach">3</property>
-            <property name="y_options"/>
+            <property name="y_options"></property>
             <property name="x_padding">5</property>
           </packing>
         </child>
         <child>
           <object class="GtkButton" id="quitButton">
+            <property name="label">gtk-quit</property>
             <property name="visible">True</property>
             <property name="can_focus">True</property>
-            <property name="label">gtk-quit</property>
+            <property name="receives_default">False</property>
             <property name="use_stock">True</property>
-            <signal handler="quitButtonClicked" name="clicked"/>
+            <signal name="clicked" handler="quitButtonClicked"/>
           </object>
           <packing>
             <property name="left_attach">1</property>
             <property name="right_attach">2</property>
-            <property name="x_options"/>
-            <property name="y_options"/>
+            <property name="x_options"></property>
+            <property name="y_options"></property>
+            <property name="y_padding">5</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkButton" id="aboutButton">
+            <property name="label">gtk-about</property>
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="receives_default">True</property>
+            <property name="use_stock">True</property>
+            <signal name="clicked" handler="aboutButtonClicked"/>
+          </object>
+          <packing>
+            <property name="left_attach">3</property>
+            <property name="right_attach">4</property>
+            <property name="x_options"></property>
+            <property name="y_options"></property>
             <property name="y_padding">5</property>
           </packing>
         </child>
diff --git a/src/orca/orca_gui_main.py b/src/orca/orca_gui_main.py
index 0e860a4..db3e446 100644
--- a/src/orca/orca_gui_main.py
+++ b/src/orca/orca_gui_main.py
@@ -1,6 +1,6 @@
 # Orca
 #
-# Copyright 2005-2009 Sun Microsystems Inc.
+# Copyright 2005-2010 Sun Microsystems Inc.
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Library General Public
@@ -34,10 +34,16 @@ import orca
 import orca_gtkbuilder
 import platform
 
+from orca_i18n import _           # for gettext support
+
 OS = None
 
 class OrcaMainGUI(orca_gtkbuilder.GtkBuilderWrapper):
 
+    def __init__(self, fileName, windowName):
+        orca_gtkbuilder.GtkBuilderWrapper.__init__(self, fileName, windowName)
+        self.aboutDialog = None
+
     def init(self):
         pass
 
@@ -67,6 +73,83 @@ class OrcaMainGUI(orca_gtkbuilder.GtkBuilderWrapper):
 
         self.get_widget("mainWindow").hide()
 
+    def aboutButtonClicked(self, widget):
+        """Signal handler for the "clicked" signal for the aboutButton
+        GtkButton widget. The user has clicked the About button.
+        Call the method to bring up the About dialog.
+
+        Arguments:
+        - widget: the component that generated the signal.
+        """
+
+        if self.aboutDialog:
+            return
+
+        authors = ["Marc Mulcahy",
+                   "Willie Walker <william walker sun com>",
+                   "Mike Pedersen <michael pedersen sun com>",
+                   "Rich Burridge <rich burridge sun com>",
+                   "Joanmarie Diggs <joanmarie diggs gmail com>"]
+        # Translators: This is used in the Orca About dialog.
+        #
+        documenters = [_("The Orca Team")]
+        # Translators: This text is used in the Orca About dialog.
+        #
+        comments = _("A free, open source scriptable screen reader, which " \
+                     "provides access to applications and toolkits that " \
+                     "support AT-SPI (e.g., the GNOME desktop).")
+        # Translators: This text is used in the Orca About dialog.
+        #
+        copyrights = _("Copyright (c) 2005-2010 Sun Microsystems Inc. \n" \
+                       "Copyright (c) 2005-2008 Google Inc. \n" \
+                       "Copyright (c) 2008, 2009 Eitan Isaacson \n" \
+                       "Copyright (c) 2006-2009 Brailcom, o.p.s. \n" \
+                       "Copyright (c) 2001, 2002 BAUM Retec, A.G.")
+        # Translators: This text is used in the Orca About dialog. Please
+        # translate it to contain your name. And thank you for your work!
+        #
+        translatorCredits = _("translator-credits")
+        # Translators: This text is used in the Orca About dialog. Orca is
+        # licensed under GPL2+.
+        #
+        licenseText = \
+            _("Orca is free software; you can redistribute it and/or\n" \
+              "modify it under the terms of the GNU Library General\n" \
+              "Public License as published by the Free Software Foundation;\n" \
+              "either version 2 of the License, or (at your option) any\n" \
+              "later version.\n" \
+              "\n" \
+              "Orca is distributed in the hope that it will be useful, but\n" \
+              "WITHOUT ANY WARRANTY; without even the implied warranty of\n" \
+              "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See\n" \
+              "the GNU Library General Public License for more details.\n" \
+              "\n" \
+              "You should have received a copy of the GNU Library General\n" \
+              "Public License along with Orca; if not, write to the\n" \
+              "Free Software Foundation, Inc., Franklin Street, Fifth Floor," \
+              "\nBoston MA  02110-1301 USA.")
+        url = "http://live.gnome.org/Orca";
+
+        self.aboutDialog = gtk.AboutDialog()
+        self.aboutDialog.set_authors(authors)
+        self.aboutDialog.set_documenters(documenters)
+        self.aboutDialog.set_translator_credits(translatorCredits)
+        self.aboutDialog.set_comments(comments)
+        self.aboutDialog.set_copyright(copyrights)
+        self.aboutDialog.set_license(licenseText)
+        self.aboutDialog.set_logo_icon_name('orca')
+        self.aboutDialog.set_name('Orca')
+        self.aboutDialog.set_version(platform.version)
+        self.aboutDialog.set_website(url)
+        self.aboutDialog.connect('response', self.aboutDialogOnResponse)
+        self.aboutDialog.show()
+
+    def aboutDialogOnResponse(self, dialog, responseID):
+        """Signal handler for the About Dialog's "response" signal."""
+
+        dialog.destroy()
+        self.aboutDialog = None
+
     def helpButtonClicked(self, widget):
         """Signal handler for the "clicked" signal for the helpButton
            GtkButton widget. The user has clicked the Help button.



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