Releases: ilius/pyglossary
Releases · ilius/pyglossary
3.0.4
Changes since 3.0.3
- Changes in
Glossarycode base - Fix critical bug in Glossary:
ZeroDivisionErrorifwordCount < 500, #61 - Bug fix in Glossary.progress: make sure ui.progress is not called with a number more than 1.0
- Fix non-working write to SQL, #67
- Bug fix & Feature: add newline argument to
Glossary.writeTxt
Because Python'sopenconverts (modifies) newlines automatically, #66 - Break compatibility about using
Glossary.writeTxtmethod
Replace argumentsepwhich was a tuple of length two, with two mandatory arguments:sep1andsep2 - Changes in plugins
- Fix in StarDict plugin: fix some Python3-related errors, #71
- Fix in Dict.org plugin:
installwas not working - Fix in DSL plugin: replace backslash at the end of line with
<br/>, #61 - Fix in SQL plugin: specify
encoding='utf-8'while opening file for write, #67 - Fix in Octopus Mdict Source plugin: specify
encoding='utf-8'while opening file for read, #78 - Fix (probable) bugs of bad newlines in 4 plugins (use
newlineargument toGlossary.writeTxt), #66
- Octopus MDict Source
- Babylon Source (gls)
- Lingoes Source (LDF)
- Sdictionary Source (sdct) - Feature in Lingoes Source plugin: add
newlinewrite option - Minor fix in AppleDict plugin: fix beautifulsoup4 error message, #72
- BGL plugin: better compatibilty with Python 3.4
FixCRC check failederror for some (rare) glossaries with Python 3.4 - Other Changes
- Bug fix in parsing command line read options
--read-optionsand--write-options(happened in very rare cases) - Fix wrong shebang line in setup.py: must run with python3, fix #75
- Update
pyglossary.spec - Change Categories for
pyglossary.desktop
3.0.3
Changes since 3.0.2
- Fixes in AppleDict plugin
- Improve Tkinter interface: fix Not Responding bug, make window icon colorful
- Fix visual bug in command line Progress Bar (percentage did not become 100.0%)
- BGL reader: add support for Python < 3.5, with a warning to install Python 3.5
- Fixes in Reverse feature
- Update README.md
3.0.2
3.0.1
3.0.0
New versioning
- Using date as the version was a mistake I made 7 years ago
- From now on, versions are in X.Y.Z format (major.minor.patch)
- While X, Y and Z are digits(0-9) for simplicity (version strings can be compared alphabetically)
- Starting from 3.0.0
- Take it for migrating to Python 3.x, or Gtk 3.x, or being alphabetically larger than previous versions (date string)
Since I believe this is the first standard version, I'm not sure which code revision should I compare it with. So I just write the most important recent changes, in both application-view and library-view.
Breaking Compatibility
- Config migration
- Config file becomes a config directory containing config file
- Config file format changes from Python (loaded by
exec) to JSON - Remove some obsolete / unused config parameters, and rename some
- Remove permanent
sortboolean flag- Must give
--sortin command line to enable sorting for most of output formats
- Must give
- Load user-defined plugins from a directory named
pluginsinside config directory
- Glossary class
- Remove some obsolete / unused method
copy,attach,merge,deepMerge,takeWords,getInputList,getOutputList
- Rename some methods:
reverseDic->reverse
- Make some public attributes private:
data->_datainfo->_infofilename->_filename
- Clear (reset) the Glossary instance (data, info, etc) after
writeoperation- Glossary class is for converting from file(s) to file, not keeping data in memory
- New methods:
convert:convertmethod is added to be used instead ofreadand thenwrite- Not just for convenience, but it's also recommended,
- and let's Glossary class to have a better default behavior
- for example it enables direct mode by default (stay tuned) if sorting is not enabled (by user or plugin)
- all UI modules (Command line, Gtk3, Tkinter) use Glossary.convert method now
- Sorting policy
sortboolean flag is now an argument towritemethod- sort=True if user gives
--sortin command line - sort=False if user gives
--no-sortin command line - sort=None if user does not give either, so
writemethod itself decides what to do
- sort=True if user gives
- Now we allow plugins to specify sorting policy based on output format
- By
sortOnWritevariable in plugin, with allowed values:ALWAYS: force sorting even if sort=False (user gives--no-sort), used only for writing StarDictDEFAULT_YES: enable sorting unless sort=False (user gives--no-sort)DEFAULT_NO: disable sorting unless sort=True (user gives--sort)NEVER: disable sorting even if sort=True (user gives--sort)
- The default and common value is:
sortOnWrite = DEFAULT_NO - Plugin can also have a global
sortKeyfunction to be used for sorting - (like the
keyargument tolist.sortmethod, Seepydoc list.sort)
- By
- New way of interacting with Glossary instance in plugins:
glos.data.append((word, defi))->glos.addEntry(word, defi)for item in glos.data:->for entry in glos:for key, value in glos.info.items():->for key, value in glos.iterInfo():
- Remove some obsolete / unused method
Gtk2 to Gtk3
- Replace obsolete PyGTK-based interface with a simpler PyGI-based (Gtk3) interface
Migrating to Python 3
- Even though
masterbranch was based on Python 3 since 2016 Apr 29, there was some problem that are fixed in this release - If you are still forced need to use Python 2.7, you can use branch
python2.7
Introducing Direct mode
--directcommand line option- reads and writes at the same time, without loading the whole data into memory
- Partial sorting is supported
--sortin command line--sort-cache-size=1000is optional
- If plugin defines sortOnWrite=ALWAYS, it means output format requires full sorting, so direct mode will be disabled
- As mentioned above (using
Glossary.convertmethod), direct mode is enabled by default if sorting is not enabled (by user or plugin) - Of course user can manually disable direct mode by giving
--indirectoption in command line
Progress Bar
Automatic command line Progress Bar for all input / output formats is now supported
- Implemented based on plugins Reader classes
- Works both for direct mode and indirect mode
- Only one progress bar for direct mode
- Two progress bars for indirect mode (one while reading, one while writing)
- Plugins must not update the progress bar anymore
- Still no progress bar when both
--directand--sortflags are given, will be fixed later - User can disable progress bar by giving
--no-progress-baroption (recommended for Windows users)
BGL Plugin
- BGL plugin works better now (comparing to latest Python 2.7 code), and it's much cleaner too
- I totally refactored the code, made it fully Python3-compatible, and much more easier to understand
- This fixes bytes/str bugs (like Bug #54), and CRC check problem for some glossaries (Bug #55)
- I'm a fan of micro-commits and I usually hate single-commit refactoring, but this time I had no choice!
Other Changes
Feature: Add encoding option to read and write drivers of some plain-text formats
Feature: SQL and SQLite: read/write extra information from/to a new table dbinfo_extra, backward compatible
New format invented and implemented for later implementation of a Glossary Editor
edlin.py(Editable Linked List of Entries) is optimized for adding/modifying/removing one entry at a time- while we can save the changes instantly after each modification
- Using the ideas of Doubly Linked List, and Git's hash-based object database
Rewrite non-working Reverse functionality
- The old code was messy, not working by default, slow, and language-dependent
- It's much faster and cleaner now
Improve and complete command line help (-h or --help)