--- a/Plugins/PluginWizardQFileDialog.py Sun Dec 01 14:31:58 2013 +0100 +++ b/Plugins/PluginWizardQFileDialog.py Sun Dec 01 17:25:29 2013 +0100 @@ -7,6 +7,8 @@ Module implementing the QFileDialog wizard plugin. """ +import re + from PyQt4.QtCore import QObject from PyQt4.QtGui import QDialog @@ -42,6 +44,8 @@ """ super().__init__(ui) self.__ui = ui + + self.__pyqtRe = re.compile(r"(?:import|from)\s+PyQt([45])") def activate(self): """ @@ -97,9 +101,15 @@ @param editor reference to the current editor @return the generated code (string) """ + match = self.__pyqtRe.search(editor.text()) + if match is None: + pyqtVariant = 0 # unknown + else: + pyqtVariant = int(match.group(1)) # 4 or 5 + from WizardPlugins.FileDialogWizard.FileDialogWizardDialog import \ FileDialogWizardDialog - dlg = FileDialogWizardDialog(None) + dlg = FileDialogWizardDialog(pyqtVariant, None) if dlg.exec_() == QDialog.Accepted: line, index = editor.getCursorPosition() indLevel = editor.indentation(line) // editor.indentationWidth()