-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* First step in making warn-on-modify messages optional (#11) * Split core application into flextoolslib. (#27) * Restructure files for making a Python library * Use relative imports now. * Add build/configuration files * Update icons path * Change to import flextools library Also removed from __future__ imports. * Move batch files into FlexTools folder * Move version info to __init__.py * Derive paths according to new structure * requirements.txt is now used for building, not runtime * Moved main UI to UIMain.py FLExTools.py is still the entry point. It initialises everything and launches the UI. * Log exceptions from flexlibs when opening a project * Specify flexlibs 1.1.6 for FW 9.1.15/16 support * Add some Chinese support files I don't know why these weren't on github already. * Reconfigure script files for new flextoolslib library * Clean out tests * Add makezip.py to build the FlexTools app zip file * Specify Python 3.6-3.8 * Package "flextools" --> "flextoolslib" * Give FlexTools a separate version from flextoolslib * Update ListProjects.py * New setup for running and updating FlexTools * Use date naming for flextoolslib version number. * Move version # to RunFlexTools.py * Fix import order for MessageBox() * Put TestAModule core code into flextoolslib.misc * Add ListProjects.vbs * Also update flexlibs with InstallOrUpdate * Better handling of flextools.log * Update history.txt * Updated help files * Add more example modules to Examples collection * Build updates New versions of libraries: cdfutils 1.0.4 flexlibs 1.1.6 * Change to global config (FTConfig) Includes adding Modules and Collections paths to the ini file for easy site customisation. * Tidy FlexToolsCommands.vbs * Warning --> Info if module doesn't modify (#11) * Put version number in Version.py * Use new global FTConfig * First library version: 2023.1.31 * Exclude flextools.ini from zip file * Update history.txt * Upload flextoolslib with twine
- Loading branch information
Showing
94 changed files
with
2,536 additions
and
1,536 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,20 @@ | ||
[Reports.Text Statistics] | ||
[Reports.Project Information] | ||
_order = 1 | ||
|
||
[Reports.Lexicon Statistics] | ||
[Reports.Text Statistics] | ||
_order = 2 | ||
|
||
[Reports.Lexicon Statistics] | ||
_order = 3 | ||
|
||
[Utilities.Approve Spelling of Numbers] | ||
_order = 4 | ||
|
||
[Reports.Lexeme Usage in Corpus] | ||
_order = 5 | ||
|
||
[Examples.Example - Check Punctuation] | ||
_order = 6 | ||
|
||
[Export.Dump All Headwords To File] | ||
_order = 7 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
' Run the FlexTools application | ||
|
||
Set WshShell = CreateObject("WScript.Shell") | ||
|
||
WshShell.Run "scripts\FlexToolsCommands.vbs RUN", 0, True | ||
|
||
WshShell = Null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
' Run FlexTools with debug logging enabled | ||
|
||
Set WshShell = CreateObject("WScript.Shell") | ||
|
||
WshShell.Run "scripts\FlexToolsCommands.vbs DEBUG", 0, True | ||
|
||
WshShell = Null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
' Run the FlexTools installer (pip) for first install or to update | ||
' to a later version. | ||
|
||
Set WshShell = CreateObject("WScript.Shell") | ||
|
||
WshShell.Run "scripts\FlexToolsCommands.vbs INSTALL", 0, True | ||
|
||
WshShell = Null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
' Run the FlexTools application | ||
|
||
Set WshShell = CreateObject("WScript.Shell") | ||
|
||
WshShell.Run "scripts\FlexToolsCommands.vbs LIST", 0, True | ||
|
||
WshShell = Null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
How to build Chinese Tools packages | ||
----------------------------------- | ||
|
||
1. Create Full ZIP for archiving. | ||
1. Delete all .pyc and .log files from the Chinese tree | ||
2. Create ZIP file with Chinese.pth + Chinese\ | ||
3. Name it "ChineseTools-MASTER-<date>.zip" (date in YYYY-MM-DD format) | ||
|
||
|
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
# -*- coding: utf-8 -*- | ||
# | ||
# ChineseUtilities | ||
# | ||
# Craig Farrow | ||
# May 2011 | ||
# | ||
# | ||
# | ||
|
||
from __future__ import unicode_literals | ||
from __future__ import print_function | ||
from builtins import str | ||
|
||
import codecs | ||
import re | ||
|
||
import os, sys | ||
|
||
class SortStringDB(dict): | ||
FNAME = 'ch2sort.txt' | ||
def __init__(self): | ||
dict.__init__(self) | ||
self.loaded = False | ||
|
||
def __load(self): | ||
if self.loaded: return | ||
self.loaded = True # Set True even if fail to load file | ||
# This stack-frame code is all that I've found to work from | ||
# Idle, command-line AND Python.NET | ||
# (Use of __file__ failed for Idle) | ||
mypath = os.path.dirname(sys._getframe().f_code.co_filename) | ||
fname = os.path.join(mypath, self.FNAME) | ||
print(fname) | ||
try: | ||
f = codecs.open(fname, encoding="gb18030") | ||
except IOError: | ||
return | ||
|
||
for line in f.readlines(): | ||
line = line.strip("\n\r") | ||
parts = line.split("\t") | ||
if len(parts) == 2: | ||
self[parts[0]] = parts[1] | ||
else: | ||
ambiguities = {} | ||
hz = parts.pop(0) | ||
while (parts): | ||
py = parts.pop(0) | ||
sortKey = parts.pop(0) | ||
ambiguities[py] = sortKey | ||
self[hz] = ambiguities | ||
|
||
f.close() | ||
|
||
def Lookup(self, hz, py): | ||
self.__load() | ||
try: | ||
sortInfo = self[hz] | ||
except KeyError: | ||
return "[HZ not in DB: %s]" % repr(hz) | ||
if type(sortInfo) == str: | ||
if sortInfo.startswith(py): | ||
return "(" + sortInfo + ")" | ||
else: | ||
return "[PY mismatch]" | ||
else: | ||
try: | ||
match = sortInfo[py] | ||
return "(" + match + ")" | ||
except KeyError: | ||
return "[PY invalid]" | ||
|
||
Sorter = SortStringDB() | ||
|
||
def PinyinTonenumSplit(pinyin): | ||
pinyin = re.sub(" ", "", pinyin) | ||
return re.findall("[^1-5]*[1-5]", pinyin) | ||
|
||
def ChineseSortString(hz, py): | ||
global Sorter | ||
if not hz or not py: | ||
return "" | ||
hzList = [x for x in hz] | ||
pyList = PinyinTonenumSplit(py) | ||
if len(hzList) != len(pyList): | ||
return "[PY different length]" | ||
|
||
return ";".join([Sorter.Lookup(h,p) for h, p in zip(hzList, pyList)]) | ||
|
||
|
||
if __name__ == "__main__": | ||
if sys.stdout.encoding == None: | ||
sys.stdout = codecs.getwriter("utf-8")(sys.stdout) | ||
|
||
testSet = [ | ||
("路", "lu4"), | ||
("你好", "ni3hao3"), | ||
("中国", "zhong1 guo2"), | ||
("录音", "lu4yin1"), | ||
("录", ""), | ||
("孩子", "hai2zi5"), | ||
] | ||
|
||
for t in testSet: | ||
print(t[0], t[1], ChineseSortString(t[0], t[1])) | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.