PyQt5 conversion seems mostly straight forward, apart from the parts
that are not straight forward :-}
Trying to work out what's going on in todo.py, let's use a simple test
case, just running the 'insert-icon' command on an outline with a
single node.
'insert-icon' uses g.app.gui.runOpenFileDialog, and *Py*Qt 5 has changed the
return value for QFileDialog.getOpenFileNames() from
[list of file names]
to
[[list of file names], <selected filter>]
Ok, no big deal.
Here's a trap though:
- def setter(pri=pri): o.setPri(pri)
- self.connect(w, QtCore.SIGNAL("clicked()"), setter)
+ def setter(pri=pri):
+ o.setPri(pri)
+ if isQt5:
+ w.clicked.connect(setter)
+ else:
+ self.connect(w, QtCore.SIGNAL("clicked()"), setter)
The old form calls setter() with no parameters, the new form calls
setter with `bool is_checked`, seeing buttons can be checked or
unchecked when they're clicked.
I think the best solution is to change setter() to be
def setter(checked, pri=pri): ...
which will work in both Qt4 and Qt5, basically the old style .connect()
let you select whether that parameter got passed or not, but I think
everything's cleaner if we just make the callbacks match the basic
definition of the signals.
Cheers -Terry
--
You received this message because you are subscribed to the Google Groups
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.