Removed some superfluous unicode() calls.

Mon, 28 Dec 2009 18:31:37 +0000

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Mon, 28 Dec 2009 18:31:37 +0000
changeset 6
52e8c820d0dd
parent 5
fa319c01b604
child 7
c679fb30c8f3

Removed some superfluous unicode() calls.

DataViews/PyCoverageDialog.py file | annotate | diff | comparison | revisions
E4XML/MultiProjectHandler.py file | annotate | diff | comparison | revisions
E4XML/SessionWriter.py file | annotate | diff | comparison | revisions
E4XML/TasksHandler.py file | annotate | diff | comparison | revisions
Helpviewer/HelpWindow.py file | annotate | diff | comparison | revisions
Helpviewer/History/HistoryFilterModel.py file | annotate | diff | comparison | revisions
Helpviewer/OpenSearch/OpenSearchManager.py file | annotate | diff | comparison | revisions
Helpviewer/Passwords/PasswordManager.py file | annotate | diff | comparison | revisions
MultiProject/PropertiesDialog.py file | annotate | diff | comparison | revisions
Plugins/PluginSyntaxChecker.py file | annotate | diff | comparison | revisions
Plugins/VcsPlugins/vcsPySvn/SvnRepoBrowserDialog.py file | annotate | diff | comparison | revisions
Plugins/VcsPlugins/vcsPySvn/subversion.py file | annotate | diff | comparison | revisions
Plugins/VcsPlugins/vcsSubversion/subversion.py file | annotate | diff | comparison | revisions
Plugins/ViewManagerPlugins/Listspace/Listspace.py file | annotate | diff | comparison | revisions
Plugins/WizardPlugins/PyRegExpWizard/PyRegExpWizardDialog.py file | annotate | diff | comparison | revisions
Preferences/ConfigurationPages/DebuggerGeneralPage.py file | annotate | diff | comparison | revisions
Preferences/ConfigurationPages/EditorFilePage.py file | annotate | diff | comparison | revisions
Preferences/ConfigurationPages/TemplatesPage.py file | annotate | diff | comparison | revisions
Preferences/ConfigurationPages/ViewmanagerPage.py file | annotate | diff | comparison | revisions
Preferences/ProgramsDialog.py file | annotate | diff | comparison | revisions
Preferences/ToolConfigurationDialog.py file | annotate | diff | comparison | revisions
Project/CreateDialogCodeDialog.py file | annotate | diff | comparison | revisions
Project/NewDialogClassDialog.py file | annotate | diff | comparison | revisions
QScintilla/Exporters/ExporterPDF.py file | annotate | diff | comparison | revisions
QScintilla/SpellChecker.py file | annotate | diff | comparison | revisions
UI/FindFileDialog.py file | annotate | diff | comparison | revisions
VCS/StatusMonitorLed.py file | annotate | diff | comparison | revisions
eric4.py file | annotate | diff | comparison | revisions
install-i18n.py file | annotate | diff | comparison | revisions
--- a/DataViews/PyCoverageDialog.py	Mon Dec 28 17:05:28 2009 +0000
+++ b/DataViews/PyCoverageDialog.py	Mon Dec 28 18:31:37 2009 +0000
@@ -259,7 +259,7 @@
         selected file.
         """
         itm = self.resultList.currentItem()
-        fn = unicode(itm.text(0))
+        fn = itm.text(0)
         
         cover = coverage(data_file = self.cfn)
         cover.use_cache(True)
--- a/E4XML/MultiProjectHandler.py	Mon Dec 28 17:05:28 2009 +0000
+++ b/E4XML/MultiProjectHandler.py	Mon Dec 28 18:31:37 2009 +0000
@@ -90,7 +90,7 @@
         Handler method for the "ProjectFile" end tag.
         """
         filename = self.utf8_to_code(self.buffer)
-        self.project["file"] = unicode(Utilities.toNativeSeparators(filename))
+        self.project["file"] = Utilities.toNativeSeparators(filename)
     
     def endProjectDescription(self):
         """
--- a/E4XML/SessionWriter.py	Mon Dec 28 17:05:28 2009 +0000
+++ b/E4XML/SessionWriter.py	Mon Dec 28 18:31:37 2009 +0000
@@ -72,7 +72,7 @@
         allOpenFiles = self.vm.getOpenFilenames()
         self._write("  <Filenames>")
         for of in allOpenFiles:
-            if isGlobal or unicode(of).startswith(self.project.ppath):
+            if isGlobal or of.startswith(self.project.ppath):
                 ed = self.vm.getOpenEditor(of)
                 if ed is not None:
                     line, index = ed.getCursorPosition()
@@ -85,7 +85,7 @@
         self._write("  </Filenames>")
         
         aw = self.vm.getActiveName()
-        if aw and unicode(aw).startswith(self.project.ppath):
+        if aw and aw.startswith(self.project.ppath):
             ed = self.vm.getOpenEditor(aw)
             if ed is not None:
                 line, index = ed.getCursorPosition()
@@ -189,7 +189,7 @@
         # step 4: save bookmarks of all open (project) files
         self._write("  <Bookmarks>")
         for of in allOpenFiles:
-            if isGlobal or unicode(of).startswith(self.project.ppath):
+            if isGlobal or of.startswith(self.project.ppath):
                 editor = self.vm.getOpenEditor(of)
                 for bookmark in editor.getBookmarks():
                     self._write("    <Bookmark>")
@@ -198,4 +198,4 @@
                     self._write("    </Bookmark>")
         self._write("  </Bookmarks>")
         
-        self._write("</Session>", newline = False)
\ No newline at end of file
+        self._write("</Session>", newline = False)
--- a/E4XML/TasksHandler.py	Mon Dec 28 17:05:28 2009 +0000
+++ b/E4XML/TasksHandler.py	Mon Dec 28 18:31:37 2009 +0000
@@ -166,7 +166,7 @@
         """
         if self.version >= '4.2':
             self.task["filename"] = \
-                unicode(Utilities.toNativeSeparators(self.utf8_to_code(self.buffer)))
+                Utilities.toNativeSeparators(self.utf8_to_code(self.buffer))
         else:
             self.task["filename"] = self.__buildPath()
         
@@ -197,4 +197,4 @@
         
         @return String containing the version number.
         """
-        return self.version
\ No newline at end of file
+        return self.version
--- a/Helpviewer/HelpWindow.py	Mon Dec 28 17:05:28 2009 +0000
+++ b/Helpviewer/HelpWindow.py	Mon Dec 28 18:31:37 2009 +0000
@@ -1403,7 +1403,7 @@
         idx = 0
         for hist in self.mHistory:
             act = self.historyMenu.addAction(
-                Utilities.compactPath(unicode(hist), self.maxMenuFilePathLen))
+                Utilities.compactPath(hist, self.maxMenuFilePathLen))
             act.setData(QVariant(idx))
             idx += 1
             act.setIcon(HelpWindow.__getWebIcon(QUrl(hist)))
--- a/Helpviewer/History/HistoryFilterModel.py	Mon Dec 28 17:05:28 2009 +0000
+++ b/Helpviewer/History/HistoryFilterModel.py	Mon Dec 28 18:31:37 2009 +0000
@@ -220,7 +220,7 @@
         @return proxy model index (QModelIndex)
         """
         self.__load()
-        url = unicode(sourceIndex.data(HistoryModel.UrlStringRole).toString())
+        url = sourceIndex.data(HistoryModel.UrlStringRole).toString()
         if url not in self.__historyDict:
             return QModelIndex()
         
@@ -271,7 +271,7 @@
         
         for sourceRow in range(self.sourceModel().rowCount()):
             idx = self.sourceModel().index(sourceRow, 0)
-            url = unicode(idx.data(HistoryModel.UrlStringRole).toString())
+            url = idx.data(HistoryModel.UrlStringRole).toString()
             if url not in self.__historyDict:
                 sourceOffset = self.sourceModel().rowCount() - sourceRow
                 self.__filteredRows.append(
--- a/Helpviewer/OpenSearch/OpenSearchManager.py	Mon Dec 28 17:05:28 2009 +0000
+++ b/Helpviewer/OpenSearch/OpenSearchManager.py	Mon Dec 28 18:31:37 2009 +0000
@@ -424,7 +424,7 @@
         @return search URL (QUrl)
         """
         try:
-            keyword, term = unicode(keywordSearch).split(" ", 1)
+            keyword, term = keywordSearch.split(" ", 1)
         except ValueError:
             return QUrl()
         
--- a/Helpviewer/Passwords/PasswordManager.py	Mon Dec 28 17:05:28 2009 +0000
+++ b/Helpviewer/Passwords/PasswordManager.py	Mon Dec 28 18:31:37 2009 +0000
@@ -384,7 +384,7 @@
             yesButton = mb.addButton(QMessageBox.Yes)
             mb.exec_()
             if mb.clickedButton() == neverButton:
-                self.__never.append(unicode(url.toString()))
+                self.__never.append(url.toString())
                 return
             elif mb.clickedButton() == noButton:
                 return
--- a/MultiProject/PropertiesDialog.py	Mon Dec 28 17:05:28 2009 +0000
+++ b/MultiProject/PropertiesDialog.py	Mon Dec 28 18:31:37 2009 +0000
@@ -36,4 +36,4 @@
         """
         Public method to store the entered/modified data.
         """
-        self.multiProject.description = unicode(self.descriptionEdit.toPlainText())
+        self.multiProject.description = self.descriptionEdit.toPlainText()
--- a/Plugins/PluginSyntaxChecker.py	Mon Dec 28 17:05:28 2009 +0000
+++ b/Plugins/PluginSyntaxChecker.py	Mon Dec 28 18:31:37 2009 +0000
@@ -250,4 +250,4 @@
             self.__editorSyntaxCheckerDialog = SyntaxCheckerDialog()
             self.__editorSyntaxCheckerDialog.show()
             self.__editorSyntaxCheckerDialog.start(editor.getFileName(), 
-                                                   unicode(editor.text()))
+                                                   editor.text())
--- a/Plugins/VcsPlugins/vcsPySvn/SvnRepoBrowserDialog.py	Mon Dec 28 17:05:28 2009 +0000
+++ b/Plugins/VcsPlugins/vcsPySvn/SvnRepoBrowserDialog.py	Mon Dec 28 18:31:37 2009 +0000
@@ -97,7 +97,7 @@
         if repopath == "/":
             path = url
         else:
-            path = unicode(url).split("/")[-1]
+            path = url.split("/")[-1]
         
         if revision == "":
             rev = ""
--- a/Plugins/VcsPlugins/vcsPySvn/subversion.py	Mon Dec 28 17:05:28 2009 +0000
+++ b/Plugins/VcsPlugins/vcsPySvn/subversion.py	Mon Dec 28 18:31:37 2009 +0000
@@ -950,7 +950,7 @@
             elif tagOp in [2, 8]:
                 url = '%s/branches/%s' % (reposRoot, urllib.quote(tag))
         else:
-            url = self.__svnURL(unicode(tag))
+            url = self.__svnURL(tag)
         
         self.tagName = tag
         client = self.getClient()
@@ -1206,7 +1206,7 @@
             else:
                 return self.canBeAdded
         
-        name = os.path.normcase(unicode(name))
+        name = os.path.normcase(name)
         states = { name : 0 }
         states = self.vcsAllRegisteredStates(states, dname, False)
         if states[name] == self.canBeCommitted:
--- a/Plugins/VcsPlugins/vcsSubversion/subversion.py	Mon Dec 28 17:05:28 2009 +0000
+++ b/Plugins/VcsPlugins/vcsSubversion/subversion.py	Mon Dec 28 18:31:37 2009 +0000
@@ -393,7 +393,7 @@
                         0, False)
                     if not ok:
                         return False
-                    tag = '%s/%s' % (unicode(type), tag)
+                    tag = '%s/%s' % (type, tag)
                 svnUrl = '%s/%s' % (vcsDir, tag)
         else:
             svnUrl = vcsDir
--- a/Plugins/ViewManagerPlugins/Listspace/Listspace.py	Mon Dec 28 17:05:28 2009 +0000
+++ b/Plugins/ViewManagerPlugins/Listspace/Listspace.py	Mon Dec 28 18:31:37 2009 +0000
@@ -404,7 +404,7 @@
         itm.setText(txt)
         itm.setToolTip(newName)
         self.viewlist.setCurrentRow(currentRow)
-        self.emit(SIGNAL('changeCaption'), unicode(newName))
+        self.emit(SIGNAL('changeCaption'), newName)
         
     def _modificationStatusChanged(self, m, editor):
         """
--- a/Plugins/WizardPlugins/PyRegExpWizard/PyRegExpWizardDialog.py	Mon Dec 28 17:05:28 2009 +0000
+++ b/Plugins/WizardPlugins/PyRegExpWizard/PyRegExpWizardDialog.py	Mon Dec 28 18:31:37 2009 +0000
@@ -589,11 +589,11 @@
         i1string = (indLevel + 1) * indString
         
         # now generate the code
-        reVar = unicode(self.variableLineEdit.text())
+        reVar = self.variableLineEdit.text()
         if not reVar:
             reVar = "regexp"
             
-        regexp = unicode(self.regexpTextEdit.toPlainText())
+        regexp = self.regexpTextEdit.toPlainText()
         
         flags = []
         if not self.caseSensitiveCheckBox.isChecked():
--- a/Preferences/ConfigurationPages/DebuggerGeneralPage.py	Mon Dec 28 17:05:28 2009 +0000
+++ b/Preferences/ConfigurationPages/DebuggerGeneralPage.py	Mon Dec 28 18:31:37 2009 +0000
@@ -183,9 +183,9 @@
         Preferences.setDebugger("PathTranslation", 
             int(self.dbgPathTranslationCheckBox.isChecked()))
         Preferences.setDebugger("PathTranslationRemote",
-            unicode(self.dbgTranslationRemoteEdit.text()))
+            self.dbgTranslationRemoteEdit.text())
         Preferences.setDebugger("PathTranslationLocal",
-            unicode(self.dbgTranslationLocalEdit.text()))
+            self.dbgTranslationLocalEdit.text())
         Preferences.setDebugger("ThreeStateBreakPoints",
             int(self.debugThreeStateBreakPoint.isChecked()))
         Preferences.setDebugger("SuppressClientExit",
--- a/Preferences/ConfigurationPages/EditorFilePage.py	Mon Dec 28 17:05:28 2009 +0000
+++ b/Preferences/ConfigurationPages/EditorFilePage.py	Mon Dec 28 18:31:37 2009 +0000
@@ -83,7 +83,7 @@
             int(self.createBackupFileCheckBox.isChecked()))
         Preferences.setEditor("AutoCheckSyntax",
             int(self.automaticSyntaxCheckCheckBox.isChecked()))
-        enc = unicode(self.defaultEncodingComboBox.currentText())
+        enc = self.defaultEncodingComboBox.currentText()
         if not enc:
             enc = "utf-8"
         Preferences.setEditor("DefaultEncoding", enc)
--- a/Preferences/ConfigurationPages/TemplatesPage.py	Mon Dec 28 17:05:28 2009 +0000
+++ b/Preferences/ConfigurationPages/TemplatesPage.py	Mon Dec 28 18:31:37 2009 +0000
@@ -44,7 +44,7 @@
             int(self.templatesAutoOpenGroupsCheckBox.isChecked()))
         sepChar = self.templatesSeparatorCharEdit.text()
         if sepChar:
-            Preferences.setTemplates("SeparatorChar", unicode(sepChar))
+            Preferences.setTemplates("SeparatorChar", sepChar)
         Preferences.setTemplates("SingleDialog",
             int(self.templatesSingleDialogButton.isChecked()))
         Preferences.setTemplates("ShowTooltip",
--- a/Preferences/ConfigurationPages/ViewmanagerPage.py	Mon Dec 28 17:05:28 2009 +0000
+++ b/Preferences/ConfigurationPages/ViewmanagerPage.py	Mon Dec 28 18:31:37 2009 +0000
@@ -78,8 +78,8 @@
         
         @param index index of selected workspace view type (integer)
         """
-        workspace = unicode(\
-            self.windowComboBox.itemData(self.windowComboBox.currentIndex()).toString())
+        workspace = \
+            self.windowComboBox.itemData(self.windowComboBox.currentIndex()).toString()
         pixmap = self.pluginManager.getPluginPreviewPixmap("viewmanager", workspace)
         
         self.previewPixmap.setPixmap(pixmap)
--- a/Preferences/ProgramsDialog.py	Mon Dec 28 17:05:28 2009 +0000
+++ b/Preferences/ProgramsDialog.py	Mon Dec 28 18:31:37 2009 +0000
@@ -147,7 +147,7 @@
         
         # 6. do the CORBA programs
         # 6a. omniORB
-        exe = unicode(Preferences.getCorba("omniidl"))
+        exe = Preferences.getCorba("omniidl")
         if Utilities.isWindowsPlatform():
             exe += ".exe"
         self.__createProgramEntry(self.trUtf8("CORBA IDL Compiler"), exe,
--- a/Preferences/ToolConfigurationDialog.py	Mon Dec 28 17:05:28 2009 +0000
+++ b/Preferences/ToolConfigurationDialog.py	Mon Dec 28 18:31:37 2009 +0000
@@ -126,10 +126,10 @@
         
         self.toolsList.addItem(menutext)
         tool = {
-            'menutext' : unicode(menutext),
-            'icon' : unicode(icon),
+            'menutext' : menutext,
+            'icon' : icon,
             'executable' : executable,
-            'arguments' : unicode(arguments),
+            'arguments' : arguments,
             'redirect' : redirect,
         }
         self.toollist.append(tool)
--- a/Project/CreateDialogCodeDialog.py	Mon Dec 28 17:05:28 2009 +0000
+++ b/Project/CreateDialogCodeDialog.py	Mon Dec 28 18:31:37 2009 +0000
@@ -383,7 +383,7 @@
                     QMessageBox.Ok))
             return
         
-        self.project.appendFile(unicode(self.filenameEdit.text()))
+        self.project.appendFile(self.filenameEdit.text())
         
     @pyqtSlot(int)
     def on_classNameCombo_activated(self, index):
--- a/Project/NewDialogClassDialog.py	Mon Dec 28 17:05:28 2009 +0000
+++ b/Project/NewDialogClassDialog.py	Mon Dec 28 18:31:37 2009 +0000
@@ -93,6 +93,6 @@
         
         @return tuple giving the classname (string) and the file name (string)
         """
-        return unicode(self.classnameEdit.text()), \
+        return self.classnameEdit.text(), \
             os.path.join(self.pathnameEdit.text(), \
                          self.filenameEdit.text())
--- a/QScintilla/Exporters/ExporterPDF.py	Mon Dec 28 17:05:28 2009 +0000
+++ b/QScintilla/Exporters/ExporterPDF.py	Mon Dec 28 18:31:37 2009 +0000
@@ -419,7 +419,7 @@
             self.pr.fontSize = Preferences.getEditorExporter("PDF/Magnification")
             
             # set font family according to face name
-            fontName = unicode(Preferences.getEditorExporter("PDF/Font"))
+            fontName = Preferences.getEditorExporter("PDF/Font")
             self.pr.fontSet = PDF_FONT_DEFAULT
             if fontName == "Courier":
                 self.pr.fontSet = 0
--- a/QScintilla/SpellChecker.py	Mon Dec 28 17:05:28 2009 +0000
+++ b/QScintilla/SpellChecker.py	Mon Dec 28 18:31:37 2009 +0000
@@ -92,7 +92,7 @@
         @return reference to the dictionary (enchant.Dict)
         """
         if not pwl:
-            pwl = unicode(Preferences.getEditor("SpellCheckingPersonalWordList"))
+            pwl = Preferences.getEditor("SpellCheckingPersonalWordList")
             if not pwl:
                 pwl = os.path.join(Utilities.getConfigDir(), "spelling", "pwl.dic")
             d = os.path.dirname(pwl)
@@ -100,7 +100,7 @@
                 os.makedirs(d)
         
         if not pel:
-            pel = unicode(Preferences.getEditor("SpellCheckingPersonalExcludeList"))
+            pel = Preferences.getEditor("SpellCheckingPersonalExcludeList")
             if not pel:
                 pel = os.path.join(Utilities.getConfigDir(), "spelling", "pel.dic")
             d = os.path.dirname(pel)
--- a/UI/FindFileDialog.py	Mon Dec 28 17:05:28 2009 +0000
+++ b/UI/FindFileDialog.py	Mon Dec 28 18:31:37 2009 +0000
@@ -321,7 +321,18 @@
         flags = re.UNICODE | re.LOCALE
         if not cs:
             flags |= re.IGNORECASE
-        search = re.compile(txt, flags)
+        try:
+            search = re.compile(txt, flags)
+        except re.error, why:
+            QMessageBox.critical(None,
+                self.trUtf8("Invalid search expression"),
+                self.trUtf8("""<p>The search expression is not valid.</p>"""
+                            """<p>Error: {0}</p>""").format(unicode(why)))
+            self.stopButton.setEnabled(False)
+            self.findButton.setEnabled(True)
+            self.findButton.setDefault(True)
+            return
+
         
         # reset the findtextCombo
         if ct in self.searchHistory:
--- a/VCS/StatusMonitorLed.py	Mon Dec 28 17:05:28 2009 +0000
+++ b/VCS/StatusMonitorLed.py	Mon Dec 28 18:31:37 2009 +0000
@@ -91,7 +91,7 @@
         @param status status of the monitoring thread (string, ok, nok or off)
         @param statusMsg explanotory text for the signaled status (string)
         """
-        self.setColor(self.vcsMonitorLedColors[unicode(status)])
+        self.setColor(self.vcsMonitorLedColors[status])
         self.setToolTip(statusMsg)
         
         self.__on = status != 'off'
--- a/eric4.py	Mon Dec 28 17:05:28 2009 +0000
+++ b/eric4.py	Mon Dec 28 18:31:37 2009 +0000
@@ -99,7 +99,7 @@
     @param tracebackobj traceback object
     """
     separator = '-' * 80
-    logFile = os.path.join(unicode(Utilities.getConfigDir()), "eric4_error.log")
+    logFile = os.path.join(Utilities.getConfigDir(), "eric4_error.log")
     notice = \
         """An unhandled exception occurred. Please report the problem\n"""\
         """using the error reporting dialog or via email to <%s>.\n"""\
--- a/install-i18n.py	Mon Dec 28 17:05:28 2009 +0000
+++ b/install-i18n.py	Mon Dec 28 18:31:37 2009 +0000
@@ -38,9 +38,9 @@
     dn.mkdir(cdn)
     hp.append("/").append(cdn)
     try:
-        return unicode(QDir.toNativeSeparators(hp))
+        return QDir.toNativeSeparators(hp)
     except AttributeError:
-        return unicode(QDir.convertSeparators(hp))
+        return QDir.convertSeparators(hp)
     
 # Define the globals.
 progName = None

eric ide

mercurial