Register Guidelines E-Books Search Today's Posts Mark Forums Read

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

Notices

Reply
 
Thread Tools Search this Thread
Old 02-13-2024, 06:10 AM   #1
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,728
Karma: 6690881
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
New action to save & restore GUI pane layouts

I added the ability to save and restore the GUI pane layout, including Narrow/Wide, what panes show, the pane sizes, and where supported by base calibre the pane positions. The new operations are added to the existing "Layout actions".

Notes:
  • You can assign a keyboard shortcut to open the Layout actions menu.
  • With the Action chains plugin you can assign shortcuts to specific menu actions such as restoring a layout.
  • I included an API for plugin writers to use to save/restore/delete layouts (View manager?). The API methods are documented in calibre.gui2.actions.layout_actions.py.
    Spoiler:
    Code:
        # Public API
        def apply_layout(self, name):
            '''apply_layout()
            Apply a saved GUI panel layout.
    
            :param:`name` The name of the saved layout
    
             Throws KeyError if the name doesn't exist.
            '''
    
        def save_current_layout(self):
            '''save_current_layout()
            Opens a dialog asking for the name to use to save the current layout.
            Saves the current settings under the provided name.
            '''
    
        def current_settings(self):
            '''current_settings()
    
            :return: the current gui layout settings.
            '''
    
        def save_named_layout(self, name, settings):
            '''save_named_layout()
            Saves the settings under the provided name.
    
            :param:`name` The name for the settings.
            :param:`settings`: The gui layout settings to save.
            '''
    
        def delete_layout(self, name, show_warning=True):
            '''delete_layout()
            Delete a saved layout.
    
            :param:`name` The name of the layout to delete
            :param:`show_warning`: If True a warning dialog will be shown before deleting the layout.
            '''
    
        def saved_layout_names(self):
            '''saved_layout_names()
            Get a list of saved layout names
    
            :return: the sorted list of names. The list is empty if there are no names.
            '''

    This python template is a small example.
    Spoiler:
    Code:
    python:
    def evaluate(book, context):
    	from calibre.gui2.ui import get_gui
    	gui = get_gui()
    
    	api = gui.iactions['Layout Actions'] # Note the capitalization.
    	settings = api.current_settings()
    	print(settings)
    	names = api.saved_layout_names()
    	print(names)
    	api.apply_layout('Normal')
    	return ', '.join(names)
  • While there I added toggling panes to the existing abilities to show and hide panes. All the pane visibility actions are visible in Action chains.
  • The changes are in calibre source and will be included in the next calibre release.
Attached Thumbnails
Click image for larger version

Name:	Clipboard02.jpg
Views:	66
Size:	44.8 KB
ID:	206361   Click image for larger version

Name:	Clipboard03.jpg
Views:	68
Size:	69.2 KB
ID:	206362  

Last edited by chaley; 02-13-2024 at 06:14 AM.
chaley is offline   Reply With Quote
Old 02-13-2024, 06:35 AM   #2
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: 990
Karma: 6417070
Join Date: Sep 2020
Device: Calibre E-book viewer
looks awesome, thank you!
Attached Thumbnails
Click image for larger version

Name:	2024-02-13 08_33_17-Calibre Actions.png
Views:	52
Size:	45.1 KB
ID:	206366  
Comfy.n is offline   Reply With Quote
Advert
Old 02-13-2024, 03:57 PM   #3
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: 20,531
Karma: 26944418
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by chaley View Post
I added the ability to save and restore the GUI pane layout, including Narrow/Wide, what panes show, the pane sizes, and where supported by base calibre the pane positions. The new operations are added to the existing "Layout actions".


Suggestions:
  1. A setting in Preferences to nominate a Layout to be used at startup or library open - default would be none… i.e. reinstate what was there when calibre was closed. Analogue of the setting for startup/library-open VL.
  2. Probably a big ask: Could window sizes be added?
BR
BetterRed is offline   Reply With Quote
Old 02-13-2024, 04:40 PM   #4
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,728
Karma: 6690881
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by BetterRed View Post


Suggestions:
  • A setting in Preferences to nominate a Layout to be used at startup or library open - default would be none… i.e. reinstate what was there when calibre was closed. Analogue of the setting for startup/library-open VL.
That would be a big step down the slippery slope of incorporating the View Manager into base calibre. The request to save column display, order, and width would very reasonably be next. Neither I nor @kovid wanted to go there, so we agreed on an "action" implementation to provide a base level of functionality while making an API available for plugins. Of course, @kiwidude might also not want to incorporate this stuff into the VM. Up to him.
Quote:
  • Probably a big ask: Could window sizes be added?
They 'can', but I won't do it. I don't want to get stuck in the quagmire of dealing with window placement on monitors that may or may not be there, with window sizes that may or may not fit. The pane sizes are expressed as fractions of window size, so manually adjusting the window will automatically adjust the layout.
chaley is offline   Reply With Quote
Old 02-13-2024, 05:00 PM   #5
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: 20,531
Karma: 26944418
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by chaley View Post
That would be a big step down the slippery slope of incorporating the View Manager into base calibre. The request to save column display, order, and width would very reasonably be next. Neither I nor @kovid wanted to go there, so we agreed on an "action" implementation to provide a base level of functionality while making an API available for plugins. Of course, @kiwidude might also not want to incorporate this stuff into the VM. Up to him.
The VL to use at startup/library-open is in Preferences->Behaviour:

Click image for larger version

Name:	Screenshot 2024-02-14 085557.jpg
Views:	38
Size:	173.2 KB
ID:	206378

BR
BetterRed is offline   Reply With Quote
Advert
Old 02-13-2024, 05:03 PM   #6
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,728
Karma: 6690881
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by BetterRed View Post
The VL to use at startup/library-open is in Preferences->Behaviour:

Attachment 206378

BR
I considered removing that option when the VM appeared and matured but decided breaking things for "correctness" wasn't the best idea. As I said, I'm not going further down that road.
chaley is offline   Reply With Quote
Old 02-13-2024, 05:17 PM   #7
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: 990
Karma: 6417070
Join Date: Sep 2020
Device: Calibre E-book viewer
The other day I was thinking that many plugins like VM, Favourites Menu, Walk Search History, probably others, could be incorporated into Calibre. But then the plugin authors might, understandably, not like this. Or they might think "Phew, one less to maintain!"
Comfy.n is offline   Reply With Quote
Old 02-13-2024, 05:43 PM   #8
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,728
Karma: 6690881
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by Comfy.n View Post
The other day I was thinking that many plugins like VM, Favourites Menu, Walk Search History, probably others, could be incorporated into Calibre. But then the plugin authors might, understandably, not like this. Or they might think "Phew, one less to maintain!"
The problem is that once these things are in base calibre, @kovid or someone like me must maintain them. That would increase his already nearly crushing workload of keeping calibre "as is" running on multiple OS with dependencies having all of increased complexity, frequent changes, and being flat-out broken. The catalog and store stuff are good examples of what can happen if code is incorporated into base calibre then the developer goes away. Another example and more personal, he must keep in mind that my work could present the same problem not all that far in the future.

Of course popular plugins can have the same problem. I think it is easier for someone else to pick these up than to have someone hacking inside base calibre, breaking things for everyone. For sure, @kovid doesn't need to review plugin code as he must do with base calibre code.
chaley is offline   Reply With Quote
Old 02-13-2024, 06:33 PM   #9
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: 20,531
Karma: 26944418
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by chaley View Post
I considered removing that option when the VM appeared and matured but decided breaking things for "correctness" wasn't the best idea. As I said, I'm not going further down that road.
Of the dozen or so calibre users in the local library reading group I 'lead', at least half use the setting in Prefs->Behaviour to start calibre in their "Current" VL. They wouldn't have been impressed if they'd been forced to install VM just for that.

BTW: if the Sort by tool had Save/Load/Delete actions I would probably remove VM from my system. I don't make as much use of the variable column layout feature as I once did and I've never used its VL/Saved-search/Split-columns features.

BR
BetterRed is offline   Reply With Quote
Old 02-13-2024, 06:46 PM   #10
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,728
Karma: 6690881
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by BetterRed View Post
BTW: if the Sort by tool had Save/Load/Delete actions I would probably remove VM from my system. I don't make as much use of the variable column layout feature as I once did and I've never used its VL/Saved-search/Split-columns features.

BR

I am confused. The "Sort by" action does have Save/Load/Delete, although expressed differently. The menu option "Sort on multiple columns" offers you the ability to give a sort a name, save it, or delete other sorts.
Attached Thumbnails
Click image for larger version

Name:	Clipboard02.jpg
Views:	32
Size:	34.7 KB
ID:	206383   Click image for larger version

Name:	Clipboard01.jpg
Views:	26
Size:	63.5 KB
ID:	206384  
chaley is offline   Reply With Quote
Old 02-13-2024, 07:48 PM   #11
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: 20,531
Karma: 26944418
Join Date: Mar 2012
Location: Sydney Australia
Device: none
oops, I bet that's always been been there. I looked for something like you've just added for Layout actions - options in the action menu.

However, there's one feature in VM I wouldn't want to lose:

The Re-apply current view action, which puts columns back where they were after they are moved manually… which is something I do quite often.

Perhaps of something similar were incorporated into the Header context menu I could remove VM. It would restore the sequence of columns as specified in the Add your own columns list… widths?

BR
BetterRed is offline   Reply With Quote
Old 02-13-2024, 07:56 PM   #12
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,728
Karma: 6690881
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by BetterRed View Post
However, there's one feature in VM I wouldn't want to lose:

The Re-apply current view action, which puts columns back where they were after they are moved manually… which is something I do quite often.

Perhaps of something similar were incorporated into the Header context menu I could remove VM. It would restore the sequence of columns as specified in the Add your own columns list… widths?

BR
If it already exists and works in VM, why should we replace it? IMO your arguments strengthen the position that putting all of this together in one place is best, and given that the VM already has most of it then that is the best one place. After all, "Least is best".
chaley is offline   Reply With Quote
Old 02-14-2024, 05:54 PM   #13
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,085
Karma: 1948136
Join Date: Aug 2015
Device: Kindle
The API will be useful as an a complementary action in Action Chains. I will add it later when I have the time. The goal is to have multiple atomic actions that can modify aspects of the GUI and can be combined in a single chain, to be invoked either on demand or in response to events.

I currently have a custom multi-sort action that needs some polishing before I add it to the plugin, and I may add some other actions e.g. virtual libraries ... etc.
capink is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[GUI Plugin] Action Chains capink Plugins 1315 04-11-2024 07:40 AM
[GUI Plugin] Save Virtual Libraries To Column (GUI) chaley Plugins 14 04-04-2021 05:25 AM
Restore right pane on main window John F Calibre 2 02-24-2021 03:45 AM
ade extra stylesheets & page layouts cybmole Sigil 12 06-27-2012 07:04 PM
Foreign Language Support & Keyboard Layouts 10tklz enTourage Archive 2 04-19-2010 11:13 AM


All times are GMT -4. The time now is 11:19 PM.


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