annotate python/codeedit.py @ 161:956f8e5ee48a

Improvements to code edit
author Windel Bouwman
date Sat, 09 Mar 2013 15:52:55 +0100
parents 10330be89bc2
children d8c735dc31f9
rev   line source
160
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
1 #!/usr/bin/python
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
2
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
3 import sys
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
4 from PyQt4.QtCore import *
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
5 from PyQt4.QtGui import *
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
6 import inspect
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
7
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
8 GAP = 5
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
9
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
10 def clipVal(v, mn, mx):
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
11 if v < mn: return mn
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
12 if v > mx: return mx
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
13 return v
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
14
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
15 class InnerCode(QWidget):
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
16 def __init__(self, scrollArea):
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
17 super().__init__(scrollArea)
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
18 self.scrollArea = scrollArea
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
19 self.setFont(QFont('Courier', 16))
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
20 self.setFocusPolicy(Qt.StrongFocus)
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
21 self.blinkcursor = False
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
22 # Initial values:
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
23 self.setSource('')
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
24 self.CursorPosition = 0
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
25 t = QTimer(self)
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
26 t.timeout.connect(self.updateCursor)
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
27 t.setInterval(500)
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
28 t.start()
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
29 def updateCursor(self):
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
30 self.blinkcursor = not self.blinkcursor
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
31 self.update(self.cursorX, self.cursorY, self.charWidth, self.charHeight)
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
32 def setSource(self, src):
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
33 self.src = src
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
34 self.adjust()
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
35 def setCursorPosition(self, c):
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
36 self.cursorPosition = clipVal(c, 0, len(self.src))
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
37 self.cursorX = self.CursorCol * self.charWidth + self.xposTXT - self.charWidth
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
38 self.cursorY = self.CursorRow * self.charHeight - self.charHeight
161
956f8e5ee48a Improvements to code edit
Windel Bouwman
parents: 160
diff changeset
39 self.update()
160
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
40 CursorPosition = property(lambda self: self.cursorPosition, setCursorPosition)
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
41 @property
161
956f8e5ee48a Improvements to code edit
Windel Bouwman
parents: 160
diff changeset
42 def Rows(self):
956f8e5ee48a Improvements to code edit
Windel Bouwman
parents: 160
diff changeset
43 # Make this nicer:
956f8e5ee48a Improvements to code edit
Windel Bouwman
parents: 160
diff changeset
44 return self.src.split('\n')
956f8e5ee48a Improvements to code edit
Windel Bouwman
parents: 160
diff changeset
45 @property
160
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
46 def CursorRow(self):
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
47 # TODO: make this nice.
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
48 txt = self.src[0:self.cursorPosition]
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
49 return len(txt.split('\n'))
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
50 @property
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
51 def CursorCol(self):
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
52 txt = self.src[0:self.cursorPosition]
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
53 curLine = txt.split('\n')[-1]
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
54 return len(curLine) + 1
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
55 @property
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
56 def CurrentLine(self):
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
57 return self.getRow(self.CursorRow)
161
956f8e5ee48a Improvements to code edit
Windel Bouwman
parents: 160
diff changeset
58 def setRowCol(self, r, c):
956f8e5ee48a Improvements to code edit
Windel Bouwman
parents: 160
diff changeset
59 prevRows = self.Rows[:r]
956f8e5ee48a Improvements to code edit
Windel Bouwman
parents: 160
diff changeset
60 txt = '\n'.join(prevRows)
956f8e5ee48a Improvements to code edit
Windel Bouwman
parents: 160
diff changeset
61 self.CursorPosition = len(txt) + c
160
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
62 def getRow(self, r):
161
956f8e5ee48a Improvements to code edit
Windel Bouwman
parents: 160
diff changeset
63 rows = self.Rows
160
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
64 r = r - 1
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
65 if r < 0 or r > len(rows) - 1:
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
66 return ''
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
67 else:
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
68 return rows[r]
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
69 def getChar(self, pos):
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
70 pass
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
71 def insertText(self, txt):
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
72 self.setSource(self.src[0:self.CursorPosition] + txt + self.src[self.CursorPosition:])
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
73 self.CursorPosition += len(txt)
161
956f8e5ee48a Improvements to code edit
Windel Bouwman
parents: 160
diff changeset
74 def deleteChar(self):
956f8e5ee48a Improvements to code edit
Windel Bouwman
parents: 160
diff changeset
75 self.setSource(self.src[0:self.CursorPosition] + self.src[self.CursorPosition+1:])
160
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
76 def GotoNextChar(self):
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
77 if self.src[self.CursorPosition] != '\n':
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
78 self.CursorPosition += 1
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
79 def GotoPrevChar(self):
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
80 if self.src[self.CursorPosition - 1] != '\n':
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
81 self.CursorPosition -= 1
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
82 def GotoNextLine(self):
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
83 curLine = self.CurrentLine
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
84 c = self.CursorCol
161
956f8e5ee48a Improvements to code edit
Windel Bouwman
parents: 160
diff changeset
85 self.CursorPosition += len(curLine) - c + 1 # line break char!
160
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
86 curLine = self.CurrentLine
161
956f8e5ee48a Improvements to code edit
Windel Bouwman
parents: 160
diff changeset
87 if len(curLine) < c:
956f8e5ee48a Improvements to code edit
Windel Bouwman
parents: 160
diff changeset
88 self.CursorPosition += len(curLine)
956f8e5ee48a Improvements to code edit
Windel Bouwman
parents: 160
diff changeset
89 else:
956f8e5ee48a Improvements to code edit
Windel Bouwman
parents: 160
diff changeset
90 self.CursorPosition += c
956f8e5ee48a Improvements to code edit
Windel Bouwman
parents: 160
diff changeset
91 def GotoPrevLine(self):
160
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
92 c = self.CursorCol
161
956f8e5ee48a Improvements to code edit
Windel Bouwman
parents: 160
diff changeset
93 self.CursorPosition -= c + 1 # line break char!
956f8e5ee48a Improvements to code edit
Windel Bouwman
parents: 160
diff changeset
94 curLine = self.CurrentLine
956f8e5ee48a Improvements to code edit
Windel Bouwman
parents: 160
diff changeset
95 if len(curLine) > c:
956f8e5ee48a Improvements to code edit
Windel Bouwman
parents: 160
diff changeset
96 self.CursorPosition -= len(curLine) - c
160
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
97 def paintEvent(self, event):
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
98 # Helper variables:
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
99 er = event.rect()
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
100 chw, chh = self.charWidth, self.charHeight
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
101 painter = QPainter(self)
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
102 # Background:
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
103 painter.fillRect(er, self.palette().color(QPalette.Base))
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
104 painter.fillRect(QRect(self.xposLNA, er.top(), 8 * chw, er.bottom() + 1), Qt.gray)
161
956f8e5ee48a Improvements to code edit
Windel Bouwman
parents: 160
diff changeset
105 painter.fillRect(er.left(), (self.CursorRow - 1) * chh, er.width(), chh, Qt.yellow)
160
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
106 painter.setPen(Qt.gray)
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
107 # first and last row:
161
956f8e5ee48a Improvements to code edit
Windel Bouwman
parents: 160
diff changeset
108 row1 = max(int(er.top() / chh) - 1, 1)
956f8e5ee48a Improvements to code edit
Windel Bouwman
parents: 160
diff changeset
109 row2 = max(int(er.bottom() / chh) + 1, 1)
160
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
110 # Draw contents:
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
111 for row in range(row1, row2 + 1):
161
956f8e5ee48a Improvements to code edit
Windel Bouwman
parents: 160
diff changeset
112 ypos = row * chh - self.charDescent
160
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
113 painter.setPen(Qt.black)
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
114 painter.drawText(self.xposLNA, ypos, 'R ={0}'.format(row))
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
115 xpos = self.xposTXT
161
956f8e5ee48a Improvements to code edit
Windel Bouwman
parents: 160
diff changeset
116 painter.drawText(xpos, ypos, self.getRow(row))
160
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
117 # cursor
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
118 if self.blinkcursor:
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
119 painter.fillRect(self.cursorX, self.cursorY, 2, chh, Qt.black)
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
120 def keyPressEvent(self, event):
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
121 if event.matches(QKeySequence.MoveToNextChar):
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
122 self.GotoNextChar()
161
956f8e5ee48a Improvements to code edit
Windel Bouwman
parents: 160
diff changeset
123 elif event.matches(QKeySequence.MoveToPreviousChar):
160
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
124 self.GotoPrevChar()
161
956f8e5ee48a Improvements to code edit
Windel Bouwman
parents: 160
diff changeset
125 elif event.matches(QKeySequence.MoveToNextLine):
160
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
126 self.GotoNextLine()
161
956f8e5ee48a Improvements to code edit
Windel Bouwman
parents: 160
diff changeset
127 elif event.matches(QKeySequence.MoveToPreviousLine):
160
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
128 self.GotoPrevLine()
161
956f8e5ee48a Improvements to code edit
Windel Bouwman
parents: 160
diff changeset
129 elif event.matches(QKeySequence.MoveToNextPage):
160
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
130 for i in range(5):
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
131 self.GotoNextLine()
161
956f8e5ee48a Improvements to code edit
Windel Bouwman
parents: 160
diff changeset
132 elif event.matches(QKeySequence.MoveToPreviousPage):
160
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
133 for i in range(5):
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
134 self.GotoPrevLine()
161
956f8e5ee48a Improvements to code edit
Windel Bouwman
parents: 160
diff changeset
135 elif event.matches(QKeySequence.MoveToEndOfLine):
160
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
136 self.CursorPosition += len(self.CurrentLine) - self.CursorCol + 1
161
956f8e5ee48a Improvements to code edit
Windel Bouwman
parents: 160
diff changeset
137 elif event.matches(QKeySequence.MoveToStartOfLine):
160
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
138 self.CursorPosition -= self.CursorCol - 1
161
956f8e5ee48a Improvements to code edit
Windel Bouwman
parents: 160
diff changeset
139 elif event.matches(QKeySequence.Delete):
956f8e5ee48a Improvements to code edit
Windel Bouwman
parents: 160
diff changeset
140 self.deleteChar()
956f8e5ee48a Improvements to code edit
Windel Bouwman
parents: 160
diff changeset
141 elif event.matches(QKeySequence.InsertParagraphSeparator):
956f8e5ee48a Improvements to code edit
Windel Bouwman
parents: 160
diff changeset
142 self.insertText('\n')
956f8e5ee48a Improvements to code edit
Windel Bouwman
parents: 160
diff changeset
143 elif event.key() == Qt.Key_Backspace:
956f8e5ee48a Improvements to code edit
Windel Bouwman
parents: 160
diff changeset
144 self.CursorPosition -= 1
956f8e5ee48a Improvements to code edit
Windel Bouwman
parents: 160
diff changeset
145 self.deleteChar()
956f8e5ee48a Improvements to code edit
Windel Bouwman
parents: 160
diff changeset
146 else:
956f8e5ee48a Improvements to code edit
Windel Bouwman
parents: 160
diff changeset
147 char = event.text()
956f8e5ee48a Improvements to code edit
Windel Bouwman
parents: 160
diff changeset
148 if char:
956f8e5ee48a Improvements to code edit
Windel Bouwman
parents: 160
diff changeset
149 self.insertText(char)
160
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
150 self.update()
161
956f8e5ee48a Improvements to code edit
Windel Bouwman
parents: 160
diff changeset
151 def mousePressEvent(self, event):
956f8e5ee48a Improvements to code edit
Windel Bouwman
parents: 160
diff changeset
152 pos = event.pos()
956f8e5ee48a Improvements to code edit
Windel Bouwman
parents: 160
diff changeset
153 if pos.x() > self.xposTXT and pos.x():
956f8e5ee48a Improvements to code edit
Windel Bouwman
parents: 160
diff changeset
154 c = round((pos.x() - self.xposTXT) / self.charWidth)
956f8e5ee48a Improvements to code edit
Windel Bouwman
parents: 160
diff changeset
155 r = int(pos.y() / self.charHeight)
956f8e5ee48a Improvements to code edit
Windel Bouwman
parents: 160
diff changeset
156 self.setRowCol(r, c)
160
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
157 def adjust(self):
161
956f8e5ee48a Improvements to code edit
Windel Bouwman
parents: 160
diff changeset
158 metrics = self.fontMetrics()
956f8e5ee48a Improvements to code edit
Windel Bouwman
parents: 160
diff changeset
159 self.charHeight = metrics.height()
956f8e5ee48a Improvements to code edit
Windel Bouwman
parents: 160
diff changeset
160 self.charWidth = metrics.width('x')
956f8e5ee48a Improvements to code edit
Windel Bouwman
parents: 160
diff changeset
161 self.charDescent = metrics.descent()
160
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
162 self.xposLNA = GAP
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
163 self.xposTXT = self.xposLNA + 8 * self.charWidth + GAP
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
164 self.xposEnd = self.xposTXT + self.charWidth * 80
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
165 self.setMinimumWidth(self.xposEnd)
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
166 txt = self.src.split('\n')
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
167 self.setMinimumHeight(self.charHeight * len(txt))
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
168 self.update()
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
169
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
170 class CodeEdit(QScrollArea):
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
171 def __init__(self):
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
172 super().__init__()
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
173 self.ic = InnerCode(self)
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
174 self.setWidget(self.ic)
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
175 self.setWidgetResizable(True)
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
176 self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
177 self.setFocusPolicy(Qt.NoFocus)
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
178 Source = property(lambda s: s.ic.getSource(), lambda s, v: s.ic.setSource(v))
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
179
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
180 if __name__ == '__main__':
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
181 app = QApplication(sys.argv)
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
182 ce = CodeEdit()
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
183 ce.show()
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
184 src = ''.join(inspect.getsourcelines(InnerCode)[0])
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
185 ce.Source = src
161
956f8e5ee48a Improvements to code edit
Windel Bouwman
parents: 160
diff changeset
186 ce.resize(600, 800)
160
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
187 app.exec()
10330be89bc2 Started from scratch with code edit
Windel Bouwman
parents:
diff changeset
188