Register Guidelines E-Books Today's Posts Search

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

Notices

Reply
 
Thread Tools Search this Thread
Old 02-01-2024, 09:00 AM   #1261
capink
Wizard
capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.
 
Posts: 1,106
Karma: 1954138
Join Date: Aug 2015
Device: Kindle
Quote:
Originally Posted by chaley View Post
@capink: this might have nothing to do with the problem, but this exception can happen if a search reduces the number of books that would be shown in the book list. The "index" is the row number of the book list. The exception is thrown if that row number no longer exists. For example, imagine 30 books being displayed, with book 20 selected. A search reduces the number displayed to 15, moving the selected book to row 10. Even though the current book is still there, the fact that there isn't a book 20 causes the exception to be thrown. If it wasn't thrown then you would most likely have the wrong book.

Also note that if the GUI hasn't been told about a db.search() then it will think that it has current data, which is likely wrong.
Thanks for the help. I think I figured out the problem. I made the wrong assumption that if no row is selected the result of gui.library_view.currentIndex() will evaluate to None and proceeded with:

Code:
if gui.library_view.currentIndex():
   ....
Turns out it returns a QModelIndex() that can be test by either:

Code:
if gui.library_view.currentIndex().row() >= 0:
   ....
or

Code:
if gui.library_view.currentIndex().row() != QModelIndex():
   ....
The selection modifier does not use db.search(). It performs the search directly in calibre GUI:

Code:
gui.search.set_search_string(search_string)
gui.search.do_search()
Hope this version fixes the problem.

Last edited by capink; 02-01-2024 at 03:54 PM. Reason: remove attatchment
capink is offline   Reply With Quote
Old 02-01-2024, 09:17 AM   #1262
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 11,765
Karma: 7029857
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by capink View Post
Thanks for the help. I think I figured out the problem. I made the wrong assumption that if no row is selected the result of gui.library_view.currentIndex() will evaluate to None and proceeded with:

Code:
if gui.library_view.currentIndex():
   ....
[...]
Use
Code:
dex = gui.library_view.currentIndex()
if dex.isValid():
    row = dex.row()
    ....
This is easy to test using this python template:
Code:
python:
def evaluate(book, context):
	from calibre.gui2.ui import get_gui
	gui = get_gui()
	dex = gui.library_view.currentIndex()
	print(dex, dex.isValid()) 
	return f'row = {dex.row()}' if dex.isValid() else 'Not valid'
To test it, select a book, open the template tester, then paste the template. It will give you a row number. Then search for authors:false (there aren't any books with no authr), which will give an empty list view. Type something in the template tester to make the template run and you will get "Not valid">
chaley is offline   Reply With Quote
Advert
Old 02-01-2024, 09:21 AM   #1263
capink
Wizard
capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.
 
Posts: 1,106
Karma: 1954138
Join Date: Aug 2015
Device: Kindle
Thanks
capink is offline   Reply With Quote
Old 02-01-2024, 09:41 AM   #1264
nqk
Fanatic
nqk does all things with Zen-like beautynqk does all things with Zen-like beautynqk does all things with Zen-like beautynqk does all things with Zen-like beautynqk does all things with Zen-like beautynqk does all things with Zen-like beautynqk does all things with Zen-like beautynqk does all things with Zen-like beautynqk does all things with Zen-like beautynqk does all things with Zen-like beautynqk does all things with Zen-like beauty
 
Posts: 516
Karma: 32106
Join Date: Feb 2012
Device: Onyx Boox Leaf
Quote:
Originally Posted by capink View Post
Thanks


The error has gone.

However, I think the action chain still executes (on which book I don't know) because the indicator shows, but very quickly. It's ok anyway.

nqk is offline   Reply With Quote
Old 02-08-2024, 12:51 AM   #1265
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 8,755
Karma: 62032371
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Is it possible to give a submenu an icon other than the first chain?
ownedbycats is online now   Reply With Quote
Advert
Old 02-08-2024, 06:01 AM   #1266
capink
Wizard
capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.
 
Posts: 1,106
Karma: 1954138
Join Date: Aug 2015
Device: Kindle
Quote:
Originally Posted by ownedbycats View Post
Is it possible to give a submenu an icon other than the first chain?
No. It is either the first chain icon or no icon at all. You can control this by setting the a plugin tweak to either

Code:
action_chains_default_sub_menu_icon = 'first_action'
or

Code:
action_chains_default_sub_menu_icon = False
capink is offline   Reply With Quote
Old 02-13-2024, 08:29 AM   #1267
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 8,755
Karma: 62032371
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Aside from manually checking all my chains, is there a way to tell if a chain is being used in a caller action prior to rename?
ownedbycats is online now   Reply With Quote
Old 02-13-2024, 02:40 PM   #1268
capink
Wizard
capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.
 
Posts: 1,106
Karma: 1954138
Join Date: Aug 2015
Device: Kindle
Quote:
Originally Posted by ownedbycats View Post
Aside from manually checking all my chains, is there a way to tell if a chain is being used in a caller action prior to rename?
Attached below is a chain (Run Python Code Action) that gives you two options:
  • Print the names of all chains that calls a particular chain (selected from a dropdown menu).
  • Rename a chosen chain while also ensuring the new name is reflected in every Chain Caller Action.

Warning: The second option is untested and it might destroy your config. Make sure to make a copy of your "Action Chains.json" file before proceeding. Do this every time you run it.
Attached Files
File Type: zip multiple_actions.zip (1.7 KB, 46 views)
capink is offline   Reply With Quote
Old 02-13-2024, 04:43 PM   #1269
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 11,765
Karma: 7029857
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by ownedbycats View Post
Aside from manually checking all my chains, is there a way to tell if a chain is being used in a caller action prior to rename?
Quote:
Originally Posted by capink View Post
Warning: The second option is untested and it might destroy your config. Make sure to make a copy of your "Action Chains.json" file before proceeding. Do this every time you run it.
Can't you answer the question while avoiding the risk by editing Action Chains.json with a text editor and searching for the names of interest?
chaley is offline   Reply With Quote
Old 02-13-2024, 04:53 PM   #1270
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 8,755
Karma: 62032371
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
I didn't think of checking the json directly. That should work and be less risky. Thanks both.
ownedbycats is online now   Reply With Quote
Old 02-13-2024, 04:58 PM   #1271
capink
Wizard
capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.
 
Posts: 1,106
Karma: 1954138
Join Date: Aug 2015
Device: Kindle
Quote:
Originally Posted by chaley View Post
Can't you answer the question while avoiding the risk by editing Action Chains.json with a text editor and searching for the names of interest?
Yes, that would be much simpler. Sometimes you miss simple things in front of you, especially at night after a long day at work.
capink is offline   Reply With Quote
Old 02-13-2024, 05:00 PM   #1272
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 11,765
Karma: 7029857
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by capink View Post
Yes, that would be much simpler. Sometimes you miss simple things in front of you, especially at night after a long day at work.
I've done that more times than I can count.
chaley is offline   Reply With Quote
Old 02-27-2024, 03:49 PM   #1273
WordMan
Junior Member
WordMan began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Mar 2013
Device: iPad
Duplicate Plugin by Grant Drake

Some when I lost the Duplicate Plugin icon on the main menu. It appears to install OK but now I have no way of running it. Any ideas? Have uninstalled and reinstalled with no success.
WordMan is offline   Reply With Quote
Old 02-27-2024, 06:45 PM   #1274
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,904
Karma: 55267620
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 WordMan View Post
Some when I lost the Duplicate Plugin icon on the main menu. It appears to install OK but now I have no way of running it. Any ideas? Have uninstalled and reinstalled with no success.
Preferences:toolbars:Main toolbar (or any other) Remember there are 2 versions of the toolbar DEVICE Not connected / connected
If the PI is installed correctly: there will be an icon on the left. Use the arrow to move it to the right
theducks is offline   Reply With Quote
Old 03-01-2024, 09:25 PM   #1275
Comfy.n
want to learn what I want
Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.
 
Posts: 1,039
Karma: 6422750
Join Date: Sep 2020
Device: Calibre E-book viewer
Quote:
Originally Posted by capink View Post
Yes, there has been a change in Calibre6/Qt6 that conflicts the plugin's way of managing icons. I haven't got around to dealing with. But I will sometime in the future.
Hi capink! Is there some update to this issue? I still can't see any custom icons on the menus nor on the chains dialog.

Last edited by Comfy.n; 03-02-2024 at 03:21 AM. Reason: grammar. grr...
Comfy.n is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Action Chains Resources capink Plugins 62 05-17-2024 12:54 AM
[Editor Plugin] Editor Chains capink Plugins 90 04-29-2024 12:21 PM
[GUI Plugin] Noosfere_util, a companion plugin to noosfere DB lrpirlet Plugins 2 08-18-2022 03:15 PM
[GUI Plugin] Save Virtual Libraries To Column (GUI) chaley Plugins 14 04-04-2021 05:25 AM


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


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