[PyKDE] QT4 PyQt Wowes - a bug ?
Dave S
eric3 at pusspaws.net
Fri Sep 29 11:44:36 BST 2006
Hi all, I got problems.
Now knowing that PyQt4 does not support the QT4 'Qt3Support' module - and
having opened and re-saved my QT3 dialogs as QT4 dialogs in QT4 designer I
realised that the dialogs are simply changed to use the ' Qt3Support'
module - I hit a problem !
So I decided that I would re-make the dialogs in QT4 designer afresh :) Being
carefull to not use any QT3 options I re-made my main window.
On my XP box I could not find pyuic4 so I
used /python24/lib/site-packages/PyQt4/uic/pyuic.py ...
I am assuming that this is the right thing to do ?
On execution I get an attribute error 'setcentralwidget' - to make sure it was
not something I was doing I made another simple dialog in QT4 designer - run
it and it works OK
I am stuck - I have looked at the output of pyuic and have googled to see
if 'setCentralWidget' is supported under PyQt4 - I looked in QDialog &
QWidget but cannot find a reference.
Help :(
Dave
<ui version="4.0" >
<author></author>
<comment></comment>
<exportmacro></exportmacro>
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>600</height>
</rect>
</property>
<property name="windowTitle" >
<string>PxQx Auditor</string>
</property>
<property name="windowIcon" >
<iconset>pngs/kontact_todo.png</iconset>
</property>
<widget class="QWidget" name="centralwidget" >
<layout class="QGridLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="1" column="0" colspan="5" >
<widget class="QTableWidget" name="tableWidget" >
<property name="baseSize" >
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="rowCount" >
<number>0</number>
</property>
<property name="columnCount" >
<number>2</number>
</property>
<column/>
<column/>
</widget>
</item>
<item row="2" column="0" colspan="5" >
<widget class="QProgressBar" name="progressBar" >
<property name="value" >
<number>0</number>
</property>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="0" column="0" >
<widget class="QPushButton" name="pushButton" >
<property name="minimumSize" >
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text" >
<string>&New Audit</string>
</property>
<property name="icon" >
<iconset>pngs/kontact_todo.png</iconset>
</property>
<property name="iconSize" >
<size>
<width>25</width>
<height>25</height>
</size>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="QPushButton" name="pushButton_2" >
<property name="minimumSize" >
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text" >
<string>&Certificate</string>
</property>
<property name="icon" >
<iconset>pngs/acroread.png</iconset>
</property>
<property name="iconSize" >
<size>
<width>25</width>
<height>25</height>
</size>
</property>
</widget>
</item>
<item row="0" column="2" >
<widget class="QPushButton" name="pushButton_3" >
<property name="minimumSize" >
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text" >
<string>&Eng PDF</string>
</property>
<property name="icon" >
<iconset>pngs/acroread.png</iconset>
</property>
<property name="iconSize" >
<size>
<width>25</width>
<height>25</height>
</size>
</property>
</widget>
</item>
<item row="0" column="3" >
<widget class="QPushButton" name="pushButton_4" >
<property name="minimumSize" >
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text" >
<string>&User PDF</string>
</property>
<property name="icon" >
<iconset>pngs/acroread.png</iconset>
</property>
<property name="iconSize" >
<size>
<width>25</width>
<height>25</height>
</size>
</property>
</widget>
</item>
<item row="0" column="4" >
<widget class="QLineEdit" name="lineEdit" >
<property name="minimumSize" >
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="font" >
<font>
<family>MS Shell Dlg 2</family>
<pointsize>8</pointsize>
<weight>75</weight>
<italic>false</italic>
<bold>true</bold>
<underline>false</underline>
<strikeout>false</strikeout>
</font>
</property>
<property name="text" >
<string> Status : Idle</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QMenuBar" name="menubar" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>19</height>
</rect>
</property>
<widget class="QMenu" name="menu_Manuals" >
<property name="title" >
<string>&Manuals</string>
</property>
<addaction name="action_Engineer_PDF" />
<addaction name="actionUser_PDF" />
</widget>
<widget class="QMenu" name="menu_About" >
<property name="title" >
<string>&About</string>
</property>
<addaction name="action_PxQxAuditor" />
<addaction name="action_Developer" />
</widget>
<widget class="QMenu" name="menu_Help" >
<property name="title" >
<string>&Help</string>
</property>
<addaction name="action_GPL_Licence" />
</widget>
<widget class="QMenu" name="menu_File" >
<property name="title" >
<string>&File</string>
</property>
<addaction name="action_New_Audit" />
<addaction name="action_Exit" />
</widget>
<widget class="QMenu" name="menuD_Base" >
<property name="title" >
<string>d&Base</string>
</property>
<addaction name="action_Export" />
<addaction name="action_Import" />
<addaction name="action_Prune" />
</widget>
<widget class="QMenu" name="menu_Screen" >
<property name="title" >
<string>&Screen</string>
</property>
<addaction name="action_Wipe" />
<addaction name="action_Lock" />
</widget>
<widget class="QMenu" name="menu_Certificate" >
<property name="title" >
<string>&Certificate</string>
</property>
<addaction name="action_Generate" />
<addaction name="action_Authenticate" />
</widget>
<addaction name="menu_File" />
<addaction name="menuD_Base" />
<addaction name="menu_Screen" />
<addaction name="menu_Certificate" />
<addaction name="menu_Manuals" />
<addaction name="menu_About" />
<addaction name="menu_Help" />
</widget>
<widget class="QStatusBar" name="statusbar" />
<action name="action_New_Audit" >
<property name="icon" >
<iconset>pngs/kontact_todo.png</iconset>
</property>
<property name="text" >
<string>&New Audit</string>
</property>
</action>
<action name="action_Exit" >
<property name="icon" >
<iconset>pngs/exit.png</iconset>
</property>
<property name="text" >
<string>&Exit</string>
</property>
</action>
<action name="action_Export" >
<property name="icon" >
<iconset>pngs/kfloppy.png</iconset>
</property>
<property name="text" >
<string>&Export</string>
</property>
</action>
<action name="action_Import" >
<property name="icon" >
<iconset>pngs/kfloppy.png</iconset>
</property>
<property name="text" >
<string>&Import</string>
</property>
</action>
<action name="action_Prune" >
<property name="icon" >
<iconset>pngs/package_utilities.png</iconset>
</property>
<property name="text" >
<string>&Prune</string>
</property>
</action>
<action name="action_Wipe" >
<property name="icon" >
<iconset>pngs/filenew.png</iconset>
</property>
<property name="text" >
<string>&Wipe</string>
</property>
</action>
<action name="action_Lock" >
<property name="icon" >
<iconset>pngs/password.png</iconset>
</property>
<property name="text" >
<string>&Lock</string>
</property>
</action>
<action name="action_Generate" >
<property name="icon" >
<iconset>pngs/acroread.png</iconset>
</property>
<property name="text" >
<string>&Generate</string>
</property>
</action>
<action name="action_Authenticate" >
<property name="icon" >
<iconset>pngs/acroread.png</iconset>
</property>
<property name="text" >
<string>&Authenticate</string>
</property>
</action>
<action name="action_Engineer_PDF" >
<property name="icon" >
<iconset>pngs/acroread.png</iconset>
</property>
<property name="text" >
<string>&Engineer PDF</string>
</property>
</action>
<action name="actionUser_PDF" >
<property name="icon" >
<iconset>pngs/acroread.png</iconset>
</property>
<property name="text" >
<string>User PDF</string>
</property>
</action>
<action name="action_PxQxAuditor" >
<property name="icon" >
<iconset>pngs/kfind.png</iconset>
</property>
<property name="text" >
<string>&PxQx Auditor</string>
</property>
</action>
<action name="action_Developer" >
<property name="icon" >
<iconset>pngs/kfind.png</iconset>
</property>
<property name="text" >
<string>&Developer</string>
</property>
</action>
<action name="action_GPL_Licence" >
<property name="icon" >
<iconset>pngs/kfind.png</iconset>
</property>
<property name="text" >
<string>&GPL Licence</string>
</property>
</action>
</widget>
<pixmapfunction></pixmapfunction>
<resources/>
<connections/>
</ui>
The py file pyuic generates
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'mainscreen.ui'
#
# Created: Fri Sep 29 11:07:25 2006
# by: PyQt4 UI code generator 4.0.1
#
# WARNING! All changes made in this file will be lost!
import sys
from PyQt4 import QtCore, QtGui
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(QtCore.QSize(QtCore.QRect(0,0,800,600).size()).expandedTo(MainWindow.minimumSizeHint()))
MainWindow.setWindowIcon(QtGui.QIcon("pngs/kontact_todo.png"))
self.centralwidget = QtGui.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
self.gridlayout = QtGui.QGridLayout(self.centralwidget)
self.gridlayout.setMargin(9)
self.gridlayout.setSpacing(6)
self.gridlayout.setObjectName("gridlayout")
self.tableWidget = QtGui.QTableWidget(self.centralwidget)
self.tableWidget.setBaseSize(QtCore.QSize(0,0))
self.tableWidget.setObjectName("tableWidget")
self.gridlayout.addWidget(self.tableWidget,1,0,1,5)
self.progressBar = QtGui.QProgressBar(self.centralwidget)
self.progressBar.setProperty("value",QtCore.QVariant(0))
self.progressBar.setOrientation(QtCore.Qt.Horizontal)
self.progressBar.setObjectName("progressBar")
self.gridlayout.addWidget(self.progressBar,2,0,1,5)
self.pushButton = QtGui.QPushButton(self.centralwidget)
self.pushButton.setMinimumSize(QtCore.QSize(0,30))
self.pushButton.setIcon(QtGui.QIcon("pngs/kontact_todo.png"))
self.pushButton.setIconSize(QtCore.QSize(25,25))
self.pushButton.setObjectName("pushButton")
self.gridlayout.addWidget(self.pushButton,0,0,1,1)
self.pushButton_2 = QtGui.QPushButton(self.centralwidget)
self.pushButton_2.setMinimumSize(QtCore.QSize(0,30))
self.pushButton_2.setIcon(QtGui.QIcon("pngs/acroread.png"))
self.pushButton_2.setIconSize(QtCore.QSize(25,25))
self.pushButton_2.setObjectName("pushButton_2")
self.gridlayout.addWidget(self.pushButton_2,0,1,1,1)
self.pushButton_3 = QtGui.QPushButton(self.centralwidget)
self.pushButton_3.setMinimumSize(QtCore.QSize(0,30))
self.pushButton_3.setIcon(QtGui.QIcon("pngs/acroread.png"))
self.pushButton_3.setIconSize(QtCore.QSize(25,25))
self.pushButton_3.setObjectName("pushButton_3")
self.gridlayout.addWidget(self.pushButton_3,0,2,1,1)
self.pushButton_4 = QtGui.QPushButton(self.centralwidget)
self.pushButton_4.setMinimumSize(QtCore.QSize(0,30))
self.pushButton_4.setIcon(QtGui.QIcon("pngs/acroread.png"))
self.pushButton_4.setIconSize(QtCore.QSize(25,25))
self.pushButton_4.setObjectName("pushButton_4")
self.gridlayout.addWidget(self.pushButton_4,0,3,1,1)
self.lineEdit = QtGui.QLineEdit(self.centralwidget)
self.lineEdit.setMinimumSize(QtCore.QSize(0,30))
font = QtGui.QFont(self.lineEdit.font())
font.setFamily("MS Shell Dlg 2")
font.setPointSize(8)
font.setWeight(75)
font.setItalic(False)
font.setUnderline(False)
font.setStrikeOut(False)
font.setBold(True)
self.lineEdit.setFont(font)
self.lineEdit.setObjectName("lineEdit")
self.gridlayout.addWidget(self.lineEdit,0,4,1,1)
MainWindow.setCentralWidget(self.centralwidget)
self.menubar = QtGui.QMenuBar(MainWindow)
self.menubar.setGeometry(QtCore.QRect(0,0,800,19))
self.menubar.setObjectName("menubar")
self.menu_Manuals = QtGui.QMenu(self.menubar)
self.menu_Manuals.setObjectName("menu_Manuals")
self.menu_About = QtGui.QMenu(self.menubar)
self.menu_About.setObjectName("menu_About")
self.menu_Help = QtGui.QMenu(self.menubar)
self.menu_Help.setObjectName("menu_Help")
self.menu_File = QtGui.QMenu(self.menubar)
self.menu_File.setObjectName("menu_File")
self.menuD_Base = QtGui.QMenu(self.menubar)
self.menuD_Base.setObjectName("menuD_Base")
self.menu_Screen = QtGui.QMenu(self.menubar)
self.menu_Screen.setObjectName("menu_Screen")
self.menu_Certificate = QtGui.QMenu(self.menubar)
self.menu_Certificate.setObjectName("menu_Certificate")
MainWindow.setMenuBar(self.menubar)
self.statusbar = QtGui.QStatusBar(MainWindow)
self.statusbar.setObjectName("statusbar")
MainWindow.setStatusBar(self.statusbar)
self.action_New_Audit = QtGui.QAction(MainWindow)
self.action_New_Audit.setIcon(QtGui.QIcon("pngs/kontact_todo.png"))
self.action_New_Audit.setObjectName("action_New_Audit")
self.action_Exit = QtGui.QAction(MainWindow)
self.action_Exit.setIcon(QtGui.QIcon("pngs/exit.png"))
self.action_Exit.setObjectName("action_Exit")
self.action_Export = QtGui.QAction(MainWindow)
self.action_Export.setIcon(QtGui.QIcon("pngs/kfloppy.png"))
self.action_Export.setObjectName("action_Export")
self.action_Import = QtGui.QAction(MainWindow)
self.action_Import.setIcon(QtGui.QIcon("pngs/kfloppy.png"))
self.action_Import.setObjectName("action_Import")
self.action_Prune = QtGui.QAction(MainWindow)
self.action_Prune.setIcon(QtGui.QIcon("pngs/package_utilities.png"))
self.action_Prune.setObjectName("action_Prune")
self.action_Wipe = QtGui.QAction(MainWindow)
self.action_Wipe.setIcon(QtGui.QIcon("pngs/filenew.png"))
self.action_Wipe.setObjectName("action_Wipe")
self.action_Lock = QtGui.QAction(MainWindow)
self.action_Lock.setIcon(QtGui.QIcon("pngs/password.png"))
self.action_Lock.setObjectName("action_Lock")
self.action_Generate = QtGui.QAction(MainWindow)
self.action_Generate.setIcon(QtGui.QIcon("pngs/acroread.png"))
self.action_Generate.setObjectName("action_Generate")
self.action_Authenticate = QtGui.QAction(MainWindow)
self.action_Authenticate.setIcon(QtGui.QIcon("pngs/acroread.png"))
self.action_Authenticate.setObjectName("action_Authenticate")
self.action_Engineer_PDF = QtGui.QAction(MainWindow)
self.action_Engineer_PDF.setIcon(QtGui.QIcon("pngs/acroread.png"))
self.action_Engineer_PDF.setObjectName("action_Engineer_PDF")
self.actionUser_PDF = QtGui.QAction(MainWindow)
self.actionUser_PDF.setIcon(QtGui.QIcon("pngs/acroread.png"))
self.actionUser_PDF.setObjectName("actionUser_PDF")
self.action_PxQxAuditor = QtGui.QAction(MainWindow)
self.action_PxQxAuditor.setIcon(QtGui.QIcon("pngs/kfind.png"))
self.action_PxQxAuditor.setObjectName("action_PxQxAuditor")
self.action_Developer = QtGui.QAction(MainWindow)
self.action_Developer.setIcon(QtGui.QIcon("pngs/kfind.png"))
self.action_Developer.setObjectName("action_Developer")
self.action_GPL_Licence = QtGui.QAction(MainWindow)
self.action_GPL_Licence.setIcon(QtGui.QIcon("pngs/kfind.png"))
self.action_GPL_Licence.setObjectName("action_GPL_Licence")
self.menu_Manuals.addAction(self.action_Engineer_PDF)
self.menu_Manuals.addAction(self.actionUser_PDF)
self.menu_About.addAction(self.action_PxQxAuditor)
self.menu_About.addAction(self.action_Developer)
self.menu_Help.addAction(self.action_GPL_Licence)
self.menu_File.addAction(self.action_New_Audit)
self.menu_File.addAction(self.action_Exit)
self.menuD_Base.addAction(self.action_Export)
self.menuD_Base.addAction(self.action_Import)
self.menuD_Base.addAction(self.action_Prune)
self.menu_Screen.addAction(self.action_Wipe)
self.menu_Screen.addAction(self.action_Lock)
self.menu_Certificate.addAction(self.action_Generate)
self.menu_Certificate.addAction(self.action_Authenticate)
self.menubar.addAction(self.menu_File.menuAction())
self.menubar.addAction(self.menuD_Base.menuAction())
self.menubar.addAction(self.menu_Screen.menuAction())
self.menubar.addAction(self.menu_Certificate.menuAction())
self.menubar.addAction(self.menu_Manuals.menuAction())
self.menubar.addAction(self.menu_About.menuAction())
self.menubar.addAction(self.menu_Help.menuAction())
self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
def retranslateUi(self, MainWindow):
MainWindow.setWindowTitle(QtGui.QApplication.translate("MainWindow", "PxQx
Auditor", None, QtGui.QApplication.UnicodeUTF8))
self.tableWidget.setRowCount(0)
self.tableWidget.setColumnCount(2)
self.tableWidget.clear()
self.tableWidget.setColumnCount(2)
self.tableWidget.setRowCount(0)
self.pushButton.setText(QtGui.QApplication.translate("MainWindow", "&New
Audit", None, QtGui.QApplication.UnicodeUTF8))
self.pushButton_2.setText(QtGui.QApplication.translate("MainWindow", "&Certificate",
None, QtGui.QApplication.UnicodeUTF8))
self.pushButton_3.setText(QtGui.QApplication.translate("MainWindow", "&Eng
PDF", None, QtGui.QApplication.UnicodeUTF8))
self.pushButton_4.setText(QtGui.QApplication.translate("MainWindow", "&User
PDF", None, QtGui.QApplication.UnicodeUTF8))
self.lineEdit.setText(QtGui.QApplication.translate("MainWindow", "
Status : Idle", None, QtGui.QApplication.UnicodeUTF8))
self.menu_Manuals.setTitle(QtGui.QApplication.translate("MainWindow", "&Manuals",
None, QtGui.QApplication.UnicodeUTF8))
self.menu_About.setTitle(QtGui.QApplication.translate("MainWindow", "&About",
None, QtGui.QApplication.UnicodeUTF8))
self.menu_Help.setTitle(QtGui.QApplication.translate("MainWindow", "&Help",
None, QtGui.QApplication.UnicodeUTF8))
self.menu_File.setTitle(QtGui.QApplication.translate("MainWindow", "&File",
None, QtGui.QApplication.UnicodeUTF8))
self.menuD_Base.setTitle(QtGui.QApplication.translate("MainWindow", "d&Base",
None, QtGui.QApplication.UnicodeUTF8))
self.menu_Screen.setTitle(QtGui.QApplication.translate("MainWindow", "&Screen",
None, QtGui.QApplication.UnicodeUTF8))
self.menu_Certificate.setTitle(QtGui.QApplication.translate("MainWindow", "&Certificate",
None, QtGui.QApplication.UnicodeUTF8))
self.action_New_Audit.setText(QtGui.QApplication.translate("MainWindow", "&New
Audit", None, QtGui.QApplication.UnicodeUTF8))
self.action_Exit.setText(QtGui.QApplication.translate("MainWindow", "&Exit",
None, QtGui.QApplication.UnicodeUTF8))
self.action_Export.setText(QtGui.QApplication.translate("MainWindow", "&Export",
None, QtGui.QApplication.UnicodeUTF8))
self.action_Import.setText(QtGui.QApplication.translate("MainWindow", "&Import",
None, QtGui.QApplication.UnicodeUTF8))
self.action_Prune.setText(QtGui.QApplication.translate("MainWindow", "&Prune",
None, QtGui.QApplication.UnicodeUTF8))
self.action_Wipe.setText(QtGui.QApplication.translate("MainWindow", "&Wipe",
None, QtGui.QApplication.UnicodeUTF8))
self.action_Lock.setText(QtGui.QApplication.translate("MainWindow", "&Lock",
None, QtGui.QApplication.UnicodeUTF8))
self.action_Generate.setText(QtGui.QApplication.translate("MainWindow", "&Generate",
None, QtGui.QApplication.UnicodeUTF8))
self.action_Authenticate.setText(QtGui.QApplication.translate("MainWindow", "&Authenticate",
None, QtGui.QApplication.UnicodeUTF8))
self.action_Engineer_PDF.setText(QtGui.QApplication.translate("MainWindow", "&Engineer
PDF", None, QtGui.QApplication.UnicodeUTF8))
self.actionUser_PDF.setText(QtGui.QApplication.translate("MainWindow", "User
PDF", None, QtGui.QApplication.UnicodeUTF8))
self.action_PxQxAuditor.setText(QtGui.QApplication.translate("MainWindow", "&PxQx
Auditor", None, QtGui.QApplication.UnicodeUTF8))
self.action_Developer.setText(QtGui.QApplication.translate("MainWindow", "&Developer",
None, QtGui.QApplication.UnicodeUTF8))
self.action_GPL_Licence.setText(QtGui.QApplication.translate("MainWindow", "&GPL
Licence", None, QtGui.QApplication.UnicodeUTF8))
my basic test code
#!/bin/env/python
import mainscreen, sys, abcd
from PyQt4 import *
def main(args):
app = QtGui.QApplication(sys.argv)
window = QtGui.QDialog()
##
## docview.app = app
## docview.parent = docview
## #QObject.connect(docview.pushButton1, SIGNAL("pressed()"),
docview.NewAudit)
#ui = abcd.Ui_Form()
ui = mainscreen.Ui_MainWindow()
ui.setupUi(window)
#app.setMainWidget(docview)
window.show()
#QObject.connect(app, SIGNAL('lastWindowClosed()'),app, SLOT('quit()'))
sys.exit(app.exec_())
if __name__=="__main__":
main(sys.argv)
the error ...
Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
****************************************************************
Personal firewall software may warn about the connection IDLE
makes to its subprocess using this computer's internal loopback
interface. This connection is not visible on any external
interface and no data is sent to or received from the Internet.
****************************************************************
IDLE 1.1.3 ==== No Subprocess ====
>>>
Traceback (most recent call last):
File "E:\Documents and Settings\User\Desktop\PxQxAuditor\dialogs\test.py",
line 27, in ?
main(sys.argv)
File "E:\Documents and Settings\User\Desktop\PxQxAuditor\dialogs\test.py",
line 18, in main
ui.setupUi(window)
File "E:\Documents and
Settings\User\Desktop\PxQxAuditor\dialogs\mainscreen.py", line 80, in setupUi
MainWindow.setCentralWidget(self.centralwidget)
AttributeError: setCentralWidget
>>>
More information about the PyQt
mailing list