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)
},
(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,
},
},
(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,
},
+++ /dev/null
-{
- "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,
- },
- },
-}
"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", },
"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): {
"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): {
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)
_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()
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()
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):