Padding, changing key symbols, size improvements, etc
authorEd Page <eopage@byu.net>
Fri, 10 Sep 2010 22:12:45 +0000 (17:12 -0500)
committerEd Page <eopage@byu.net>
Fri, 10 Sep 2010 22:12:45 +0000 (17:12 -0500)
src/ejpi_qt.py
src/plugins/builtins.py
src/plugins/computer.map [deleted file]
src/plugins/computer.py
src/plugins/trig.py
src/qhistory.py
src/util/qtpie.py
src/util/qtpieboard.py

index 05b597f..a1d92f4 100755 (executable)
@@ -253,7 +253,7 @@ class MainWindow(object):
                self._userEntry = QValueEntry()
                self._userEntry.entry.returnPressed.connect(self._on_push)
                self._userEntryLayout = QtGui.QHBoxLayout()
-               self._userEntryLayout.addWidget(self._userEntry.toplevel)
+               self._userEntryLayout.addWidget(self._userEntry.toplevel, 10)
 
                self._controlLayout = QtGui.QVBoxLayout()
                self._controlLayout.addWidget(self._errorDisplay.toplevel)
index 58bd625..2a33714 100644 (file)
@@ -21,8 +21,8 @@ _MAP = {
                },
                (0, 1): {
                        "CENTER": {"action": "8", "type": "text", "text": "8", },
-                       "SOUTH": {"action": "[**]", "type": "text", "text": "**", },
-                       "EAST": {"action": "[sq]", "type": "text", "text": "sq", },
+                       "SOUTH": {"action": "[**]", "type": "text", "text": "x ** y", },
+                       "EAST": {"action": "[sq]", "type": "text", "text": "x ** 2", },
                        "WEST": {"action": "[sqrt]", "type": "text", "text": "sqrt", },
                        "showAllSlices": False,
                },
@@ -60,7 +60,7 @@ _MAP = {
                },
                (2, 2): {
                        "CENTER": {"action": "3", "type": "text", "text": "3", },
-                       "NORTH": {"action": "[!]", "type": "text", "text": "!", },
+                       "NORTH": {"action": "[!]", "type": "text", "text": "x !", },
                        "WEST": {"action": "j", "type": "text", "text": "j", },
                        "showAllSlices": True,
                },
diff --git a/src/plugins/computer.map b/src/plugins/computer.map
deleted file mode 100644 (file)
index a1193d3..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-{
-       "name": "Computer",
-       "dimensions": (3, 3),
-       "keys": {
-               (0, 0): {
-                       "CENTER": {"action": "[//]", "type": "text", "text": "//", },
-                       "showAllSlices": False,
-               },
-               (0, 1): {
-                       "CENTER": {"action": "[dec]", "type": "text", "text": "dec", },
-                       "showAllSlices": True,
-               },
-               (0, 2): {
-                       "CENTER": {"action": "[%]", "type": "text", "text": "%", },
-                       "showAllSlices": False,
-               },
-               (1, 0): {
-                       "CENTER": {"action": "[&]", "type": "text", "text": "and", },
-                       "showAllSlices": True,
-               },
-               (1, 1): {
-                       "CENTER": {"action": "[|]", "type": "text", "text": "or", },
-                       "NORTH": {"action": "[~]", "type": "text", "text": "not", },
-                       "showAllSlices": True,
-               },
-               (1, 2): {
-                       "CENTER": {"action": "[^]", "type": "text", "text": "xor", },
-                       "showAllSlices": True,
-               },
-               (2, 0): {
-                       "CENTER": {"action": "0x", "type": "text", "text": "0x", },
-                       "SOUTH": {"action": "[hex]", "type": "text", "text": "hex", },
-                       "NORTH_WEST": {"action": "a", "type": "text", "text": "A", },
-                       "WEST": {"action": "b", "type": "text", "text": "B", },
-                       "SOUTH_WEST": {"action": "c", "type": "text", "text": "C", },
-                       "NORTH_EAST": {"action": "d", "type": "text", "text": "D", },
-                       "EAST": {"action": "e", "type": "text", "text": "E", },
-                       "SOUTH_EAST": {"action": "f", "type": "text", "text": "F", },
-                       "showAllSlices": True,
-               },
-               (2, 1): {
-                       "CENTER": {"action": "0o", "type": "text", "text": "0o", },
-                       "SOUTH": {"action": "[oct]", "type": "text", "text": "oct", },
-                       "showAllSlices": True,
-               },
-               (2, 2): {
-                       "CENTER": {"action": "0b", "type": "text", "text": "0b", },
-                       "showAllSlices": True,
-               },
-       },
-}
index 5edd77e..65520ba 100644 (file)
@@ -17,25 +17,25 @@ _MAP = {
        "name": _NAME,
        "keys": {
                (0, 0): {
-                       "CENTER": {"action": "[//]", "type": "text", "text": "//", },
+                       "CENTER": {"action": "[//]", "type": "text", "text": "x // y", },
                        "showAllSlices": False,
                },
                (0, 1): {
-                       "CENTER": {"action": "[dec]", "type": "text", "text": "dec", },
+                       "CENTER": {"action": "[dec]", "type": "text", "text": "-> dec", },
                        "showAllSlices": True,
                },
                (0, 2): {
-                       "CENTER": {"action": "[%]", "type": "text", "text": "%", },
+                       "CENTER": {"action": "[%]", "type": "text", "text": "x % y", },
                        "showAllSlices": False,
                },
                (1, 0): {
                        "CENTER": {"action": "0o", "type": "text", "text": "0o", },
-                       "SOUTH": {"action": "[oct]", "type": "text", "text": "oct", },
+                       "SOUTH": {"action": "[oct]", "type": "text", "text": "-> oct", },
                        "showAllSlices": True,
                },
                (1, 1): {
                        "CENTER": {"action": "0x", "type": "text", "text": "0x", },
-                       "SOUTH": {"action": "[hex]", "type": "text", "text": "hex", },
+                       "SOUTH": {"action": "[hex]", "type": "text", "text": "-> hex", },
                        "NORTH_WEST": {"action": "a", "type": "text", "text": "A", },
                        "WEST": {"action": "b", "type": "text", "text": "B", },
                        "SOUTH_WEST": {"action": "c", "type": "text", "text": "C", },
index c1cd3d7..65d5863 100644 (file)
@@ -32,8 +32,8 @@ _MAP = {
                        "showAllSlices": False,
                },
                (1, 0): {
-                       "CENTER": {"action": "[exp]", "type": "text", "text": "exp", },
-                       "NORTH": {"action": "[log]", "type": "text", "text": "log", },
+                       "CENTER": {"action": "[exp]", "type": "text", "text": "e ** x", },
+                       "NORTH": {"action": "[log]", "type": "text", "text": "ln", },
                        "showAllSlices": True,
                },
                (1, 1): {
@@ -42,8 +42,8 @@ _MAP = {
                        "showAllSlices": True,
                },
                (1, 2): {
-                       "CENTER": {"action": "[rad]", "type": "text", "text": "rad", },
-                       "NORTH": {"action": "[deg]", "type": "text", "text": "deg", },
+                       "CENTER": {"action": "[rad]", "type": "text", "text": "-> rad", },
+                       "NORTH": {"action": "[deg]", "type": "text", "text": "-> deg", },
                        "showAllSlices": True,
                },
                (2, 0): {
index a853173..4b7a0ae 100644 (file)
@@ -74,6 +74,10 @@ class QCalcHistory(history.AbstractHistory):
                equation = QtGui.QStandardItem(operation.render_operation(self._prettyRenderer, node))
                equation.setData(node)
                equation.setCheckable(False)
+               eqFont = equation.font()
+               eqFont.setPointSize(max(eqFont.pointSize() - 3, 5))
+               equation.setFont(eqFont)
+
                result = QtGui.QStandardItem(operation.render_operation(self._prettyRenderer, simpleNode))
                result.setData(simpleNode)
                result.setEditable(False)
index 884d5ce..005050f 100755 (executable)
@@ -25,6 +25,45 @@ _moduleLogger = logging.getLogger(__name__)
 _TWOPI = 2 * math.pi
 
 
+class EIGHT_SLICE_PIE(object):
+
+       SLICE_CENTER = -1
+       SLICE_NORTH = 0
+       SLICE_NORTH_WEST = 1
+       SLICE_WEST = 2
+       SLICE_SOUTH_WEST = 3
+       SLICE_SOUTH = 4
+       SLICE_SOUTH_EAST = 5
+       SLICE_EAST = 6
+       SLICE_NORTH_EAST = 7
+
+       MAX_ANGULAR_SLICES = 8
+
+       SLICE_DIRECTIONS = [
+               SLICE_CENTER,
+               SLICE_NORTH,
+               SLICE_NORTH_WEST,
+               SLICE_WEST,
+               SLICE_SOUTH_WEST,
+               SLICE_SOUTH,
+               SLICE_SOUTH_EAST,
+               SLICE_EAST,
+               SLICE_NORTH_EAST,
+       ]
+
+       SLICE_DIRECTION_NAMES = [
+               "CENTER",
+               "NORTH",
+               "NORTH_WEST",
+               "WEST",
+               "SOUTH_WEST",
+               "SOUTH",
+               "SOUTH_EAST",
+               "EAST",
+               "NORTH_EAST",
+       ]
+
+
 def _radius_at(center, pos):
        delta = pos - center
        xDelta = delta.x()
index 80c43d0..7d79c60 100755 (executable)
@@ -14,41 +14,21 @@ import qtpie
 
 class PieKeyboard(object):
 
-       SLICE_CENTER = -1
-       SLICE_NORTH = 0
-       SLICE_NORTH_WEST = 1
-       SLICE_WEST = 2
-       SLICE_SOUTH_WEST = 3
-       SLICE_SOUTH = 4
-       SLICE_SOUTH_EAST = 5
-       SLICE_EAST = 6
-       SLICE_NORTH_EAST = 7
-
-       MAX_ANGULAR_SLICES = 8
-
-       SLICE_DIRECTIONS = [
-               SLICE_CENTER,
-               SLICE_NORTH,
-               SLICE_NORTH_WEST,
-               SLICE_WEST,
-               SLICE_SOUTH_WEST,
-               SLICE_SOUTH,
-               SLICE_SOUTH_EAST,
-               SLICE_EAST,
-               SLICE_NORTH_EAST,
-       ]
-
-       SLICE_DIRECTION_NAMES = [
-               "CENTER",
-               "NORTH",
-               "NORTH_WEST",
-               "WEST",
-               "SOUTH_WEST",
-               "SOUTH",
-               "SOUTH_EAST",
-               "EAST",
-               "NORTH_EAST",
-       ]
+       SLICE_CENTER = qtpie.EIGHT_SLICE_PIE.SLICE_CENTER
+       SLICE_NORTH = qtpie.EIGHT_SLICE_PIE.SLICE_NORTH
+       SLICE_NORTH_WEST = qtpie.EIGHT_SLICE_PIE.SLICE_NORTH_WEST
+       SLICE_WEST = qtpie.EIGHT_SLICE_PIE.SLICE_WEST
+       SLICE_SOUTH_WEST = qtpie.EIGHT_SLICE_PIE.SLICE_SOUTH_WEST
+       SLICE_SOUTH = qtpie.EIGHT_SLICE_PIE.SLICE_SOUTH
+       SLICE_SOUTH_EAST = qtpie.EIGHT_SLICE_PIE.SLICE_SOUTH_EAST
+       SLICE_EAST = qtpie.EIGHT_SLICE_PIE.SLICE_EAST
+       SLICE_NORTH_EAST = qtpie.EIGHT_SLICE_PIE.SLICE_NORTH_EAST
+
+       MAX_ANGULAR_SLICES = qtpie.EIGHT_SLICE_PIE.MAX_ANGULAR_SLICES
+
+       SLICE_DIRECTIONS = qtpie.EIGHT_SLICE_PIE.SLICE_DIRECTIONS
+
+       SLICE_DIRECTION_NAMES = qtpie.EIGHT_SLICE_PIE.SLICE_DIRECTION_NAMES
 
        def __init__(self):
                self._layout = QtGui.QGridLayout()
@@ -63,7 +43,7 @@ class PieKeyboard(object):
 
        def add_pie(self, row, column, pieButton):
                assert len(pieButton) == 8
-               self._layout.addWidget(pieButton, row, column)
+               self._layout.addWidget(pieButton, row, column, QtCore.Qt.AlignCenter)
                self.__cells[(row, column)] = pieButton
 
        def get_pie(self, row, column):