[prev in list] [next in list] [prev in thread] [next in thread]
List: kwrite-devel
Subject: Re: [python] per session config data
From: Shaheed Haque <srhaque () theiet ! org>
Date: 2013-04-25 20:59:56
Message-ID: CAHAc2jeQ6ra_KTvVaivAa2=O9RfJGbfDOz7nvEQG4EOvainy4w () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
I was more thinking of how those APIs should be exposed to individual Pate
plugins, since the native intent is they support Pate, not Pate's plugins.
On 25 April 2013 21:43, Alex Turbov <i.zaufi@gmail.com> wrote:
> I suppose from Python plugin viewpoint there is should be smth similar to
> a global configuration -- i.e. a dict w/ keys, but they must be
> stored/loaded on per-session basis... like `kate.session_configuration' .=
..
>
>
> On Fri, Apr 26, 2013 at 12:34 AM, Shaheed Haque <srhaque@theiet.org>wrote=
:
>
>> Good point. Pate has empty implementations of these hooks, one of them
>> with a comment to the effect "deprecated, do not use" inherited from the
>> original code. I now remember looking at this and wondering "why? maybe
>> this is to do with there being only the notion of the current session?" =
but
>> not being sure of how to proceed. If we can agree that out, wiring it up
>> should not be too hard (for me or somebody else...).
>>
>> Alex, I think you are familiar with the non-session configuration
>> support. Care to suggest something?
>>
>>
>> On 24 April 2013 21:26, Dominik Haumann <dhaumann@kde.org> wrote:
>>
>>> On Wednesday, 24. April 2013 19:27:59 J. Pablo Mart=C3=ADn 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=C3=ADn Cobos <
>>> goinnn@gmail.com>wrote:
>>> > >> I think that this is impossible! I think that you have to change
>>> the sip
>>> > >> files. I changed this 1 month ago, I added the 47-48 like:
>>> > >>
>>> > >>
>>> > >>
>>> https://projects.kde.org/projects/kde/applications/kate/repository/revi=
si
>>> > >> 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/revi=
si
>>> > >>
>>> ons/goinnn-kate-plugins/entry/kate/plugins/pate/src/plugins/libkatepate=
/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 ne=
w
>>> > > 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& groupPrefix);
>>>
>>> /**
>>> * 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
>>> Sessions.
>>> 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 questio=
n
>>> (can
>>> > you please resurrect this code?) I can not say yes o no. Dominik or
>>> Shaheed
>>> > 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-kat=
e-
>>> > >> 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
>>>
>>
>>
>> _______________________________________________
>> KWrite-Devel mailing list
>> KWrite-Devel@kde.org
>> https://mail.kde.org/mailman/listinfo/kwrite-devel
>>
>>
>
> _______________________________________________
> KWrite-Devel mailing list
> KWrite-Devel@kde.org
> https://mail.kde.org/mailman/listinfo/kwrite-devel
>
>
[Attachment #5 (text/html)]
<div dir="ltr">I was more thinking of how those APIs should be exposed to individual \
Pate plugins, since the native intent is they support Pate, not Pate's \
plugins.</div><div class="gmail_extra"><br><br><div class="gmail_quote"> On 25 April \
2013 21:43, Alex Turbov <span dir="ltr"><<a href="mailto:i.zaufi@gmail.com" \
target="_blank">i.zaufi@gmail.com</a>></span> wrote:<br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"> I suppose from Python plugin viewpoint there is should be \
smth similar to a global configuration -- i.e. a dict w/ keys, but they must be \
stored/loaded on per-session basis... like `kate.session_configuration' ...<div \
class="HOEnZb"> <div class="h5"><br><br>
<div class="gmail_quote">On Fri, Apr 26, 2013 at 12:34 AM, Shaheed Haque <span \
dir="ltr"><<a href="mailto:srhaque@theiet.org" \
target="_blank">srhaque@theiet.org</a>></span> wrote:<br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex">
<div dir="ltr">Good point. Pate has empty implementations of these hooks, one of them \
with a comment to the effect "deprecated, do not use" inherited from the \
original code. I now remember looking at this and wondering "why? maybe this is \
to do with there being only the notion of the current session?" but not being \
sure of how to proceed. If we can agree that out, wiring it up should not be too hard \
(for me or somebody else...).<div>
<br></div><div>Alex, I think you are familiar with the non-session configuration \
support. Care to suggest something? </div></div><div><div><div \
class="gmail_extra"><br><br><div class="gmail_quote"> On 24 April 2013 21:26, Dominik \
Haumann <span dir="ltr"><<a href="mailto:dhaumann@kde.org" \
target="_blank">dhaumann@kde.org</a>></span> wrote:<br> <blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex">On Wednesday, 24. April 2013 19:27:59 J. Pablo Martín Cobos \
wrote:<br> > 2013/4/24 Alex Turbov <<a href="mailto:i.zaufi@gmail.com" \
target="_blank">i.zaufi@gmail.com</a>><br> ><br>
> > thanks for reply,<br>
><br>
> You are welcome Alex ;-)<br>
><br>
> > On Wed, Apr 24, 2013 at 9:15 PM, J. Pablo Martín Cobos <<a \
href="mailto:goinnn@gmail.com" target="_blank">goinnn@gmail.com</a>>wrote:<br> \
> >> I think that this is impossible! I think that you have to change the \
sip<br> > >> files. I changed this 1 month ago, I added the 47-48 like:<br>
> >><br>
> >><br>
> >> <a href="https://projects.kde.org/projects/kde/applications/kate/repository/revisi" \
target="_blank">https://projects.kde.org/projects/kde/applications/kate/repository/revisi</a><br>
> >> ons/master/entry/addons/kate/pate/sip/kate/mainwindow.sip#L48<br>
> >><br>
> >> But you can get the current session from the title of the kate.<br>
> >><br>
> >><br>
> >> <a href="https://projects.kde.org/projects/kde/applications/kate/repository/revisi" \
target="_blank">https://projects.kde.org/projects/kde/applications/kate/repository/revisi</a><br>
> >> ons/goinnn-kate-plugins/entry/kate/plugins/pate/src/plugins/libkatepate/s<br>
> >> ession.py><br>
> > can you please resurrect this code? as for me it's better than \
nothing...<br> > > and I badly need to have a per-session configuration data \
for my new<br> > > plugin!<br>
> Could be a configuration per-project?<br>
><br>
> When I added this code, Dominik tell me that this is very ugly. When I did<br>
> not need it, I removed.<br>
<br>
And I'd criticize it again ;)<br>
<br>
In kate/interfaces/kate/plugin.h there are functions<br>
<br>
/**<br>
* Load session specific settings here.<br>
* This function is called whenever a Kate session is loaded. You<br>
* should use the given \p config and prefix \p groupPrefix to store \
the<br>
* data. The group prefix exist so that the group does not clash with<br>
* other applications that use the same config file.<br>
* \param config the KConfig object which is to be used<br>
* \param groupPrefix the group prefix which is to be used<br>
* \see writeSessionConfig()<br>
*/<br>
<br>
virtual void readSessionConfig (KConfigBase* config, const QString& \
groupPrefix);<br> <br>
/**<br>
* Store session specific settings here.<br>
* This function is called whenever a Kate session is saved. You<br>
* should use the given \p config and prefix \p groupPrefix to store \
the<br>
* data. The group prefix exists so that the group does not clash with<br>
* other applications that use the same config file.<br>
* \param config the KConfig object which is to be used<br>
* \param groupPrefix the group prefix which is to be used<br>
* \see readSessionConfig()<br>
*/<br>
virtual void writeSessionConfig (KConfigBase* config, const QString& \
groupPrefix);<br> <br>
These functions are called by Kate for all plugins when opening/closing Sessions.<br>
So C++ Kate plugins just need to reimplement these functions.<br>
<br>
Doesn't this exist in your python bindings as well?<br>
<br>
Greetings,<br>
Dominik<br>
<br>
> The problem is that the sip files are not updated, you can get the session<br>
> name in a C++ plugin.... and this a great problem. About your question (can<br>
> you please resurrect this code?) I can not say yes o no. Dominik or Shaheed<br>
> tell something please<br>
><br>
> >> I did this, but I removed the code because this was very ugly and I \
saw<br> > >> the project plugin and I prefered to integrate with this.<br>
> >><br>
> >><br>
> >> <a href="http://kate-editor.org/2013/04/23/a-rich-python-console-and-more-in-kate-" \
target="_blank">http://kate-editor.org/2013/04/23/a-rich-python-console-and-more-in-kate-</a><br>
> >> editor/<br>
> >><br>
> >> Best regards,<br>
> >><br>
> >> PS: Please tell me if you get some solution!<br>
> >><br>
> >><br>
> >><br>
> >> 2013/4/24 Alex Turbov <<a href="mailto:i.zaufi@gmail.com" \
target="_blank">i.zaufi@gmail.com</a>><br> > >><br>
> >>> hi list (and espesially python devs),<br>
> >>><br>
> >>> I'm looking for the way to store per session configuration data \
from my<br> > >>> python plugin (and see nothing yet)...<br>
> >>> or at least the way to get session name (or smth unique ID of \
the<br> > >>> current session).<br>
> >>><br>
> >>> anyone can help?<br>
_______________________________________________<br>
KWrite-Devel mailing list<br>
<a href="mailto:KWrite-Devel@kde.org" target="_blank">KWrite-Devel@kde.org</a><br>
<a href="https://mail.kde.org/mailman/listinfo/kwrite-devel" \
target="_blank">https://mail.kde.org/mailman/listinfo/kwrite-devel</a><br> \
</blockquote></div><br></div> \
</div></div><br>_______________________________________________<br> KWrite-Devel \
mailing list<br> <a href="mailto:KWrite-Devel@kde.org" \
target="_blank">KWrite-Devel@kde.org</a><br> <a \
href="https://mail.kde.org/mailman/listinfo/kwrite-devel" \
target="_blank">https://mail.kde.org/mailman/listinfo/kwrite-devel</a><br> \
<br></blockquote></div><br> \
</div></div><br>_______________________________________________<br> KWrite-Devel \
mailing list<br> <a href="mailto:KWrite-Devel@kde.org">KWrite-Devel@kde.org</a><br>
<a href="https://mail.kde.org/mailman/listinfo/kwrite-devel" \
target="_blank">https://mail.kde.org/mailman/listinfo/kwrite-devel</a><br> \
<br></blockquote></div><br></div>
_______________________________________________
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