[PyQt] QCoreApplication.translate()

2013-07-05 Thread paolo
Hi I'm trying to internationalize my PyQt application. Following the pyqt reference guide i'm trying to use QCoreApplication.translate() instead of self.tr(). Works but only if i write the full function. But if i want to shorten it in this way: tr = QCoreApplication.translate and then using

Re: [PyQt] QPixmap.loadFromData()

2013-01-28 Thread paolo
Il 2013-01-28 15:11 Hans-Peter Jansen ha scritto: try this: print("Load", pix.loadFromData(QByteArray(ba), "PNG")) I've tryed already this but with no success. >ba< is already a QByteArray BUT different from what i've store and i don't know why. As i've replyed before i can on

Re: [PyQt] QPixmap.loadFromData()

2013-01-28 Thread paolo
I changed my code in this way, converting bytea field to a text field: def createEditor(self, parent, option, index): dd = DisplayDialog(parent) ba = index.model().data(index, Qt.DisplayRole) if ba: pix=QPixmap() print("Load", pix.loadFromData(QByte

[PyQt] QPixmap.loadFromData()

2013-01-24 Thread paolo
Hello I'm trying to create a item delegate for a sql table (postgres db) where i have a field (type bytea) that should contain a PNG image. This is the code of the create editor method: def createEditor(self, parent, option, index): dd = DisplayDialog(parent) ba = index.model().

Re: [PyQt] Gui best practice

2012-02-28 Thread paolo
So for best performance at runtime it's prefereble to choose the first option Thank you On Wed, 29 Feb 2012 00:44:32 +0800, Goldfish Huang wrote: > The second depends on Qt,QtXml and PyQt4.uic. They cause inconvenience > when you distributing your PyQt program. And, the program has to spend > ex

[PyQt] i18n

2012-02-27 Thread paolo
I found in the mailing list archive this old post. As i have the same problem is there anything new about this ? I want to use a short form for QCoreApplication.translate("MyContext", "My String") but if i set: tr = QCoreApplication.translate(context, string) and use tr("MyContext", "My String"

[PyQt] Gui best practice

2012-02-27 Thread paolo
Hello I'm trying to understand how to manage ui files from qtdesigner in the best way. I see in the examples that i have 2 options: - use pyuic4.bat utility to translate ui file in a python class (included in a module) that create the graphical interface through the setupUi() method - load the ui f

Re: [PyQt] Using PostgreSQL

2011-10-17 Thread paolo
t; {0}".format(db.lastError().text())) >> query = QSqlQuery() >> query.exec_("select * from test_table;") >> while query.next(): >> print(query.value(0), query.value(1) ) >> >> This code return the error "Driver not loaded&quo

[PyQt] Using PostgreSQL

2011-10-17 Thread paolo
ry.value(0), query.value(1) ) This code return the error "Driver not loaded". If i change only the database driver, this line: db = QSqlDatabase.addDatabase("QODBC") I get the correct output: 1 Prova paolo 2 Prova Pippo Baudo So what's wrong ? I've cheked qsqlps

[PyQt] subclassing QSqlTableModel

2011-09-23 Thread paolo
invalid result type from StaffModel.flags() TypeError: invalid result type from StaffModel.flags() (...) If i delete the flags() method, so that StaffModel is the same of QSqlTableModel but with 'preloaded' the table name, everything works as expected. Looks Like i can not

[PyQt] tooltips in menu: how?

2009-03-18 Thread Paolo Milani
Hi! :) I'm a newbie. I've searched in the docs, but I haven't found the solution. I want to add tooltips to menu, but it doesn't work: tooltips are not displayed. Suggestions? my system: ubuntu linux 8.10 with kde 4..2 repository. Many thanks. This is the code: #!/usr/bin/env python # -*- c

Re: [PyQt] launch a dialog from main window

2008-06-06 Thread Paolo Franzetti
simone wrote: > Paolo Franzetti ha scritto: > >> How can I do this job without blocking the main window ? > > You don't have to set up another instance of QApplication in the viewer. > > But: this application starts in some way? On Windows, with Python 2.5.2 >