Re: [PyQt] QGraphicsScene issue
On Saturday 11 August 2007 2:20 am, Jason H wrote: I started using Qt 4.3.1 and PyQt 4.3. When I added the QGraphicsScene, I got the error: QObject::startTimer: timers cannot be started from another thread With out me actually using any timers. Then I wrote the script below (Change sups.jpg) to another file you have on your system. Everytime it renders the scene, the QObject::startTimer: timers cannot be started from another thread message appears, and floods the console. After a few moments of running, python crashes It typically rotates 3 or 4 times before crashing. I am wondering what I am doing wrong? You can't do GUI related stuff in anything other than the main thread. Phil ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Can't load UI files under Turkish locale
On Thursday 02 August 2007 12:08 pm, Ismail Dönmez wrote: Hi all, uic/properties.py line 220 says : getattr(widget, set%s%s % (propname[0].upper(), propname[1:]))( The propname[0].upper() part is problematic for Turkish locale, because uppercase of i is not I in Turkish locale but its i-with-a-dot-above (İ) . So trying to load a UI file results in an error : File /usr/lib/python2.4/site-packages/PyQt4/uic/properties.py, line 220, in setProperties getattr(widget, set%s%s % (propname[0].upper(), propname[1:]))( AttributeError: seticon Notice the method name is seticon and not setIcon. Somehow ascii only upper should be done, something like : import ascii def ascii_upper(s): trans_table = string.maketrans(string.ascii_lowercase, string.ascii_uppercase) return s.translate(trans_table) What do you think? Added to tonight's snapshot. Thanks, Phil ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] Multiple inheritance involving KXMLGUIClient does not work?
Hello. I'm having problems with KXMLGUIClient; in particular, it seems subclassing from it does not work when multiple inheritance is involved. See the script below. If this gets fixed, the attached example should work as well. (I seem to be pushing PyKDE to its limits, and I've already found three non-working features which I need for my application. As I've said before, I understand that you're not very inclined to fix them for KDE 3, but what are the odds that they'll work in KDE 4? I guess my application can live without them until then, but I'd like to know if the future will indeed be better. I'm afraid all I can provide is working/non-working C++/Python examples.) - #! /usr/bin/env python This script demonstrates that multiple inheritance with KXMLGUIClient does not work. import qt import kdeui class MyClient1(kdeui.KXMLGUIClient): def __init__(self): super(MyClient1, self).__init__() class MyClient2(kdeui.KXMLGUIClient, qt.QObject): def __init__(self): super(MyClient2, self).__init__() class MyClient3(qt.QObject, kdeui.KXMLGUIClient): def __init__(self): super(MyClient3, self).__init__() print hasattr(MyClient1(), 'actionCollection') # True print hasattr(MyClient2(), 'actionCollection') # True print hasattr(MyClient2(), 'connect') # False print hasattr(MyClient3(), 'actionCollection') # False print hasattr(MyClient3(), 'connect') # True - -- Adeodato Simó dato at net.com.org.es Debian Developer adeodato at debian.org We're happy, we have boyfriends! This is infinitely better than any mood stabilizer I have ever been on. -- Paris Geller #! /usr/bin/env python import sys import qt import kdeui import kdecore def main(): application = kdecore.KApplication(sys.argv, 'test app') main_window = MainWindow(None, 'main window') main_window.show() application.exec_loop() class MainWindow(kdeui.KMainWindow): def __init__ (self, *args): kdeui.KMainWindow.__init__(self, *args) self.vbox = MyVBox(self) class MyVBox(qt.QVBox, kdeui.KXMLGUIClient): def __init__(self, parent): qt.QVBox.__init__(self, parent) kdeui.KXMLGUIClient.__init__(self) self.toolbar = kdeui.KToolBar(self, 'toolbar') # This assert succeeds... assert 'actionCollection' in dir(self) # ... but this does not: print hasattr(self, 'actionCollection') # XXX ... and this obviously dies with AttributeError # Using super() instead of calling each constructor does not help ac = self.actionCollection() kdeui.KAction('Action 1', kdecore.KShortcut.null(), self.noop, ac, 'action1') kdeui.KAction('Action 2', kdecore.KShortcut.null(), self.noop, ac, 'action2') kdeui.KAction('Action 3', kdecore.KShortcut.null(), self.noop, ac, 'action3') self.setXMLFile('/tmp/xml_toolbar.rc'); self.createGUI() def createGUI(self): builder = kdeui.KXMLGUIBuilder(self) factory = kdeui.KXMLGUIFactory(builder, self) factory.addClient(self) def noop(self): pass if __name__ == '__main__': main() #include qvbox.h #include kapplication.h #include kcmdlineargs.h #include kmainwindow.h #include ktoolbar.h #include kxmlguiclient.h #include kxmlguibuilder.h #include kxmlguifactory.h #include kaction.h #include kactioncollection.h class MyVBox : public QVBox, public KXMLGUIClient { Q_OBJECT; public: MyVBox(QWidget *parent); ~MyVBox(); void createGUI(); public slots: void noop(); private: KToolBar *toolbar; }; MyVBox::MyVBox(QWidget *parent) : QVBox(parent), KXMLGUIClient() { toolbar = new KToolBar(this, toolbar); KActionCollection *ac = actionCollection(); new KAction(Action 1, 0, this, SLOT( noop() ), ac, action1); new KAction(Action 2, 0, this, SLOT( noop() ), ac, action2); new KAction(Action 3, 0, this, SLOT( noop() ), ac, action3); setXMLFile(/tmp/xml_toolbar.rc); createGUI(); } void MyVBox::createGUI() { KXMLGUIBuilder builder(this); KXMLGUIFactory factory(builder, this); factory.addClient(this); } void MyVBox::noop() { } MyVBox::~MyVBox() { delete toolbar; } /// class MainWindow : public KMainWindow { Q_OBJECT; public: MainWindow(); ~MainWindow(); private: MyVBox *vbox; }; MainWindow::MainWindow() : KMainWindow() { vbox = new MyVBox(this); } MainWindow::~MainWindow() { delete vbox; } /// int main (int argc, char **argv) { KCmdLineArgs::init(argc, argv, test, test, test, 1.0); KApplication app; MainWindow *window = new MainWindow;
Re: [PyQt] Multiple inheritance involving KXMLGUIClient does not work?
On Saturday 11 August 2007 11:48, Adeodato Simó wrote: Hello. I'm having problems with KXMLGUIClient; in particular, it seems subclassing from it does not work when multiple inheritance is involved. See the script below. If this gets fixed, the attached example should work as well. (I seem to be pushing PyKDE to its limits, and I've already found three non-working features which I need for my application. As I've said before, I understand that you're not very inclined to fix them for KDE 3, but what are the odds that they'll work in KDE 4? I guess my application can live without them until then, but I'd like to know if the future will indeed be better. I'm afraid all I can provide is working/non-working C++/Python examples.) sip doesn't support multiple inheritance in Python classes . It does support C++ classes which have multiple base classes, so you could create your own C++ classes that inherit from KXMLGuiClient and QObject and wrap them. It won't work in PyKDE4 either. It won't change unless Phil modifies sip, and I suspect there are good reasons why that isn't going to happen, but can't speak for Phil. Jim ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Multiple inheritance involving KXMLGUIClient does not work?
On Saturday 11 August 2007 8:17 pm, Jim Bublitz wrote: On Saturday 11 August 2007 11:48, Adeodato Simó wrote: Hello. I'm having problems with KXMLGUIClient; in particular, it seems subclassing from it does not work when multiple inheritance is involved. See the script below. If this gets fixed, the attached example should work as well. (I seem to be pushing PyKDE to its limits, and I've already found three non-working features which I need for my application. As I've said before, I understand that you're not very inclined to fix them for KDE 3, but what are the odds that they'll work in KDE 4? I guess my application can live without them until then, but I'd like to know if the future will indeed be better. I'm afraid all I can provide is working/non-working C++/Python examples.) sip doesn't support multiple inheritance in Python classes . It does support C++ classes which have multiple base classes, so you could create your own C++ classes that inherit from KXMLGuiClient and QObject and wrap them. It won't work in PyKDE4 either. It won't change unless Phil modifies sip, and I suspect there are good reasons why that isn't going to happen, but can't speak for Phil. The good reason is that it's impossible to implement without a standard way for creating new C++ types dynamically. Phil ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt