Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Library Management

Notices

Reply
 
Thread Tools Search this Thread
Old 07-10-2023, 09:33 AM   #16
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: 12,376
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by Comfy.n View Post
@chaley Hi! I just tested the new layout actions, running Calibre from source, as I found it cool to have another distinctive way to visually acknowledge library switching - besides a different library icon.

Upon running the chain, I get:

Code:
Traceback (most recent call last):
  File "calibre_plugins.action_chains.action", line 448, in run_chain
  File "calibre_plugins.action_chains.chains", line 389, in run
  File "calibre_plugins.action_chains.chains", line 209, in _run_loop
  File "calibre_plugins.action_chains.chains", line 348, in refresh_gui
  File "C:\users\user\calibre-master\src\calibre\db\legacy.py", line 284, in all_ids
AttributeError: 'LibraryDatabase' object has no attribute 'new_api'
There's also a validation message:

Code:
Menu entry: mylib2 (plugin_name: Choose Library) cannot be found
The chain I tested was set up this way: 1 - a Calibre Action to quick switch to a given library and 2 - Hide Cover Grid

It runs the desired actions, but the message is displayed.
As far as I can tell this is a problem in Action Chains. It seems to a) lose the library plugin action, and b) lose the database when a chain changes the library. I suggest that you report the problem there.

To test I built an action chain that turns off the search bar if the target library is "Library.test_small". Note the chain condition that tests the library name. I then set up an event to call that chain whenever the library is changed. This works fine. However, a chain that contains a single action to change the library works only once.

Here is my test action chain:
HideSearchBar.zip

Here is the event definition:
Click image for larger version

Name:	Clipboard01.jpg
Views:	355
Size:	57.5 KB
ID:	202575
chaley is offline   Reply With Quote
Old 07-10-2023, 11:44 AM   #17
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,605
Karma: 7511185
Join Date: Sep 2020
Device: none
Quote:
Originally Posted by chaley View Post
Here is the event definition:
Attachment 202575
Thank you, I will give this a try later. I had forgotten about the Library Changed Event, which seems a more suitable approach.

edit: in this case, I think I misinterpreted the event Library Changed as Library Switched. Anyway, I finally got the layout action to run upon switching to a specific library, but what I think will be useful is something that will need more testing: for library A, show this; for library B, hide that...

Last edited by Comfy.n; 07-10-2023 at 01:01 PM.
Comfy.n is offline   Reply With Quote
Advert
Old 07-10-2023, 04:18 PM   #18
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,605
Karma: 7511185
Join Date: Sep 2020
Device: none
This was a very cool addition, thanks so much @chaley and OP for the suggestion!

The new 'Hide all' option provides an instant expansion of screen real estate, making it easier to adjust/order columns in book list mode.

And it's awesome that anyone can run Calibre from source and take a peek at latest features.

Attached Thumbnails
Click image for larger version

Name:	MWSnap 2023-07-10, 16_58_09.png
Views:	226
Size:	8.9 KB
ID:	202581  
Comfy.n is offline   Reply With Quote
Old 07-10-2023, 05:33 PM   #19
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: 12,376
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by Comfy.n View Post
edit: in this case, I think I misinterpreted the event Library Changed as Library Switched. Anyway, I finally got the layout action to run upon switching to a specific library, but what I think will be useful is something that will need more testing: for library A, show this; for library B, hide that...
I had what I think is a similar problem. The Action Chains event "Library Changed" is triggered only when the library is actually changed. When you first start calibre the event "Calibre Initialized" is triggered. To get things to work on startup I had to call my chain when either event occurred.

If I was doing this "in anger" I would probably build an action chain per library, setting up the panels as I want for that library, with a chain condition that checks the library name. I would then build a chain using "Chain Caller" to call each of these library chains. Finally, I would call the chain caller chain in the Library Changed and the Calibre Initialized events.

NB: our hope is that there is enough of an API in this action to permit the View Manager to offer controlling which panels are visible using check boxes or what-have-you.
Quote:
Originally Posted by Comfy.n View Post
This was a very cool addition, thanks so much @chaley and OP for the suggestion!

The new 'Hide all' option provides an instant expansion of screen real estate, making it easier to adjust/order columns in book list mode.
You are welcome.

For amusement: my first implementation included a "Show all" action that turned out to be less than useful. In particular, showing the cover grid, the cover browser, and QuickView at the same time is best avoided.
chaley is offline   Reply With Quote
Old 07-10-2023, 05:50 PM   #20
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,605
Karma: 7511185
Join Date: Sep 2020
Device: none
Quote:
Originally Posted by chaley View Post
For amusement: my first implementation included a "Show all" action that turned out to be less than useful. In particular, showing the cover grid, the cover browser, and QuickView at the same time is best avoided.
I wondered that, lol. Then it hit me.
Comfy.n is offline   Reply With Quote
Advert
Old 07-11-2023, 03:20 PM   #21
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: 10,829
Karma: 74203799
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Quote:
Originally Posted by chaley View Post
I submitted changes to Kovid to add a calibre "action" that can show/hide any of the 6 panes. Assuming he accepts it, you can use the Action Chains plugin to set up the view how you want with a single shortcut to invoke the chain. You could also use Action Chains events to do it automatically when a given library is opened.
Have not checked yet, but is it explicit enable/disable options, or toggle options? Your description sounds like the former.
ownedbycats is offline   Reply With Quote
Old 07-11-2023, 03:26 PM   #22
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: 12,376
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by ownedbycats View Post
Have not checked yet, but is it explicit enable/disable options, or toggle options? Your description sounds like the former.
See post 18 where @Comfy.n posted an image of the menu items. They are enable/disable. There are no toggles.

The built-in buttons are toggles.
chaley is offline   Reply With Quote
Old 07-11-2023, 03:29 PM   #23
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: 10,829
Karma: 74203799
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
I managed to miss that.

EDIT: Oh, a second page.
ownedbycats is offline   Reply With Quote
Old 07-13-2023, 02:35 AM   #24
arpeggioaccele
light mode user
arpeggioaccele exercises by bench pressing the entire Harry Potter series in hardcoverarpeggioaccele exercises by bench pressing the entire Harry Potter series in hardcoverarpeggioaccele exercises by bench pressing the entire Harry Potter series in hardcoverarpeggioaccele exercises by bench pressing the entire Harry Potter series in hardcoverarpeggioaccele exercises by bench pressing the entire Harry Potter series in hardcoverarpeggioaccele exercises by bench pressing the entire Harry Potter series in hardcoverarpeggioaccele exercises by bench pressing the entire Harry Potter series in hardcoverarpeggioaccele exercises by bench pressing the entire Harry Potter series in hardcoverarpeggioaccele exercises by bench pressing the entire Harry Potter series in hardcoverarpeggioaccele exercises by bench pressing the entire Harry Potter series in hardcoverarpeggioaccele exercises by bench pressing the entire Harry Potter series in hardcover
 
Posts: 66
Karma: 16268
Join Date: May 2023
Location: New England
Device: I use the Calibre ebook-viewer on macos and Apple Books on ios.
Quote:
Originally Posted by chaley View Post
... you can use the Action Chains plugin to set up the view how you want with a single shortcut to invoke the chain. You could also use Action Chains events to do it automatically when a given library is opened.

In addition, the change includes an "API" that View Manager can use to show or hide panes, should someone want to add this functionality to it.
Wow that's great! Kovid suggested asking the View Manager plugin about it, but I'll just follow the steps you showed for now (when it is released). Hopefully the plugin will be able to use what you've done.

Thanks for all the effort solving and adding a qol feature— it will be a great improvement to using multiple libraries and layouts on calibre!

Last edited by arpeggioaccele; 07-13-2023 at 02:42 AM.
arpeggioaccele is offline   Reply With Quote
Old 07-14-2023, 02:25 PM   #25
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: 12,376
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
The new actions are in calibre release 6.23.
chaley is offline   Reply With Quote
Old 07-14-2023, 06:57 PM   #26
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 21,677
Karma: 29711016
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Suggestion: apply the 'Layout actions' icon to the Layout button in the status bar, at the moment the button uses the Preferences icon so it can't be done effectively with an override.

BR
BetterRed is offline   Reply With Quote
Old 07-16-2023, 07:06 AM   #27
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: 12,376
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by BetterRed View Post
Suggestion: apply the 'Layout actions' icon to the Layout button in the status bar, at the moment the button uses the Preferences icon so it can't be done effectively with an override.

BR
Done, in calibre source.
chaley is offline   Reply With Quote
Old 07-16-2023, 03:59 PM   #28
arpeggioaccele
light mode user
arpeggioaccele exercises by bench pressing the entire Harry Potter series in hardcoverarpeggioaccele exercises by bench pressing the entire Harry Potter series in hardcoverarpeggioaccele exercises by bench pressing the entire Harry Potter series in hardcoverarpeggioaccele exercises by bench pressing the entire Harry Potter series in hardcoverarpeggioaccele exercises by bench pressing the entire Harry Potter series in hardcoverarpeggioaccele exercises by bench pressing the entire Harry Potter series in hardcoverarpeggioaccele exercises by bench pressing the entire Harry Potter series in hardcoverarpeggioaccele exercises by bench pressing the entire Harry Potter series in hardcoverarpeggioaccele exercises by bench pressing the entire Harry Potter series in hardcoverarpeggioaccele exercises by bench pressing the entire Harry Potter series in hardcoverarpeggioaccele exercises by bench pressing the entire Harry Potter series in hardcover
 
Posts: 66
Karma: 16268
Join Date: May 2023
Location: New England
Device: I use the Calibre ebook-viewer on macos and Apple Books on ios.
I got the action chain working! It took me a while to figure out what went wrong; it was the little checkboxes that enable/disable the event trigger.

Using two chains to hide all layouts then enable the ones I wanted with the condition
template = program: current_library_name()
datatype = text
condition value = Library name
(why is book title and font choice displayed here, super confusing imo)

Then I just called both chains when the event triggered, which is terribly slow but it was my first try lol.
arpeggioaccele is offline   Reply With Quote
Old 07-16-2023, 04:55 PM   #29
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: 12,376
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by arpeggioaccele View Post
I got the action chain working! It took me a while to figure out what went wrong; it was the little checkboxes that enable/disable the event trigger.

Using two chains to hide all layouts then enable the ones I wanted with the condition
template = program: current_library_name()
datatype = text
condition value = Library name
(why is book title and font choice displayed here, super confusing imo)

Then I just called both chains when the event triggered, which is terribly slow but it was my first try lol.
Glad you have it working.

The font and title boxes are shown because it is using the general template tester, which has no idea what you are trying to do. It gives you the value of the template for the current book(s), if it can figure out what the current book is. It also gives you access to the template debugger, which you didn't mention. Your condition template might be simple or it might be a multi-line complex GPM or Python template. Calibre can't know in advance/read your mind.

As regards "terribly slow", the time will depend on the number of books in the library. Mine takes 0.5 seconds to switch libraries to my test library of 100 books, which for me isn't slow. For my test library of 50,000 books it taks 2.4 seconds, of which 2 seconds is calibre opening the library. Switching to a library with 1 book takes 0.1 seconds. Are these times similar to what you are seeing? It is taking longer than simply changing the library then pushing the layout buttons?

To help with the comparison, what I have is:
  • Three action chains, one per library, that hide all panels then show different things depending on the library. These chains don't have a condition.
  • One "Chain caller" action that "calls" the three above chains. Each chain call has a condition checking the library, so only one chain is actually called.
  • The event manager's "Library Changed" and "Calibre initialized" events each call the "Chain caller" action.
chaley is offline   Reply With Quote
Old 07-17-2023, 02:42 AM   #30
arpeggioaccele
light mode user
arpeggioaccele exercises by bench pressing the entire Harry Potter series in hardcoverarpeggioaccele exercises by bench pressing the entire Harry Potter series in hardcoverarpeggioaccele exercises by bench pressing the entire Harry Potter series in hardcoverarpeggioaccele exercises by bench pressing the entire Harry Potter series in hardcoverarpeggioaccele exercises by bench pressing the entire Harry Potter series in hardcoverarpeggioaccele exercises by bench pressing the entire Harry Potter series in hardcoverarpeggioaccele exercises by bench pressing the entire Harry Potter series in hardcoverarpeggioaccele exercises by bench pressing the entire Harry Potter series in hardcoverarpeggioaccele exercises by bench pressing the entire Harry Potter series in hardcoverarpeggioaccele exercises by bench pressing the entire Harry Potter series in hardcoverarpeggioaccele exercises by bench pressing the entire Harry Potter series in hardcover
 
Posts: 66
Karma: 16268
Join Date: May 2023
Location: New England
Device: I use the Calibre ebook-viewer on macos and Apple Books on ios.
Quote:
The font and title boxes are shown because it is using the general template tester...
I didn't mean to criticize the functionality— it is quite clear that the template tester is necessary, I have used the calibre template language once before to extract metadata from books.

I just meant that I personally tried a dozen times to get the book title to switch to show the value of the template I was trying to use instead lol. Once I understood that book details did not actually pertain to the template value I wanted I gave up trying to click and actually read the instructions (https://www.mobileread.com/forums/sh...&postcount=172)

I assumed that changing the font is generally done a single time even for a long program and just makes the UI cluttered— though I'm sure it has it's uses and it isn't at all confusing what it is for. I copy paste stuff if its long anyways.

Quote:
As regards "terribly slow"...
Sorry for the confusion, I just mean that I can see obvious improvement in the way I made the chains work. It is relatively slow, not absolutely.

I have around 15k books in my main calibre library, I was mostly exaggerating about the speed. You're right, changing the layout is hardly longer than loading the database.

I only mentioned it because I think I am unnecessarily loading covers when I do not need to. I assume that if I do not load the covers, it will eliminate the quite fast loading time. If I turn off covers before switching libraries, there would be no loading time, the button pushing in this order (using action chains) might actually be faster.

In short, it is my implementation that is the slow part, not the plugin at all! Since it was my first try, I did not get around to using the chain caller action you suggest but I will try it next for nth library I have.

Last edited by arpeggioaccele; 07-17-2023 at 02:53 AM.
arpeggioaccele is offline   Reply With Quote
Reply

Tags
layout, switch


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
New keyboard layouts for M92 docidocus Onyx Boox 4 07-22-2014 06:27 AM
QWidget Layouts Agama Development 1 08-16-2012 03:32 PM
903 Not all layouts available after installing FBReader Fractalus PocketBook 3 12-18-2011 12:40 PM
Advice for two column layouts? stickybuns Workshop 5 04-20-2011 07:12 AM
PRS-600 Additional keyboard layouts Shiimis Sony Reader Dev Corner 2 04-05-2010 01:47 PM


All times are GMT -4. The time now is 08:22 AM.


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