mirror of
https://github.com/plasmaofthedawn/fcitx5-toki-pona.git
synced 2026-04-23 19:52:51 -06:00
initial commit
This commit is contained in:
78
combine.py
Normal file
78
combine.py
Normal file
@@ -0,0 +1,78 @@
|
||||
import subprocess
|
||||
import os
|
||||
|
||||
header = """KeyCode=mnptkswljiueoaAR
|
||||
Length=16
|
||||
Prompt=
|
||||
ConstructPhrase=
|
||||
[Data]
|
||||
"""
|
||||
|
||||
ucscr_header = """KeyCode=mnptkswljiueoa()[]{}^*.: -"
|
||||
Length=16
|
||||
Prompt=
|
||||
ConstructPhrase=
|
||||
[Data]
|
||||
"""
|
||||
|
||||
|
||||
def make_conf(name, filepath):
|
||||
|
||||
a = f"""[InputMethod]
|
||||
Name=toki pona - {name}
|
||||
LangCode=toki pona
|
||||
Addon=table
|
||||
Configurable=True
|
||||
|
||||
[Table]
|
||||
File=table/{filepath}.dict
|
||||
OrderPolicy=Fast
|
||||
PageSize=10
|
||||
ExactMatch={"True" if name != "UCSUR" else "False"}
|
||||
|
||||
[Table/PrevPage]
|
||||
0=Page_Up
|
||||
|
||||
[Table/NextPage]
|
||||
0=Page_Down
|
||||
|
||||
[Table/Selection]
|
||||
0=F1
|
||||
1=F2
|
||||
2=F3
|
||||
3=F4
|
||||
4=F5
|
||||
5=F6
|
||||
6=F7
|
||||
7=F8
|
||||
8=F9
|
||||
9=F10
|
||||
"""
|
||||
with open(f"confs/{filepath}.conf", "w") as f:
|
||||
f.write(a)
|
||||
|
||||
|
||||
try:
|
||||
os.mkdir("raw_tables")
|
||||
os.mkdir("table")
|
||||
os.mkdir("confs")
|
||||
except FileExistsError as e:
|
||||
pass
|
||||
|
||||
names = [f"sitelen Kansi ({x})" for x in ["Tencent QQ", "sitelen munjan", "jan Josan", "jan Mato (jp)", "jan Mato (zh)", "jan U", "enervation", "jan lili", "StuleBackery", "sitelen Sonko pona", "WillBaneOfGods", "nasin pi kulupu Eko", "JoeStrout", "Evilkenevil77", "sitelen Sonwa", "sitelen Kanpun", "All"]] + ["UCSUR", "Toki Pona Script (dingbats)", "nasin pi sitelen jelo"]
|
||||
|
||||
filenames = ["toki_pona_" + x.replace(" ", "_").replace("(", "").replace(")", "").lower() for x in names]
|
||||
|
||||
data = open("data.txt").read()
|
||||
|
||||
for n, fn, d in zip(names, filenames, data.split("---")):
|
||||
|
||||
print(n, fn)
|
||||
|
||||
with open(f"raw_tables/{fn}.txt", "w") as f:
|
||||
f.write(header if n != "UCSUR" and n != "nasin pi sitelen jelo" else ucscr_header)
|
||||
f.write(d.strip())
|
||||
|
||||
subprocess.Popen(["libime_tabledict", f"raw_tables/{fn}.txt", f"table/{fn}.dict"])
|
||||
|
||||
make_conf(n, fn)
|
||||
Reference in New Issue
Block a user