-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdcsidewinder_gui.py
24 lines (23 loc) · 1.07 KB
/
dcsidewinder_gui.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import tktest
import re
import time
import os
from dCATDict import exportDic
tktest.KeyEater(exportDic, 'dCAT').mainloop()
translationFileRead = open("log.txt", "r")
translationFileWrite = open("write.txt", "w")
text = translationFileRead.read()
text = re.sub(r' {\^([a-zA-Z ]*)} ', lambda m: '%s ' % (m.group(1),), text)
text = re.sub(r' {([a-zA-Z ]*)\^} ', lambda m: ' %s' % (m.group(1),), text)
text = re.sub(r'{([a-zA-Z])([a-zA-Z]*)\^} ', lambda m: '%s' % (m.group(1).upper() + m.group(2),), text)
text = re.sub(r' {\.} ([a-z])', lambda m: '. %s' % (m.group(1).upper(),), text)
text = re.sub(r' {\?} ([a-z])', lambda m: '? %s' % (m.group(1).upper(),), text)
text = re.sub(r' {\!} ([a-z])', lambda m: '! %s' % (m.group(1).upper(),), text)
text = re.sub(r' {\,}', ',', text)
text = re.sub(r' {\.}', '.', text)
text = re.sub(r' {\?}', '?', text)
text = re.sub(r' {\!}', '!', text)
text = re.sub(r'^([a-z])', lambda m: '%s' % (m.group(1).upper()), text, 1)
translationFileWrite.write(text)
translationFileWrite.close()
os.rename('write.txt','plover' + time.strftime('%m%d%y%H%M%S') + '.txt')