Register Guidelines E-Books Today's Posts Search

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

Notices

Reply
 
Thread Tools Search this Thread
Old 04-22-2015, 12:26 AM   #1
naveen.chandran
Junior Member
naveen.chandran began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Apr 2015
Device: none
Question Add Custom User Configuration Popup to Viewer Plugin

Hello,

I have created a viewer plugin, and would like to know how to include settings in the toolbar on the left of the viewer (similar to preferences).

I would also like to know how I would be able to save and get preference values, as well as display them for editing to the user.

I saw on the documentation for plugins the
save_settings(config_widget)
and
config_widget()

methods, but I do not know how to implement them.

Could anyone provide me with more information on this?
naveen.chandran is offline   Reply With Quote
Old 04-22-2015, 04:48 AM   #2
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,851
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
You can add any buttons you like to the viewer toolbars, see the documentation of the ViewerPlugin.customize_ui method on how to do that.

Those buttons can trigger any action you like, including showing a dialog with config options. You will just need to use the standard PyQt QDialog class to create such a dialog.

As for how to store the configuration options, you can store them in any way that you like, just choose a unique name for the config file, so that it does not conflict with the rest of calibre's config files. Use the calibre JSONConfig class to manage the config file easily.
kovidgoyal is online now   Reply With Quote
Old 04-23-2015, 12:43 AM   #3
naveen.chandran
Junior Member
naveen.chandran began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Apr 2015
Device: none
Should I implement the ConfigWidgetBase or just implement isCustomizable(), save_settings(), and config_widget in my main plugin class?
naveen.chandran is offline   Reply With Quote
Old 04-23-2015, 02:07 AM   #4
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,851
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
You dont need to implement any of those. Those are all for plugins that dont want their own config UI and are intended t be configured via Preferences->Plugins
kovidgoyal is online now   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Viewer Plugin] Get selected text on right click. jverrone3 Development 1 03-27-2015 10:57 PM
CALIBRE User Interface Configuration Guba Calibre 4 04-13-2012 03:39 AM
viewer plugin? dhunter Plugins 1 03-08-2012 10:10 PM
Perfect Viewer PDF Plugin GJSmith Kobo Tablets 9 12-01-2011 02:03 PM
# user css for viewer.py/ ebook-viewer/ prs-650 tscamera Calibre 0 01-02-2011 06:28 PM


All times are GMT -4. The time now is 10:00 PM.


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