Project/Project.py

branch
Py2 comp.
changeset 3060
5883ce99ee12
parent 3058
0a02c433f52d
parent 3038
7fe9a53280bd
child 3127
e47a9d5954e8
--- a/Project/Project.py	Fri Nov 01 15:48:48 2013 +0100
+++ b/Project/Project.py	Sun Nov 03 15:58:22 2013 +0100
@@ -189,11 +189,11 @@
         
         self.dbgFilters = {
             "Python2": self.trUtf8(
-                         "Python2 Files (*.py2);;"
-                         "Python2 GUI Files (*.pyw2);;"),
+                "Python2 Files (*.py2);;"
+                "Python2 GUI Files (*.pyw2);;"),
             "Python3": self.trUtf8(
-                         "Python3 Files (*.py *.py3);;"
-                         "Python3 GUI Files (*.pyw *.pyw3);;"),
+                "Python3 Files (*.py *.py3);;"
+                "Python3 GUI Files (*.pyw *.pyw3);;"),
             "Ruby": self.trUtf8("Ruby Files (*.rb);;"),
         }
         
@@ -321,8 +321,8 @@
                         self.trUtf8("Registering Project Type"),
                         self.trUtf8(
                             """<p>The Programming Language <b>{0}</b> is not"""
-                            """ supported.</p>""")\
-                            .format(progLanguage)
+                            """ supported.</p>""")
+                        .format(progLanguage)
                     )
                     return
                 
@@ -333,8 +333,8 @@
                         self.trUtf8(
                             """<p>The Project type <b>{0}</b> is already"""
                             """ registered with Programming Language"""
-                            """ <b>{1}</b>.</p>""")\
-                            .format(type_, progLanguage)
+                            """ <b>{1}</b>.</p>""")
+                        .format(type_, progLanguage)
                     )
                     return
             
@@ -677,8 +677,8 @@
                 self.ui,
                 self.trUtf8("Read project file"),
                 self.trUtf8(
-                    "<p>The project file <b>{0}</b> could not be read.</p>")\
-                    .format(fn))
+                    "<p>The project file <b>{0}</b> could not be read.</p>")
+                .format(fn))
             return False
         
         self.pfile = os.path.abspath(fn)
@@ -714,10 +714,10 @@
             
             # get the names of subdirectories the files are stored in
             for fn in self.pdata["SOURCES"] + \
-                      self.pdata["FORMS"] + \
-                      self.pdata["INTERFACES"] + \
-                      self.pdata["RESOURCES"] + \
-                      self.pdata["TRANSLATIONS"]:
+                self.pdata["FORMS"] + \
+                self.pdata["INTERFACES"] + \
+                self.pdata["RESOURCES"] + \
+                    self.pdata["TRANSLATIONS"]:
                 dn = os.path.dirname(fn)
                 if dn not in self.subdirs:
                     self.subdirs.append(dn)
@@ -979,8 +979,8 @@
                 self.ui,
                 self.trUtf8("Read tasks"),
                 self.trUtf8(
-                    "<p>The tasks file <b>{0}</b> could not be read.</p>")\
-                    .format(fn))
+                    "<p>The tasks file <b>{0}</b> could not be read.</p>")
+                .format(fn))
         
     def writeTasks(self):
         """
@@ -1000,7 +1000,7 @@
                 self.trUtf8("Save tasks"),
                 self.trUtf8(
                     "<p>The tasks file <b>{0}</b> could not be written.</p>")
-                    .format(fn))
+                .format(fn))
             return
         
         from E5XML.TasksWriter import TasksWriter
@@ -1116,7 +1116,7 @@
                         self.trUtf8(
                             "<p>The project debugger properties file"
                             " <b>{0}</b> could not be deleted.</p>")
-                            .format(fn))
+                        .format(fn))
         
     def __initDebugProperties(self):
         """
@@ -1250,7 +1250,7 @@
         Public slot to check the language files after a release process.
         """
         tbPath = self.pdata["TRANSLATIONSBINPATH"] and \
-                 self.pdata["TRANSLATIONSBINPATH"][0] or ""
+            self.pdata["TRANSLATIONSBINPATH"][0] or ""
         for langFile in self.pdata["TRANSLATIONS"][:]:
             qmFile = self.__binaryTranslationFile(langFile)
             if qmFile:
@@ -1453,7 +1453,7 @@
                                     self.trUtf8(
                                         "<p>The file <b>{0}</b> already"
                                         " exists.</p><p>Overwrite it?</p>")
-                                        .format(targetfile),
+                                    .format(targetfile),
                                     icon=E5MessageBox.Warning)
                                 if not res:
                                     return  # don't overwrite
@@ -1467,7 +1467,7 @@
                                     "<p>The selected file <b>{0}</b> could"
                                     " not be added to <b>{1}</b>.</p>"
                                     "<p>Reason: {2}</p>")
-                                    .format(fn, target, str(why)))
+                                .format(fn, target, str(why)))
                             continue
                     
                     self.appendFile(targetfile, isSource or filter == 'source')
@@ -1522,7 +1522,7 @@
                     self.trUtf8(
                         "<p>The target directory <b>{0}</b> could not be"
                         " created.</p><p>Reason: {1}</p>")
-                        .format(target, str(why)))
+                    .format(target, str(why)))
                 return
         
         for file in files:
@@ -1540,7 +1540,7 @@
                             self.trUtf8(
                                 "<p>The file <b>{0}</b> already exists.</p>"
                                 "<p>Overwrite it?</p>")
-                                .format(targetfile),
+                            .format(targetfile),
                             icon=E5MessageBox.Warning)
                         if not res:
                             continue  # don't overwrite, carry on
@@ -2031,7 +2031,7 @@
             self.pluginGrp.setEnabled(
                 self.pdata["PROJECTTYPE"][0] == "E4Plugin")
             self.addLanguageAct.setEnabled(
-                len(self.pdata["TRANSLATIONPATTERN"]) > 0 and \
+                len(self.pdata["TRANSLATIONPATTERN"]) > 0 and
                 self.pdata["TRANSLATIONPATTERN"][0] != '')
             
             self.projectAboutToBeCreated.emit()
@@ -2053,7 +2053,7 @@
                         self.trUtf8(
                             "<p>The project directory <b>{0}</b> could not"
                             " be created.</p>")
-                            .format(self.ppath))
+                        .format(self.ppath))
                     self.vcs = self.initVCS()
                     return
                 # create an empty __init__.py file to make it a Python package
@@ -2111,7 +2111,7 @@
                                 self.trUtf8(
                                     "<p>The mainscript <b>{0}</b> could not"
                                     " be created.<br/>Reason: {1}</p>")
-                                    .format(self.ppath, str(err)))
+                                .format(self.ppath, str(err)))
                     self.appendFile(ms)
                 except IndexError:
                     ms = ""
@@ -2175,8 +2175,8 @@
                                     """ command options?"""))
                             if vcores:
                                 from VCS.CommandOptionsDialog import \
-                                    vcsCommandOptionsDialog
-                                codlg = vcsCommandOptionsDialog(self.vcs)
+                                    VcsCommandOptionsDialog
+                                codlg = VcsCommandOptionsDialog(self.vcs)
                                 if codlg.exec_() == QDialog.Accepted:
                                     self.vcs.vcsSetOptions(codlg.getOptions())
                             # add project file to repository
@@ -2239,7 +2239,7 @@
                             """Would you like to edit the VCS command"""
                             """ options?"""))
                     if vcores:
-                        codlg = vcsCommandOptionsDialog(self.vcs)
+                        codlg = VcsCommandOptionsDialog(self.vcs)
                         if codlg.exec_() == QDialog.Accepted:
                             self.vcs.vcsSetOptions(codlg.getOptions())
                     
@@ -2296,12 +2296,12 @@
             if '_' in os.path.basename(tslist[0]):
                 # the first entry determines the mainscript name
                 mainscriptname = os.path.splitext(mainscript)[0] or \
-                                 os.path.basename(tslist[0]).split('_')[0]
+                    os.path.basename(tslist[0]).split('_')[0]
                 self.pdata["TRANSLATIONPATTERN"] = \
                     [os.path.join(os.path.dirname(tslist[0]),
                      "{0}_%language%{1}".format(
-                        os.path.basename(tslist[0]).split('_')[0],
-                        os.path.splitext(tslist[0])[1]))]
+                         os.path.basename(tslist[0]).split('_')[0],
+                         os.path.splitext(tslist[0])[1]))]
             else:
                 pattern, ok = QInputDialog.getText(
                     None,
@@ -2404,12 +2404,12 @@
         if dlg.exec_() == QDialog.Accepted:
             dlg.storeData()
             
-            if (self.pdata["VCS"] and \
+            if (self.pdata["VCS"] and
                 self.pdata["VCS"][0] != vcsSystem) or \
-               (self.pudata["VCSOVERRIDE"] and \
+               (self.pudata["VCSOVERRIDE"] and
                 self.pudata["VCSOVERRIDE"][0] != vcsSystemOverride) or \
-               (vcsSystemOverride is not None and \
-                len(self.pudata["VCSOVERRIDE"]) == 0):
+               (vcsSystemOverride is not None and
+                    len(self.pudata["VCSOVERRIDE"]) == 0):
                 # stop the VCS monitor thread and shutdown VCS
                 if self.vcs is not None:
                     self.vcs.stopStatusMonitor()
@@ -2497,8 +2497,8 @@
             fn = E5FileDialog.getOpenFileName(
                 self.parent(),
                 self.trUtf8("Open project"),
-                Preferences.getMultiProject("Workspace") or \
-                    Utilities.getHomeDir(),
+                Preferences.getMultiProject("Workspace") or
+                Utilities.getHomeDir(),
                 self.trUtf8("Project Files (*.e4p)"))
         
         QApplication.processEvents()
@@ -2569,7 +2569,7 @@
                                 self.vcs = self.initVCS()
                                 self.setDirty(True)
                     if self.vcs is not None and \
-                           (self.vcs.vcsRegisteredState(self.ppath) != 
+                        (self.vcs.vcsRegisteredState(self.ppath) !=
                             self.vcs.canBeCommitted):
                         self.pdata["VCS"] = ['None']
                         self.vcs = self.initVCS()
@@ -2592,7 +2592,7 @@
                     self.pluginGrp.setEnabled(
                         self.pdata["PROJECTTYPE"][0] == "E4Plugin")
                     self.addLanguageAct.setEnabled(
-                        len(self.pdata["TRANSLATIONPATTERN"]) > 0 and \
+                        len(self.pdata["TRANSLATIONPATTERN"]) > 0 and
                         self.pdata["TRANSLATIONPATTERN"][0] != '')
                     
                     self.__model.projectOpened()
@@ -2675,7 +2675,7 @@
             defaultPath = self.ppath
         else:
             defaultPath = Preferences.getMultiProject("Workspace") or \
-                          Utilities.getHomeDir()
+                Utilities.getHomeDir()
         fn, selectedFilter = E5FileDialog.getSaveFileNameAndFilter(
             self.parent(),
             self.trUtf8("Save project as"),
@@ -2744,11 +2744,11 @@
         """
         Private method to close all project related windows.
         """
-        self.codemetrics        and self.codemetrics.close()
-        self.codecoverage       and self.codecoverage.close()
-        self.profiledata        and self.profiledata.close()
+        self.codemetrics and self.codemetrics.close()
+        self.codecoverage and self.codecoverage.close()
+        self.profiledata and self.profiledata.close()
         self.applicationDiagram and self.applicationDiagram.close()
-        self.loadedDiagram      and self.loadedDiagram.close()
+        self.loadedDiagram and self.loadedDiagram.close()
         
     def closeProject(self, reopen=False, noSave=False):
         """
@@ -2927,7 +2927,7 @@
         @return list of the projects scripts (list of string)
         """
         if normalized:
-            return [os.path.join(self.ppath, fn) for fn in 
+            return [os.path.join(self.ppath, fn) for fn in
                     self.pdata["SOURCES"]]
         else:
             return self.pdata["SOURCES"]
@@ -3975,13 +3975,13 @@
                         filetype = self.pdata["FILETYPES"][pattern]
                         break
                 
-                if (filetype == "SOURCES" and 
+                if (filetype == "SOURCES" and
                     fn not in self.pdata["SOURCES"]) or \
-                   (filetype == "FORMS" and 
+                   (filetype == "FORMS" and
                     fn not in self.pdata["FORMS"]) or \
-                   (filetype == "INTERFACES" and 
+                   (filetype == "INTERFACES" and
                     fn not in self.pdata["INTERFACES"]) or \
-                   (filetype == "RESOURCES" and 
+                   (filetype == "RESOURCES" and
                     fn not in self.pdata["RESOURCES"]) or \
                    (filetype == "OTHERS" and fn not in self.pdata["OTHERS"]):
                     if autoInclude and AI:
@@ -4145,7 +4145,7 @@
                         self.trUtf8(
                             "<p>The selected VCS <b>{0}</b> could not be"
                             " found. <br/>Reverting override.</p><p>{1}</p>")
-                            .format(vcsSystem, msg))
+                        .format(vcsSystem, msg))
                     self.pudata["VCSOVERRIDE"] = []
                     return self.initVCS(nooverride=True)
                 
@@ -4367,11 +4367,11 @@
             basename = os.path.splitext(fn)[0]
             tbasename = os.path.splitext(tfn)[0]
             self.codeProfileAct.setEnabled(
-                os.path.isfile("{0}.profile".format(basename)) or \
+                os.path.isfile("{0}.profile".format(basename)) or
                 os.path.isfile("{0}.profile".format(tbasename)))
             self.codeCoverageAct.setEnabled(
-                self.isPy3Project() and \
-                (os.path.isfile("{0}.coverage".format(basename)) or \
+                self.isPy3Project() and
+                (os.path.isfile("{0}.coverage".format(basename)) or
                  os.path.isfile("{0}.coverage".format(tbasename))))
         else:
             self.codeProfileAct.setEnabled(False)
@@ -4530,7 +4530,7 @@
         for entry in lst_:
             if os.path.isdir(self.getAbsolutePath(entry)):
                 lst.extend(
-                    [self.getRelativePath(p) for p in 
+                    [self.getRelativePath(p) for p in
                      Utilities.direntries(self.getAbsolutePath(entry), True)])
                 continue
             else:
@@ -4638,8 +4638,8 @@
                         self.trUtf8(
                             """<p>The file <b>{0}</b> could not be stored """
                             """in the archive. Ignoring it.</p>"""
-                            """<p>Reason: {1}</p>""")\
-                            .format(os.path.join(self.ppath, name), str(why)))
+                            """<p>Reason: {1}</p>""")
+                        .format(os.path.join(self.ppath, name), str(why)))
         archiveFile.writestr("VERSION", version.encode("utf-8"))
         archiveFile.close()
         
@@ -4652,8 +4652,8 @@
                 self.trUtf8("Create Plugin Archive"),
                 self.trUtf8(
                     """<p>The eric5 plugin archive file <b>{0}</b> was """
-                    """created successfully.</p>""")\
-                    .format(os.path.basename(archive)))
+                    """created successfully.</p>""")
+                .format(os.path.basename(archive)))
         else:
             E5MessageBox.information(
                 self.ui,
@@ -4706,7 +4706,7 @@
                 self.trUtf8("""<p>The plugin file <b>{0}</b> could """
                             """not be read.</p>"""
                             """<p>Reason: {1}</p>""")
-                            .format(filename, str(why)))
+                .format(filename, str(why)))
             return b"", ""
         
         lineno = 0
@@ -4718,7 +4718,7 @@
                     .replace(sourcelines[lineno].rstrip(), "")
                 sversion = "{0}-snapshot-{1}".format(
                     sourcelines[lineno].replace("version = ", "")
-                        .strip()[1:-1],
+                    .strip()[1:-1],
                     datestr)
                 sourcelines[lineno] = '{0} + "-snapshot-{1}"{2}'.format(
                     sourcelines[lineno].rstrip(), datestr, lineend)
@@ -4747,13 +4747,13 @@
                 self.trUtf8(
                     """<p>The plugin file <b>{0}</b> could """
                     """not be read.</p> <p>Reason: {1}</p>""")
-                    .format(filename, str(why)))
+                .format(filename, str(why)))
             return ""
         
         for sourceline in sourcelines:
             if sourceline.startswith("version = "):
                 version = sourceline.replace("version = ", "").strip()\
-                            .replace('"', "").replace("'", "")
+                    .replace('"', "").replace("'", "")
                 break
         
         return version

eric ide

mercurial