I am trying to convert the toggle-compositing plasmoid from C++ to Python and 
ended up having a problem with KSharedConfig.
The original uses the following code to modify the config of kwin:

        void ToggleCompositing::writeState(bool state) {
                KSharedConfigPtr 
mKWinConfig=KSharedConfig::openConfig("kwinrc");
                KConfigGroup config(mKWinConfig, "Compositing");
                m_state = config.readEntry("Enabled", false);
                if (m_state != state) {
                        config.writeEntry("Enabled", state);
                        m_state = state;
                        mKWinConfig->sync();
                }
        }

I tried to follow a narrowly and got this:

        def writeState(self, newValue):
                config = KSharedConfig.openConfig("kwinrc")
                configGroup = config.group("Compositing")
                if configGroup.readEntry("Enabled", QVariant(False) ).toBool() 
!= newValue:
                        configGroup.writeEntry("Enabled", newValue)
                        configGroup.sync()
                return configGroup.readEntry("Enabled", QVariant(False) 
).toBool()

It always crashes on the third line. No backtrace, sorry. Python doesn't give 
me anything, and KCrash says it can't load the necessary symbols :/
I've already tried it with the normal KConfig class, with the result that it 
only crashes at every second try (nothing happens after the first, though)...
_______________________________________________
PyQt mailing list    [email protected]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to