← Back to team overview

zim-wiki team mailing list archive

Re: Disabling/Enabling plugins per Notebook

 

On Fri, Mar 9, 2012 at 2:40 PM, Mariano Draghi <mdraghi@xxxxxxxxx> wrote:
> BTW, I'm using the notebook.zim file as the "profile", so apart from
> the Notebook section, it might contain the General, GtkInterface and
> PageView (plus any *Plugin) sections. Do you agree with this, or would
> you prefer a separate file for the profile? (like a "preferences.conf"
> in the notebook folder). I went for the notebook.zim route just to
> avoid adding another file, but I can change it if you like. If I keep
> the notebook.zim file, I just have to add the "Notebook" section to
> the preferences ConfigDictFile too before changing the file, so it
> doesn't get lost when saving it.

I would suggest a separate file in ~/.config/zim. E.g.
~/config/zim/profiles/myprofile.conf . That way a profile can be
shared by multiple notebooks. This was my original intention for
profiles.

The use case is that for example you have notebooks for creative
writing, one per writing project. And you have notebooks for
organizing private tasks and business tasks. This could be configured
with 2 profiles, each used by multiple notebooks.

(Thinking of this use case: please remind me to add a setting in the
"new notebook" dialog to select the profile for the new notebook.)

To implement have a look at how the "config_file()" method looks up
the file name relative to configuration folder. Probably this would be
the sequence:

  file = XDG_CONFIG_HOME.file(('zim', 'profiles', profile_name + '.conf'))
  if file.exists():
     data = ConfigDictFile(file)
    # ... merge data ...
  else:
     pass # new profile, keep default settings

  self.preference.change_file(file)
  self.emit('preferences-changed')

-- Jaap


Follow ups

References