nburdick / lilykde

Automatically exported from code.google.com/p/lilykde
0 stars 0 forks source link

Configuration settings aren't saved #26

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

1. Open Configuration Dialog
2. Change something and Apply
3. Open Config Dialog again

All paths have disappeared. That's impossible to save any configuration change.

Sorry for my bad english...

Version of Frescobaldi : 0.7.17 ( same issue in 0.7.16 )
System : Gentoo - KDE 4.3.4

Original issue reported on code.google.com by noursb...@free.fr on 7 Dec 2009 at 2:03

GoogleCodeExporter commented 8 years ago
I thinks Frescobaldi can't read .kde4/share/config/frescobaldirc

If I change manually the settings directly in this file, they're applied 
successfully.

Original comment by noursb...@free.fr on 7 Dec 2009 at 6:29

GoogleCodeExporter commented 8 years ago
Strange, I can't reproduce this bug here. On my system both "Apply" and "OK" do 
save
the changes. If I open the settings dialog again, the changed settings are 
still there.

Please check if Frescobaldi does try to write to 
.kde4/share/config/frescobaldirc and
not to .kde/share/config/frescobaldirc or something (but that would be strange, 
as
Frescobaldi just uses the KDE confing system to save it's changes).

Please also check if you have recent SIP, PyQt4 and PyKDE4 packages.

Original comment by wbsoft on 8 Dec 2009 at 7:55

GoogleCodeExporter commented 8 years ago
Thanks for your reply.

I have :

-> SIP 4.9.3
-> PyQt4 4.6.2
-> PyKDE4 4.3.4

I think that's ok.

When  starting I get :

------------------------------------------------------------
$  /usr/lib/python2.6/site-packages/dbus/connection.py:242: DeprecationWarning: 
object.__init__() takes
no parameters
  super(Connection, self).__init__(*args, **kwargs)
-------------------------------------------------------------
Not relative to my problem.

now, I thought about permissions :

-> started fresco for the first time
-------------------------------------------------------------
$ ls -l kde4/share/config/frescobaldirc
$ -rw------- 1 user user 160 déc.   8 09:29 .kde4/share/config/frescobaldirc
-------------------------------------------------------------
The config file contains nothing but a [MainWindow] section with a State value.

-> now I open config dialog (all path are ok)
-> add a midi player for example kmid2
-> apply and Ok.
-> Check config file : nothing has changed
-> maybe amarok behavior, so I close fresco.
-> check config file : 
config file has changed and is full of settings. I see that all software paths 
are empty and kmid2 doesn't
appear. This is a default virgin config file.
-> start fresco again
-> open config file, change something and apply : no change in config file.

So I decided to change the config file by hand and add kmid2 as the midi player.
-> start fresco
-> open config dialog : kmid2 appear !!!!

Note: there is no error message when using config dialog.

Conclusion : fresco can read config file, write a default config file but can't 
modify this file.

Hope this can help to solve this bug.  ;)

Original comment by noursb...@free.fr on 8 Dec 2009 at 8:45

GoogleCodeExporter commented 8 years ago
Frescobaldi only saves its config file on exit, and it should save the path 
settings
too, then. The deprecation warning comes from Python-dbus and is harmless, I 
think.

I could add code to sync() the config also when the settings dialog is closed, 
maybe
this solves the problem you're experiencing.

If you can, could you please try if adding this code helps on your system?

open frescobaldi-0.7.17/python/frescobaldi_app/settings.py and add this line

            KGlobal.config().sync()

before line 77, at the same indentation level as the preceding 
self.saveSettings()
line, so that the whole done() method looks like:

    def done(self, result):
        if result:
            self.saveSettings()
            KGlobal.config().sync()
        KPageDialog.done(self, result)

thanks.

Original comment by wbsoft on 8 Dec 2009 at 6:22

GoogleCodeExporter commented 8 years ago
Hi.

This patch doesn't change anything. Always the same behavior. Sorry.

Original comment by noursb...@free.fr on 8 Dec 2009 at 6:50

GoogleCodeExporter commented 8 years ago
(I assume you did a make install after the patch :-)

Strange... could you tell me if it only applies to the paths?
or also the checkbox options in the first page (General Preferences)?
And the KatePart options (Editor component options), are they saved?
And what if you don't click "Apply" first but just OK?

And the other settings in Frescobaldi that should be remembered, e.g. in the 
Score
Wizard, third tab (many settings should be retained) and e.g. the Show Path and 
Show
Document Tabs options in the Settings menu, are they remembered after a restart 
of
Frescobaldi?

Thanks for your help and your time.

For now, it seems that writeEntry() calls to a KConfigGroup are lost on your 
system
as soon as the group goes out of scope. That could be caused by sip 4.9.3 (I 
tested
only with 4.7.9 and 4.9.1). But if that is the case, the loss of settings 
should be
everywhere across Frescobaldi...

Original comment by wbsoft on 8 Dec 2009 at 9:35

GoogleCodeExporter commented 8 years ago
Ok. I've tested lots of things.
It appear that only the Paths window (lilypond , convert-ly, midi player, etc) 
of settings dialog doesn't save
its changes. Everything else is working ok.
Hope this can help !

Original comment by noursb...@free.fr on 8 Dec 2009 at 10:41

GoogleCodeExporter commented 8 years ago
thanks. maybe writeEntry fails in sip 4.9.3 with plain Python strings or 
QStrings
(instead of QVariants)

Is the Expand Dialog working? I.e. if you press Ctrl+. and then select one 
expansion,
and make some changes in the text entry at the bottom, are those changes 
remembered
(saved in ~/.kde4/share/apps/frescobaldi/expansions) ?

Original comment by wbsoft on 8 Dec 2009 at 11:30

GoogleCodeExporter commented 8 years ago
No. Changes aren't saved ! And when fresco restart, text entry has disappeared.

Hope this help.

(go to bed, 1:07 am here) See you tomorrow !

Original comment by noursb...@free.fr on 9 Dec 2009 at 12:07

GoogleCodeExporter commented 8 years ago
I've changed A4 paper size definition with "YOUPI" and file 
~/.kde4/share/apps/frescobaldi/expansions
contains :

[a4]
Text=

Nothing else.

Original comment by noursb...@free.fr on 9 Dec 2009 at 12:09

GoogleCodeExporter commented 8 years ago
Again, many thanks for you help an patience.
It seems now that keys (the Text=) are created but the (string) values are not 
saved.

I think and hope now that wrapping all strings in QVariant will fix this 
problem that
clearly is associated with changes in SIP in 4.9.3 compared to earlier versions.

To try this, if you want to help, you could change line 342 in
<frescobaldi>/python/frescobaldi_app/settings.py from:

                conf.writeEntry(name, widget.text())

to:

                conf.writeEntry(name, QVariant(widget.text()))

so that the beginning of the saveSettings() method looks like:

    def saveSettings(self):
        conf = config("commands")
        for widget, name, default in self.commands:
            if widget.text() or not default:
                conf.writeEntry(name, widget.text())

(And then make install again)

If your commands (first options in Settings/Paths) are saved now, we've found 
the
solution.

Original comment by wbsoft on 9 Dec 2009 at 5:37

GoogleCodeExporter commented 8 years ago
Sorry, I meant:

so that the beginning of the saveSettings() method looks like:

    def saveSettings(self):
        conf = config("commands")
        for widget, name, default in self.commands:
            if widget.text() or not default:
                conf.writeEntry(name, QVariant(widget.text()))

of course :-)

Original comment by wbsoft on 9 Dec 2009 at 5:43

GoogleCodeExporter commented 8 years ago
Well, I have made this change everywhere in SVN r1713 and it still works on my 
system
with sip 4.9.1 and my laptop with sip 4.7.9.

I hope this fixes the problems you're experiencing.

You can checkout the source from SVN with:

svn checkout http://lilykde.googlecode.com/svn/trunk/frescobaldi
cd frescobaldi
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=$(kde4-config --exec-prefix)
make
su -c "make install" # or: sudo make install

(This will install in the same place as install via ebuild, good to unmerge
frescobaldi first.) See INSTALL for some more information (I ought to create a
frescobaldi-svn ebuild :-)

Good luck!

Original comment by wbsoft on 9 Dec 2009 at 6:15

GoogleCodeExporter commented 8 years ago
Hi.

tested : not working... Always the same bug. Sorry...

Original comment by noursb...@free.fr on 9 Dec 2009 at 1:08

GoogleCodeExporter commented 8 years ago
Hi! After 2 hours I've killed this bug.
Your writeEntry() method doesn't accept the QString widget.text() but a python 
string !!!

so, I've replaced conf.writeEntry(name, widget.text()) with 
conf.writeEntry(name, str(widget.text())) to get a
python string and it works ! No need to a QVariant...

Now everything is ok !

Code  line 342 :

def saveSettings(self):
        conf = config("commands")
        for widget, name, default in self.commands:
            if widget.text() or not default:
                conf.writeEntry(name, str(widget.text()))

Let's have a beer ! ;)

Original comment by noursb...@free.fr on 9 Dec 2009 at 2:37

GoogleCodeExporter commented 8 years ago
Great, many thanks for your help!!

One last question: does QVariant(pythonstring) work on your?

e.g.
                conf.writeEntry(name, QVariant(unicode(widget.text())))

? :-)

Original comment by wbsoft on 9 Dec 2009 at 6:29

GoogleCodeExporter commented 8 years ago
Hi !

conf.writeEntry(name, QVariant(unicode(widget.text()))) is working like a charm 
!

Thank you for such a software !

See ya

Noursbleu (France)

Original comment by noursb...@free.fr on 9 Dec 2009 at 7:15

GoogleCodeExporter commented 8 years ago
Many, many thanks for your great help with testing and swatting this bug. This 
way
Frescobaldi <= 1.0.0 can work with anything from PyQt 4.4.3 up to 4.6.2 and SIP 
4.7.7
and SIP 4.9.3

After 1.0 I'll make Frescobaldi require latest SIP and PyQt4 versions which 
will make
everything easier (QString will not exist anymore, autoconversion to Python 
Unicode
everywhere). Probably, if PyKDE4 is ported to Python 3, Frescobaldi will follow 
soon.

Original comment by wbsoft on 9 Dec 2009 at 7:25