Graphics/ApplicationDiagramBuilder.py

branch
Py2 comp.
changeset 3057
10516539f238
parent 2525
8b507a9a2d40
parent 2992
dbdf27746da5
child 3058
0a02c433f52d
diff -r 9986ec0e559a -r 10516539f238 Graphics/ApplicationDiagramBuilder.py
--- a/Graphics/ApplicationDiagramBuilder.py	Tue Oct 15 22:03:54 2013 +0200
+++ b/Graphics/ApplicationDiagramBuilder.py	Fri Oct 18 23:00:41 2013 +0200
@@ -41,12 +41,14 @@
         
         self.noModules = noModules
         
-        self.umlView.setDiagramName(self.trUtf8("Application Diagram {0}").format(
-            self.project.getProjectName()))
+        self.umlView.setDiagramName(
+            self.trUtf8("Application Diagram {0}").format(
+                self.project.getProjectName()))
         
     def __buildModulesDict(self):
         """
-        Private method to build a dictionary of modules contained in the application.
+        Private method to build a dictionary of modules contained in the
+        application.
         
         @return dictionary of modules contained in the application.
         """
@@ -57,7 +59,8 @@
         mods = self.project.pdata["SOURCES"]
         modules = []
         for module in mods:
-            modules.append(Utilities.normabsjoinpath(self.project.ppath, module))
+            modules.append(Utilities.normabsjoinpath(
+                self.project.ppath, module))
         tot = len(modules)
         try:
             prog = 0
@@ -73,8 +76,8 @@
                 if module.endswith("__init__.py"):
                     continue
                 try:
-                    mod = Utilities.ModuleParser.readModule(module, extensions=extensions,
-                                                            caching=False)
+                    mod = Utilities.ModuleParser.readModule(
+                        module, extensions=extensions, caching=False)
                 except ImportError:
                     continue
                 else:
@@ -145,13 +148,15 @@
                         ppath = packagePath
                         while hasInit:
                             ppath = os.path.dirname(ppath)
-                            hasInit = \
-                                len(glob.glob(os.path.join(ppath, '__init__.*'))) > 0
-                        shortPackage = \
-                            packagePath.replace(ppath, '').replace(os.sep, '.')[1:]
+                            hasInit = len(glob.glob(os.path.join(
+                                ppath, '__init__.*'))) > 0
+                        shortPackage = packagePath.replace(ppath, '')\
+                            .replace(os.sep, '.')[1:]
                         packageList = shortPackage.split('.')[1:]
                         packageListLen = len(packageList)
-                        i = '.'.join(packageList[:packageListLen - dots + 1] + [i[dots:]])
+                        i = '.'.join(
+                            packageList[:packageListLen - dots + 1] + 
+                            [i[dots:]])
                 
                 if i in modules:
                     impLst.append(i)
@@ -187,7 +192,8 @@
                     relPackage = self.trUtf8("<<Application>>")
             else:
                 relPackage = self.trUtf8("<<Others>>")
-            shape = self.__addPackage(relPackage, packages[package][0], 0.0, 0.0)
+            shape = self.__addPackage(
+                relPackage, packages[package][0], 0.0, 0.0)
             shapeRect = shape.sceneBoundingRect()
             shapes[package] = (shape, packages[package][1])
             pn = p + shapeRect.width() + 10
@@ -222,6 +228,7 @@
             (list of strings)
         @param x x-coordinate (float)
         @param y y-coordinate (float)
+        @return reference to the package item (PackageItem)
         """
         from .PackageItem import PackageItem, PackageModel
         modules.sort()
@@ -271,8 +278,9 @@
         if projectFile != self.project.getProjectFile():
             res = E5MessageBox.yesNo(None,
                 self.trUtf8("Load Diagram"),
-                self.trUtf8("""<p>The diagram belongs to the project <b>{0}</b>."""
-                             """ Shall this project be opened?</p>""").format(
+                self.trUtf8(
+                    """<p>The diagram belongs to the project <b>{0}</b>."""
+                    """ Shall this project be opened?</p>""").format(
                     projectFile))
             if res:
                 self.project.openProject(projectFile)

eric ide

mercurial