|
| 1 | +<?xml version="1.0" encoding="UTF-8"?> |
| 2 | +<ui version="4.0"> |
| 3 | + <class>CodeGenerator</class> |
| 4 | + <widget class="QMainWindow" name="CodeGenerator"> |
| 5 | + <property name="geometry"> |
| 6 | + <rect> |
| 7 | + <x>0</x> |
| 8 | + <y>0</y> |
| 9 | + <width>800</width> |
| 10 | + <height>333</height> |
| 11 | + </rect> |
| 12 | + </property> |
| 13 | + <property name="windowTitle"> |
| 14 | + <string>PyRex Code Generaotr</string> |
| 15 | + </property> |
| 16 | + <property name="windowIcon"> |
| 17 | + <iconset resource="src.qrc"> |
| 18 | + <normaloff>:/icons/icons/windowIcon.png</normaloff>:/icons/icons/windowIcon.png</iconset> |
| 19 | + </property> |
| 20 | + <widget class="QWidget" name="centralwidget"> |
| 21 | + <layout class="QVBoxLayout" name="verticalLayout"> |
| 22 | + <property name="leftMargin"> |
| 23 | + <number>0</number> |
| 24 | + </property> |
| 25 | + <property name="topMargin"> |
| 26 | + <number>0</number> |
| 27 | + </property> |
| 28 | + <property name="rightMargin"> |
| 29 | + <number>0</number> |
| 30 | + </property> |
| 31 | + <property name="bottomMargin"> |
| 32 | + <number>0</number> |
| 33 | + </property> |
| 34 | + <item> |
| 35 | + <widget class="QTextEdit" name="textEdit"> |
| 36 | + <property name="styleSheet"> |
| 37 | + <string notr="true">border-bottom: 2px; |
| 38 | +border-style: solid; |
| 39 | +border-bottom-color: rgb(255, 85, 0);</string> |
| 40 | + </property> |
| 41 | + <property name="lineWidth"> |
| 42 | + <number>1</number> |
| 43 | + </property> |
| 44 | + <property name="html"> |
| 45 | + <string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> |
| 46 | +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> |
| 47 | +p, li { white-space: pre-wrap; } |
| 48 | +</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> |
| 49 | +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">import re</span></p> |
| 50 | +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;"><br /></p> |
| 51 | +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">regex = r&quot;&lt;CHANGE_ME&gt;pattern&lt;CHANGE_ME&gt;&quot;</span></p> |
| 52 | +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">test_str = &quot;&lt;CHANGE_ME&gt;string&lt;CHANGE_ME&gt;&quot;</span></p> |
| 53 | +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;"><br /></p> |
| 54 | +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">matches = re.finditer(regex, test_str, re.MULTILINE)</span></p> |
| 55 | +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;"><br /></p> |
| 56 | +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">for matchNum, match in enumerate(matches, start=1):</span></p> |
| 57 | +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;"> print (&quot;Match {matchNum} was found at {start}-{end}: {match}&quot;.format(matchNum = matchNum, start = match.start(), end = match.end(), match = match.group()))</span></p> |
| 58 | +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;"> for groupNum in range(0, len(match.groups())):</span></p> |
| 59 | +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;"> groupNum = groupNum + 1</span></p> |
| 60 | +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;"><br /></p> |
| 61 | +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;"> print (&quot;Group {groupNum} found at {start}-{end}: {group}&quot;.format(groupNum = groupNum, start = match.start(groupNum), end = match.end(groupNum), group = match.group(groupNum)))</span></p></body></html></string> |
| 62 | + </property> |
| 63 | + <property name="textInteractionFlags"> |
| 64 | + <set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set> |
| 65 | + </property> |
| 66 | + </widget> |
| 67 | + </item> |
| 68 | + <item> |
| 69 | + <layout class="QHBoxLayout" name="horizontalLayout"> |
| 70 | + <property name="topMargin"> |
| 71 | + <number>0</number> |
| 72 | + </property> |
| 73 | + <item> |
| 74 | + <spacer name="horizontalSpacer"> |
| 75 | + <property name="orientation"> |
| 76 | + <enum>Qt::Horizontal</enum> |
| 77 | + </property> |
| 78 | + <property name="sizeHint" stdset="0"> |
| 79 | + <size> |
| 80 | + <width>40</width> |
| 81 | + <height>20</height> |
| 82 | + </size> |
| 83 | + </property> |
| 84 | + </spacer> |
| 85 | + </item> |
| 86 | + <item alignment="Qt::AlignHCenter|Qt::AlignVCenter"> |
| 87 | + <widget class="QPushButton" name="CopyPushButton"> |
| 88 | + <property name="styleSheet"> |
| 89 | + <string notr="true">QPushButton#CopyPushButton { |
| 90 | + min-width:60px; |
| 91 | + max-width:60px; |
| 92 | + min-height:35; |
| 93 | + max-height:35; |
| 94 | + |
| 95 | + color: #495057; |
| 96 | + |
| 97 | + background: rgba(255,255,255,100%); |
| 98 | + border-bottom: 2px; |
| 99 | + border-style: solid; |
| 100 | + border-bottom-color: rgba(0,0,0,.3); |
| 101 | + border-top-left-radius: 0px; |
| 102 | + border-top-right-radius: 3px; |
| 103 | + border-bottom-right-radius: 0px; |
| 104 | + border-bottom-left-radius: 0px; |
| 105 | +} |
| 106 | + |
| 107 | +QPushButton#CopyPushButton:hover { |
| 108 | + background: rgba(255,255,255,50%); |
| 109 | + border-bottom-color:rgb(255, 85, 0); |
| 110 | +} |
| 111 | + |
| 112 | +QPushButton#CopyPushButton:pressed { |
| 113 | + background: rgba(255,255,255,100%); |
| 114 | + border-bottom-color:rgb(255, 85, 0); |
| 115 | +} |
| 116 | + |
| 117 | +QPushButton#CopyPushButton:disabled { |
| 118 | + background: rgba(0,0,0,.04); |
| 119 | + border-bottom-color: rgba(0,0,0,.15); |
| 120 | +}</string> |
| 121 | + </property> |
| 122 | + <property name="text"> |
| 123 | + <string>Copy</string> |
| 124 | + </property> |
| 125 | + </widget> |
| 126 | + </item> |
| 127 | + <item alignment="Qt::AlignHCenter|Qt::AlignVCenter"> |
| 128 | + <widget class="QPushButton" name="ClosePushButton"> |
| 129 | + <property name="styleSheet"> |
| 130 | + <string notr="true">QPushButton#ClosePushButton { |
| 131 | + min-width:60px; |
| 132 | + max-width:60px; |
| 133 | + min-height:35; |
| 134 | + max-height:35; |
| 135 | + |
| 136 | + color: #495057; |
| 137 | + |
| 138 | + background: rgba(255,255,255,100%); |
| 139 | + border-bottom: 2px; |
| 140 | + border-style: solid; |
| 141 | + border-bottom-color: rgba(0,0,0,.3); |
| 142 | + border-top-left-radius: 0px; |
| 143 | + border-top-right-radius: 3px; |
| 144 | + border-bottom-right-radius: 0px; |
| 145 | + border-bottom-left-radius: 0px; |
| 146 | +} |
| 147 | + |
| 148 | +QPushButton#ClosePushButton:hover { |
| 149 | + background: rgba(255,255,255,50%); |
| 150 | + border-bottom-color:rgb(255, 85, 0); |
| 151 | +} |
| 152 | + |
| 153 | +QPushButton#ClosePushButton:pressed { |
| 154 | + background: rgba(255,255,255,100%); |
| 155 | + border-bottom-color:rgb(255, 85, 0); |
| 156 | +} |
| 157 | + |
| 158 | +QPushButton#ClosePushButton:disabled { |
| 159 | + background: rgba(0,0,0,.04); |
| 160 | + border-bottom-color: rgba(0,0,0,.15); |
| 161 | +}</string> |
| 162 | + </property> |
| 163 | + <property name="text"> |
| 164 | + <string>Close</string> |
| 165 | + </property> |
| 166 | + </widget> |
| 167 | + </item> |
| 168 | + <item> |
| 169 | + <spacer name="horizontalSpacer_2"> |
| 170 | + <property name="orientation"> |
| 171 | + <enum>Qt::Horizontal</enum> |
| 172 | + </property> |
| 173 | + <property name="sizeHint" stdset="0"> |
| 174 | + <size> |
| 175 | + <width>40</width> |
| 176 | + <height>20</height> |
| 177 | + </size> |
| 178 | + </property> |
| 179 | + </spacer> |
| 180 | + </item> |
| 181 | + </layout> |
| 182 | + </item> |
| 183 | + </layout> |
| 184 | + </widget> |
| 185 | + <widget class="QMenuBar" name="menubar"> |
| 186 | + <property name="geometry"> |
| 187 | + <rect> |
| 188 | + <x>0</x> |
| 189 | + <y>0</y> |
| 190 | + <width>800</width> |
| 191 | + <height>21</height> |
| 192 | + </rect> |
| 193 | + </property> |
| 194 | + </widget> |
| 195 | + <widget class="QStatusBar" name="statusbar"/> |
| 196 | + </widget> |
| 197 | + <resources> |
| 198 | + <include location="src.qrc"/> |
| 199 | + </resources> |
| 200 | + <connections> |
| 201 | + <connection> |
| 202 | + <sender>ClosePushButton</sender> |
| 203 | + <signal>clicked()</signal> |
| 204 | + <receiver>CodeGenerator</receiver> |
| 205 | + <slot>close()</slot> |
| 206 | + <hints> |
| 207 | + <hint type="sourcelabel"> |
| 208 | + <x>432</x> |
| 209 | + <y>560</y> |
| 210 | + </hint> |
| 211 | + <hint type="destinationlabel"> |
| 212 | + <x>399</x> |
| 213 | + <y>299</y> |
| 214 | + </hint> |
| 215 | + </hints> |
| 216 | + </connection> |
| 217 | + <connection> |
| 218 | + <sender>CopyPushButton</sender> |
| 219 | + <signal>clicked()</signal> |
| 220 | + <receiver>textEdit</receiver> |
| 221 | + <slot>selectAll()</slot> |
| 222 | + <hints> |
| 223 | + <hint type="sourcelabel"> |
| 224 | + <x>366</x> |
| 225 | + <y>560</y> |
| 226 | + </hint> |
| 227 | + <hint type="destinationlabel"> |
| 228 | + <x>399</x> |
| 229 | + <y>280</y> |
| 230 | + </hint> |
| 231 | + </hints> |
| 232 | + </connection> |
| 233 | + <connection> |
| 234 | + <sender>CopyPushButton</sender> |
| 235 | + <signal>clicked()</signal> |
| 236 | + <receiver>textEdit</receiver> |
| 237 | + <slot>copy()</slot> |
| 238 | + <hints> |
| 239 | + <hint type="sourcelabel"> |
| 240 | + <x>366</x> |
| 241 | + <y>560</y> |
| 242 | + </hint> |
| 243 | + <hint type="destinationlabel"> |
| 244 | + <x>399</x> |
| 245 | + <y>280</y> |
| 246 | + </hint> |
| 247 | + </hints> |
| 248 | + </connection> |
| 249 | + </connections> |
| 250 | +</ui> |
0 commit comments