[ Avaa Bypassed ]




Upload:

Command:

www-data@18.224.33.135: ~ $
# Orca
#
# Copyright 2005-2009 Sun Microsystems Inc.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser 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.

"""Displays a GUI for the Orca Find window"""

__id__        = "$Id$"
__version__   = "$Revision$"
__date__      = "$Date$"
__copyright__ = "Copyright (c) 2005-2009 Sun Microsystems Inc."
__license__   = "LGPL"

import os
import sys
from gi.repository import Gtk
import locale

from . import find
from . import guilabels
from . import orca_gtkbuilder
from . import orca_state
from . import orca_platform

OS = None

class OrcaFindGUI(orca_gtkbuilder.GtkBuilderWrapper):

    def __init__(self, fileName, windowName):
        """Initialize the Orca configuration 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)

        # Initialize variables to None to keep pylint happy.
        #
        self.activeScript = None
        self.caseSensitive = None
        self.matchEntireWord = None
        self.searchBackwards = None
        self.searchString = None
        self.startAtTop = None
        self.windowWrap = None

    def init(self):
        # Initialize the dialog box controls.
        self.searchString = ""
        self.searchBackwards = False
        self.caseSensitive = False
        self.matchEntireWord = False
        self.windowWrap = True
        self.startAtTop = False

        self.activeScript = orca_state.activeScript

    def showGUI(self):
        """Show the Orca Find dialog. This assumes that the GUI has
        already been created.
        """

        findDialog = self.get_widget("findDialog")
        ts = orca_state.lastInputEvent.timestamp
        if ts == 0:
            ts = Gtk.get_current_event_time()
        findDialog.present_with_time(ts)

        # Populate the dialog box from the previous searchQuery, should
        # one exist.  Note:  This is necessary because we are destroying
        # the dialog (rather than merely hiding it) before performing the
        # search.

        try:
            searchForEntry = self.get_widget("searchForEntry")
            searchForEntry.set_text(orca_state.searchQuery.searchString)
            searchForEntry.select_region(0, len(searchForEntry.get_text()))
            if orca_state.searchQuery.startAtTop:
                self.get_widget("topRadioButton").set_active(True)
            self.get_widget("matchCaseCheckbox").set_active(\
                orca_state.searchQuery.caseSensitive)
            self.get_widget("matchEntireWordCheckbox").set_active(\
                orca_state.searchQuery.matchEntireWord)
            self.get_widget("wrapAroundCheckbox").set_active(\
                orca_state.searchQuery.windowWrap)
            self.get_widget("searchBackwardsCheckbox").set_active(\
                orca_state.searchQuery.searchBackwards)
        except:
            pass

    def searchForEntryChanged(self, widget):
        """Signal handler for the "changed" signal for the
           searchForEntry GtkEntry widget. The user has changed
           the string to be searched for.

        Arguments:
        - widget: the component that generated the signal.
        """

        self.searchString = widget.get_text()
        findButton = self.get_widget("findButton")
        if len(self.searchString) > 0:
            findButton.set_sensitive(True)
        else:
            findButton.set_sensitive(False)

    def startingPointChanged(self, widget):
        """Signal handler for the "toggled" signal for the
           currentLocationRadioButton or topRadioButton GtkRadioButton
           widgets. The user has toggled the starting point for the search.

        Arguments:
        - widget: the component that generated the signal.
        """

        if widget.get_active():
            if widget.get_label() == guilabels.FIND_START_AT_CURRENT_LOCATION:
                self.startAtTop = False
            else:
                self.startAtTop = True

    def matchCaseChecked(self, widget):
        """Signal handler for the "toggled" signal for the
           matchCaseCheckbox GtkCheckButton widget. The user has
           [un]checked the "Match Case" checkbox.

        Arguments:
        - widget: the component that generated the signal.
        """

        self.caseSensitive = widget.get_active()

    def matchEntireWordChecked(self, widget):
        """Signal handler for the "toggled" signal for the
           matchEntireWordCheckbox GtkCheckButton widget.
           The user has [un]checked the "Match entire word"
           checkbox.

        Arguments:
        - widget: the component that generated the signal.
        """

        self.matchEntireWord = widget.get_active()

    def searchBackwardsChecked(self, widget):
        """Signal handler for the "toggled" signal for the
           searchBackwardsCheckbox GtkCheckButton widget.
           The user has [un]checked the "Search backwards"
           checkbox.

        Arguments:
        - widget: the component that generated the signal.
        """

        self.searchBackwards = widget.get_active()

    def wrapAroundChecked(self, widget):
        """Signal handler for the "toggled" signal for the
           wrapAroundCheckbox GtkCheckButton widget. The user has
           [un]checked the "Wrap around" checkbox.

        Arguments:
        - widget: the component that generated the signal.
        """

        self.windowWrap = widget.get_active()

    def closeButtonClicked(self, widget):
        """Signal handler for the "clicked" signal for the cancelButton
           GtkButton widget. The user has clicked the Cancel button.
           Hide the dialog.

        Arguments:
        - widget: the component that generated the signal.
        """

        self.get_widget("findDialog").hide()

    def findButtonClicked(self, widget):
        """Signal handler for the "clicked" signal for the findButton
           GtkButton widget. The user has clicked the Find button.
           Call the method to begin the search.

        Arguments:
        - widget: the component that generated the signal.
        """

        orca_state.searchQuery = find.SearchQuery()
        orca_state.searchQuery.searchString = self.searchString
        orca_state.searchQuery.searchBackwards = self.searchBackwards
        orca_state.searchQuery.caseSensitive = self.caseSensitive
        orca_state.searchQuery.matchEntireWord = self.matchEntireWord
        orca_state.searchQuery.startAtTop = self.startAtTop
        orca_state.searchQuery.windowWrap = self.windowWrap

        self.activeScript.findCommandRun = True

        # Merely hiding the dialog causes the find to take place before
        # the original window has fully regained focus.
        self.get_widget("findDialog").destroy()


    def findDialogDestroyed(self, widget):
        """Signal handler for the "destroyed" signal for the findDialog
           GtkWindow widget. Reset OS to None.

        Arguments:
        - widget: the component that generated the signal.
        """

        global OS

        OS = None

def showFindUI():
    global OS

    if not OS:
        uiFile = os.path.join(orca_platform.datadir,
                              orca_platform.package,
                              "ui",
                              "orca-find.ui")
        OS = OrcaFindGUI(uiFile, "findDialog")
        OS.init()

    OS.showGUI()

def main():
    locale.setlocale(locale.LC_ALL, '')

    showFindUI()

    Gtk.main()
    sys.exit(0)

if __name__ == "__main__":
    main()

Filemanager

Name Type Size Permission Actions
__pycache__ Folder 0755
backends Folder 0755
scripts Folder 0755
__init__.py File 115 B 0644
acss.py File 3.49 KB 0644
bookmarks.py File 8.37 KB 0644
braille.py File 59.87 KB 0644
braille_generator.py File 20.5 KB 0644
braille_rolenames.py File 10.33 KB 0644
brlmon.py File 6.45 KB 0644
brltablenames.py File 7.15 KB 0644
caret_navigation.py File 13.67 KB 0644
chat.py File 33.63 KB 0644
chnames.py File 23.03 KB 0644
cmdnames.py File 55.65 KB 0644
colornames.py File 38.13 KB 0644
common_keyboardmap.py File 6.64 KB 0644
debug.py File 17.16 KB 0644
desktop_keyboardmap.py File 4.62 KB 0644
event_manager.py File 31.81 KB 0644
eventsynthesizer.py File 17.82 KB 0644
find.py File 12.77 KB 0644
flat_review.py File 51.84 KB 0644
formatting.py File 53.94 KB 0644
generator.py File 59.09 KB 0644
guilabels.py File 45.78 KB 0644
input_event.py File 36.41 KB 0644
keybindings.py File 16.39 KB 0644
keynames.py File 9.71 KB 0644
label_inference.py File 19.38 KB 0644
laptop_keyboardmap.py File 4.61 KB 0644
liveregions.py File 21.55 KB 0644
logger.py File 1.97 KB 0644
mathsymbols.py File 88.14 KB 0644
messages.py File 140.32 KB 0644
mouse_review.py File 18.91 KB 0644
notification_messages.py File 6.18 KB 0644
object_properties.py File 32.74 KB 0644
orca.py File 25 KB 0644
orca_gtkbuilder.py File 5.35 KB 0644
orca_gui_commandlist.py File 4.19 KB 0644
orca_gui_find.py File 8.12 KB 0644
orca_gui_navlist.py File 6.66 KB 0644
orca_gui_prefs.py File 139.07 KB 0644
orca_gui_profile.py File 4.06 KB 0644
orca_i18n.py File 3.18 KB 0644
orca_platform.py File 1.41 KB 0644
orca_state.py File 2.1 KB 0644
phonnames.py File 2.76 KB 0644
pronunciation_dict.py File 2.61 KB 0644
punctuation_settings.py File 13.64 KB 0644
script.py File 19.04 KB 0644
script_manager.py File 13.31 KB 0644
script_utilities.py File 183.59 KB 0644
settings.py File 12.82 KB 0644
settings_manager.py File 20.73 KB 0644
sound.py File 5.17 KB 0644
sound_generator.py File 11.99 KB 0644
speech.py File 11.4 KB 0644
speech_generator.py File 108.24 KB 0644
speechdispatcherfactory.py File 24.54 KB 0644
speechserver.py File 7.41 KB 0644
spellcheck.py File 10.07 KB 0644
structural_navigation.py File 122.53 KB 0644
text_attribute_names.py File 28.62 KB 0644
tutorialgenerator.py File 30.41 KB 0644