Re: [PyQt] Regression in SIP sip-4.8-snapshot-20090409 wrt MappedTypes
Phil Thompson wrote: On Sun, 19 Apr 2009 21:39:29 +0200, Simon Edwards si...@simonzone.com wrote: Phil Thompson wrote: sipForceConvertTo_*() (and related functions) are internal and should not be used by handwritten code. If it isn't documented then you can't use it. Thanks that helps a lot. Another question. 4.8 gives errors on PyKDE related it trying to use a copy constructor or operator=() on some classes which don't have one or have one which is private. It looks like SIP wants to use the copy constructor to copy a returned value from a method and then fails. Has anything changed? Have you got any tips about what I should be trying. If a copy ctor is private then SIP should be told about it - see qobject.sip. The copy ctor is included and private like many others. This might be a namespace related issue. Here is what I've got. It worked in SIP 4.8. class KEditListBox : QGroupBox { public: class CustomEditor { public: CustomEditor (); CustomEditor (QWidget* repWidget, KLineEdit* edit); CustomEditor (KComboBox* combo); private: CustomEditor (const KEditListBox::CustomEditor); }; // ... }; class KUrlRequester : KHBox { // ... public: explicit KUrlRequester (QWidget* parent /TransferThis/ = 0); explicit KUrlRequester (const KUrl url, QWidget* parent /TransferThis/ = 0); KUrlRequester (QWidget* editWidget, QWidget* parent /TransferThis/); const KEditListBox::CustomEditor customEditor (); // ^ This here fails. } /home/sbe/devel/kdesvninstall/include/keditlistbox.h: In function ‘PyObject* meth_KUrlRequester_customEditor(PyObject*, PyObject*)’: /home/sbe/devel/kdesvninstall/include/keditlistbox.h:77: error: ‘KEditListBox::CustomEditor::CustomEditor(const KEditListBox::CustomEditor)’ is private sipkiopart5.cpp:22797: error: within this context cheers, -- Simon Edwards | KDE-NL, Guidance tools, Guarddog Firewall si...@simonzone.com | http://www.simonzone.com/software/ Nijmegen, The Netherlands | ZooTV? You made the right choice. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] Eclipse sliding info panels
For those who haven't seen the sliding info panels in the Eclipses IDE they are great. They slide out over the main working area and collapse out of sight when you click back into the main working area. Makes it really convenient to get/edit data. They differ from splitting a Frame in two with QSplitter in that it doesn't change the dimensions of the main pane. They ride over the top of the main pane. I'm wondering if any one knows if this is possible in PyQt? Cheers, -Scott __ Information from ESET NOD32 Antivirus, version of virus signature database 4020 (20090420) __ The message was checked by ESET NOD32 Antivirus. http://www.eset.com ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Re: tooltips in menu: how?
Wolfgang Rohdewald a écrit : let me restate what I observed: if the tip click here... appears, the tips tooltip 0 etc will never appear unless the program is restarted if the tip click here... does not appear, the tips tooltip 0 etc will appear this is inconsistent behaviour. You're right this a real problem. I've it on my computer too. This is a bug. Wolfgang Rohdewald a écrit : Even worse: 1. wait for the tooltip click here to appear 2. open the menu and click on any menu entry. 3. the tool tip click here will never appear again don't you observe this behaviour? What versions are you using? I do not have this problem. Christophe. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Link between a QWebViev and a JavaScript program
David Boddie a écrit : The porting of the C++ Qt examples to Python has fallen behind since Qt 4.3 so there aren't any simple WebKit examples included with PyQt. I'm not lucky... :-\ David Boddie a écrit : The recent Monster Evolution experiments on Qt Labs include a Python version of a program that integrates with WebKit's JavaScript engine: http://labs.trolltech.com/blogs/2009/04/07/monster-evolution-in-qt-episode-2-attack-of-the-squirrelfish/ QWebFrame's addToJavaScriptWindowObject() method lets you insert an instance of a QObject subclass into the page. You can expose methods to JavaScript, but you have to declare them as slots with the @pyqtSignature() decorator. The example code can be found here: http://labs.trolltech.com/gitweb?p=GraphicsDojo;a=blob;f=webmonster/webmonster.py I'll study it as soon as possible... Thanks. Christophe. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Link between a QWebViev and a JavaScript program
Marcell Mars a écrit : the simplest example of loading jquery.js (geti it from http://jqueryjs.googlecode.com/files/jquery-1.3.2.js and put it in the same directory with the snippet below) after loading html and then using jquery syntax to change the background color into red: run it in python interactive shell or better in ipython: from PyQt4.QtCore import * from PyQt4.QtGui import * from PyQt4.QtWebKit import * myWebKit = QWebView() myWebKit.show() myWebKit.setUrl(QUrl(http://www.google.com;)) myWebKit.page().mainFrame().evaluateJavaScript(open('jquery.js').read()) myWebKit.page().mainFrame().evaluateJavaScript($(document).ready(function() { $(body).css(background, #f00);});) Your example doesn't work for me. I've done the program given with tis message and the files which are ine the same folder. What's wrong ? Christophe. A simple test # -*- coding: utf-8 -*- #!/usr/bin/env python # Les lignes ci-dessus sont très importantes : #1°) La 1ère ligne indique le codage du fichier Python. #2°) La 2nde ligne est indispensable pour un bon fonctionnement sous Linux. # PRESENTATION : ce script montre comment créé un fichier au format HTML ou PDF. # AUTEUR : BAL Christophe # MAIL : projet...@club.fr # SITE : http://christophe_bal.club.fr/index.php # DATE DE CREATION : 24/06/2008 # DERNIERE MODIFICATION : 10/12/2008 # # TEST(S) EFFECTUE(S) : programme testé sous Windows XP avec succès. # On importe les bibliothèques que nous allons utiliser. import sys from PyQt4 import QtCore, QtGui from PyQt4 import QtWebKit # On importe notre boîte de dialogue. from JQueryTest import Ui_dial_Projet2 class dial_Projet2(QtGui.QDialog, Ui_dial_Projet2): def __init__(self): QtGui.QDialog.__init__(self) Ui_dial_Projet2.__init__(self) self.verticalLayout = QtGui.QVBoxLayout(self) self.verticalLayout.setObjectName(verticalLayout) self.webView = QtWebKit.QWebView(self) self.webView.setUrl(QtCore.QUrl(test.html)) self.webView.setObjectName(webView) self.verticalLayout.addWidget(self.webView) self.webView.page().mainFrame().evaluateJavaScript(open('jquery.js').read()) self.webView.page().mainFrame().evaluateJavaScript($(document).ready(function() { $(body).css(background, #ff0);});) if __name__ == __main__: import sys app = QtGui.QApplication(sys.argv) testFichier = dial_Projet2() testFichier.show() sys.exit(app.exec_()) ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Link between a QWebViev and a JavaScript program
I've forgot the gui file. Here is it. Christophe. : Marcell Mars a écrit : the simplest example of loading jquery.js (geti it from http://jqueryjs.googlecode.com/files/jquery-1.3.2.js and put it in the same directory with the snippet below) after loading html and then using jquery syntax to change the background color into red: run it in python interactive shell or better in ipython: from PyQt4.QtCore import * from PyQt4.QtGui import * from PyQt4.QtWebKit import * myWebKit = QWebView() myWebKit.show() myWebKit.setUrl(QUrl(http://www.google.com;)) myWebKit.page().mainFrame().evaluateJavaScript(open('jquery.js').read()) myWebKit.page().mainFrame().evaluateJavaScript($(document).ready(function() { $(body).css(background, #f00);});) Your example doesn't work for me. I've done the program given with tis message and the files which are ine the same folder. What's wrong ? Christophe. # -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'C:\Documents and Settings\Christophe\Mes documents\2,pyBaNaMa\Deb_PythonEtPyQT\CodesProjets\99-WebViev-JavaScript\JQueryTest.ui ' # # Created: Mon Apr 20 00:32:39 2009 # by: PyQt4 UI code generator 4.4.4 # # WARNING! All changes made in this file will be lost! from PyQt4 import QtCore, QtGui class Ui_dial_Projet2(object): def setupUi(self, dial_Projet2): dial_Projet2.setObjectName(dial_Projet2) dial_Projet2.resize(805, 639) dial_Projet2.setAutoFillBackground(True) self.verticalLayout = QtGui.QVBoxLayout(dial_Projet2) self.verticalLayout.setObjectName(verticalLayout) self.webView = QtWebKit.QWebView(dial_Projet2) self.webView.setUrl(QtCore.QUrl(http://www.google.com;)) self.webView.setObjectName(webView) self.verticalLayout.addWidget(self.webView) self.retranslateUi(dial_Projet2) QtCore.QMetaObject.connectSlotsByName(dial_Projet2) def retranslateUi(self, dial_Projet2): dial_Projet2.setWindowTitle(QtGui.QApplication.translate(dial_Projet2, Projet n°2, None, QtGui.QApplication.UnicodeUTF8)) from PyQt4 import QtWebKit if __name__ == __main__: import sys app = QtGui.QApplication(sys.argv) dial_Projet2 = QtGui.QDialog() ui = Ui_dial_Projet2() ui.setupUi(dial_Projet2) dial_Projet2.show() sys.exit(app.exec_()) ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] dir() for PyQt 4.5 modules
Hi! I using pylint, and it complains about importing PyQt modules (PyQt 4.5 snapshots) a lot, like No module 'QtCore' in 'PyQt4'. Same thing with PyQt classes. Seems like dir() function does not show contents of PyQt4 modules. Thanks Alexey. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Call for better SIP documentation (perhaps on wiki)
On Sat, Apr 18, 2009 at 4:11 PM, David Boddie da...@boddie.org.uk wrote: [..} Here are two possible starting points: http://www.diotavelli.net/PyQtWiki/MiniSipExample http://wiki.python.org/moin/SIP Here is another nice one: http://www.rkblog.rk.edu.pl/w/p/making-pyqt4-widgets-sip/ Henning ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Eclipse sliding info panels
On Montag, 20. April 2009, Scott Ballard wrote: For those who haven't seen the sliding info panels in the Eclipses IDE they are great. They slide out over the main working area and collapse out of sight when you click back into the main working area. Makes it really convenient to get/edit data. They differ from splitting a Frame in two with QSplitter in that it doesn't change the dimensions of the main pane. They ride over the top of the main pane. I'm wondering if any one knows if this is possible in PyQt? It has been done in eric4 4.3.x. :-)) Detlev Cheers, -Scott __ Information from ESET NOD32 Antivirus, version of virus signature database 4020 (20090420) __ The message was checked by ESET NOD32 Antivirus. http://www.eset.com ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt -- Detlev Offenbach det...@die-offenbachs.de ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Regression in SIP sip-4.8-snapshot-20090409 wrt MappedTypes
On Mon, 20 Apr 2009 08:22:54 +0200, Simon Edwards si...@simonzone.com wrote: Phil Thompson wrote: On Sun, 19 Apr 2009 21:39:29 +0200, Simon Edwards si...@simonzone.com wrote: Phil Thompson wrote: sipForceConvertTo_*() (and related functions) are internal and should not be used by handwritten code. If it isn't documented then you can't use it. Thanks that helps a lot. Another question. 4.8 gives errors on PyKDE related it trying to use a copy constructor or operator=() on some classes which don't have one or have one which is private. It looks like SIP wants to use the copy constructor to copy a returned value from a method and then fails. Has anything changed? Have you got any tips about what I should be trying. If a copy ctor is private then SIP should be told about it - see qobject.sip. The copy ctor is included and private like many others. This might be a namespace related issue. Here is what I've got. It worked in SIP 4.8. class KEditListBox : QGroupBox { public: class CustomEditor { public: CustomEditor (); CustomEditor (QWidget* repWidget, KLineEdit* edit); CustomEditor (KComboBox* combo); private: CustomEditor (const KEditListBox::CustomEditor); }; // ... }; class KUrlRequester : KHBox { // ... public: explicit KUrlRequester (QWidget* parent /TransferThis/ = 0); explicit KUrlRequester (const KUrl url, QWidget* parent /TransferThis/ = 0); KUrlRequester (QWidget* editWidget, QWidget* parent /TransferThis/); const KEditListBox::CustomEditor customEditor (); // ^ This here fails. } /home/sbe/devel/kdesvninstall/include/keditlistbox.h: In function ‘PyObject* meth_KUrlRequester_customEditor(PyObject*, PyObject*)’: /home/sbe/devel/kdesvninstall/include/keditlistbox.h:77: error: ‘KEditListBox::CustomEditor::CustomEditor(const KEditListBox::CustomEditor)’ is private sipkiopart5.cpp:22797: error: within this context Try tonight's SIP snapshot. It's a problem with the new implicit copying of const reference results. Phil ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] How to survey the activity of the QSyntaxHighlighter ?
Hello, I would like to know if it is possible to know when the QSyntaxHighlighter does some chnages in the coloration of a text. Is-it possible or not ? C. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] Exposing complex Qt objects as javascript objects
Hi, I'm trying to create a Qt object that will be exposed to javascript. I want that javascript object to be complex: It has nested objects inside it, and has arrays with other objects in them. I'm not sure how to define the properties for the top object that I expose. pyqtProperty doesn't accept QVariant. (It returns the error TypeError: type 'QVariant' is not supported as a property type) I managed to go around it by defining a function that returns a QVariant: @pyqtSignature(fun(), result=QVariant) def fun(self): return QVariant({one:1, arr:[1,2,{three:3}], obj:{foo:bar} }) but I'd really like to have fun as a property instead of a function. What's the correct way to define such properties? Thanks, Ori ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] QLineEdit and focusOutEvent problem
Hello there, I'm new to the mailing list as well as PyQt in general, so please bare with me, and I apologize ahead of time for questions that may be trivial. So far I dig PyQt, I've been very pleased with everything, that is until I had my encounter with events. Maybe its lack of knowledge when it comes to event handling paradigm, but it just seems like plain voodoo to me. The current tool I am working on uses a QDialog as the main widget. Its being called as a dialog box for a custom plugin I have written for Nuke (compositing software). One of the behaviors I am trying to incorporate in several QLineEdit widgets is to execute the same method used on a returnPressed() Signal, or execute the signal itself. But I am getting ahead of myself here, executing logic is not the problem, its residue behavior that occurs when I either try to override a widgets focusOutEvent() or define an eventFilter for my object. I first used an event filter; this seemed like the most logical solution for what I needed, However when I setup the event trigger, it looked like the widget not losing focus properly. After I focused out by clicking on another widget, a text cursor would remain flashing in the widget. Also it didn't seem to update the stylesheet settings either. I have a my stylesheet assigning a different color border for whichever widget has focus. With the event filter, when a widget loses focus, the border remains highlighted unless I mouse over it. ...in the __init__() method self.ui.pth_ln.installEventFilter(self) self.ui.desc_ln.installEventFilter(self) self.ui.vrsn_ln.installEventFilter(self) def eventFilter(self, o, e): if o == self.ui.pth_ln: if e.type() == QtCore.QEvent.FocusOut: utils.executeInMainThread(nuke.tprint, ('path out focus',)) self.ui.pth_ln.clearFocus() return True else: return False if o == self.ui.desc_ln: if e.type() == QtCore.QEvent.FocusOut: utils.executeInMainThread(nuke.tprint, ('description out focus',)) self.ui.desc_ln.clearFocus() return True else: return False if o == self.ui.vrsn_ln: if e.type() == QtCore.QEvent.FocusOut: utils.executeInMainThread(nuke.tprint, ('version out focus',)) self.ui.vrsn_ln.clearFocus() return True else: return False #else: return self.eventFilter(o,e) In place of the methods I want to execute I used nukes terminal print method. My second try was to override the widget's focusOutEvent. Here is what I did In my __init__() method, I have: self.ui.pth_ln.focusOutEvent = self.path_focusOutEvent self.ui.desc_ln.focusOutEvent = self.desc_focusOutEvent self.ui.vrsn_ln.focusOutEvent = self.vrsn_focusOutEvent and the corresponding methods: def pth_FocusOutEvent(self, event): utils.executeInMainThread(nuke.tprint, ('path off focus',)) self.ui.pth_ln.clearFocus() event.accept() def desc_FocusOutEvent(self, event): utils.executeInMainThread(nuke.tprint, ('description off focus',)) self.ui.desc_ln.clearFocus() event.accept() def vrsn_FocusOutEvent(self, event): utils.executeInMainThread(nuke.tprint, ('version off focus',)) self.ui.vrsn_ln.clearFocus() event.accept() Again, same behavior as found in the event filters. So it seems like when the default event is getting overridden, I am not introducing back code that enables the behavior I am after, As if the widget is not being fully released, that still thinks has focus even though the keyboard has been released from the widget. So, I don't know. I am hoping someone can enlighten me on how to get it to work, or maybe even suggest a work around that doesn't use events but signals instead, I seem to have better luck with those. Thanks, Greg ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt