Moving push to the entry row
authorEd Page <eopage@byu.net>
Sat, 10 Jul 2010 12:04:00 +0000 (07:04 -0500)
committerEd Page <eopage@byu.net>
Sat, 10 Jul 2010 12:22:58 +0000 (07:22 -0500)
src/ejpi_qt.py
src/plugins/builtin_entry.ini [new file with mode: 0644]
src/plugins/builtin_entry.map [new file with mode: 0644]
src/plugins/builtin_entry.py [new file with mode: 0644]
src/plugins/builtins.map

index c3068f1..d853375 100755 (executable)
@@ -261,11 +261,13 @@ class MainWindow(object):
                self._historyView = qhistory.QCalcHistory(self._errorDisplay)
                self._userEntry = QValueEntry()
                self._userEntry.entry.returnPressed.connect(self._on_push)
+               self._userEntryLayout = QtGui.QHBoxLayout()
+               self._userEntryLayout.addWidget(self._userEntry.toplevel)
 
                self._controlLayout = QtGui.QVBoxLayout()
                self._controlLayout.addLayout(self._errorDisplay.toplevel)
                self._controlLayout.addWidget(self._historyView.toplevel)
-               self._controlLayout.addWidget(self._userEntry.toplevel)
+               self._controlLayout.addLayout(self._userEntryLayout)
 
                self._inputLayout = QtGui.QVBoxLayout()
 
@@ -349,6 +351,12 @@ class MainWindow(object):
                self._builtinPlugin = self._keyboardPlugins.keyboards["Builtin"].construct_keyboard()
                self._builtinKeyboard = self._builtinPlugin.setup(self._history, self._handler)
 
+               entryKeyboardId = self._keyboardPlugins.lookup_plugin("Entry")
+               self._keyboardPlugins.enable_plugin(entryKeyboardId)
+               entryPlugin = self._keyboardPlugins.keyboards["Entry"].construct_keyboard()
+               entryKeyboard = entryPlugin.setup(self._history, self._handler)
+               self._userEntryLayout.addLayout(entryKeyboard.toplevel)
+
                # Plugins
                self.enable_plugin(self._keyboardPlugins.lookup_plugin("Trigonometry"))
                self.enable_plugin(self._keyboardPlugins.lookup_plugin("Computer"))
diff --git a/src/plugins/builtin_entry.ini b/src/plugins/builtin_entry.ini
new file mode 100644 (file)
index 0000000..cbbaa4d
--- /dev/null
@@ -0,0 +1,14 @@
+[Operator]
+name=Entry
+version=0.1
+description=
+
+[Constants]
+name=Entry
+version=0.1
+description=
+
+[Keyboard]
+name=Entry
+version=0.1
+description=
diff --git a/src/plugins/builtin_entry.map b/src/plugins/builtin_entry.map
new file mode 100644 (file)
index 0000000..9f915df
--- /dev/null
@@ -0,0 +1,13 @@
+{
+       "name": "Entry",
+       "dimensions": (1, 1),
+       "keys": {
+               (0, 0): {
+                       "CENTER": {"action": "[push]", "type": "image", "path": "newline.png", },
+                       "NORTH": {"action": "[unpush]", "type": "text", "text": "Undo", },
+                       "NORTH_WEST": {"action": "[clear]", "type": "image", "path": "clear.png", },
+                       "WEST": {"action": "[backspace]", "type": "image", "path": "backspace.png", },
+                       "showAllSlices": False,
+               },
+       },
+}
diff --git a/src/plugins/builtin_entry.py b/src/plugins/builtin_entry.py
new file mode 100644 (file)
index 0000000..7f32ddb
--- /dev/null
@@ -0,0 +1,24 @@
+from __future__ import division
+
+import os
+
+import sys
+sys.path.append("../")
+import plugin_utils
+
+
+_NAME = "Entry"
+_MAP = {
+       "name": _NAME,
+       "keys": {
+               (0, 0): {
+                       "CENTER": {"action": "[push]", "type": "image", "path": "newline.png", },
+                       "NORTH": {"action": "[unpush]", "type": "text", "text": "Undo", },
+                       "NORTH_WEST": {"action": "[clear]", "type": "image", "path": "clear.png", },
+                       "WEST": {"action": "[backspace]", "type": "image", "path": "backspace.png", },
+                       "showAllSlices": False,
+               },
+       },
+}
+_ICON_PATH = [os.path.join(os.path.dirname(__file__), "images")]
+PLUGIN = plugin_utils.PieKeyboardPluginFactory(_NAME, _MAP, _ICON_PATH)
index 6bbb840..f978384 100644 (file)
@@ -1,6 +1,6 @@
 {
        "name": "Builtins",
-       "dimensions": (4, 3),
+       "dimensions": (3, 3),
        "keys": {
                (0, 0): {
                        "CENTER": {"action": "7", "type": "text", "text": "7", },
                },
                (2, 0): {
                        "CENTER": {"action": "1", "type": "text", "text": "1", },
+                       "EAST": {"action": "0", "type": "text", "text": "0", },
                        "showAllSlices": True,
                },
                (2, 1): {
                        "CENTER": {"action": "2", "type": "text", "text": "2", },
-                       "NORTH": {"action": "[abs]", "type": "text", "text": "abs", },
+                       "EAST": {"action": "[abs]", "type": "text", "text": "abs", },
+                       "NORTH": {"action": ".", "type": "text", "text": ".", },
+                       "WEST": {"action": "[+-]", "type": "text", "text": "+/-", },
                        "showAllSlices": True,
                },
                (2, 2): {
                        "CENTER": {"action": "3", "type": "text", "text": "3", },
-                       "WEST": {"action": "[!]", "type": "text", "text": "!", },
-                       "showAllSlices": True,
-               },
-               (3, 0): {
-                       "CENTER": {"action": "[push]", "type": "image", "path": "newline.png", },
-                       "NORTH": {"action": "[unpush]", "type": "text", "text": "Undo", },
-                       "NORTH_WEST": {"action": "[clear]", "type": "image", "path": "clear.png", },
-                       "WEST": {"action": "[backspace]", "type": "image", "path": "backspace.png", },
-                       "showAllSlices": False,
-               },
-               (3, 1): {
-                       "CENTER": {"action": "0", "type": "text", "text": "0", },
-                       "showAllSlices": True,
-               },
-               (3, 2): {
-                       "CENTER": {"action": ".", "type": "text", "text": ".", },
-                       "NORTH": {"action": "j", "type": "text", "text": "j", },
-                       "WEST": {"action": "[+-]", "type": "text", "text": "+/-", },
+                       "NORTH": {"action": "[!]", "type": "text", "text": "!", },
+                       "WEST": {"action": "j", "type": "text", "text": "j", },
                        "showAllSlices": True,
                },
        },