From f9e3422898af68f9a72b155c5fa209d321a96ec9 Mon Sep 17 00:00:00 2001 From: "Chen, Chien-ting" Date: Sat, 2 Apr 2016 18:31:49 +0800 Subject: [PATCH] fe --- __main__.py | 26 +++++++++++++++++++++----- __pycache__/ui.cpython-34.pyc | Bin 0 -> 4944 bytes __pycache__/ui2.cpython-34.pyc | Bin 0 -> 4847 bytes ui.py | 19 ++++--------------- ui.ui | 17 +++-------------- 5 files changed, 28 insertions(+), 34 deletions(-) create mode 100644 __pycache__/ui.cpython-34.pyc create mode 100644 __pycache__/ui2.cpython-34.pyc diff --git a/__main__.py b/__main__.py index 99a33a7..9fed7bd 100755 --- a/__main__.py +++ b/__main__.py @@ -86,10 +86,22 @@ class MainWindow(QtGui.QMainWindow, ui.Ui_MainWindow): self.setupUi(self) self.lineEdit.returnPressed.connect(self.input_characters) self.pushButton.clicked.connect(self.input_characters) + self.pushButton_2.clicked.connect(self.clear_input) + self.action_About.triggered.connect(self.show_about) + + def clear_input(self): + self.label_2.setText("") + self.lineEdit.clear() + + def show_about(self): + about_dialog = QtGui.QWidget() + about_dialog_ui = ui2.Ui_Dialog() + about_dialog_ui.setupUi(about_dialog) + about_dialog.show() def show_result(self,char_code): result = "" - header = '' + header = "
" result = header + result for (char,code) in char_code: @@ -108,9 +120,13 @@ class MainWindow(QtGui.QMainWindow, ui.Ui_MainWindow): def input_characters(self): import re - characters = self.lineEdit.text() - chinese_char_pattern = re.compile("^[\u2f00-\u2fd5\u4e00-\u9fcc\u3400-\u4db5\u20000-\u2a6d6\u2a700-\u2b734\u2b740-\u2b81d\u2b820-\u2cea1]+$") + + #some CJK ext B,C,etc arerepensented in utf16 in pyqt qlineedit. + #convert it to utf8 + #characters = characters.encode(encoding='utf-16',errors='surrogatepass').decode('utf-8') + #print('\\u'+"\\u".join("{:x}".format(ord(c)) for c in characters)) + chinese_char_pattern = re.compile("^[一-鿌㐀-䶵𠀷𠂁𠁍]+$",re.UNICODE) is_chinese_chars = chinese_char_pattern.match(characters) if is_chinese_chars: @@ -121,8 +137,8 @@ class MainWindow(QtGui.QMainWindow, ui.Ui_MainWindow): def main(): app = QtGui.QApplication(sys.argv) - form = MainWindow() - form.show() + main_window = MainWindow() + main_window.show() app.exec_() diff --git a/__pycache__/ui.cpython-34.pyc b/__pycache__/ui.cpython-34.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4b31da6b27bb1b331cb71f44feeeff11dbdd0e69 GIT binary patch literal 4944 zcmb_g-)|g89iP45ce(S=*ohO@aYE|)(mD=FfB?qCPMtV3Hn}=ZU>`WGZ^!mt?{=@V zdn6a7Pi|En0KrQFQbpB@N+c3bNT@=AH(vPzmPceae&LO0_~p85Wo z&-cg7&g?&nrNZC5f8QM&XY3!W=jSN;SMj*NL1W@iV-3cd8q+n_OfWscw9WwI8mlK+ zJ;n4iyJt_Z6wk1C3QSyQnx>fvW+vJDjF>;PHTHwfIO7Rc&$4=s>3L?Rn3jkZRclPtP?x zZVJsK1}$y%DJyHf<_aRo=3g`D&3et&?A}Muc7OTj-Cz9d#UDQ0d;II&-~MHG)3QxN z2%~f9Ld`MxY}-2D>iGHUrf{0;-sY8lvYtT0G?7JHOHv;{^goS9PCtf@$5BhTA1R`9AGccyH9r>pb3HD`u?x2zpe$+6i;3Fs1G`00~ zsFw=$NG=ob0@17-qNLRn>0Z$s+mW?a%}b#?s~0HK^&_laBsq;{0adAHdQ~w{swJsf zI#d-@rJC(k?TZ8Kms1V|ZGAB83^92A9%>LPa+ubX1cbrS-oc18*3asr1gL(D+7LOY z$4R|stl;EBIOHEdjs-?Yko-RpM|d)haQw?4Jb5TWP-6%&RtO7+B0MQwA%w5Q5l+Mr zp87HfCk{mjY78O93L!SQpjLZhI3W=RWiu&3mLkwm&778u(}&g!sA>XPfni3@FtfzW zzR<5I1*d3RdM_E;`wDx6jVj3Eff$|rKg8(lp)mqA79)(63;n$@f@7-A&b}O@(-G)b z!{d!Egeq3G4!DNlr_pX;v>Y?;NYYPV0sKhL|}_@uC1xiXfr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ap_LAowK|09)xpMfYTlkM1&|G{ zyRK6;(ZL(saH{QQFQ4$5X$hB~^Xh`X^hVq9t`)ju!78f68A7+XX@jrey?wri!$!H~ zsAQfrRho?fscN<9@u0tLnN2guU5Z>e-X$B5USmq*7;oZH`6Prm2QY63IGQ25#!tG;(D%B_Qu*XMI473VnRM}X zjIXAPS>m}0rU|~8$QRSeQYMk-o2C3_u8@NG6|l{wv#WVXNo}OE#d$~tjHhm5!3*n& zOh$=Hl%RcH>6grH-p;4j){A^Smsv>xxSWD!iRDZx5Cx->nM8Uc##a&>i8azL&vQ^X zuh6>MZLg;k2=Ws6C5!1?mdr@zvc)`>F<6-|_DQ$Xg;b0u^63IOWHp}ydvYfz$Y)ui z%ccS@

您查詢的行列碼為:\n" -"

查碼結果:
\n" -"\n" -"\n" -"\n" -"\n" -"\n" -"\n" -"\n" -"\n" -"
4^3v1^2v
4^1^
9-0^9-6-
5^
\n" -"", None)) - self.menu_Help.setTitle(_translate("MainWindow", "&Help", None)) - self.action_About.setText(_translate("MainWindow", "&About...", None)) + self.label_2.setText(_translate("MainWindow", "


", None)) + self.menu_Help.setTitle(_translate("MainWindow", "說明 (&H)", None)) + self.action_About.setText(_translate("MainWindow", "關於 findarray30code (&A)", None)) diff --git a/ui.ui b/ui.ui index 0e88ace..3c61c0a 100644 --- a/ui.ui +++ b/ui.ui @@ -120,18 +120,7 @@ - <html><head/><body><p>您查詢的行列碼為: -<table style="vertical-align:top;"> -<tr> -<td><span style=" font-size:18pt;">越</span></td> -<td >4^3v1^2v<br/>4^1^</td> -</tr> -<tr> -<td><span style=" font-size:18pt;">的</span></td> -<td >9-0^9-6-<br/>5^</td> -</tr> -</table> -</html> + Qt::AutoText @@ -169,7 +158,7 @@ - &Help + 說明 (&H) @@ -178,7 +167,7 @@ - &About... + 關於 findarray30code (&A)