[orca/cfr-gnome3-experimental] Beginning work on a cross-platform toolkit implementation:
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca/cfr-gnome3-experimental] Beginning work on a cross-platform toolkit implementation:
- Date: Fri, 1 Apr 2011 12:54:45 +0000 (UTC)
commit 9c6a3badee56cfdb4929ad2d0a0804e4c210f35d
Author: Joanmarie Diggs <joanmarie diggs gmail com>
Date: Fri Apr 1 08:43:07 2011 -0400
Beginning work on a cross-platform toolkit implementation:
* Gtk2, Gtk3, and Qt
* Basic support for rendering Orca's gui components for the
following widgets:
- HBox, VBox, Table, Frame
- Checkbox, Radio button, Push Button
- Slider, Spinner
- Entry, Combobox
- Tree
- Statusbar
- Window, Message dialog
* Initial tests
configure.in | 5 +
src/orca/Makefile.am | 5 +-
src/orca/gui/Makefile.am | 10 +
src/orca/gui/toolkit.py | 132 ++++++++
src/orca/gui/toolkits/Makefile.am | 27 ++
src/orca/gui/toolkits/abstract_model.py | 30 ++
src/orca/gui/toolkits/abstract_widget.py | 30 ++
src/orca/gui/toolkits/box.py | 96 ++++++
src/orca/gui/toolkits/checkbox.py | 66 ++++
src/orca/gui/toolkits/entry.py | 69 ++++
src/orca/gui/toolkits/frame.py | 60 ++++
src/orca/gui/toolkits/gtk2/Makefile.am | 24 ++
src/orca/gui/toolkits/gtk2/box.py | 107 ++++++
src/orca/gui/toolkits/gtk2/checkbox.py | 65 ++++
src/orca/gui/toolkits/gtk2/entry.py | 65 ++++
src/orca/gui/toolkits/gtk2/frame.py | 63 ++++
src/orca/gui/toolkits/gtk2/label.py | 63 ++++
src/orca/gui/toolkits/gtk2/message_dialog.py | 96 ++++++
src/orca/gui/toolkits/gtk2/push_button.py | 73 +++++
src/orca/gui/toolkits/gtk2/radio_button.py | 74 +++++
src/orca/gui/toolkits/gtk2/slider.py | 95 ++++++
src/orca/gui/toolkits/gtk2/spinner.py | 80 +++++
src/orca/gui/toolkits/gtk2/status_bar.py | 64 ++++
src/orca/gui/toolkits/gtk2/tabbed_widget.py | 86 +++++
src/orca/gui/toolkits/gtk2/table.py | 57 ++++
src/orca/gui/toolkits/gtk2/text_combo_box.py | 72 ++++
src/orca/gui/toolkits/gtk2/toolkit.py | 87 +++++
src/orca/gui/toolkits/gtk2/tree.py | 130 ++++++++
src/orca/gui/toolkits/gtk2/tree_model.py | 73 +++++
src/orca/gui/toolkits/gtk2/window.py | 133 ++++++++
src/orca/gui/toolkits/gtk3/Makefile.am | 24 ++
src/orca/gui/toolkits/gtk3/__init__.py | 1 +
src/orca/gui/toolkits/gtk3/box.py | 107 ++++++
src/orca/gui/toolkits/gtk3/checkbox.py | 65 ++++
src/orca/gui/toolkits/gtk3/entry.py | 65 ++++
src/orca/gui/toolkits/gtk3/frame.py | 63 ++++
src/orca/gui/toolkits/gtk3/label.py | 63 ++++
src/orca/gui/toolkits/gtk3/message_dialog.py | 97 ++++++
src/orca/gui/toolkits/gtk3/push_button.py | 73 +++++
src/orca/gui/toolkits/gtk3/radio_button.py | 77 +++++
src/orca/gui/toolkits/gtk3/slider.py | 95 ++++++
src/orca/gui/toolkits/gtk3/spinner.py | 80 +++++
src/orca/gui/toolkits/gtk3/status_bar.py | 68 ++++
src/orca/gui/toolkits/gtk3/tabbed_widget.py | 86 +++++
src/orca/gui/toolkits/gtk3/table.py | 57 ++++
src/orca/gui/toolkits/gtk3/text_combo_box.py | 73 +++++
src/orca/gui/toolkits/gtk3/toolkit.py | 88 +++++
src/orca/gui/toolkits/gtk3/tree.py | 131 ++++++++
src/orca/gui/toolkits/gtk3/tree_model.py | 73 +++++
src/orca/gui/toolkits/gtk3/window.py | 133 ++++++++
src/orca/gui/toolkits/label.py | 68 ++++
src/orca/gui/toolkits/message_dialog.py | 97 ++++++
src/orca/gui/toolkits/push_button.py | 70 ++++
src/orca/gui/toolkits/qt/Makefile.am | 24 ++
src/orca/gui/toolkits/qt/box.py | 111 +++++++
src/orca/gui/toolkits/qt/checkbox.py | 71 ++++
src/orca/gui/toolkits/qt/entry.py | 72 ++++
src/orca/gui/toolkits/qt/frame.py | 67 ++++
src/orca/gui/toolkits/qt/label.py | 67 ++++
src/orca/gui/toolkits/qt/message_dialog.py | 97 ++++++
src/orca/gui/toolkits/qt/push_button.py | 80 +++++
src/orca/gui/toolkits/qt/radio_button.py | 83 +++++
src/orca/gui/toolkits/qt/slider.py | 99 ++++++
src/orca/gui/toolkits/qt/spinner.py | 88 +++++
src/orca/gui/toolkits/qt/status_bar.py | 71 ++++
src/orca/gui/toolkits/qt/tabbed_widget.py | 98 ++++++
src/orca/gui/toolkits/qt/table.py | 60 ++++
src/orca/gui/toolkits/qt/text_combo_box.py | 74 +++++
src/orca/gui/toolkits/qt/toolkit.py | 93 ++++++
src/orca/gui/toolkits/qt/tree.py | 123 +++++++
src/orca/gui/toolkits/qt/tree_model.py | 188 +++++++++++
src/orca/gui/toolkits/qt/window.py | 144 +++++++++
src/orca/gui/toolkits/radio_button.py | 73 +++++
src/orca/gui/toolkits/slider.py | 92 ++++++
src/orca/gui/toolkits/spinner.py | 82 +++++
src/orca/gui/toolkits/status_bar.py | 60 ++++
src/orca/gui/toolkits/tabbed_widget.py | 82 +++++
src/orca/gui/toolkits/table.py | 51 +++
src/orca/gui/toolkits/text_combo_box.py | 72 ++++
src/orca/gui/toolkits/tree.py | 103 ++++++
src/orca/gui/toolkits/tree_model.py | 71 ++++
src/orca/gui/toolkits/window.py | 128 ++++++++
test/gui/main_window.py | 76 +++++
test/gui/test_all_widgets.py | 446 ++++++++++++++++++++++++++
84 files changed, 6835 insertions(+), 2 deletions(-)
---
diff --git a/configure.in b/configure.in
index b43f22a..bda9903 100644
--- a/configure.in
+++ b/configure.in
@@ -92,6 +92,11 @@ help/Makefile
icons/Makefile
src/Makefile
src/orca/Makefile
+src/orca/gui/Makefile
+src/orca/gui/toolkits/Makefile
+src/orca/gui/toolkits/gtk2/Makefile
+src/orca/gui/toolkits/gtk3/Makefile
+src/orca/gui/toolkits/qt/Makefile
src/orca/scripts/Makefile
src/orca/scripts/apps/Makefile
src/orca/scripts/apps/acroread/Makefile
diff --git a/src/orca/Makefile.am b/src/orca/Makefile.am
index 891ecac..b8c07be 100644
--- a/src/orca/Makefile.am
+++ b/src/orca/Makefile.am
@@ -78,8 +78,9 @@ orca_python_PYTHON = \
orca_pythondir=$(pyexecdir)/orca
SUBDIRS = \
- scripts \
- backends
+ backends \
+ gui \
+ scripts
ui_DATA = \
orca-advanced-magnification.ui \
diff --git a/src/orca/gui/Makefile.am b/src/orca/gui/Makefile.am
new file mode 100644
index 0000000..9e47916
--- /dev/null
+++ b/src/orca/gui/Makefile.am
@@ -0,0 +1,10 @@
+orca_pathdir=$(pyexecdir)
+
+orca_python_PYTHON = \
+ __init__.py \
+ toolkit.py
+
+SUBDIRS = \
+ toolkits
+
+orca_pythondir=$(pyexecdir)/orca/gui
diff --git a/src/orca/gui/__init__.py b/src/orca/gui/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/src/orca/gui/toolkit.py b/src/orca/gui/toolkit.py
new file mode 100644
index 0000000..3107430
--- /dev/null
+++ b/src/orca/gui/toolkit.py
@@ -0,0 +1,132 @@
+# Orca
+#
+# Copyright 2011 The Orca Team.
+# Author: Joanmarie Diggs <joanmarie diggs gmail com>
+#
+# 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.
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2011 The Orca Team."
+__license__ = "LGPL"
+
+class Toolkit(object):
+
+ def __init__(self, toolkitName='gtk2'):
+ super(Toolkit, self).__init__()
+ self._baseToolkit = None
+ self._baseToolkitName = toolkitName
+ self._getBaseToolkit(toolkitName)
+
+ self.TYPE_BOOLEAN = self._baseToolkit.TYPE_BOOLEAN
+ self.TYPE_CHAR = self._baseToolkit.TYPE_CHAR
+ self.TYPE_DOUBLE = self._baseToolkit.TYPE_DOUBLE
+ self.TYPE_FLOAT = self._baseToolkit.TYPE_FLOAT
+ self.TYPE_INT = self._baseToolkit.TYPE_INT
+ self.TYPE_LONG = self._baseToolkit.TYPE_LONG
+ self.TYPE_NONE = self._baseToolkit.TYPE_NONE
+ self.TYPE_STRING = self._baseToolkit.TYPE_STRING
+ self.TYPE_UCHAR = self._baseToolkit.TYPE_UCHAR
+ self.TYPE_UINT = self._baseToolkit.TYPE_UINT
+ self.TYPE_ULONG = self._baseToolkit.TYPE_ULONG
+ self.TYPE_UNICHAR = self._baseToolkit.TYPE_UNICHAR
+
+ self.STOCK_ABOUT = self._baseToolkit.STOCK_ABOUT
+ self.STOCK_APPLY = self._baseToolkit.STOCK_APPLY
+ self.STOCK_CANCEL = self._baseToolkit.STOCK_CANCEL
+ self.STOCK_CLOSE = self._baseToolkit.STOCK_CLOSE
+ self.STOCK_FIND = self._baseToolkit.STOCK_FIND
+ self.STOCK_HELP = self._baseToolkit.STOCK_HELP
+ self.STOCK_NO = self._baseToolkit.STOCK_NO
+ self.STOCK_OK = self._baseToolkit.STOCK_OK
+ self.STOCK_OPEN = self._baseToolkit.STOCK_OPEN
+ self.STOCK_PREFERENCES = self._baseToolkit.STOCK_PREFERENCES
+ self.STOCK_QUIT = self._baseToolkit.STOCK_QUIT
+ self.STOCK_SAVE = self._baseToolkit.STOCK_SAVE
+ self.STOCK_SAVE_AS = self._baseToolkit.STOCK_SAVE_AS
+ self.STOCK_YES = self._baseToolkit.STOCK_YES
+
+ def _getBaseToolkit(self, toolkitName):
+ toolkit = 'orca.gui.toolkits.%s.toolkit' % toolkitName
+ try:
+ module = __import__(toolkit, globals(), locals(), [''])
+ self._baseToolkit = module
+ except:
+ raise Exception('toolkit._getBaseToolkit failure: %s' % toolkit)
+
+ def createHBox(self):
+ return self._baseToolkit.HBox()
+
+ def createVBox(self):
+ return self._baseToolkit.VBox()
+
+ def createCheckbox(self, label='', state=False):
+ return self._baseToolkit.Checkbox(label, state)
+
+ def createEntry(self, text='', isPasswordText=False):
+ return self._baseToolkit.Entry(text, isPasswordText)
+
+ def createFrame(self, labelText=''):
+ return self._baseToolkit.Frame(labelText)
+
+ def createLabel(self, text=''):
+ return self._baseToolkit.Label(text)
+
+ def createMessageDialog(self):
+ return self._baseToolkit.MessageDialog()
+
+ def createPushButton(self, label='', stock=None):
+ return self._baseToolkit.PushButton(label, stock)
+
+ def createRadioButton(self, label='', firstInGroup=None, state=False):
+ return self._baseToolkit.RadioButton(label, firstInGroup, state)
+
+ def createHSlider(self):
+ return self._baseToolkit.HSlider()
+
+ def createVSlider(self):
+ return self._baseToolkit.VSlider()
+
+ def createSpinner(self):
+ return self._baseToolkit.Spinner()
+
+ def createStatusBar(self, numberOfAreas=1):
+ return self._baseToolkit.StatusBar(numberOfAreas)
+
+ def createTabbedWidget(self):
+ return self._baseToolkit.TabbedWidget()
+
+ def createTable(self, nRows=1, nColumns=1):
+ return self._baseToolkit.Table(nRows, nColumns)
+
+ def createTextComboBox(self, isEditable=False):
+ return self._baseToolkit.TextComboBox(isEditable)
+
+ def createTree(self, *args):
+ return self._baseToolkit.Tree(*args)
+
+ def createTreeModel(self, *args):
+ return self._baseToolkit.TreeModel(*args)
+
+ def createWindow(self, title=''):
+ return self._baseToolkit.Window(title)
+
+ def main(self):
+ self._baseToolkit.main()
+
+ def timeoutAdd(self, time, function):
+ self._baseToolkit.timeoutAdd(time, function)
diff --git a/src/orca/gui/toolkits/Makefile.am b/src/orca/gui/toolkits/Makefile.am
new file mode 100644
index 0000000..ebf87b6
--- /dev/null
+++ b/src/orca/gui/toolkits/Makefile.am
@@ -0,0 +1,27 @@
+SUBDIRS = gtk2 gtk3 qt
+
+orca_pathdir=$(pyexecdir)
+
+orca_python_PYTHON = \
+ __init__.py \
+ abstract_widget.py \
+ abstract_model.py \
+ box.py \
+ checkbox.py \
+ entry.py \
+ frame.py \
+ label.py \
+ message_dialog.py \
+ push_button.py \
+ radio_button.py \
+ slider.py \
+ spinner.py \
+ status_bar.py \
+ tabbed_widget.py \
+ table.py \
+ tree.py \
+ tree_model.py \
+ text_combo_box.py \
+ window.py
+
+orca_pythondir=$(pyexecdir)/orca/gui/toolkits
diff --git a/src/orca/gui/toolkits/__init__.py b/src/orca/gui/toolkits/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/src/orca/gui/toolkits/abstract_model.py b/src/orca/gui/toolkits/abstract_model.py
new file mode 100644
index 0000000..1fa468e
--- /dev/null
+++ b/src/orca/gui/toolkits/abstract_model.py
@@ -0,0 +1,30 @@
+# Orca
+#
+# Copyright 2011 The Orca Team.
+# Author: Joanmarie Diggs <joanmarie diggs gmail com>
+#
+# 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.
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2011 The Orca Team."
+__license__ = "LGPL"
+
+class AbstractModel(object):
+
+ def __init__(self):
+ pass
diff --git a/src/orca/gui/toolkits/abstract_widget.py b/src/orca/gui/toolkits/abstract_widget.py
new file mode 100644
index 0000000..0057123
--- /dev/null
+++ b/src/orca/gui/toolkits/abstract_widget.py
@@ -0,0 +1,30 @@
+# Orca
+#
+# Copyright 2011 The Orca Team.
+# Author: Joanmarie Diggs <joanmarie diggs gmail com>
+#
+# 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.
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2011 The Orca Team."
+__license__ = "LGPL"
+
+class AbstractWidget(object):
+
+ def __init__(self):
+ pass
diff --git a/src/orca/gui/toolkits/box.py b/src/orca/gui/toolkits/box.py
new file mode 100644
index 0000000..ecf1724
--- /dev/null
+++ b/src/orca/gui/toolkits/box.py
@@ -0,0 +1,96 @@
+# Orca
+#
+# Copyright 2011 The Orca Team.
+# Author: Joanmarie Diggs <joanmarie diggs gmail com>
+#
+# 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.
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2011 The Orca Team."
+__license__ = "LGPL"
+
+from abstract_widget import AbstractWidget
+
+class Box(AbstractWidget):
+
+ def __init__(self):
+ super(Box, self).__init__()
+
+ def add(self, child, expand=False, fill=False, padding=0):
+ pass
+
+ def getHomogeneous(self):
+ pass
+
+ def setHomogeneous(self, setting):
+ pass
+
+ def getSpacing(self):
+ pass
+
+ def setSpacing(self, spacing):
+ pass
+
+ def getPadding(self):
+ pass
+
+ def setPadding(self, top, bottom, left, right):
+ pass
+
+ def setTopPadding(self, amount):
+ pass
+
+ def setLeftPadding(self, amount):
+ pass
+
+ def setBottomPadding(self, amount):
+ pass
+
+ def setRightPadding(self, amount):
+ pass
+
+ def setAlignment(self, xalign, yalign, xscale, yscale):
+ pass
+
+ def alignLeft(self):
+ pass
+
+ def alignHCenter(self):
+ pass
+
+ def alignRight(self):
+ pass
+
+ def alignTop(self):
+ pass
+
+ def alignVCenter(self):
+ pass
+
+ def alignBottom(self):
+ pass
+
+class HBox(Box):
+
+ def __init__(self):
+ super(HBox, self).__init__()
+
+class VBox(Box):
+
+ def __init__(self):
+ super(VBox, self).__init__()
diff --git a/src/orca/gui/toolkits/checkbox.py b/src/orca/gui/toolkits/checkbox.py
new file mode 100644
index 0000000..6ce3bea
--- /dev/null
+++ b/src/orca/gui/toolkits/checkbox.py
@@ -0,0 +1,66 @@
+# Orca
+#
+# Copyright 2011 The Orca Team.
+# Author: Joanmarie Diggs <joanmarie diggs gmail com>
+#
+# 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.
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2011 The Orca Team."
+__license__ = "LGPL"
+
+from abstract_widget import AbstractWidget
+
+class Checkbox(AbstractWidget):
+
+ SIGNAL_TOGGLED = None
+
+ def __init__(self, label, state):
+ super(Checkbox, self).__init__()
+ self.setDisplayedText(label)
+ self.setState(state)
+
+ def _getHandlerForSignal(self, signal):
+ if signal == self.SIGNAL_TOGGLED:
+ return self.onToggled
+
+ return None
+
+ def bind(self, signal, function, *args, **kwargs):
+ pass
+
+ def onToggled(self, widget, function, *args, **kwargs):
+ pass
+
+ def getUseUnderline(self):
+ pass
+
+ def setUseUnderline(self, setting):
+ pass
+
+ def getDisplayedText(self):
+ pass
+
+ def setDisplayedText(self, displayedText):
+ pass
+
+ def getState(self):
+ pass
+
+ def setState(self, state):
+ pass
diff --git a/src/orca/gui/toolkits/entry.py b/src/orca/gui/toolkits/entry.py
new file mode 100644
index 0000000..3b46e81
--- /dev/null
+++ b/src/orca/gui/toolkits/entry.py
@@ -0,0 +1,69 @@
+# Orca
+#
+# Copyright 2011 The Orca Team.
+# Author: Joanmarie Diggs <joanmarie diggs gmail com>
+#
+# 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.
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2011 The Orca Team."
+__license__ = "LGPL"
+
+from abstract_widget import AbstractWidget
+
+class Entry(AbstractWidget):
+
+ SIGNAL_TEXT_CHANGED = None
+
+ def __init__(self, text, isPasswordText):
+ super(Entry, self).__init__()
+ self.setDisplayedText(text)
+ self.setIsPasswordText(isPasswordText)
+
+ def _getHandlerForSignal(self, signal):
+ if signal == self.SIGNAL_TEXT_CHANGED:
+ return self.onTextChanged
+
+ return None
+
+ def bind(self, signal, function, *args, **kwargs):
+ pass
+
+ def onTextChanged(self, widget, function, *args, **kwargs):
+ pass
+
+ def getIsPasswordText(self):
+ pass
+
+ def setIsPasswordText(self, isPasswordText):
+ pass
+
+ def getDisplayedText(self):
+ pass
+
+ def setDisplayedText(self, displayedText):
+ pass
+
+ def getActivatesDefault(self):
+ pass
+
+ def setActivatesDefault(self, activatesDefault):
+ pass
+
+ def setSelection(self):
+ pass
diff --git a/src/orca/gui/toolkits/frame.py b/src/orca/gui/toolkits/frame.py
new file mode 100644
index 0000000..81c1073
--- /dev/null
+++ b/src/orca/gui/toolkits/frame.py
@@ -0,0 +1,60 @@
+# Orca
+#
+# Copyright 2011 The Orca Team.
+# Author: Joanmarie Diggs <joanmarie diggs gmail com>
+#
+# 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.
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2011 The Orca Team."
+__license__ = "LGPL"
+
+from abstract_widget import AbstractWidget
+
+class Frame(AbstractWidget):
+
+ SHADOW_NONE = None
+ SHADOW_IN = None
+ SHADOW_OUT = None
+ SHADOW_ETCHED_IN = None
+ SHADOW_ETCHED_OUT = None
+
+ def __init__(self, labelText):
+ super(Frame, self).__init__()
+ self.setLabel(labelText)
+
+ def getLabel(self):
+ pass
+
+ def setLabel(self, labelText):
+ pass
+
+ def getShadowType(self):
+ pass
+
+ def setShadowType(self, shadowType):
+ pass
+
+ def getBorderWidth(self):
+ pass
+
+ def setBorderWidth(self, width):
+ pass
+
+ def add(self, child):
+ pass
diff --git a/src/orca/gui/toolkits/gtk2/Makefile.am b/src/orca/gui/toolkits/gtk2/Makefile.am
new file mode 100644
index 0000000..f2a1b2e
--- /dev/null
+++ b/src/orca/gui/toolkits/gtk2/Makefile.am
@@ -0,0 +1,24 @@
+orca_pathdir=$(pyexecdir)
+
+orca_python_PYTHON = \
+ __init__.py \
+ box.py \
+ checkbox.py \
+ entry.py \
+ frame.py \
+ label.py \
+ message_dialog.py \
+ push_button.py \
+ radio_button.py \
+ slider.py \
+ spinner.py \
+ status_bar.py \
+ tabbed_widget.py \
+ table.py \
+ text_combo_box.py \
+ toolkit.py \
+ tree.py \
+ tree_model.py \
+ window.py
+
+orca_pythondir=$(pyexecdir)/orca/gui/toolkits/gtk2
diff --git a/src/orca/gui/toolkits/gtk2/__init__.py b/src/orca/gui/toolkits/gtk2/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/src/orca/gui/toolkits/gtk2/box.py b/src/orca/gui/toolkits/gtk2/box.py
new file mode 100644
index 0000000..4bbef8f
--- /dev/null
+++ b/src/orca/gui/toolkits/gtk2/box.py
@@ -0,0 +1,107 @@
+# Orca
+#
+# Copyright 2011 The Orca Team.
+# Author: Joanmarie Diggs <joanmarie diggs gmail com>
+#
+# 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.
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2011 The Orca Team."
+__license__ = "LGPL"
+
+import gtk
+from orca.gui.toolkits import box
+
+class Box(box.Box):
+
+ def __init__(self):
+ super(Box, self).__init__()
+
+ def add(self, child, expand=False, fill=False, padding=0):
+ self._innerContainer.pack_start(child._widget, expand, fill, padding)
+
+ def getHomogeneous(self):
+ return self._innerContainer.get_homogeneous()
+
+ def setHomogeneous(self, setting):
+ self._innerContainer.set_homogeneous(setting)
+
+ def getSpacing(self):
+ return self._innerContainer.get_spacing()
+
+ def setSpacing(self, spacing):
+ self._innerContainer.set_spacing(spacing)
+
+ def getPadding(self):
+ return self._innerContainer.get_padding()
+
+ def setPadding(self, top, bottom, left, right):
+ self._alignment.set_padding(top, bottom, left, right)
+
+ def setTopPadding(self, amount):
+ self._alignment.set_property('top-padding', amount)
+
+ def setLeftPadding(self, amount):
+ self._alignment.set_property('left-padding', amount)
+
+ def setBottomPadding(self, amount):
+ self._alignment.set_property('bottom-padding', amount)
+
+ def setRightPadding(self, amount):
+ self._alignment.set_property('right-padding', amount)
+
+ def setAlignment(self, xalign, yalign, xscale, yscale):
+ self._alignment.set(xalign, yalign, xscale, yscale)
+
+ def alignLeft(self):
+ self._alignment.set_property('xalign', 0.0)
+
+ def alignHCenter(self):
+ self._alignment.set_property('xalign', 0.5)
+
+ def alignRight(self):
+ self._alignment.set_property('xalign', 1.0)
+
+ def alignTop(self):
+ self._alignment.set_property('yalign', 0.0)
+
+ def alignVCenter(self):
+ self._alignment.set_property('yalign', 0.5)
+
+ def alignBottom(self):
+ self._alignment.set_property('yalign', 1.0)
+
+class HBox(box.HBox, Box):
+
+ def __init__(self):
+ self._widget = gtk.HBox()
+ self._alignment = gtk.Alignment()
+ self._widget.pack_start(self._alignment, True, True, 0)
+ self._innerContainer = gtk.HBox()
+ self._alignment.add(self._innerContainer)
+ super(HBox, self).__init__()
+
+class VBox(box.VBox, Box):
+
+ def __init__(self):
+ self._widget = gtk.VBox()
+ self._alignment = gtk.Alignment()
+ self._widget.pack_start(self._alignment, True, True, 0)
+ self._innerContainer = gtk.VBox()
+ self._alignment.add(self._innerContainer)
+ super(VBox, self).__init__()
diff --git a/src/orca/gui/toolkits/gtk2/checkbox.py b/src/orca/gui/toolkits/gtk2/checkbox.py
new file mode 100644
index 0000000..3c1573a
--- /dev/null
+++ b/src/orca/gui/toolkits/gtk2/checkbox.py
@@ -0,0 +1,65 @@
+# Orca
+#
+# Copyright 2011 The Orca Team.
+# Author: Joanmarie Diggs <joanmarie diggs gmail com>
+#
+# 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.
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2011 The Orca Team."
+__license__ = "LGPL"
+
+from gtk import CheckButton as gtkCheckButton
+from orca.gui.toolkits import checkbox
+
+class Checkbox(checkbox.Checkbox):
+
+ SIGNAL_TOGGLED = 'toggled'
+
+ def __init__(self, label, state):
+ self._widget = gtkCheckButton()
+ super(Checkbox, self).__init__(label, state)
+ self.setUseUnderline(True)
+
+ def bind(self, signal, function, *args, **kwargs):
+ handler = self._getHandlerForSignal(signal)
+ if not handler:
+ return
+
+ self._widget.connect(signal, handler, function, *args, **kwargs)
+
+ def onToggled(self, widget, function, *args, **kwargs):
+ function(self, *args, **kwargs)
+
+ def getState(self):
+ return self._widget.get_active()
+
+ def setState(self, checked):
+ self._widget.set_active(checked)
+
+ def getUseUnderline(self):
+ return self._widget.get_use_underline()
+
+ def setUseUnderline(self, setting):
+ self._widget.set_use_underline(setting)
+
+ def getDisplayedText(self):
+ return self._widget.get_label()
+
+ def setDisplayedText(self, displayedText):
+ self._widget.set_label(displayedText)
diff --git a/src/orca/gui/toolkits/gtk2/entry.py b/src/orca/gui/toolkits/gtk2/entry.py
new file mode 100644
index 0000000..d86fdc2
--- /dev/null
+++ b/src/orca/gui/toolkits/gtk2/entry.py
@@ -0,0 +1,65 @@
+# Orca
+#
+# Copyright 2011 The Orca Team.
+# Author: Joanmarie Diggs <joanmarie diggs gmail com>
+#
+# 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.
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2011 The Orca Team."
+__license__ = "LGPL"
+
+from gtk import Entry as gtkEntry
+from orca.gui.toolkits import entry
+
+class Entry(entry.Entry):
+
+ SIGNAL_TEXT_CHANGED = 'changed'
+
+ def __init__(self, text, isPasswordText):
+ self._widget = gtkEntry()
+ super(Entry, self).__init__(text, isPasswordText)
+
+ def bind(self, signal, function, *args, **kwargs):
+ handler = self._getHandlerForSignal(signal)
+ if not handler:
+ return
+
+ self._widget.connect(signal, handler, function, *args, **kwargs)
+
+ def onTextChanged(self, widget, function, *args, **kwargs):
+ function(self, *args, **kwargs)
+
+ def getDisplayedText(self):
+ return self._widget.get_text()
+
+ def setDisplayedText(self, text):
+ self._widget.set_text(text)
+
+ def getIsPasswordText(self):
+ return not self._widget.get_visibility()
+
+ def setIsPasswordText(self, isPasswordText):
+ self._widget.set_visibility(not isPasswordText)
+
+ def getActivatesDefault(self):
+ pass
+
+ def setActivatesDefault(self, activatesDefault):
+ pass
+
diff --git a/src/orca/gui/toolkits/gtk2/frame.py b/src/orca/gui/toolkits/gtk2/frame.py
new file mode 100644
index 0000000..c713d74
--- /dev/null
+++ b/src/orca/gui/toolkits/gtk2/frame.py
@@ -0,0 +1,63 @@
+# Orca
+#
+# Copyright 2011 The Orca Team.
+# Author: Joanmarie Diggs <joanmarie diggs gmail com>
+#
+# 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.
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2011 The Orca Team."
+__license__ = "LGPL"
+
+import gtk
+from orca.gui.toolkits import frame
+
+class Frame(frame.Frame):
+
+ SHADOW_NONE = gtk.SHADOW_NONE
+ SHADOW_IN = gtk.SHADOW_IN
+ SHADOW_OUT = gtk.SHADOW_OUT
+ SHADOW_ETCHED_IN = gtk.SHADOW_ETCHED_IN
+ SHADOW_ETCHED_OUT = gtk.SHADOW_ETCHED_OUT
+
+ def __init__(self, labelText):
+ self._widget = gtk.Frame()
+ super(Frame, self).__init__(labelText)
+
+ def getLabel(self):
+ return self._widget.get_label()
+
+ def setLabel(self, labelText):
+ self._widget.set_label('<b>%s</b>' % labelText)
+ labelWidget = self._widget.get_label_widget()
+ labelWidget.set_use_markup(True)
+
+ def getShadowType(self):
+ return self._widget.get_shadow_type()
+
+ def setShadowType(self, shadowType):
+ self._widget.set_shadow_type(shadowType)
+
+ def getBorderWidth(self):
+ return self._widget.get_border_width()
+
+ def setBorderWidth(self, width):
+ self._widget.set_border_width(width)
+
+ def add(self, child):
+ self._widget.add(child._widget)
diff --git a/src/orca/gui/toolkits/gtk2/label.py b/src/orca/gui/toolkits/gtk2/label.py
new file mode 100644
index 0000000..b560d7c
--- /dev/null
+++ b/src/orca/gui/toolkits/gtk2/label.py
@@ -0,0 +1,63 @@
+# Orca
+#
+# Copyright 2011 The Orca Team.
+# Author: Joanmarie Diggs <joanmarie diggs gmail com>
+#
+# 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.
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2011 The Orca Team."
+__license__ = "LGPL"
+
+from gtk import Label as gtkLabel
+from orca.gui.toolkits import label
+
+class Label(label.Label):
+ def __init__(self, text):
+ self._widget = gtkLabel()
+ super(Label, self).__init__(text)
+
+ def getDisplayedText(self):
+ return self._widget.get_text()
+
+ def setDisplayedText(self, text):
+ self._widget.set_text(text)
+
+ def getUseUnderline(self):
+ return self._widget.get_use_underline()
+
+ def setUseUnderline(self, setting):
+ self._widget.set_use_underline(setting)
+
+ def getUseMarkup(self):
+ return self._widget.get_use_markup()
+
+ def setUseMarkup(self, setting):
+ self._widget.set_use_markup(setting)
+
+ def getWrapText(self):
+ return self._widget.get_line_wrap()
+
+ def setWrapText(self, setting):
+ self._widget.set_line_wrap(setting)
+
+ def getMnemonicWidget(self):
+ return self._widget.get_mnemonic_widget()
+
+ def setMnemonicWidget(self, widget):
+ self._widget.set_mnemonic_widget(widget._widget)
diff --git a/src/orca/gui/toolkits/gtk2/message_dialog.py b/src/orca/gui/toolkits/gtk2/message_dialog.py
new file mode 100644
index 0000000..80f2031
--- /dev/null
+++ b/src/orca/gui/toolkits/gtk2/message_dialog.py
@@ -0,0 +1,96 @@
+# Orca
+#
+# Copyright 2011 The Orca Team.
+# Author: Joanmarie Diggs <joanmarie diggs gmail com>
+#
+# 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.
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2011 The Orca Team."
+__license__ = "LGPL"
+
+import gtk
+from orca.gui.toolkits import message_dialog
+
+class MessageDialog(message_dialog.MessageDialog):
+
+ SIGNAL_CLOSE = 'close'
+ SIGNAL_RESPONSE = 'response'
+
+ MESSAGE_INFO = gtk.MESSAGE_INFO
+ MESSAGE_WARNING = gtk.MESSAGE_WARNING
+ MESSAGE_QUESTION = gtk.MESSAGE_QUESTION
+ MESSAGE_ERROR = gtk.MESSAGE_ERROR
+
+ BUTTON_OK = (gtk.STOCK_OK, gtk.RESPONSE_OK)
+ BUTTON_CLOSE = (gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE)
+ BUTTON_CANCEL = (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL)
+ BUTTON_YES = (gtk.STOCK_YES, gtk.RESPONSE_YES)
+ BUTTON_NO = (gtk.STOCK_NO, gtk.RESPONSE_NO)
+
+ RESPONSE_OK = gtk.RESPONSE_OK
+ RESPONSE_CLOSE = gtk.RESPONSE_CLOSE
+ RESPONSE_CANCEL = gtk.RESPONSE_CANCEL
+ RESPONSE_YES = gtk.RESPONSE_YES
+ RESPONSE_NO = gtk.RESPONSE_NO
+
+ def __init__(self):
+ self._widget = gtk.MessageDialog()
+ super(MessageDialog, self).__init__()
+
+ def bind(self, signal, function, *args, **kwargs):
+ handler = self._getHandlerForSignal(signal)
+ if not handler:
+ return
+
+ self._widget.connect(signal, handler, function, *args, **kwargs)
+
+ def onClose(self, widget, function, *args, **kwargs):
+ function(self, *args, **kwargs)
+
+ def onResponse(self, widget, responseID, function, *args, **kwargs):
+ function(self, responseID, *args, **kwargs)
+ self.hide()
+
+ def setDefaultSize(self, width, height):
+ self._widget.set_default_size(width, height)
+
+ def setSize(self, width, height):
+ self._widget.resize(width, height)
+
+ def setType(self, messageType):
+ self._widget.set_property('message-type', messageType)
+
+ def setMainText(self, text):
+ self._widget.set_markup('<b>%s</b>' % text)
+
+ def setSecondaryText(self, text):
+ self._widget.format_secondary_markup(text)
+
+ def addButton(self, button):
+ self._widget.add_button(button[0], button[1])
+
+ def display(self):
+ self._widget.show_all()
+
+ def hide(self):
+ self._widget.hide()
+
+ def destroy(self):
+ self._widget.destroy()
+
diff --git a/src/orca/gui/toolkits/gtk2/push_button.py b/src/orca/gui/toolkits/gtk2/push_button.py
new file mode 100644
index 0000000..ddcd729
--- /dev/null
+++ b/src/orca/gui/toolkits/gtk2/push_button.py
@@ -0,0 +1,73 @@
+# Orca
+#
+# Copyright 2011 The Orca Team.
+# Author: Joanmarie Diggs <joanmarie diggs gmail com>
+#
+# 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.
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2011 The Orca Team."
+__license__ = "LGPL"
+
+from gtk import Button as gtkButton
+from orca.gui.toolkits import push_button
+
+class PushButton(push_button.PushButton):
+
+ SIGNAL_CLICKED = 'clicked'
+
+ def __init__(self, label='', stock=None):
+ self._widget = gtkButton(label, stock)
+ super(PushButton, self).__init__(label, stock)
+ self.setUseUnderline(True)
+
+ def bind(self, signal, function, *args, **kwargs):
+ handler = self._getHandlerForSignal(signal)
+ if not handler:
+ return
+
+ self._widget.connect(signal, handler, function, *args, **kwargs)
+
+ def onClicked(self, widget, function, *args, **kwargs):
+ function(self, *args, **kwargs)
+
+ def getIsDefault(self):
+ return self._widget.get_property('has-default')
+
+ def setIsDefault(self, isDefault):
+ if isDefault:
+ self._widget.set_can_default(True)
+ self._widget.set_property('has-default', True)
+
+ def getUseUnderline(self):
+ return self._widget.get_use_underline()
+
+ def setUseUnderline(self, setting):
+ self._widget.set_use_underline(setting)
+
+ def getDisplayedText(self):
+ return self._widget.get_label()
+
+ def setDisplayedText(self, displayedText):
+ self._widget.set_label(displayedText)
+
+ def getUseStock(self):
+ return self._widget.get_use_stock()
+
+ def setUseStock(self, useStock):
+ self._widget.set_use_stock(useStock)
diff --git a/src/orca/gui/toolkits/gtk2/radio_button.py b/src/orca/gui/toolkits/gtk2/radio_button.py
new file mode 100644
index 0000000..e780b85
--- /dev/null
+++ b/src/orca/gui/toolkits/gtk2/radio_button.py
@@ -0,0 +1,74 @@
+# Orca
+#
+# Copyright 2011 The Orca Team.
+# Author: Joanmarie Diggs <joanmarie diggs gmail com>
+#
+# 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.
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2011 The Orca Team."
+__license__ = "LGPL"
+
+from gtk import RadioButton as gtkRadioButton
+from orca.gui.toolkits import radio_button
+
+class RadioButton(radio_button.RadioButton):
+
+ SIGNAL_TOGGLED = 'toggled'
+
+ def __init__(self, label, firstInGroup, state):
+ self._widget = gtkRadioButton()
+ super(RadioButton, self).__init__(label, firstInGroup, state)
+ self.setUseUnderline(True)
+
+ def bind(self, signal, function, *args, **kwargs):
+ handler = self._getHandlerForSignal(signal)
+ if not handler:
+ return
+
+ self._widget.connect(signal, handler, function, *args, **kwargs)
+
+ def onToggled(self, widget, function, *args, **kwargs):
+ function(self, *args, **kwargs)
+
+ def getState(self):
+ return self._widget.get_active()
+
+ def setState(self, checked):
+ self._widget.set_active(checked)
+
+ def getUseUnderline(self):
+ return self._widget.get_use_underline()
+
+ def setUseUnderline(self, setting):
+ self._widget.set_use_underline(setting)
+
+ def getDisplayedText(self):
+ return self._widget.get_label()
+
+ def setDisplayedText(self, displayedText):
+ self._widget.set_label(displayedText)
+
+ def getGroup(self):
+ return self._widget.get_group()
+
+ def setGroup(self, firstInGroup):
+ if not firstInGroup or firstInGroup == self:
+ return
+
+ self._widget.set_group(firstInGroup._widget)
diff --git a/src/orca/gui/toolkits/gtk2/slider.py b/src/orca/gui/toolkits/gtk2/slider.py
new file mode 100644
index 0000000..c591eec
--- /dev/null
+++ b/src/orca/gui/toolkits/gtk2/slider.py
@@ -0,0 +1,95 @@
+# Orca
+#
+# Copyright 2011 The Orca Team.
+# Author: Joanmarie Diggs <joanmarie diggs gmail com>
+#
+# 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.
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2011 The Orca Team."
+__license__ = "LGPL"
+
+from gtk import Scale as gtkScale
+from gtk import HScale as gtkHScale
+from gtk import VScale as gtkVScale
+from orca.gui.toolkits import slider
+
+class Slider(slider.Slider):
+
+ SIGNAL_VALUE_CHANGED = 'value-changed'
+
+ def __init__(self):
+ super(Slider, self).__init__()
+
+ def bind(self, signal, function, *args, **kwargs):
+ handler = self._getHandlerForSignal(signal)
+ if not handler:
+ return
+
+ self._widget.connect(signal, handler, function, *args, **kwargs)
+
+ def onValueChanged(self, widget, function, *args, **kwargs):
+ function(self, *args, **kwargs)
+
+ def getRange(self):
+ return self._widget.get_range()
+
+ def setRange(self, minimum, maximum):
+ self._widget.set_range(minimum, maximum)
+
+ def getIncrements(self):
+ return self._widget.get_increments()
+
+ def setIncrements(self, step, page):
+ self._widget.set_increments(step, page)
+
+ def getValue(self):
+ return self._widget.get_value()
+
+ def setValue(self, value):
+ self._widget.set_value(value)
+
+ def getPrecision(self):
+ return self._widget.get_digits()
+
+ def setPrecision(self, digits):
+ self._widget.set_digits(digits)
+
+ def getShowCurrentValue(self):
+ return self._widget.get_draw_value()
+
+ def setShowCurrentValue(self, showCurrent):
+ self._widget.set_draw_value(showCurrent)
+
+ def getValuePosition(self):
+ return self._widget.get_value_position()
+
+ def setValuePosition(self, position):
+ self._widget.set_value_position(position)
+
+class HSlider(slider.HSlider, Slider):
+
+ def __init__(self):
+ self._widget = gtkHScale()
+ super(HSlider, self).__init__()
+
+class VSlider(slider.VSlider, Slider):
+
+ def __init__(self):
+ self._widget = gtkVScale()
+ super(VSlider, self).__init__()
diff --git a/src/orca/gui/toolkits/gtk2/spinner.py b/src/orca/gui/toolkits/gtk2/spinner.py
new file mode 100644
index 0000000..972f0a4
--- /dev/null
+++ b/src/orca/gui/toolkits/gtk2/spinner.py
@@ -0,0 +1,80 @@
+# Orca
+#
+# Copyright 2011 The Orca Team.
+# Author: Joanmarie Diggs <joanmarie diggs gmail com>
+#
+# 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.
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2011 The Orca Team."
+__license__ = "LGPL"
+
+from gtk import SpinButton as gtkSpinButton
+from orca.gui.toolkits import spinner
+
+class Spinner(spinner.Spinner):
+
+ SIGNAL_VALUE_CHANGED = 'value-changed'
+ SIGNAL_TEXT_CHANGED = 'changed'
+
+ def __init__(self):
+ self._widget = gtkSpinButton()
+ super(Spinner, self).__init__()
+
+ def bind(self, signal, function, *args, **kwargs):
+ handler = self._getHandlerForSignal(signal)
+ if not handler:
+ return
+
+ self._widget.connect(signal, handler, function, *args, **kwargs)
+
+ def onValueChanged(self, widget, function, *args, **kwargs):
+ function(self, *args, **kwargs)
+
+ def onTextChanged(self, widget, function, *args, **kwargs):
+ function(self, *args, **kwargs)
+
+ def getRange(self):
+ return self._widget.get_range()
+
+ def setRange(self, minimum, maximum):
+ self._widget.set_range(minimum, maximum)
+
+ def getIncrements(self):
+ return self._widget.get_increments()
+
+ def setIncrements(self, step, page):
+ self._widget.set_increments(step, page)
+
+ def getValue(self):
+ return self._widget.get_value()
+
+ def setValue(self, value):
+ self._widget.set_value(value)
+
+ def getDisplayedText(self):
+ return self._widget.get_text()
+
+ def setDisplayedText(self, text):
+ self._widget.set_text(text)
+
+ def getPrecision(self):
+ return self._widget.get_digits()
+
+ def setPrecision(self, digits):
+ self._widget.set_digits(digits)
diff --git a/src/orca/gui/toolkits/gtk2/status_bar.py b/src/orca/gui/toolkits/gtk2/status_bar.py
new file mode 100644
index 0000000..0a493be
--- /dev/null
+++ b/src/orca/gui/toolkits/gtk2/status_bar.py
@@ -0,0 +1,64 @@
+# Orca
+#
+# Copyright 2011 The Orca Team.
+# Author: Joanmarie Diggs <joanmarie diggs gmail com>
+#
+# 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.
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2011 The Orca Team."
+__license__ = "LGPL"
+
+import gtk
+from orca.gui.toolkits import status_bar
+
+class StatusBar(status_bar.StatusBar):
+
+ def __init__(self, numberOfAreas=1):
+ self._widget = gtk.Statusbar()
+ self._widget.connect('map', self.onMap)
+ self._messageArea = self._widget.get_message_area()
+ self._labels = self._messageArea.get_children()
+ super(StatusBar, self).__init__(numberOfAreas)
+
+ def createLabels(self, numberOfAreas):
+ labels = [gtk.Label() for i in range(numberOfAreas - 1)]
+ map(lambda l: self._messageArea.pack_start(l, True, True, 0), labels)
+ self._labels.extend(labels)
+
+ def setLabelWidth(self, index, width):
+ self._labels[index].set_size_request(width, -1)
+
+ def setLabelWidthInChars(self, index, nChars):
+ self._labels[index].set_width_chars(nChars)
+
+ def getCurrentMessage(self, index=0):
+ return self._labels[index].get_text()
+
+ def setMessage(self, text, index=0):
+ self._labels[index].set_text(text)
+
+ def clearMessage(self, index=0):
+ self.setMessage(self, '', index)
+
+ def setSpacing(self, spacing):
+ map(lambda l: l.set_padding(spacing, 0), self._labels)
+
+ def onMap(self, widget):
+ # TODO: Nothing I do seems to actually make the grip go away. :-(
+ widget.set_has_resize_grip(False)
diff --git a/src/orca/gui/toolkits/gtk2/tabbed_widget.py b/src/orca/gui/toolkits/gtk2/tabbed_widget.py
new file mode 100644
index 0000000..adf62c8
--- /dev/null
+++ b/src/orca/gui/toolkits/gtk2/tabbed_widget.py
@@ -0,0 +1,86 @@
+# Orca
+#
+# Copyright 2011 The Orca Team.
+# Author: Joanmarie Diggs <joanmarie diggs gmail com>
+#
+# 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.
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2011 The Orca Team."
+__license__ = "LGPL"
+
+from gtk import Notebook as gtkNotebook
+from orca.gui.toolkits import tabbed_widget
+
+class TabbedWidget(tabbed_widget.TabbedWidget):
+
+ SIGNAL_PAGE_CHANGED = 'switch-page'
+
+ def __init__(self):
+ self._widget = gtkNotebook()
+ super(TabbedWidget, self).__init__()
+
+ def bind(self, signal, function, *args, **kwargs):
+ handler = self._getHandlerForSignal(signal)
+ if not handler:
+ return
+
+ self._widget.connect(signal, handler, function, *args, **kwargs)
+
+ def onPageChanged(self, widget, page, index, function, *args, **kwargs):
+ function(self, index, *args, **kwargs)
+
+ def addPage(self, widget, label=None):
+ if label:
+ label = label._widget
+ self._widget.append_page(widget._widget, label)
+
+ def insertPage(self, widget, label=None, position=0):
+ if label:
+ label = label._widget
+ self._widget.insert_page(widget._widget, label, position)
+
+ def removePage(self, position):
+ self._widget.remove_page(position)
+
+ def getCurrentPosition(self):
+ return self._widget.get_current_page()
+
+ def getNthPage(self, index):
+ return self._widget.get_nth_page(index)
+
+ def getNPages(self):
+ return self._widget.get_n_pages()
+
+ def pageNum(self, widget):
+ return self._widget.page_num(widget)
+
+ def gotoPage(self, index):
+ self._widget.set_current_page(index)
+
+ def gotoNextPage(self):
+ self._widget.next_page()
+
+ def gotoPrevPage(self):
+ self._widget.prev_page()
+
+ def getScrollable(self):
+ return self._widget.get_scrollable()
+
+ def setScrollable(self, scrollable):
+ self._widget.set_scrollable(scrollable)
diff --git a/src/orca/gui/toolkits/gtk2/table.py b/src/orca/gui/toolkits/gtk2/table.py
new file mode 100644
index 0000000..e81b434
--- /dev/null
+++ b/src/orca/gui/toolkits/gtk2/table.py
@@ -0,0 +1,57 @@
+# Orca
+#
+# Copyright 2011 The Orca Team.
+# Author: Joanmarie Diggs <joanmarie diggs gmail com>
+#
+# 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.
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2011 The Orca Team."
+__license__ = "LGPL"
+
+from gtk import Table as gtkTable
+from orca.gui.toolkits import table
+
+class Table(table.Table):
+ def __init__(self, nRows, nColumns):
+ self._widget = gtkTable()
+ super(Table, self).__init__(nRows, nColumns)
+
+ def getSize(self):
+ rows = self._widget.get_property('n-rows')
+ columns = self._widget.get_property('n-columns')
+ return rows, columns
+
+ def setSize(self, nRows, nColumns):
+ self._widget.resize(nRows, nColumns)
+
+ def add(self, obj, row, col, rowspan=1, colspan=1):
+ self._widget.attach(obj._widget, col, col+colspan, row, row+rowspan)
+
+ def setPadding(self, child, xpadding, ypadding):
+ obj = child._widget
+ self._widget.child_set_property(obj, 'x-padding', xpadding)
+ self._widget.child_set_property(obj, 'y-padding', ypadding)
+
+ def setOptions(self, child, xoptions, yoptions):
+ obj = child._widget
+ self._widget.child_set_property(obj, 'x-options', xoptions)
+ self._widget.child_set_property(obj, 'y-options', yoptions)
+
+ def setContentsMargins(self, left, top, right, bottom):
+ pass
diff --git a/src/orca/gui/toolkits/gtk2/text_combo_box.py b/src/orca/gui/toolkits/gtk2/text_combo_box.py
new file mode 100644
index 0000000..13f7463
--- /dev/null
+++ b/src/orca/gui/toolkits/gtk2/text_combo_box.py
@@ -0,0 +1,72 @@
+# Orca
+#
+# Copyright 2011 The Orca Team.
+# Author: Joanmarie Diggs <joanmarie diggs gmail com>
+#
+# 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.
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2011 The Orca Team."
+__license__ = "LGPL"
+
+import gtk
+from orca.gui.toolkits import text_combo_box
+
+class TextComboBox(text_combo_box.TextComboBox):
+
+ SIGNAL_SELECTION_CHANGED = 'changed'
+
+ def __init__(self, isEditable=False):
+ if not isEditable:
+ self._widget = gtk.combo_box_new_text()
+ else:
+ self._widget = gtk.combo_box_entry_new_text()
+
+ def bind(self, signal, function, *args, **kwargs):
+ handler = self._getHandlerForSignal(signal)
+ if not handler:
+ return
+
+ self._widget.connect(signal, handler, function, *args, **kwargs)
+
+ def onSelectionChanged(self, widget, function, *args, **kwargs):
+ function(self, *args, **kwargs)
+
+ def addItemAtPosition(self, item, position):
+ self._widget.insert_text(position, item)
+
+ def removeItemFromPosition(self, position):
+ self._widget.text_remove(position)
+
+ def getSelectedItemPosition(self):
+ return self._widget.get_active()
+
+ def setSelectedItem(self, position):
+ self._widget.set_active(position)
+
+ def getSelectedText(self):
+ return self._widget.get_active_text()
+
+ def setTextColumn(self, column):
+ self._widget.set_text_column(column)
+
+ def getIsEditable(self):
+ pass
+
+ def setIsEditable(self, setting):
+ pass
diff --git a/src/orca/gui/toolkits/gtk2/toolkit.py b/src/orca/gui/toolkits/gtk2/toolkit.py
new file mode 100644
index 0000000..44c8ca5
--- /dev/null
+++ b/src/orca/gui/toolkits/gtk2/toolkit.py
@@ -0,0 +1,87 @@
+# Orca
+#
+# Copyright 2011 The Orca Team.
+# Author: Joanmarie Diggs <joanmarie diggs gmail com>
+#
+# 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.
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2011 The Orca Team."
+__license__ = "LGPL"
+
+import gobject
+import gtk
+
+from orca.gui import toolkit
+
+from box import HBox, VBox
+from checkbox import Checkbox
+from entry import Entry
+from frame import Frame
+from label import Label
+from message_dialog import MessageDialog
+from push_button import PushButton
+from radio_button import RadioButton
+from slider import HSlider, VSlider
+from spinner import Spinner
+from status_bar import StatusBar
+from tabbed_widget import TabbedWidget
+from table import Table
+from text_combo_box import TextComboBox
+from tree import Tree
+from tree_model import TreeModel
+from window import Window
+
+TYPE_BOOLEAN = "gboolean"
+TYPE_CHAR = "gchar"
+TYPE_DOUBLE = "gdouble"
+TYPE_FLOAT = "gfloat"
+TYPE_INT = "gint"
+TYPE_LONG = "glong"
+TYPE_NONE = "void"
+TYPE_STRING = "gchararray"
+TYPE_UCHAR = "guchar"
+TYPE_UINT = "guint"
+TYPE_ULONG = "gulong"
+TYPE_UNICHAR = "guint"
+
+STOCK_ABOUT = gtk.STOCK_ABOUT
+STOCK_APPLY = gtk.STOCK_APPLY
+STOCK_CANCEL = gtk.STOCK_CANCEL
+STOCK_CLOSE = gtk.STOCK_CLOSE
+STOCK_FIND = gtk.STOCK_FIND
+STOCK_HELP = gtk.STOCK_HELP
+STOCK_NO = gtk.STOCK_NO
+STOCK_OK = gtk.STOCK_OK
+STOCK_OPEN = gtk.STOCK_OPEN
+STOCK_PREFERENCES = gtk.STOCK_PREFERENCES
+STOCK_QUIT = gtk.STOCK_QUIT
+STOCK_SAVE = gtk.STOCK_SAVE
+STOCK_SAVE_AS = gtk.STOCK_SAVE_AS
+STOCK_YES = gtk.STOCK_YES
+
+def main():
+ return gtk.main()
+
+def timeoutAdd(time, function):
+ gobject.timeout_add(time, function)
+
+class Toolkit(toolkit.Toolkit):
+
+ def __init__(self):
+ super(Toolkit, self).__init__()
diff --git a/src/orca/gui/toolkits/gtk2/tree.py b/src/orca/gui/toolkits/gtk2/tree.py
new file mode 100644
index 0000000..1973d3a
--- /dev/null
+++ b/src/orca/gui/toolkits/gtk2/tree.py
@@ -0,0 +1,130 @@
+# Orca
+#
+# Copyright 2011 The Orca Team.
+# Author: Joanmarie Diggs <joanmarie diggs gmail com>
+#
+# 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.
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2011 The Orca Team."
+__license__ = "LGPL"
+
+import gtk
+from orca.gui.toolkits import tree
+
+import tree_model
+
+class Tree(tree.Tree):
+
+ GRID_LINES_NONE = gtk.TREE_VIEW_GRID_LINES_NONE
+ GRID_LINES_HORIZONTAL = gtk.TREE_VIEW_GRID_LINES_HORIZONTAL
+ GRID_LINES_VERTICAL = gtk.TREE_VIEW_GRID_LINES_VERTICAL
+ GRID_LINES_BOTH = gtk.TREE_VIEW_GRID_LINES_BOTH
+
+ ORDER_DESCENDING = gtk.SORT_DESCENDING
+ ORDER_ASCENDING = gtk.SORT_ASCENDING
+
+ def __init__(self, *args):
+ self._widget = gtk.TreeView()
+ self._model = None
+ super(Tree, self).__init__(*args)
+
+ model = tree_model.TreeModel(*args)
+ self.setModel(model)
+ cellRenderer = gtk.CellRendererText()
+ for i, columnType in enumerate(args):
+ column = gtk.TreeViewColumn(None, cellRenderer, text=i)
+ self._widget.append_column(column)
+ self.setColumnResizable(i, True)
+
+ def getColumnTitle(self, column):
+ treeColumn = self._widget.get_column(column)
+ return treeColumn.get_title()
+
+ def setColumnTitle(self, column, title):
+ treeColumn = self._widget.get_column(column)
+ return treeColumn.set_title(title)
+
+ def getColumnHidden(self, column):
+ treeColumn = self._widget.get_column(column)
+ return not treeColumn.get_visible()
+
+ def setColumnHidden(self, column, hide):
+ treeColumn = self._widget.get_column(column)
+ treeColumn.set_visible(not hide)
+
+ def getColumnResizable(self, column):
+ treeColumn = self._widget.get_column(column)
+ return treeColumn.get_resizable()
+
+ def setColumnResizable(self, column, resizable):
+ treeColumn = self._widget.get_column(column)
+ treeColumn.set_resizable(resizable)
+
+ def getHeadersHidden(self):
+ return not self._widget.get_headers_visible()
+
+ def setHeadersHidden(self, hide):
+ self._widget.set_headers_visible(not hide)
+
+ def collapseAll(self):
+ self._widget.collapse_all()
+
+ def expandAll(self):
+ self._widget.expand_all()
+
+ def getRowExpanded(self, row):
+ return self._widget.row_expanded(row)
+
+ def setRowExpanded(self, row, expanded):
+ if expanded:
+ self._widget.expand_row(row, False)
+ else:
+ self._widget.collapse_row(row)
+
+ def getItemsExpandable(self):
+ pass
+
+ def setItemsExpandable(self,expandable):
+ pass
+
+ def setRootIsDecorated(self, setting):
+ pass
+
+ def sortByColumn(self, column, order):
+ self._model.setSortColumnId(column, order)
+ treeColumn = self._widget.get_column(column)
+ treeColumn.set_sort_column_id(column)
+ treeColumn.set_sort_indicator(True)
+
+ def setRulesHint(self, hint):
+ self._widget.set_rules_hint(hint)
+
+ def getGridLines(self):
+ return self._widget.get_grid_lines()
+
+ def setGridLines(self, gridLineType):
+ self._widget.set_grid_lines(gridLineType)
+
+ def getModel(self):
+ return self._model
+
+ def setModel(self, model):
+ toolkitModel = model._model
+ self._widget.set_model(toolkitModel)
+ self._model = model
diff --git a/src/orca/gui/toolkits/gtk2/tree_model.py b/src/orca/gui/toolkits/gtk2/tree_model.py
new file mode 100644
index 0000000..35676ea
--- /dev/null
+++ b/src/orca/gui/toolkits/gtk2/tree_model.py
@@ -0,0 +1,73 @@
+# Orca
+#
+# Copyright 2011 The Orca Team.
+# Author: Joanmarie Diggs <joanmarie diggs gmail com>
+#
+# 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.
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2011 The Orca Team."
+__license__ = "LGPL"
+
+from gtk import TreeStore as gtkTreeStore
+from orca.gui.toolkits import tree_model
+
+class TreeModel(tree_model.TreeModel):
+
+ def __init__(self, *args):
+ self._model = gtkTreeStore(*args)
+ super(TreeModel, self).__init__(*args)
+
+ def setValue(self, row, column, value):
+ self._model.set_value(row, column, value)
+
+ def remove(self, row):
+ return self._model.remove(row)
+
+ def insert(self, parent, position, rowItems):
+ return self._model.insert(parent, position, rowItems)
+
+ def prepend(self, parent, rowItems):
+ return self._model.prepend(parent, rowItems)
+
+ def append(self, parent, rowItems):
+ return self._model.append(parent, rowItems)
+
+ def isAncestor(self, row, descendant):
+ return self._model.is_ancestor(row, descendant)
+
+ def rowDepth(self, row):
+ return self._model.iter_depth(row)
+
+ def clear(self):
+ self._model.clear()
+
+ def reorder(self, parent, new_order):
+ self._model.reorder(parent, new_order)
+
+ def swap(self, a, b):
+ self._model.swap(a, b)
+
+ def moveAfter(self, row, position):
+ self._model.move_after(row, position)
+
+ def moveBefore(self, row, position):
+ self._model.move_before(row, position)
+
+ def setSortColumnId(self, column, order):
+ self._model.set_sort_column_id(column, order)
diff --git a/src/orca/gui/toolkits/gtk2/window.py b/src/orca/gui/toolkits/gtk2/window.py
new file mode 100644
index 0000000..8230e3c
--- /dev/null
+++ b/src/orca/gui/toolkits/gtk2/window.py
@@ -0,0 +1,133 @@
+# Orca
+#
+# Copyright 2011 The Orca Team.
+# Author: Joanmarie Diggs <joanmarie diggs gmail com>
+#
+# 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.
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2011 The Orca Team."
+__license__ = "LGPL"
+
+from gtk import Window as gtkWindow, VBox as gtkVBox
+from orca.gui.toolkits import window
+
+class Window(window.Window):
+
+ SIGNAL_CLOSE_EVENT = 'delete-event'
+
+ def __init__(self, title):
+ self._widget = gtkWindow()
+ self._container = gtkVBox()
+ self._widget.add(self._container)
+ self._isEmpty = True
+ super(Window, self).__init__(title)
+
+ def bind(self, signal, function, *args, **kwargs):
+ handler = self._getHandlerForSignal(signal)
+ if not handler:
+ return
+
+ self._widget.connect(signal, handler, function, *args, **kwargs)
+
+ def onClose(self, widget, event, function, *args, **kwargs):
+ function(self, event, *args, **kwargs)
+
+ def getTitle(self):
+ return self._widget.get_title()
+
+ def setTitle(self, title):
+ self._widget.set_title(title)
+
+ def getDefaultSize(self):
+ return self._widget.get_default_size()
+
+ def setDefaultSize(self, width, height):
+ self._widget.set_default_size(width, height)
+
+ def getModal(self):
+ return self._widget.get_modal()
+
+ def setModal(self, modal):
+ return self._widget.get_modal(modal)
+
+ def getKeepAbove(self):
+ return self._widget.get_keep_above()
+
+ def setKeepAbove(self, setting):
+ self._widget.set_keep_above(setting)
+
+ def getDestroyWithParent(self):
+ return self._widget.get_destroy_with_parent()
+
+ def setDestroyWithParent(self, setting):
+ self._widget.set_destroy_with_parent(setting)
+
+ def getSkipTaskbarHint(self):
+ return self._widget.get_skip_taskbar_hint()
+
+ def setSkipTaskbarHint(self, setting):
+ self._widget.set_skip_taskbar_hint(setting)
+
+ def getUrgencyHint(self):
+ return self._widget.get_urgency_hint()
+
+ def setUrgencyHint(self, setting):
+ self._widget.set_urgency_hint(setting)
+
+ def getSkipPagerHint(self):
+ return self._widget.get_skip_pager_hint()
+
+ def setSkipPagerHint(self, setting):
+ self._widget.set_skip_pager_hint(setting)
+
+ def getDecorated(self):
+ return self._widget.get_decorated()
+
+ def setDecorated(self, setting):
+ self._widget.set_decorated(setting)
+
+ def getResizable(self):
+ return self._widget.get_resizable()
+
+ def setResizable(self, resizable):
+ self._widget.set_resizable(resizable)
+
+ def getTransientFor(self):
+ return self._widget.get_transient_for()
+
+ def setTransientFor(self, parent):
+ self._widget.set_transient_for(parent)
+
+ def add(self, obj):
+ expand = self._isEmpty
+ fill = self._isEmpty
+ self._container.pack_start(obj._widget, expand, fill, 0)
+ self._isEmpty = False
+
+ def display(self):
+ self._widget.show_all()
+
+ def hide(self):
+ self._widget.hide()
+
+ def close(self):
+ self._widget.close()
+
+ def destroy(self):
+ self._widget.destroy()
diff --git a/src/orca/gui/toolkits/gtk3/Makefile.am b/src/orca/gui/toolkits/gtk3/Makefile.am
new file mode 100644
index 0000000..4725cb6
--- /dev/null
+++ b/src/orca/gui/toolkits/gtk3/Makefile.am
@@ -0,0 +1,24 @@
+orca_pathdir=$(pyexecdir)
+
+orca_python_PYTHON = \
+ __init__.py \
+ box.py \
+ checkbox.py \
+ entry.py \
+ frame.py \
+ label.py \
+ message_dialog.py \
+ push_button.py \
+ radio_button.py \
+ slider.py \
+ spinner.py \
+ status_bar.py \
+ tabbed_widget.py \
+ table.py \
+ text_combo_box.py \
+ tree.py \
+ tree_model.py \
+ toolkit.py \
+ window.py
+
+orca_pythondir=$(pyexecdir)/orca/gui/toolkits/gtk3
diff --git a/src/orca/gui/toolkits/gtk3/__init__.py b/src/orca/gui/toolkits/gtk3/__init__.py
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/src/orca/gui/toolkits/gtk3/__init__.py
@@ -0,0 +1 @@
+
diff --git a/src/orca/gui/toolkits/gtk3/box.py b/src/orca/gui/toolkits/gtk3/box.py
new file mode 100644
index 0000000..e2561ad
--- /dev/null
+++ b/src/orca/gui/toolkits/gtk3/box.py
@@ -0,0 +1,107 @@
+# Orca
+#
+# Copyright 2011 The Orca Team.
+# Author: Joanmarie Diggs <joanmarie diggs gmail com>
+#
+# 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.
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2011 The Orca Team."
+__license__ = "LGPL"
+
+from gi.repository import Gtk
+from orca.gui.toolkits import box
+
+class Box(box.Box):
+
+ def __init__(self):
+ super(Box, self).__init__()
+
+ def add(self, child, expand=False, fill=False, padding=0):
+ self._innerContainer.pack_start(child._widget, expand, fill, padding)
+
+ def getHomogeneous(self):
+ return self._innerContainer.get_homogeneous()
+
+ def setHomogeneous(self, setting):
+ self._innerContainer.set_homogeneous(setting)
+
+ def getSpacing(self):
+ return self._innerContainer.get_spacing()
+
+ def setSpacing(self, spacing):
+ self._innerContainer.set_spacing(spacing)
+
+ def getPadding(self):
+ return self._innerContainer.get_padding()
+
+ def setPadding(self, top, bottom, left, right):
+ self._alignment.set_padding(top, bottom, left, right)
+
+ def setTopPadding(self, amount):
+ self._alignment.set_property('top-padding', amount)
+
+ def setLeftPadding(self, amount):
+ self._alignment.set_property('left-padding', amount)
+
+ def setBottomPadding(self, amount):
+ self._alignment.set_property('bottom-padding', amount)
+
+ def setRightPadding(self, amount):
+ self._alignment.set_property('right-padding', amount)
+
+ def setAlignment(self, xalign, yalign, xscale, yscale):
+ self._alignment.set(xalign, yalign, xscale, yscale)
+
+ def alignLeft(self):
+ self._alignment.set_property('xalign', 0.0)
+
+ def alignHCenter(self):
+ self._alignment.set_property('xalign', 0.5)
+
+ def alignRight(self):
+ self._alignment.set_property('xalign', 1.0)
+
+ def alignTop(self):
+ self._alignment.set_property('yalign', 0.0)
+
+ def alignVCenter(self):
+ self._alignment.set_property('yalign', 0.5)
+
+ def alignBottom(self):
+ self._alignment.set_property('yalign', 1.0)
+
+class HBox(box.HBox, Box):
+
+ def __init__(self):
+ self._widget = Gtk.HBox()
+ self._alignment = Gtk.Alignment()
+ self._widget.pack_start(self._alignment, True, True, 0)
+ self._innerContainer = Gtk.HBox()
+ self._alignment.add(self._innerContainer)
+ super(HBox, self).__init__()
+
+class VBox(box.VBox, Box):
+
+ def __init__(self):
+ self._widget = Gtk.VBox()
+ self._alignment = Gtk.Alignment()
+ self._widget.pack_start(self._alignment, True, True, 0)
+ self._innerContainer = Gtk.VBox()
+ self._alignment.add(self._innerContainer)
+ super(VBox, self).__init__()
diff --git a/src/orca/gui/toolkits/gtk3/checkbox.py b/src/orca/gui/toolkits/gtk3/checkbox.py
new file mode 100644
index 0000000..d890cf8
--- /dev/null
+++ b/src/orca/gui/toolkits/gtk3/checkbox.py
@@ -0,0 +1,65 @@
+# Orca
+#
+# Copyright 2011 The Orca Team.
+# Author: Joanmarie Diggs <joanmarie diggs gmail com>
+#
+# 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.
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2011 The Orca Team."
+__license__ = "LGPL"
+
+from gi.repository.Gtk import CheckButton as gtkCheckButton
+from orca.gui.toolkits import checkbox
+
+class Checkbox(checkbox.Checkbox):
+
+ SIGNAL_TOGGLED = 'toggled'
+
+ def __init__(self, label, state):
+ self._widget = gtkCheckButton()
+ super(Checkbox, self).__init__(label, state)
+ self.setUseUnderline(True)
+
+ def bind(self, signal, function, *args, **kwargs):
+ handler = self._getHandlerForSignal(signal)
+ if not handler:
+ return
+
+ self._widget.connect(signal, handler, function, *args, **kwargs)
+
+ def onToggled(self, widget, function, *args, **kwargs):
+ function(self, *args, **kwargs)
+
+ def getState(self):
+ return self._widget.get_active()
+
+ def setState(self, checked):
+ self._widget.set_active(checked)
+
+ def getUseUnderline(self):
+ return self._widget.get_use_underline()
+
+ def setUseUnderline(self, setting):
+ self._widget.set_use_underline(setting)
+
+ def getDisplayedText(self):
+ return self._widget.get_label()
+
+ def setDisplayedText(self, displayedText):
+ self._widget.set_label(displayedText)
diff --git a/src/orca/gui/toolkits/gtk3/entry.py b/src/orca/gui/toolkits/gtk3/entry.py
new file mode 100644
index 0000000..d587e4f
--- /dev/null
+++ b/src/orca/gui/toolkits/gtk3/entry.py
@@ -0,0 +1,65 @@
+# Orca
+#
+# Copyright 2011 The Orca Team.
+# Author: Joanmarie Diggs <joanmarie diggs gmail com>
+#
+# 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.
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2011 The Orca Team."
+__license__ = "LGPL"
+
+from gi.repository.Gtk import Entry as gtkEntry
+from orca.gui.toolkits import entry
+
+class Entry(entry.Entry):
+
+ SIGNAL_TEXT_CHANGED = 'changed'
+
+ def __init__(self, text, isPasswordText):
+ self._widget = gtkEntry()
+ super(Entry, self).__init__(text, isPasswordText)
+
+ def bind(self, signal, function, *args, **kwargs):
+ handler = self._getHandlerForSignal(signal)
+ if not handler:
+ return
+
+ self._widget.connect(signal, handler, function, *args, **kwargs)
+
+ def onTextChanged(self, widget, function, *args, **kwargs):
+ function(self, *args, **kwargs)
+
+ def getDisplayedText(self):
+ return self._widget.get_text()
+
+ def setDisplayedText(self, text):
+ self._widget.set_text(text)
+
+ def getIsPasswordText(self):
+ return not self._widget.get_visibility()
+
+ def setIsPasswordText(self, isPasswordText):
+ self._widget.set_visibility(not isPasswordText)
+
+ def getActivatesDefault(self):
+ pass
+
+ def setActivatesDefault(self, activatesDefault):
+ pass
+
diff --git a/src/orca/gui/toolkits/gtk3/frame.py b/src/orca/gui/toolkits/gtk3/frame.py
new file mode 100644
index 0000000..ac3c79e
--- /dev/null
+++ b/src/orca/gui/toolkits/gtk3/frame.py
@@ -0,0 +1,63 @@
+# Orca
+#
+# Copyright 2011 The Orca Team.
+# Author: Joanmarie Diggs <joanmarie diggs gmail com>
+#
+# 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.
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2011 The Orca Team."
+__license__ = "LGPL"
+
+from gi.repository import Gtk
+from orca.gui.toolkits import frame
+
+class Frame(frame.Frame):
+
+ SHADOW_NONE = Gtk.ShadowType.NONE
+ SHADOW_IN = Gtk.ShadowType.IN
+ SHADOW_OUT = Gtk.ShadowType.OUT
+ SHADOW_ETCHED_IN = Gtk.ShadowType.ETCHED_IN
+ SHADOW_ETCHED_OUT = Gtk.ShadowType.ETCHED_OUT
+
+ def __init__(self, labelText):
+ self._widget = Gtk.Frame()
+ super(Frame, self).__init__(labelText)
+
+ def getLabel(self):
+ return self._widget.get_label()
+
+ def setLabel(self, labelText):
+ self._widget.set_label('<b>%s</b>' % labelText)
+ labelWidget = self._widget.get_label_widget()
+ labelWidget.set_use_markup(True)
+
+ def getShadowType(self):
+ return self._widget.get_shadow_type()
+
+ def setShadowType(self, shadowType):
+ self._widget.set_shadow_type(shadowType)
+
+ def add(self, child):
+ self._widget.add(child._widget)
+
+ def getBorderWidth(self):
+ return self._widget.get_border_width()
+
+ def setBorderWidth(self, width):
+ self._widget.set_border_width(width)
diff --git a/src/orca/gui/toolkits/gtk3/label.py b/src/orca/gui/toolkits/gtk3/label.py
new file mode 100644
index 0000000..dc55869
--- /dev/null
+++ b/src/orca/gui/toolkits/gtk3/label.py
@@ -0,0 +1,63 @@
+# Orca
+#
+# Copyright 2011 The Orca Team.
+# Author: Joanmarie Diggs <joanmarie diggs gmail com>
+#
+# 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.
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2011 The Orca Team."
+__license__ = "LGPL"
+
+from gi.repository.Gtk import Label as gtkLabel
+from orca.gui.toolkits import label
+
+class Label(label.Label):
+ def __init__(self, text):
+ self._widget = gtkLabel()
+ super(Label, self).__init__(text)
+
+ def getDisplayedText(self):
+ return self._widget.get_text()
+
+ def setDisplayedText(self, text):
+ self._widget.set_text(text)
+
+ def getUseUnderline(self):
+ return self._widget.get_use_underline()
+
+ def setUseUnderline(self, setting):
+ self._widget.set_use_underline(setting)
+
+ def getUseMarkup(self):
+ return self._widget.get_use_markup()
+
+ def setUseMarkup(self, setting):
+ self._widget.set_use_markup(setting)
+
+ def getWrapText(self):
+ return self._widget.get_line_wrap()
+
+ def setWrapText(self, setting):
+ self._widget.set_line_wrap(setting)
+
+ def getMnemonicWidget(self):
+ return self._widget.get_mnemonic_widget()
+
+ def setMnemonicWidget(self, widget):
+ self._widget.set_mnemonic_widget(widget._widget)
diff --git a/src/orca/gui/toolkits/gtk3/message_dialog.py b/src/orca/gui/toolkits/gtk3/message_dialog.py
new file mode 100644
index 0000000..e8fd037
--- /dev/null
+++ b/src/orca/gui/toolkits/gtk3/message_dialog.py
@@ -0,0 +1,97 @@
+# Orca
+#
+# Copyright 2011 The Orca Team.
+# Author: Joanmarie Diggs <joanmarie diggs gmail com>
+#
+# 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.
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2011 The Orca Team."
+__license__ = "LGPL"
+
+from gi.repository import Gtk
+from orca.gui.toolkits import message_dialog
+
+class MessageDialog(message_dialog.MessageDialog):
+
+ SIGNAL_CLOSE = 'close'
+ SIGNAL_RESPONSE = 'response'
+
+ MESSAGE_INFO = Gtk.MessageType.INFO
+ MESSAGE_WARNING = Gtk.MessageType.WARNING
+ MESSAGE_QUESTION = Gtk.MessageType.QUESTION
+ MESSAGE_ERROR = Gtk.MessageType.ERROR
+
+ BUTTON_OK = (Gtk.STOCK_OK, Gtk.ResponseType.OK)
+ BUTTON_CLOSE = (Gtk.STOCK_CLOSE, Gtk.ResponseType.CLOSE)
+ BUTTON_CANCEL = (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL)
+ BUTTON_YES = (Gtk.STOCK_YES, Gtk.ResponseType.YES)
+ BUTTON_NO = (Gtk.STOCK_NO, Gtk.ResponseType.NO)
+
+ RESPONSE_OK = Gtk.ResponseType.OK
+ RESPONSE_CLOSE = Gtk.ResponseType.CLOSE
+ RESPONSE_CANCEL = Gtk.ResponseType.CANCEL
+ RESPONSE_YES = Gtk.ResponseType.YES
+ RESPONSE_NO = Gtk.ResponseType.NO
+
+ def __init__(self):
+ self._widget = Gtk.MessageDialog()
+ super(MessageDialog, self).__init__()
+
+ def bind(self, signal, function, *args, **kwargs):
+ handler = self._getHandlerForSignal(signal)
+ if not handler:
+ return
+
+ self._widget.connect(signal, handler, function, *args, **kwargs)
+
+ def onClose(self, widget, function, *args, **kwargs):
+ function(self, *args, **kwargs)
+
+ def onResponse(self, widget, responseID, function, *args, **kwargs):
+ function(self, responseID, *args, **kwargs)
+ self.hide()
+
+ def setDefaultSize(self, width, height):
+ self._widget.set_size_request(width, height)
+ self._widget.set_default_size(width, height)
+
+ def setSize(self, width, height):
+ self._widget.resize(width, height)
+
+ def setType(self, messageType):
+ self._widget.set_property('message-type', messageType)
+
+ def setMainText(self, text):
+ self._widget.set_markup('<b>%s</b>' % text)
+
+ def setSecondaryText(self, text):
+ self._widget.format_secondary_markup(text)
+
+ def addButton(self, button):
+ self._widget.add_button(button[0], button[1])
+
+ def display(self):
+ self._widget.show_all()
+
+ def hide(self):
+ self._widget.hide()
+
+ def destroy(self):
+ self._widget.destroy()
+
diff --git a/src/orca/gui/toolkits/gtk3/push_button.py b/src/orca/gui/toolkits/gtk3/push_button.py
new file mode 100644
index 0000000..b289b18
--- /dev/null
+++ b/src/orca/gui/toolkits/gtk3/push_button.py
@@ -0,0 +1,73 @@
+# Orca
+#
+# Copyright 2011 The Orca Team.
+# Author: Joanmarie Diggs <joanmarie diggs gmail com>
+#
+# 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.
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2011 The Orca Team."
+__license__ = "LGPL"
+
+from gi.repository.Gtk import Button as gtkButton
+from orca.gui.toolkits import push_button
+
+class PushButton(push_button.PushButton):
+
+ SIGNAL_CLICKED = 'clicked'
+
+ def __init__(self, label='', stock=None):
+ self._widget = gtkButton(label, stock)
+ super(PushButton, self).__init__(label, stock)
+ self.setUseUnderline(True)
+
+ def bind(self, signal, function, *args, **kwargs):
+ handler = self._getHandlerForSignal(signal)
+ if not handler:
+ return
+
+ self._widget.connect(signal, handler, function, *args, **kwargs)
+
+ def onClicked(self, widget, function, *args, **kwargs):
+ function(self, *args, **kwargs)
+
+ def getIsDefault(self):
+ return self._widget.get_property('has-default')
+
+ def setIsDefault(self, isDefault):
+ if isDefault:
+ self._widget.set_can_default(True)
+ self._widget.set_property('has-default', True)
+
+ def getUseUnderline(self):
+ return self._widget.get_use_underline()
+
+ def setUseUnderline(self, setting):
+ self._widget.set_use_underline(setting)
+
+ def getDisplayedText(self):
+ return self._widget.get_label()
+
+ def setDisplayedText(self, displayedText):
+ self._widget.set_label(displayedText)
+
+ def getUseStock(self):
+ return self._widget.get_use_stock()
+
+ def setUseStock(self, useStock):
+ self._widget.set_use_stock(useStock)
diff --git a/src/orca/gui/toolkits/gtk3/radio_button.py b/src/orca/gui/toolkits/gtk3/radio_button.py
new file mode 100644
index 0000000..3f12e55
--- /dev/null
+++ b/src/orca/gui/toolkits/gtk3/radio_button.py
@@ -0,0 +1,77 @@
+# Orca
+#
+# Copyright 2011 The Orca Team.
+# Author: Joanmarie Diggs <joanmarie diggs gmail com>
+#
+# 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.
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2011 The Orca Team."
+__license__ = "LGPL"
+
+from gi.repository.Gtk import RadioButton as gtkRadioButton
+from orca.gui.toolkits import radio_button
+
+class RadioButton(radio_button.RadioButton):
+
+ SIGNAL_TOGGLED = 'toggled'
+
+ def __init__(self, label, firstInGroup, state):
+ self._widget = gtkRadioButton()
+ super(RadioButton, self).__init__(label, firstInGroup, state)
+ self.setUseUnderline(True)
+
+ def bind(self, signal, function, *args, **kwargs):
+ handler = self._getHandlerForSignal(signal)
+ if not handler:
+ return
+
+ self._widget.connect(signal, handler, function, *args, **kwargs)
+
+ def onToggled(self, widget, function, *args, **kwargs):
+ function(self, *args, **kwargs)
+
+ def getState(self):
+ return self._widget.get_active()
+
+ def setState(self, checked):
+ self._widget.set_active(checked)
+
+ def getUseUnderline(self):
+ return self._widget.get_use_underline()
+
+ def setUseUnderline(self, setting):
+ self._widget.set_use_underline(setting)
+
+ def getDisplayedText(self):
+ return self._widget.get_label()
+
+ def setDisplayedText(self, displayedText):
+ self._widget.set_label(displayedText)
+
+ def getGroup(self):
+ return self._widget.get_group()
+
+ def setGroup(self, firstInGroup):
+ if not firstInGroup or firstInGroup == self:
+ return
+
+ firstWidget = firstInGroup._widget
+ self._widget.join_group(firstWidget)
+ if not firstWidget.get_group():
+ firstWidget.join_group(self._widget)
diff --git a/src/orca/gui/toolkits/gtk3/slider.py b/src/orca/gui/toolkits/gtk3/slider.py
new file mode 100644
index 0000000..154897e
--- /dev/null
+++ b/src/orca/gui/toolkits/gtk3/slider.py
@@ -0,0 +1,95 @@
+# Orca
+#
+# Copyright 2011 The Orca Team.
+# Author: Joanmarie Diggs <joanmarie diggs gmail com>
+#
+# 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.
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2011 The Orca Team."
+__license__ = "LGPL"
+
+from gi.repository.Gtk import Scale as gtkScale
+from gi.repository.Gtk import HScale as gtkHScale
+from gi.repository.Gtk import VScale as gtkVScale
+from orca.gui.toolkits import slider
+
+class Slider(slider.Slider):
+
+ SIGNAL_VALUE_CHANGED = 'value-changed'
+
+ def __init__(self):
+ super(Slider, self).__init__()
+
+ def bind(self, signal, function, *args, **kwargs):
+ handler = self._getHandlerForSignal(signal)
+ if not handler:
+ return
+
+ self._widget.connect(signal, handler, function, *args, **kwargs)
+
+ def onValueChanged(self, widget, function, *args, **kwargs):
+ function(self, *args, **kwargs)
+
+ def getRange(self):
+ return self._widget.get_range()
+
+ def setRange(self, minimum, maximum):
+ self._widget.set_range(minimum, maximum)
+
+ def getIncrements(self):
+ return self._widget.get_increments()
+
+ def setIncrements(self, step, page):
+ self._widget.set_increments(step, page)
+
+ def getValue(self):
+ return self._widget.get_value()
+
+ def setValue(self, value):
+ self._widget.set_value(value)
+
+ def getPrecision(self):
+ return self._widget.get_digits()
+
+ def setPrecision(self, digits):
+ self._widget.set_digits(digits)
+
+ def getShowCurrentValue(self):
+ return self._widget.get_draw_value()
+
+ def setShowCurrentValue(self, showCurrent):
+ self._widget.set_draw_value(showCurrent)
+
+ def getValuePosition(self):
+ return self._widget.get_value_position()
+
+ def setValuePosition(self, position):
+ self._widget.set_value_position(position)
+
+class HSlider(slider.HSlider, Slider):
+
+ def __init__(self):
+ self._widget = gtkHScale()
+ super(HSlider, self).__init__()
+
+class VSlider(slider.VSlider, Slider):
+
+ def __init__(self):
+ self._widget = gtkVScale()
+ super(VSlider, self).__init__()
diff --git a/src/orca/gui/toolkits/gtk3/spinner.py b/src/orca/gui/toolkits/gtk3/spinner.py
new file mode 100644
index 0000000..a4dc35b
--- /dev/null
+++ b/src/orca/gui/toolkits/gtk3/spinner.py
@@ -0,0 +1,80 @@
+# Orca
+#
+# Copyright 2011 The Orca Team.
+# Author: Joanmarie Diggs <joanmarie diggs gmail com>
+#
+# 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.
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2011 The Orca Team."
+__license__ = "LGPL"
+
+from gi.repository.Gtk import SpinButton as gtkSpinButton
+from orca.gui.toolkits import spinner
+
+class Spinner(spinner.Spinner):
+
+ SIGNAL_VALUE_CHANGED = 'value-changed'
+ SIGNAL_TEXT_CHANGED = 'changed'
+
+ def __init__(self):
+ self._widget = gtkSpinButton()
+ super(Spinner, self).__init__()
+
+ def bind(self, signal, function, *args, **kwargs):
+ handler = self._getHandlerForSignal(signal)
+ if not handler:
+ return
+
+ self._widget.connect(signal, handler, function, *args, **kwargs)
+
+ def onValueChanged(self, widget, function, *args, **kwargs):
+ function(self, *args, **kwargs)
+
+ def onTextChanged(self, widget, function, *args, **kwargs):
+ function(self, *args, **kwargs)
+
+ def getRange(self):
+ return self._widget.get_range()
+
+ def setRange(self, minimum, maximum):
+ self._widget.set_range(minimum, maximum)
+
+ def getIncrements(self):
+ return self._widget.get_increments()
+
+ def setIncrements(self, step, page):
+ self._widget.set_increments(step, page)
+
+ def getValue(self):
+ return self._widget.get_value()
+
+ def setValue(self, value):
+ self._widget.set_value(value)
+
+ def getDisplayedText(self):
+ return self._widget.get_text()
+
+ def setDisplayedText(self, text):
+ self._widget.set_text(text)
+
+ def getPrecision(self):
+ return self._widget.get_digits()
+
+ def setPrecision(self, digits):
+ self._widget.set_digits(digits)
diff --git a/src/orca/gui/toolkits/gtk3/status_bar.py b/src/orca/gui/toolkits/gtk3/status_bar.py
new file mode 100644
index 0000000..be6b677
--- /dev/null
+++ b/src/orca/gui/toolkits/gtk3/status_bar.py
@@ -0,0 +1,68 @@
+# Orca
+#
+# Copyright 2011 The Orca Team.
+# Author: Joanmarie Diggs <joanmarie diggs gmail com>
+#
+# 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.
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2011 The Orca Team."
+__license__ = "LGPL"
+
+from gi.repository import Gtk
+from orca.gui.toolkits import status_bar
+
+class StatusBar(status_bar.StatusBar):
+
+ def __init__(self, numberOfAreas=1):
+ self._widget = Gtk.Statusbar()
+ self._widget.connect('map', self.onMap)
+ self._messageArea = self._widget.get_message_area()
+ self._labels = self._messageArea.get_children()
+ super(StatusBar, self).__init__(numberOfAreas)
+
+ def createLabels(self, numberOfAreas):
+ labels = [Gtk.Label() for i in range(numberOfAreas - 1)]
+ map(lambda l: self._messageArea.pack_start(l, True, True, 0), labels)
+ self._labels.extend(labels)
+
+ def setLabelWidth(self, index, width):
+ self._labels[index].set_size_request(width, -1)
+
+ def setLabelWidthInChars(self, index, nChars):
+ self._labels[index].set_width_chars(nChars)
+
+ def getCurrentMessage(self, index=0):
+ return self._labels[index].get_text()
+
+ def setMessage(self, text, index=0):
+ self._labels[index].set_text(text)
+
+ def clearMessage(self, index=0):
+ self.setMessage(self, '', index)
+
+ def setSpacing(self, spacing):
+ map(lambda l: l.set_padding(spacing, 0), self._labels)
+
+ def onMap(self, widget):
+ parent = widget.get_parent()
+ while parent and not isinstance(parent, Gtk.Window):
+ parent = parent.get_parent()
+
+ if parent:
+ parent.set_has_resize_grip(False)
diff --git a/src/orca/gui/toolkits/gtk3/tabbed_widget.py b/src/orca/gui/toolkits/gtk3/tabbed_widget.py
new file mode 100644
index 0000000..fb6327c
--- /dev/null
+++ b/src/orca/gui/toolkits/gtk3/tabbed_widget.py
@@ -0,0 +1,86 @@
+# Orca
+#
+# Copyright 2011 The Orca Team.
+# Author: Joanmarie Diggs <joanmarie diggs gmail com>
+#
+# 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.
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2011 The Orca Team."
+__license__ = "LGPL"
+
+from gi.repository.Gtk import Notebook as gtkNotebook
+from orca.gui.toolkits import tabbed_widget
+
+class TabbedWidget(tabbed_widget.TabbedWidget):
+
+ SIGNAL_PAGE_CHANGED = 'switch-page'
+
+ def __init__(self):
+ self._widget = gtkNotebook()
+ super(TabbedWidget, self).__init__()
+
+ def bind(self, signal, function, *args, **kwargs):
+ handler = self._getHandlerForSignal(signal)
+ if not handler:
+ return
+
+ self._widget.connect(signal, handler, function, *args, **kwargs)
+
+ def onPageChanged(self, widget, page, index, function, *args, **kwargs):
+ function(self, index, *args, **kwargs)
+
+ def addPage(self, widget, label=None):
+ if label:
+ label = label._widget
+ self._widget.append_page(widget._widget, label)
+
+ def insertPage(self, widget, label=None, position=0):
+ if label:
+ label = label._widget
+ self._widget.insert_page(widget._widget, label, position)
+
+ def removePage(self, position):
+ self._widget.remove_page(position)
+
+ def getCurrentPosition(self):
+ return self._widget.get_current_page()
+
+ def getNthPage(self, index):
+ return self._widget.get_nth_page(index)
+
+ def getNPages(self):
+ return self._widget.get_n_pages()
+
+ def pageNum(self, widget):
+ return self._widget.page_num(widget)
+
+ def gotoPage(self, index):
+ self._widget.set_current_page(index)
+
+ def gotoNextPage(self):
+ self._widget.next_page()
+
+ def gotoPrevPage(self):
+ self._widget.prev_page()
+
+ def getScrollable(self):
+ return self._widget.get_scrollable()
+
+ def setScrollable(self, scrollable):
+ self._widget.set_scrollable(scrollable)
diff --git a/src/orca/gui/toolkits/gtk3/table.py b/src/orca/gui/toolkits/gtk3/table.py
new file mode 100644
index 0000000..93080c1
--- /dev/null
+++ b/src/orca/gui/toolkits/gtk3/table.py
@@ -0,0 +1,57 @@
+# Orca
+#
+# Copyright 2011 The Orca Team.
+# Author: Joanmarie Diggs <joanmarie diggs gmail com>
+#
+# 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.
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2011 The Orca Team."
+__license__ = "LGPL"
+
+from gi.repository.Gtk import Table as gtkTable
+from orca.gui.toolkits import table
+
+class Table(table.Table):
+ def __init__(self, nRows, nColumns):
+ self._widget = gtkTable()
+ super(Table, self).__init__(nRows, nColumns)
+
+ def getSize(self):
+ rows = self._widget.get_property('n-rows')
+ columns = self._widget.get_property('n-columns')
+ return rows, columns
+
+ def setSize(self, nRows, nColumns):
+ self._widget.resize(nRows, nColumns)
+
+ def add(self, obj, row, col, rowspan=1, colspan=1):
+ self._widget.attach(obj._widget, col, col+colspan, row, row+rowspan)
+
+ def setPadding(self, child, xpadding, ypadding):
+ obj = child._widget
+ self._widget.child_set_property(obj, 'x-padding', xpadding)
+ self._widget.child_set_property(obj, 'y-padding', ypadding)
+
+ def setOptions(self, child, xoptions, yoptions):
+ obj = child._widget
+ self._widget.child_set_property(obj, 'x-options', xoptions)
+ self._widget.child_set_property(obj, 'y-options', yoptions)
+
+ def setContentsMargins(self, left, top, right, bottom):
+ pass
diff --git a/src/orca/gui/toolkits/gtk3/text_combo_box.py b/src/orca/gui/toolkits/gtk3/text_combo_box.py
new file mode 100644
index 0000000..618bde4
--- /dev/null
+++ b/src/orca/gui/toolkits/gtk3/text_combo_box.py
@@ -0,0 +1,73 @@
+# Orca
+#
+# Copyright 2011 The Orca Team.
+# Author: Joanmarie Diggs <joanmarie diggs gmail com>
+#
+# 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.
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2011 The Orca Team."
+__license__ = "LGPL"
+
+from gi.repository.Gtk import ComboBoxText as gtkComboBoxText
+from orca.gui.toolkits import text_combo_box
+
+class TextComboBox(text_combo_box.TextComboBox):
+
+ SIGNAL_SELECTION_CHANGED = 'changed'
+
+ def __init__(self, isEditable=False):
+ if not isEditable:
+ self._widget = gtkComboBoxText.new()
+ else:
+ self._widget = gtkComboBoxText.new_with_entry()
+ super(TextComboBox, self).__init__(isEditable)
+
+ def bind(self, signal, function, *args, **kwargs):
+ handler = self._getHandlerForSignal(signal)
+ if not handler:
+ return
+
+ self._widget.connect(signal, handler, function, *args, **kwargs)
+
+ def onSelectionChanged(self, widget, function, *args, **kwargs):
+ function(self, *args, **kwargs)
+
+ def addItemAtPosition(self, item, position):
+ self._widget.insert_text(position, item)
+
+ def removeItemFromPosition(self, position):
+ self._widget.text_remove(position)
+
+ def getSelectedItemPosition(self):
+ return self._widget.get_active()
+
+ def setSelectedItem(self, position):
+ self._widget.set_active(position)
+
+ def getSelectedText(self):
+ return self._widget.get_active_text()
+
+ def setTextColumn(self, column):
+ self._widget.set_entry_text_column(column)
+
+ def getIsEditable(self):
+ pass
+
+ def setIsEditable(self, setting):
+ pass
diff --git a/src/orca/gui/toolkits/gtk3/toolkit.py b/src/orca/gui/toolkits/gtk3/toolkit.py
new file mode 100644
index 0000000..efbf026
--- /dev/null
+++ b/src/orca/gui/toolkits/gtk3/toolkit.py
@@ -0,0 +1,88 @@
+# Orca
+#
+# Copyright 2011 The Orca Team.
+# Author: Joanmarie Diggs <joanmarie diggs gmail com>
+#
+# 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.
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2011 The Orca Team."
+__license__ = "LGPL"
+
+import gobject
+from gi.repository import Gtk
+
+from orca.gui import toolkit
+
+from box import HBox, VBox
+from checkbox import Checkbox
+from entry import Entry
+from frame import Frame
+from label import Label
+from message_dialog import MessageDialog
+from push_button import PushButton
+from radio_button import RadioButton
+from slider import HSlider, VSlider
+from spinner import Spinner
+from status_bar import StatusBar
+from tabbed_widget import TabbedWidget
+from table import Table
+from text_combo_box import TextComboBox
+from tree import Tree
+from tree_model import TreeModel
+from window import Window
+
+TYPE_BOOLEAN = "gboolean"
+TYPE_CHAR = "gchar"
+TYPE_DOUBLE = "gdouble"
+TYPE_FLOAT = "gfloat"
+TYPE_INT = "gint"
+TYPE_LONG = "glong"
+TYPE_NONE = "void"
+TYPE_STRING = "gchararray"
+TYPE_UCHAR = "guchar"
+TYPE_UINT = "guint"
+TYPE_ULONG = "gulong"
+TYPE_UNICHAR = "guint"
+
+STOCK_ABOUT = Gtk.STOCK_ABOUT
+STOCK_APPLY = Gtk.STOCK_APPLY
+STOCK_CANCEL = Gtk.STOCK_CANCEL
+STOCK_CLOSE = Gtk.STOCK_CLOSE
+STOCK_FIND = Gtk.STOCK_FIND
+STOCK_HELP = Gtk.STOCK_HELP
+STOCK_NO = Gtk.STOCK_NO
+STOCK_OK = Gtk.STOCK_OK
+STOCK_OPEN = Gtk.STOCK_OPEN
+STOCK_PREFERENCES = Gtk.STOCK_PREFERENCES
+STOCK_QUIT = Gtk.STOCK_QUIT
+STOCK_SAVE = Gtk.STOCK_SAVE
+STOCK_SAVE_AS = Gtk.STOCK_SAVE_AS
+STOCK_YES = Gtk.STOCK_YES
+
+def main():
+ return Gtk.main()
+
+def timeoutAdd(time, function):
+ gobject.timeout_add(time, function)
+
+class Toolkit(toolkit.Toolkit):
+
+ def __init__(self):
+ super(Toolkit, self).__init__()
+
diff --git a/src/orca/gui/toolkits/gtk3/tree.py b/src/orca/gui/toolkits/gtk3/tree.py
new file mode 100644
index 0000000..92b0933
--- /dev/null
+++ b/src/orca/gui/toolkits/gtk3/tree.py
@@ -0,0 +1,131 @@
+# Orca
+#
+# Copyright 2011 The Orca Team.
+# Author: Joanmarie Diggs <joanmarie diggs gmail com>
+#
+# 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.
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2011 The Orca Team."
+__license__ = "LGPL"
+
+from gi.repository import Gtk
+from orca.gui.toolkits import tree
+
+import tree_model
+
+class Tree(tree.Tree):
+
+ GRID_LINES_NONE = Gtk.TreeViewGridLines.NONE
+ GRID_LINES_HORIZONTAL = Gtk.TreeViewGridLines.HORIZONTAL
+ GRID_LINES_VERTICAL = Gtk.TreeViewGridLines.VERTICAL
+ GRID_LINES_BOTH = Gtk.TreeViewGridLines.BOTH
+
+ ORDER_DESCENDING = Gtk.SortType.DESCENDING
+ ORDER_ASCENDING = Gtk.SortType.ASCENDING
+
+ def __init__(self, *args):
+ self._widget = Gtk.TreeView()
+ self._model = None
+ super(Tree, self).__init__(*args)
+
+ model = tree_model.TreeModel(*args)
+ self.setModel(model)
+ cellRenderer = Gtk.CellRendererText()
+ for i, columnType in enumerate(args):
+ column = Gtk.TreeViewColumn(None, cellRenderer, text=i)
+ self._widget.append_column(column)
+ self.setColumnResizable(i, True)
+
+ def getColumnTitle(self, column):
+ treeColumn = self._widget.get_column(column)
+ return treeColumn.get_title()
+
+ def setColumnTitle(self, column, title):
+ treeColumn = self._widget.get_column(column)
+ return treeColumn.set_title(title)
+
+ def getColumnHidden(self, column):
+ treeColumn = self._widget.get_column(column)
+ return not treeColumn.get_visible()
+
+ def setColumnHidden(self, column, hide):
+ treeColumn = self._widget.get_column(column)
+ treeColumn.set_visible(not hide)
+
+ def getHeadersHidden(self):
+ return not self._widget.get_headers_visible()
+
+ def setHeadersHidden(self, hide):
+ self._widget.set_headers_visible(not hide)
+
+ def getColumnResizable(self, column):
+ treeColumn = self._widget.get_column(column)
+ return treeColumn.get_resizable()
+
+ def setColumnResizable(self, column, resizable):
+ treeColumn = self._widget.get_column(column)
+ treeColumn.set_resizable(resizable)
+
+ def collapseAll(self):
+ self._widget.collapse_all()
+
+ def expandAll(self):
+ self._widget.expand_all()
+
+ def getRowExpanded(self, row):
+ return self._widget.row_expanded(row)
+
+ def setRowExpanded(self, row, expanded):
+ if expanded:
+ self._widget.expand_row(row, False)
+ else:
+ self._widget.collapse_row(row)
+
+ def getItemsExpandable(self):
+ pass
+
+ def setItemsExpandable(self,expandable):
+ pass
+
+ def setRootIsDecorated(self, setting):
+ pass
+
+ def sortByColumn(self, column, order):
+ self._model.setSortColumnId(column, order)
+ treeColumn = self._widget.get_column(column)
+ treeColumn.set_sort_column_id(column)
+ treeColumn.set_sort_indicator(True)
+
+ def setRulesHint(self, hint):
+ self._widget.set_rules_hint(hint)
+
+ def getGridLines(self):
+ return self._widget.get_grid_lines()
+
+ def setGridLines(self, gridLineType):
+ self._widget.set_grid_lines(gridLineType)
+
+ def getModel(self):
+ return self._model
+
+ def setModel(self, model):
+ toolkitModel = model._model
+ self._widget.set_model(toolkitModel)
+ self._model = model
+
diff --git a/src/orca/gui/toolkits/gtk3/tree_model.py b/src/orca/gui/toolkits/gtk3/tree_model.py
new file mode 100644
index 0000000..0283311
--- /dev/null
+++ b/src/orca/gui/toolkits/gtk3/tree_model.py
@@ -0,0 +1,73 @@
+# Orca
+#
+# Copyright 2011 The Orca Team.
+# Author: Joanmarie Diggs <joanmarie diggs gmail com>
+#
+# 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.
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2011 The Orca Team."
+__license__ = "LGPL"
+
+from gi.repository.Gtk import TreeStore as gtkTreeStore
+from orca.gui.toolkits import tree_model
+
+class TreeModel(tree_model.TreeModel):
+
+ def __init__(self, *args):
+ self._model = gtkTreeStore(*args)
+ super(TreeModel, self).__init__(*args)
+
+ def setValue(self, row, column, value):
+ self._model.set_value(row, column, value)
+
+ def remove(self, row):
+ return self._model.remove(row)
+
+ def insert(self, parent, position, rowItems):
+ return self._model.insert(parent, position, rowItems)
+
+ def prepend(self, parent, rowItems):
+ return self._model.prepend(parent, rowItems)
+
+ def append(self, parent, rowItems):
+ return self._model.append(parent, rowItems)
+
+ def isAncestor(self, row, descendant):
+ return self._model.is_ancestor(row, descendant)
+
+ def rowDepth(self, row):
+ return self._model.iter_depth(row)
+
+ def clear(self):
+ self._model.clear()
+
+ def reorder(self, parent, new_order):
+ self._model.reorder(parent, new_order)
+
+ def swap(self, a, b):
+ self._model.swap(a, b)
+
+ def moveAfter(self, row, position):
+ self._model.move_after(row, position)
+
+ def moveBefore(self, row, position):
+ self._model.move_before(row, position)
+
+ def setSortColumnId(self, column, order):
+ self._model.set_sort_column_id(column, order)
diff --git a/src/orca/gui/toolkits/gtk3/window.py b/src/orca/gui/toolkits/gtk3/window.py
new file mode 100644
index 0000000..5becd37
--- /dev/null
+++ b/src/orca/gui/toolkits/gtk3/window.py
@@ -0,0 +1,133 @@
+# Orca
+#
+# Copyright 2011 The Orca Team.
+# Author: Joanmarie Diggs <joanmarie diggs gmail com>
+#
+# 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.
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2011 The Orca Team."
+__license__ = "LGPL"
+
+from gi.repository.Gtk import Window as gtkWindow, VBox as gtkVBox
+from orca.gui.toolkits import window
+
+class Window(window.Window):
+
+ SIGNAL_CLOSE_EVENT = 'delete-event'
+
+ def __init__(self, title):
+ self._widget = gtkWindow()
+ self._container = gtkVBox()
+ self._widget.add(self._container)
+ self._isEmpty = True
+ super(Window, self).__init__(title)
+
+ def bind(self, signal, function, *args, **kwargs):
+ handler = self._getHandlerForSignal(signal)
+ if not handler:
+ return
+
+ self._widget.connect(signal, handler, function, *args, **kwargs)
+
+ def onClose(self, widget, event, function, *args, **kwargs):
+ function(self, event, *args, **kwargs)
+
+ def getTitle(self):
+ return self._widget.get_title()
+
+ def setTitle(self, title):
+ self._widget.set_title(title)
+
+ def getDefaultSize(self):
+ return self._widget.get_default_size()
+
+ def setDefaultSize(self, width, height):
+ self._widget.set_default_size(width, height)
+
+ def getModal(self):
+ return self._widget.get_modal()
+
+ def setModal(self, modal):
+ return self._widget.get_modal(modal)
+
+ def getKeepAbove(self):
+ return self._widget.get_keep_above()
+
+ def setKeepAbove(self, setting):
+ self._widget.set_keep_above(setting)
+
+ def getDestroyWithParent(self):
+ return self._widget.get_destroy_with_parent()
+
+ def setDestroyWithParent(self, setting):
+ self._widget.set_destroy_with_parent(setting)
+
+ def getSkipTaskbarHint(self):
+ return self._widget.get_skip_taskbar_hint()
+
+ def setSkipTaskbarHint(self, setting):
+ self._widget.set_skip_taskbar_hint(setting)
+
+ def getUrgencyHint(self):
+ return self._widget.get_urgency_hint()
+
+ def setUrgencyHint(self, setting):
+ self._widget.set_urgency_hint(setting)
+
+ def getSkipPagerHint(self):
+ return self._widget.get_skip_pager_hint()
+
+ def setSkipPagerHint(self, setting):
+ self._widget.set_skip_pager_hint(setting)
+
+ def getDecorated(self):
+ return self._widget.get_decorated()
+
+ def setDecorated(self, setting):
+ self._widget.set_decorated(setting)
+
+ def getResizable(self):
+ return self._widget.get_resizable()
+
+ def setResizable(self, resizable):
+ self._widget.set_resizable(resizable)
+
+ def getTransientFor(self):
+ return self._widget.get_transient_for()
+
+ def setTransientFor(self, parent):
+ self._widget.set_transient_for(parent)
+
+ def add(self, obj):
+ expand = self._isEmpty
+ fill = self._isEmpty
+ self._container.pack_start(obj._widget, expand, fill, 0)
+ self._isEmpty = False
+
+ def display(self):
+ self._widget.show_all()
+
+ def hide(self):
+ self._widget.hide()
+
+ def close(self):
+ self._widget.close()
+
+ def destroy(self):
+ self._widget.destroy()
diff --git a/src/orca/gui/toolkits/label.py b/src/orca/gui/toolkits/label.py
new file mode 100644
index 0000000..04a7868
--- /dev/null
+++ b/src/orca/gui/toolkits/label.py
@@ -0,0 +1,68 @@
+# Orca
+#
+# Copyright 2011 The Orca Team.
+# Author: Joanmarie Diggs <joanmarie diggs gmail com>
+#
+# 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.
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2011 The Orca Team."
+__license__ = "LGPL"
+
+from abstract_widget import AbstractWidget
+
+class Label(AbstractWidget):
+
+ def __init__(self, text):
+ super(Label, self).__init__()
+ self.setDisplayedText(text)
+ self.setUseUnderline(True)
+ self.setUseMarkup(True)
+
+ def getDisplayedText(self):
+ pass
+
+ def setDisplayedText(self, displayedText):
+ pass
+
+ def getUseUnderline(self):
+ pass
+
+ def setUseUnderline(self, setting):
+ pass
+
+ def setDisplayedText(self, displayedText):
+ pass
+
+ def getUseMarkup(self):
+ pass
+
+ def setUseMarkup(self, setting):
+ pass
+
+ def getWrapText(self):
+ pass
+
+ def setWrapText(self, setting):
+ pass
+
+ def getMnemonicWidget(self):
+ pass
+
+ def setMnemonicWidget(self, widget):
+ pass
diff --git a/src/orca/gui/toolkits/message_dialog.py b/src/orca/gui/toolkits/message_dialog.py
new file mode 100644
index 0000000..08c3cad
--- /dev/null
+++ b/src/orca/gui/toolkits/message_dialog.py
@@ -0,0 +1,97 @@
+# Orca
+#
+# Copyright 2011 The Orca Team.
+# Author: Joanmarie Diggs <joanmarie diggs gmail com>
+#
+# 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.
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2011 The Orca Team."
+__license__ = "LGPL"
+
+from abstract_widget import AbstractWidget
+
+class MessageDialog(AbstractWidget):
+
+ SIGNAL_CLOSE = None
+ SIGNAL_RESPONSE = None
+
+ MESSAGE_INFO = None
+ MESSAGE_WARNING = None
+ MESSAGE_QUESTION = None
+ MESSAGE_ERROR = None
+
+ BUTTON_OK = None
+ BUTTON_CLOSE = None
+ BUTTON_CANCEL = None
+ BUTTON_YES = None
+ BUTTON_NO = None
+
+ RESPONSE_OK = None
+ RESPONSE_CLOSE = None
+ RESPONSE_CANCEL = None
+ RESPONSE_YES = None
+ RESPONSE_NO = None
+
+ def __init__(self):
+ super(MessageDialog, self).__init__()
+ self.setDefaultSize(400, 100)
+
+ def _getHandlerForSignal(self, signal):
+ if signal == self.SIGNAL_CLOSE:
+ return self.onClose
+ if signal == self.SIGNAL_RESPONSE:
+ return self.onResponse
+
+ return None
+
+ def bind(self, signal, function, *args, **kwargs):
+ pass
+
+ def onClose(self, widget, function, *args, **kwargs):
+ pass
+
+ def onResponse(self, widget, responseID, function, *args, **kwargs):
+ pass
+
+ def setDefaultSize(self, width, height):
+ pass
+
+ def setSize(self, width, height):
+ pass
+
+ def setType(self, messageType):
+ pass
+
+ def setMainText(self, text):
+ pass
+
+ def setSecondaryText(self, text):
+ pass
+
+ def addButton(self, button):
+ pass
+
+ def display(self):
+ pass
+
+ def hide(self):
+ pass
+
+ def destroy(self):
+ pass
diff --git a/src/orca/gui/toolkits/push_button.py b/src/orca/gui/toolkits/push_button.py
new file mode 100644
index 0000000..1e68ecb
--- /dev/null
+++ b/src/orca/gui/toolkits/push_button.py
@@ -0,0 +1,70 @@
+# Orca
+#
+# Copyright 2011 The Orca Team.
+# Author: Joanmarie Diggs <joanmarie diggs gmail com>
+#
+# 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.
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2011 The Orca Team."
+__license__ = "LGPL"
+
+from abstract_widget import AbstractWidget
+
+class PushButton(AbstractWidget):
+
+ SIGNAL_CLICKED = None
+
+ def __init__(self, label, stock):
+ super(PushButton, self).__init__()
+
+ def _getHandlerForSignal(self, signal):
+ if signal == self.SIGNAL_CLICKED:
+ return self.onClicked
+
+ return None
+
+ def bind(self, signal, function, *args, **kwargs):
+ pass
+
+ def onClicked(self, widget, function, *args, **kwargs):
+ pass
+
+ def getIsDefault(self):
+ pass
+
+ def setIsDefault(self, isDefault):
+ pass
+
+ def getUseUnderline(self):
+ pass
+
+ def setUseUnderline(self, setting):
+ pass
+
+ def getDisplayedText(self):
+ pass
+
+ def setDisplayedText(self, displayedText):
+ pass
+
+ def getUseStock(self):
+ pass
+
+ def setUseStock(self, useStock):
+ pass
diff --git a/src/orca/gui/toolkits/qt/Makefile.am b/src/orca/gui/toolkits/qt/Makefile.am
new file mode 100644
index 0000000..123914f
--- /dev/null
+++ b/src/orca/gui/toolkits/qt/Makefile.am
@@ -0,0 +1,24 @@
+orca_pathdir=$(pyexecdir)
+
+orca_python_PYTHON = \
+ __init__.py \
+ box.py \
+ checkbox.py \
+ entry.py \
+ frame.py \
+ label.py \
+ message_dialog.py \
+ push_button.py \
+ radio_button.py \
+ slider.py \
+ spinner.py \
+ status_bar.py \
+ tabbed_widget.py \
+ table.py \
+ text_combo_box.py \
+ tree.py \
+ tree_model.py \
+ toolkit.py \
+ window.py
+
+orca_pythondir=$(pyexecdir)/orca/gui/toolkits/qt
diff --git a/src/orca/gui/toolkits/qt/__init__.py b/src/orca/gui/toolkits/qt/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/src/orca/gui/toolkits/qt/box.py b/src/orca/gui/toolkits/qt/box.py
new file mode 100644
index 0000000..3d46fdb
--- /dev/null
+++ b/src/orca/gui/toolkits/qt/box.py
@@ -0,0 +1,111 @@
+# Orca
+#
+# Copyright 2011 The Orca Team.
+# Author: Joanmarie Diggs <joanmarie diggs gmail com>
+#
+# 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.
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2011 The Orca Team."
+__license__ = "LGPL"
+
+from PyQt4 import QtGui
+from PyQt4.QtCore import Qt, QMargins
+from orca.gui.toolkits import box
+
+class Box(box.Box):
+ def __init__(self, direction):
+ self._widget = QtGui.QBoxLayout(direction)
+ super(Box, self).__init__()
+
+ def add(self, obj, expand=False, fill=False, padding=0):
+ # TODO: Find the equivalent in Qt to expand, fill, and padding.
+ # Look at stretch and spacers
+ child = obj._widget
+ if isinstance(child, QtGui.QLayout):
+ self._widget.addLayout(child)
+ elif isinstance(child, QtGui.QWidget):
+ self._widget.addWidget(child)
+ else:
+ self._widget.addItem(child)
+
+ def getHomogeneous(self):
+ pass
+
+ def setHomogeneous(self, setting):
+ pass
+
+ def getSpacing(self):
+ return self._widget.spacing()
+
+ def setSpacing(self, spacing):
+ self._widget.setSpacing(spacing)
+
+ def getPadding(self):
+ m = self._widget.contentsMargins()
+ return m.top(), m.bottom(), m.left(), m.right()
+
+ def setPadding(self, top, bottom, left, right):
+ self._widget.setContentsMargins(left, top, right, bottom)
+
+ def setTopPadding(self, amount):
+ m = self._widget.contentsMargins()
+ m.setTop(amount)
+
+ def setLeftPadding(self, amount):
+ m = self._widget.contentsMargins()
+ m.setLeft(amount)
+
+ def setBottomPadding(self, amount):
+ m = self._widget.contentsMargins()
+ m.setBottom(amount)
+
+ def setRightPadding(self, amount):
+ m = self._widget.contentsMargins()
+ m.setRight(amount)
+
+ def setAlignment(self, xalign, yalign, xscale, yscale):
+ pass
+
+ def alignLeft(self):
+ self._widget.setAlignment(Qt.AlignLeft)
+
+ def alignHCenter(self):
+ self._widget.setAlignment(Qt.AlignHCenter)
+
+ def alignRight(self):
+ self._widget.setAlignment(Qt.AlignRight)
+
+ def alignTop(self):
+ self._widget.setAlignment(Qt.AlignTop)
+
+ def alignVCenter(self):
+ self._widget.setAlignment(Qt.AlignVCenter)
+
+ def alignBottom(self):
+ self._widget.setAlignment(Qt.AlignBottom)
+
+class HBox(Box):
+
+ def __init__(self):
+ super(HBox, self).__init__(QtGui.QBoxLayout.LeftToRight)
+
+class VBox(Box):
+
+ def __init__(self):
+ super(VBox, self).__init__(QtGui.QBoxLayout.TopToBottom)
diff --git a/src/orca/gui/toolkits/qt/checkbox.py b/src/orca/gui/toolkits/qt/checkbox.py
new file mode 100644
index 0000000..83a5781
--- /dev/null
+++ b/src/orca/gui/toolkits/qt/checkbox.py
@@ -0,0 +1,71 @@
+# Orca
+#
+# Copyright 2011 The Orca Team.
+# Author: Joanmarie Diggs <joanmarie diggs gmail com>
+#
+# 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.
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2011 The Orca Team."
+__license__ = "LGPL"
+
+from PyQt4.QtGui import QCheckBox
+from PyQt4.QtCore import QObject, SIGNAL
+from orca.gui.toolkits import checkbox
+
+class Checkbox(checkbox.Checkbox):
+
+ SIGNAL_TOGGLED = SIGNAL('stateChanged(int)')
+
+ def __init__(self, label, state):
+ self._widget = QCheckBox()
+ super(Checkbox, self).__init__(label, state)
+
+ def bind(self, signal, function, *args, **kwargs):
+ handler = self._getHandlerForSignal(signal)
+ if not handler:
+ return
+
+ def wrappedFunction():
+ handler(self._widget, function, *args, **kwargs)
+
+ QObject.connect(self._widget, signal, wrappedFunction)
+
+ def onToggled(self, widget, function, *args, **kwargs):
+ function(self, *args, **kwargs)
+
+ def getState(self):
+ return self._widget.isChecked()
+
+ def setState(self, checked):
+ if self.getState() != checked:
+ self._widget.toggle()
+
+ def getUseUnderline(self):
+ return True
+
+ def setUseUnderline(self, setting):
+ # Qt seems to do this by default
+ pass
+
+ def getDisplayedText(self):
+ return str(self._widget.text())
+
+ def setDisplayedText(self, displayedText):
+ displayedText = displayedText.replace('_', '&')
+ self._widget.setText(displayedText)
diff --git a/src/orca/gui/toolkits/qt/entry.py b/src/orca/gui/toolkits/qt/entry.py
new file mode 100644
index 0000000..ed43744
--- /dev/null
+++ b/src/orca/gui/toolkits/qt/entry.py
@@ -0,0 +1,72 @@
+# Orca
+#
+# Copyright 2011 The Orca Team.
+# Author: Joanmarie Diggs <joanmarie diggs gmail com>
+#
+# 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.
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2011 The Orca Team."
+__license__ = "LGPL"
+
+from PyQt4.QtGui import QLineEdit
+from PyQt4.QtCore import QObject, SIGNAL
+from orca.gui.toolkits import entry
+
+class Entry(entry.Entry):
+
+ SIGNAL_TEXT_CHANGED = SIGNAL('textChanged(QString)')
+
+ def __init__(self, text, isPasswordText):
+ self._widget = QLineEdit()
+ super(Entry, self).__init__(text, isPasswordText)
+
+ def bind(self, signal, function, *args, **kwargs):
+ handler = self._getHandlerForSignal(signal)
+ if not handler:
+ return
+
+ def wrappedFunction():
+ handler(self._widget, function, *args, **kwargs)
+
+ QObject.connect(self._widget, signal, wrappedFunction)
+
+ def onTextChanged(self, widget, function, *args, **kwargs):
+ function(self, *args, **kwargs)
+
+ def getDisplayedText(self):
+ return self._widget.text()
+
+ def setDisplayedText(self, text):
+ self._widget.setText(text)
+
+ def getIsPasswordText(self):
+ return self._widget.echoMode == QLineEdit.Password
+
+ def setIsPasswordText(self, isPasswordText):
+ if isPasswordText:
+ self._widget.setEchoMode(QLineEdit.Password)
+ else:
+ self._widget.setEchoMode(QLineEdit.Normal)
+
+ def getActivatesDefault(self):
+ pass
+
+ def setActivatesDefault(self, activatesDefault):
+ pass
+
diff --git a/src/orca/gui/toolkits/qt/frame.py b/src/orca/gui/toolkits/qt/frame.py
new file mode 100644
index 0000000..5acde00
--- /dev/null
+++ b/src/orca/gui/toolkits/qt/frame.py
@@ -0,0 +1,67 @@
+# Orca
+#
+# Copyright 2011 The Orca Team.
+# Author: Joanmarie Diggs <joanmarie diggs gmail com>
+#
+# 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.
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2011 The Orca Team."
+__license__ = "LGPL"
+
+from PyQt4 import QtGui
+from orca.gui.toolkits import frame
+
+class Frame(frame.Frame):
+
+ SHADOW_NONE = QtGui.QFrame.Plain
+ SHADOW_IN = QtGui.QFrame.Sunken
+ SHADOW_OUT = QtGui.QFrame.Raised
+ SHADOW_ETCHED_IN = QtGui.QFrame.Sunken
+ SHADOW_ETCHED_OUT = QtGui.QFrame.Raised
+
+ def __init__(self, labelText):
+ self._widget = QtGui.QGroupBox()
+ super(Frame, self).__init__(labelText)
+
+ def getLabel(self):
+ self._widget.title()
+
+ def setLabel(self, label):
+ self._widget.setTitle(label)
+
+ def getShadowType(self):
+ pass
+
+ def setShadowType(self, shadowType):
+ pass
+
+ def getBorderWidth(self):
+ pass
+
+ def setBorderWidth(self, width):
+ pass
+
+ def add(self, obj):
+ child = obj._widget
+ if isinstance(child, QtGui.QLayout):
+ self._widget.setLayout(child)
+ elif isinstance(child, QtGui.QWidget):
+ self._widget.addWidget(child)
+ else:
+ self._widget.addItem(child)
diff --git a/src/orca/gui/toolkits/qt/label.py b/src/orca/gui/toolkits/qt/label.py
new file mode 100644
index 0000000..3c38867
--- /dev/null
+++ b/src/orca/gui/toolkits/qt/label.py
@@ -0,0 +1,67 @@
+# Orca
+#
+# Copyright 2011 The Orca Team.
+# Author: Joanmarie Diggs <joanmarie diggs gmail com>
+#
+# 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.
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2011 The Orca Team."
+__license__ = "LGPL"
+
+from PyQt4.QtGui import QLabel
+from orca.gui.toolkits import label
+
+class Label(label.Label):
+ def __init__(self, text):
+ self._widget = QLabel()
+ super(Label, self).__init__(text)
+
+ def getDisplayedText(self):
+ return self._widget.text()
+
+ def setDisplayedText(self, text):
+ text = text.replace('_', '&')
+ self._widget.setText(text)
+
+ def getUseUnderline(self):
+ return True
+
+ def setUseUnderline(self, setting):
+ # Qt seems to do this by default
+ pass
+
+ def getUseMarkup(self):
+ # TODO: Find equivalent for Qt
+ pass
+
+ def setUseMarkup(self, setting):
+ # TODO: Find equivalent for Qt
+ pass
+
+ def getWrapText(self):
+ return self._widget.wordWrap()
+
+ def setWrapText(self, setting):
+ self._widget.setWordWrap(setting)
+
+ def getMnemonicWidget(self):
+ return self._widget.buddy()
+
+ def setMnemonicWidget(self, widget):
+ self._widget.setBuddy(widget._widget)
diff --git a/src/orca/gui/toolkits/qt/message_dialog.py b/src/orca/gui/toolkits/qt/message_dialog.py
new file mode 100644
index 0000000..27a4647
--- /dev/null
+++ b/src/orca/gui/toolkits/qt/message_dialog.py
@@ -0,0 +1,97 @@
+# Orca
+#
+# Copyright 2011 The Orca Team.
+# Author: Joanmarie Diggs <joanmarie diggs gmail com>
+#
+# 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.
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2011 The Orca Team."
+__license__ = "LGPL"
+
+from PyQt4.QtGui import QMessageBox
+from PyQt4.QtCore import QObject, SIGNAL
+from orca.gui.toolkits import message_dialog
+
+class MessageDialog(message_dialog.MessageDialog):
+
+ SIGNAL_CLOSE = SIGNAL('closeEvent(QEvent)')
+ SIGNAL_RESPONSE = SIGNAL('buttonClicked(QAbstractButton)')
+
+ MESSAGE_INFO = QMessageBox.Information
+ MESSAGE_WARNING = QMessageBox.Warning
+ MESSAGE_QUESTION = QMessageBox.Question
+ MESSAGE_ERROR = QMessageBox.Critical
+
+ BUTTON_OK = QMessageBox.Ok
+ BUTTON_CLOSE = QMessageBox.Close
+ BUTTON_CANCEL = QMessageBox.Cancel
+ BUTTON_YES = QMessageBox.Yes
+ BUTTON_NO = QMessageBox.No
+
+ RESPONSE_OK = QMessageBox.AcceptRole
+ RESPONSE_CLOSE = QMessageBox.RejectRole
+ RESPONSE_CANCEL = QMessageBox.RejectRole
+ RESPONSE_YES = QMessageBox.YesRole
+ RESPONSE_NO = QMessageBox.NoRole
+
+ def __init__(self):
+ self._widget = QMessageBox()
+ super(MessageDialog, self).__init__()
+
+ def bind(self, signal, function, *args, **kwargs):
+ handler = self._getHandlerForSignal(signal)
+ if not handler:
+ return
+
+ def wrappedFunction():
+ handler(self._widget, function, *args, **kwargs)
+
+ QObject.connect(self._widget, signal, wrappedFunction)
+
+ def onResponse(self, widget, button, function, *args, **kwargs):
+ function(self, button, *args, **kwargs)
+ self.hide()
+
+ def setDefaultSize(self, width, height):
+ self._widget.setMinimumSize(width, height)
+
+ def setSize(self, width, height):
+ self._widget.adjustSize(width, height)
+
+ def setType(self, messageType):
+ self._widget.setIcon(messageType)
+
+ def setMainText(self, text):
+ self._widget.setText('<b>%s</b>' % text)
+
+ def setSecondaryText(self, text):
+ self._widget.setInformativeText(text)
+
+ def addButton(self, button):
+ self._widget.addButton(button)
+
+ def display(self):
+ self._widget.show()
+
+ def hide(self):
+ self._widget.hide()
+
+ def destroy(self):
+ self._widget.destroy()
+
diff --git a/src/orca/gui/toolkits/qt/push_button.py b/src/orca/gui/toolkits/qt/push_button.py
new file mode 100644
index 0000000..2447101
--- /dev/null
+++ b/src/orca/gui/toolkits/qt/push_button.py
@@ -0,0 +1,80 @@
+# Orca
+#
+# Copyright 2011 The Orca Team.
+# Author: Joanmarie Diggs <joanmarie diggs gmail com>
+#
+# 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.
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2011 The Orca Team."
+__license__ = "LGPL"
+
+from PyQt4.QtGui import QPushButton
+from PyQt4.QtCore import QObject, SIGNAL
+from orca.gui.toolkits import push_button
+
+class PushButton(push_button.PushButton):
+
+ SIGNAL_CLICKED = SIGNAL('clicked(bool)')
+
+ def __init__(self, label='', stock=None):
+ if stock:
+ stock, label = stock
+ label = label.replace('_', '&')
+
+ self._widget = QPushButton(stock, label)
+ super(PushButton, self).__init__(label, stock)
+
+ def bind(self, signal, function, *args, **kwargs):
+ handler = self._getHandlerForSignal(signal)
+ if not handler:
+ return
+
+ def wrappedFunction():
+ handler(self._widget, function, *args, **kwargs)
+
+ QObject.connect(self._widget, signal, wrappedFunction)
+
+ def onClicked(self, widget, function, *args, **kwargs):
+ function(self, *args, **kwargs)
+
+ def getIsDefault(self):
+ return self._widget.isDefault()
+
+ def getUseUnderline(self):
+ return True
+
+ def setUseUnderline(self, setting):
+ # Qt seems to do this by default
+ pass
+
+ def setIsDefault(self, isDefault):
+ self._widget.setDefault(isDefault)
+
+ def getDisplayedText(self):
+ return str(self._widget.text())
+
+ def setDisplayedText(self, displayedText):
+ displayedText = displayedText.replace('_', '&')
+ self._widget.setText(displayedText)
+
+ def getUseStock(self):
+ pass
+
+ def setUseStock(self, useStock):
+ pass
diff --git a/src/orca/gui/toolkits/qt/radio_button.py b/src/orca/gui/toolkits/qt/radio_button.py
new file mode 100644
index 0000000..16afbdb
--- /dev/null
+++ b/src/orca/gui/toolkits/qt/radio_button.py
@@ -0,0 +1,83 @@
+# Orca
+#
+# Copyright 2011 The Orca Team.
+# Author: Joanmarie Diggs <joanmarie diggs gmail com>
+#
+# 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.
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2011 The Orca Team."
+__license__ = "LGPL"
+
+from PyQt4.QtGui import QRadioButton, QButtonGroup
+from PyQt4.QtCore import QObject, SIGNAL
+from orca.gui.toolkits import radio_button
+
+class RadioButton(radio_button.RadioButton):
+
+ SIGNAL_TOGGLED = SIGNAL('toggled(bool)')
+
+ def __init__(self, label, firstInGroup, state):
+ self._widget = QRadioButton()
+ super(RadioButton, self).__init__(label, firstInGroup, state)
+
+ def bind(self, signal, function, *args, **kwargs):
+ handler = self._getHandlerForSignal(signal)
+ if not handler:
+ return
+
+ def wrappedFunction():
+ handler(self._widget, function, *args, **kwargs)
+
+ QObject.connect(self._widget, signal, wrappedFunction)
+
+ def onToggled(self, widget, function, *args, **kwargs):
+ function(self)
+
+ def getState(self):
+ return self._widget.isChecked()
+
+ def setState(self, checked):
+ if self.getState() != checked:
+ self._widget.toggle()
+
+ def getUseUnderline(self):
+ return True
+
+ def setUseUnderline(self, setting):
+ # Qt seems to do this by default
+ pass
+
+ def getDisplayedText(self):
+ return str(self._widget.text())
+
+ def setDisplayedText(self, displayedText):
+ displayedText = displayedText.replace('_', '&')
+ self._widget.setText(displayedText)
+
+ def getGroup(self):
+ return self._widget.group()
+
+ def setGroup(self, firstInGroup):
+ group = None
+ if firstInGroup:
+ group = firstInGroup._widget.group()
+ if not group:
+ group = QButtonGroup()
+ if group:
+ group.addButton(self._widget)
diff --git a/src/orca/gui/toolkits/qt/slider.py b/src/orca/gui/toolkits/qt/slider.py
new file mode 100644
index 0000000..43fcc90
--- /dev/null
+++ b/src/orca/gui/toolkits/qt/slider.py
@@ -0,0 +1,99 @@
+# Orca
+#
+# Copyright 2011 The Orca Team.
+# Author: Joanmarie Diggs <joanmarie diggs gmail com>
+#
+# 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.
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2011 The Orca Team."
+__license__ = "LGPL"
+
+from PyQt4.QtGui import QSlider
+from PyQt4.QtCore import Qt, QObject, SIGNAL
+from orca.gui.toolkits import slider
+
+class Slider(slider.Slider):
+
+ SIGNAL_VALUE_CHANGED = SIGNAL('valueChanged(int)')
+
+ def __init__(self, orientation):
+ self._widget = QSlider(orientation)
+ super(Slider, self).__init__()
+
+ def bind(self, signal, function, *args, **kwargs):
+ handler = self._getHandlerForSignal(signal)
+ if not handler:
+ return
+
+ def wrappedFunction():
+ handler(self._widget, function, *args, **kwargs)
+
+ QObject.connect(self._widget, signal, wrappedFunction)
+
+ def onValueChanged(self, widget, function, *args, **kwargs):
+ function(self, *args, **kwargs)
+
+ def getRange(self):
+ return self._widget.minimum(), self._widget.maximum()
+
+ def setRange(self, minimum, maximum):
+ self._widget.setMinimum(minimum)
+ self._widget.setMaximum(maximum)
+
+ def getIncrements(self):
+ return self._widget.singleStep(), self._widget.pageStep()
+
+ def setIncrements(self, step, page):
+ self._widget.setSingleStep(step)
+ self._widget.setPageStep(page)
+
+ def getValue(self):
+ return self._widget.value()
+
+ def setValue(self, value):
+ super(Slider, self).setValue(value)
+
+ def getValuePosition(self):
+ return self._widget.tickPosition()
+
+ def setValuePosition(self, position):
+ self._widget.setTickPosition(position)
+
+ # TODO: Need to find the Qt equivalents
+ def getPrecision(self):
+ pass
+
+ def setPrecision(self, digits):
+ pass
+
+ def getShowCurrentValue(self):
+ pass
+
+ def setShowCurrentValue(self, showCurrent):
+ pass
+
+class HSlider(Slider):
+
+ def __init__(self):
+ super(HSlider, self).__init__(Qt.Horizontal)
+
+class VSlider(Slider):
+
+ def __init__(self):
+ super(VSlider, self).__init__(Qt.Vertical)
diff --git a/src/orca/gui/toolkits/qt/spinner.py b/src/orca/gui/toolkits/qt/spinner.py
new file mode 100644
index 0000000..594339c
--- /dev/null
+++ b/src/orca/gui/toolkits/qt/spinner.py
@@ -0,0 +1,88 @@
+# Orca
+#
+# Copyright 2011 The Orca Team.
+# Author: Joanmarie Diggs <joanmarie diggs gmail com>
+#
+# 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.
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2011 The Orca Team."
+__license__ = "LGPL"
+
+from PyQt4.QtGui import QSpinBox
+from PyQt4.QtCore import QObject, SIGNAL
+from orca.gui.toolkits import spinner
+
+class Spinner(spinner.Spinner):
+
+ SIGNAL_VALUE_CHANGED = SIGNAL('valueChanged(int)')
+ SIGNAL_TEXT_CHANGED = SIGNAL('textChanged(QString)')
+
+ def __init__(self):
+ self._widget = QSpinBox()
+ super(Spinner, self).__init__()
+
+ def bind(self, signal, function, *args, **kwargs):
+ handler = self._getHandlerForSignal(signal)
+ if not handler:
+ return
+
+ def wrappedFunction():
+ handler(self._widget, function, *args, **kwargs)
+
+ QObject.connect(self._widget, signal, wrappedFunction)
+
+ def onValueChanged(self, widget, function, *args, **kwargs):
+ function(self, *args, **kwargs)
+
+ def onTextChanged(self, widget, function, *args, **kwargs):
+ function(self, *args, **kwargs)
+
+ def getRange(self):
+ return self._widget.minimum(), self._widget.maximum()
+
+ def setRange(self, minimum, maximum):
+ self._widget.setRange(minimum, maximum)
+
+ def getIncrements(self):
+ # TODO: page?
+ #self._widget.pageStep()
+ return self._widget.singleStep(), self._widget.singleStep()
+
+ def setIncrements(self, step, page):
+ self._widget.setSingleStep(step)
+ # TODO: page?
+
+ def getValue(self):
+ return self._widget.value()
+
+ def setValue(self, value):
+ self._widget.setValue(value)
+
+ def getDisplayedText(self):
+ return self._widget.text()
+
+ def setDisplayedText(self, text):
+ self._widget.setText(text)
+
+ # TODO: Need to find the Qt equivalents
+ def getPrecision(self):
+ pass
+
+ def setPrecision(self, digits):
+ pass
diff --git a/src/orca/gui/toolkits/qt/status_bar.py b/src/orca/gui/toolkits/qt/status_bar.py
new file mode 100644
index 0000000..71a4b2f
--- /dev/null
+++ b/src/orca/gui/toolkits/qt/status_bar.py
@@ -0,0 +1,71 @@
+# Orca
+#
+# Copyright 2011 The Orca Team.
+# Author: Joanmarie Diggs <joanmarie diggs gmail com>
+#
+# 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.
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2011 The Orca Team."
+__license__ = "LGPL"
+
+from PyQt4 import QtGui
+from orca.gui.toolkits import status_bar
+
+class StatusBar(status_bar.StatusBar):
+
+ def __init__(self, numberOfAreas=1):
+ self._widget = QtGui.QStatusBar()
+ self._widget.setSizeGripEnabled(False)
+ self._labels = []
+ super(StatusBar, self).__init__(numberOfAreas)
+
+ def createLabels(self, numberOfAreas):
+ labels = [QtGui.QLabel() for i in range(numberOfAreas - 1)]
+ map(lambda l: self._widget.addPermanentWidget(l), labels)
+ self._labels.extend(labels)
+
+ def setLabelWidth(self, index, width):
+ pass
+
+ def setLabelWidth(self, index, width):
+ pass
+
+ def setLabelWidthInChars(self, index, nChars):
+ pass
+
+ def getCurrentMessage(self, index=0):
+ if index == 0:
+ return str(self._widget.currentMessage())
+
+ label = self._labels[index-1]
+ return label.text()
+
+ def setMessage(self, text, index=0):
+ if index == 0:
+ self._widget.showMessage(text)
+ return
+
+ label = self._labels[index-1]
+ label.setText(text)
+
+ def clearMessage(self, index=0):
+ self._widget.clearMessage()
+
+ def setSpacing(self, spacing):
+ pass
diff --git a/src/orca/gui/toolkits/qt/tabbed_widget.py b/src/orca/gui/toolkits/qt/tabbed_widget.py
new file mode 100644
index 0000000..3f6a503
--- /dev/null
+++ b/src/orca/gui/toolkits/qt/tabbed_widget.py
@@ -0,0 +1,98 @@
+# Orca
+#
+# Copyright 2011 The Orca Team.
+# Author: Joanmarie Diggs <joanmarie diggs gmail com>
+#
+# 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.
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2011 The Orca Team."
+__license__ = "LGPL"
+
+from PyQt4.QtGui import QTabWidget, QWidget, QLayout
+from PyQt4.QtCore import QObject, SIGNAL
+from orca.gui.toolkits import tabbed_widget
+
+class TabbedWidget(tabbed_widget.TabbedWidget):
+
+ SIGNAL_PAGE_CHANGED = SIGNAL('currentChanged(int)')
+
+ def __init__(self):
+ self._widget = QTabWidget()
+ super(TabbedWidget, self).__init__()
+ self.setScrollable(False)
+
+ def bind(self, signal, function, *args, **kwargs):
+ handler = self._getHandlerForSignal(signal)
+ if not handler:
+ return
+
+ def wrappedFunction(index=-1):
+ handler(self._widget, index, function, *args, **kwargs)
+
+ QObject.connect(self._widget, signal, wrappedFunction)
+
+ def onPageChanged(self, widget, index, function, *args, **kwargs):
+ function(self, index, *args, **kwargs)
+
+ def addPage(self, widget, label):
+ position = self.getNPages()
+ self.insertPage(widget, label, position)
+
+ def insertPage(self, widget, label, position=0):
+ widget = widget._widget
+ qwidget = widget
+ if not isinstance(qwidget, QWidget):
+ qwidget = QWidget()
+
+ self._widget.insertTab(position, qwidget, label._widget.text())
+ if isinstance(widget, QLayout):
+ qwidget.setLayout(widget)
+
+ def removePage(self, position):
+ self._widget.removeTab(position)
+
+ def getCurrentPosition(self):
+ return self._widget.currentIndex()
+
+ def getNthPage(self, index):
+ return self._widget.widget(index)
+
+ def getNPages(self):
+ return self._widget.count()
+
+ def pageNum(self, widget):
+ return self._widget.indexOf(widget)
+
+ def gotoPage(self, index):
+ page = self._widget.widget(index)
+ self._widget.setCurrentWidget(page)
+
+ def gotoNextPage(self):
+ index = self._widget.getCurrentPosition()
+ self._widget.gotoPage(index+1)
+
+ def gotoPrevPage(self):
+ index = self._widget.getCurrentPosition()
+ self._widget.gotoPage(index-1)
+
+ def getScrollable(self):
+ return self._widget.usesScrollButtons()
+
+ def setScrollable(self, scrollable):
+ self._widget.setUsesScrollButtons(scrollable)
diff --git a/src/orca/gui/toolkits/qt/table.py b/src/orca/gui/toolkits/qt/table.py
new file mode 100644
index 0000000..d31e85e
--- /dev/null
+++ b/src/orca/gui/toolkits/qt/table.py
@@ -0,0 +1,60 @@
+# Orca
+#
+# Copyright 2011 The Orca Team.
+# Author: Joanmarie Diggs <joanmarie diggs gmail com>
+#
+# 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.
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2011 The Orca Team."
+__license__ = "LGPL"
+
+from PyQt4 import QtGui
+from orca.gui.toolkits import table
+
+class Table(table.Table):
+ def __init__(self, nRows, nColumns):
+ self._widget = QtGui.QGridLayout()
+ super(Table, self).__init__(nRows, nColumns)
+
+ def getSize(self):
+ rows = self._widget.rowCount()
+ columns = self._widget.columnCount()
+ return rows, columns
+
+ def setSize(self, nRows, nColumns):
+ # Can you really not specify this?
+ pass
+
+ def add(self, obj, row, col, rowspan=1, colspan=1):
+ child = obj._widget
+ if isinstance(child, QtGui.QLayout):
+ self._widget.addLayout(child, row, col, rowspan, colspan)
+ elif isinstance(child, QtGui.QWidget):
+ self._widget.addWidget(child, row, col, rowspan, colspan)
+ else:
+ self._widget.addItem(child, row, col, rowspan, colspan)
+
+ def setPadding(self, child, xpadding, ypadding):
+ pass
+
+ def setOptions(self, child, xoptions, yoptions):
+ pass
+
+ def setContentsMargins(self, left, top, right, bottom):
+ self._widget.setContentsMargins(left, top, right, bottom)
diff --git a/src/orca/gui/toolkits/qt/text_combo_box.py b/src/orca/gui/toolkits/qt/text_combo_box.py
new file mode 100644
index 0000000..b75a03c
--- /dev/null
+++ b/src/orca/gui/toolkits/qt/text_combo_box.py
@@ -0,0 +1,74 @@
+# Orca
+#
+# Copyright 2011 The Orca Team.
+# Author: Joanmarie Diggs <joanmarie diggs gmail com>
+#
+# 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.
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2011 The Orca Team."
+__license__ = "LGPL"
+
+from PyQt4.QtGui import QComboBox
+from PyQt4.QtCore import QObject, SIGNAL
+from orca.gui.toolkits import text_combo_box
+
+class TextComboBox(text_combo_box.TextComboBox):
+
+ SIGNAL_SELECTION_CHANGED = SIGNAL('currentIndexChanged(int)')
+
+ def __init__(self, isEditable=False):
+ self._widget = QComboBox()
+ super(TextComboBox, self).__init__(isEditable)
+
+ def bind(self, signal, function, *args, **kwargs):
+ handler = self._getHandlerForSignal(signal)
+ if not handler:
+ return
+
+ def wrappedFunction(position=-1):
+ handler(self._widget, position, function, *args, **kwargs)
+
+ QObject.connect(self._widget, signal, wrappedFunction)
+
+ def onSelectionChanged(self, widget, position, function, *args, **kwargs):
+ function(self, position, *args, **kwargs)
+
+ def addItemAtPosition(self, item, position):
+ self._widget.insertItem(position, item)
+
+ def removeItemFromPosition(self, position):
+ self._widget.removeItem(position)
+
+ def getSelectedItemPosition(self):
+ return self._widget.currentIndex()
+
+ def setSelectedItem(self, position):
+ self._widget.setCurrentIndex(position)
+
+ def getSelectedText(self):
+ return self._widget.currentText()
+
+ def setTextColumn(self, column):
+ self._widget.setModelColumn(column)
+
+ def getIsEditable(self):
+ return self._widget.isEditable()
+
+ def setIsEditable(self, setting):
+ self._widget.setEditable(setting)
diff --git a/src/orca/gui/toolkits/qt/toolkit.py b/src/orca/gui/toolkits/qt/toolkit.py
new file mode 100644
index 0000000..4a41c51
--- /dev/null
+++ b/src/orca/gui/toolkits/qt/toolkit.py
@@ -0,0 +1,93 @@
+# Orca
+#
+# Copyright 2011 The Orca Team.
+# Author: Alejandro Leiva <aleiva emergya es>
+# Author: Joanmarie Diggs <joanmarie diggs gmail com>
+#
+# 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.
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2011 The Orca Team."
+__license__ = "LGPL"
+
+from PyQt4 import QtGui, QtCore
+
+from orca.gui import toolkit
+
+# TODO - Maybe the localization stuff needs to be part of the gui
+# toolkit??
+from orca.orca_i18n import _
+
+from box import HBox, VBox
+from checkbox import Checkbox
+from entry import Entry
+from frame import Frame
+from label import Label
+from message_dialog import MessageDialog
+from push_button import PushButton
+from radio_button import RadioButton
+from slider import HSlider, VSlider
+from spinner import Spinner
+from status_bar import StatusBar
+from tabbed_widget import TabbedWidget
+from table import Table
+from text_combo_box import TextComboBox
+from tree import Tree
+from tree_model import TreeModel
+from window import Window
+
+TYPE_BOOLEAN = QtCore.QVariant
+TYPE_CHAR = QtCore.QVariant
+TYPE_DOUBLE = QtCore.QVariant
+TYPE_FLOAT = QtCore.QVariant
+TYPE_INT = QtCore.QVariant
+TYPE_LONG = QtCore.QVariant
+TYPE_NONE = QtCore.QVariant
+TYPE_STRING = QtCore.QVariant
+TYPE_UCHAR = QtCore.QVariant
+TYPE_UINT = QtCore.QVariant
+TYPE_ULONG = QtCore.QVariant
+TYPE_UNICHAR = QtCore.QVariant
+
+STOCK_ABOUT = (QtGui.QIcon.fromTheme('help-about'), _('_About'))
+STOCK_APPLY = (QtGui.QIcon.fromTheme('apply'), '')
+STOCK_CANCEL = (QtGui.QIcon.fromTheme('cancel'), '')
+STOCK_CLOSE = (QtGui.QIcon.fromTheme('window-close'), '')
+STOCK_FIND = (QtGui.QIcon.fromTheme('edit-find'), '')
+STOCK_HELP = (QtGui.QIcon.fromTheme('help'), _('_Help'))
+STOCK_NO = (QtGui.QIcon.fromTheme('no'), '')
+STOCK_OK = (QtGui.QIcon.fromTheme('ok'), _('_OK'))
+STOCK_OPEN = (QtGui.QIcon.fromTheme('document-open'), '')
+STOCK_PREFERENCES = (QtGui.QIcon.fromTheme('preferences-desktop'), _('_Preferences'))
+STOCK_QUIT = (QtGui.QIcon.fromTheme('application-exit'), _('_Quit'))
+STOCK_SAVE = (QtGui.QIcon.fromTheme('document-save'), '')
+STOCK_SAVE_AS = (QtGui.QIcon.fromTheme('document-save-as'), '')
+STOCK_YES = (QtGui.QIcon.fromTheme('yes'), '')
+
+app = QtGui.QApplication([''])
+
+def main():
+ return app.exec_()
+
+def timeoutAdd(time, function):
+ pass
+
+class Toolkit(toolkit.Toolkit):
+
+ def __init__(self):
+ super(Toolkit, self).__init__()
diff --git a/src/orca/gui/toolkits/qt/tree.py b/src/orca/gui/toolkits/qt/tree.py
new file mode 100644
index 0000000..20ac871
--- /dev/null
+++ b/src/orca/gui/toolkits/qt/tree.py
@@ -0,0 +1,123 @@
+# Orca
+#
+# Copyright 2011 The Orca Team.
+# Author: Joanmarie Diggs <joanmarie diggs gmail com>
+#
+# 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.
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2011 The Orca Team."
+__license__ = "LGPL"
+
+from PyQt4 import QtGui
+from PyQt4.QtCore import Qt, QVariant, QModelIndex
+from orca.gui.toolkits import tree
+
+import tree_model
+
+class Tree(tree.Tree):
+
+ GRID_LINES_NONE = None
+ GRID_LINES_HORIZONTAL = None
+ GRID_LINES_VERTICAL = None
+ GRID_LINES_BOTH = None
+
+ ORDER_DESCENDING = Qt.DescendingOrder
+ ORDER_ASCENDING = Qt.AscendingOrder
+
+ def __init__(self, *args):
+ self._widget = QtGui.QTreeView()
+ self._model = None
+ super(Tree, self).__init__(*args)
+
+ model = tree_model.TreeModel(*args)
+ self.setModel(model)
+
+ def getColumnTitle(self, column):
+ # TODO: This seems wrong. Compare to Gtk2 and Gtk3.
+ header = self._widget.header()
+ model = header.model()
+ return model.headerData(column, Qt.Horizontal)
+
+ def setColumnTitle(self, column, title):
+ # TODO: This seems wrong. Compare to Gtk2 and Gtk3.
+ header = self._widget.header()
+ model = header.model()
+ model.setHeaderData(column, Qt.Horizontal, QVariant(title))
+
+ def getColumnHidden(self, column):
+ return self._widget.isColumnHidden(column)
+
+ def setColumnHidden(self, column, hide):
+ if hide:
+ self._widget.hideColumn(column)
+ else:
+ self._widget.showColumn(column)
+
+ def getColumnResizable(self, column):
+ pass
+
+ def setColumnResizable(self, column, resizable):
+ pass
+
+ def getHeadersHidden(self):
+ return self._widget.isHeaderHidden()
+
+ def setHeadersHidden(self, hide):
+ self._widget.setHeaderHidden(hide)
+
+ def collapseAll(self):
+ self._widget.collapseAll()
+
+ def expandAll(self):
+ self._widget.expandAll()
+
+ def getRowExpanded(self, row):
+ pass
+
+ def setRowExpanded(self, row, expanded):
+ pass
+
+ def getItemsExpandable(self):
+ return self._widget.itemsExpandable()
+
+ def setItemsExpandable(self, expandable):
+ self._widget.setItemsExpandable(expandable)
+
+ def setRootIsDecorated(self, setting):
+ self._widget.setRootIsDecorated(setting)
+
+ def sortByColumn(self, column, order):
+ self._widget.setSortingEnabled(True)
+ self._widget.sortByColumn(column, order)
+
+ def setRulesHint(self, hint):
+ self._widget.setAlternatingRowColors(hint)
+
+ def getGridLines(self):
+ pass
+
+ def setGridLines(self, grid):
+ pass
+
+ def getModel(self):
+ return self._model
+
+ def setModel(self, model):
+ self._widget.setModel(model._model)
+ self._model = model
diff --git a/src/orca/gui/toolkits/qt/tree_model.py b/src/orca/gui/toolkits/qt/tree_model.py
new file mode 100644
index 0000000..bf51e5c
--- /dev/null
+++ b/src/orca/gui/toolkits/qt/tree_model.py
@@ -0,0 +1,188 @@
+# Orca
+#
+# Copyright 2011 The Orca Team.
+# Author: Joanmarie Diggs <joanmarie diggs gmail com>
+#
+# 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.
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2011 The Orca Team."
+__license__ = "LGPL"
+
+from PyQt4.QtCore import Qt, QAbstractItemModel, QModelIndex, QVariant
+from orca.gui.toolkits import tree_model
+
+class Row(list):
+ def __init__(self, parent, columnTypes):
+ super(Row, self).__init__()
+ self.parent = parent
+ self._columnTypes = columnTypes
+ self.extend([None] * len(columnTypes))
+
+ def getCellValue(self, column):
+ return self[column]
+
+ def setCellValue(self, column, value):
+ # TODO: Add validation based on type
+ self[column] = value
+
+ def populate(self, values):
+ if len(values) != len(self):
+ return False
+
+ for i, value in enumerate(values):
+ self.setCellValue(i, value)
+
+ return True
+
+# NOTE: This isn't done or fully working. Qt implementation is merely
+# a proof-of-concept at this stage. (Having said that, the tree in the
+# test works.)
+
+class QtTreeModel(QAbstractItemModel):
+
+ def __init__(self, *args):
+ super(QtTreeModel, self).__init__()
+ self._columnTypes = args
+ self._columnHeaders = [None] * len(args)
+ self.rows = []
+
+ def rowCount(self, parent):
+ return len(self.rows)
+
+ def columnCount(self, parent):
+ return len(self._columnTypes)
+
+ def index(self, row, column, parent):
+ if not parent.isValid():
+ return self.createIndex(row, column, parent)
+
+ # TODO: Finish this.
+ return QModelIndex()
+
+ def parent(self, index):
+ if not index.isValid():
+ return QModelIndex()
+
+ # TODO: Finish this.
+ return QModelIndex()
+
+ def data(self, index, role):
+ # TODO: Finish this, including using the pointer to get the
+ # parent row. (Some error somewhere was resulting in frequent
+ # segfaults.)
+ if not index.isValid():
+ return QVariant()
+
+ if not role == Qt.DisplayRole:
+ return QVariant()
+
+ row = self.rows[index.row()]
+ cell = row[index.column()]
+
+ return QVariant(cell)
+
+ def setData(self, index, value, role):
+ # TODO: Implement this.
+ pass
+
+ def headerData(self, section, orientation, role=Qt.DisplayRole):
+ if orientation == Qt.Horizontal and role == Qt.DisplayRole:
+ return self._columnHeaders[section]
+
+ return QVariant()
+
+ def setHeaderData(self, section, orientation, value, role=Qt.DisplayRole):
+ if orientation == Qt.Horizontal and role == Qt.DisplayRole:
+ self._columnHeaders[section] = value
+
+ def insertRows(self, row, count, parent):
+ if parent == None:
+ parent = QModelIndex()
+
+ lastRow = row + count - 1
+ self.beginInsertRows(parent, row, lastRow)
+ parentItem = parent.internalPointer()
+ emptyRow = Row(parentItem, self._columnTypes)
+ emptyRows = [emptyRow for i in xrange(count)]
+ self.rows[row:lastRow] = emptyRows
+ self.endInsertRows()
+ return True
+
+ def removeRows(self, row, count, parent):
+ if parent == None:
+ parent = QModelIndex()
+
+ self.beginRemoveRows(parent, row, row + count - 1)
+ for i in xrange(row, row + count - 1):
+ self.rows.pop(i)
+ self.endRemoveRows()
+ return True
+
+class TreeModel(tree_model.TreeModel):
+
+ def __init__(self, *args):
+ self._model = QtTreeModel(*args)
+ super(TreeModel, self).__init__(*args)
+
+ def setValue(self, row, column, value):
+ index = self.index(row, column, parent)
+ self._model.setData(index, value)
+
+ def remove(self, row):
+ self._model.removeRows(row, 1, parent)
+
+ def insert(self, parent, position, rowItems):
+ self._model.insertRows(position, 1, parent)
+ emptyRow = self._model.rows[position]
+ emptyRow.populate(rowItems)
+
+ def prepend(self, parent, rowItems):
+ self._model.insertRows(0, 1, parent)
+ emptyRow = self._model.rows[end]
+ emptyRow.populate(rowItems)
+
+ def append(self, parent, rowItems):
+ end = self._model.rowCount(parent)
+ self._model.insertRows(end, 1, parent)
+ emptyRow = self._model.rows[end]
+ emptyRow.populate(rowItems)
+
+ def isAncestor(self, row, descendant):
+ pass
+
+ def rowDepth(self, row):
+ pass
+
+ def clear(self):
+ self._model.reset()
+
+ def reorder(self, parent, new_order):
+ pass
+
+ def swap(self, a, b):
+ pass
+
+ def moveAfter(self, row, position):
+ pass
+
+ def moveBefore(self, row, position):
+ pass
+
+ def setSortColumnId(self, column, order):
+ pass
diff --git a/src/orca/gui/toolkits/qt/window.py b/src/orca/gui/toolkits/qt/window.py
new file mode 100644
index 0000000..203bd43
--- /dev/null
+++ b/src/orca/gui/toolkits/qt/window.py
@@ -0,0 +1,144 @@
+# Orca
+#
+# Copyright 2011 The Orca Team.
+# Author: Joanmarie Diggs <joanmarie diggs gmail com>
+#
+# 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.
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2011 The Orca Team."
+__license__ = "LGPL"
+
+from PyQt4.QtGui import QWidget, QLayout, QBoxLayout
+from PyQt4.QtCore import Qt, QObject, QSize, SIGNAL
+from orca.gui.toolkits import window
+
+class Window(window.Window):
+
+ SIGNAL_CLOSE_EVENT = SIGNAL('closeEvent(QEvent)')
+
+ def __init__(self, title):
+ self._widget = QWidget()
+ self._container = QBoxLayout(QBoxLayout.TopToBottom)
+ self._widget.setLayout(self._container)
+ super(Window, self).__init__(title)
+
+ def bind(self, signal, function, *args, **kwargs):
+ handler = self._getHandlerForSignal(signal)
+ if not handler:
+ return
+
+ def wrappedFunction(event=None):
+ handler(self._widget, event, function, *args, **kwargs)
+
+ QObject.connect(self._widget, signal, wrappedFunction)
+
+ def onClose(self, widget, event, function, *args, **kwargs):
+ function(self, event, *args, **kwargs)
+
+ def getTitle(self):
+ return str(self._widget.windowTitle())
+
+ def setTitle(self, title):
+ self._widget.setWindowTitle(title)
+
+ def getDefaultSize(self):
+ pass
+
+ def setDefaultSize(self, width, height):
+ size = QSize(width, height)
+ self._widget.setMaximumSize(size)
+
+ def getModal(self):
+ return self._widget.isModal()
+
+ def setModal(self, modal):
+ if modal:
+ self._widget.setWindowModality(Qt.Modal)
+ else:
+ self._widget.setWindowModality(Qt.NonModal)
+
+ def getKeepAbove(self):
+ pass
+
+ def setKeepAbove(self, setting):
+ pass
+
+ def getDestroyWithParent(self):
+ pass
+
+ def setDestroyWithParent(self, setting):
+ pass
+
+ def getSkipTaskbarHint(self):
+ pass
+
+ def setSkipTaskbarHint(self, setting):
+ pass
+
+ def getUrgencyHint(self):
+ pass
+
+ def setUrgencyHint(self, setting):
+ pass
+
+ def getSkipPagerHint(self):
+ pass
+
+ def setSkipPagerHint(self, setting):
+ pass
+
+ def getDecorated(self):
+ pass
+
+ def setDecorated(self, setting):
+ pass
+
+ def getResizable(self):
+ pass
+
+ def setResizable(self, resizable):
+ pass
+
+ def getTransientFor(self):
+ pass
+
+ def setTransientFor(self, parent):
+ pass
+
+ def add(self, obj):
+ widget = obj._widget
+ if isinstance(widget, QLayout):
+ self._container.addLayout(widget)
+ elif isinstance(widget, QWidget):
+ self._container.addWidget(widget)
+ else:
+ self._container.addItem(widget)
+
+ def display(self):
+ self._widget.show()
+
+ def hide(self):
+ self._widget.hide()
+
+ def close(self):
+ self._widget.close()
+
+ def destroy(self):
+ self._widget.destroy()
+
diff --git a/src/orca/gui/toolkits/radio_button.py b/src/orca/gui/toolkits/radio_button.py
new file mode 100644
index 0000000..23a329e
--- /dev/null
+++ b/src/orca/gui/toolkits/radio_button.py
@@ -0,0 +1,73 @@
+# Orca
+#
+# Copyright 2011 The Orca Team.
+# Author: Joanmarie Diggs <joanmarie diggs gmail com>
+#
+# 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.
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2011 The Orca Team."
+__license__ = "LGPL"
+
+from abstract_widget import AbstractWidget
+
+class RadioButton(AbstractWidget):
+
+ SIGNAL_TOGGLED = None
+
+ def __init__(self, label, firstInGroup, state):
+ super(RadioButton, self).__init__()
+ self.setDisplayedText(label)
+ self.setGroup(firstInGroup)
+ self.setState(state)
+
+ def _getHandlerForSignal(self, signal):
+ if signal == self.SIGNAL_TOGGLED:
+ return self.onToggled
+
+ return None
+
+ def bind(self, signal, function, *args, **kwargs):
+ pass
+
+ def onToggled(self, widget, function, *args, **kwargs):
+ pass
+
+ def getUseUnderline(self):
+ pass
+
+ def setUseUnderline(self, setting):
+ pass
+
+ def getDisplayedText(self):
+ pass
+
+ def setDisplayedText(self, displayedText):
+ pass
+
+ def getState(self):
+ pass
+
+ def setState(self, state):
+ pass
+
+ def getGroup(self):
+ pass
+
+ def setGroup(self, firstInGroup):
+ pass
diff --git a/src/orca/gui/toolkits/slider.py b/src/orca/gui/toolkits/slider.py
new file mode 100644
index 0000000..bd16c60
--- /dev/null
+++ b/src/orca/gui/toolkits/slider.py
@@ -0,0 +1,92 @@
+# Orca
+#
+# Copyright 2011 The Orca Team.
+# Author: Joanmarie Diggs <joanmarie diggs gmail com>
+#
+# 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.
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2011 The Orca Team."
+__license__ = "LGPL"
+
+from abstract_widget import AbstractWidget
+
+class Slider(AbstractWidget):
+
+ SIGNAL_VALUE_CHANGED = None
+
+ def __init__(self):
+ super(Slider, self).__init__()
+
+ def _getHandlerForSignal(self, signal):
+ if signal == self.SIGNAL_VALUE_CHANGED:
+ return self.onValueChanged
+
+ return None
+
+ def bind(self, signal, function, *args, **kwargs):
+ pass
+
+ def onValueChanged(self, widget, function, *args, **kwargs):
+ pass
+
+ def getRange(self):
+ pass
+
+ def setRange(self, minimum, maximum):
+ pass
+
+ def getIncrements(self):
+ pass
+
+ def setIncrements(self, step, page):
+ pass
+
+ def getValue(self):
+ pass
+
+ def setValue(self, value):
+ pass
+
+ def getPrecision(self):
+ pass
+
+ def setPrecision(self, digits):
+ pass
+
+ def getShowCurrentValue(self):
+ pass
+
+ def setShowCurrentValue(self, showCurrent):
+ pass
+
+ def getValuePosition(self):
+ pass
+
+ def setValuePosition(self, position):
+ pass
+
+class HSlider(Slider):
+
+ def __init__(self):
+ super(HSlider, self).__init__()
+
+class VSlider(Slider):
+
+ def __init__(self):
+ super(VSlider, self).__init__()
diff --git a/src/orca/gui/toolkits/spinner.py b/src/orca/gui/toolkits/spinner.py
new file mode 100644
index 0000000..b1c783e
--- /dev/null
+++ b/src/orca/gui/toolkits/spinner.py
@@ -0,0 +1,82 @@
+# Orca
+#
+# Copyright 2011 The Orca Team.
+# Author: Joanmarie Diggs <joanmarie diggs gmail com>
+#
+# 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.
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2011 The Orca Team."
+__license__ = "LGPL"
+
+from abstract_widget import AbstractWidget
+
+class Spinner(AbstractWidget):
+
+ SIGNAL_VALUE_CHANGED = None
+ SIGNAL_TEXT_CHANGED = None
+
+ def __init__(self):
+ super(Spinner, self).__init__()
+
+ def _getHandlerForSignal(self, signal):
+ if signal == self.SIGNAL_VALUE_CHANGED:
+ return self.onValueChanged
+ if signal == self.SIGNAL_TEXT_CHANGED:
+ return self.onTextChanged
+
+ return None
+
+ def bind(self, signal, function, *args, **kwargs):
+ pass
+
+ def onValueChanged(self, widget, function, *args, **kwargs):
+ pass
+
+ def onTextChanged(self, widget, function, *args, **kwargs):
+ pass
+
+ def getRange(self):
+ pass
+
+ def setRange(self, minimum, maximum):
+ pass
+
+ def getIncrements(self):
+ pass
+
+ def setIncrements(self, step, page):
+ pass
+
+ def getValue(self):
+ pass
+
+ def setValue(self, value):
+ pass
+
+ def getDisplayedText(self):
+ pass
+
+ def setDisplayedText(self, displayedText):
+ pass
+
+ def getPrecision(self):
+ pass
+
+ def setPrecision(self, digits):
+ pass
diff --git a/src/orca/gui/toolkits/status_bar.py b/src/orca/gui/toolkits/status_bar.py
new file mode 100644
index 0000000..f5cd4e6
--- /dev/null
+++ b/src/orca/gui/toolkits/status_bar.py
@@ -0,0 +1,60 @@
+# Orca
+#
+# Copyright 2011 The Orca Team.
+# Author: Joanmarie Diggs <joanmarie diggs gmail com>
+#
+# 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.
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2011 The Orca Team."
+__license__ = "LGPL"
+
+from abstract_widget import AbstractWidget
+
+class StatusBar(AbstractWidget):
+
+ def __init__(self, numberOfAreas=1):
+ super(StatusBar, self).__init__()
+ self.createLabels(numberOfAreas)
+
+ def createLabels(self, numberOfAreas):
+ pass
+
+ def setLabelWidth(self, index, width):
+ pass
+
+ def setLabelWidth(self, index, width):
+ pass
+
+ def setLabelWidthInChars(self, index, nChars):
+ pass
+
+ def getCurrentMessage(self, index=0):
+ pass
+
+ def setMessage(self, text, index=0):
+ pass
+
+ def clearMessage(self, index=0):
+ pass
+
+ def enableSizeGrip(self, enable):
+ pass
+
+ def setSpacing(self, spacing):
+ pass
diff --git a/src/orca/gui/toolkits/tabbed_widget.py b/src/orca/gui/toolkits/tabbed_widget.py
new file mode 100644
index 0000000..900e1c2
--- /dev/null
+++ b/src/orca/gui/toolkits/tabbed_widget.py
@@ -0,0 +1,82 @@
+# Orca
+#
+# Copyright 2011 The Orca Team.
+# Author: Joanmarie Diggs <joanmarie diggs gmail com>
+#
+# 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.
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2011 The Orca Team."
+__license__ = "LGPL"
+
+from abstract_widget import AbstractWidget
+
+class TabbedWidget(AbstractWidget):
+
+ SIGNAL_PAGE_CHANGED = None
+
+ def __init__(self):
+ super(TabbedWidget, self).__init__()
+
+ def _getHandlerForSignal(self, signal):
+ if signal == self.SIGNAL_PAGE_CHANGED:
+ return self.onPageChanged
+
+ return None
+
+ def bind(self, signal, function, *args, **kwargs):
+ pass
+
+ def onPageChanged(self, widget, index, function, *args, **kwargs):
+ pass
+
+ def addPage(self, widget, label=None):
+ pass
+
+ def insertPage(self, widget, label=None, position=0):
+ pass
+
+ def removePage(self, position):
+ pass
+
+ def getCurrentPosition(self):
+ pass
+
+ def getNthPage(self, index):
+ pass
+
+ def getNPages(self):
+ pass
+
+ def pageNum(self, widget):
+ pass
+
+ def gotoPage(self, index):
+ pass
+
+ def gotoNextPage(self):
+ pass
+
+ def gotoPrevPage(self):
+ pass
+
+ def getScrollable(self):
+ pass
+
+ def setScrollable(self, scrollable):
+ pass
diff --git a/src/orca/gui/toolkits/table.py b/src/orca/gui/toolkits/table.py
new file mode 100644
index 0000000..22569cc
--- /dev/null
+++ b/src/orca/gui/toolkits/table.py
@@ -0,0 +1,51 @@
+# Orca
+#
+# Copyright 2011 The Orca Team.
+# Author: Joanmarie Diggs <joanmarie diggs gmail com>
+#
+# 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.
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2011 The Orca Team."
+__license__ = "LGPL"
+
+from abstract_widget import AbstractWidget
+
+class Table(AbstractWidget):
+
+ def __init__(self, nRows, nColumns):
+ super(Table, self).__init__()
+ self.setSize(nRows, nColumns)
+
+ def getSize(self):
+ pass
+
+ def setSize(self, nRows, nColumns):
+ pass
+
+ def add(self, obj, row, col, rowspan=1, colspan=1):
+ pass
+
+ def setPadding(self, xpadding, ypadding):
+ pass
+
+ def setOptions(self, child, xoptions, yoptions):
+ pass
+
+ def setContentsMargins(self, left, top, right, bottom):
+ pass
diff --git a/src/orca/gui/toolkits/text_combo_box.py b/src/orca/gui/toolkits/text_combo_box.py
new file mode 100644
index 0000000..721001f
--- /dev/null
+++ b/src/orca/gui/toolkits/text_combo_box.py
@@ -0,0 +1,72 @@
+# Orca
+#
+# Copyright 2011 The Orca Team.
+# Author: Joanmarie Diggs <joanmarie diggs gmail com>
+#
+# 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.
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2011 The Orca Team."
+__license__ = "LGPL"
+
+from abstract_widget import AbstractWidget
+
+class TextComboBox(AbstractWidget):
+
+ SIGNAL_SELECTION_CHANGED = None
+
+ def __init__(self, isEditable=False):
+ super(TextComboBox, self).__init__()
+ self.setIsEditable(isEditable)
+ self.setTextColumn(0)
+
+ def _getHandlerForSignal(self, signal):
+ if signal == self.SIGNAL_SELECTION_CHANGED:
+ return self.onSelectionChanged
+
+ return None
+
+ def bind(self, signal, function, *args, **kwargs):
+ pass
+
+ def onSelectionChanged(self, widget, function, *args, **kwargs):
+ pass
+
+ def addItemAtPosition(self, item, position):
+ pass
+
+ def removeItemFromPosition(self, position):
+ pass
+
+ def getSelectedItemPosition(self):
+ pass
+
+ def setSelectedItem(self, position):
+ pass
+
+ def getSelectedText(self):
+ pass
+
+ def setTextColumn(self, column):
+ pass
+
+ def getIsEditable(self):
+ pass
+
+ def setIsEditable(self, setting):
+ pass
diff --git a/src/orca/gui/toolkits/tree.py b/src/orca/gui/toolkits/tree.py
new file mode 100644
index 0000000..2843bdb
--- /dev/null
+++ b/src/orca/gui/toolkits/tree.py
@@ -0,0 +1,103 @@
+# Orca
+#
+# Copyright 2011 The Orca Team.
+# Author: Joanmarie Diggs <joanmarie diggs gmail com>
+#
+# 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.
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2011 The Orca Team."
+__license__ = "LGPL"
+
+from abstract_widget import AbstractWidget
+
+class Tree(AbstractWidget):
+
+ GRID_LINES_NONE = None
+ GRID_LINES_HORIZONTAL = None
+ GRID_LINES_VERTICAL = None
+ GRID_LINES_BOTH = None
+
+ ORDER_DESCENDING = None
+ ORDER_ASCENDING = None
+
+ def __init__(self, *args):
+ super(Tree, self).__init__()
+
+ def getColumnTitle(self):
+ pass
+
+ def setColumnTitle(self, header):
+ pass
+
+ def getColumnHidden(self, column):
+ pass
+
+ def setColumnHidden(self, column, hide):
+ pass
+
+ def getColumnResizable(self, column):
+ pass
+
+ def setColumnResizable(self, column, resizable):
+ pass
+
+ def getHeadersHidden(self):
+ pass
+
+ def setHeadersHidden(self, hide):
+ pass
+
+ def collapseAll(self):
+ pass
+
+ def expandAll(self):
+ pass
+
+ def getRowExpanded(self, row):
+ pass
+
+ def setRowExpanded(self, row, expanded):
+ pass
+
+ def getItemsExpandable(self):
+ pass
+
+ def setItemsExpandable(self,expandable):
+ pass
+
+ def setRootIsDecorated(self, setting):
+ pass
+
+ def sortByColumn(self, column, order):
+ pass
+
+ def setRulesHint(self, hint):
+ pass
+
+ def getGridLines(self):
+ pass
+
+ def setGridLines(self, grid):
+ pass
+
+ def getModel(self):
+ pass
+
+ def setModel(self, model):
+ pass
diff --git a/src/orca/gui/toolkits/tree_model.py b/src/orca/gui/toolkits/tree_model.py
new file mode 100644
index 0000000..235322c
--- /dev/null
+++ b/src/orca/gui/toolkits/tree_model.py
@@ -0,0 +1,71 @@
+# Orca
+#
+# Copyright 2011 The Orca Team.
+# Author: Joanmarie Diggs <joanmarie diggs gmail com>
+#
+# 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.
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2011 The Orca Team."
+__license__ = "LGPL"
+
+from abstract_model import AbstractModel
+
+class TreeModel(AbstractModel):
+
+ def __init__(self, *args):
+ super(TreeModel, self).__init__()
+
+ def setValue(self, row, column, value):
+ pass
+
+ def remove(self, row):
+ pass
+
+ def insert(self, parent, position, rowItems):
+ pass
+
+ def prepend(self, parent, rowItems):
+ pass
+
+ def append(self, parent, rowItems):
+ pass
+
+ def isAncestor(self, row, descendant):
+ pass
+
+ def rowDepth(self, row):
+ pass
+
+ def clear(self):
+ pass
+
+ def reorder(self, parent, new_order):
+ pass
+
+ def swap(self, a, b):
+ pass
+
+ def moveAfter(self, row, position):
+ pass
+
+ def moveBefore(self, row, position):
+ pass
+
+ def setSortColumnId(self, column, order):
+ pass
diff --git a/src/orca/gui/toolkits/window.py b/src/orca/gui/toolkits/window.py
new file mode 100644
index 0000000..bb70b95
--- /dev/null
+++ b/src/orca/gui/toolkits/window.py
@@ -0,0 +1,128 @@
+# Orca
+#
+# Copyright 2011 The Orca Team.
+# Author: Joanmarie Diggs <joanmarie diggs gmail com>
+#
+# 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.
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2011 The Orca Team."
+__license__ = "LGPL"
+
+from abstract_widget import AbstractWidget
+
+class Window(AbstractWidget):
+
+ SIGNAL_CLOSE_EVENT = None
+
+ def __init__(self, title):
+ super(Window, self).__init__()
+ self.setTitle(title)
+
+ def _getHandlerForSignal(self, signal):
+ if signal == self.SIGNAL_CLOSE_EVENT:
+ return self.onClose
+
+ return None
+
+ def bind(self, signal, function, *args, **kwargs):
+ pass
+
+ def onClose(self, widget, event, function, *args, **kwargs):
+ pass
+
+ def getTitle(self):
+ pass
+
+ def setTitle(self, title):
+ pass
+
+ def getDefaultSize(self):
+ pass
+
+ def setDefaultSize(self, width, height):
+ pass
+
+ def getModal(self):
+ pass
+
+ def setModal(self, modal):
+ pass
+
+ def getKeepAbove(self):
+ pass
+
+ def setKeepAbove(self, setting):
+ pass
+
+ def getDestroyWithParent(self):
+ pass
+
+ def setDestroyWithParent(self, setting):
+ pass
+
+ def getSkipTaskbarHint(self):
+ pass
+
+ def setSkipTaskbarHint(self, setting):
+ pass
+
+ def getUrgencyHint(self):
+ pass
+
+ def setUrgencyHint(self, setting):
+ pass
+
+ def getSkipPagerHint(self):
+ pass
+
+ def setSkipPagerHint(self, setting):
+ pass
+
+ def getDecorated(self):
+ pass
+
+ def setDecorated(self, setting):
+ pass
+
+ def getResizable(self):
+ pass
+
+ def setResizable(self, resizable):
+ pass
+
+ def getTransientFor(self):
+ pass
+
+ def setTransientFor(self, parent):
+ pass
+
+ def add(self, obj):
+ pass
+
+ def display(self):
+ pass
+
+ def hide(self):
+ pass
+
+ def close(self):
+ pass
+
+ def destroy(self):
+ pass
diff --git a/test/gui/main_window.py b/test/gui/main_window.py
new file mode 100755
index 0000000..e577913
--- /dev/null
+++ b/test/gui/main_window.py
@@ -0,0 +1,76 @@
+#!/usr/bin/python
+
+import sys
+
+import orca.orca as orca
+from orca.gui.toolkit import Toolkit
+from orca.orca_i18n import _
+
+def onClicked(widget, function=None):
+ print "'%s' clicked" % widget.getDisplayedText()
+ if function:
+ function()
+
+def onWindowCloseEvent(widget, event):
+ print "Close event for window: %s" % widget.getTitle()
+ widget.destroy()
+ quit()
+
+def runTest(toolkitName):
+ toolkit = Toolkit(toolkitName)
+
+ window = toolkit.createWindow(_("Orca Screen Reader / Magnifier"))
+ window.bind(window.SIGNAL_CLOSE_EVENT, onWindowCloseEvent)
+ window.setDefaultSize(300, 40)
+ window.setResizable(False)
+
+ table = toolkit.createTable(1, 5)
+ table.setContentsMargins(0, 0, 0, 0)
+ window.add(table)
+
+ button = toolkit.createPushButton(stock=toolkit.STOCK_PREFERENCES)
+ button.bind(button.SIGNAL_CLICKED, onClicked)
+ table.add(button, 0, 1)
+ table.setPadding(button, 5, 5)
+ table.setOptions(button, 0, 0)
+
+ button = toolkit.createPushButton(stock=toolkit.STOCK_QUIT)
+ button.bind(button.SIGNAL_CLICKED, onClicked)
+ table.add(button, 0, 2)
+ table.setPadding(button, 0, 5)
+ table.setOptions(button, 0, 0)
+
+ spacer = toolkit.createLabel()
+ table.add(spacer, 0, 3)
+ table.setPadding(spacer, 5, 0)
+ table.setOptions(spacer, 1, 0)
+
+ button = toolkit.createPushButton(stock=toolkit.STOCK_ABOUT)
+ button.bind(button.SIGNAL_CLICKED, onClicked)
+ table.add(button, 0, 4)
+ table.setPadding(button, 0, 5)
+ table.setOptions(button, 0, 0)
+
+ # At the moment, this button is the only one connected to a handler
+ # that actually does something other than print the signal.
+ button = toolkit.createPushButton(stock=toolkit.STOCK_HELP)
+ button.bind(button.SIGNAL_CLICKED, onClicked, orca.helpForOrca)
+ table.add(button, 0, 5)
+ table.setPadding(button, 5, 5)
+ table.setOptions(button, 0, 0)
+
+ window.display()
+ toolkit.main()
+
+def main():
+ try:
+ toolkit = sys.argv[1]
+ except IndexError:
+ toolkit = 'gtk2'
+
+ runTest(toolkit)
+
+ return 0
+
+if __name__ == "__main__":
+ sys.exit(main())
diff --git a/test/gui/test_all_widgets.py b/test/gui/test_all_widgets.py
new file mode 100755
index 0000000..fbd9dc6
--- /dev/null
+++ b/test/gui/test_all_widgets.py
@@ -0,0 +1,446 @@
+#!/usr/bin/python
+
+import sys
+
+from orca.gui.toolkit import Toolkit
+
+statusbar = None
+
+def onToggled(widget):
+ label = widget.getDisplayedText()
+ state = widget.getState()
+ statusbar.setMessage("'%s' toggled to: %s" % (label, state), 0)
+
+def onClicked(widget, function=None):
+ statusbar.setMessage("'%s' clicked" % widget.getDisplayedText(), 0)
+ if function:
+ function()
+
+def onValueChanged(widget):
+ statusbar.setMessage("value changed to: %f" % widget.getValue(), 0)
+
+def onTextChanged(widget):
+ statusbar.setMessage("text is now: %s" % widget.getDisplayedText(), 0)
+
+def onSelectionChanged(widget, position=None):
+ if position == None:
+ position = widget.getSelectedItemPosition()
+ text = widget.getSelectedText()
+ statusbar.setMessage(
+ "selected item is at index %d and contains '%s'" % (position, text), 0)
+
+def onPageChanged(widget, index=-1):
+ statusbar.setMessage("Active page is now page %s" % index, 0)
+
+def onWindowCloseEvent(widget, event):
+ print "Close event for window: %s" % widget.getTitle()
+ widget.destroy()
+ quit()
+
+def onResponse(widget, responseID):
+ print widget, responseID
+
+def showWindow(window):
+ window.display()
+
+def runTest(toolkitName):
+ # TODO: This test should be broken up, of course. I am putting off
+ # doing that because having a single dialog with which to check
+ # all changes is incredibly convenient -- especially given three
+ # toolkits actively being implemented.
+
+ global statusbar
+
+ toolkit = Toolkit(toolkitName)
+
+ window = toolkit.createWindow("Test Window for %s" % toolkitName)
+ window.bind(window.SIGNAL_CLOSE_EVENT, onWindowCloseEvent)
+
+ tabbedWidget = toolkit.createTabbedWidget()
+ window.add(tabbedWidget)
+ tabbedWidget.bind(tabbedWidget.SIGNAL_PAGE_CHANGED, onPageChanged)
+
+ statusbar = toolkit.createStatusBar()
+ statusbar.setSpacing(10)
+ window.add(statusbar)
+
+ table = toolkit.createTable(2, 2)
+ label = toolkit.createLabel('Toggles')
+ tabbedWidget.addPage(table, label)
+
+ frame = toolkit.createFrame('Checkboxes')
+ frame.setShadowType(frame.SHADOW_IN)
+ frame.setBorderWidth(10)
+ table.add(frame, 0, 0)
+
+ vbox = toolkit.createVBox()
+ vbox.alignLeft()
+ vbox.setLeftPadding(12)
+ vbox.alignTop()
+ vbox.setTopPadding(6)
+ frame.add(vbox)
+
+ cb1 = toolkit.createCheckbox('CB 1 (checked)', True)
+ cb1.bind(cb1.SIGNAL_TOGGLED, onToggled)
+ vbox.add(cb1)
+
+ cb2 = toolkit.createCheckbox('CB 2 (unchecked)', False)
+ cb2.bind(cb2.SIGNAL_TOGGLED, onToggled)
+ vbox.add(cb2)
+
+ cb3 = toolkit.createCheckbox('_CB 3 (uses underline)', False)
+ cb3.bind(cb3.SIGNAL_TOGGLED, onToggled)
+ vbox.add(cb3)
+
+ frame = toolkit.createFrame('Radio Buttons')
+ frame.setShadowType(frame.SHADOW_OUT)
+ frame.setBorderWidth(10)
+ table.add(frame, 0, 1)
+
+ vbox = toolkit.createVBox()
+ vbox.alignLeft()
+ vbox.setLeftPadding(12)
+ vbox.alignTop()
+ vbox.setTopPadding(6)
+ frame.add(vbox)
+
+ rb1 = toolkit.createRadioButton('RB 1 (selected)', None, True)
+ rb1.bind(rb1.SIGNAL_TOGGLED, onToggled)
+ vbox.add(rb1)
+
+ rb2 = toolkit.createRadioButton('RB 2 (unselected)', rb1, False)
+ rb2.bind(rb2.SIGNAL_TOGGLED, onToggled)
+ vbox.add(rb2)
+
+ rb3 = toolkit.createRadioButton('_RB 3 (uses underline)', rb1, False)
+ rb3.bind(rb3.SIGNAL_TOGGLED, onToggled)
+ vbox.add(rb3)
+
+ table = toolkit.createTable(1, 2)
+ label = toolkit.createLabel('Buttons')
+ tabbedWidget.addPage(table, label)
+
+ frame = toolkit.createFrame('Simple Buttons')
+ frame.setShadowType(frame.SHADOW_IN)
+ frame.setBorderWidth(10)
+ table.add(frame, 0, 0)
+
+ vbox = toolkit.createVBox()
+ vbox.alignLeft()
+ vbox.setLeftPadding(12)
+ vbox.alignTop()
+ vbox.setTopPadding(6)
+ frame.add(vbox)
+
+ pb1 = toolkit.createPushButton('Button 1 (is default)')
+ vbox.add(pb1)
+ pb1.setIsDefault(True)
+ pb1.bind(pb1.SIGNAL_CLICKED, onClicked)
+
+ pb2 = toolkit.createPushButton('Button 2 (not default)')
+ vbox.add(pb2)
+ pb2.setIsDefault(False)
+ pb2.bind(pb2.SIGNAL_CLICKED, onClicked)
+
+ pb3 = toolkit.createPushButton('_Button 3 (uses underline)')
+ vbox.add(pb3)
+ pb3.bind(pb3.SIGNAL_CLICKED, onClicked)
+
+ frame = toolkit.createFrame('Message Dialogs')
+ frame.setShadowType(frame.SHADOW_OUT)
+ frame.setBorderWidth(10)
+ table.add(frame, 0, 1)
+
+ hbox = toolkit.createHBox()
+ hbox.setSpacing(10)
+ frame.add(hbox)
+
+ vbox = toolkit.createVBox()
+ vbox.alignLeft()
+ vbox.setLeftPadding(12)
+ vbox.alignTop()
+ vbox.setTopPadding(6)
+ hbox.add(vbox)
+
+ messageDialog = toolkit.createMessageDialog()
+ messageDialog.setMainText('Type Not Specified')
+ messageDialog.setSecondaryText('Secondary text. Bla bla bla bla bla bla.')
+ messageDialog.addButton(messageDialog.BUTTON_CLOSE)
+ messageDialog.bind(messageDialog.SIGNAL_RESPONSE, onResponse)
+ pb1 = toolkit.createPushButton('Type Not Specified')
+ vbox.add(pb1)
+ pb1.bind(pb1.SIGNAL_CLICKED, onClicked, messageDialog.display)
+
+ messageDialog = toolkit.createMessageDialog()
+ messageDialog.setType(messageDialog.MESSAGE_INFO)
+ messageDialog.setMainText('Information')
+ messageDialog.setSecondaryText('Secondary text. Bla bla bla bla bla bla.')
+ messageDialog.addButton(messageDialog.BUTTON_OK)
+ messageDialog.bind(messageDialog.SIGNAL_RESPONSE, onResponse)
+ pb2 = toolkit.createPushButton('Information')
+ vbox.add(pb2)
+ pb2.bind(pb2.SIGNAL_CLICKED, onClicked, messageDialog.display)
+
+ messageDialog = toolkit.createMessageDialog()
+ messageDialog.setType(messageDialog.MESSAGE_WARNING)
+ messageDialog.setMainText('Warning')
+ messageDialog.setSecondaryText('Secondary text. Bla bla bla bla bla bla.')
+ messageDialog.addButton(messageDialog.BUTTON_CANCEL)
+ messageDialog.bind(messageDialog.SIGNAL_RESPONSE, onResponse)
+ pb3 = toolkit.createPushButton('Warning')
+ vbox.add(pb3)
+ pb3.bind(pb3.SIGNAL_CLICKED, onClicked, messageDialog.display)
+
+ vbox = toolkit.createVBox()
+ vbox.alignLeft()
+ vbox.setLeftPadding(12)
+ vbox.alignTop()
+ vbox.setTopPadding(6)
+ hbox.add(vbox)
+
+ messageDialog = toolkit.createMessageDialog()
+ messageDialog.setType(messageDialog.MESSAGE_QUESTION)
+ messageDialog.setMainText('Question')
+ messageDialog.setSecondaryText('Secondary text. Bla bla bla bla bla bla.')
+ messageDialog.addButton(messageDialog.BUTTON_NO)
+ messageDialog.addButton(messageDialog.BUTTON_YES)
+ messageDialog.bind(messageDialog.SIGNAL_RESPONSE, onResponse)
+ pb4 = toolkit.createPushButton('Question')
+ vbox.add(pb4)
+ pb4.bind(pb4.SIGNAL_CLICKED, onClicked, messageDialog.display)
+
+ messageDialog = toolkit.createMessageDialog()
+ messageDialog.setType(messageDialog.MESSAGE_ERROR)
+ messageDialog.setMainText('Error')
+ messageDialog.setSecondaryText('Secondary text. Bla bla bla bla bla bla.')
+ messageDialog.addButton(messageDialog.BUTTON_CANCEL)
+ messageDialog.addButton(messageDialog.BUTTON_OK)
+ messageDialog.bind(messageDialog.SIGNAL_RESPONSE, onResponse)
+ pb5 = toolkit.createPushButton('Error')
+ vbox.add(pb5)
+ pb5.bind(pb5.SIGNAL_CLICKED, onClicked, messageDialog.display)
+
+ messageDialog = toolkit.createMessageDialog()
+ messageDialog.setType(messageDialog.MESSAGE_ERROR)
+ messageDialog.setMainText('Wordy Error')
+ messageDialog.setSecondaryText('Secondary text. The presence of the text ' \
+ 'should force the message dialog to grow ' \
+ 'sufficiently to display all of the text ' \
+ 'reasonably. Bla bla bla bla bla bla bla.' \
+ '\n\nBla bla bla bla bla bla bla bla bla.')
+ pb6 = toolkit.createPushButton('Wordy Error')
+ messageDialog.bind(messageDialog.SIGNAL_RESPONSE, onResponse)
+ vbox.add(pb6)
+ pb6.bind(pb6.SIGNAL_CLICKED, onClicked, messageDialog.display)
+
+ table = toolkit.createTable(1, 2)
+ label = toolkit.createLabel('Ranges')
+ tabbedWidget.addPage(table, label)
+
+ frame = toolkit.createFrame('Spinners')
+ frame.setShadowType(frame.SHADOW_IN)
+ frame.setBorderWidth(10)
+ table.add(frame, 0, 0)
+
+ vbox = toolkit.createVBox()
+ vbox.alignLeft()
+ vbox.setLeftPadding(12)
+ vbox.alignTop()
+ vbox.setTopPadding(6)
+ frame.add(vbox)
+
+ hbox = toolkit.createHBox()
+ hbox.setSpacing(10)
+ vbox.add(hbox)
+
+ minValue = -10
+ maxValue = 10
+ value = -3.5
+ step = 1
+ page = 5
+ precision = 3
+
+ label = toolkit.createLabel('_Volume:')
+ spinner = toolkit.createSpinner()
+ spinner.setRange(minValue, maxValue)
+ spinner.setValue(value)
+ spinner.setIncrements(step, page)
+ spinner.setPrecision(precision)
+ spinner.bind(spinner.SIGNAL_VALUE_CHANGED, onValueChanged)
+ spinner.bind(spinner.SIGNAL_TEXT_CHANGED, onTextChanged)
+ label.setMnemonicWidget(spinner)
+ hbox.add(label)
+ hbox.add(spinner)
+
+ hbox = toolkit.createHBox()
+ hbox.setSpacing(10)
+ vbox.add(hbox)
+
+ precision = 0
+ value = 2
+
+ label = toolkit.createLabel('_Rate:')
+ spinner = toolkit.createSpinner()
+ spinner.setRange(minValue, maxValue)
+ spinner.setValue(value)
+ spinner.setIncrements(step, page)
+ spinner.setPrecision(precision)
+ spinner.bind(spinner.SIGNAL_VALUE_CHANGED, onValueChanged)
+ spinner.bind(spinner.SIGNAL_TEXT_CHANGED, onTextChanged)
+ hbox.add(label, False, True, 10)
+ hbox.add(spinner)
+
+ frame = toolkit.createFrame('Sliders')
+ frame.setShadowType(frame.SHADOW_OUT)
+ frame.setBorderWidth(10)
+ table.add(frame, 0, 1)
+
+ vbox = toolkit.createVBox()
+ vbox.alignLeft()
+ vbox.setLeftPadding(12)
+ vbox.alignTop()
+ vbox.setTopPadding(6)
+ frame.add(vbox)
+
+ minValue = -10
+ maxValue = 10
+ value = -3.5
+ step = 1
+ page = 5
+ precision = 3
+
+ slider = toolkit.createHSlider()
+ slider.setRange(minValue, maxValue)
+ slider.setValue(value)
+ slider.setIncrements(step, page)
+ slider.setPrecision(precision)
+ vbox.add(slider, True, True, 0)
+ slider.bind(slider.SIGNAL_VALUE_CHANGED, onValueChanged)
+
+ precision = 0
+ value = 2
+
+ slider = toolkit.createHSlider()
+ slider.setRange(minValue, maxValue)
+ slider.setValue(value)
+ slider.setIncrements(step, page)
+ slider.setPrecision(precision)
+ vbox.add(slider)
+ slider.bind(slider.SIGNAL_VALUE_CHANGED, onValueChanged)
+
+ table = toolkit.createTable(2, 2)
+ label = toolkit.createLabel('Text')
+ tabbedWidget.addPage(table, label)
+
+ frame = toolkit.createFrame('Entries')
+ frame.setShadowType(frame.SHADOW_IN)
+ frame.setBorderWidth(10)
+ table.add(frame, 0, 0)
+
+ vbox = toolkit.createVBox()
+ vbox.alignLeft()
+ vbox.setLeftPadding(12)
+ vbox.alignTop()
+ vbox.setTopPadding(6)
+ frame.add(vbox)
+
+ hbox = toolkit.createHBox()
+ hbox.setSpacing(10)
+ vbox.add(hbox)
+
+ label = toolkit.createLabel('_Username:')
+ entry = toolkit.createEntry('Joanmarie', False)
+ entry.bind(entry.SIGNAL_TEXT_CHANGED, onTextChanged)
+ label.setMnemonicWidget(entry)
+ hbox.add(label)
+ hbox.add(entry)
+
+ hbox = toolkit.createHBox()
+ hbox.setSpacing(10)
+ vbox.add(hbox)
+
+ label = toolkit.createLabel('_Password:')
+ entry = toolkit.createEntry('ConsoleAppsRock', True)
+ entry.bind(entry.SIGNAL_TEXT_CHANGED, onTextChanged)
+ label.setMnemonicWidget(entry)
+ hbox.add(label)
+ hbox.add(entry)
+
+ frame = toolkit.createFrame('Comboboxes')
+ frame.setShadowType(frame.SHADOW_OUT)
+ frame.setBorderWidth(10)
+ table.add(frame, 0, 1)
+
+ vbox = toolkit.createVBox()
+ vbox.alignLeft()
+ vbox.setLeftPadding(12)
+ vbox.alignTop()
+ vbox.setTopPadding(6)
+ frame.add(vbox)
+
+ hbox = toolkit.createHBox()
+ hbox.setSpacing(10)
+ vbox.add(hbox)
+
+ label = toolkit.createLabel('_Standard:')
+ comboboxItems = ['one', 'two', 'three', 'four', 'five']
+ combobox = toolkit.createTextComboBox()
+ for i, item in enumerate(comboboxItems):
+ combobox.addItemAtPosition(item, i)
+ combobox.setSelectedItem(2)
+ combobox.bind(combobox.SIGNAL_SELECTION_CHANGED, onSelectionChanged)
+ label.setMnemonicWidget(combobox)
+ hbox.add(label)
+ hbox.add(combobox, True, True, 10)
+
+ hbox = toolkit.createHBox()
+ hbox.setSpacing(10)
+ vbox.add(hbox)
+
+ label = toolkit.createLabel('_Editable:')
+ comboboxItems = ['edit me!', 'one', 'two', 'three', 'four', 'five']
+ combobox = toolkit.createTextComboBox(True)
+ for i, item in enumerate(comboboxItems):
+ combobox.addItemAtPosition(item, i)
+ combobox.setSelectedItem(0)
+ combobox.bind(combobox.SIGNAL_SELECTION_CHANGED, onSelectionChanged)
+ hbox.add(label)
+ hbox.add(combobox, True, True, 10)
+
+ table = toolkit.createTable(1, 2)
+ label = toolkit.createLabel('Trees')
+ tabbedWidget.addPage(table, label)
+
+ tree = toolkit.createTree(toolkit.TYPE_STRING, toolkit.TYPE_INT, toolkit.TYPE_STRING)
+ tree.setColumnTitle(0, 'Word')
+ tree.setColumnTitle(1, 'Arabic')
+ tree.setColumnTitle(2, 'Roman')
+ tree.setGridLines(tree.GRID_LINES_BOTH)
+ tree.setRulesHint(True)
+ tree.setRootIsDecorated(False)
+ tree.sortByColumn(0, tree.ORDER_ASCENDING)
+ model = tree.getModel()
+ model.append(None, ['One', 1, 'I'])
+ model.append(None, ['Two', 2, 'II'])
+ model.append(None, ['Three', 3, 'III'])
+ model.append(None, ['Four', 4, 'IV'])
+ model.append(None, ['Five', 5, 'V'])
+ table.add(tree, 0, 0)
+
+ window.display()
+ toolkit.main()
+
+ return window
+
+def main():
+ try:
+ toolkit = sys.argv[1]
+ except IndexError:
+ toolkit = 'gtk2'
+
+ runTest(toolkit)
+
+ return 0
+
+if __name__ == "__main__":
+ sys.exit(main())
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]