03-23-2022, 09:19 AM | #61 | |
Sigil Developer
Posts: 7,727
Karma: 5444398
Join Date: Nov 2009
Device: many
|
Quote:
That said, ... You can do this now with Automate Lists, it will let you store current selections and restore them before the next plugin is run so chains of plugins can be run on the same initial selection but spine order can no longer be assured given a plugin can change that with any addition or deletion. So it is truly safe when the plugin being run does neither. Last edited by KevinH; 03-23-2022 at 11:03 AM. |
|
03-23-2022, 10:37 AM | #62 |
Evangelist
Posts: 483
Karma: 2267928
Join Date: Nov 2015
Device: none
|
|
Advert | |
|
03-23-2022, 11:06 AM | #63 | |
Sigil Developer
Posts: 7,727
Karma: 5444398
Join Date: Nov 2009
Device: many
|
Quote:
Yes this can be made to number ids on elements that can then be grabbed and inserted into text by regular expressions if needed. So counting can be done now as well. |
|
03-23-2022, 11:35 AM | #64 |
Sigil Developer
Posts: 7,727
Karma: 5444398
Join Date: Nov 2009
Device: many
|
I think there may be a way to do this using Sigil's embedded python bridge code, passing in a hit number, a string list of the capture strings. If we make the replacement call its own class, then storage between calls would also be doable.
My real questions are more due to the gui elements and how to shoehorn them into Sigil: 1. how to indicate and select a function name in the already over crowded Find and Replace dialog? Perhaps a separate dialog similar to Saved-Searches dialog may be the only way? 2. where to capture the print output and how best to display any print output from the replacement function? Again perhaps in a separate Saved-Search-like dialog with its own Find and Replace buttons? 3. how to allow debugging of the python replacement code? 4. how to handle python errors during a replace all? In fact, much of this python infrastructure already exists in the plugin runner. Maybe ... we implement this functionality all in its own plugin, "FunctionReplacer", that just implements python replacement inside a python based search regex search and replace. That would prevent current Find and Replace from getting any more bloated while allowing users who need it access to this feature via the FunctionReplacer plugin. Since plugins are already python based and python has both regex and re modules and can easily access all css, all html files and if needed the set of selected resources, adding this feature request using a plugin makes the most sense. Imagine a plugin gui that asks for your Find, target, direction, and provides a pull-down of existing replacement functions by module name stored in that plugin preferences folder. And given Plugins use a copy on write approach, then all changes can be previewed first and aborted if needed with no harm done. Thoughts? Last edited by KevinH; 03-23-2022 at 12:58 PM. |
03-23-2022, 11:51 AM | #65 |
Sigil Developer
Posts: 7,727
Karma: 5444398
Join Date: Nov 2009
Device: many
|
In fact, I think Sigil has probably reached a tipping point when it comes to new features, and that any other major features, especially more esoteric ones that most users may never need, probably should be implemented via plugins that those interested is using can add. Especially given the PyQt5/PySide6/tk gui abilities that plugins already have.
Again people's thoughts welcomed. Last edited by KevinH; 03-23-2022 at 01:00 PM. |
Advert | |
|
03-23-2022, 12:11 PM | #66 |
Sigil Developer
Posts: 7,727
Karma: 5444398
Join Date: Nov 2009
Device: many
|
I agree with DiapDealer here. Filtering BookBrowser would be a disaster from a user perspective. Hiding the existence of files is just not a good idea.
That said, instead of filtering, perhaps a BookBrowser pop-up menu to "Select by Regex" that pops up a dialog that the user can type a single regex and then hit ok and BookBrowser selects just the bookpaths that match that regex. Nothing hidden. And no real damage done if it selects too much or too little. That might be doable. |
03-23-2022, 12:31 PM | #67 |
Grand Sorcerer
Posts: 5,604
Karma: 23165369
Join Date: Dec 2010
Device: Kindle PW2
|
|
03-23-2022, 05:49 PM | #68 | |
Evangelist
Posts: 425
Karma: 77256
Join Date: Sep 2011
Device: none
|
Quote:
https://stackoverflow.com/questions/...-or-class-name I think there is some API to filter Qtreeview. But up to you. Select by regex would be an ok alternative. While EPUBs may not typically have as many files as some code projects, occasionally they can have many files. Anything would be very welcome. |
|
03-23-2022, 06:57 PM | #69 |
Grand Sorcerer
Posts: 27,595
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
You misunderstand. It's not that we lack the requisite knowledge of Qt to be able to do what you want. It's that we're not going to do it. You will have a much easier time of it here if you stop dwelling on what "other editors/IDEs" can do. Sigil isn't looking to mimic other full-featured editors. Heck... we're not even trying to get people to abandon their favorite editors for Sigil. That's why the "Open With" feature exists: use the editor that works best for your workflow and return to Sigil when you're done.
So you need to understand that the "other editors can..." mantra is not one that really motivates us at all. We have no desire to recreate what full-featured--but ultimately project-agnostic--code-editing IDEs already do well. Last edited by DiapDealer; 03-24-2022 at 07:48 AM. |
03-23-2022, 08:34 PM | #70 |
Addict
Posts: 311
Karma: 3196258
Join Date: Oct 2015
Location: Madison, WI
Device: Kindle 5th Gen
|
It’s definitely becoming difficult to think of core features Sigil lacks, even the last few runs of improvements have been pretty advanced (and very appreciated).
|
03-24-2022, 09:54 AM | #71 |
A Hairy Wizard
Posts: 3,119
Karma: 18727091
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
|
Any way you can add functionality for me to enter all my preferences, style techniques, html tag techniques, etc. and then have Sigil just fix all the books for me the way I would have done it manually? Perhaps save all of those preferences as a profile...so that I can switch all my preferences with a dropdown. Oh yeah! and perhaps have that profile preferences be exportable in a csv file.
Of course, along with that, we'd need a watch folder so I can just drag an ePub into it and it's auto-magically fixed. |
03-24-2022, 12:35 PM | #72 | |
Sigil Developer
Posts: 7,727
Karma: 5444398
Join Date: Nov 2009
Device: many
|
So you want us to make you redundant!
Quote:
|
|
03-24-2022, 01:39 PM | #73 |
Bibliophagist
Posts: 36,506
Karma: 145748888
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
|
03-24-2022, 03:01 PM | #74 |
Sigil Developer
Posts: 7,727
Karma: 5444398
Join Date: Nov 2009
Device: many
|
Another possible approach for function replacement
I have been thinking about how to implement python function replacement without having to jam even more into the F&R dialog and *not* use a plugin.
Since in replacements \F has no special meaning as a capture group, we could start any python replacement function name with that. So to use function replacement from a replace function in a module named 'mymod.py' **without any gui changes** the replace field in the F&R dialog could be set by the user to: Code:
\F<mymod> Then the current ReplaceBuilder code would detect that and invoke the replace() function in mymod.py which would be stored in the Sigil Preferences folder in a replacement_ functions folder. Then all a user would have to do is fill that folder with whatever python modules with replace functions they want. Yes this is more than a bit esoteric and cryptic but so are python replacement functions and regex and this would only be used by very advanced users. If we went this approach, we could easily add this capability to Sigil itself (no plugin needed) and it would not bloat or otherwise interfere with the current F&R for 99.9% of the users. Any printing output from a replacement function would need to be written to a log file by the user, and no function edit and remove interface would be added. The user him/herself would be responsible for creating, editing, storing, and removing their own python code. It would also work "as is" with Saved Searches. Thoughts? Last edited by KevinH; 03-24-2022 at 03:16 PM. |
03-24-2022, 03:56 PM | #75 |
Grand Sorcerer
Posts: 27,595
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
How would the "found" C PCRE2 match object be made available to any Python replace functions? Would it be through the embedded Python interface somehow? Or Are you talking providing only pure match strings (perhaps an ordered dictionary of multiple captured strings) and a match count?
Last edited by DiapDealer; 03-24-2022 at 04:02 PM. |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Possible To-Do List for Future Sigil Releases Post Sigil 1.8 | KevinH | Sigil | 143 | 02-05-2022 12:08 PM |
Icon Redesign for future 1.0 Release of Sigil | shorshe | Sigil | 38 | 06-06-2016 11:29 PM |
Sigil on Nook vs Sigil on Kobo vs Sigil on iBook | rosshalde | Sigil | 12 | 11-13-2014 09:34 AM |
Sigil’s Future Direction (Post 0.4.x) | user_none | Sigil | 90 | 10-11-2011 03:28 PM |
Sigil's Future | crutledge | Sigil | 36 | 07-26-2011 06:02 PM |