Graphics/UMLGraphicsView.py

branch
Py2 comp.
changeset 3057
10516539f238
parent 2791
a9577f248f04
parent 2992
dbdf27746da5
child 3058
0a02c433f52d
--- a/Graphics/UMLGraphicsView.py	Tue Oct 15 22:03:54 2013 +0200
+++ b/Graphics/UMLGraphicsView.py	Fri Oct 18 23:00:41 2013 +0200
@@ -9,8 +9,10 @@
 
 from __future__ import unicode_literals    # __IGNORE_WARNING__
 
-from PyQt4.QtCore import pyqtSignal, Qt, QSignalMapper, QFileInfo, QEvent, QRectF
-from PyQt4.QtGui import QGraphicsView, QAction, QToolBar, QDialog, QPrinter, QPrintDialog
+from PyQt4.QtCore import pyqtSignal, Qt, QSignalMapper, QFileInfo, QEvent, \
+    QRectF
+from PyQt4.QtGui import QGraphicsView, QAction, QToolBar, QDialog, QPrinter, \
+    QPrintDialog
 
 from E5Graphics.E5GraphicsView import E5GraphicsView
 
@@ -51,7 +53,8 @@
         self.border = 10
         self.deltaSize = 100.0
         
-        self.__zoomWidget = E5ZoomWidget(UI.PixmapCache.getPixmap("zoomOut.png"),
+        self.__zoomWidget = E5ZoomWidget(
+            UI.PixmapCache.getPixmap("zoomOut.png"),
             UI.PixmapCache.getPixmap("zoomIn.png"),
             UI.PixmapCache.getPixmap("zoomReset.png"), self)
         parent.statusBar().addPermanentWidget(self.__zoomWidget)
@@ -80,25 +83,29 @@
         
         self.incWidthAct = \
             QAction(UI.PixmapCache.getIcon("sceneWidthInc.png"),
-                    self.trUtf8("Increase width by {0} points").format(self.deltaSize),
+                    self.trUtf8("Increase width by {0} points").format(
+                        self.deltaSize),
                     self)
         self.incWidthAct.triggered[()].connect(self.__incWidth)
         
         self.incHeightAct = \
             QAction(UI.PixmapCache.getIcon("sceneHeightInc.png"),
-                    self.trUtf8("Increase height by {0} points").format(self.deltaSize),
+                    self.trUtf8("Increase height by {0} points").format(
+                        self.deltaSize),
                     self)
         self.incHeightAct.triggered[()].connect(self.__incHeight)
         
         self.decWidthAct = \
             QAction(UI.PixmapCache.getIcon("sceneWidthDec.png"),
-                    self.trUtf8("Decrease width by {0} points").format(self.deltaSize),
+                    self.trUtf8("Decrease width by {0} points").format(
+                        self.deltaSize),
                     self)
         self.decWidthAct.triggered[()].connect(self.__decWidth)
         
         self.decHeightAct = \
             QAction(UI.PixmapCache.getIcon("sceneHeightDec.png"),
-                    self.trUtf8("Decrease height by {0} points").format(self.deltaSize),
+                    self.trUtf8("Decrease height by {0} points").format(
+                        self.deltaSize),
                     self)
         self.decHeightAct.triggered[()].connect(self.__decHeight)
         
@@ -344,11 +351,13 @@
                 if not res:
                     return
             
-            success = super(UMLGraphicsView, self).saveImage(fname, QFileInfo(fname).suffix().upper())
+            success = super(UMLGraphicsView, self).saveImage(
+                fname, QFileInfo(fname).suffix().upper())
             if not success:
                 E5MessageBox.critical(self,
                     self.trUtf8("Save Diagram"),
-                    self.trUtf8("""<p>The file <b>{0}</b> could not be saved.</p>""")
+                    self.trUtf8(
+                        """<p>The file <b>{0}</b> could not be saved.</p>""")
                         .format(fname))
         
     def __relayout(self):
@@ -445,6 +454,8 @@
     def __printPreviewPrint(self, printer):
         """
         Private slot to generate a print preview.
+        
+        @param printer reference to the printer object (QPrinter)
         """
         super(UMLGraphicsView, self).printDiagram(printer, self.diagramName)
         
@@ -677,7 +688,8 @@
         
         from .AssociationItem import AssociationItem
         for item in self.filteredItems(self.scene().items(), AssociationItem):
-            lines.append("association: {0}".format(item.buildAssociationItemDataString()))
+            lines.append("association: {0}".format(
+                item.buildAssociationItemDataString()))
         
         return lines
     
@@ -729,7 +741,8 @@
                     return False, linenum
             elif key == "association":
                 srcId, dstId, assocType, topToBottom = \
-                    AssociationItem.parseAssociationItemDataString(value.strip())
+                    AssociationItem.parseAssociationItemDataString(
+                        value.strip())
                 assoc = AssociationItem(umlItems[srcId], umlItems[dstId],
                     assocType, topToBottom)
                 self.scene().addItem(assoc)

eric ide

mercurial