~ubuntu-branches/ubuntu/oneiric/gnome-orca/oneiric

« back to all changes in this revision

Viewing changes to src/orca/orca_quit.py

  • Committer: Package Import Robot
  • Author(s): Luke Yelavich
  • Date: 2011-09-05 16:11:45 UTC
  • mfrom: (0.9.39 upstream)
  • Revision ID: package-import@ubuntu.com-20110905161145-1hi5a6dva201le8l
Tags: 3.1.90-0ubuntu1
* New upstream release
  - General
    + Fix for bug 626254 - Migrate from PyGTK to PyGObject introspection-
      based bindings
    + Fix for bug 652485 - Remove deprecated (or soon-to-be deprecated)
      GtkBox, GtkTable, etc. and use GtkGrid instead.
    + Fix for bug 657646 - Default stopSpeechOnActiveDescendantChanged()
      should not be so restrictive
    + Fix for bug 657579 - Orca should not present tooltips shown as a
      result of mouse hovering unless the 'present tooltips' setting is
      enabled
  - Gecko
    + Fix for bug 599361 - Significant delay building up the contents
      of certain lines in Firefox
    + Fix for bug 650904 - Work around AT-SPI2 caching issues with
      Thunderbird
  - New and updated translations (THANKS EVERYONE!!!):
    + ca            Catalan              Gil Forcada
    + de            German               Mario Blättermann
    + es            Spanish              Gonzalo Sanhueza, Jorge González
    + id            Indonesian           Andika Triwidada
    + nb            Norwegian bokmål     Kjartan Maraas
    + sr            Serbian              Miroslav Nikolić
    + ug            Uyghur               Abduxukur Abdurixit, Sahran
* debian/control: Update build-depends and package depends as follows:
  - Removed python-gtk2 deps
  - Depend on python-gobject >= 2.91.3
  - Depend on python-pyatspi2 >= 2.1.90
  - Depend on gobject introspection bindings for GTK3, wnck3, and pango

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Orca
2
 
#
3
 
# Copyright 2006-2008 Sun Microsystems Inc.
4
 
#
5
 
# This library is free software; you can redistribute it and/or
6
 
# modify it under the terms of the GNU Lesser General Public
7
 
# License as published by the Free Software Foundation; either
8
 
# version 2.1 of the License, or (at your option) any later version.
9
 
#
10
 
# This library is distributed in the hope that it will be useful,
11
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
 
# Lesser General Public License for more details.
14
 
#
15
 
# You should have received a copy of the GNU Lesser General Public
16
 
# License along with this library; if not, write to the
17
 
# Free Software Foundation, Inc., Franklin Street, Fifth Floor,
18
 
# Boston MA  02110-1301 USA.
19
 
 
20
 
"""Displays a GUI for the user to quit Orca."""
21
 
 
22
 
__id__        = "$Id$"
23
 
__version__   = "$Revision$"
24
 
__date__      = "$Date$"
25
 
__copyright__ = "Copyright (c) 2005-2008 Sun Microsystems Inc."
26
 
__license__   = "LGPL"
27
 
 
28
 
import os
29
 
import sys
30
 
import debug
31
 
import gtk
32
 
import locale
33
 
 
34
 
import orca
35
 
import orca_gtkbuilder
36
 
import orca_state
37
 
import orca_platform
38
 
import settings
39
 
 
40
 
OS = None
41
 
 
42
 
class OrcaQuitGUI(orca_gtkbuilder.GtkBuilderWrapper):
43
 
 
44
 
    def init(self):
45
 
        pass
46
 
 
47
 
    def showGUI(self):
48
 
        """Show the Orca quit GUI dialog. This assumes that the GUI has 
49
 
        already been created.
50
 
        """
51
 
 
52
 
        quitDialog = self.get_widget("quitDialog")
53
 
        quitDialog.connect('delete_event', self.quitDialogClosed)
54
 
 
55
 
        # Set the current time on the quit GUI dialog so that it'll
56
 
        # get focus. set_user_time is a new call in pygtk 2.9.2 or later.
57
 
        # It's surronded by a try/except block here so that if it's not found,
58
 
        # then we can fail gracefully.
59
 
        #
60
 
        try:
61
 
            quitDialog.realize()
62
 
            ts = orca_state.lastInputEventTimestamp
63
 
            if ts == 0:
64
 
                ts = gtk.get_current_event_time()
65
 
            quitDialog.window.set_user_time(ts)
66
 
        except AttributeError:
67
 
            debug.printException(debug.LEVEL_FINEST)
68
 
 
69
 
        quitDialog.hide()
70
 
        quitDialog.show()
71
 
 
72
 
    def quitNoButtonClicked(self, widget):
73
 
        """Signal handler for the "clicked" signal for the quitNoButton
74
 
           GtkButton widget. The user has clicked the No button.
75
 
           Don't quit Orca. Just hide the quit dialog and recreate the
76
 
           Orca main window.
77
 
 
78
 
        Arguments:
79
 
        - widget: the component that generated the signal.
80
 
        """
81
 
 
82
 
        self.get_widget("quitDialog").hide()
83
 
        if settings.showMainWindow:
84
 
            orca.showMainWindowGUI()
85
 
 
86
 
    def quitYesButtonClicked(self, widget):
87
 
        """Signal handler for the "clicked" signal for the quitYesButton
88
 
           GtkButton widget. The user has clicked the Yes button.
89
 
           Call the orca.shutdown() method to gracefully terminate Orca.
90
 
 
91
 
        Arguments:
92
 
        - widget: the component that generated the signal.
93
 
        """
94
 
 
95
 
        orca.shutdown()
96
 
 
97
 
    def quitDialogClosed(self, widget, data):
98
 
        """Signal handler for the 'delete' signal. This is the equivalent
99
 
        of the 'no' button being pressed."""
100
 
 
101
 
        self.quitNoButtonClicked(None)
102
 
 
103
 
    def quitDialogDestroyed(self, widget):
104
 
        """Signal handler for the "destroyed" signal for the quitDialog
105
 
           GtkWindow widget. Reset OS to None, so that the GUI can be rebuilt
106
 
           from the GtkBuilder file the next time the user wants to display
107
 
           the quit dialog GUI.
108
 
 
109
 
        Arguments:
110
 
        - widget: the component that generated the signal.
111
 
        """
112
 
 
113
 
        global OS
114
 
 
115
 
        OS = None
116
 
 
117
 
def showQuitUI():
118
 
    global OS
119
 
 
120
 
    if not OS:
121
 
        uiFile = os.path.join(orca_platform.prefix,
122
 
                              orca_platform.datadirname,
123
 
                              orca_platform.package,
124
 
                              "ui",
125
 
                              "orca-quit.ui")
126
 
        OS = OrcaQuitGUI(uiFile, "quitDialog")
127
 
        OS.init()
128
 
 
129
 
    OS.showGUI()
130
 
 
131
 
def main():
132
 
    locale.setlocale(locale.LC_ALL, '')
133
 
 
134
 
    showQuitUI()
135
 
 
136
 
    gtk.main()
137
 
    sys.exit(0)
138
 
 
139
 
if __name__ == "__main__":
140
 
    main()