251 lines
9.6 KiB
XML
Executable File
251 lines
9.6 KiB
XML
Executable File
<?xml version="1.0" encoding="UTF-8"?>
|
|
<ui version="4.0">
|
|
<class>CodeGenerator</class>
|
|
<widget class="QMainWindow" name="CodeGenerator">
|
|
<property name="geometry">
|
|
<rect>
|
|
<x>0</x>
|
|
<y>0</y>
|
|
<width>800</width>
|
|
<height>333</height>
|
|
</rect>
|
|
</property>
|
|
<property name="windowTitle">
|
|
<string>PyRex Code Generaotr</string>
|
|
</property>
|
|
<property name="windowIcon">
|
|
<iconset resource="src.qrc">
|
|
<normaloff>:/icons/icons/icon.ico</normaloff>:/icons/icons/icon.ico</iconset>
|
|
</property>
|
|
<widget class="QWidget" name="centralwidget">
|
|
<layout class="QVBoxLayout" name="verticalLayout">
|
|
<property name="leftMargin">
|
|
<number>0</number>
|
|
</property>
|
|
<property name="topMargin">
|
|
<number>0</number>
|
|
</property>
|
|
<property name="rightMargin">
|
|
<number>0</number>
|
|
</property>
|
|
<property name="bottomMargin">
|
|
<number>0</number>
|
|
</property>
|
|
<item>
|
|
<widget class="QTextEdit" name="textEdit">
|
|
<property name="styleSheet">
|
|
<string notr="true">border-bottom: 2px;
|
|
border-style: solid;
|
|
border-bottom-color: rgb(255, 85, 0);</string>
|
|
</property>
|
|
<property name="lineWidth">
|
|
<number>1</number>
|
|
</property>
|
|
<property name="html">
|
|
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
|
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
|
p, li { white-space: pre-wrap; }
|
|
</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;">
|
|
<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>
|
|
<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>
|
|
<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>
|
|
<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>
|
|
<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>
|
|
<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>
|
|
<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>
|
|
<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>
|
|
<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>
|
|
<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>
|
|
<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>
|
|
<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>
|
|
<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>
|
|
</property>
|
|
<property name="textInteractionFlags">
|
|
<set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
|
|
</property>
|
|
</widget>
|
|
</item>
|
|
<item>
|
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
|
<property name="topMargin">
|
|
<number>0</number>
|
|
</property>
|
|
<item>
|
|
<spacer name="horizontalSpacer">
|
|
<property name="orientation">
|
|
<enum>Qt::Horizontal</enum>
|
|
</property>
|
|
<property name="sizeHint" stdset="0">
|
|
<size>
|
|
<width>40</width>
|
|
<height>20</height>
|
|
</size>
|
|
</property>
|
|
</spacer>
|
|
</item>
|
|
<item alignment="Qt::AlignHCenter|Qt::AlignVCenter">
|
|
<widget class="QPushButton" name="CopyPushButton">
|
|
<property name="styleSheet">
|
|
<string notr="true">QPushButton#CopyPushButton {
|
|
min-width:60px;
|
|
max-width:60px;
|
|
min-height:35;
|
|
max-height:35;
|
|
|
|
color: #495057;
|
|
|
|
background: rgba(255,255,255,100%);
|
|
border-bottom: 2px;
|
|
border-style: solid;
|
|
border-bottom-color: rgba(0,0,0,.3);
|
|
border-top-left-radius: 0px;
|
|
border-top-right-radius: 3px;
|
|
border-bottom-right-radius: 0px;
|
|
border-bottom-left-radius: 0px;
|
|
}
|
|
|
|
QPushButton#CopyPushButton:hover {
|
|
background: rgba(255,255,255,50%);
|
|
border-bottom-color:rgb(255, 85, 0);
|
|
}
|
|
|
|
QPushButton#CopyPushButton:pressed {
|
|
background: rgba(255,255,255,100%);
|
|
border-bottom-color:rgb(255, 85, 0);
|
|
}
|
|
|
|
QPushButton#CopyPushButton:disabled {
|
|
background: rgba(0,0,0,.04);
|
|
border-bottom-color: rgba(0,0,0,.15);
|
|
}</string>
|
|
</property>
|
|
<property name="text">
|
|
<string>Copy</string>
|
|
</property>
|
|
</widget>
|
|
</item>
|
|
<item alignment="Qt::AlignHCenter|Qt::AlignVCenter">
|
|
<widget class="QPushButton" name="ClosePushButton">
|
|
<property name="styleSheet">
|
|
<string notr="true">QPushButton#ClosePushButton {
|
|
min-width:60px;
|
|
max-width:60px;
|
|
min-height:35;
|
|
max-height:35;
|
|
|
|
color: #495057;
|
|
|
|
background: rgba(255,255,255,100%);
|
|
border-bottom: 2px;
|
|
border-style: solid;
|
|
border-bottom-color: rgba(0,0,0,.3);
|
|
border-top-left-radius: 0px;
|
|
border-top-right-radius: 3px;
|
|
border-bottom-right-radius: 0px;
|
|
border-bottom-left-radius: 0px;
|
|
}
|
|
|
|
QPushButton#ClosePushButton:hover {
|
|
background: rgba(255,255,255,50%);
|
|
border-bottom-color:rgb(255, 85, 0);
|
|
}
|
|
|
|
QPushButton#ClosePushButton:pressed {
|
|
background: rgba(255,255,255,100%);
|
|
border-bottom-color:rgb(255, 85, 0);
|
|
}
|
|
|
|
QPushButton#ClosePushButton:disabled {
|
|
background: rgba(0,0,0,.04);
|
|
border-bottom-color: rgba(0,0,0,.15);
|
|
}</string>
|
|
</property>
|
|
<property name="text">
|
|
<string>Close</string>
|
|
</property>
|
|
</widget>
|
|
</item>
|
|
<item>
|
|
<spacer name="horizontalSpacer_2">
|
|
<property name="orientation">
|
|
<enum>Qt::Horizontal</enum>
|
|
</property>
|
|
<property name="sizeHint" stdset="0">
|
|
<size>
|
|
<width>40</width>
|
|
<height>20</height>
|
|
</size>
|
|
</property>
|
|
</spacer>
|
|
</item>
|
|
</layout>
|
|
</item>
|
|
</layout>
|
|
</widget>
|
|
<widget class="QMenuBar" name="menubar">
|
|
<property name="geometry">
|
|
<rect>
|
|
<x>0</x>
|
|
<y>0</y>
|
|
<width>800</width>
|
|
<height>21</height>
|
|
</rect>
|
|
</property>
|
|
</widget>
|
|
<widget class="QStatusBar" name="statusbar"/>
|
|
</widget>
|
|
<resources>
|
|
<include location="src.qrc"/>
|
|
</resources>
|
|
<connections>
|
|
<connection>
|
|
<sender>ClosePushButton</sender>
|
|
<signal>clicked()</signal>
|
|
<receiver>CodeGenerator</receiver>
|
|
<slot>close()</slot>
|
|
<hints>
|
|
<hint type="sourcelabel">
|
|
<x>432</x>
|
|
<y>560</y>
|
|
</hint>
|
|
<hint type="destinationlabel">
|
|
<x>399</x>
|
|
<y>299</y>
|
|
</hint>
|
|
</hints>
|
|
</connection>
|
|
<connection>
|
|
<sender>CopyPushButton</sender>
|
|
<signal>clicked()</signal>
|
|
<receiver>textEdit</receiver>
|
|
<slot>selectAll()</slot>
|
|
<hints>
|
|
<hint type="sourcelabel">
|
|
<x>366</x>
|
|
<y>560</y>
|
|
</hint>
|
|
<hint type="destinationlabel">
|
|
<x>399</x>
|
|
<y>280</y>
|
|
</hint>
|
|
</hints>
|
|
</connection>
|
|
<connection>
|
|
<sender>CopyPushButton</sender>
|
|
<signal>clicked()</signal>
|
|
<receiver>textEdit</receiver>
|
|
<slot>copy()</slot>
|
|
<hints>
|
|
<hint type="sourcelabel">
|
|
<x>366</x>
|
|
<y>560</y>
|
|
</hint>
|
|
<hint type="destinationlabel">
|
|
<x>399</x>
|
|
<y>280</y>
|
|
</hint>
|
|
</hints>
|
|
</connection>
|
|
</connections>
|
|
</ui>
|