From f28b353c5e91ad9d0092ebdacd27232704bd50c1 Mon Sep 17 00:00:00 2001 From: "Chen, Chien-ting" Date: Wed, 23 Mar 2016 23:39:28 +0800 Subject: [PATCH] add sontehing --- __main__.py | 9 ++- ui.py | 64 ++++++++++++++--- ui.ui | 195 +++++++++++++++++++++++++++++++--------------------- 3 files changed, 177 insertions(+), 91 deletions(-) diff --git a/__main__.py b/__main__.py index 0141b05..626c0c7 100755 --- a/__main__.py +++ b/__main__.py @@ -77,11 +77,16 @@ def rawcode2truecode(raw): return true_code -class MainWindow(QtGui.QMainWindow, ui.Ui_Dialog): +class MainWindow(QtGui.QMainWindow, ui.Ui_MainWindow): def __init__(self, parent=None): super(MainWindow, self).__init__(parent) 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(): app = QtGui.QApplication(sys.argv) form = MainWindow() diff --git a/ui.py b/ui.py index 34006b7..8a300ae 100644 --- a/ui.py +++ b/ui.py @@ -2,7 +2,7 @@ # 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 # # WARNING! All changes made in this file will be lost! @@ -26,31 +26,73 @@ except AttributeError: class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName(_fromUtf8("MainWindow")) - MainWindow.resize(478, 408) + MainWindow.resize(387, 359) self.centralwidget = QtGui.QWidget(MainWindow) self.centralwidget.setObjectName(_fromUtf8("centralwidget")) - self.textEdit = QtGui.QTextEdit(self.centralwidget) - self.textEdit.setGeometry(QtCore.QRect(90, 20, 301, 21)) - self.textEdit.setObjectName(_fromUtf8("textEdit")) + self.horizontalLayout_3 = QtGui.QHBoxLayout(self.centralwidget) + self.horizontalLayout_3.setObjectName(_fromUtf8("horizontalLayout_3")) + 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.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.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.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.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.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.horizontalLayout_2.addWidget(self.pushButton_2) + self.verticalLayout.addLayout(self.horizontalLayout_2) 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.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.setObjectName(_fromUtf8("label_2")) + self.verticalLayout.addWidget(self.label_2) + self.horizontalLayout_3.addLayout(self.verticalLayout) MainWindow.setCentralWidget(self.centralwidget) 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.menu_Help = QtGui.QMenu(self.menubar) self.menu_Help.setObjectName(_fromUtf8("menu_Help")) diff --git a/ui.ui b/ui.ui index 0587858..dd2d86b 100644 --- a/ui.ui +++ b/ui.ui @@ -6,74 +6,106 @@ 0 0 - 478 - 408 + 387 + 359 findarray30code - 行列30查碼 - - - - 90 - 20 - 301 - 21 - - - - - - - 10 - 20 - 66 - 15 - - - - 輸入文字 - - - - - - 400 - 20 - 61 - 26 - - - - 查詢 - - - - - - 400 - 60 - 61 - 26 - - - - 清空 - - - - - - 30 - 110 - 421 - 211 - - - - <html><head/><body><p>您查詢的行列碼為: + + + + + QLayout::SetDefaultConstraint + + + + + QLayout::SetDefaultConstraint + + + + + + 0 + 0 + + + + 輸入文字 + + + + + + + + 0 + 0 + + + + + + + + + 0 + 0 + + + + 查詢 + + + + + + + + + QLayout::SetDefaultConstraint + + + + + Qt::Horizontal + + + + 168 + 20 + + + + + + + + + 0 + 0 + + + + 清空 + + + + + + + + + + 0 + 0 + + + + <html><head/><body><p>您查詢的行列碼為: <table style="vertical-align:top;"> <tr> <td><span style=" font-size:18pt;">越</span></td> @@ -85,28 +117,35 @@ </tr> </table> </html> - - - Qt::AutoText - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - -2 - - - Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - + + + Qt::AutoText + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + 2 + + + 5 + + + Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + + + + 0 0 - 478 - 21 + 387 + 22