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 0000000..4b31da6
Binary files /dev/null and b/__pycache__/ui.cpython-34.pyc differ
diff --git a/__pycache__/ui2.cpython-34.pyc b/__pycache__/ui2.cpython-34.pyc
new file mode 100644
index 0000000..7cd0ec5
Binary files /dev/null and b/__pycache__/ui2.cpython-34.pyc differ
diff --git a/ui.py b/ui.py
index a265250..5b47c85 100644
--- a/ui.py
+++ b/ui.py
@@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'ui.ui'
#
-# Created: Fri Apr 1 23:13:43 2016
+# Created: Sat Apr 2 15:29:18 2016
# by: PyQt4 UI code generator 4.10.4
#
# WARNING! All changes made in this file will be lost!
@@ -123,18 +123,7 @@ class Ui_MainWindow(object):
self.label.setText(_translate("MainWindow", "輸入文字", None))
self.pushButton.setText(_translate("MainWindow", "查詢", None))
self.pushButton_2.setText(_translate("MainWindow", "清空", None))
- self.label_2.setText(_translate("MainWindow", "
您查詢的行列碼為:\n"
-"
\n"
-"\n"
-"越 | \n"
-"4^3v1^2v 4^1^ | \n"
-"
\n"
-"\n"
-"的 | \n"
-"9-0^9-6- 5^ | \n"
-"
\n"
-"
\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 @@
@@ -178,7 +167,7 @@
- &About...
+ 關於 findarray30code (&A)