diff --git a/__main__.py b/__main__.py
index fb2db59..99a33a7 100755
--- a/__main__.py
+++ b/__main__.py
@@ -87,16 +87,35 @@ class MainWindow(QtGui.QMainWindow, ui.Ui_MainWindow):
self.lineEdit.returnPressed.connect(self.input_characters)
self.pushButton.clicked.connect(self.input_characters)
+ def show_result(self,char_code):
+ result = ""
+ header = '
'
+ result = header + result
+
+ for (char,code) in char_code:
+ result = result + '' + \
+ char + ' | '
+
+ for i in range(len(code)):
+ if (i < len(code) - 1):
+ result = result + code[i] + ' '
+ else:
+ result = result + code[i] + ' |
'
+
+ result = result + '
'
+ self.label_2.setText(result)
+
def input_characters(self):
import re
characters = self.lineEdit.text()
- chinese_char_pattern = re.compile("^[\u4e00-\u9fa5]+$")
+ chinese_char_pattern = re.compile("^[\u2f00-\u2fd5\u4e00-\u9fcc\u3400-\u4db5\u20000-\u2a6d6\u2a700-\u2b734\u2b740-\u2b81d\u2b820-\u2cea1]+$")
is_chinese_chars = chinese_char_pattern.match(characters)
if is_chinese_chars:
char_code_list = [(ch,find_code(ch,self.c)) for ch in characters]
- print(char_code_list)
+ self.show_result(char_code_list)
else:
print("error")
diff --git a/ui.py b/ui.py
index 8a300ae..a265250 100644
--- a/ui.py
+++ b/ui.py
@@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'ui.ui'
#
-# Created: Wed Mar 23 23:22:07 2016
+# Created: Fri Apr 1 23:13:43 2016
# by: PyQt4 UI code generator 4.10.4
#
# WARNING! All changes made in this file will be lost!
@@ -76,7 +76,15 @@ class Ui_MainWindow(object):
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.scrollArea = QtGui.QScrollArea(self.centralwidget)
+ self.scrollArea.setWidgetResizable(True)
+ self.scrollArea.setObjectName(_fromUtf8("scrollArea"))
+ self.scrollAreaWidgetContents = QtGui.QWidget()
+ self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 365, 219))
+ self.scrollAreaWidgetContents.setObjectName(_fromUtf8("scrollAreaWidgetContents"))
+ self.horizontalLayout_4 = QtGui.QHBoxLayout(self.scrollAreaWidgetContents)
+ self.horizontalLayout_4.setObjectName(_fromUtf8("horizontalLayout_4"))
+ self.label_2 = QtGui.QLabel(self.scrollAreaWidgetContents)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
@@ -88,11 +96,13 @@ class Ui_MainWindow(object):
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_4.addWidget(self.label_2)
+ self.scrollArea.setWidget(self.scrollAreaWidgetContents)
+ self.verticalLayout.addWidget(self.scrollArea)
self.horizontalLayout_3.addLayout(self.verticalLayout)
MainWindow.setCentralWidget(self.centralwidget)
self.menubar = QtGui.QMenuBar(MainWindow)
- self.menubar.setGeometry(QtCore.QRect(0, 0, 387, 22))
+ self.menubar.setGeometry(QtCore.QRect(0, 0, 387, 23))
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 dd2d86b..0e88ace 100644
--- a/ui.ui
+++ b/ui.ui
@@ -97,15 +97,30 @@
-
-
-
-
- 0
- 0
-
+
+
+ true
-
- <html><head/><body><p>您查詢的行列碼為:
+
+
+
+ 0
+ 0
+ 365
+ 219
+
+
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ <html><head/><body><p>您查詢的行列碼為:
<table style="vertical-align:top;">
<tr>
<td><span style=" font-size:18pt;">越</span></td>
@@ -117,22 +132,26 @@
</tr>
</table>
</html>
-
-
- Qt::AutoText
-
-
- Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop
-
-
- 2
-
-
- 5
-
-
- 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
+
+
+
+
+
@@ -145,7 +164,7 @@
0
0
387
- 22
+ 23