[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kwrite-devel
Subject:    Re: [python] per session config data
From:       Dominik Haumann <dhaumann () kde ! org>
Date:       2013-04-24 20:26:26
Message-ID: 2312769.71FuSXFjWi () eriador
[Download RAW message or body]

On Wednesday, 24. April 2013 19:27:59 J. Pablo Mart=EDn Cobos wrote:
> 2013/4/24 Alex Turbov <i.zaufi@gmail.com>
> =

> > thanks for reply,
> =

> You are welcome Alex ;-)
> =

> > On Wed, Apr 24, 2013 at 9:15 PM, J. Pablo Mart=EDn Cobos <goinnn@gmail.=
com>wrote:
> >> I think that this is impossible! I think that you have to change the s=
ip
> >> files. I changed this 1 month ago, I added the 47-48 like:
> >> =

> >> =

> >> https://projects.kde.org/projects/kde/applications/kate/repository/rev=
isi
> >> ons/master/entry/addons/kate/pate/sip/kate/mainwindow.sip#L48
> >> =

> >> But you can get the current session from the title of the kate.
> >> =

> >> =

> >> https://projects.kde.org/projects/kde/applications/kate/repository/rev=
isi
> >> ons/goinnn-kate-plugins/entry/kate/plugins/pate/src/plugins/libkatepat=
e/s
> >> ession.py> =

> > can you please resurrect this code? as for me it's better than nothing.=
..
> > and I badly need to have a per-session configuration data for my new
> > plugin!
> Could be a configuration per-project?
> =

> When I added this code, Dominik tell me that this is very ugly. When I did
> not need it, I removed.

And I'd criticize it again ;)

In kate/interfaces/kate/plugin.h there are functions =


      /**
       * Load session specific settings here.
       * This function is called whenever a Kate session is loaded. You
       * should use the given \p config and prefix \p groupPrefix to store =
the
       * data. The group prefix exist so that the group does not clash with
       * other applications that use the same config file.
       * \param config the KConfig object which is to be used
       * \param groupPrefix the group prefix which is to be used
       * \see writeSessionConfig()
       */

      virtual void readSessionConfig (KConfigBase* config, const QString& g=
roupPrefix);

      /**
       * Store session specific settings here.
       * This function is called whenever a Kate session is saved. You
       * should use the given \p config and prefix \p groupPrefix to store =
the
       * data. The group prefix exists so that the group does not clash with
       * other applications that use the same config file.
       * \param config the KConfig object which is to be used
       * \param groupPrefix the group prefix which is to be used
       * \see readSessionConfig()
       */
      virtual void writeSessionConfig (KConfigBase* config, const QString& =
groupPrefix);

These functions are called by Kate for all plugins when opening/closing Ses=
sions.
So C++ Kate plugins just need to reimplement these functions.

Doesn't this exist in your python bindings as well?

Greetings,
Dominik

> The problem is that the sip files are not updated, you can get the session
> name in a C++ plugin.... and this a great problem. About your question (c=
an
> you please resurrect this code?) I can not say yes o no. Dominik or Shahe=
ed
> tell something please
> =

> >> I did this, but I removed the code because this was very ugly and I saw
> >> the project plugin and I prefered to integrate with this.
> >> =

> >> =

> >> http://kate-editor.org/2013/04/23/a-rich-python-console-and-more-in-ka=
te-
> >> editor/
> >> =

> >> Best regards,
> >> =

> >> PS: Please tell me if you get some solution!
> >> =

> >> =

> >> =

> >> 2013/4/24 Alex Turbov <i.zaufi@gmail.com>
> >> =

> >>>  hi list (and espesially python devs),
> >>> =

> >>> I'm looking for the way to store per session configuration data from =
my
> >>> python plugin (and see nothing yet)...
> >>> or at least the way to get session name (or smth unique ID of the
> >>> current session).
> >>> =

> >>> anyone can help?
_______________________________________________
KWrite-Devel mailing list
KWrite-Devel@kde.org
https://mail.kde.org/mailman/listinfo/kwrite-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic