I am trying to convert a program with hand coded QT over to using UI
files from QT Designer. I am getting the error below and do not
understand what's going on. I have a feeling I need to add self. to
something in here, but I'm not sure what. Is this enough code for you to
see whats going on?? If not I can upload the project somewhere. Thanks,
Lawrence
The error,
Traceback (most recent call last):
File "atf.py", line 113, in on_actionOpen_triggered
self.open()
File "atf.py", line 56, in open
if self.isUntitled and self.textBrowser.document().isEmpty() and not
self.isWindowModified():
RuntimeError: underlying C/C++ object has been deleted
Here is the first part of the code.
#!/usr/bin/env python
# iaC.py - A Qt4 Calculator example
import sys
from math import pi
from PyQt4 import QtCore, QtGui
from iac_ui import Ui_mainWindow
from filterEdit2_ui import Ui_filterEdit
class iaC(QtGui.QMainWindow):
sequenceNumber = 1
windowList = []
@QtCore.pyqtSignature("")
def __init__(self, fileName=None, parent=None):
QtGui.QMainWindow.__init__(self, parent)
self.init()
if fileName:
self.loadFile(fileName)
else:
self.setCurrentFile(QtCore.QString())
self.ui = Ui_mainWindow()
self.ui.setupUi(self)
# ================Set up delete, up, and down buttons on the main
form==================
if self.ui.listWidget.count() < 1:
self.ui.deleteButton.setEnabled(False)
else:
self.ui.deleteButton.setEnabled(True)
if self.ui.listWidget.count() < 2:
self.ui.upButton.setEnabled(False)
self.ui.downButton.setEnabled(False)
else:
self.ui.downButton.setEnabled(True)
self.ui.upButton.setEnabled(True)
# ================Save settings on
close?=======================================
def closeEvent(self, event):
if self.maybeSave():
self.writeSettings()
event.accept()
else:
event.ignore()
# ===============Open File=================================================
@QtCore.pyqtSignature("")
def open(self):
fileName = QtGui.QFileDialog.getOpenFileName(self)
print "Loading fileName", fileName
if not fileName.isEmpty():
if self.isUntitled and self.textBrowser.document().isEmpty()
and not self.isWindowModified():
self.loadFile(fileName)
else:
other = MainWindow(fileName)
if other.isUntitled:
del other
return
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor