def _onImportDrawing(self):
drawing = QtGui.QFileDialog.getOpenFileName(parent=self, caption="Import Drawing", directory=self.lastDirectory, filter="Dxf (*.dxf)");
# open a document and load the drawing
if len(drawing)>0:
self.lastDirectory=os.path.split(drawing)[0]
self.mdiArea.activeSubWindow().importExternalFormat(drawing) <<<<<<<<<<<<<it crashes here
return
saying "unhandled attribute error"
none type object has no attribute "importExternalFormat"
regards
carlo
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
it seems a problem with the self.mdiArea.activeSubWindow() that is None .
It seems that you do not have any active drawing ..opened ..
witch version of pyqt are you using ?
dose the open file with dxf extension works well ?
we can manage this error controlling the code like this:
def _onImportDrawing(self):
drawing = QtGui.QFileDialog.getOpenFileName(parent=self, caption="Import Drawing", directory=self.lastDirectory, filter="Dxf (*.dxf)");
# open a document and load the drawing
if len(drawing)>0:
self.lastDirectory=os.path.split(drawing)[0]
if self.mdiArea.activeSubWindow() != None:
self.mdiArea.activeSubWindow()importExternalFormat(drawing)
else:
print "active sub windows is none"
return
but I do not think that you can open a dxf file anymore :-)
Regards,
Matteo
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
could you post part of the code
Regards,
Matteo
def _onImportDrawing(self):
drawing = QtGui.QFileDialog.getOpenFileName(parent=self, caption="Import Drawing", directory=self.lastDirectory, filter="Dxf (*.dxf)");
# open a document and load the drawing
if len(drawing)>0:
self.lastDirectory=os.path.split(drawing)[0]
self.mdiArea.activeSubWindow().importExternalFormat(drawing) <<<<<<<<<<<<<it crashes here
return
saying "unhandled attribute error"
none type object has no attribute "importExternalFormat"
regards
carlo
it seems a problem with the self.mdiArea.activeSubWindow() that is None .
It seems that you do not have any active drawing ..opened ..
witch version of pyqt are you using ?
dose the open file with dxf extension works well ?
we can manage this error controlling the code like this:
def _onImportDrawing(self):
drawing = QtGui.QFileDialog.getOpenFileName(parent=self, caption="Import Drawing", directory=self.lastDirectory, filter="Dxf (*.dxf)");
# open a document and load the drawing
if len(drawing)>0:
self.lastDirectory=os.path.split(drawing)[0]
if self.mdiArea.activeSubWindow() != None:
self.mdiArea.activeSubWindow()importExternalFormat(drawing)
else:
print "active sub windows is none"
return
but I do not think that you can open a dxf file anymore :-)
Regards,
Matteo
is this bug still open ?