Re:Slouchy – a small Python script that warns you if you're ...
by V-2 on Tuesday October 13, 2015 @06:44AM
(#10379522)
What about these magic string: "slouching_alert(QString, QString)"? I don't know Python. Does it work by reflection? I assume these are some kind of bindings to an underlying native API or something? It doesn't look very maintainable...
[ Parent
| on HN ]
Re:Slouchy – a small Python script that warns you if you're ...
by mkempe on Tuesday October 13, 2015 @08:39AM
(#10379959)
Qt uses slots and signals to control messaging between threads (e.g. the UI and the workers).
The Python binding to Qt is good, but it is auto-generated (from C++) and some of it shows up as non-Pythonic mechanisms or conventions.
Re:Slouchy – a small Python script that warns you if you're ...
by amyjess on Tuesday October 13, 2015 @11:44AM
(#10381200)
Newer versions of PyQt have replaced the magic strings with a system that's much more Pythonic, using decorators and OOP.
I guess the author just wanted to keep backwards compatibility with old versions (or isn't aware of the change).
Edit: If anyone's interested, here's the new syntax: http://pyqt.sourceforge.net/Docs/PyQt4/new_style_signals_slo...
Re:Slouchy – a small Python script that warns you if you're ...
by pyskell on Wednesday October 14, 2015 @08:11PM
(#10390462)
Thanks for this. I had no idea a different mechanism existed.
Re:Slouchy – a small Python script that warns you if you're ...
by mkempe on Tuesday October 13, 2015 @11:48AM
(#10381230)
is PySide2 also getting that new system?
Re:Slouchy – a small Python script that warns you if you're ...
by amyjess on Tuesday October 13, 2015 @02:06PM
(#10382288)
Looks like it: https://wiki.qt.io/Signals_and_Slots_in_PySide