MobileRead Forums

MobileRead Forums (https://www.mobileread.com/forums/index.php)
-   Plugins (https://www.mobileread.com/forums/forumdisplay.php?f=268)
-   -   [Plugin] TagMechanic (https://www.mobileread.com/forums/showthread.php?t=270639)

theducks 12-02-2016 04:39 PM

Quote:

Originally Posted by DiapDealer (Post 3436859)
The plugin framework has no interface to Sigil's report data. That would take changes to the plugin framework--and to Sigil itself to accomplish. Not entirely out of the question, but not very likely--at least not for a single plugin. There'd have to be a need for multiple plugins (and an interest from other plugin devs) to justify that kind of expansion of the framework.

Absolutely a valid reason. :thumbsup: had no clue..what was or was not available to the developer

DiapDealer 12-03-2016 09:39 AM

Quote:

Originally Posted by Crick (Post 3436688)
1 - Can you add p in the tag name list

Version 0.4.2 has added the p tag to the list of tags it can work with.

https://www.mobileread.com/forums/sho...77&postcount=1

Crick 12-03-2016 05:13 PM

thanks

DiapDealer 12-03-2016 05:55 PM

Quote:

Originally Posted by Crick (Post 3437494)
thanks

No problem. Let me know if I missed something and it doesn't work right. It's been a while since I've been "under the hood" of that plugin. :)

odamizu 01-16-2017 02:06 AM

Hi there,

I'm getting an error when I try to run Tag Mechanic. I'm still new to Sigil, so I suspect I'm doing something stupid. I start by opening a book in Sigil, selecting a file, then go to Plugins > Edit > TagMechanic.

Then this happens:

Code:

Status: failed

Traceback (most recent call last):
  File "/Applications/Sigil.app/Contents/plugin_launchers/python/launcher.py", line 135, in launch
    self.exitcode = target_script.run(container)
  File "/Users/X/Library/Application Support/sigil-ebook/sigil/plugins/TagMechanic/plugin.py", line 565, in run
    img = tkinter.Image('photo', file=os.path.join(bk._w.plugin_dir, bk._w.plugin_name, 'images/icon.png'))
  File "/Applications/Sigil.app/Contents/Frameworks/Python.framework/Versions/3.5/lib/python3.5/tkinter/__init__.py", line 3350, in __init__
    self.tk.call(('image', 'create', imgtype, name,) + options)
_tkinter.TclError: couldn't recognize data in image file "/Users/X/Library/Application Support/sigil-ebook/sigil/plugins/TagMechanic/images/icon.png"
Error: couldn't recognize data in image file "/Users/X/Library/Application Support/sigil-ebook/sigil/plugins/TagMechanic/images/icon.png"

I am on a Mac OS 10.11.6 using Sigil 0.9.7. I deleted the preferences file, but that didn't help.

Thanks for any suggestions!

Also, is TagMechanic the Sigil equivalent of Diaps Editing Toolbag in Calibre?

slowsmile 01-16-2017 06:13 AM

@odamizu...The error reports that it can't recognize the data in the image file. This probably means that your downloaded version of Tag Mechanic has a corrupt image file. I've also just downloaded Tag Mechanic and re-installed it again on my system and it works without problems.

Just try downloading and re-installing Tag Mechanic again to see if this cures your problem.

Doitsu 01-16-2017 06:44 AM

@odamizu: Did you install the special macOS ActiveState Tcl 8.6.4.1 package mentioned on the download page? This package is required for all Sigil plugins that come with a GUI.

DiapDealer 01-16-2017 09:25 AM

Doitsu is correct. The Tcl that comes with OS X is broken. That's why KevinH recommends installing Activestate's Tcl before running/installing Sigil plugins (at least he ones that have tkinter gui components).

And yes, this plugin is the equivalent of the "Span/Div Editor" portion of my "Diaps EditorToolbag" plugin for calibre's editor. There's a separate PunctuationSmarten plugin that provides the rest of the functionality from the "Toolbag".

odamizu 01-16-2017 02:19 PM

Thanks. I do have ActiveState Tcl 8.6.4.1 installed. For good measure, I re-installed it. Unfortunately, that didn't help. I still get the error message.

I also re-downloaded a fresh copy of the plug-in, uninstalled and re-installed it a few times. That didn't help either.

Any thing else I can try?

Doitsu 01-16-2017 03:08 PM

Quote:

Originally Posted by odamizu (Post 3459191)
Any thing else I can try?

This appears to be a strange macOS bug. Hopefully, KevinH, who has a Mac, will see this post and know what to do.

In the meantime, you can try the following:

1. Download TextWrangler or another programmer's text editor.
2. Start Sigil and select Edit >Preferences > Open Preferences Location.
3. Click Plugins > TagMechanic and open plugin.py with TextWrangler.
4. Comment out lines 565 and 566 by inserting a # sign:

Code:

    #img = tkinter.Image('photo', file=os.path.join(bk._w.plugin_dir, bk._w.plugin_name, 'images/icon.png'))
    #root.tk.call('wm','iconphoto',root._w,img)

and save plugin.py.

This workaround should allow you to run TagMechanic until KevinH has figured out what additional image library is required to run the commented-out code.

DiapDealer 01-16-2017 03:29 PM

Kevin's tested this plugin for me on OS X, I know. But it's been a while. I don't believe that icon is even visible on a Mac, so I could easily exclude it for that platform if it's found to be causing issues.

@odamizu: in fact ... here's a version that does just that (in case you don't want to manually edit the plugin yourself). See if it makes a difference. If so, I'll commit the change and release a new version. I'm not in love with the icon or anything. ;)

EDIT: test attachment removed since the first post was updated to that version

odamizu 01-16-2017 03:43 PM

Quote:

Originally Posted by Doitsu (Post 3459208)
This appears to be a strange macOS bug. ... Comment out lines 565 and 566 by inserting a # sign ...

This workaround should allow you to run TagMechanic until KevinH has figured what additional image library is required to run the commented-out code.

Excellent! That worked! Thank you!

Quote:

Originally Posted by DiapDealer (Post 3459218)
Kevin's tested this plugin for me on OS X, I know. But it's been a while. I don't believe that icon is even visible on a Mac, so I could easily exclude it for that platform if it's found to be causing issues.

What's weird is, I'm pretty sure I ran this plug-in successfully a few months ago. Not sure what's changed. If there's anything else I can do or info I can provide to help troubleshoot, let me know.

In the meantime, thanks everyone for your help!

odamizu 01-16-2017 03:48 PM

Quote:

Originally Posted by DiapDealer (Post 3459218)
@odamizu: in fact ... here's a version that does just that (in case you don't want to manually edit the plugin yourself). See if it makes a difference. If so, I'll commit the change and release a new version. I'm not in love with the icon or anything. ;)

Thanks! Just installed 0.4.3 and it works, too!

(You're too fast for me. I was trying Doitsu's manual edit, and when I came back to the forum, you had 0.4.3 up)

DiapDealer 01-16-2017 03:52 PM

I'll wait to hear if Kevin has any ideas before updating the first post with the new version. Thanks for making sure it works! :)

KevinH 01-16-2017 04:19 PM

Hi DiapDealer,
Just saw this. I will see if I can reproduce it on my Mac and get back to you.

KevinH


All times are GMT -4. The time now is 07:08 PM.

Powered by: vBulletin
Copyright ©2000 - 3.8.5, Jelsoft Enterprises Ltd.
MobileRead.com is a privately owned, operated and funded community.