Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Editor

Notices

Reply
 
Thread Tools Search this Thread
Old 07-25-2014, 11:18 PM   #61
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 29,818
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by kovidgoyal View Post
The plugin toolbar will be visible only if you have any installed plugins.

When you install a plugin it becomes available in a "Plugins" menu and if it is the first time it is installed (as opposed to being updated), it is also added to the plugins toolbar.

And note that after installing the plugin you have to restart the editor, if it was already open.
Kovid
I installed the PI the normal 'from file' way with the editor closed.
The steps I listed was what happened with both 203 and 1.46 (Windows)

Confirming
Before Plugin: No Plugins on the Menu

The problem is with getting the Icon on the User PI tool bar to show (the first time). I added a separator at the top of the User PI Menu list, to make it clear which toolbar the Icon was on. Once it shows, it stays.
theducks is offline   Reply With Quote
Old 07-25-2014, 11:23 PM   #62
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,907
Karma: 47303748
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
Quote:
Originally Posted by kovidgoyal View Post
The plugin toolbar will be visible only if you have any installed plugins.

When you install a plugin it becomes available in a "Plugins" menu and if it is the first time it is installed (as opposed to being updated), it is also added to the plugins toolbar.

And note that after installing the plugin you have to restart the editor, if it was already open.
It took me a few moments to find the tool and the correct toolbar when I first added it. What I couldn't work out was how to put it on one of the more specific toolbars. I was thinking of putting this only on the CSS editor toolbar to run the sort on the open file. Is there a way to do this?
davidfor is offline   Reply With Quote
Advert
Old 07-25-2014, 11:30 PM   #63
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,871
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
No plugins are book wide only. If you wish to run it only only the currently opened file, you can do so by simply restricting the files your plugin processes. Get the name of the file like this

from calibre.gui2.tweak_book import editor_name

name = editor_name(self.gui.current_editor)


And I suggest adding a submenu to the plugins menu entry that allows the user to toggle what mnode the plugin operates in.
kovidgoyal is offline   Reply With Quote
Old 07-26-2014, 12:12 AM   #64
icallaci
Guru
icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.
 
Posts: 769
Karma: 6528026
Join Date: Sep 2012
Device: Kobo Elipsa
Quote:
Originally Posted by theducks View Post
Sorts All CSS in book? (actually, i would prefer the current only, but User PI may be limited)
I also would prefer it to sort just the current stylesheet, but I'm not complaining, since it does what I need at the moment. I never expected such a quick response.
icallaci is offline   Reply With Quote
Old 07-26-2014, 12:14 AM   #65
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,907
Karma: 47303748
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
Quote:
Originally Posted by theducks View Post
Might not be working the way you thought (1.46 x64) if I understand the rules. Sorts All CSS in book? (actually, i would prefer the current only, but User PI may be limited)

2@ CSS: page_styles, styleesheet
I ran the PI, it showed changes made to Pages (not obvious, only @pages)
the other: stylesheet (the one that could use a sort, did not change. old styl calibre ASCII sorted styles)

Did I use incorrectly?
No, I don't think so. As I said, the plugin is dumb. It simple finds all the stylesheet files and sort them. And because of the way it does this, it does a beautify of the CSS at the same time. What that means is if a beautify has already been run a file and the rules are already sorted, there won't be a change. And for a file with only one rule in it, it will be changed as if a beautify was run.

I'll probably add some extra function. I was thinking of prompting with a list of stylesheets to sort, but I like the idea of restricting it to the current file as Kovid suggests. Plus handling the specificity and rules without a specifier.
davidfor is offline   Reply With Quote
Advert
Old 07-26-2014, 12:57 AM   #66
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 29,818
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
David
I was reading in the Modify EPUB PI topic and something

Duplicate Selectors and changing their ORDER when sorting could have significant effects on the document.

Maybe ?

1) Display a pre-sort warning if dups are found and:
a) allow a Bailout
b) just refuse to proceed.

2) Use a 'bubble sort' so the order does not change. I know, Bubble Sorts are slow.
theducks is offline   Reply With Quote
Old 07-26-2014, 05:31 AM   #67
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,907
Karma: 47303748
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
Quote:
Originally Posted by kovidgoyal View Post
No plugins are book wide only. If you wish to run it only only the currently opened file, you can do so by simply restricting the files your plugin processes. Get the name of the file like this

from calibre.gui2.tweak_book import editor_name

name = editor_name(self.gui.current_editor)
Thanks. Should the second line be:

Code:
name = editor_name(self.gui.central.current_editor)
Or did I miss something?
davidfor is offline   Reply With Quote
Old 07-26-2014, 05:52 AM   #68
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,907
Karma: 47303748
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
Quote:
Originally Posted by theducks View Post
David
I was reading in the Modify EPUB PI topic and something

Duplicate Selectors and changing their ORDER when sorting could have significant effects on the document.
I didn't think of that at all when I started. It was only after rereading one of the posts that I thought
Quote:
Maybe ?

1) Display a pre-sort warning if dups are found and:
a) allow a Bailout
b) just refuse to proceed.

2) Use a 'bubble sort' so the order does not change. I know, Bubble Sorts are slow.
I haven't thought about sort algorithms for a VERY long time. I'll have a think of these options.

In the meantime, I have added the single file sort that has been suggested. The toolbar button now has a menu option "Sort current file". When that is checked, pressing the button will sort the currently opened file if it is a stylesheet. If it is not checked, it will sort all of them as it does now.
Attached Files
File Type: zip SortCSS.zip (21.1 KB, 234 views)
davidfor is offline   Reply With Quote
Old 07-26-2014, 05:53 AM   #69
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,871
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Yeah, it should.
kovidgoyal is offline   Reply With Quote
Old 07-26-2014, 06:43 AM   #70
mrmikel
Color me gone
mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.
 
Posts: 2,089
Karma: 1445295
Join Date: Apr 2008
Location: Central Oregon Coast
Device: PRS-300
Will editor plug-ins be in a sticky in this forum, or with the other plug-ins?
mrmikel is offline   Reply With Quote
Old 07-26-2014, 07:05 AM   #71
ShellShock
Wizard
ShellShock ought to be getting tired of karma fortunes by now.ShellShock ought to be getting tired of karma fortunes by now.ShellShock ought to be getting tired of karma fortunes by now.ShellShock ought to be getting tired of karma fortunes by now.ShellShock ought to be getting tired of karma fortunes by now.ShellShock ought to be getting tired of karma fortunes by now.ShellShock ought to be getting tired of karma fortunes by now.ShellShock ought to be getting tired of karma fortunes by now.ShellShock ought to be getting tired of karma fortunes by now.ShellShock ought to be getting tired of karma fortunes by now.ShellShock ought to be getting tired of karma fortunes by now.
 
ShellShock's Avatar
 
Posts: 1,176
Karma: 2431850
Join Date: Sep 2008
Device: IPad Mini 2 Retina
Yes I think a sticky would be good, because I have only just found my way back here after several days--I was starting to think I had imagined reading about editor plug-ins!
ShellShock is offline   Reply With Quote
Old 07-26-2014, 07:15 AM   #72
DoctorOhh
US Navy, Retired
DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.
 
DoctorOhh's Avatar
 
Posts: 9,864
Karma: 13806776
Join Date: Feb 2009
Location: North Carolina
Device: Icarus Illumina XL HD, Nexus 7
Quote:
Originally Posted by ShellShock View Post
Yes I think a sticky would be good, because I have only just found my way back here after several days--I was starting to think I had imagined reading about editor plug-ins!
There is already a Sticky for plug-ins: Index of plugins which is used for all calibre plug-ins. Any plug-in released by a developer will be listed here.
DoctorOhh is offline   Reply With Quote
Old 07-26-2014, 08:03 AM   #73
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 27,553
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Quote:
Originally Posted by kovidgoyal View Post
FYI tomorrows calibre release has support for editor plugins.

http://manual.calibre-ebook.com/crea...t-book-plugins
Sweet mother of monkey milk; thank you for this!
DiapDealer is offline   Reply With Quote
Old 07-26-2014, 10:26 AM   #74
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 29,818
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by davidfor View Post
I didn't think of that at all when I started. It was only after rereading one of the posts that I thought


I haven't thought about sort algorithms for a VERY long time. I'll have a think of these options.

In the meantime, I have added the single file sort that has been suggested. The toolbar button now has a menu option "Sort current file". When that is checked, pressing the button will sort the currently opened file if it is a stylesheet. If it is not checked, it will sort all of them as it does now.
Is this from the latest SortCSS PI (on 1.203)?

Spoiler:
calibre, version 1.203.1
ERROR: Unhandled exception: <b>UnboundLocalError</b>:local variable 'ac' referenced before assignment

calibre 1.203.1 isfrozen: True is64bit: False
Windows-XP-5.1.2600-SP3 Windows ('32bit', 'WindowsPE')
('Windows', 'XP', '5.1.2600')
Python 2.7.8
Windows: ('XP', '5.1.2600', 'SP3', 'Multiprocessor Free')
Successfully initialized third party plugins: EpubMerge && Generate Cover && Count Pages && Search The Internet && Open With && Quality Check && Import List && Manage Series && Find Duplicates && Fantastic Fiction && Sort CSS && Fantastic Fiction Adults && EpubSplit && Resize Cover && Modify ePub
Traceback (most recent call last):
File "site-packages\calibre\gui2\tweak_book\preferences.py", line 452, in bar_changed
File "site-packages\calibre\gui2\tweak_book\preferences.py", line 447, in build_lists
UnboundLocalError: local variable 'ac' referenced before assignment
theducks is offline   Reply With Quote
Old 07-26-2014, 08:51 PM   #75
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,907
Karma: 47303748
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
Quote:
Originally Posted by theducks View Post
Is this from the latest SortCSS PI (on 1.203)?

Spoiler:
calibre, version 1.203.1
ERROR: Unhandled exception: <b>UnboundLocalError</b>:local variable 'ac' referenced before assignment

calibre 1.203.1 isfrozen: True is64bit: False
Windows-XP-5.1.2600-SP3 Windows ('32bit', 'WindowsPE')
('Windows', 'XP', '5.1.2600')
Python 2.7.8
Windows: ('XP', '5.1.2600', 'SP3', 'Multiprocessor Free')
Successfully initialized third party plugins: EpubMerge && Generate Cover && Count Pages && Search The Internet && Open With && Quality Check && Import List && Manage Series && Find Duplicates && Fantastic Fiction && Sort CSS && Fantastic Fiction Adults && EpubSplit && Resize Cover && Modify ePub
Traceback (most recent call last):
File "site-packages\calibre\gui2\tweak_book\preferences.py", line 452, in bar_changed
File "site-packages\calibre\gui2\tweak_book\preferences.py", line 447, in build_lists
UnboundLocalError: local variable 'ac' referenced before assignment
It looks like it. I changed one of the names in the plugin. It looks like that name was used as part of the key in the preferences for what is on the toolbar. And calibre didn't like not being able to match the key to a plugin. Or at least I think that is what is happening.

To fix it, I think you need to edit the file "tweak_book_gui.json" that is in you calibre preferences directory. Look for the "global_plugins_toolbar" and remove that section and save the file.
davidfor is offline   Reply With Quote
Reply


Forum Jump


All times are GMT -4. The time now is 04:09 AM.


MobileRead.com is a privately owned, operated and funded community.