From f7f2e35172c6cd952163bf8388d0a92a6e3d00f1 Mon Sep 17 00:00:00 2001 From: fromwheretowhere Date: Fri, 28 Sep 2018 23:08:37 -0700 Subject: [PATCH 1/3] =?UTF-8?q?mac=E4=B8=8B=E8=A1=8C=E5=B0=BE=E6=9C=89^M,?= =?UTF-8?q?=20=E5=9C=A8Linux=E4=B8=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wubicodeeditor.py | 4 ++++ "\345\255\227\347\254\246\350\241\250.py" | 23 +++++++++++++++++++++++ "\345\270\270\351\207\217.py" | 14 ++++++++++++-- 3 files changed, 39 insertions(+), 2 deletions(-) diff --git a/wubicodeeditor.py b/wubicodeeditor.py index 86318a9..bc58c65 100755 --- a/wubicodeeditor.py +++ b/wubicodeeditor.py @@ -18,6 +18,9 @@ def __init__(self, master=None): def 修改当前条目(self): self.字符表.修改当前字符(self.编码86版值.get(), self.编码98版值.get(), self.编码06版值.get()) + 源数据文件路径 = 常量.源数据路径 + 常量.源数据文件[self.字符表.取当前字符区间号()] + 字符区间 = self.字符表.取当前字符区间() + csv文件处理.写数组到文件(self.字符表.取所有字符()[字符区间[0]:字符区间[1]], 源数据文件路径) def 导出文件(self): csv文件处理.写数组到文件(self.字符表.取所有字符(), 常量.修改后文件) @@ -154,6 +157,7 @@ def 刷新控件(self): for 字体 in 常量.图片路径.keys(): self.刷新图片显示(self.按字体取图片显示[字体], 字体) + # TODO: 界面改进: 只读部分如果为空, 显示'无', 而不是空白 self.Unicode编码值.set(当前字符[0]) self.编码86版值.set(当前字符[2]) self.编码98版值.set(当前字符[3]) diff --git "a/\345\255\227\347\254\246\350\241\250.py" "b/\345\255\227\347\254\246\350\241\250.py" index ee9a069..796a070 100644 --- "a/\345\255\227\347\254\246\350\241\250.py" +++ "b/\345\255\227\347\254\246\350\241\250.py" @@ -1,10 +1,33 @@ class 字符表: 当前字符序号 = 0 字符列表 = [] + 字符序号区间 = [] def 添加所有字符(self, 子字符列表): self.字符列表.extend(子字符列表) + self.字符序号区间.append(len(self.字符列表)) + print(self.字符序号区间) + def 取当前字符区间号(self): + 区间号 = 0 + for 末字符序号 in self.字符序号区间: + if self.当前字符序号 < 末字符序号: + break + else: + 区间号 += 1 + return 区间号 + + def 取当前字符区间(self): + 开始序号 = 0 + 结束序号 = 0 + for 末字符序号 in self.字符序号区间: + if self.当前字符序号 < 末字符序号: + 结束序号 = 末字符序号 + break + else: + 开始序号 = 末字符序号 + return (开始序号, 结束序号) + def 取当前字符(self): # TODO: 判断序号范围 return self.字符列表[self.当前字符序号] diff --git "a/\345\270\270\351\207\217.py" "b/\345\270\270\351\207\217.py" index 628a4b4..7fc84a3 100644 --- "a/\345\270\270\351\207\217.py" +++ "b/\345\270\270\351\207\217.py" @@ -1,8 +1,18 @@ from collections import OrderedDict 源数据路径 = "UnicodeCJK-Wubi/" -源数据文件 = ["CJK-A.txt", "CJK-B.txt", "CJK-C.txt", - "CJK-D.txt", "CJK-E.txt", "CJK-F.txt", "CJK.txt"] + +# https://github.com/CNMan/UnicodeCJK-WuBi/pull/2#issuecomment-424330083 +# 4E00..9FFF CJK +# 3400..4DBF CJK-A +# 20000..2A6DF CJK-B +# 2A700..2B73F CJK-C +# 2B740..2B81F CJK-D +# 2B820..2CEAF CJK-E +# 2CEB0..2EBEF CJK-F +# 按码大小范围排序 +源数据文件 = ["CJK-A.txt", "CJK.txt", "CJK-B.txt", "CJK-C.txt", + "CJK-D.txt", "CJK-E.txt", "CJK-F.txt"] # 暂时只指出导出到一个文件 修改后文件 = "CJK-所有.txt" From d81ac3f5132b06fc390ef655132e603d92b6cfef Mon Sep 17 00:00:00 2001 From: fromwheretowhere Date: Fri, 28 Sep 2018 23:22:44 -0700 Subject: [PATCH 2/3] =?UTF-8?q?Linux=E4=B8=8B=E6=96=87=E4=BB=B6=E8=B7=AF?= =?UTF-8?q?=E5=BE=84=E5=A4=A7=E5=B0=8F=E5=86=99=E6=95=8F=E6=84=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- "\345\270\270\351\207\217.py" | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git "a/\345\270\270\351\207\217.py" "b/\345\270\270\351\207\217.py" index 7fc84a3..de3de53 100644 --- "a/\345\270\270\351\207\217.py" +++ "b/\345\270\270\351\207\217.py" @@ -1,6 +1,6 @@ from collections import OrderedDict -源数据路径 = "UnicodeCJK-Wubi/" +源数据路径 = "UnicodeCJK-WuBi/" # https://github.com/CNMan/UnicodeCJK-WuBi/pull/2#issuecomment-424330083 # 4E00..9FFF CJK From 81807aa95ac8ae5ffb856d3ff23ea3bfbfff7bc6 Mon Sep 17 00:00:00 2001 From: fromwheretowhere Date: Sat, 29 Sep 2018 00:10:24 -0700 Subject: [PATCH 3/3] =?UTF-8?q?=E5=88=A0=E9=99=A4'=E5=AF=BC=E5=87=BA?= =?UTF-8?q?=E6=96=87=E4=BB=B6'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 +- wubicodeeditor.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 5b43df1..f59f242 100644 --- a/.gitignore +++ b/.gitignore @@ -139,7 +139,7 @@ pip-selfcheck.json # End of https://www.gitignore.io/api/python,visualstudiocode -UnicodeCJK-Wubi +UnicodeCJK-WuBi UnicodeCJK-FontGlyphs # 暂时不列入版本控制 diff --git a/wubicodeeditor.py b/wubicodeeditor.py index bc58c65..6759344 100755 --- a/wubicodeeditor.py +++ b/wubicodeeditor.py @@ -22,8 +22,8 @@ def 修改当前条目(self): 字符区间 = self.字符表.取当前字符区间() csv文件处理.写数组到文件(self.字符表.取所有字符()[字符区间[0]:字符区间[1]], 源数据文件路径) - def 导出文件(self): - csv文件处理.写数组到文件(self.字符表.取所有字符(), 常量.修改后文件) + #def 导出文件(self): + # csv文件处理.写数组到文件(self.字符表.取所有字符(), 常量.修改后文件) # TODO: 提示已到开头/末尾 def 上一个字符(self): @@ -130,8 +130,8 @@ def 创建控件(self): command=lambda: self.搜索Unicode(搜索Unicode值.get())) 搜索Unicode.pack(side="right") - 导出按钮 = Button(细节区, text="导出文件", command=self.导出文件) - 导出按钮.pack() + #导出按钮 = Button(细节区, text="导出文件", command=self.导出文件) + #导出按钮.pack() def 搜索Unicode(self, Unicode值输入): if self.字符表.按Unicode码置当前字符(Unicode值输入):