zim-wiki team mailing list archive
-
zim-wiki team
-
Mailing list archive
-
Message #04193
how to load another plugin's settings
I'm trying extend the Now Button
<https://github.com/Osndok/zim-plugin-nowbutton/blob/master/nowbutton.py>
plugin to use the same path the journal plugin uses by calling
path_from_date.
I haven't figured out how to respect/load the granularity setting from
preferences.conf. I am trying to explicitly set it using PluginManager or
ConfigManager. Neither with success
# get cal plug object a la tests/calendar.py
calplugklass = PluginManager.get_plugin_class('calendar')
calplug = calplugklass()
prefs=calplug.config.get_config_dict('<profile>/preferences.conf')
# ConfigManagerINIConfigFile w/ only with key as "CalendarPlugin", has
default plugin vals (e.g. path=:Journal)
# OR #
prefs=zim.config.ConfigManager().get_config_dict('<profile>/preferences.conf')
# ConfigManagerINIConfigFile has all sections of prefs.conf as keys,
but ConfigDict's are all empty
# want to set the cal props like
calplug.preferences = prefs['CalendarPlugin']
# so granularity respected by the calendar plugin is reflected here too
cur_date_page = calplug.path_from_date(...)
In the first pluginmanger attempt, the default values are seen not the
values in my preferences.conf
in the second attempt with configmanger, I see all the sections in my .conf
(included a bogus [FooBar] section) but all the dictionaries are empty.
I think I am missing something obvious. Any hints?
As an aside, what is the best way to debug zim plugins? Currently, I make a
change, sprinkling in raise Exception(prefs) and restart zim.
Thanks!
Will
Follow ups