help! PyQt4 and UTF-8
I can display UTF-8 when I use wxPython: -- import wx app = wx.App() s = 'testing\xf0\x9f\x98\x80' frame = wx.Frame(None, wx.ID_ANY) font = wx.Font("Arial") textbox = wx.TextCtrl(frame, id=wx.ID_ANY) textbox.SetFont(font) textbox.WriteText(s) frame.Show() app.MainLoop() -- But when I try the same thing with PyQt4.. -- from PyQt4 import QtGui import sys s = 'testing\xf0\x9f\x98\x80' app = QtGui.QApplication(sys.argv) w = QtGui.QWidget() font = QtGui.QFont("Arial") textbox = QtGui.QLineEdit(w) textbox.setFont(font) textbox.setText(s) w.show() sys.exit(app.exec_()) -- Instead of "testing😀" ("testing" with a smiley face after it, if you can't see it in this message), I get "testingð" ("testing", then an o with some kind of mark above it). I tried replacing "s = 'testing\xf0\x9f\x98\x80'" with "s = 'testing\xf0\x9f\x98\x80'.decode('UTF-8')" in case PyQt takes Unicode instead of UTF-8, but in that case I get "testing" and then a little square after it (like the character isn't found in the font). If I copy it and paste it here I get "testing😀" ("testing" with a smiley face after it, like I want), so I guess displaying it in the font is the problem, but I don't know why.. as you can see, both the wxPython and the PyQt examples use "Arial." I've also tried "FixedSys Excelsior 3.01". Python version: CPython 2.7.14 OS: Windows 10 thanks for any help -- https://mail.python.org/mailman/listinfo/python-list
Re: PyQt4 QWebView cant load google maps markers
tell some solution ?yes you are correct for some seconds show me the mark but only for some seconds.can i update my pyqt4 to show me the mark ? -- https://mail.python.org/mailman/listinfo/python-list
Re: PyQt4 QWebView cant load google maps markers
Xristos Xristoou writes: > I want to create a simple python app using pyqt,QWebView and google maps with > markers. > > The problem is that,the markers does not load inside the QWebView, as > you can see they load just fine in the browser. Well, since you got a javascript error, maybe Qt4 doesn't support the version of javascript Google uses today? Qt4 was released over a decade ago. I tried with PyQt5 and the page loads and a marker shows up. It then disappears as Google puts up a couple of popups. There's a complaint about browser capabilities and also a privacy note from Google. -- https://mail.python.org/mailman/listinfo/python-list
PyQt4 QWebView cant load google maps markers
I want to create a simple python app using pyqt,QWebView and google maps with markers. The problem is that,the markers does not load inside the QWebView, as you can see they load just fine in the browser. here the simple code : import sys from PyQt4.QtCore import * from PyQt4.QtGui import * from PyQt4.QtWebKit import * import os app = QApplication(sys.argv) web_view= dialog.findChild(QWebView,"webView") google='https://www.google.gr/maps/place/Granite+Mountain+Hotshots+Memorial+State+Park/@34.1749572,-112.850308,12.78z/data=!4m13!1m7!3m6!1s0x872b08ebcb4c186b:0x423927b17fc1cd71!2zzpHPgc65zrbPjM69zrEsIM6Xzr3Pic68zq3Ovc61z4IgzqDOv867zrnPhM61zq_Otc-C!3b1!8m2!3d34.0489281!4d-111.0937311!3m4!1s0x80d330577faee965:0x66d75aef24890ae1!8m2!3d34.2032843!4d-112.7746582?hl=el' web_view2.load(QUrl(google)) web_view2.show() sys.exit(app.exec_()) error message : right click and select Inspect, then go to console and observe the messages console I take this error : TypeError: 'undefined' is not a function (evaluating 'this.D.bind(this)') marker.js:58 Any idea how to can fix that ? I need to add more settings to QWebView to work google maps with markers ? -- https://mail.python.org/mailman/listinfo/python-list
PyQt4 QWebView cant load google maps markers
I want to create a simple python app using pyqt,QWebView and google maps with markers. The problem is that,the markers does not load inside the QWebView, as you can see they load just fine in the browser. here the simple code : import sys from PyQt4.QtCore import * from PyQt4.QtGui import * from PyQt4.QtWebKit import * import os app = QApplication(sys.argv) web_view= dialog.findChild(QWebView,"webView") google='https://www.google.gr/maps/place/Granite+Mountain+Hotshots+Memorial+State+Park/@34.1749572,-112.850308,12.78z/data=!4m13!1m7!3m6!1s0x872b08ebcb4c186b:0x423927b17fc1cd71!2zzpHPgc65zrbPjM69zrEsIM6Xzr3Pic68zq3Ovc61z4IgzqDOv867zrnPhM61zq_Otc-C!3b1!8m2!3d34.0489281!4d-111.0937311!3m4!1s0x80d330577faee965:0x66d75aef24890ae1!8m2!3d34.2032843!4d-112.7746582?hl=el' web_view2.load(QUrl(google)) web_view2.show() sys.exit(app.exec_()) error message : right click and select Inspect, then go to console and observe the messages console I take this error : TypeError: 'undefined' is not a function (evaluating 'this.D.bind(this)') marker.js:58 Any idea how to can fix that ? I need to add more settings to QWebView to work google maps with markers ? -- https://mail.python.org/mailman/listinfo/python-list
Re: python and pyqt4
On 2017-03-14 21:03, Vincent Vande Vyvre wrote: Le 14/03/17 à 20:56, Xristos Xristoou a écrit : i will want to create a simple python script with pyqt4 and Q designer where the user put a number (line_edit) and if that number is something the user take back three new codes(lineEdit_2,lineEdit_3,lineEdit_4) and if user press ok(buttonBox) then plugin do something else in the some GUI. for that i create a new additional pushButton in Qdesigner and i create additional def function(run1) for execute code for pushButton. first i add new pushbutton in __init__ : def __init__(self, iface): self.dlg = pluginDialog() self.dlg.pushButton.clicked.connect(self.run1) plugin work without error but dont show me the codes (lineEdit_2,lineEdit_3,lineEdit_4) in the plugin window if i press pushbutton any idea ? my python code : def run1(self): distance = str(self.dlg.lineEdit.text()) if distance==0: area1='some' area2='hello' area3='world' self.dlg.lineEdit_2.setText(str(area1)) self.dlg.lineEdit_3.setText(str(area2)) self.dlg.lineEdit_4.setText(str(area3)) def run(self): self.dlg.show() result = self.dlg.exec_() if result: pass and i try to replace run1 with : def run1(self): self.dlg.show() result = self.dlg.exec_() if result: distance = str(self.dlg.lineEdit.text()) if distance==0: area1='some' area2='hello' area3='world' self.dlg.lineEdit_2.setText(str(area1)) self.dlg.lineEdit_3.setText(str(area2)) self.dlg.lineEdit_4.setText(str(area3)) pass but no change. distance is a string, then you have to compare it with the string "0" not the integer In addition, if the condition is false, then area1, area2 and area3 won't exist, and you'll get a NameError (although the GUI might be hiding that from you!). -- https://mail.python.org/mailman/listinfo/python-list
Re: python and pyqt4
Le 14/03/17 à 20:56, Xristos Xristoou a écrit : i will want to create a simple python script with pyqt4 and Q designer where the user put a number (line_edit) and if that number is something the user take back three new codes(lineEdit_2,lineEdit_3,lineEdit_4) and if user press ok(buttonBox) then plugin do something else in the some GUI. for that i create a new additional pushButton in Qdesigner and i create additional def function(run1) for execute code for pushButton. first i add new pushbutton in __init__ : def __init__(self, iface): self.dlg = pluginDialog() self.dlg.pushButton.clicked.connect(self.run1) plugin work without error but dont show me the codes (lineEdit_2,lineEdit_3,lineEdit_4) in the plugin window if i press pushbutton any idea ? my python code : def run1(self): distance = str(self.dlg.lineEdit.text()) if distance==0: area1='some' area2='hello' area3='world' self.dlg.lineEdit_2.setText(str(area1)) self.dlg.lineEdit_3.setText(str(area2)) self.dlg.lineEdit_4.setText(str(area3)) def run(self): self.dlg.show() result = self.dlg.exec_() if result: pass and i try to replace run1 with : def run1(self): self.dlg.show() result = self.dlg.exec_() if result: distance = str(self.dlg.lineEdit.text()) if distance==0: area1='some' area2='hello' area3='world' self.dlg.lineEdit_2.setText(str(area1)) self.dlg.lineEdit_3.setText(str(area2)) self.dlg.lineEdit_4.setText(str(area3)) pass but no change. distance is a string, then you have to compare it with the string "0" not the integer Vincent -- https://mail.python.org/mailman/listinfo/python-list
python and pyqt4
i will want to create a simple python script with pyqt4 and Q designer where the user put a number (line_edit) and if that number is something the user take back three new codes(lineEdit_2,lineEdit_3,lineEdit_4) and if user press ok(buttonBox) then plugin do something else in the some GUI. for that i create a new additional pushButton in Qdesigner and i create additional def function(run1) for execute code for pushButton. first i add new pushbutton in __init__ : def __init__(self, iface): self.dlg = pluginDialog() self.dlg.pushButton.clicked.connect(self.run1) plugin work without error but dont show me the codes (lineEdit_2,lineEdit_3,lineEdit_4) in the plugin window if i press pushbutton any idea ? my python code : def run1(self): distance = str(self.dlg.lineEdit.text()) if distance==0: area1='some' area2='hello' area3='world' self.dlg.lineEdit_2.setText(str(area1)) self.dlg.lineEdit_3.setText(str(area2)) self.dlg.lineEdit_4.setText(str(area3)) def run(self): self.dlg.show() result = self.dlg.exec_() if result: pass and i try to replace run1 with : def run1(self): self.dlg.show() result = self.dlg.exec_() if result: distance = str(self.dlg.lineEdit.text()) if distance==0: area1='some' area2='hello' area3='world' self.dlg.lineEdit_2.setText(str(area1)) self.dlg.lineEdit_3.setText(str(area2)) self.dlg.lineEdit_4.setText(str(area3)) pass but no change. -- https://mail.python.org/mailman/listinfo/python-list
Re: PyQt4
Le 03/04/2016 21:36, Muhammad Ali a écrit : On Sunday, April 3, 2016 at 12:15:06 PM UTC-7, Michael Torrie wrote: On 04/03/2016 12:57 PM, Muhammad Ali wrote: Hi, How can we confirm that either PyQt4 is already installed on LInux machine or not? Please suggest commands to confirm the already existence of PyQt4 in the machine. Ideally you make a distribution-specific package of the binary in a .deb on Debian or an RPM on other distros, and specify that it depends on the package that provides PyQt4. That way when it's installed, modern package managers will automatically install the dependencies. Alternatively you can use try and except in your python code to attempt to import something from PyQt4 and see if it fails or not. This technique is also used to make your code work either PyQt4 or PySide, depending on which the user has installed. try: from PySide import QtGui except ImportError: from PyQt4 import QtGui If neither are installed, this little example will end with an ImportError. Thank you for your suggestions. I tried both but it shows the following error: IndentationError: expected an indented block Actually, I have to plot some graphs by using matplotlib and PyQt4 at supercomputer. Any other suggestion??? There's no IndentationError in the exemple provided by Michael. Copy the code AS IT in a file and retry. Vincent -- https://mail.python.org/mailman/listinfo/python-list
Re: PyQt4
On Sunday, April 3, 2016 at 12:15:06 PM UTC-7, Michael Torrie wrote: > On 04/03/2016 12:57 PM, Muhammad Ali wrote: > > > > Hi, > > > > How can we confirm that either PyQt4 is already installed on LInux machine > > or not? > > > > Please suggest commands to confirm the already existence of PyQt4 in the > > machine. > > Ideally you make a distribution-specific package of the binary in a .deb > on Debian or an RPM on other distros, and specify that it depends on the > package that provides PyQt4. That way when it's installed, modern > package managers will automatically install the dependencies. > > Alternatively you can use try and except in your python code to attempt > to import something from PyQt4 and see if it fails or not. This > technique is also used to make your code work either PyQt4 or PySide, > depending on which the user has installed. > > try: > from PySide import QtGui > except ImportError: > from PyQt4 import QtGui > > If neither are installed, this little example will end with an ImportError. Thank you for your suggestions. I tried both but it shows the following error: IndentationError: expected an indented block Actually, I have to plot some graphs by using matplotlib and PyQt4 at supercomputer. Any other suggestion??? -- https://mail.python.org/mailman/listinfo/python-list
Re: PyQt4
On 04/03/2016 12:57 PM, Muhammad Ali wrote: > > Hi, > > How can we confirm that either PyQt4 is already installed on LInux machine > or not? > > Please suggest commands to confirm the already existence of PyQt4 in the > machine. Ideally you make a distribution-specific package of the binary in a .deb on Debian or an RPM on other distros, and specify that it depends on the package that provides PyQt4. That way when it's installed, modern package managers will automatically install the dependencies. Alternatively you can use try and except in your python code to attempt to import something from PyQt4 and see if it fails or not. This technique is also used to make your code work either PyQt4 or PySide, depending on which the user has installed. try: from PySide import QtGui except ImportError: from PyQt4 import QtGui If neither are installed, this little example will end with an ImportError. -- https://mail.python.org/mailman/listinfo/python-list
PyQt4
Hi, How can we confirm that either PyQt4 is already installed on LInux machine or not? Please suggest commands to confirm the already existence of PyQt4 in the machine. Thank you. -- https://mail.python.org/mailman/listinfo/python-list
Re: Python 3.4.2 + PyQt4 + PyCharm 3.4.1
Resolved, kinda. Just use PySide instead of PyQt. Remove everything PyQt related from PyCharm and install PySide using the PyCharm plugins window. PySide has access to all modules and packages that PyQt has, but now you need to import like "from PySide.<**> import *". On Thu, Nov 6, 2014 at 12:50 farshad akbari wrote: > On Saturday, November 1, 2014 3:11:54 PM UTC+3:30, Juan Christian wrote: > > No one here uses PyCharm and Qt? =/ > > > > > > On Wed, Oct 29, 2014 at 8:45 PM, Juan Christian > wrote: > > > > It only occurs whule using PyCharm I tried it via pure terminal and > everything works... =/ > > > > > > > > > > On Tue, Oct 28, 2014 at 7:45 PM, Juan Christian > wrote: > > > > > > Python 3.4.2 Windows x64 > > PyQt4 4.11.2 Py3.4 Qt4.8.6 (x64) > > > > PyCharm 3.4.1 Pro Edition > > > > > > > > > > So, PyCharm works 100% with everything here but PyQt. > > > > > > I have this folder structure: > > > > > > Disk C: > > > PyQt4 > > >> Lib/site-packages/PyQt4/(tons of files here) > > > > > > > Python34 (normal/default installation) > > > > > > --- > > > > > > I tried copying the 'PyQt4' folder to my 'Python34/Lib/site-packages' > folder but when I try to code something Qt related on PyCharm I get this > issue: > > > > > > > > Some skeletons failed to generate: 19 modules failed in 1 interpreter. > Details... > > > > > > > > Failed modules > > > > > > Python 3.4.2 > > PyQt4.QAxContainer > > PyQt4.Qsci > > PyQt4.QtCore > > PyQt4.QtDeclarative > > PyQt4.QtDesigner > > PyQt4.QtGui > > PyQt4.QtHelp > > PyQt4.QtMultimedia > > PyQt4.QtNetwork > > PyQt4.QtOpenGL > > PyQt4.QtScript > > PyQt4.QtScriptTools > > PyQt4.QtSql > > PyQt4.QtSvg > > PyQt4.QtTest > > PyQt4.QtWebKit > > PyQt4.QtXml > > PyQt4.QtXmlPatterns > > PyQt4.phonon > > > > > > Generation of skeletons for the modules above will be tried again when > the modules are updated or a new version of generator is available. > > > > > > And PyCharm tells me that my 'import PyQt4.ANYTHING_HERE import *' has > 'Unresolved references'. > > > > > > --- > > > > > > When I try to install the PyQt4 via the installer, in the default > location (C:/Python34) I get an even 'worse' error, whenever PyCharm try to > update the skeletons or something like that (that is, whenever I open a > file there...), I get tons and tons of the same error, 'Error while > accessing memory at address ', and 'python.exe' stops working. > > i have this problem too, > and it's so annoying. > -- > https://mail.python.org/mailman/listinfo/python-list > -- https://mail.python.org/mailman/listinfo/python-list
Re: Python 3.4.2 + PyQt4 + PyCharm 3.4.1
On Saturday, November 1, 2014 3:11:54 PM UTC+3:30, Juan Christian wrote: > No one here uses PyCharm and Qt? =/ > > > On Wed, Oct 29, 2014 at 8:45 PM, Juan Christian wrote: > > It only occurs whule using PyCharm I tried it via pure terminal and > everything works... =/ > > > > > On Tue, Oct 28, 2014 at 7:45 PM, Juan Christian wrote: > > > Python 3.4.2 Windows x64 > PyQt4 4.11.2 Py3.4 Qt4.8.6 (x64) > > PyCharm 3.4.1 Pro Edition > > > > > So, PyCharm works 100% with everything here but PyQt. > > > I have this folder structure: > > > Disk C: > > PyQt4 > >> Lib/site-packages/PyQt4/(tons of files here) > > > > Python34 (normal/default installation) > > > --- > > > I tried copying the 'PyQt4' folder to my 'Python34/Lib/site-packages' folder > but when I try to code something Qt related on PyCharm I get this issue: > > > > Some skeletons failed to generate: 19 modules failed in 1 interpreter. > Details... > > > > Failed modules > > > Python 3.4.2 > PyQt4.QAxContainer > PyQt4.Qsci > PyQt4.QtCore > PyQt4.QtDeclarative > PyQt4.QtDesigner > PyQt4.QtGui > PyQt4.QtHelp > PyQt4.QtMultimedia > PyQt4.QtNetwork > PyQt4.QtOpenGL > PyQt4.QtScript > PyQt4.QtScriptTools > PyQt4.QtSql > PyQt4.QtSvg > PyQt4.QtTest > PyQt4.QtWebKit > PyQt4.QtXml > PyQt4.QtXmlPatterns > PyQt4.phonon > > > Generation of skeletons for the modules above will be tried again when the > modules are updated or a new version of generator is available. > > > And PyCharm tells me that my 'import PyQt4.ANYTHING_HERE import *' has > 'Unresolved references'. > > > --- > > > When I try to install the PyQt4 via the installer, in the default location > (C:/Python34) I get an even 'worse' error, whenever PyCharm try to update the > skeletons or something like that (that is, whenever I open a file there...), > I get tons and tons of the same error, 'Error while accessing memory at > address ', and 'python.exe' stops working. i have this problem too, and it's so annoying. -- https://mail.python.org/mailman/listinfo/python-list
PYQT4 referer in javascript still blank
Hello, I am trying to set referrer for my script this way in PYQT4: class NetworkManager(QNetworkAccessManager): def createRequest(self, op, req, outgoing_data): req.setRawHeader('Referer', 'http://www.my-university.com/') req.setRawHeader('Accept-Language', 'en') return super(NetworkManager, self).createRequest(op, req, outgoing_data) but when I use javascript document.write('js ref: ' + document.referrer +''); on my website it still returns empty line. When I use php $_SERVER["HTTP_REFERER"] it returns correct referer. How should I make it working for javascript as well? -- https://mail.python.org/mailman/listinfo/python-list
Re: Python 3.4.2 + PyQt4 + PyCharm 3.4.1
No one here uses PyCharm and Qt? =/ On Wed, Oct 29, 2014 at 8:45 PM, Juan Christian wrote: > It only occurs whule using PyCharm I tried it via pure terminal and > everything works... =/ > > On Tue, Oct 28, 2014 at 7:45 PM, Juan Christian > wrote: > >> Python 3.4.2 Windows x64 >> PyQt4 4.11.2 Py3.4 Qt4.8.6 (x64) >> PyCharm 3.4.1 Pro Edition >> >> >> So, PyCharm works 100% with everything here but PyQt. >> >> I have this folder structure: >> >> Disk C: >> > PyQt4 >> >> Lib/site-packages/PyQt4/(tons of files here) >> >> > Python34 (normal/default installation) >> >> --- >> >> I tried copying the 'PyQt4' folder to my 'Python34/Lib/site-packages' >> folder but when I try to code something Qt related on PyCharm I get this >> issue: >> >> Some skeletons failed to generate: 19 modules failed in 1 interpreter. >> Details... >> >> Failed modules >> >> Python 3.4.2 >> PyQt4.QAxContainer >> PyQt4.Qsci >> PyQt4.QtCore >> PyQt4.QtDeclarative >> PyQt4.QtDesigner >> PyQt4.QtGui >> PyQt4.QtHelp >> PyQt4.QtMultimedia >> PyQt4.QtNetwork >> PyQt4.QtOpenGL >> PyQt4.QtScript >> PyQt4.QtScriptTools >> PyQt4.QtSql >> PyQt4.QtSvg >> PyQt4.QtTest >> PyQt4.QtWebKit >> PyQt4.QtXml >> PyQt4.QtXmlPatterns >> PyQt4.phonon >> >> Generation of skeletons for the modules above will be tried again when >> the modules are updated or a new version of generator is available. >> >> And PyCharm tells me that my 'import PyQt4.ANYTHING_HERE import *' has >> 'Unresolved references'. >> >> --- >> >> When I try to install the PyQt4 via the installer, in the default >> location (C:/Python34) I get an even 'worse' error, whenever PyCharm try to >> update the skeletons or something like that (that is, whenever I open a >> file there...), I get tons and tons of the same error, 'Error while >> accessing memory at address ', and 'python.exe' stops working. >> >> > -- https://mail.python.org/mailman/listinfo/python-list
Re: Python 3.4.2 + PyQt4 + PyCharm 3.4.1
It only occurs whule using PyCharm I tried it via pure terminal and everything works... =/ On Tue, Oct 28, 2014 at 7:45 PM, Juan Christian wrote: > Python 3.4.2 Windows x64 > PyQt4 4.11.2 Py3.4 Qt4.8.6 (x64) > PyCharm 3.4.1 Pro Edition > > > So, PyCharm works 100% with everything here but PyQt. > > I have this folder structure: > > Disk C: > > PyQt4 > >> Lib/site-packages/PyQt4/(tons of files here) > > > Python34 (normal/default installation) > > --- > > I tried copying the 'PyQt4' folder to my 'Python34/Lib/site-packages' > folder but when I try to code something Qt related on PyCharm I get this > issue: > > Some skeletons failed to generate: 19 modules failed in 1 interpreter. > Details... > > Failed modules > > Python 3.4.2 > PyQt4.QAxContainer > PyQt4.Qsci > PyQt4.QtCore > PyQt4.QtDeclarative > PyQt4.QtDesigner > PyQt4.QtGui > PyQt4.QtHelp > PyQt4.QtMultimedia > PyQt4.QtNetwork > PyQt4.QtOpenGL > PyQt4.QtScript > PyQt4.QtScriptTools > PyQt4.QtSql > PyQt4.QtSvg > PyQt4.QtTest > PyQt4.QtWebKit > PyQt4.QtXml > PyQt4.QtXmlPatterns > PyQt4.phonon > > Generation of skeletons for the modules above will be tried again when the > modules are updated or a new version of generator is available. > > And PyCharm tells me that my 'import PyQt4.ANYTHING_HERE import *' has > 'Unresolved references'. > > --- > > When I try to install the PyQt4 via the installer, in the default location > (C:/Python34) I get an even 'worse' error, whenever PyCharm try to update > the skeletons or something like that (that is, whenever I open a file > there...), I get tons and tons of the same error, 'Error while accessing > memory at address ', and 'python.exe' stops working. > > -- https://mail.python.org/mailman/listinfo/python-list
Python 3.4.2 + PyQt4 + PyCharm 3.4.1
Python 3.4.2 Windows x64 PyQt4 4.11.2 Py3.4 Qt4.8.6 (x64) PyCharm 3.4.1 Pro Edition So, PyCharm works 100% with everything here but PyQt. I have this folder structure: Disk C: > PyQt4 >> Lib/site-packages/PyQt4/(tons of files here) > Python34 (normal/default installation) --- I tried copying the 'PyQt4' folder to my 'Python34/Lib/site-packages' folder but when I try to code something Qt related on PyCharm I get this issue: Some skeletons failed to generate: 19 modules failed in 1 interpreter. Details... Failed modules Python 3.4.2 PyQt4.QAxContainer PyQt4.Qsci PyQt4.QtCore PyQt4.QtDeclarative PyQt4.QtDesigner PyQt4.QtGui PyQt4.QtHelp PyQt4.QtMultimedia PyQt4.QtNetwork PyQt4.QtOpenGL PyQt4.QtScript PyQt4.QtScriptTools PyQt4.QtSql PyQt4.QtSvg PyQt4.QtTest PyQt4.QtWebKit PyQt4.QtXml PyQt4.QtXmlPatterns PyQt4.phonon Generation of skeletons for the modules above will be tried again when the modules are updated or a new version of generator is available. And PyCharm tells me that my 'import PyQt4.ANYTHING_HERE import *' has 'Unresolved references'. --- When I try to install the PyQt4 via the installer, in the default location (C:/Python34) I get an even 'worse' error, whenever PyCharm try to update the skeletons or something like that (that is, whenever I open a file there...), I get tons and tons of the same error, 'Error while accessing memory at address ', and 'python.exe' stops working. -- https://mail.python.org/mailman/listinfo/python-list
Re: weakref, memory management and execution slow down in PyQt4
On 9/9/2014 11:34 AM, Michael Torrie wrote: On 09/08/2014 08:45 PM, kjs wrote: You're right, a dictionary can do everything I need and more. Actually I am wrong in suggesting a dictionary. A list or an array would probably be more appropriate. Thinking about it this morning, one additional reason why getattr and setattr aren't appropriate for this task is that they are not just a dictionary lookup under the hood, they are an additional layer. One more function call that would be unnecessary if you used a data structure directly. The extra function call for getattr at least doubles the lookup time >>> repeat("C.a", "class C: a=1") [0.06093001107618079, 0.042186288111423664, 0.04218598069616064] >>> repeat("getattr(C, 'a')", "class C: a=1") [0.13152054655972734, 0.1100451316336688, 0.11021882125309901] -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list
Re: weakref, memory management and execution slow down in PyQt4
On September 9, 2014 8:57:02 AM PDT, Michael Torrie wrote: >On 09/09/2014 09:37 AM, Chris Angelico wrote: >> On Wed, Sep 10, 2014 at 1:32 AM, Michael Torrie >wrote: >>> Yes you're correct. It is the equivalent. But it always involves >>> lookup in the object's dictionary, which is big O order O(n log n) >>> complexity for each and every access. >> >> Where do you get that figure from? A CPython dictionary is >implemented >> as a hashtable, so algorithmic complexity of lookups ought to be >O(1). > >You're right, it is. My mistake. Guess the main issue is the overhead >of an additional function call. A dict directly or a list directly may >me faster. > >Anyway, I guess we're wandering in the weeds a bit as the original >issue >is probably not related to his unorthodox choice of metaprogramming as >a >data model. I agree. I believe I have isolated the issue to be either my user of pyqtgraph, or is implementation. I lean towards the my use, because I know how little effort I put into understanding the library. If I figure on a solution, I'll be sure to come back in. I'm also curious why the weakrefs are not being garbage collected. And how many (~20,000) tiny little things can bring processing to a halt after only a couple minutes of runtime. -- https://mail.python.org/mailman/listinfo/python-list
Re: weakref, memory management and execution slow down in PyQt4
On 09/09/2014 09:37 AM, Chris Angelico wrote: > On Wed, Sep 10, 2014 at 1:32 AM, Michael Torrie wrote: >> Yes you're correct. It is the equivalent. But it always involves >> lookup in the object's dictionary, which is big O order O(n log n) >> complexity for each and every access. > > Where do you get that figure from? A CPython dictionary is implemented > as a hashtable, so algorithmic complexity of lookups ought to be O(1). You're right, it is. My mistake. Guess the main issue is the overhead of an additional function call. A dict directly or a list directly may me faster. Anyway, I guess we're wandering in the weeds a bit as the original issue is probably not related to his unorthodox choice of metaprogramming as a data model. -- https://mail.python.org/mailman/listinfo/python-list
Re: weakref, memory management and execution slow down in PyQt4
On Wed, Sep 10, 2014 at 1:32 AM, Michael Torrie wrote: > Yes you're correct. It is the equivalent. But it always involves > lookup in the object's dictionary, which is big O order O(n log n) > complexity for each and every access. Where do you get that figure from? A CPython dictionary is implemented as a hashtable, so algorithmic complexity of lookups ought to be O(1). ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: weakref, memory management and execution slow down in PyQt4
On 09/08/2014 08:45 PM, kjs wrote: > You're right, a dictionary can do everything I need and more. Actually I am wrong in suggesting a dictionary. A list or an array would probably be more appropriate. Thinking about it this morning, one additional reason why getattr and setattr aren't appropriate for this task is that they are not just a dictionary lookup under the hood, they are an additional layer. One more function call that would be unnecessary if you used a data structure directly. -- https://mail.python.org/mailman/listinfo/python-list
Re: weakref, memory management and execution slow down in PyQt4
Reposting to list, instead of directly to kjs On 09/08/2014 08:45 PM, kjs wrote: > Thanks for the consideration Michael. If you do get the data, and are > able to run the code, let me know if you notice anything interesting. Yeah I don't think I'll be able to have the time to download a 3 GB file. >> Is there a reason you are using setattr and getattr instead of a proper >> data structure? both of those calls are rather expensive. Would >> probably be cheaper to use some kind of array, dictionary, or other >> purpose-built data structure? >> > > You're right, a dictionary can do everything I need and more. This > happened to be the first thing I thought of, and I didn't imagine it > would be very expensive. I figured it was simply a different way of > defining and retrieving a class variable. IE setattr(self, foo, True) == > self.foo = True. Yes you're correct. It is the equivalent. But it always involves lookup in the object's dictionary, which is big O order O(n log n) complexity for each and every access. A list would be far faster, essentially O(1) (I think?) after the single name lookup, since you can access the elements by number. Indexing into a list doesn't involve doing name lookups; you just specify an offset. No idea how much faster, but significantly so. If a list is too slow, there are other array-like classes you can use (like numpy arrays) that do offer true O(1) lookups. Besides that, it's not typical use of setattr and getattr in python. -- https://mail.python.org/mailman/listinfo/python-list
Re: weakref, memory management and execution slow down in PyQt4
On 09/09/2014 03:45, kjs wrote: You're right, a dictionary can do everything I need and more. This happened to be the first thing I thought of, and I didn't imagine it would be very expensive. I figured it was simply a different way of defining and retrieving a class variable. IE setattr(self, foo, True) == self.foo = True. My rule of thumb for making a judgement on Python performance is never assume anything, ever. In using Python for well over 10 years my gut instinct has never been correct on this matter. The only thing to do is profile your code and then seek the answers online, as you can guarantee someone else has already been there, seen it, done it and got the t-shirt :) -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence -- https://mail.python.org/mailman/listinfo/python-list
Re: weakref, memory management and execution slow down in PyQt4
Thanks for the consideration Michael. If you do get the data, and are able to run the code, let me know if you notice anything interesting. Michael Torrie: > On 09/07/2014 02:39 PM, kjs wrote: >> The code is minimal[0]. The only other widgets are a start button that >> fires off the plotting and a stop button that calls sys.exit(). > > Unfortunately there are no data files in your git repository so I can't > run it. The data is available from the internet[0] in the form of 3+GB gziped blobs. In case you don't want to register an account with Kaggle and download 3GB to execute the code, I have uploaded a sample file to a Tahoe LAFS grid accessible via tor. If you're interested in downloading the data, please let me know and I'll share the read capability with you. Additionally, I should write some tests the use mock data. I'll let you know if I get around to this. > >> >> Lines 112-114 appear to be causing the weakref proliferation. > > Is there a reason you are using setattr and getattr instead of a proper > data structure? both of those calls are rather expensive. Would > probably be cheaper to use some kind of array, dictionary, or other > purpose-built data structure? > You're right, a dictionary can do everything I need and more. This happened to be the first thing I thought of, and I didn't imagine it would be very expensive. I figured it was simply a different way of defining and retrieving a class variable. IE setattr(self, foo, True) == self.foo = True. Thanks, Kevin [0] http://www.kaggle.com/c/seizure-prediction/data 0x8A61431E.asc Description: application/pgp-keys signature.asc Description: OpenPGP digital signature -- https://mail.python.org/mailman/listinfo/python-list
Re: weakref, memory management and execution slow down in PyQt4
On 09/07/2014 02:39 PM, kjs wrote: > The code is minimal[0]. The only other widgets are a start button that > fires off the plotting and a stop button that calls sys.exit(). Unfortunately there are no data files in your git repository so I can't run it. > > Lines 112-114 appear to be causing the weakref proliferation. Is there a reason you are using setattr and getattr instead of a proper data structure? both of those calls are rather expensive. Would probably be cheaper to use some kind of array, dictionary, or other purpose-built data structure? -- https://mail.python.org/mailman/listinfo/python-list
Re: weakref, memory management and execution slow down in PyQt4
Michael Torrie: > On 09/07/2014 01:11 PM, kjs wrote: >> Thanks for the advice. I commented out the graph generation and PyQt call >> >>>>> self.app.processEvents() >> >> where in the class __init__ >> >>>>> self.app = QtGui.QApplication(sys.argv) >> >> This stopped the weakref proliferation. All other objects grow and >> shrink in number as expected. > > Can you make an absolute minimal example with no widgets save the graph > itself? You could then go to the PyQt folks with that. Could be a bug, > or could be an improper use of something by your code. This is one of > the problems with using Qt in other languages: it's not a perfect fit > for Python's object model as it is C++-based. So you have to think like > a C++ programmer, and you might have to manage some resources manually, > unlike normal Python objects which for the most part take care of > themselves. > The code is minimal[0]. The only other widgets are a start button that fires off the plotting and a stop button that calls sys.exit(). Lines 112-114 appear to be causing the weakref proliferation. I do not doubt that I could be using PyQt4 incorrectly. I'll send a message to the pyqt mailing list as well. > Also you could try a minimal example using PySide instead of PyQt and > see if that also manifests the leak. If so, then the problem could be > in Qt itself. Though I suspect the problem is some kind of impedance > mismatch between C++ and Python. > Thanks much, Kevin [0] https://github.com/kevinjos/kaggle-aes-seizure-prediction/blob/master/explore.py 0x8A61431E.asc Description: application/pgp-keys signature.asc Description: OpenPGP digital signature -- https://mail.python.org/mailman/listinfo/python-list
Re: weakref, memory management and execution slow down in PyQt4
On 09/07/2014 01:11 PM, kjs wrote: > Thanks for the advice. I commented out the graph generation and PyQt call > self.app.processEvents() > > where in the class __init__ > self.app = QtGui.QApplication(sys.argv) > > This stopped the weakref proliferation. All other objects grow and > shrink in number as expected. Can you make an absolute minimal example with no widgets save the graph itself? You could then go to the PyQt folks with that. Could be a bug, or could be an improper use of something by your code. This is one of the problems with using Qt in other languages: it's not a perfect fit for Python's object model as it is C++-based. So you have to think like a C++ programmer, and you might have to manage some resources manually, unlike normal Python objects which for the most part take care of themselves. Also you could try a minimal example using PySide instead of PyQt and see if that also manifests the leak. If so, then the problem could be in Qt itself. Though I suspect the problem is some kind of impedance mismatch between C++ and Python. -- https://mail.python.org/mailman/listinfo/python-list
Re: weakref, memory management and execution slow down in PyQt4
Antoine Pitrou: > kjs riseup.net> writes: >> >> I have come to believe that the growing number of weakrefs is slowing >> down execution. Is my analysis misguided? How can I introspect further? >> If the slowdown can be attributed to weakref escalation, what are some >> next steps? > > The way to analyze this is to build some gradually smaller subsets of your > application until you can isolate what is causing the growth in number of > objects (if any). I would suggest first remove the GUI and replace it with > some dummy functions, to stress your core logic. Thanks for the advice. I commented out the graph generation and PyQt call >>> self.app.processEvents() where in the class __init__ >>> self.app = QtGui.QApplication(sys.argv) This stopped the weakref proliferation. All other objects grow and shrink in number as expected. > > Note that "top" isn't a very reliable tool, as memory fragmentation and > other factors can cause your process' visible size to grow even though > Python's memory consumption may be stable. There are dedicated Python tools > for finer analysis, such as tracemalloc, which is standard on 3.4 and > available > as a backport for older versions: > > https://docs.python.org/3/library/tracemalloc.html > http://pytracemalloc.readthedocs.org/ > > But regardless of such tools, the approach above (try to decompose your > workload into separate parts until your find the culprit) is highly > recommended. > > Regards > > Antoine. > > 0x8A61431E.asc Description: application/pgp-keys signature.asc Description: OpenPGP digital signature -- https://mail.python.org/mailman/listinfo/python-list
Re: weakref, memory management and execution slow down in PyQt4
kjs riseup.net> writes: > > I have come to believe that the growing number of weakrefs is slowing > down execution. Is my analysis misguided? How can I introspect further? > If the slowdown can be attributed to weakref escalation, what are some > next steps? The way to analyze this is to build some gradually smaller subsets of your application until you can isolate what is causing the growth in number of objects (if any). I would suggest first remove the GUI and replace it with some dummy functions, to stress your core logic. Note that "top" isn't a very reliable tool, as memory fragmentation and other factors can cause your process' visible size to grow even though Python's memory consumption may be stable. There are dedicated Python tools for finer analysis, such as tracemalloc, which is standard on 3.4 and available as a backport for older versions: https://docs.python.org/3/library/tracemalloc.html http://pytracemalloc.readthedocs.org/ But regardless of such tools, the approach above (try to decompose your workload into separate parts until your find the culprit) is highly recommended. Regards Antoine. -- https://mail.python.org/mailman/listinfo/python-list
weakref, memory management and execution slow down in PyQt4
I built a small application using PyQt4 and pyqtgraph to visualize some data. The app has 32 graphs that plot deques of size 512. The plots are updated when 200 ints are cycled through each deque. The plotting slows down in a linear manner with respect to time. In other words after cycling through 100,000 data points the time between calls to process events is much longer than it was at T0. I have done a little memory profiling. Watching the process on top, it's clear that there is some memory leak. I also tried invoking objgraph.show_most_common_types(). This test reveals that the number of objects being created plateaus, except for weakref objects, which keep growing and growing. I have come to believe that the growing number of weakrefs is slowing down execution. Is my analysis misguided? How can I introspect further? If the slowdown can be attributed to weakref escalation, what are some next steps? Thanks, Kevin 0x8A61431E.asc Description: application/pgp-keys signature.asc Description: OpenPGP digital signature -- https://mail.python.org/mailman/listinfo/python-list
Re: PyQt4 - Issue with deleting a QWidget from a QGridLayout
Le 20/08/2014 16:22, Alex Murray a écrit : Please do not post in HTML it makes everything an unreadable mess (I have left you original post above so you can see what I mean.) Sorry, here's the original e-mail in plain text: Hi, I've discovered some very strange behaviour when trying to delete a QWidget from a QGridLayout. The following code demonstrates this behaviour: from PyQt4 import QtGui import sys app = QtGui.QApplication(sys.argv) grid_layout = QtGui.QGridLayout() grid_layout.addWidget(QtGui.QWidget()) item = grid_layout.takeAt(0) item.deleteLater() Traceback (most recent call last): File "", line 1, in AttributeError: 'QWidgetItem' object has no attribute 'deleteLater' This makes no sense to me whatsoever. Firstly, why is it returning a QWidgetItem when I inserted a QWidget to begin with? Secondly, every Qt object derives from QObject, and deleteLater() is a method of QObject, so that method should exist. Additional info: Python 2.7.6 (default, Mar 22 2014, 22:59:56) [GCC 4.8.2] on linux2 Not exactly, QLayoutItem or QSpacerItem doesn't inherits of QObject. As I've sayed in my precedent post, you must use item.widget().deleteLater(). -- https://mail.python.org/mailman/listinfo/python-list
Re: Re: PyQt4 - Issue with deleting a QWidget from a QGridLayout
> Please do not post in HTML it makes everything an unreadable mess > (I have left you original post above so you can see what I mean.) Sorry, here's the original e-mail in plain text: Hi, I've discovered some very strange behaviour when trying to delete a QWidget from a QGridLayout. The following code demonstrates this behaviour: >>> from PyQt4 import QtGui >>> import sys >>> app = QtGui.QApplication(sys.argv) >>> grid_layout = QtGui.QGridLayout() >>> grid_layout.addWidget(QtGui.QWidget()) >>> item = grid_layout.takeAt(0) >>> item.deleteLater() Traceback (most recent call last): File "", line 1, in AttributeError: 'QWidgetItem' object has no attribute 'deleteLater' This makes no sense to me whatsoever. Firstly, why is it returning a QWidgetItem when I inserted a QWidget to begin with? Secondly, every Qt object derives from QObject, and deleteLater() is a method of QObject, so that method should exist. Additional info: Python 2.7.6 (default, Mar 22 2014, 22:59:56) [GCC 4.8.2] on linux2 -- https://mail.python.org/mailman/listinfo/python-list
Re: PyQt4 - Issue with deleting a QWidget from a QGridLayout
On Wed, 20 Aug 2014 00:11:24 +0200, Alex Murray wrote: > Hi, > > > > I've discovered some very strange behaviour when trying to > delete a QWidget from a QGridLayout. The following code demonstrates > this behaviour: > > > > >>> from PyQt4 import QtGui > > >>> import sys > > >>> app = QtGui.QApplication(sys.argv) > > >>> grid_layout = QtGui.QGridLayout() > >>> grid_layout.addWidget(QtGui.QWidget()) > >>> item = self.grid_layout.takeAt(0) > >>> item.deleteLater() > > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > AttributeError: 'QWidgetItem' object has no attribute > 'deleteLater' > > > > This makes no sense to me whatsoever. Firstly, why is it returning > a QWidgetItem when I inserted a QWidget to begin with? Secondly, every > Qt object derives from QObject, and deleteLater() is a method of > QObject, so that method should exist. Additional info: > > > Python 2.7.6 (default, Mar 22 2014, 22:59:56) > [GCC 4.8.2] on linux2 > > using PyQt4 > Please do not post in HTML it makes everything an unreadable mess (I have left you original post above so you can see what I mean.) -- "Yes, your honour, I have RSA encryption code tattood on my penis. Shall I show the jury?" -- https://mail.python.org/mailman/listinfo/python-list
Re: PyQt4 - Issue with deleting a QWidget from a QGridLayout
Le 20/08/2014 00:11, Alex Murray a écrit : Hi, I've discovered some very strange behaviour when trying to delete a QWidget from a QGridLayout. The following code demonstrates this behaviour: >>> from PyQt4 import QtGui >>> import sys >>> app = QtGui.QApplication(sys.argv) >>> grid_layout = QtGui.QGridLayout() >>> grid_layout.addWidget(QtGui.QWidget()) >>> item = self.grid_layout.takeAt(0) >>> item.deleteLater() Traceback (most recent call last): File "", line 1, in AttributeError: 'QWidgetItem' object has no attribute 'deleteLater' This makes no sense to me whatsoever. Firstly, why is it returning a QWidgetItem when I inserted a QWidget to begin with? Secondly, every Qt object derives from QObject, and deleteLater() is a method of QObject, so that method should exist. Additional info: Python 2.7.6 (default, Mar 22 2014, 22:59:56) [GCC 4.8.2] on linux2 using PyQt4 QLayout.takeAt() returns a QWidgetItem not the instance of the widget himself. See: http://pyqt.sourceforge.net/Docs/PyQt4/qlayout.html#takeAt You must use item.widget() to retrieve your widget instance. -- https://mail.python.org/mailman/listinfo/python-list
PyQt4 - Issue with deleting a QWidget from a QGridLayout
Hi, I've discovered some very strange behaviour when trying to delete a QWidget from a QGridLayout. The following code demonstrates this behaviour: >>> from PyQt4 import QtGui >>> import sys >>> app = QtGui.QApplication(sys.argv) >>> grid_layout = QtGui.QGridLayout() >>> grid_layout.addWidget(QtGui.QWidget()) >>> item = self.grid_layout.takeAt(0) >>> item.deleteLater() Traceback (most recent call last): File "", line 1, in AttributeError: 'QWidgetItem' object has no attribute 'deleteLater' This makes no sense to me whatsoever. Firstly, why is it returning a QWidgetItem when I inserted a QWidget to begin with? Secondly, every Qt object derives from QObject, and deleteLater() is a method of QObject, so that method should exist. Additional info: Python 2.7.6 (default, Mar 22 2014, 22:59:56) [GCC 4.8.2] on linux2 using PyQt4 -- https://mail.python.org/mailman/listinfo/python-list
Re: python to enable javascript , tried selinium, ghost, pyQt4 already
On 2014-01-18, Jaiprakash Singh wrote: > hi, > > can you please suggest me some method for study so that i can > scrap a site having JavaScript behind it > > > i have tried selenium, ghost, pyQt4, but it is slow and as a am > working with thread it sinks my ram memory very fast. I have tried selenium in the past and I remember it working reasonably well. I am afraid you can't get around the slowness since you have to have a web browser running. -- Improve at backgammon rapidly through addictive quickfire position quizzes: http://www.bgtrain.com/ -- https://mail.python.org/mailman/listinfo/python-list
Re: python to enable javascript , tried selinium, ghost, pyQt4 already
On Sun, Jan 19, 2014 at 8:40 AM, Denis McMahon wrote: > On Sun, 19 Jan 2014 05:13:57 +1100, Chris Angelico wrote: > >> On Sat, Jan 18, 2014 at 10:54 PM, Jaiprakash Singh >> wrote: >>> hi, >>> >>> can you please suggest me some method for study so that i can >>> scrap a site having JavaScript behind it >>> >>> >>> i have tried selenium, ghost, pyQt4, but it is slow and as a am >>> working with thread it sinks my ram memory very fast. >> >> Do you mean "scrape"? You're trying to retrieve the displayed contents >> of a web page that uses JavaScript? If so, that's basically impossible >> without actually executing the JS code, which means largely replicating >> the web browser. > > Oh, you think he meant scrape? I thought he was trying to scrap (as in > throw away / replace) an old javascript heavy website with something > using python instead. I thought so too at first, but since we had another recent case of someone confusing the two words, and since "scrape" would make sense in this context, I figured it'd be worth asking the question. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: python to enable javascript , tried selinium, ghost, pyQt4 already
On Sun, 19 Jan 2014 05:13:57 +1100, Chris Angelico wrote: > On Sat, Jan 18, 2014 at 10:54 PM, Jaiprakash Singh > wrote: >> hi, >> >> can you please suggest me some method for study so that i can >> scrap a site having JavaScript behind it >> >> >> i have tried selenium, ghost, pyQt4, but it is slow and as a am >> working with thread it sinks my ram memory very fast. > > Do you mean "scrape"? You're trying to retrieve the displayed contents > of a web page that uses JavaScript? If so, that's basically impossible > without actually executing the JS code, which means largely replicating > the web browser. Oh, you think he meant scrape? I thought he was trying to scrap (as in throw away / replace) an old javascript heavy website with something using python instead. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list
Re: python to enable javascript , tried selinium, ghost, pyQt4 already
On Sat, Jan 18, 2014 at 10:54 PM, Jaiprakash Singh wrote: > hi, > > can you please suggest me some method for study so that i can scrap a > site having JavaScript behind it > > > i have tried selenium, ghost, pyQt4, but it is slow and as a am working > with thread it sinks my ram memory very fast. Do you mean "scrape"? You're trying to retrieve the displayed contents of a web page that uses JavaScript? If so, that's basically impossible without actually executing the JS code, which means largely replicating the web browser. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: python to enable javascript , tried selinium, ghost, pyQt4 already
On Sat, 18 Jan 2014 03:54:17 -0800, Jaiprakash Singh wrote: > can you please suggest me some method for study so that i can > scrap a site having JavaScript behind it Please expand upon the requirement, are you trying to: a) replace server side javascript with server side python, or b) replace client side javascript with server side python, or c) replace client side javascript with client side python, or d) something else? (c) is not possible (you can't guarantee that all clients will have python, or that there will be a mechanism for calling it from your webpages), (b) doesn't make a lot of sense (you'll be trading cpu in the client for cpu in the server + network bandwidth and latency). -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list
python to enable javascript , tried selinium, ghost, pyQt4 already
hi, can you please suggest me some method for study so that i can scrap a site having JavaScript behind it i have tried selenium, ghost, pyQt4, but it is slow and as a am working with thread it sinks my ram memory very fast. -- https://mail.python.org/mailman/listinfo/python-list
Re: pyqt4 & qt license
Am Sonntag, 10. März 2013 05:09:41 UTC+1 schrieb D. Xenakis: > Please correct me if im wrong.. > ... > PyQT4 GPL Licence is free and by using that someone can develop only > non-commercial software. Wrong. GPL does not prevent you from developing commercial softwarre. You just have to release your source under GPL. GPL is free as in freedom. It doesn't have to be free as in "free beer". There are customers paying for software relesed under GPL. They just needed it and didn't care if others used it too. > What about the source here? Could that be both open and close? As already said, if you use parts of GPL code in your (non private) project, the whole project has to be GPL. > Can someone develop a closed source but NON-commercial software, > by using PyQT4 GPL license? GPL does not cover commercial vs. non-commertial. Just freedom vs. proprietary. > ... hth, Martin -- http://mail.python.org/mailman/listinfo/python-list
Re: pyqt4 & qt license
On 03/09/2013 09:45 PM, Vito De Tullio wrote: > D. Xenakis wrote: > >> Can someone develop a closed source but NON-commercial software, by using >> PyQT4 GPL license? > > no, by definition of GPL: if you are using a GPL library, you must > distribute your software as GPL. > > (the GPL does not care about commercial / non commercial) > > http://www.gnu.org/licenses/gpl-faq.html#IfLibraryIsGPL Just to be clear here, the GPL isn't a magical license. It doesn't arbitrarily infect your code and force you to use the GPL on your own code. And no matter what license you use, you can re-license your code later under any terms you wish, since you own the copyright on the code. Here's the vital part: The moment you distribute your code, if you use a GPL library, then unless you also release your code under the GPL also, you are now in a copyright violation situation. You have three options: 1. License your code in a compatible way so that you're following the terms of the open source license the library you are using asks of you. IE release your source code under the terms of the GPL. 2. Remove the GPL'd library and either implement the lost functionality yourself (also know as "write your own dang code"), or replace the GPL'd library with an equivalent library under a different, compatible license. In the case of PyQt, this could be PySide, or maybe you decide to use a completely different GUI toolkit. 3. Negotiate a proprietary license with the copyright holder (IE buy the proprietary, royalty-free license from PyQt's authors. If you are in a position where you have violated copyright, failure to remedy it in a timely manner can cause you to be financially liable to the copyright holders of the code you are mis-using. Now, if you develop a program using PyQt and distribute it under the terms of the GPL, that does not mean you have to keep your code under the GPL. You can close your source at any time and use, say, PySide instead. But any code you already distributed under the GPL remains in the wild (supposing someone has a copy) under the GPL terms, even if newer versions of your software adopt a new license. -- http://mail.python.org/mailman/listinfo/python-list
Re: pyqt4 & qt license
D. Xenakis wrote: > Can someone develop a closed source but NON-commercial software, by using > PyQT4 GPL license? no, by definition of GPL: if you are using a GPL library, you must distribute your software as GPL. (the GPL does not care about commercial / non commercial) http://www.gnu.org/licenses/gpl-faq.html#IfLibraryIsGPL -- ZeD -- http://mail.python.org/mailman/listinfo/python-list
Re: pyqt4 & qt license
Please correct me if im wrong.. PySide is LGPL and is free and by using that someone can develop commercial (and non commercial) software, while being able at the same to choose between both close and open Source. PyQT4 Commercial Licence costs more than 300 Euro and by using that someone can develop commercial software while being again able to choose between both close and open Soruce. PyQT4 GPL Licence is free and by using that someone can develop only non-commercial software. What about the source here? Could that be both open and close? Can someone develop a closed source but NON-commercial software, by using PyQT4 GPL license? Τη Κυριακή, 10 Μαρτίου 2013 5:31:21 π.μ. UTC+2, ο χρήστης CM έγραψε: > Yes. PyQT is a wrapper for Python around QT, so you would need both. > > QT has, according to the site, > > both a GPL and LGPL version of their license. If someone used PySide, he should again use in addition one of those 2 above QT licences? Last question: Could someone just buy the PyQT4 commercial licence and use the LGPL licence of QT in his CLOSED source commercial software? (Which i believe is free :S) Or does LGPL mean that the source should be open? Or i should better ask, Does any of those 2 Licenses cost any money? Or they are free? Forgive me for all these questions im very interested in this topic too. THX 4 your time!! Tellidis your Greek? :) -- http://mail.python.org/mailman/listinfo/python-list
Re: pyqt4 & qt license
On 03/09/2013 07:08 PM, pitsa...@gmail.com wrote: > hello, > > i want to develop a GUI application that will be sold. i want to use > pyqt4. can i download and use the GPL version during the development > and then buy the commercial verion beofore i distribute the > application ? > > commercial version means LGPL? i think i am comfused so please > someone clarify on versions and licences. Nope. Commerical means you buy a royalty-free license to use their product in a proprietary project. In other words you buy the right to use their code in a way that's compatible with your own code's distribution scheme. > > somewhere i also noticed that there is a qt license ? will i need > this also ? You must be aware of the licenses of each individual part of the stack and honor their terms! This is true of *any* library you use, and code from *any* source. Open source does not mean public domain and you don't automatically have a right to use it in your own project. If you are using open source components in a proprietary project, you might need to consult a lawyer if you are unsure of the use terms you are dealing with or your obligations under those terms under copyright law. You have to follow the appropriate license for Qt (LGPL, so no biggy for you if you don't modify Qt itself), PyQt (GPL only or proprietary royalty-free), Python itself (not a problem since you aren't modifying it and you can redistribute it), and any and all Python libraries you might use. From what I can tell things in the standard library are fine, but watch out for third-party libraries. The licenses are not always compatible with proprietary code. As for PyQt, unless you pay for the proprietary, royalty-free license for PyQT (before or after development), then you have to use the GPL for your project, since those are the terms the free version of PyQt is released under. This is a deliberate choice by the company that makes it to secure a revenue stream. There is an alternative to PyQt, PySide, which is under the LGPL and compatible with a closed-source project. -- http://mail.python.org/mailman/listinfo/python-list
Re: pyqt4 & qt license
On Mar 9, 9:08 pm, pitsa...@gmail.com wrote: > hello, > > i want to develop a GUI application that will be sold. > i want to use pyqt4. > can i download and use the GPL version during the development and then buy > the commercial verion beofore i distribute the application ? Arguably, yes. From pyqt4's website: "Yes, you can re-license your application under a commercial license so long as you have purchased appropriate commercial PyQt licenses before you start to sell it." and also: "The availability of the LGPL version of Qt means that it is possible to evaluate using that and the GPL version of PyQt while still being able to re-license any code written during an evaluation in a future closed source application." > commercial version means LGPL? i think i am comfused so please someone > clarify on versions and licences. There is currently no version of PyQT licensed with LGPL. They refer to their commercial license as their "commercial license". > somewhere i also noticed that there is a qt license ? will i need this also ? Yes. PyQT is a wrapper for Python around QT, so you would need both. QT has, according to the site, both a GPL and LGPL version of their license. You can read up on GPL and LGPL by Googling about it, but in a nutshell, for commercial applications, of the two, LGPL is what you want. Do you know about PySide? It's another wrapper for QT that is licensed as LGPL and is free software. I don't know it's current state of development, though. Last Twitter update was about a year ago. -- http://mail.python.org/mailman/listinfo/python-list
Re: pyqt4 & qt license
On Sat, Mar 9, 2013 at 9:08 PM, wrote: > hello, > > i want to develop a GUI application that will be sold. > i want to use pyqt4. > can i download and use the GPL version during the development and then buy > the commercial verion beofore i distribute the application ? > > commercial version means LGPL? i think i am comfused so please someone > clarify on versions and licences. > > somewhere i also noticed that there is a qt license ? will i need this > also ? > > Thank you in advance > -- > http://mail.python.org/mailman/listinfo/python-list > I am not sure if this is the right place for clarifying Licences issues. But I am sure that you are "touching" a very sensitive issue about how to mix licenses for commercial products. -- http://mail.python.org/mailman/listinfo/python-list
pyqt4 & qt license
hello, i want to develop a GUI application that will be sold. i want to use pyqt4. can i download and use the GPL version during the development and then buy the commercial verion beofore i distribute the application ? commercial version means LGPL? i think i am comfused so please someone clarify on versions and licences. somewhere i also noticed that there is a qt license ? will i need this also ? Thank you in advance -- http://mail.python.org/mailman/listinfo/python-list
pyqt4 & qt license
i want to develop a GUI application that will be sold. i want to use pyqt4. can i download and use the GML version during the development and then buy the commercial verion beofore i distribute the application ? commercial version means LGPL? i think i am comfused so please someone clarify on versions and licences. somewhere i also noticed that there is a qt license ? will i need this also ? Thank you in advance -- http://mail.python.org/mailman/listinfo/python-list
from PyQt4 import QtWebKit ImportError: DLL load failed
Hi, Using WinXP I installed PyQt from http://www.riverbankcomputing.co.uk/software/pyqt/download installation file: PyQt-Py2.7-x86-gpl-4.9-1 then tried: Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)] on win32 Type "copyright", "credits" or "license()" for more information. >>> from PyQt4 import QtWebKit Traceback (most recent call last): File "", line 1, in from PyQt4 import QtWebKit ImportError: DLL load failed: The specified procedure could not be found. >>> This is a common problem when I google it but I don't see a clear procedure for a fix. Any help appreciated. -- http://mail.python.org/mailman/listinfo/python-list
Re: Help on PyQt4 QProcess
On Aug 20, 4:36 am, Phil Thompson wrote: > On Fri, 19 Aug 2011 14:32:12 -0700 (PDT), Edgar Fuentes > > > > > > > > > > wrote: > > On Aug 19, 4:21 pm, Carl Banks wrote: > >> On Friday, August 19, 2011 12:55:40 PM UTC-7, Edgar Fuentes wrote: > >> > On Aug 19, 1:56 pm, Phil Thompson > >> > wrote: > >> > > On Fri, 19 Aug 2011 10:15:20 -0700 (PDT), Edgar Fuentes > >> > > wrote: > >> > > > Dear friends, > > >> > > > I need execute an external program from a gui using PyQt4, to > avoid > >> > > > that hang the main thread, i must connect the signal > >> > > > "finished(int)" > >> > > > of a QProcess to work properly. > > >> > > > for example, why this program don't work? > > >> > > > from PyQt4.QtCore import QProcess > >> > > > pro = QProcess() # create QProcess object > >> > > > pro.connect(pro, SIGNAL('started()'), lambda > >> > > > x="started":print(x)) # connect > >> > > > pro.connect(pro, SIGNAL("finished(int)"), lambda > >> > > > x="finished":print(x)) > >> > > > pro.start('python',['hello.py']) # star hello.py > program > >> > > > (contain print("hello world!")) > >> > > > timeout = -1 > >> > > > pro.waitForFinished(timeout) > >> > > > print(pro.readAllStandardOutput().data()) > > >> > > > output: > > >> > > > started > >> > > > 0 > >> > > > b'hello world!\n' > > >> > > > see that not emit the signal finished(int) > > >> > > Yes it is, and your lambda slot is printing "0" which is the return > >> > > code > >> > > of the process. > > >> > > Phil > > >> > Ok, but the output should be: > > >> > started > >> > b'hello world!\n' > >> > finished > > >> > no?. > > >> > thanks Phil > > >> Two issues. First of all, your slot for the finished function does not > >> have the correct prototype, and it's accidentally not throwing an > >> exception because of your unnecessary use of default arguments. > Anyway, > >> to fix that, try this: > > >> pro.connect(pro, SIGNAL("finished(int)"), lambda v, > >> x="finished":print(x)) > > >> Notice that it adds an argument to the lambda (v) that accepts the int > >> argument of the signal. If you don't have that argument there, the int > >> argument goes into x, which is why Python prints 0 instead of > "finished". > > >> Second, processess run asynchrously, and because of line-buffering, IO > >> can output asynchronously, and so there's no guarantee what order > output > >> occurs. You might try calling the python subprocess with the '-u' > switch > >> to force unbuffered IO, which might be enough to force synchronous > output > >> (depending on how signal/slot and subprocess semantics are > implemented). > > >> Carl Banks > > > Thanks Carl, your intervention was very helpful for me, this solve my > > semantic error. I need to study more about signal/slots and process. > > In which case you should look at the modern, Pythonic connection syntax > rather than the old one... > > pro.started.connect(lambda: print("started")) > pro.finished.connect(lambda: print("finished")) > > Phil Pythonic, great!, more straightforward. Thanks again Phil and Carl. best regards, Edgar Fuentes -- http://mail.python.org/mailman/listinfo/python-list
Re: Help on PyQt4 QProcess
On Fri, 19 Aug 2011 14:32:12 -0700 (PDT), Edgar Fuentes wrote: > On Aug 19, 4:21 pm, Carl Banks wrote: >> On Friday, August 19, 2011 12:55:40 PM UTC-7, Edgar Fuentes wrote: >> > On Aug 19, 1:56 pm, Phil Thompson >> > wrote: >> > > On Fri, 19 Aug 2011 10:15:20 -0700 (PDT), Edgar Fuentes >> > > wrote: >> > > > Dear friends, >> >> > > > I need execute an external program from a gui using PyQt4, to avoid >> > > > that hang the main thread, i must connect the signal >> > > > "finished(int)" >> > > > of a QProcess to work properly. >> >> > > > for example, why this program don't work? >> >> > > > from PyQt4.QtCore import QProcess >> > > > pro = QProcess() # create QProcess object >> > > > pro.connect(pro, SIGNAL('started()'), lambda >> > > > x="started":print(x)) # connect >> > > > pro.connect(pro, SIGNAL("finished(int)"), lambda >> > > > x="finished":print(x)) >> > > > pro.start('python',['hello.py']) # star hello.py program >> > > > (contain print("hello world!")) >> > > > timeout = -1 >> > > > pro.waitForFinished(timeout) >> > > > print(pro.readAllStandardOutput().data()) >> >> > > > output: >> >> > > > started >> > > > 0 >> > > > b'hello world!\n' >> >> > > > see that not emit the signal finished(int) >> >> > > Yes it is, and your lambda slot is printing "0" which is the return >> > > code >> > > of the process. >> >> > > Phil >> >> > Ok, but the output should be: >> >> > started >> > b'hello world!\n' >> > finished >> >> > no?. >> >> > thanks Phil >> >> Two issues. First of all, your slot for the finished function does not >> have the correct prototype, and it's accidentally not throwing an >> exception because of your unnecessary use of default arguments. Anyway, >> to fix that, try this: >> >> pro.connect(pro, SIGNAL("finished(int)"), lambda v, >> x="finished":print(x)) >> >> Notice that it adds an argument to the lambda (v) that accepts the int >> argument of the signal. If you don't have that argument there, the int >> argument goes into x, which is why Python prints 0 instead of "finished". >> >> Second, processess run asynchrously, and because of line-buffering, IO >> can output asynchronously, and so there's no guarantee what order output >> occurs. You might try calling the python subprocess with the '-u' switch >> to force unbuffered IO, which might be enough to force synchronous output >> (depending on how signal/slot and subprocess semantics are implemented). >> >> Carl Banks > > Thanks Carl, your intervention was very helpful for me, this solve my > semantic error. I need to study more about signal/slots and process. In which case you should look at the modern, Pythonic connection syntax rather than the old one... pro.started.connect(lambda: print("started")) pro.finished.connect(lambda: print("finished")) Phil -- http://mail.python.org/mailman/listinfo/python-list
Re: Help on PyQt4 QProcess
On Aug 19, 4:21 pm, Carl Banks wrote: > On Friday, August 19, 2011 12:55:40 PM UTC-7, Edgar Fuentes wrote: > > On Aug 19, 1:56 pm, Phil Thompson > > wrote: > > > On Fri, 19 Aug 2011 10:15:20 -0700 (PDT), Edgar Fuentes > > > wrote: > > > > Dear friends, > > > > > I need execute an external program from a gui using PyQt4, to avoid > > > > that hang the main thread, i must connect the signal "finished(int)" > > > > of a QProcess to work properly. > > > > > for example, why this program don't work? > > > > > from PyQt4.QtCore import QProcess > > > > pro = QProcess() # create QProcess object > > > > pro.connect(pro, SIGNAL('started()'), lambda > > > > x="started":print(x)) # connect > > > > pro.connect(pro, SIGNAL("finished(int)"), lambda > > > > x="finished":print(x)) > > > > pro.start('python',['hello.py']) # star hello.py program > > > > (contain print("hello world!")) > > > > timeout = -1 > > > > pro.waitForFinished(timeout) > > > > print(pro.readAllStandardOutput().data()) > > > > > output: > > > > > started > > > > 0 > > > > b'hello world!\n' > > > > > see that not emit the signal finished(int) > > > > Yes it is, and your lambda slot is printing "0" which is the return code > > > of the process. > > > > Phil > > > Ok, but the output should be: > > > started > > b'hello world!\n' > > finished > > > no?. > > > thanks Phil > > Two issues. First of all, your slot for the finished function does not have > the correct prototype, and it's accidentally not throwing an exception > because of your unnecessary use of default arguments. Anyway, to fix that, > try this: > > pro.connect(pro, SIGNAL("finished(int)"), lambda v, x="finished":print(x)) > > Notice that it adds an argument to the lambda (v) that accepts the int > argument of the signal. If you don't have that argument there, the int > argument goes into x, which is why Python prints 0 instead of "finished". > > Second, processess run asynchrously, and because of line-buffering, IO can > output asynchronously, and so there's no guarantee what order output occurs. > You might try calling the python subprocess with the '-u' switch to force > unbuffered IO, which might be enough to force synchronous output (depending > on how signal/slot and subprocess semantics are implemented). > > Carl Banks Thanks Carl, your intervention was very helpful for me, this solve my semantic error. I need to study more about signal/slots and process. -- http://mail.python.org/mailman/listinfo/python-list
Re: Help on PyQt4 QProcess
On Friday, August 19, 2011 12:55:40 PM UTC-7, Edgar Fuentes wrote: > On Aug 19, 1:56 pm, Phil Thompson > wrote: > > On Fri, 19 Aug 2011 10:15:20 -0700 (PDT), Edgar Fuentes > > wrote: > > > Dear friends, > > > > > I need execute an external program from a gui using PyQt4, to avoid > > > that hang the main thread, i must connect the signal "finished(int)" > > > of a QProcess to work properly. > > > > > for example, why this program don't work? > > > > > from PyQt4.QtCore import QProcess > > > pro = QProcess() # create QProcess object > > > pro.connect(pro, SIGNAL('started()'), lambda > > > x="started":print(x)) # connect > > > pro.connect(pro, SIGNAL("finished(int)"), lambda > > > x="finished":print(x)) > > > pro.start('python',['hello.py']) # star hello.py program > > > (contain print("hello world!")) > > > timeout = -1 > > > pro.waitForFinished(timeout) > > > print(pro.readAllStandardOutput().data()) > > > > > output: > > > > > started > > > 0 > > > b'hello world!\n' > > > > > see that not emit the signal finished(int) > > > > Yes it is, and your lambda slot is printing "0" which is the return code > > of the process. > > > > Phil > > Ok, but the output should be: > > started > b'hello world!\n' > finished > > no?. > > thanks Phil Two issues. First of all, your slot for the finished function does not have the correct prototype, and it's accidentally not throwing an exception because of your unnecessary use of default arguments. Anyway, to fix that, try this: pro.connect(pro, SIGNAL("finished(int)"), lambda v, x="finished":print(x)) Notice that it adds an argument to the lambda (v) that accepts the int argument of the signal. If you don't have that argument there, the int argument goes into x, which is why Python prints 0 instead of "finished". Second, processess run asynchrously, and because of line-buffering, IO can output asynchronously, and so there's no guarantee what order output occurs. You might try calling the python subprocess with the '-u' switch to force unbuffered IO, which might be enough to force synchronous output (depending on how signal/slot and subprocess semantics are implemented). Carl Banks -- http://mail.python.org/mailman/listinfo/python-list
Re: Help on PyQt4 QProcess
On Aug 19, 1:56 pm, Phil Thompson wrote: > On Fri, 19 Aug 2011 10:15:20 -0700 (PDT), Edgar Fuentes > > > > > > > > > > wrote: > > Dear friends, > > > I need execute an external program from a gui using PyQt4, to avoid > > that hang the main thread, i must connect the signal "finished(int)" > > of a QProcess to work properly. > > > for example, why this program don't work? > > > from PyQt4.QtCore import QProcess > > pro = QProcess() # create QProcess object > > pro.connect(pro, SIGNAL('started()'), lambda > > x="started":print(x)) # connect > > pro.connect(pro, SIGNAL("finished(int)"), lambda > > x="finished":print(x)) > > pro.start('python',['hello.py']) # star hello.py program > > (contain print("hello world!")) > > timeout = -1 > > pro.waitForFinished(timeout) > > print(pro.readAllStandardOutput().data()) > > > output: > > > started > > 0 > > b'hello world!\n' > > > see that not emit the signal finished(int) > > Yes it is, and your lambda slot is printing "0" which is the return code > of the process. > > Phil Ok, but the output should be: started b'hello world!\n' finished no?. thanks Phil -- http://mail.python.org/mailman/listinfo/python-list
Re: Help on PyQt4 QProcess
On Fri, 19 Aug 2011 10:15:20 -0700 (PDT), Edgar Fuentes wrote: > Dear friends, > > I need execute an external program from a gui using PyQt4, to avoid > that hang the main thread, i must connect the signal "finished(int)" > of a QProcess to work properly. > > for example, why this program don't work? > >from PyQt4.QtCore import QProcess >pro = QProcess() # create QProcess object >pro.connect(pro, SIGNAL('started()'), lambda > x="started":print(x))# connect >pro.connect(pro, SIGNAL("finished(int)"), lambda > x="finished":print(x)) >pro.start('python',['hello.py'])# star hello.py program > (contain print("hello world!")) >timeout = -1 >pro.waitForFinished(timeout) >print(pro.readAllStandardOutput().data()) > > output: > >started >0 >b'hello world!\n' > > see that not emit the signal finished(int) Yes it is, and your lambda slot is printing "0" which is the return code of the process. Phil -- http://mail.python.org/mailman/listinfo/python-list
Help on PyQt4 QProcess
Dear friends, I need execute an external program from a gui using PyQt4, to avoid that hang the main thread, i must connect the signal "finished(int)" of a QProcess to work properly. for example, why this program don't work? from PyQt4.QtCore import QProcess pro = QProcess() # create QProcess object pro.connect(pro, SIGNAL('started()'), lambda x="started":print(x))# connect pro.connect(pro, SIGNAL("finished(int)"), lambda x="finished":print(x)) pro.start('python',['hello.py'])# star hello.py program (contain print("hello world!")) timeout = -1 pro.waitForFinished(timeout) print(pro.readAllStandardOutput().data()) output: started 0 b'hello world!\n' see that not emit the signal finished(int) I'm using Python 3.2 and PyQt 4.8.4 under winxp 32bit. best regards, -- http://mail.python.org/mailman/listinfo/python-list
Re: ImportError: No module named PyQt4.QtGui
On 04/08/11 11:39, 守株待兔 wrote: > i have installed such things: > > sudo apt-get install libqt4-dev > sudo apt-get install g++ automake > sudo apt-get install qt4-dev-tools qt4-designer qt4-doc > sudo apt-get install libqt4-opengl-dev > sudo apt-get install libqt4-sql-mysql libqt4-sql-odbc libqt4-sql-psql > libqt4-sql-sqlite libqt4-sql-sqlite2 > > when i finished,input >>>>from PyQt4.QtCore import * > Traceback (most recent call last): > File "", line 1, in > ImportError: No module named PyQt4.QtCore > > would you mind to tell me how to solve it? > > http://lmgtfy.com/?q=debian+pyqt4 You haven't actually installed the python-qt4 bindings yet. All you installed is the C++ library. -- http://mail.python.org/mailman/listinfo/python-list
ImportError: No module named PyQt4.QtGui
i have installed such things: sudo apt-get install libqt4-dev sudo apt-get install g++ automake sudo apt-get install qt4-dev-tools qt4-designer qt4-doc sudo apt-get install libqt4-opengl-dev sudo apt-get install libqt4-sql-mysql libqt4-sql-odbc libqt4-sql-psql libqt4-sql-sqlite libqt4-sql-sqlite2 when i finished,input >>>from PyQt4.QtCore import * Traceback (most recent call last): File "", line 1, in ImportError: No module named PyQt4.QtCore would you mind to tell me how to solve it?-- http://mail.python.org/mailman/listinfo/python-list
Re: logging and PyQt4
On Mar 14, 7:40 am, Adrian Casey wrote: > I have a multi-threaded PyQt4 application which has both a GUI and command- > line interface. I am using Qt4's threading because from what I have read, > it is more efficient than the native python threading module. Also, given > most users will probably use the GUI, it seemed to make sense. > > I want a flexible, threadsafeloggingfacility for my application so I was > thinking of using python'sloggingmodule. I need a logger that can log to > the GUI or a terminal depending on how the application is invoked. > > So, my question is -: > > Is it wise to use python'sloggingmodule in conjunction with Qt4 threads? > If not, what are my options apart from writing my ownloggingmodule? > > If it is OK, then I would like to know how to subclass theloggingclass so > that instead of sending output to stdout (as in StreamHandler), it emits Qt4 > signals instead. > > Any help would be appreciated. > > Thank you. > Adrian Casey. Logging certainly works well with PyQt4 in multi-threaded applications, though of course it's based on Python's threading API rather than Qt's. To direct logging output to a GUI, it would be appropriate to develop a Qt/PyQt-aware handler class (derived from logging.Handler) to do the Qt interfacing. Regards, Vinay Sajip -- http://mail.python.org/mailman/listinfo/python-list
logging and PyQt4
I have a multi-threaded PyQt4 application which has both a GUI and command- line interface. I am using Qt4's threading because from what I have read, it is more efficient than the native python threading module. Also, given most users will probably use the GUI, it seemed to make sense. I want a flexible, threadsafe logging facility for my application so I was thinking of using python's logging module. I need a logger that can log to the GUI or a terminal depending on how the application is invoked. So, my question is -: Is it wise to use python's logging module in conjunction with Qt4 threads? If not, what are my options apart from writing my own logging module? If it is OK, then I would like to know how to subclass the logging class so that instead of sending output to stdout (as in StreamHandler), it emits Qt4 signals instead. Any help would be appreciated. Thank you. Adrian Casey. -- http://mail.python.org/mailman/listinfo/python-list
Re: pyqt4: multi-threaded database access
Adrian Casey writes: > I have a PyQt4 multi-threaded application which accesses many hosts > concurrently via ssh. I would like each thread to have access to a > database so that it can look up details about the particular system it > is connected to. > > The easy way is to have each thread create a connection to the database. > However, this is wasteful and likely to exhaust the maximum number of > connections the database (postgresql) allows. Instead, I would like to > share a single database connection between all threads. In PyQt4, this > is not possible since the database connection can only be used by the > thread which created it. > > So, I'm thinking I'll create a thread to just handle database queries. > The worker threads will communicate with the database thread using > signals and slots. > > My question is, if I have 20 worker threads who have emitted a signal > which results in a database query, how do I ensure that the query > results are sent back to the originating thread? > > Ideas, examples anyone? First of all, do you *know* it will exhaust the connections, or is that just some gut feeling? Because postgres can easily handle a few hundered connections, and unless you really are exhausting these, it's the easiest solution. The next advice would be to create a pool of connections (pure python, not Qt). Then you lose the "can only be used by the thread which created it" restriction. Of course you should only use a connection from within one thread at a time, but that shouldn't be an issue. So all you have to make sure is that you fetch & return the connections properly. I would use a context-manager for that: with connection_pooll as connection: do_some_queries(connection) HTH, Diez -- http://mail.python.org/mailman/listinfo/python-list
pyqt4: multi-threaded database access
I have a PyQt4 multi-threaded application which accesses many hosts concurrently via ssh. I would like each thread to have access to a database so that it can look up details about the particular system it is connected to. The easy way is to have each thread create a connection to the database. However, this is wasteful and likely to exhaust the maximum number of connections the database (postgresql) allows. Instead, I would like to share a single database connection between all threads. In PyQt4, this is not possible since the database connection can only be used by the thread which created it. So, I'm thinking I'll create a thread to just handle database queries. The worker threads will communicate with the database thread using signals and slots. My question is, if I have 20 worker threads who have emitted a signal which results in a database query, how do I ensure that the query results are sent back to the originating thread? Ideas, examples anyone? Thanks. Adrian. -- http://mail.python.org/mailman/listinfo/python-list
Re: pyqt4 Table Widget deleting c/c++ object
On Oct 19, 2:29 pm, David Boddie wrote: > On Monday 18 October 2010 23:26, Andrew wrote: > > > I have two issues dealing with the table widget, though they may be > > interconnected. I'm not sure. Both delete the cell widgets off of my > > table but leave the rows, and then when I have the table update, it > > complains the c++ object has been deleted. > > > # self.tableData.setCellWidget(rowCount, 0, trackItem) > > # RuntimeError: underlying C/C++ object has been deleted > > This is because you pass your widgets to this method and later ask > the table to clear the contents of the table. When it does so, it > deletes the underlying widgets, leaving only Python wrappers. > > The documentation mentions that the table takes ownership of the > widget: > > http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qtablewidg... > > I had read that, but I did not fully understand what that actually was supposed to mean. like a 'Ok it has ownership, good for it?' I hadn't run into such a problem before either in any form. Now I know. > > > I have a list of a custom widget class that keeps track of several > > directories. Each class gets put into a row on the table. I have a set > > of radio buttons that will show me different views of the data: All, > > New, Done, Errors, Warnings. > > When I switch views, I clear my table, set the row count to 0, and > > then add back in only the widgets I want to see. > > > Error 1: > > I load in the data initially, and then repopulate the table, and then > > re-size the window, instantly all listed rows are cleared, but the > > rows stay. This only happened on the diagonal re-size (bottom left > > corner); not the up and down, or side to side re-size. Attempting to > > repopulate the table, resulted in: underlying C/C++ object has been > > deleted. Though it will put in the correct number of rows required. > > > Everything worked fine as long as I did not re-size the window. > > This may only be a symptom of the behaviour and not a guarantee that > the code was working correctly up until the point when the resize > occurred. > > > Error 2: > > I load in the data initially, and then repopulate the table, the table > > clears and then nothing happens. No error messages or even visible > > rows. After several more repopulates it with either crash or tell me: > > underlying C/C++ object has been deleted. > > > I had error 1 two days ago, then without changing the code, I now get > > error 2. I do not have to re-size the window for it to break now. > > I recommend that you create a list of non-widget data structures in > your parsePath() method and create widgets on the fly in your addToTable() > method. If you need to retain information when you repopulate the table > then update the data structures that correspond to the widgets just before > you clear the table. > > David Thanks, it does work now that I've split it into a data and widget class and create the widgets on the fly. Thanks for the help and sorry for the delayed response. Andrew -- http://mail.python.org/mailman/listinfo/python-list
Re: pyqt4 Table Widget deleting c/c++ object
On Monday 18 October 2010 23:26, Andrew wrote: > I have two issues dealing with the table widget, though they may be > interconnected. I'm not sure. Both delete the cell widgets off of my > table but leave the rows, and then when I have the table update, it > complains the c++ object has been deleted. > > # self.tableData.setCellWidget(rowCount, 0, trackItem) > # RuntimeError: underlying C/C++ object has been deleted This is because you pass your widgets to this method and later ask the table to clear the contents of the table. When it does so, it deletes the underlying widgets, leaving only Python wrappers. The documentation mentions that the table takes ownership of the widget: http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qtablewidget.html#setCellWidget > I have a list of a custom widget class that keeps track of several > directories. Each class gets put into a row on the table. I have a set > of radio buttons that will show me different views of the data: All, > New, Done, Errors, Warnings. > When I switch views, I clear my table, set the row count to 0, and > then add back in only the widgets I want to see. > > Error 1: > I load in the data initially, and then repopulate the table, and then > re-size the window, instantly all listed rows are cleared, but the > rows stay. This only happened on the diagonal re-size (bottom left > corner); not the up and down, or side to side re-size. Attempting to > repopulate the table, resulted in: underlying C/C++ object has been > deleted. Though it will put in the correct number of rows required. > > Everything worked fine as long as I did not re-size the window. This may only be a symptom of the behaviour and not a guarantee that the code was working correctly up until the point when the resize occurred. > Error 2: > I load in the data initially, and then repopulate the table, the table > clears and then nothing happens. No error messages or even visible > rows. After several more repopulates it with either crash or tell me: > underlying C/C++ object has been deleted. > > I had error 1 two days ago, then without changing the code, I now get > error 2. I do not have to re-size the window for it to break now. I recommend that you create a list of non-widget data structures in your parsePath() method and create widgets on the fly in your addToTable() method. If you need to retain information when you repopulate the table then update the data structures that correspond to the widgets just before you clear the table. David -- http://mail.python.org/mailman/listinfo/python-list
Re: pyqt4 Table Widget deleting c/c++ object
On Oct 18, 2:26 pm, Andrew wrote: > I have two issues dealing with the table widget, though they may be > interconnected. I'm not sure. Both delete the cell widgets off of my > table but leave the rows, and then when I have the table update, it > complains the c++ object has been deleted. > > # self.tableData.setCellWidget(rowCount, 0, trackItem) > # RuntimeError: underlying C/C++ object has been deleted > > I have a list of a custom widget class that keeps track of several > directories. Each class gets put into a row on the table. I have a set > of radio buttons that will show me different views of the data: All, > New, Done, Errors, Warnings. > When I switch views, I clear my table, set the row count to 0, and > then add back in only the widgets I want to see. > > Error 1: > I load in the data initially, and then repopulate the table, and then > re-size the window, instantly all listed rows are cleared, but the > rows stay. This only happened on the diagonal re-size (bottom left > corner); not the up and down, or side to side re-size. Attempting to > repopulate the table, resulted in: underlying C/C++ object has been > deleted. Though it will put in the correct number of rows required. > > Everything worked fine as long as I did not re-size the window. > > Error 2: > I load in the data initially, and then repopulate the table, the table > clears and then nothing happens. No error messages or even visible > rows. After several more repopulates it with either crash or tell me: > underlying C/C++ object has been deleted. > > I had error 1 two days ago, then without changing the code, I now get > error 2. I do not have to re-size the window for it to break now. > > I am using python 2.7 with PyQt4 4.7.7 > > Thanks for any insight, > Andrew Here is a working example of what I'm describing above. http://dl.dropbox.com/u/11715751/trackSetLoader.rar Thanks. -- http://mail.python.org/mailman/listinfo/python-list
pyqt4 Table Widget deleting c/c++ object
I have two issues dealing with the table widget, though they may be interconnected. I'm not sure. Both delete the cell widgets off of my table but leave the rows, and then when I have the table update, it complains the c++ object has been deleted. # self.tableData.setCellWidget(rowCount, 0, trackItem) # RuntimeError: underlying C/C++ object has been deleted I have a list of a custom widget class that keeps track of several directories. Each class gets put into a row on the table. I have a set of radio buttons that will show me different views of the data: All, New, Done, Errors, Warnings. When I switch views, I clear my table, set the row count to 0, and then add back in only the widgets I want to see. Error 1: I load in the data initially, and then repopulate the table, and then re-size the window, instantly all listed rows are cleared, but the rows stay. This only happened on the diagonal re-size (bottom left corner); not the up and down, or side to side re-size. Attempting to repopulate the table, resulted in: underlying C/C++ object has been deleted. Though it will put in the correct number of rows required. Everything worked fine as long as I did not re-size the window. Error 2: I load in the data initially, and then repopulate the table, the table clears and then nothing happens. No error messages or even visible rows. After several more repopulates it with either crash or tell me: underlying C/C++ object has been deleted. I had error 1 two days ago, then without changing the code, I now get error 2. I do not have to re-size the window for it to break now. I am using python 2.7 with PyQt4 4.7.7 Thanks for any insight, Andrew -- http://mail.python.org/mailman/listinfo/python-list
Re: Deleting widgets from PyQt4 QFormWidget
On Wednesday 15 September 2010 18:53, Andrew wrote: > I'm trying to remove the widgets from the QFormLayout widget from > PyQt4. According to the documentation I should be able to use the > command .takeAt(int) which will delete the widget from the layout and > then return to me the QLayoutWidget. It will remove the widget from the layout but it won't delete it because it doesn't own it. The widget will still remain within its parent widget. You have to either reparent it to another widget, or delete it manually. [...] > Am I missing a step or is this just broken? I haven't been able to > find anything else on this issue yet. If it's broke, is there any > potential workaround? Try calling deleteLater() on each widget when you take it from the layout. Does that work? David -- http://mail.python.org/mailman/listinfo/python-list
Re: Deleting widgets from PyQt4 QFormWidget
On Sep 15, 9:53 am, Andrew wrote: > I'm trying to remove the widgets from the QFormLayout widget from > PyQt4. According to the documentation I should be able to use the > command .takeAt(int) which will delete the widget from the layout and > then return to me the QLayoutWidget. > It currently is giving me back the widget, but is not removing it from > the layout. > At the moment, I'm simply trying to clear out all the widgets on the > layout with this: > > def clearForm(self): > print ("Clearing") > print self.dataForm.rowCount() > for i in range(self.dataForm.rowCount()-1, -1, -1): > print " .", > tmp = self.dataForm.takeAt(i) > print tmp.widget() > tmp = "" > print self.dataForm.rowCount() > > It goes through each widget on the layout, and prints out the > classes .__repr__ on the tmp.widget() line since tmp is a > QLayoutWidget. So it's doing the returning part, but they still exist > instead of being deleted like the documentation explains. > > Am I missing a step or is this just broken? I haven't been able to > find anything else on this issue yet. If it's broke, is there any > potential workaround? > > I'm using python 2.6.4 and PyQt4 4.7.6 > > Thanks, > Andrew QLayoutWidget, I meant a QWidgetItem. -- http://mail.python.org/mailman/listinfo/python-list
Deleting widgets from PyQt4 QFormWidget
I'm trying to remove the widgets from the QFormLayout widget from PyQt4. According to the documentation I should be able to use the command .takeAt(int) which will delete the widget from the layout and then return to me the QLayoutWidget. It currently is giving me back the widget, but is not removing it from the layout. At the moment, I'm simply trying to clear out all the widgets on the layout with this: def clearForm(self): print ("Clearing") print self.dataForm.rowCount() for i in range(self.dataForm.rowCount()-1, -1, -1): print " .", tmp = self.dataForm.takeAt(i) print tmp.widget() tmp = "" print self.dataForm.rowCount() It goes through each widget on the layout, and prints out the classes .__repr__ on the tmp.widget() line since tmp is a QLayoutWidget. So it's doing the returning part, but they still exist instead of being deleted like the documentation explains. Am I missing a step or is this just broken? I haven't been able to find anything else on this issue yet. If it's broke, is there any potential workaround? I'm using python 2.6.4 and PyQt4 4.7.6 Thanks, Andrew -- http://mail.python.org/mailman/listinfo/python-list
pyqt4 vs pygtk2 vs pyjamas (was: GUIs - A Modest Proposal)
On Jun 13, 3:43 pm, Michael Torrie wrote: > On 06/13/2010 05:29 AM, lkcl wrote: > > > really? drat. i could have done with knowing that at the time. > > hmmm, perhaps i will return to the pyqt4 port after all. > > We're now wandering well off-topic here, but then again this thread was > never really on any particular topic. :) > I have to say I'm really confused as to your issues with GTK and Qt. yeahh... it's kinda necessary to have done complex HTML/CSS-based layouts (or better yet, an equivalent, e.g. using declarative python- driven widget-enhanced DOM programming) to appreciate the perspective i'm coming from. the "rules" for table layouts in browsers are (aside from their technical limitations) incredibly powerful, flexible and ultimately very very forgiving of users' lack of knowledge and experience. use of - reliance upon - these rules results in quite a bit less code (both for the pyjamas ui widget developers to have to write, and also for the users/developers of the pyjamas widget set). so my expectations were that i should be able to do the same sort of thing with GTK or QT, and... it just wasn't happening. to highlight this further, i should point out that i looked up paul bonser's browser-written-in-python, called pybrowser: http://git.paulbonser.com/ in it, you can find some pseudo-code for table/div which he's obviously looked up somewhere, presumably in W3C DOM specifications. he's already successfully implemented rules, but the rules he left for another time. i tried implementing them: i cannot make head nor tail of the algorithm/pseudocode :) it's _that_ complex a recursive interaction, between block-based and flowing layout objects. i mention this because to even _remotely_ attempt to accurately re- create pyjamas desktop using Qt4 or Gtk2, it would be necessary, ultimately, to implement the same browser-based recursive layout algorithm that is already in existing web browsers. by doing that, effectively i would actually be creating the vast majority of the functionality of a web browser... in python! and rather than do that from scratch, i would actually be better off either helping (or waiting for) paul to work on pybrowser, or recover and work on grailbrowser (which i've begun doing - it now runs under python 2.4 and just needs all its regular expressions converted from regex to sre in order to run under python2.5+) http://github.com/lkcl/grailbrowser ... ... and then using _that_ as the basis for another pyjamas port, by adding and using W3C DOM functions (which don't exist in grailbrowser sadly). paul bonser's work is actually the better underlying framework: he's already added the W3C DOM TR1 through to TR3 properties and functions, such as getElementById(), appendChild(), offsetWidth and so on, but grailbrowser is the better _actual_ browser on account of it actually... working! :) in a delicious piece of irony, which brings us back full circle to the original discussion, python/tk-haters will howwl with fury to learn that grailbrowser is a fully-functioning 35,000-line python/tk application :) > I've seen and done all kinds of fancy widget layouts in Qt and have > *never* had to subclass layout. If you think you need to subclass > QLayout, most of the time you're doing it wrong. You are familiar with > how the vertical and horizontal layouts and spacers work in Qt, aren't > you? yes. > Sometimes you need a grid for a table or the specialized form > grid. But other than that you want a dynamically-sizing layouts most > of the time. And Qt's Vertical and Horizontal layouts do that. sadly, not to the kind of recursive / child _and_ parent inter- dependent level as browser layouts that would make it a simple viable alternative. > I'm also confused by your claim that GTK lacks the layout widgets you > need as well. GTK has the GtkHBox layout class which acts much like > your tag. Anything to pack in the hbox is automatically layed > out in a dynamicially-resizing way. i did map pyjamas UI HorizontalPanel directly onto GtkHBox, and so on: i got a long long way, very very quickly by doing that. perhaps... perhaps if you have time, if you could take a look at the pyjd-gtk2 and/or the pyjd-qt4 ports, you might be able to point out where i'm going wrong. they're both here: http://github.com/lkcl/pyjamas-desktop they're a bit old, but are functional (install python-gtkhtml2 even to get the pyjd-qt4 port to run, there's some code still accidentally left in) and you run them with "hello_loader.py" by hacking in the appropriate class - you'll see what i mean. > > excellent! that actually makes it worthwhile carrying on. the only > > other thing that needs solving is that RichText is forced to have its &
PyQt4 QThread - passing arguments to thread methods
Hi, I am trying to figure out how to implement a QThread class that will handle GUI event while keeping the GUI responsive. I want to call thread's methods by their names and start() the thread from inside that method. My problem is with passing methods their arguments since start() wont take any argument. So I thought I could keep a global variable self.invoker which holds the name of currently called method and start the thread accordingly as follows: class Counter(QThread): def __init__(self, parent=None): super(Counter, self).__init__(parent) self.reset() def __del__(self): self.exiting = True self.wait() try: self.reset() # is not instantiated except TypeError: return def stop(self): self.__del__() def reset(self): self.exiting = False def countup(self, till): if not self.isRunning(): self.invoker = [self.countup, till] self.start() else: n = 0 while not self.exiting and n < till: n += 1 self.emit(SIGNAL("ticktock(int)", n)) def run(self): self.invoker[0](self.invoker[1], self.invoker[2]) But I cant always know the number of arguments the invoker has, can I? So can you please suggest me a better way of doing this please? Thanks in advance. -- http://mail.python.org/mailman/listinfo/python-list
Re: Help with PyQt4 tabwidget setup
On Fri, 21 May 2010 08:03:43 +0200, dpalmboom wrote: > I am creating an application and I'm busy designing the main layout on > the main window. What I would like to do is the following: > > Create a QTabWidget with a QVBoxLayout already inside it and also a > scrollbar inside it. When a user triggers a menu item, a QDockWidget > must be created and inserted into the QVBoxLayout, but it must not > stretch to the bottom of the QTabWidget. The QDockWidget must keep a set > size in the QVBoxLayout. When the user triggers another menu item, the > next QDockWidget must go above or below the existing QDockWidgets in the > QVBoxLayout. > > I currently have the following code for the QTabWidget: > > class PaneTabWidget(PyQt4.QtGui.QTabWidget): > > def __init__(self, tabs, parent=None): > > """ > A tabwidget to go inside a Pane. > """ > > super(PaneTabWidget, self).__init__(parent) > > for tab in tabs: > > if tab == "Properties": > self.propertiesBin() > elif tab == "Schedule": > self.scheduleBin() > elif tab == "Pricelist": > self.pricelistBin() > > def setLayoutAndScrollBar(self, page): > pass > > def addPanel(self, panel, type): > self.addTab(panel, type) > > def propertiesBin(self): > self.page = PyQt4.QtGui.QWidget() > self.addTab(self.page, "Properties") > self.setLayoutAndScrollBar(self.page) > > Right now, the dockwidget gets put into a new tab in the tab widget, but > I would like to put it into an existing QVBoxLayout. I currently have a > blank QWidget as a "placeholder" page of the tabwidget. > > If anyone can help me with this, it would be greatly appreciated. > > Thanks Hi, not 100% sure what you are after, but perhaps a standard tabWidget, with a customised Scrollarea forming the panel is one way? from PyQt4 import QtGui class TabPane(QtGui.QScrollArea): def __init__(self, parent=None): super(TabPane, self).__init__(parent) frame = QtGui.QFrame(self) frame.setFixedSize(300,200) self.setWidget(frame) self.layout = QtGui.QVBoxLayout(frame) def addDock(self, title): dw = QtGui.QDockWidget(title, self) self.layout.addWidget(dw) if __name__ == "__main__": app = QtGui.QApplication([]) tab_widget = QtGui.QTabWidget() for heading in ["Properties", "Schedule", "Pricelist"]: pane = TabPane() pane.addDock("Hello World") pane.addDock("Hello Galaxy") pane.addDock("Hello Universe") tab_widget.addTab(pane , heading) tab_widget.show() app.exec_() -- http://mail.python.org/mailman/listinfo/python-list
Help with PyQt4 tabwidget setup
I am creating an application and I'm busy designing the main layout on the main window. What I would like to do is the following: Create a QTabWidget with a QVBoxLayout already inside it and also a scrollbar inside it. When a user triggers a menu item, a QDockWidget must be created and inserted into the QVBoxLayout, but it must not stretch to the bottom of the QTabWidget. The QDockWidget must keep a set size in the QVBoxLayout. When the user triggers another menu item, the next QDockWidget must go above or below the existing QDockWidgets in the QVBoxLayout. I currently have the following code for the QTabWidget: class PaneTabWidget(PyQt4.QtGui.QTabWidget): def __init__(self, tabs, parent=None): """ A tabwidget to go inside a Pane. """ super(PaneTabWidget, self).__init__(parent) for tab in tabs: if tab == "Properties": self.propertiesBin() elif tab == "Schedule": self.scheduleBin() elif tab == "Pricelist": self.pricelistBin() def setLayoutAndScrollBar(self, page): pass def addPanel(self, panel, type): self.addTab(panel, type) def propertiesBin(self): self.page = PyQt4.QtGui.QWidget() self.addTab(self.page, "Properties") self.setLayoutAndScrollBar(self.page) Right now, the dockwidget gets put into a new tab in the tab widget, but I would like to put it into an existing QVBoxLayout. I currently have a blank QWidget as a "placeholder" page of the tabwidget. If anyone can help me with this, it would be greatly appreciated. Thanks -- http://mail.python.org/mailman/listinfo/python-list
Re: PyQt4 designer custom properties - combo box style
On Saturday 06 February 2010 10:32, Andrew wrote: > I'm attempting to create a drop down property for a custom widget I'm > creating. So when in designer and you scroll down to the custom > properties, under the regular widget properties, one of them would be > a drop down menu. The data to populate it will be coming from our API > and currently is a list of string-items. Yes, it would be treated > specially by Designer, since it's the only place it would be seen. Right. The drop down menus in the property editor usually contain values defined for C++ enums which have been declared to Qt's meta-object system when a C++ library or plugin is compiled. I'm not sure that PyQt can expose lists of Python values in the same way. An example of this is the alignment property in QLineEdit. > In the PyQt4\examples\designer folder, it carries a number of custom > widgets that will load into designer. The datetimeedit widget creates > a custom drop down menu property. The plugin pulls its information > from the QtCore libraries and from the QCalander Widget. Though I am > unable to find a better example or even explanation of how it's > actually creating that drop down menu. Each of the individual properties are just single values, aren't they, not collections of values? >> Have you seen this article? >> >> http://qt.nokia.com/doc/qq/qq26-pyqtdesigner.html > > No, I haven't, thanks. That might step in the right direction. I can't > run it right now, so I'm not sure if it is putting a spinbox as it's > property or just the value from the spin box. The value from each spin box is turned into a property, so there are latitude and longitude properties, though each of these only holds a double precision floating point number. It sounds like you want to be able to select from a list of values, or possibly change the values themselves. If it turns out you can't add a property to Qt Designer in the way you want, you can still add a custom editor to the widget so that users can open a context menu and select an item to configure it. This is similar to the way you can open a dialog to edit the text inside QTextEdit widgets. The article I referred to also covers this: http://qt.nokia.com/doc/qq/qq26-pyqtdesigner.html#makingamenu David -- http://mail.python.org/mailman/listinfo/python-list
Re: PyQt4 designer custom properties - combo box style
On Feb 4, 2:59 pm, David Boddie wrote: > On Tuesday 02 February 2010 22:25, Andrew wrote: > > > I am creating custom widgets for the PyQt4 Designer. I can create > > custom properties, but I'm looking for how to create a custom property > > that has a combo box drop down. I've seen them in the example widgets > > and tried following them, but they are using pre-defined items to > > populate their property, so it's not a very clear example of how to > > get the combo box property to work. > > Can you explain a bit more about what you have seen and what you are > trying to do. Are you trying to create a property that is treated > specially by Designer or do you want to get the data for the combo > box from somewhere else? I'm attempting to create a drop down property for a custom widget I'm creating. So when in designer and you scroll down to the custom properties, under the regular widget properties, one of them would be a drop down menu. The data to populate it will be coming from our API and currently is a list of string-items. Yes, it would be treated specially by Designer, since it's the only place it would be seen. In the PyQt4\examples\designer folder, it carries a number of custom widgets that will load into designer. The datetimeedit widget creates a custom drop down menu property. The plugin pulls its information from the QtCore libraries and from the QCalander Widget. Though I am unable to find a better example or even explanation of how it's actually creating that drop down menu. > > > Is there any other examples or help for this kind of setup? > > Have you seen this article? > > http://qt.nokia.com/doc/qq/qq26-pyqtdesigner.html No, I haven't, thanks. That might step in the right direction. I can't run it right now, so I'm not sure if it is putting a spinbox as it's property or just the value from the spin box. > > David Andrew -- http://mail.python.org/mailman/listinfo/python-list
Re: PyQt4 designer custom properties - combo box style
On Tuesday 02 February 2010 22:25, Andrew wrote: > I am creating custom widgets for the PyQt4 Designer. I can create > custom properties, but I'm looking for how to create a custom property > that has a combo box drop down. I've seen them in the example widgets > and tried following them, but they are using pre-defined items to > populate their property, so it's not a very clear example of how to > get the combo box property to work. Can you explain a bit more about what you have seen and what you are trying to do. Are you trying to create a property that is treated specially by Designer or do you want to get the data for the combo box from somewhere else? > Is there any other examples or help for this kind of setup? Have you seen this article? http://qt.nokia.com/doc/qq/qq26-pyqtdesigner.html David -- http://mail.python.org/mailman/listinfo/python-list
PyQt4 designer custom properties - combo box style
I am creating custom widgets for the PyQt4 Designer. I can create custom properties, but I'm looking for how to create a custom property that has a combo box drop down. I've seen them in the example widgets and tried following them, but they are using pre-defined items to populate their property, so it's not a very clear example of how to get the combo box property to work. Is there any other examples or help for this kind of setup? Thanks, Andrew -- http://mail.python.org/mailman/listinfo/python-list
Re: pyqt4 eric4 generated gui custom dialog open
rewonka wrote: > Hi, > > I've made a little application with mainwindow and one dialog > (something like input dialog). > I can't open the input dialog from my mainwindow > > I tried to open the dialog with a button, here is a code: > @pyqtSignature("") > def on_BtnAdd_clicked(self): > """ > Open input dialog for some data input > """ > Dialog = QDialog() > ui = DlgAdd() > ui.setupUi(Dialog) > Dialog.show() > > and if I clicked the button , it's like the dialog open and disappear. That is caused by the Python garbage collector removing your objects when the method is left. In order to keep the dialog, you must assign it to some class members. Alternatively you may replace "Dialog.show()" with Dialog.exec_() to get a modal dialog. Detlev > I searched a lot and found , that i need something to connect, but i > didn't found how (exactly source code). On the dialog i have two > button (OK,Cancel). > As i saw the generated code for pyqt has line like this: > QtCore.QMetaObject.connectSlotsByName(MainWindow) > I think that's mean i don't need to connect, if i have the function > for it,but I don't know how to write?? > > Thank for Help, > Rewonka -- Detlev Offenbach det...@die-offenbachs.de -- http://mail.python.org/mailman/listinfo/python-list
pyqt4 eric4 generated gui custom dialog open
Hi, I've made a little application with mainwindow and one dialog (something like input dialog). I can't open the input dialog from my mainwindow I tried to open the dialog with a button, here is a code: @pyqtSignature("") def on_BtnAdd_clicked(self): """ Open input dialog for some data input """ Dialog = QDialog() ui = DlgAdd() ui.setupUi(Dialog) Dialog.show() and if I clicked the button , it's like the dialog open and disappear. I searched a lot and found , that i need something to connect, but i didn't found how (exactly source code). On the dialog i have two button (OK,Cancel). As i saw the generated code for pyqt has line like this: QtCore.QMetaObject.connectSlotsByName(MainWindow) I think that's mean i don't need to connect, if i have the function for it,but I don't know how to write?? Thank for Help, Rewonka -- http://mail.python.org/mailman/listinfo/python-list
Re: PyQt4 4.4.4 : a bug with highlightBlock ?
> You need to change the indexOf() calls to indexIn() calls on the QRegExp > object: > > index = expression.indexIn(text, index + length) Thank you so much ! After looking a bit more I found out that when using indexOf the command : length = expression.matchedLength() was the one causing a problem. Thus I also had to change the line : index = text.indexOf(expression) to : index = expression.indexIn(text) Now it works like a charm ! I'll test it at work where we have PyQt 4.3.3. Thanks again ! -- http://mail.python.org/mailman/listinfo/python-list
Re: PyQt4 4.4.4 : a bug with highlightBlock ?
On Wednesday 18 November 2009 11:47, Snouffy wrote: > I've been trying to do some syntax highlighting using PyQt4. I ported > the example given in the documentation of Qt4 to Python. It works fine > on my computer at work (which has PyQt4 version 4.3.3) but doesn't on > my home computer (which has version 4.4.4) : it gets stuck in an > infinite loop. This is a known issue. There are examples distributed with PyQt that should have been updated to use a slightly different approach. > Here is the code : > > class MyHighlighter(QtGui.QSyntaxHighlighter): > def __init__(self, edit): > QtGui.QSyntaxHighlighter.__init__(self,edit) > > def highlightBlock(self, text): > myClassFormat = QtGui.QTextCharFormat() > myClassFormat.setFontWeight(QtGui.QFont.Bold) > myClassFormat.setForeground(QtCore.Qt.darkMagenta) > pattern = "\\b[A-Z_]+\\b" > > expression = QtCore.QRegExp(pattern) > index = text.indexOf(expression); > while (index >= 0): > length = expression.matchedLength() > self.setFormat(index, length, myClassFormat) > index = text.indexOf(expression, index + length) You need to change the indexOf() calls to indexIn() calls on the QRegExp object: index = expression.indexIn(text, index + length) > What am I missing ? Is this a known bug of version 4.4.4 ? I think there was a behavioural change at some point that affected regular expression searching in QStrings. David -- http://mail.python.org/mailman/listinfo/python-list
PyQt4 4.4.4 : a bug with highlightBlock ?
Hello everybody, I've been trying to do some syntax highlighting using PyQt4. I ported the example given in the documentation of Qt4 to Python. It works fine on my computer at work (which has PyQt4 version 4.3.3) but doesn't on my home computer (which has version 4.4.4) : it gets stuck in an infinite loop. Here is the code : class MyHighlighter(QtGui.QSyntaxHighlighter): def __init__(self, edit): QtGui.QSyntaxHighlighter.__init__(self,edit) def highlightBlock(self, text): myClassFormat = QtGui.QTextCharFormat() myClassFormat.setFontWeight(QtGui.QFont.Bold) myClassFormat.setForeground(QtCore.Qt.darkMagenta) pattern = "\\b[A-Z_]+\\b" expression = QtCore.QRegExp(pattern) index = text.indexOf(expression); while (index >= 0): length = expression.matchedLength() self.setFormat(index, length, myClassFormat) index = text.indexOf(expression, index + length) What am I missing ? Is this a known bug of version 4.4.4 ? Thank you, Alexis. -- http://mail.python.org/mailman/listinfo/python-list
Re: PyQT4 user group
On Thursday 29 October 2009 17:15, Diez B. Roggisch wrote: > Chris wrote: > >> I'm starting to learn and use PyQT4 at work. Is there a good user >> group or forum out there that I should know about? > > The PyQt Mailinglist. There's a #pyqt IRC channel on Freenode: irc://irc.freenode.net/pyqt The Wiki is also a fairly useful resource: http://www.diotavelli.net/PyQtWiki David -- http://mail.python.org/mailman/listinfo/python-list
Re: PyQT4 user group
Diez B. Roggisch wrote: Chris wrote: Hi! I'm starting to learn and use PyQT4 at work. Is there a good user group or forum out there that I should know about? The PyQt Mailinglist. Diez I find the Gmane server, which delivers items from the PyQt Mailing List, easier to use. It threads the messages. Colin W. -- http://mail.python.org/mailman/listinfo/python-list
Re: PyQT4 user group
For detailed questions, try http://stackoverflow.com/questions/tagged/pyqt or pyqt4 (the " or " may have to be escaped as "%20or%20" in some browsers.) -- http://mail.python.org/mailman/listinfo/python-list
Re: PyQT4 user group
Chris wrote: > Hi! > > I'm starting to learn and use PyQT4 at work. Is there a good user > group or forum out there that I should know about? The PyQt Mailinglist. Diez -- http://mail.python.org/mailman/listinfo/python-list
PyQT4 user group
Hi! I'm starting to learn and use PyQT4 at work. Is there a good user group or forum out there that I should know about? Thanks! -- http://mail.python.org/mailman/listinfo/python-list
Re: PyQt4 - remember widget positions
nusch wrote: > Is there any simple command which allows me to save position of all > windows: QMainWindow, QDialogs and qdockwidgets with their sizes, > dock state and positions ? Or do I need to store those values > manually, how can I do it fast? You can use saveState() from QMainWindow to save the dockwidget geometries. I save the size and position of the main window separately and restore it with resize() and move(). You need to make sure all your toolbars and dockwidgets have unique object names for saveState to work. Jeremy -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list
Re: PyQt4 - remember widget positions
On Oct 22, 4:05 am, TerryP wrote: > On Oct 21, 9:04 pm, nusch wrote: > > > Is there any simple command which allows me to save position of all > > windows: QMainWindow, QDialogs and qdockwidgets with their sizes, > > dock state and positions ? Or do I need to store those values > > manually, how can I do it fast? > > Both fast and simple have relative meanings, there may be some common > persistence mumbo jumbo added to Qt since I last looked but, in > generally read this: > > http://doc.trolltech.com/4.5/geometry.html > > I don't know off the top of my head if PyQt's documentation has code > examples on it, but it should be fairly easy for you to comprehend how > to do it in Python. > . > -- > TerryP Yes, but I meant how to store all QApplication windows size and pos at once, I don't want to introduce lot of additional strings describing keys in QSettings. I migrated my app from PyKDE to pure PyQt4 and there was 1 command for whole app to remember those settings. -- http://mail.python.org/mailman/listinfo/python-list
Re: PyQt4 - remember widget positions
On Oct 21, 9:04 pm, nusch wrote: > Is there any simple command which allows me to save position of all > windows: QMainWindow, QDialogs and qdockwidgets with their sizes, > dock state and positions ? Or do I need to store those values > manually, how can I do it fast? Both fast and simple have relative meanings, there may be some common persistence mumbo jumbo added to Qt since I last looked but, in generally read this: http://doc.trolltech.com/4.5/geometry.html I don't know off the top of my head if PyQt's documentation has code examples on it, but it should be fairly easy for you to comprehend how to do it in Python. -- TerryP -- http://mail.python.org/mailman/listinfo/python-list
PyQt4 - remember widget positions
Is there any simple command which allows me to save position of all windows: QMainWindow, QDialogs and qdockwidgets with their sizes, dock state and positions ? Or do I need to store those values manually, how can I do it fast? -- http://mail.python.org/mailman/listinfo/python-list
Re: trouble quitting PyQt4 App
Soumen banerjee wrote: Hi, Im new to PyQt4 and im having fun using it. but ive run into a bit of a problem. I cant quit the application. The application has 2 modules. The gui module(gui.py) and then the main program(main.py) [snip] so heres the problem:- when i hit the quit button, quit is set to high (in the Gui module) and then the while loop in the speak thread quits(printing quitting loop) and it updates the log file as its supposed to do. then after it prints calling exit, the app freezes. Isnt sys.exit() supposed to kill the interpreter? So, what is going on? why does the app not quit? sys.exit() just raises a SystemExit exception, so only the thread is terminated. -- http://mail.python.org/mailman/listinfo/python-list
trouble quitting PyQt4 App
Hi, Im new to PyQt4 and im having fun using it. but ive run into a bit of a problem. I cant quit the application. The application has 2 modules. The gui module(gui.py) and then the main program(main.py) heres gui.py: from PyQt4 import QtCore, QtGui import sys from subprocess import Popen class Ui_MainWindow(object): fileinit=False paused=True quit=False filename="" def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(394, 414) self.centralwidget = QtGui.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.scrollArea = QtGui.QScrollArea(self.centralwidget) self.scrollArea.setGeometry(QtCore.QRect(19, 9, 361, 281)) self.scrollArea.setWidgetResizable(True) self.scrollArea.setObjectName("scrollArea") self.scrollAreaWidgetContents = QtGui.QWidget(self.scrollArea) self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 357, 277)) self.scrollAreaWidgetContents.setObjectName("scrollAreaWidgetContents") self.textEdit = QtGui.QTextEdit(self.scrollAreaWidgetContents) self.textEdit.setGeometry(QtCore.QRect(-7, -6, 371, 291)) self.textEdit.setObjectName("textEdit") self.scrollArea.setWidget(self.scrollAreaWidgetContents) self.pushButton = QtGui.QPushButton(self.centralwidget) self.pushButton.setGeometry(QtCore.QRect(30, 310, 80, 25)) self.pushButton.setObjectName("pushButton") self.pushButton_2 = QtGui.QPushButton(self.centralwidget) self.pushButton_2.setGeometry(QtCore.QRect(139, 310, 91, 25)) self.pushButton_2.setObjectName("pushButton_2") self.pushButton_3 = QtGui.QPushButton(self.centralwidget) self.pushButton_3.setGeometry(QtCore.QRect(280, 310, 80, 25)) self.pushButton_3.setObjectName("pushButton_3") MainWindow.setCentralWidget(self.centralwidget) self.menubar = QtGui.QMenuBar(MainWindow) self.menubar.setGeometry(QtCore.QRect(0, 0, 394, 23)) self.menubar.setObjectName("menubar") MainWindow.setMenuBar(self.menubar) self.statusbar = QtGui.QStatusBar(MainWindow) self.statusbar.setObjectName("statusbar") MainWindow.setStatusBar(self.statusbar) self.retranslateUi(MainWindow) QtCore.QObject.connect(self.pushButton, QtCore.SIGNAL("clicked()"), self.Open) QtCore.QObject.connect(self.pushButton_2, QtCore.SIGNAL("clicked()"), self.Pause) QtCore.QObject.connect(self.pushButton_3, QtCore.SIGNAL("clicked()"), self.Quit) QtCore.QMetaObject.connectSlotsByName(MainWindow) def retranslateUi(self, MainWindow): MainWindow.setWindowTitle(QtGui.QApplication.translate("MainWindow", "MainWindow", None, QtGui.QApplication.UnicodeUTF8)) self.pushButton.setText(QtGui.QApplication.translate("MainWindow", "Open", None, QtGui.QApplication.UnicodeUTF8)) self.pushButton_2.setText(QtGui.QApplication.translate("MainWindow", "Pause/Resume", None, QtGui.QApplication.UnicodeUTF8)) self.pushButton_3.setText(QtGui.QApplication.translate("MainWindow", "Quit", None, QtGui.QApplication.UnicodeUTF8)) def Pause(self): print "Pause" self.paused=not(self.paused) def Quit(self): self.quit=True print "setting quit" def Open(self): print "Open" self.filename=QtGui.QFileDialog.getOpenFileName() self.filename=str(self.filename) f=open("book.txt","r") old=f.read(20) f.close() f=open(self.filename,'r') new=f.read(20) f.close() if(old!=new): Popen('rm log.txt',shell=True) f=open("book.txt",'w') f.write(new) f.close() self.fileinit=True print "setting fileinit" and heres the main.py from PyQt4 import QtCore, QtGui import sip,gui import sys from subprocess import Popen from threading import Thread class AppThread(Thread): appinit=False def run(self): app = QtGui.QApplication(sys.argv) MainWindow = QtGui.QMainWindow() self.u
Re: Migrate From PyQt3 to PyQt4
nusch wrote: I want to migrate from qt,pyqt,pykde 3 to 4 and remove all *.py files to work with newer version, also after remove pyqt3support. How can I do it in easy way ? I've read here http://www.mail-archive.com/p...@riverbankcomputing.com/msg15009.html something about deprecation warning but can't see such warning anywhere. My python modules also produce a lot of output so I can easily overlook such information. Is there a way to stop execution after every old qt3 class/method? I know I can remove all qt3, qt3support libs, but I don't want to make whole system unstable because of one project. Generic answer: when migrating one Python project independent of others on the same system, I'd suggest having an independent Python installation for the temporary mix of addon libraries. In your case the only difference might be the absense of the qt version 3 stuff. The way of supporting multiple environments varies by system and by user environment, but generally you can either change the shebang line, or the script/batch file you start the application with. If you're on Windows, you do not want to change the file association to point to the new environment, so be careful during install, not to make this the "default" Python installation. DaveA -- http://mail.python.org/mailman/listinfo/python-list
Migrate From PyQt3 to PyQt4
I want to migrate from qt,pyqt,pykde 3 to 4 and remove all *.py files to work with newer version, also after remove pyqt3support. How can I do it in easy way ? I've read here http://www.mail-archive.com/p...@riverbankcomputing.com/msg15009.html something about deprecation warning but can't see such warning anywhere. My python modules also produce a lot of output so I can easily overlook such information. Is there a way to stop execution after every old qt3 class/method? I know I can remove all qt3, qt3support libs, but I don't want to make whole system unstable because of one project. -- http://mail.python.org/mailman/listinfo/python-list
Re: PyQt4.__file__ gives PyQt4/__init__.py as value
On Aug 15, 2:19 pm, Christian Heimes wrote: > wgw wrote: > > I don't understand why the __file__ value in my installation of PyQt > > would not give a proper, full path. > > > I'm guessing that I did not install pyqt properly (I'm on Ubuntu > > Hardy, trying to install QT4.5), but before redoing the install, I > > want to see if there is a quicker fix. > > Some versions of Debian and Ubuntu used to compile Python files with a > relative path. Try this: > > python2.5 /usr/lib/python2.5/compileall.py -f /usr/lib/python2.5 > python2.5 -o /usr/lib/python2.5/compileall.py -f /usr/lib/python2.5 > > Christian python2.5 /usr/lib/python2.5/compileall.py -f /usr/lib/python2.5 didn't change anything, and there is no -o option (-O exists, but would that be useful?) thanks! -- http://mail.python.org/mailman/listinfo/python-list