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)

DiapDealer 09-28-2018 09:48 AM

I remember making a hard-coded compromise font-size to make sure it displayed "reasonably" across all platforms and OS versions. Fonts are a huge PITA in Tkinter--especially when cross-platform variables are thrown into the mix. But I'll see what I can do. At the very least, I should be able to create a user preference that users can tweak in the json preferences file.

I gotta say, though, that even with my tired, old blurry eyes, the font-size in that screenshot wouldn't give me any trouble. As such; I certainly wouldn't want to hard-code a new font-size any larger than that for everyone. So I'll have to ponder how best to tackle giving users a choice in the matter.

Thasaidon 09-28-2018 10:10 AM

Quote:

Originally Posted by DiapDealer (Post 3753270)
I gotta say, though, that even with my tired, old blurry eyes, the font-size in that screenshot wouldn't give me any trouble. As such; I certainly wouldn't want to hard-code a new font-size any larger than that for everyone. So I'll have to ponder how best to tackle giving users a choice in the matter.

My tired, old blurry eyes, started off below average. One of my eyes is long sighted and one short sighted. With age the smallest fonts I can read is getting larger and larger, which is why I bought my first ereader. I was having to use a magnifying glass to read most mass paperbacks. My distance vision is not much better. I have problems recognizing people's faces if they are more than 10metres (33ft prox) away.

If there is no easy way to make the change please forget the issue as I can use a magnifying glass on the screen. I always have one by the PC just in case.

I also carry a small folding magnifying with me when I go out again just in case

Thanks

DiapDealer 09-28-2018 10:33 AM

Quote:

Originally Posted by Thasaidon (Post 3753281)
If there is no easy way to make the change please forget the issue as I can use a magnifying glass on the screen. I always have one by the PC just in case.

I don't think it will be difficult to provide a "down-and-dirty" tweak via the preferences file. It would probably have be a manual edit to begin with. That also probably wouldn't hamper a more robust solution later on. I don't know how soon I can have something available, but I should be able to provide you relief without putting myself out too, too terribly. ;)

odamizu 09-29-2018 01:24 AM

I would love to be able to increase the font size as well. I'm not quite to the point of needing a magnifying glass, but there's a lot of squinting up to my computer monitor going on :D

:thanks: as always for all that you do!

Thasaidon 09-29-2018 02:46 AM

Quote:

Originally Posted by DiapDealer (Post 3753293)
I don't think it will be difficult to provide a "down-and-dirty" tweak via the preferences file. It would probably have be a manual edit to begin with. That also probably wouldn't hamper a more robust solution later on. I don't know how soon I can have something available, but I should be able to provide you relief without putting myself out too, too terribly. ;)

Thank you very much.:thanks:

Details of a "down-and-dirty" manual tweak of the preferences file, sound good to me.:thumbsup:

DiapDealer 09-29-2018 01:58 PM

1 Attachment(s)
Here's a test version for you guys to try out. Before attempting to tweak the fonts, you may want to try it out as is. I changed the defaults to a sans-serif font and changed the font-size to 10 point (I was using a pixel default before). Regardless, you'll need to install the plugin and run it/close it at least one time before the tweak-able preferences will be created in the preferences json file.

As far as tweaking goes, there's two settings available: "font_family" and "font_size". Both are under the "font_tweaks" section.

@Thasaidon: if you're unfamiliar with manually editing a plugin's preferences file, the easiest way to get to it is to open the "Manage Plugins" dialog and click the "Open Preferences Location" button in the bottom right-hand corner of the dialog box. From there you'll want to open the "plugins_prefs" folder and look for the folder with the plugin's name (in this case "TagMechanic") and open it. In that folder you should find a "TagMechanic.json" file. Open it in a text editor to make the following changes.

Look for the new font_tweaks section. The default (after first run) will be:
Code:

"font_tweaks": {
  "font_family": "Helvetica",
  "font_size": "10"
}

Tkinter guarantees that the following font names will always map to a working font-family:
Helvetica (sans-serif)
Times (serif)
Courier (Monspaced)

So while you're free to experiment with other system font names, I can't guarantee they'll work with Tkinter (or my code).

A positive font size value (yes, I know it's a quoted string in this file ... humor me!) specifies points and a negative value ("-12") specifies pixels.

Make your changes (carefully, so as not to change other settings) and they should take effect when you next run the plugin.

Let me know if it's working for you.

@odamizu: remember that installing this new version of the plugin will mean you'll have to redo your code-tweaks from the previous discussion here: https://www.mobileread.com/forums/sh...8&postcount=54

AlanHK 09-30-2018 02:01 AM

I'm sure it's been asked before, but can we have a file selection in the plugin, default all HTML files? It works in "Punctuation Smarten" and other plugins that let me choose files while the plugin is open so it's possible.

I usually want to do do two or three edits at a time, often a "delete naked spans" for all those I have neutered using S&R and then a transform.

It gets tedious doing a series of edits to tags:
1) select all files
2) open plugin
3) fill in edit details
4) close plugin
5) Select all files...

More then half the time is just opening and closing the plugin.

Even worse when I start the plugin and then realise I haven't selected the files and nothing happens; have to exit and redo everything.

DiapDealer 09-30-2018 07:49 AM

I'm not cluttering an already busy UI with another file selection dialog when a perfectly good interface to select files to be modified already exists in Sigil. The file selection duplication you mention in "Punctuation Smarten" exists because that plugin was written before Sigil's plugin framework was given the ability to know which files were selected in the Book Browser. Had I created that plugin after that ability was added, its file selection method would work exactly like this plugin's does.

I'm afraid it's also a hard no on having the plugin default to assuming all html files are to be affected. That would defeat the ability to select a subset of files entirely.

When stressing over how much time is lost having to close and relaunch the plugin, try to factor in how much time you would be losing if you had to make all of the desired changes without the assistance of the plugin. I think you'll find you're still way ahead on time saved.

Every plugin I create going forward will work in this manner (RE file selection).

Thasaidon 09-30-2018 08:24 AM

Quote:

Originally Posted by DiapDealer (Post 3753685)
Here's a test version for you guys to try out. Before attempting to tweak the fonts, you may want to try it out as is. I changed the defaults to a sans-serif font and changed the font-size to 10 point (I was using a pixel default before). Regardless, you'll need to install the plugin and run it/close it at least one time before the tweak-able preferences will be created in the preferences json file.

Hi Diapdealer

That suits my needs exactly.:yahoo::thanks::thanks:

The magnifying glass will get less use and I have a new shiny blue spanner Icon on my Icon toolbar.:D

Your instructions were most helpful. I have taken a copy of them so I can find them easily in the future if I need them.

I was a coder and systems analyst for over 20 years but due to choices made by management :smack: I always ended up in having to code in some form of basic. And unfortunately(?) I have always had so many interests I never got round to learning other programming languages. Plus I never had the need.

Thanks again:thanks::2thumbsup

DiapDealer 09-30-2018 09:22 AM

You're very welcome. :)

The plugin preferences will survive plugins being uninstalled and newer versions being installed. So unless you specifically delete the plugin's preference file, you shouldn't need to worry about redoing the tweak. If you install Sigil on a new machine (or under a different user account), the instructions will come in handy, though. I'll also document the tweaks on the first post of this thread whenever I "officially" update to this new version.

Thanks for reporting back.

BeckyEbook 09-30-2018 10:31 AM

1 Attachment(s)
Quote:

Originally Posted by DiapDealer (Post 3753877)
Every plugin I create going forward will work in this manner (RE file selection).

OK. This is good idea, but IMHO better solution is:
* if are (x)html files selected -- use bk.selected_iter()
* if not (for example selected is folder "Text") -- use bk.text_iter() (all files)

Because TagMechanic is a great plugin - the ability to run it for all files, but without the need to select them significantly speeds up the work.

Look at the attachment.

DiapDealer 09-30-2018 11:30 AM

Quote:

Originally Posted by BeckyEbook (Post 3753904)
OK. This is good idea, but IMHO better solution is:
* if are (x)html files selected -- use bk.selected_iter()
* if not (for example selected is folder "Text") -- use bk.text_iter() (all files)

Because TagMechanic is a great plugin - the ability to run it for all files, but without the need to select them significantly speeds up the work.

Sorry. I don't see the problem. Nor do I see your proposal as a "better" solution. The better solution is to commit how the plugin actually works (instead of how you wished it worked) to memory and move on. There's no way I'm going to assume that someone who forgot to select ANY xhtml files would want ALL xhtml files to be processed by default. That makes zero sense to me.

Quote:

Originally Posted by BeckyEbook (Post 3753904)
Look at the attachment.

No. The problem is not me not understanding how to code what you're asking for. The problem is me not thinking what you're asking for is good idea.

BeckyEbook 09-30-2018 11:58 AM

That's why I wrote "IMHO".

Some plugins written by Doitsu work in this way:
* AddIDs
* LanguageTool
* Proselint
* RegexTester
* TTS

By Francesco Martini:
* fileNamesAsTitles (and others)

I like this way and use it every day, also in private plugins.

DiapDealer 09-30-2018 12:25 PM

Your ability to make private plugins suggests that you'll have no problem altering mine to support your particular needs. Your mistake is in assuming that your particular needs for my plugin make the most sense for everybody.

My plugin works the way I want it to. I'll entertain improvement suggestions, and incorporate them when they make sense to me. But I've made my decision on this particular front, so there's really no sense in continuing to offer rationales for the change. The plugin works on the xhtml files selected in Sigil's Book Browser. Period. That info is #1 in the instructions for using the plugin. It's bold and it's underlined.

I appreciate that people find my plugin very useful, and I welcome suggestions for improvements. But this particular question has been asked and anwered. My mind is made up. So I'd appreciate it if we could drop it and move on.

odamizu 09-30-2018 03:49 PM

Quote:

Originally Posted by DiapDealer (Post 3753685)
Here's a test version for you guys to try out ... two settings available: "font_family" and "font_size". Both are under the "font_tweaks" section.

:thanks: :thanks: :thanks:

This is perfect!

My faulty, aging eyes :thanks:


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.