Plugins/WizardPlugins/PyRegExpWizard/PyRegExpWizardDialog.py

changeset 12
1d8dd9706f46
parent 6
52e8c820d0dd
child 13
1af94a91f439
--- a/Plugins/WizardPlugins/PyRegExpWizard/PyRegExpWizardDialog.py	Fri Jan 01 16:11:36 2010 +0000
+++ b/Plugins/WizardPlugins/PyRegExpWizard/PyRegExpWizardDialog.py	Sat Jan 02 15:11:35 2010 +0000
@@ -14,10 +14,10 @@
 from PyQt4.QtCore import *
 from PyQt4.QtGui import *
 
-from Ui_PyRegExpWizardDialog import Ui_PyRegExpWizardDialog
+from .Ui_PyRegExpWizardDialog import Ui_PyRegExpWizardDialog
 
-from PyRegExpWizardRepeatDialog import PyRegExpWizardRepeatDialog
-from PyRegExpWizardCharactersDialog import PyRegExpWizardCharactersDialog
+from .PyRegExpWizardRepeatDialog import PyRegExpWizardRepeatDialog
+from .PyRegExpWizardCharactersDialog import PyRegExpWizardCharactersDialog
 
 import UI.PixmapCache
 
@@ -322,14 +322,14 @@
                     return
             
             try:
-                f=open(Utilities.toNativeSeparators(fname), "wb")
+                f=open(Utilities.toNativeSeparators(fname), "w")
                 f.write(self.regexpTextEdit.toPlainText())
                 f.close()
-            except IOError, err:
+            except IOError as err:
                 QMessageBox.information(self,
                     self.trUtf8("Save regular expression"),
                     self.trUtf8("""<p>The regular expression could not be saved.</p>"""
-                                """<p>Reason: {0}</p>""").format(unicode(err)))
+                                """<p>Reason: {0}</p>""").format(str(err)))
     
     @pyqtSlot()
     def on_loadButton_clicked(self):
@@ -343,15 +343,15 @@
             self.trUtf8("RegExp Files (*.rx);;All Files (*)"))
         if fname:
             try:
-                f=open(Utilities.toNativeSeparators(fname), "rb")
+                f=open(Utilities.toNativeSeparators(fname), "r")
                 regexp = f.read()
                 f.close()
                 self.regexpTextEdit.setPlainText(regexp)
-            except IOError, err:
+            except IOError as err:
                 QMessageBox.information(self,
                     self.trUtf8("Save regular expression"),
                     self.trUtf8("""<p>The regular expression could not be saved.</p>"""
-                                """<p>Reason: {0}</p>""").format(unicode(err)))
+                                """<p>Reason: {0}</p>""").format(str(err)))
 
     @pyqtSlot()
     def on_copyButton_clicked(self):
@@ -394,11 +394,11 @@
                 QMessageBox.information(None,
                     self.trUtf8(""),
                     self.trUtf8("""The regular expression is valid."""))
-            except re.error, e:
+            except re.error as e:
                 QMessageBox.critical(None,
                     self.trUtf8("Error"),
                     self.trUtf8("""Invalid regular expression: {0}""")
-                        .format(unicode(e)))
+                        .format(str(e)))
                 return
             except IndexError:
                 QMessageBox.critical(None,
@@ -521,11 +521,11 @@
                 self.resultTable.resizeRowsToContents()
                 self.resultTable.verticalHeader().hide()
                 self.resultTable.horizontalHeader().hide()
-            except re.error, e:
+            except re.error as e:
                 QMessageBox.critical(None,
                     self.trUtf8("Error"),
                     self.trUtf8("""Invalid regular expression: {0}""")
-                        .format(unicode(e)))
+                        .format(str(e)))
                 return
             except IndexError:
                 QMessageBox.critical(None,

eric ide

mercurial