Python plasmoid and configChanged()

2012-02-05 Thread Simone Gaiarin
Hi,
I wrote a python plasmoid that needs to restart a program (redshift)
everytime that the configuration is changed by the user (the plasmoid
configChanged() function reacts to the signal). When the program is
restarted the user is aware of it, because the screen color become
white and than red again. But this is not a problem because the
configuration is likely changed only few times.
Although I've noticed that the signal configChanged() is emitted every
time every part of the desktop is changed. So everytime I add a
widget, lock/unlock widgets and so on, my plasmoid restarts the
program. Is this the normal behaviour? Shouldn't the signal be emitted
only when the configuration of my plasmoid is changed?
___
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel


Re: Python plasmoid and configChanged()

2012-02-05 Thread Aaron J. Seigo
On Sunday, February 5, 2012 11:44:02 Simone Gaiarin wrote:
 Hi,
 I wrote a python plasmoid that needs to restart a program (redshift)
 everytime that the configuration is changed by the user (the plasmoid
 configChanged() function reacts to the signal). When the program is
 restarted the user is aware of it, because the screen color become
 white and than red again. But this is not a problem because the
 configuration is likely changed only few times.
 Although I've noticed that the signal configChanged() is emitted every
 time every part of the desktop is changed. So everytime I add a
 widget, lock/unlock widgets and so on, my plasmoid restarts the
 program. Is this the normal behaviour? Shouldn't the signal be emitted
 only when the configuration of my plasmoid is changed?

yes, and that's how it should be working. do you call configChanged() from 
anywhere else in the plasmoid code?

i tried just now with a C++ plasmoid, and it is not happening.

tried again with a JS plasmoid, also not happening there either.

so it seems this is something in your plasmoid or in the python bindings?

-- 
Aaron J. Seigo

signature.asc
Description: This is a digitally signed message part.
___
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel


Re: Python plasmoid and configChanged()

2012-02-05 Thread Simone Gaiarin
I call configChanged() once in the init function and then I connect it
to the configChanged() signal.

Here you can find the code:

https://github.com/simgunz/redshift-plasmoid/blob/master/contents/code/main.py


2012/2/5 Aaron J. Seigo ase...@kde.org:
 On Sunday, February 5, 2012 11:44:02 Simone Gaiarin wrote:
 Hi,
 I wrote a python plasmoid that needs to restart a program (redshift)
 everytime that the configuration is changed by the user (the plasmoid
 configChanged() function reacts to the signal). When the program is
 restarted the user is aware of it, because the screen color become
 white and than red again. But this is not a problem because the
 configuration is likely changed only few times.
 Although I've noticed that the signal configChanged() is emitted every
 time every part of the desktop is changed. So everytime I add a
 widget, lock/unlock widgets and so on, my plasmoid restarts the
 program. Is this the normal behaviour? Shouldn't the signal be emitted
 only when the configuration of my plasmoid is changed?

 yes, and that's how it should be working. do you call configChanged() from
 anywhere else in the plasmoid code?

 i tried just now with a C++ plasmoid, and it is not happening.

 tried again with a JS plasmoid, also not happening there either.

 so it seems this is something in your plasmoid or in the python bindings?

 --
 Aaron J. Seigo
 ___
 Plasma-devel mailing list
 Plasma-devel@kde.org
 https://mail.kde.org/mailman/listinfo/plasma-devel

___
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel


Re: Python plasmoid and configChanged()

2012-02-05 Thread Aaron J. Seigo
On Sunday, February 5, 2012 15:16:03 Simone Gaiarin wrote:
 I call configChanged() once in the init function and then I connect it
 to the configChanged() signal.

you don't need to connect it to any signal. i'm not sure if that's the cause 
of your problem, but it is unecessary in any case.

and just in case something odd is going on .. the init function is indeed only 
being called once, correct?

-- 
Aaron J. Seigo

signature.asc
Description: This is a digitally signed message part.
___
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel


Re: Python plasmoid and configChanged()

2012-02-05 Thread Simone Gaiarin
Connecting configChanged() explicitly was the cause of the problem
apparently (I need to test it a little bit more). In many forum I've
found that the people suggest to do this connection, maybe it's old
stuff.

Another strange thing I noticed is that when I click OK in the config
dialog it does not close immediatly itself but it waits the end of the
function configChanged() and since in my case this function takes
about 10 seconds to complete the config dialog remain frozen for 10
seconds before closing.

I tried a workaround to avoid this behaviour trying to emit a custom
signal at the end of configChanged that activate the slow function,
but even in this case the config dialog waits. Any idea on how to
solve this?

2012/2/5 Aaron J. Seigo ase...@kde.org:
 On Sunday, February 5, 2012 15:16:03 Simone Gaiarin wrote:
 I call configChanged() once in the init function and then I connect it
 to the configChanged() signal.

 you don't need to connect it to any signal. i'm not sure if that's the cause
 of your problem, but it is unecessary in any case.

 and just in case something odd is going on .. the init function is indeed only
 being called once, correct?

 --
 Aaron J. Seigo
 ___
 Plasma-devel mailing list
 Plasma-devel@kde.org
 https://mail.kde.org/mailman/listinfo/plasma-devel

___
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel