Re: [PyQt] First bottom-up GUI, acting strange
Nonyaz wrote: I made an attempt to port over a little command line file DL script I wrote into a GUI as a practice working with PyQt. While I have seemingly achieved that goal, the resulting product is not acting as I suspected. When I start a download, the GUI will continue to update as long as I don't click it, as soon as I do, the OS throws up Not Responding in the title bar and the GUI no longer updates. Even when I don't click it, I can tell somethings not right, the start button never releases, and the progress bar effects on vista are not apparent. Hopefully someone can point out to me what I'm doing wrong, I have a feeling its just bad event loop execution, although I'm not quite sure how I could rewrite it so it wouldn't have this problem. import urllib, os, time, sys, win32con import win32clipboard as w from PyQt4.QtCore import * from PyQt4.QtGui import * class Window(QDialog): def __init__(self, parent=None): super(Window, self).__init__(parent) self.lineedit = QLineEdit() self.getclip = QCommandLinkButton(Poll Clipboard) self.progbar = QProgressBar() self.speed = QLabel() self.status = QLabel() self.startb = QPushButton(Start DL) grid = QGridLayout() buttlay = QHBoxLayout() buttlay.addStretch() buttlay.addWidget(self.startb) grid.addWidget(self.lineedit,0,0) grid.addWidget(self.getclip,0,1) grid.addWidget(self.progbar,1,0,1,0) grid.addWidget(self.status,3,0) grid.addWidget(self.speed,3,1) grid.addLayout(buttlay,4,1) self.setLayout(grid) self.setWindowTitle(Clipboard DL V.001) self.lineedit.setText(getText()) self.lineedit.setMinimumSize(300,0) self.startb.setMaximumSize(75,300) self.connect(self.startb, SIGNAL(clicked()), fileDL) self.connect(self.getclip, SIGNAL(clicked()), setClipText) class myURLOpener(urllib.FancyURLopener): def http_error_206(self, url, fp, errcode, errmsg, headers, data=None): print I've been 206'd! pass def getText(): w.OpenClipboard() try: d = w.GetClipboardData(win32con.CF_TEXT) except: d = None. w.CloseClipboard() if d[:7] != http://: d = Clipboard does not contain a valid URL. return d def fileDL(): loop = 1 existSize = 0 dlFile = getFilename() url = str(daprog.lineedit.text()) myUrlclass = myURLOpener() webPage = myUrlclass.open(url) contentLength = int(webPage.headers['Content-Length']) if os.path.exists(str(dlFile)): outputFile = open(dlFile,ab) existSize = os.path.getsize(dlFile) if existSize contentLength: webPage.close() myUrlclass = None myUrlclass = myURLOpener() myUrlclass.addheader(Range,bytes=%s- % (existSize)) webPage = myUrlclass.open(url) else: try: outputFile = open(dlFile,wb) except: os.mkdir(dldir+'/'+show) outputFile = open(dlFile,wb) existSize = 0 if existSize == contentLength: daprog.status.setText(All %s bytes already downloaded!\n % (contentLength)) raw_input() loop = 0 elif existSize == 0: pass elif existSize contentLength: daprog.status.setText(Resuming download) numBytes = existSize daprog.status.setText(Download Started) counterr = 0 while loop: if counterr == 0: intime = time.time() daprog.progbar.setValue((float(numBytes)/float(contentLength)*100)) data = webPage.read(8192) if not data: break outputFile.write(data) numBytes += len(data) if counterr == 10: counterr = -1 outtime = time.time() lab = %.2f KB/s % (((8192*10)/(outtime-intime))/1000) daprog.speed.setText(lab) counterr += 1 daprog.progbar.setValue(100) daprog.status.setText(Done) webPage.close() outputFile.close() def getFilename(): hack_fin = 0 fname = '' for x in str(daprog.lineedit.text())[::-1]: if x == /: hack_fin = 1 if x != /: if hack_fin == 0: fname += x return fname[::-1] def setClipText(): daprog.lineedit.setText(getText()) app = QApplication(sys.argv) daprog = Window() daprog.show() daprog.exec_() Thanks for your help, - Adam ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt Could it be that you need a QApplication.processEvents() call in your while loop? This command gives some CPU to the GUI to update itself. I'm afraid the while loop eats all CPU and there's no time/possibility to update the UI... From the documentation (QCoreApplication.processEvents()): You can call this function occasionally when your program is busy performing a long operation
Re: [PyQt] First bottom-up GUI, acting strange
Looking over your code, I suspect the problem is with this line: data = webPage.read(8192) if not data: break Unless data is 0 or None, it will go into an infinite loop. From your description, it does not sound like it will ever return 0. It is also not good programming practice to write loops that are by nature always True. I suggest you use the total number of bytes instead as the condition for your loop, so after x amount of bytes is read or written, the loop finishes. I also suggest making the download in a separate thread, to avoid locking up the GUI during long downloads (because the while loop is going to be using up all the CPU time for your app, without giving the Qt event loop a chance to run). - Original Message - From: Nonyaz che...@nonyaz.com To: pyqt@riverbankcomputing.com Sent: Saturday, April 18, 2009 11:58 PM Subject: [PyQt] First bottom-up GUI, acting strange I made an attempt to port over a little command line file DL script I wrote into a GUI as a practice working with PyQt. While I have seemingly achieved that goal, the resulting product is not acting as I suspected. When I start a download, the GUI will continue to update as long as I don't click it, as soon as I do, the OS throws up Not Responding in the title bar and the GUI no longer updates. Even when I don't click it, I can tell somethings not right, the start button never releases, and the progress bar effects on vista are not apparent. Hopefully someone can point out to me what I'm doing wrong, I have a feeling its just bad event loop execution, although I'm not quite sure how I could rewrite it so it wouldn't have this problem. import urllib, os, time, sys, win32con import win32clipboard as w from PyQt4.QtCore import * from PyQt4.QtGui import * class Window(QDialog): def __init__(self, parent=None): super(Window, self).__init__(parent) self.lineedit = QLineEdit() self.getclip = QCommandLinkButton(Poll Clipboard) self.progbar = QProgressBar() self.speed = QLabel() self.status = QLabel() self.startb = QPushButton(Start DL) grid = QGridLayout() buttlay = QHBoxLayout() buttlay.addStretch() buttlay.addWidget(self.startb) grid.addWidget(self.lineedit,0,0) grid.addWidget(self.getclip,0,1) grid.addWidget(self.progbar,1,0,1,0) grid.addWidget(self.status,3,0) grid.addWidget(self.speed,3,1) grid.addLayout(buttlay,4,1) self.setLayout(grid) self.setWindowTitle(Clipboard DL V.001) self.lineedit.setText(getText()) self.lineedit.setMinimumSize(300,0) self.startb.setMaximumSize(75,300) self.connect(self.startb, SIGNAL(clicked()), fileDL) self.connect(self.getclip, SIGNAL(clicked()), setClipText) class myURLOpener(urllib.FancyURLopener): def http_error_206(self, url, fp, errcode, errmsg, headers, data=None): print I've been 206'd! pass def getText(): w.OpenClipboard() try: d = w.GetClipboardData(win32con.CF_TEXT) except: d = None. w.CloseClipboard() if d[:7] != http://: d = Clipboard does not contain a valid URL. return d def fileDL(): loop = 1 existSize = 0 dlFile = getFilename() url = str(daprog.lineedit.text()) myUrlclass = myURLOpener() webPage = myUrlclass.open(url) contentLength = int(webPage.headers['Content-Length']) if os.path.exists(str(dlFile)): outputFile = open(dlFile,ab) existSize = os.path.getsize(dlFile) if existSize contentLength: webPage.close() myUrlclass = None myUrlclass = myURLOpener() myUrlclass.addheader(Range,bytes=%s- % (existSize)) webPage = myUrlclass.open(url) else: try: outputFile = open(dlFile,wb) except: os.mkdir(dldir+'/'+show) outputFile = open(dlFile,wb) existSize = 0 if existSize == contentLength: daprog.status.setText(All %s bytes already downloaded!\n % (contentLength)) raw_input() loop = 0 elif existSize == 0: pass elif existSize contentLength: daprog.status.setText(Resuming download) numBytes = existSize daprog.status.setText(Download Started) counterr = 0 while loop: if counterr == 0: intime = time.time() daprog.progbar.setValue((float(numBytes)/float(contentLength)*100)) data = webPage.read(8192) if not data: break outputFile.write(data) numBytes += len(data) if counterr == 10: counterr = -1 outtime = time.time() lab = %.2f KB/s % (((8192*10)/(outtime-intime))/1000) daprog.speed.setText(lab) counterr += 1 daprog.progbar.setValue(100) daprog.status.setText(Done) webPage.close() outputFile.close() def getFilename(): hack_fin = 0 fname = '' for x in str(daprog.lineedit.text())[::-1]: if x == /: hack_fin = 1
[PyQt] Regression in SIP sip-4.8-snapshot-20090409 wrt MappedTypes
Hello Phil, I'm working on getting PyKDE4 trunk working on SIP 4.8 and PyQt 4.5 and hit what looks like a fairly straight forward regression bug. The compile error is: /home/sbe/devel/svn/kde/trunk/KDE/kdebindings/python/pykde4/sip/kdecore/typedefs.sip: In function ‘int convertTo_KSharedPtr_0200DNSSD_RemoteService(PyObject*, void**, int*, PyObject*)’: /home/sbe/devel/svn/kde/trunk/KDE/kdebindings/python/pykde4/sip/kdecore/typedefs.sip:247: error: ‘sipForceConvertTo_DNSSD’ was not declared in this scope /home/sbe/devel/svn/kde/trunk/KDE/kdebindings/python/pykde4/sip/kdecore/typedefs.sip:247: error: expected ‘,’ or ‘;’ before ‘::’ token The offending C++ code is: DNSSD::RemoteService *cpp = (DNSSD::RemoteService *)sipForceConvertTo_DNSSD::RemoteService (sipPy, iserr); which was expanded from the mapped type: --- template TYPE %MappedType KSharedPtrTYPE { // ... etc etc ... %ConvertToTypeCode // Convert a Python instance to a Ptr on the heap. if (sipIsErr == NULL) return PyInstance_Check(sipPy); int iserr = 0; TYPE *cpp = (TYPE *)sipForceConvertTo_TYPE (sipPy, iserr); // ... etc etc ... --- elsewhere in the sip files I've got this which sets it all in motion: typedef KSharedPtrDNSSD::RemoteService Ptr; 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
Re: [PyQt] __setitem__ Problem
Thanks! Problem solved. Works fine with overloaded __setitem__'s too. Neil Birkbeck On Sat, Apr 18, 2009 at 9:56 AM, Phil Thompson p...@riverbankcomputing.comwrote: On Thu, 16 Apr 2009 12:26:17 -0600 (MDT), Neil Birkbeck birkb...@cs.ualberta.ca wrote: In older versions of sip (4.7.3), I have used __setitem__, __getitem__ to access/set elements from multidimensional quantities of a wrapped c++ object that uses operator()(int,int). For example, the following sip code used to work fine class A { int operator()(int x,int y) const; int __getitem__(int x,int y) const; %MethodCode ... %End void __setitem__(int x,int y, int val) const; %MethodCode ... %End }; From the ChangeLog this feature seemed to have been removed (in a related mailing list post, it was reported that the above usage was a bug http://article.gmane.org/gmane.comp.python.pyqt-pykde/12342/match=sip+__setitem__ ). With the new checking (sip 4.7.9, possibly earlier), the above code will now give an error (e.g., sip: A.sip:18: Incorrect number of arguments to Python slot). The previous mailing list post (http://thread.gmane.org/gmane.comp.python.pyqt-pykde/12342) suggested to either not use __setitem__/__getitem__ for this purpose or to use a tuple. I updated my code and the tuples work fine for __getitem__, but I cannot seem to get the tuple to work for __setitem__. For example, A.sip: class A { int __getitem(int x,int y); %MethodCode //This is just a dummy, actually parse the tuple and extract indices... %End void __setitem__(SIP_PYOBJECT, SIP_PYOBJECT); %MethodCode //Do something here %End }; Python test: from A import A a = A(10,10) # Getting works fine, no error parsing arguments b = a[0,0] b = a[0] # Setting works with anything but tuple a[0] = 1 # Works fine a[[1,2]] = 1 # Also works, but is not really a desired syntax a[0:5] = 1 # Works, would check for this when parsing args. a[(0,1)] = 1 # Error: TypeError: too many arguments to A.__setitem__(), 2 at most expected a[0,1] = 1 # Same error tup = (0,1) a[tup] = 1 # Same error The tuple always gets unpacked into more than one argument for __setitem__ and causes the TypeError, which happens before any of the sip %MethodCode can be called. Looking at the generated code for the __setitem__, the parsing of args looks something like: sipParseArgs(sipArgsParsed,sipArgs,P0P0,a0,a1) On the other hand, the parsing of args for __getitem__ seems to work due to the single arg format of 1P0. Manually editing the generated code to return the args packed into a single tuple (including the set value) like __getitem__ works but is not a satisfying solution. Changing the function signature of __setitem__ to take a SIP_PYTUPLE as the first argument also does not help, although it does change the sipParseArgs format to TP0 (e.g., sipParseArgs(sipArgsParsed,sipArgs,TP0,PyTuple_Type,a0,a1)). I suspect this call would succeed if there was a way to make sipParseArgs put the first n-1 sipArgs into a0 and the last argument into a1. The parsing of arguments for other methods with similar signature, e.g., void afunc(SIP_PYOBJECT, SIP_PYOBJECT), does indeed accept stuff like afunc((1,2), 0), so the problem appears to be with __setitem__. I could be doing something wrong as no one else appears to be having this problem. If not, is there a some other way to force the argument parsing to put the first args into a tuple? Or is there a way to do it by hand (like a NoArgParser for member functions)?Currently, I modified the sip source (in sipgen/parser.c:findFunction, line 7642, {__setitem__, setitem_slot, TRUE, -1}) to not check the # of arguments to __setitem__/__getitem__. For the time being, this gives the behaviour of the older version, so that I can remain using my old sip files (like the beginning of this post). Try tonight's SIP snapshot. Use __setitem__(SIP_PYTUPLE, SIP_PYOBJECT) and then unpack the tuple as you are in your __getitem__. Thanks, Phil ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] ANN: New eric 4.4 snapshot released
Hi, I'd like to inform all of you about the immediate availability of a new eric 4.4 snapshot. It fixes a few bugs and adds these new features. - added a thread list viewer to the debug viewer - added support for forking to the Python debuggers - added code for handling infinite recursions to the Python debuggers - added code to make it compatible with PyQt 4.5.0 or newer - added Italian translations contributed by Gianluca - added capability to open the help window with a search word - added configuration option to disable spell checking - added Python 3 compatibility code to the Pythe re wizard - removed the Python cycles finder because that is not needed anymore - changed the find in files dialog to show the current file - added some improvements to the find/replace in files dialog - added a navigation menu to the tabview viewmanager - added code to check, if a project needs to be reread after an update from the repository (e.g. if files have been added or deleted) - added an auto update feature to the VCS status monitor (needs to be activated via the configuration dialog) It is available via http://sourceforge.net/project/showfiles.php?group_id=119070package_id=300692. Regards Detlev -- 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 Sun, 19 Apr 2009 10:25:11 +0200, Simon Edwards si...@simonzone.com wrote: Hello Phil, I'm working on getting PyKDE4 trunk working on SIP 4.8 and PyQt 4.5 and hit what looks like a fairly straight forward regression bug. The compile error is: /home/sbe/devel/svn/kde/trunk/KDE/kdebindings/python/pykde4/sip/kdecore/typedefs.sip: In function ‘int convertTo_KSharedPtr_0200DNSSD_RemoteService(PyObject*, void**, int*, PyObject*)’: /home/sbe/devel/svn/kde/trunk/KDE/kdebindings/python/pykde4/sip/kdecore/typedefs.sip:247: error: ‘sipForceConvertTo_DNSSD’ was not declared in this scope /home/sbe/devel/svn/kde/trunk/KDE/kdebindings/python/pykde4/sip/kdecore/typedefs.sip:247: error: expected ‘,’ or ‘;’ before ‘::’ token The offending C++ code is: DNSSD::RemoteService *cpp = (DNSSD::RemoteService *)sipForceConvertTo_DNSSD::RemoteService (sipPy, iserr); which was expanded from the mapped type: --- template TYPE %MappedType KSharedPtrTYPE { // ... etc etc ... %ConvertToTypeCode // Convert a Python instance to a Ptr on the heap. if (sipIsErr == NULL) return PyInstance_Check(sipPy); int iserr = 0; TYPE *cpp = (TYPE *)sipForceConvertTo_TYPE (sipPy, iserr); // ... etc etc ... --- elsewhere in the sip files I've got this which sets it all in motion: typedef KSharedPtrDNSSD::RemoteService Ptr; 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. For SIP prior to v4.8 you should use sipForceConvertToInstance(). For v4.8 then sipForceConvertToType() is preferred (though the former will be supported for all SIP v4.x versions). The advantage of the latter is that it will automatically handle (for example) QString when it is implemented as a wrapped class or a mapped type. Phil ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Re: tooltips in menu: how?
This is normal. When the menu is activated ther is no reason to give a tooltip about it because we know wath is in. Christophe. Wolfgang Rohdewald a écrit : this code works here too - but not always. First place the mouse over the menu and wait until the tooltip Click here... appears now click on it and move the mouse to the menu entries. No tooltips. They only appear if the click here... was not visible when opening the menu. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] First bottom-up GUI, acting strange
On Sun, Apr 19, 2009 at 3:05 AM, Geert Vancompernolle geert.vancomperno...@gmail.com wrote: Could it be that you need a QApplication.processEvents() call in your while loop? This command gives some CPU to the GUI to update itself. I'm afraid the while loop eats all CPU and there's no time/possibility to update the UI... I stuck a QApplication.processEvents() in the loop just like you said and it freed the GUI right up! I'ts still not quite 100% fluid, but its to be expected, and without threading, probably the best I can do. On Sun, Apr 19, 2009 at 3:22 AM, Demetrius Cassidy dcassid...@mass.rr.com wrote: Looking over your code, I suspect the problem is with this line: data = webPage.read(8192) if not data: break Unless data is 0 or None, it will go into an infinite loop. From your description, it does not sound like it will ever return 0. It is also not good programming practice to write loops that are by nature always True. I suggest you use the total number of bytes instead as the condition for your loop, so after x amount of bytes is read or written, the loop finishes. I also suggest making the download in a separate thread, to avoid locking up the GUI during long downloads (because the while loop is going to be using up all the CPU time for your app, without giving the Qt event loop a chance to run). It wont infinite loop, it just keeps reading until it EOL's and then breaks out of the loop. The problem with using the headers from the server, is that I've had situations where that information is not available and thus I wouldn't be able to construct my loop. I agree with the threading idea, that is the ideal fix, unfortunately threading is in chapter 19 of my book, and I'm currently on 5 :) Thanks again for all your help! -Adam On Sun, Apr 19, 2009 at 3:05 AM, Geert Vancompernolle geert.vancomperno...@gmail.com wrote: Nonyaz wrote: I made an attempt to port over a little command line file DL script I wrote into a GUI as a practice working with PyQt. While I have seemingly achieved that goal, the resulting product is not acting as I suspected. When I start a download, the GUI will continue to update as long as I don't click it, as soon as I do, the OS throws up Not Responding in the title bar and the GUI no longer updates. Even when I don't click it, I can tell somethings not right, the start button never releases, and the progress bar effects on vista are not apparent. Hopefully someone can point out to me what I'm doing wrong, I have a feeling its just bad event loop execution, although I'm not quite sure how I could rewrite it so it wouldn't have this problem. import urllib, os, time, sys, win32con import win32clipboard as w from PyQt4.QtCore import * from PyQt4.QtGui import * class Window(QDialog): def __init__(self, parent=None): super(Window, self).__init__(parent) self.lineedit = QLineEdit() self.getclip = QCommandLinkButton(Poll Clipboard) self.progbar = QProgressBar() self.speed = QLabel() self.status = QLabel() self.startb = QPushButton(Start DL) grid = QGridLayout() buttlay = QHBoxLayout() buttlay.addStretch() buttlay.addWidget(self.startb) grid.addWidget(self.lineedit,0,0) grid.addWidget(self.getclip,0,1) grid.addWidget(self.progbar,1,0,1,0) grid.addWidget(self.status,3,0) grid.addWidget(self.speed,3,1) grid.addLayout(buttlay,4,1) self.setLayout(grid) self.setWindowTitle(Clipboard DL V.001) self.lineedit.setText(getText()) self.lineedit.setMinimumSize(300,0) self.startb.setMaximumSize(75,300) self.connect(self.startb, SIGNAL(clicked()), fileDL) self.connect(self.getclip, SIGNAL(clicked()), setClipText) class myURLOpener(urllib.FancyURLopener): def http_error_206(self, url, fp, errcode, errmsg, headers, data=None): print I've been 206'd! pass def getText(): w.OpenClipboard() try: d = w.GetClipboardData(win32con.CF_TEXT) except: d = None. w.CloseClipboard() if d[:7] != http://: d = Clipboard does not contain a valid URL. return d def fileDL(): loop = 1 existSize = 0 dlFile = getFilename() url = str(daprog.lineedit.text()) myUrlclass = myURLOpener() webPage = myUrlclass.open(url) contentLength = int(webPage.headers['Content-Length']) if os.path.exists(str(dlFile)): outputFile = open(dlFile,ab) existSize = os.path.getsize(dlFile) if existSize contentLength: webPage.close() myUrlclass = None myUrlclass = myURLOpener() myUrlclass.addheader(Range,bytes=%s- % (existSize)) webPage = myUrlclass.open(url) else: try: outputFile = open(dlFile,wb) except: os.mkdir(dldir+'/'+show) outputFile = open(dlFile,wb)
[PyQt] Link between a QWebViev and a JavaScript program
Hello, I'm seeking for information about how to comunicate from PyQt with a JavaScript program. All kind of information is welcome. Christophe. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Link between a QWebViev and a JavaScript program
projetmbc wrote: I'm seeking for information about how to comunicate from PyQt with a JavaScript program. QWebFrame's evaluateJavaScript() might be a start. -- 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
Re: [PyQt] Link between a QWebViev and a JavaScript program
Simon Edwards a écrit : projetmbc wrote: I'm seeking for information about how to comunicate from PyQt with a JavaScript program. QWebFrame's evaluateJavaScript() might be a start. I also found a whitepaper of QT. I'll try to test that. Thanks for showing me the direction. Christophe. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Regression in SIP sip-4.8-snapshot-20090409 wrt MappedTypes
Hi, 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. thanks, -- 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
Re: [PyQt] Link between a QWebViev and a JavaScript program
Simon Edwards a écrit : projetmbc wrote: I'm seeking for information about how to comunicate from PyQt with a JavaScript program. QWebFrame's evaluateJavaScript() might be a start. Indeed I'm looking for a simple example rather than an abstract one. Christophe. ___ 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 Sun, 19 Apr 2009 21:39:29 +0200, Simon Edwards si...@simonzone.com wrote: Hi, 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. Phil ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Link between a QWebViev and a JavaScript program
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);});) ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Link between a QWebViev and a JavaScript program
On Sun Apr 19 20:51:49 BST 2009, projetmbc wrote: Simon Edwards a écrit : projetmbc wrote: I'm seeking for information about how to comunicate from PyQt with a JavaScript program. QWebFrame's evaluateJavaScript() might be a start. Indeed I'm looking for a simple example rather than an abstract one. 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. Still, 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 David ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Re: tooltips in menu: how?
On Sonntag, 19. April 2009, projetmbc wrote: This is normal. When the menu is activated ther is no reason to give a tooltip about it because we know wath is in. 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. 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? -- Wolfgang ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] QDirModel populating QTreeView in Windows Slow Response
I populate QTreeView with QDirModel ... While EXECUTING. It takes much time to generate the TREE Structure... Is it true! QDirModel - QTreeView takes much time? Say 5-6 Sec~! I m using XP in Intel Penti Dual CPU, 2ghz, 2gb RAM! -- View this message in context: http://www.nabble.com/QDirModel-populating-QTreeView-in-Windows-Slow-Response-tp23089544p23089544.html Sent from the PyQt mailing list archive at Nabble.com. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] QDirModel populating QTreeView in Windows Slow Response
Could be that one of your drives has gone to sleep. It takes a couple of seconds for the drive to wake up and give a directory listing. Its not that slow on my machine. -Scott akumarzen wrote: I populate QTreeView with QDirModel ... While EXECUTING. It takes much time to generate the TREE Structure... Is it true! QDirModel - QTreeView takes much time? Say 5-6 Sec~! I m using XP in Intel Penti Dual CPU, 2ghz, 2gb RAM! __ Information from ESET NOD32 Antivirus, version of virus signature database 4019 (20090418) __ The message was checked by ESET NOD32 Antivirus. http://www.eset.com ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] Emulate WIN-DOS Capture results live, How to achive?
Instead of os.popen or subprocess to execute SINGLE DOS COMMAND to capture back its output in python... Is there anyway I can capture the intermid results simultaneously that appears in DOS? Eg: import os x = os.popen('ping 127.0.0.1').read() print x This print the entire output of PING. But I would like to receive the RESULTS line by line when PING send out to DOS. Is it possible? -- View this message in context: http://www.nabble.com/Emulate-WIN-DOS-Capture-results-live%2C-How-to-achive--tp23129514p23129514.html Sent from the PyQt mailing list archive at Nabble.com. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt