add sontehing

This commit is contained in:
Tan, Kian-ting 2016-03-23 23:39:28 +08:00
parent 87c6fc61ae
commit f28b353c5e
3 changed files with 177 additions and 91 deletions

View file

@ -77,11 +77,16 @@ def rawcode2truecode(raw):
return true_code return true_code
class MainWindow(QtGui.QMainWindow, ui.Ui_Dialog): class MainWindow(QtGui.QMainWindow, ui.Ui_MainWindow):
def __init__(self, parent=None): def __init__(self, parent=None):
super(MainWindow, self).__init__(parent) super(MainWindow, self).__init__(parent)
self.setupUi(self) self.setupUi(self)
self.lineEdit.returnPressed.connect(self.input_characters)
self.pushButton.clicked.connect(self.input_characters)
def input_characters(self):
print("Hello world")
#TODO: validate, and return result
def main(): def main():
app = QtGui.QApplication(sys.argv) app = QtGui.QApplication(sys.argv)
form = MainWindow() form = MainWindow()

64
ui.py
View file

@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'ui.ui' # Form implementation generated from reading ui file 'ui.ui'
# #
# Created: Wed Mar 23 07:34:11 2016 # Created: Wed Mar 23 23:22:07 2016
# by: PyQt4 UI code generator 4.10.4 # by: PyQt4 UI code generator 4.10.4
# #
# WARNING! All changes made in this file will be lost! # WARNING! All changes made in this file will be lost!
@ -26,31 +26,73 @@ except AttributeError:
class Ui_MainWindow(object): class Ui_MainWindow(object):
def setupUi(self, MainWindow): def setupUi(self, MainWindow):
MainWindow.setObjectName(_fromUtf8("MainWindow")) MainWindow.setObjectName(_fromUtf8("MainWindow"))
MainWindow.resize(478, 408) MainWindow.resize(387, 359)
self.centralwidget = QtGui.QWidget(MainWindow) self.centralwidget = QtGui.QWidget(MainWindow)
self.centralwidget.setObjectName(_fromUtf8("centralwidget")) self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
self.textEdit = QtGui.QTextEdit(self.centralwidget) self.horizontalLayout_3 = QtGui.QHBoxLayout(self.centralwidget)
self.textEdit.setGeometry(QtCore.QRect(90, 20, 301, 21)) self.horizontalLayout_3.setObjectName(_fromUtf8("horizontalLayout_3"))
self.textEdit.setObjectName(_fromUtf8("textEdit")) self.verticalLayout = QtGui.QVBoxLayout()
self.verticalLayout.setSizeConstraint(QtGui.QLayout.SetDefaultConstraint)
self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
self.horizontalLayout = QtGui.QHBoxLayout()
self.horizontalLayout.setSizeConstraint(QtGui.QLayout.SetDefaultConstraint)
self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
self.label = QtGui.QLabel(self.centralwidget) self.label = QtGui.QLabel(self.centralwidget)
self.label.setGeometry(QtCore.QRect(10, 20, 66, 15)) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Maximum)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.label.sizePolicy().hasHeightForWidth())
self.label.setSizePolicy(sizePolicy)
self.label.setObjectName(_fromUtf8("label")) self.label.setObjectName(_fromUtf8("label"))
self.horizontalLayout.addWidget(self.label)
self.lineEdit = QtGui.QLineEdit(self.centralwidget)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Maximum)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.lineEdit.sizePolicy().hasHeightForWidth())
self.lineEdit.setSizePolicy(sizePolicy)
self.lineEdit.setObjectName(_fromUtf8("lineEdit"))
self.horizontalLayout.addWidget(self.lineEdit)
self.pushButton = QtGui.QPushButton(self.centralwidget) self.pushButton = QtGui.QPushButton(self.centralwidget)
self.pushButton.setGeometry(QtCore.QRect(400, 20, 61, 26)) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Maximum)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.pushButton.sizePolicy().hasHeightForWidth())
self.pushButton.setSizePolicy(sizePolicy)
self.pushButton.setObjectName(_fromUtf8("pushButton")) self.pushButton.setObjectName(_fromUtf8("pushButton"))
self.horizontalLayout.addWidget(self.pushButton)
self.verticalLayout.addLayout(self.horizontalLayout)
self.horizontalLayout_2 = QtGui.QHBoxLayout()
self.horizontalLayout_2.setSizeConstraint(QtGui.QLayout.SetDefaultConstraint)
self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2"))
spacerItem = QtGui.QSpacerItem(168, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.horizontalLayout_2.addItem(spacerItem)
self.pushButton_2 = QtGui.QPushButton(self.centralwidget) self.pushButton_2 = QtGui.QPushButton(self.centralwidget)
self.pushButton_2.setGeometry(QtCore.QRect(400, 60, 61, 26)) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Maximum)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.pushButton_2.sizePolicy().hasHeightForWidth())
self.pushButton_2.setSizePolicy(sizePolicy)
self.pushButton_2.setObjectName(_fromUtf8("pushButton_2")) self.pushButton_2.setObjectName(_fromUtf8("pushButton_2"))
self.horizontalLayout_2.addWidget(self.pushButton_2)
self.verticalLayout.addLayout(self.horizontalLayout_2)
self.label_2 = QtGui.QLabel(self.centralwidget) self.label_2 = QtGui.QLabel(self.centralwidget)
self.label_2.setGeometry(QtCore.QRect(30, 110, 421, 211)) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.label_2.sizePolicy().hasHeightForWidth())
self.label_2.setSizePolicy(sizePolicy)
self.label_2.setTextFormat(QtCore.Qt.AutoText) self.label_2.setTextFormat(QtCore.Qt.AutoText)
self.label_2.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop) self.label_2.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop)
self.label_2.setMargin(-2) self.label_2.setMargin(2)
self.label_2.setIndent(5)
self.label_2.setTextInteractionFlags(QtCore.Qt.LinksAccessibleByKeyboard|QtCore.Qt.LinksAccessibleByMouse|QtCore.Qt.TextBrowserInteraction|QtCore.Qt.TextSelectableByKeyboard|QtCore.Qt.TextSelectableByMouse) self.label_2.setTextInteractionFlags(QtCore.Qt.LinksAccessibleByKeyboard|QtCore.Qt.LinksAccessibleByMouse|QtCore.Qt.TextBrowserInteraction|QtCore.Qt.TextSelectableByKeyboard|QtCore.Qt.TextSelectableByMouse)
self.label_2.setObjectName(_fromUtf8("label_2")) self.label_2.setObjectName(_fromUtf8("label_2"))
self.verticalLayout.addWidget(self.label_2)
self.horizontalLayout_3.addLayout(self.verticalLayout)
MainWindow.setCentralWidget(self.centralwidget) MainWindow.setCentralWidget(self.centralwidget)
self.menubar = QtGui.QMenuBar(MainWindow) self.menubar = QtGui.QMenuBar(MainWindow)
self.menubar.setGeometry(QtCore.QRect(0, 0, 478, 21)) self.menubar.setGeometry(QtCore.QRect(0, 0, 387, 22))
self.menubar.setObjectName(_fromUtf8("menubar")) self.menubar.setObjectName(_fromUtf8("menubar"))
self.menu_Help = QtGui.QMenu(self.menubar) self.menu_Help = QtGui.QMenu(self.menubar)
self.menu_Help.setObjectName(_fromUtf8("menu_Help")) self.menu_Help.setObjectName(_fromUtf8("menu_Help"))

195
ui.ui
View file

@ -6,74 +6,106 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>478</width> <width>387</width>
<height>408</height> <height>359</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>findarray30code - 行列30查碼</string> <string>findarray30code - 行列30查碼</string>
</property> </property>
<widget class="QWidget" name="centralwidget"> <widget class="QWidget" name="centralwidget">
<widget class="QTextEdit" name="textEdit"> <layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="geometry"> <item>
<rect> <layout class="QVBoxLayout" name="verticalLayout">
<x>90</x> <property name="sizeConstraint">
<y>20</y> <enum>QLayout::SetDefaultConstraint</enum>
<width>301</width> </property>
<height>21</height> <item>
</rect> <layout class="QHBoxLayout" name="horizontalLayout">
</property> <property name="sizeConstraint">
</widget> <enum>QLayout::SetDefaultConstraint</enum>
<widget class="QLabel" name="label"> </property>
<property name="geometry"> <item>
<rect> <widget class="QLabel" name="label">
<x>10</x> <property name="sizePolicy">
<y>20</y> <sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<width>66</width> <horstretch>0</horstretch>
<height>15</height> <verstretch>0</verstretch>
</rect> </sizepolicy>
</property> </property>
<property name="text"> <property name="text">
<string>輸入文字</string> <string>輸入文字</string>
</property> </property>
</widget> </widget>
<widget class="QPushButton" name="pushButton"> </item>
<property name="geometry"> <item>
<rect> <widget class="QLineEdit" name="lineEdit">
<x>400</x> <property name="sizePolicy">
<y>20</y> <sizepolicy hsizetype="Expanding" vsizetype="Maximum">
<width>61</width> <horstretch>0</horstretch>
<height>26</height> <verstretch>0</verstretch>
</rect> </sizepolicy>
</property> </property>
<property name="text"> </widget>
<string>查詢</string> </item>
</property> <item>
</widget> <widget class="QPushButton" name="pushButton">
<widget class="QPushButton" name="pushButton_2"> <property name="sizePolicy">
<property name="geometry"> <sizepolicy hsizetype="Minimum" vsizetype="Maximum">
<rect> <horstretch>0</horstretch>
<x>400</x> <verstretch>0</verstretch>
<y>60</y> </sizepolicy>
<width>61</width> </property>
<height>26</height> <property name="text">
</rect> <string>查詢</string>
</property> </property>
<property name="text"> </widget>
<string>清空</string> </item>
</property> </layout>
</widget> </item>
<widget class="QLabel" name="label_2"> <item>
<property name="geometry"> <layout class="QHBoxLayout" name="horizontalLayout_2">
<rect> <property name="sizeConstraint">
<x>30</x> <enum>QLayout::SetDefaultConstraint</enum>
<y>110</y> </property>
<width>421</width> <item>
<height>211</height> <spacer name="horizontalSpacer">
</rect> <property name="orientation">
</property> <enum>Qt::Horizontal</enum>
<property name="text"> </property>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;您查詢的行列碼為: <property name="sizeHint" stdset="0">
<size>
<width>168</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pushButton_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>清空</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;您查詢的行列碼為:
&lt;table style=&quot;vertical-align:top;&quot;&gt; &lt;table style=&quot;vertical-align:top;&quot;&gt;
&lt;tr&gt; &lt;tr&gt;
&lt;td&gt;&lt;span style=&quot; font-size:18pt;&quot;&gt;越&lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style=&quot; font-size:18pt;&quot;&gt;越&lt;/span&gt;&lt;/td&gt;
@ -85,28 +117,35 @@
&lt;/tr&gt; &lt;/tr&gt;
&lt;/table&gt; &lt;/table&gt;
&lt;/html&gt;</string> &lt;/html&gt;</string>
</property> </property>
<property name="textFormat"> <property name="textFormat">
<enum>Qt::AutoText</enum> <enum>Qt::AutoText</enum>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property> </property>
<property name="margin"> <property name="margin">
<number>-2</number> <number>2</number>
</property> </property>
<property name="textInteractionFlags"> <property name="indent">
<set>Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set> <number>5</number>
</property> </property>
</widget> <property name="textInteractionFlags">
<set>Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget> </widget>
<widget class="QMenuBar" name="menubar"> <widget class="QMenuBar" name="menubar">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>478</width> <width>387</width>
<height>21</height> <height>22</height>
</rect> </rect>
</property> </property>
<widget class="QMenu" name="menu_Help"> <widget class="QMenu" name="menu_Help">