Skip to content

Commit

Permalink
Pre-0.5.0 changes
Browse files Browse the repository at this point in the history
  • Loading branch information
dougmassay committed Oct 12, 2020
1 parent 2a7273e commit 0532930
Show file tree
Hide file tree
Showing 9 changed files with 160 additions and 92 deletions.
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ http://www.mobileread.com/forums/showthread.php?t=251452.
The core plugin files (this is where most contributors will spend their time) are:

> dialogs.py
> images/icon.png
> plugin.png
> plugin.svg
> parsing_engine.py
> plugin.py
> plugin.xml
> tk_tooltips.py
> updatecheck.py
> utilities.py


Files used for building/maintaining the plugin:
Expand All @@ -54,6 +54,10 @@ Files used for building/maintaining the plugin:

Feel free to fork the repository and submit pull requests (or just use it privately to experiment).

Files used for translations:
> translations/template.ts

To any potential volunteer translators: There's nothing terribly complicated. Just a bunch of strings strings that probably won't be changing much (if at all) in the future. Contact me if you're interested in translating the plugin. The gist is this: fork the repo; copy the template.ts file (in the translations folder) to tagmechanic_(pl|es|fr).ts (or whatever your language's code is) and use Qt's Linguist to translate the strings. Then submit a pull request and I'll compile the language files for use in the plugin.


License Information
Expand Down
3 changes: 2 additions & 1 deletion buildplugin
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ PLUGIN_FILES = ['dialogs.py',
'plugin.py',
'plugin.xml',
'utilities.py',
'plugin.png']
'plugin.svg',
'plugin.png',]

def findVersion():
_version_pattern = re.compile(r'<version>([^<]*)</version>')
Expand Down
2 changes: 1 addition & 1 deletion dialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

def launch_gui(bk, prefs):
app = QApplication([])
icon = os.path.join(bk._w.plugin_dir, bk._w.plugin_name, 'plugin.png')
icon = os.path.join(bk._w.plugin_dir, bk._w.plugin_name, 'plugin.svg')
app.setWindowIcon(QIcon(icon))

if tuple_version(qVersion()) >= (5, 10, 0):
Expand Down
13 changes: 13 additions & 0 deletions maintenance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
**Maintenance**

Translation updates: after changing the source-code an before releasing a new version, make sure to update each of the .ts files in the translation folder.

From the root of the repository run:

`pylupdate5 -verbose -translate-function _t *.py -ts ./translations/template.ts`

Do that for each of the .ts files.

If no translataion strings were added or changed, that's it. Only the line numbers were adjusted and the buildplugin script will compile them and add them to the plugin.

If translation strings WERE added or changed, then volunteers will need to check/update their language's ts file before releasing the plugin.
17 changes: 16 additions & 1 deletion plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
from __future__ import unicode_literals, division, absolute_import, print_function

import sys
import os

from dialogs import launch_gui
from utilities import setupPrefs
from utilities import setupPrefs, check_for_custom_icon, get_icon_color, change_icon_color


prefs = {}
Expand All @@ -29,9 +30,23 @@ def run(bk):
return -1

global prefs

prefs = bk.getPrefs()
prefs = setupPrefs(prefs)

prefs_folder = os.path.join(os.path.dirname(bk._w.plugin_dir), "plugins_prefs", bk._w.plugin_name)
if not check_for_custom_icon(prefs_folder):
svg = os.path.join(bk._w.plugin_dir, bk._w.plugin_name, "plugin.svg")
if os.path.exists(svg) and os.path.isfile(svg):
original_color = get_icon_color(svg)
new_color = prefs['miscellaneous_settings']['icon_color']
if original_color is not None and original_color != new_color:
try:
change_icon_color(svg, original_color, new_color)
prefs['miscellaneous_settings']['icon_color'] = new_color
except Exception:
print('Couldn\'t change icon color!')

bailOut = launch_gui(bk, prefs)

# Save prefs to back to json
Expand Down
1 change: 1 addition & 0 deletions plugin.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
87 changes: 43 additions & 44 deletions translations/tagmechanic_en.ts
Original file line number Diff line number Diff line change
@@ -1,218 +1,217 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="en">
<!DOCTYPE TS><TS version="2.0" language="en" sourcelanguage="">
<context>
<name>ConfigDialog</name>
<message>
<location filename="../dialogs.py" line="123"/>
<location filename="../dialogs.py" line="129"/>
<source>Customize Tag Mechanic</source>
<translation>Customize Tag Mechanic</translation>
</message>
<message>
<location filename="../dialogs.py" line="154"/>
<location filename="../dialogs.py" line="160"/>
<source>Comma separated list of html elements (no quotes, no angle &quot;&amp;lt;&quot; brackets).</source>
<translation>Comma separated list of html elements (no quotes, no angle &quot;&amp;lt;&quot; brackets).</translation>
</message>
<message>
<location filename="../dialogs.py" line="162"/>
<location filename="../dialogs.py" line="168"/>
<source>Choices to change</source>
<translation>Choices to change</translation>
</message>
<message>
<location filename="../dialogs.py" line="162"/>
<location filename="../dialogs.py" line="168"/>
<source>elements to:</source>
<translation>elements to:</translation>
</message>
<message>
<location filename="../dialogs.py" line="180"/>
<location filename="../dialogs.py" line="186"/>
<source>HTML attributes available to search for:</source>
<translation>HTML attributes available to search for:</translation>
</message>
<message>
<location filename="../dialogs.py" line="184"/>
<location filename="../dialogs.py" line="190"/>
<source>Comma separated list of html attribute names (no quotes).</source>
<translation>Comma separated list of html attribute names (no quotes).</translation>
</message>
<message>
<location filename="../dialogs.py" line="193"/>
<location filename="../dialogs.py" line="199"/>
<source>Reset all defaults</source>
<translation>Reset all defaults</translation>
</message>
<message>
<location filename="../dialogs.py" line="194"/>
<location filename="../dialogs.py" line="200"/>
<source>Reset all settings to original defaults.</source>
<translation>Reset all settings to original defaults.</translation>
</message>
<message>
<location filename="../dialogs.py" line="217"/>
<location filename="../dialogs.py" line="223"/>
<source>Are you sure?</source>
<translation>Are you sure?</translation>
</message>
<message>
<location filename="../dialogs.py" line="218"/>
<location filename="../dialogs.py" line="224"/>
<source>Reset all customizable options to their original defaults?</source>
<translation>Reset all customizable options to their original defaults?</translation>
</message>
</context>
<context>
<name>guiMain</name>
<message>
<location filename="../dialogs.py" line="245"/>
<location filename="../dialogs.py" line="251"/>
<source>Delete</source>
<translation>Delete</translation>
</message>
<message>
<location filename="../dialogs.py" line="246"/>
<location filename="../dialogs.py" line="252"/>
<source>Modify</source>
<translation>Modify</translation>
</message>
<message>
<location filename="../dialogs.py" line="247"/>
<location filename="../dialogs.py" line="253"/>
<source>No attributes (naked tag)</source>
<translation>No attributes (naked tag)</translation>
</message>
<message>
<location filename="../dialogs.py" line="248"/>
<location filename="../dialogs.py" line="254"/>
<source>No change</source>
<translation>No change</translation>
</message>
<message>
<location filename="../dialogs.py" line="249"/>
<location filename="../dialogs.py" line="255"/>
<source>Tag Mechanic</source>
<translation>Tag Mechanic</translation>
</message>
<message>
<location filename="../dialogs.py" line="266"/>
<location filename="../dialogs.py" line="272"/>
<source>Action type:</source>
<translation>Action type:</translation>
</message>
<message>
<location filename="../dialogs.py" line="276"/>
<location filename="../dialogs.py" line="282"/>
<source>Tag name:</source>
<translation>Tag name:</translation>
</message>
<message>
<location filename="../dialogs.py" line="286"/>
<location filename="../dialogs.py" line="292"/>
<source>Having the attribute:</source>
<translation>Having the attribute:</translation>
</message>
<message>
<location filename="../dialogs.py" line="297"/>
<location filename="../dialogs.py" line="303"/>
<source>Whose value is (no quotes):</source>
<translation>Whose value is (no quotes):</translation>
</message>
<message>
<location filename="../dialogs.py" line="301"/>
<location filename="../dialogs.py" line="307"/>
<source>Regex</source>
<translation>Regex</translation>
</message>
<message>
<location filename="../dialogs.py" line="306"/>
<location filename="../dialogs.py" line="312"/>
<source>Change tag to:</source>
<translation>Change tag to:</translation>
</message>
<message>
<location filename="../dialogs.py" line="319"/>
<location filename="../dialogs.py" line="325"/>
<source>New attribute string to insert (entire):</source>
<translation>New attribute string to insert (entire):</translation>
</message>
<message>
<location filename="../dialogs.py" line="323"/>
<location filename="../dialogs.py" line="329"/>
<source>Copy existing attribute string</source>
<translation>Copy existing attribute string</translation>
</message>
<message>
<location filename="../dialogs.py" line="338"/>
<location filename="../dialogs.py" line="344"/>
<source>Process</source>
<translation>Process</translation>
</message>
<message>
<location filename="../dialogs.py" line="339"/>
<location filename="../dialogs.py" line="345"/>
<source>Process selected files with current criteria</source>
<translation>Process selected files with current criteria</translation>
</message>
<message>
<location filename="../dialogs.py" line="343"/>
<location filename="../dialogs.py" line="349"/>
<source>Abort Changes</source>
<translation>Abort Changes</translation>
</message>
<message>
<location filename="../dialogs.py" line="344"/>
<location filename="../dialogs.py" line="350"/>
<source>Make no changes and exit</source>
<translation>Make no changes and exit</translation>
</message>
<message>
<location filename="../dialogs.py" line="349"/>
<location filename="../dialogs.py" line="355"/>
<source>Quit</source>
<translation>Quit</translation>
</message>
<message>
<location filename="../dialogs.py" line="350"/>
<location filename="../dialogs.py" line="356"/>
<source>Quit with no changes</source>
<translation>Quit with no changes</translation>
</message>
<message>
<location filename="../dialogs.py" line="429"/>
<location filename="../dialogs.py" line="435"/>
<source>Error</source>
<translation>Error</translation>
</message>
<message>
<location filename="../dialogs.py" line="416"/>
<location filename="../dialogs.py" line="422"/>
<source>Must enter a value for the attribute selected</source>
<translation>Must enter a value for the attribute selected</translation>
</message>
<message>
<location filename="../dialogs.py" line="430"/>
<location filename="../dialogs.py" line="436"/>
<source>What--exactly--would that achieve?</source>
<translation>What--exactly--would that achieve?</translation>
</message>
<message>
<location filename="../dialogs.py" line="447"/>
<location filename="../dialogs.py" line="453"/>
<source>Starting</source>
<translation>Starting</translation>
</message>
<message>
<location filename="../dialogs.py" line="467"/>
<location filename="../dialogs.py" line="473"/>
<source>Error parsing</source>
<translation>Error parsing</translation>
</message>
<message>
<location filename="../dialogs.py" line="467"/>
<location filename="../dialogs.py" line="473"/>
<source>File skipped</source>
<translation>File skipped</translation>
</message>
<message>
<location filename="../dialogs.py" line="476"/>
<location filename="../dialogs.py" line="482"/>
<source>Occurrences found/changed in</source>
<translation>Occurrences found/changed in</translation>
</message>
<message>
<location filename="../dialogs.py" line="479"/>
<location filename="../dialogs.py" line="485"/>
<source>Criteria not found in</source>
<translation>Criteria not found in</translation>
</message>
<message>
<location filename="../dialogs.py" line="484"/>
<location filename="../dialogs.py" line="490"/>
<source>Commit and Exit</source>
<translation>Commit and Exit</translation>
</message>
<message>
<location filename="../dialogs.py" line="485"/>
<location filename="../dialogs.py" line="491"/>
<source>Commit all changes and exit</source>
<translation>Commit all changes and exit</translation>
</message>
<message>
<location filename="../dialogs.py" line="487"/>
<location filename="../dialogs.py" line="493"/>
<source>Total occurrences found/changed</source>
<translation>Total occurrences found/changed</translation>
</message>
<message>
<location filename="../dialogs.py" line="490"/>
<location filename="../dialogs.py" line="496"/>
<source>No changes made to book</source>
<translation>No changes made to book</translation>
</message>
<message>
<location filename="../dialogs.py" line="492"/>
<location filename="../dialogs.py" line="498"/>
<source>Finished</source>
<translation>Finished</translation>
</message>
Expand Down
Loading

0 comments on commit 0532930

Please sign in to comment.