Sun, 09 Sep 2012 19:38:07 +0200
Some more refactorings to prepare loading graphics diagrams from file.
--- a/APIs/Python3/eric5.api Sun Sep 09 17:46:32 2012 +0200 +++ b/APIs/Python3/eric5.api Sun Sep 09 19:38:07 2012 +0200 @@ -1616,6 +1616,8 @@ eric5.Globals.settingsNameOrganization?7 eric5.Globals.settingsNameRecent?7 eric5.Graphics.ApplicationDiagramBuilder.ApplicationDiagramBuilder.buildDiagram?4() +eric5.Graphics.ApplicationDiagramBuilder.ApplicationDiagramBuilder.getPersistenceData?4() +eric5.Graphics.ApplicationDiagramBuilder.ApplicationDiagramBuilder.parsePersistenceData?4(data) eric5.Graphics.ApplicationDiagramBuilder.ApplicationDiagramBuilder?1(dialog, view, project, noModules=False) eric5.Graphics.AssociationItem.AssociationItem.buildAssociationItemDataString?4() eric5.Graphics.AssociationItem.AssociationItem.parseAssociationItemDataString?4(data) @@ -1651,6 +1653,9 @@ eric5.Graphics.GraphicsUtilities._buildChildrenLists?5(routes) eric5.Graphics.GraphicsUtilities.sort?4(nodes, routes, noRecursion=False) eric5.Graphics.ImportsDiagramBuilder.ImportsDiagramBuilder.buildDiagram?4() +eric5.Graphics.ImportsDiagramBuilder.ImportsDiagramBuilder.getPersistenceData?4() +eric5.Graphics.ImportsDiagramBuilder.ImportsDiagramBuilder.initialize?4() +eric5.Graphics.ImportsDiagramBuilder.ImportsDiagramBuilder.parsePersistenceData?4(data) eric5.Graphics.ImportsDiagramBuilder.ImportsDiagramBuilder?1(dialog, view, project, package, showExternalImports=False) eric5.Graphics.ModuleItem.ModuleItem.ItemType?7 eric5.Graphics.ModuleItem.ModuleItem.buildItemDataString?4() @@ -1663,6 +1668,9 @@ eric5.Graphics.ModuleItem.ModuleModel.getName?4() eric5.Graphics.ModuleItem.ModuleModel?1(name, classlist=[]) eric5.Graphics.PackageDiagramBuilder.PackageDiagramBuilder.buildDiagram?4() +eric5.Graphics.PackageDiagramBuilder.PackageDiagramBuilder.getPersistenceData?4() +eric5.Graphics.PackageDiagramBuilder.PackageDiagramBuilder.initialize?4() +eric5.Graphics.PackageDiagramBuilder.PackageDiagramBuilder.parsePersistenceData?4(data) eric5.Graphics.PackageDiagramBuilder.PackageDiagramBuilder?1(dialog, view, project, package, noAttrs=False) eric5.Graphics.PackageItem.PackageItem.ItemType?7 eric5.Graphics.PackageItem.PackageItem.buildItemDataString?4() @@ -1686,17 +1694,22 @@ eric5.Graphics.SvgDiagram.SvgDiagram.wheelEvent?4(evt) eric5.Graphics.SvgDiagram.SvgDiagram?1(svgFile, parent=None, name=None) eric5.Graphics.UMLClassDiagramBuilder.UMLClassDiagramBuilder.buildDiagram?4() +eric5.Graphics.UMLClassDiagramBuilder.UMLClassDiagramBuilder.getPersistenceData?4() +eric5.Graphics.UMLClassDiagramBuilder.UMLClassDiagramBuilder.initialize?4() +eric5.Graphics.UMLClassDiagramBuilder.UMLClassDiagramBuilder.parsePersistenceData?4(data) eric5.Graphics.UMLClassDiagramBuilder.UMLClassDiagramBuilder?1(dialog, view, project, file, noAttrs=False) eric5.Graphics.UMLDiagramBuilder.UMLDiagramBuilder.buildDiagram?4() +eric5.Graphics.UMLDiagramBuilder.UMLDiagramBuilder.getPersistenceData?4() +eric5.Graphics.UMLDiagramBuilder.UMLDiagramBuilder.initialize?4() eric5.Graphics.UMLDiagramBuilder.UMLDiagramBuilder.parsePersistenceData?4(data) eric5.Graphics.UMLDiagramBuilder.UMLDiagramBuilder?1(dialog, view, project) eric5.Graphics.UMLDialog.UMLDialog.ApplicationDiagram?7 eric5.Graphics.UMLDialog.UMLDialog.ClassDiagram?7 eric5.Graphics.UMLDialog.UMLDialog.ImportsDiagram?7 eric5.Graphics.UMLDialog.UMLDialog.PackageDiagram?7 -eric5.Graphics.UMLDialog.UMLDialog.diagramTypeToString?4(diagramType) +eric5.Graphics.UMLDialog.UMLDialog.generateDialogFromFile?4(project, parent=None) eric5.Graphics.UMLDialog.UMLDialog.show?4() -eric5.Graphics.UMLDialog.UMLDialog?1(diagramType, project, path, parent=None, **kwargs) +eric5.Graphics.UMLDialog.UMLDialog?1(diagramType, project, path="", parent=None, initBuilder=True, **kwargs) eric5.Graphics.UMLGraphicsView.UMLGraphicsView.autoAdjustSceneSize?4(limit=False) eric5.Graphics.UMLGraphicsView.UMLGraphicsView.event?4(evt) eric5.Graphics.UMLGraphicsView.UMLGraphicsView.filteredItems?4(items, itemType=UMLItem) @@ -1705,17 +1718,22 @@ eric5.Graphics.UMLGraphicsView.UMLGraphicsView.getItemId?4() eric5.Graphics.UMLGraphicsView.UMLGraphicsView.getPersistenceData?4() eric5.Graphics.UMLGraphicsView.UMLGraphicsView.initToolBar?4() +eric5.Graphics.UMLGraphicsView.UMLGraphicsView.parsePersistenceData?4(data) +eric5.Graphics.UMLGraphicsView.UMLGraphicsView.printDiagram?4() +eric5.Graphics.UMLGraphicsView.UMLGraphicsView.printPreviewDiagram?4() eric5.Graphics.UMLGraphicsView.UMLGraphicsView.relayout?7 +eric5.Graphics.UMLGraphicsView.UMLGraphicsView.saveImage?4() eric5.Graphics.UMLGraphicsView.UMLGraphicsView.selectItem?4(item) eric5.Graphics.UMLGraphicsView.UMLGraphicsView.selectItems?4(items) eric5.Graphics.UMLGraphicsView.UMLGraphicsView.setDiagramName?4(name) -eric5.Graphics.UMLGraphicsView.UMLGraphicsView.setPersistenceData?4(data) eric5.Graphics.UMLGraphicsView.UMLGraphicsView.wheelEvent?4(evt) -eric5.Graphics.UMLGraphicsView.UMLGraphicsView?1(scene, diagramType, parent=None) +eric5.Graphics.UMLGraphicsView.UMLGraphicsView?1(scene, parent=None) +eric5.Graphics.UMLItem.UMLItem.ItemType?7 eric5.Graphics.UMLItem.UMLItem.addAssociation?4(assoc) eric5.Graphics.UMLItem.UMLItem.adjustAssociations?4() eric5.Graphics.UMLItem.UMLItem.buildItemDataString?4() eric5.Graphics.UMLItem.UMLItem.getId?4() +eric5.Graphics.UMLItem.UMLItem.getItemType?4() eric5.Graphics.UMLItem.UMLItem.itemChange?4(change, value) eric5.Graphics.UMLItem.UMLItem.moveBy?4(dx, dy) eric5.Graphics.UMLItem.UMLItem.paint?4(painter, option, widget=None)
--- a/Documentation/Help/source.qhp Sun Sep 09 17:46:32 2012 +0200 +++ b/Documentation/Help/source.qhp Sun Sep 09 19:38:07 2012 +0200 @@ -1280,6 +1280,8 @@ <keyword name="ApplicationDiagramBuilder.__buildModulesDict" id="ApplicationDiagramBuilder.__buildModulesDict" ref="eric5.Graphics.ApplicationDiagramBuilder.html#ApplicationDiagramBuilder.__buildModulesDict" /> <keyword name="ApplicationDiagramBuilder.__createAssociations" id="ApplicationDiagramBuilder.__createAssociations" ref="eric5.Graphics.ApplicationDiagramBuilder.html#ApplicationDiagramBuilder.__createAssociations" /> <keyword name="ApplicationDiagramBuilder.buildDiagram" id="ApplicationDiagramBuilder.buildDiagram" ref="eric5.Graphics.ApplicationDiagramBuilder.html#ApplicationDiagramBuilder.buildDiagram" /> + <keyword name="ApplicationDiagramBuilder.getPersistenceData" id="ApplicationDiagramBuilder.getPersistenceData" ref="eric5.Graphics.ApplicationDiagramBuilder.html#ApplicationDiagramBuilder.getPersistenceData" /> + <keyword name="ApplicationDiagramBuilder.parsePersistenceData" id="ApplicationDiagramBuilder.parsePersistenceData" ref="eric5.Graphics.ApplicationDiagramBuilder.html#ApplicationDiagramBuilder.parsePersistenceData" /> <keyword name="ApplicationPage" id="ApplicationPage" ref="eric5.Preferences.ConfigurationPages.ApplicationPage.html#ApplicationPage" /> <keyword name="ApplicationPage (Constructor)" id="ApplicationPage (Constructor)" ref="eric5.Preferences.ConfigurationPages.ApplicationPage.html#ApplicationPage.__init__" /> <keyword name="ApplicationPage (Module)" id="ApplicationPage (Module)" ref="eric5.Preferences.ConfigurationPages.ApplicationPage.html" /> @@ -6234,6 +6236,9 @@ <keyword name="ImportsDiagramBuilder.__buildModulesDict" id="ImportsDiagramBuilder.__buildModulesDict" ref="eric5.Graphics.ImportsDiagramBuilder.html#ImportsDiagramBuilder.__buildModulesDict" /> <keyword name="ImportsDiagramBuilder.__createAssociations" id="ImportsDiagramBuilder.__createAssociations" ref="eric5.Graphics.ImportsDiagramBuilder.html#ImportsDiagramBuilder.__createAssociations" /> <keyword name="ImportsDiagramBuilder.buildDiagram" id="ImportsDiagramBuilder.buildDiagram" ref="eric5.Graphics.ImportsDiagramBuilder.html#ImportsDiagramBuilder.buildDiagram" /> + <keyword name="ImportsDiagramBuilder.getPersistenceData" id="ImportsDiagramBuilder.getPersistenceData" ref="eric5.Graphics.ImportsDiagramBuilder.html#ImportsDiagramBuilder.getPersistenceData" /> + <keyword name="ImportsDiagramBuilder.initialize" id="ImportsDiagramBuilder.initialize" ref="eric5.Graphics.ImportsDiagramBuilder.html#ImportsDiagramBuilder.initialize" /> + <keyword name="ImportsDiagramBuilder.parsePersistenceData" id="ImportsDiagramBuilder.parsePersistenceData" ref="eric5.Graphics.ImportsDiagramBuilder.html#ImportsDiagramBuilder.parsePersistenceData" /> <keyword name="IndexGenerator" id="IndexGenerator" ref="eric5.DocumentationTools.IndexGenerator.html#IndexGenerator" /> <keyword name="IndexGenerator (Constructor)" id="IndexGenerator (Constructor)" ref="eric5.DocumentationTools.IndexGenerator.html#IndexGenerator.__init__" /> <keyword name="IndexGenerator (Module)" id="IndexGenerator (Module)" ref="eric5.DocumentationTools.IndexGenerator.html" /> @@ -7149,6 +7154,9 @@ <keyword name="PackageDiagramBuilder.__createAssociations" id="PackageDiagramBuilder.__createAssociations" ref="eric5.Graphics.PackageDiagramBuilder.html#PackageDiagramBuilder.__createAssociations" /> <keyword name="PackageDiagramBuilder.__getCurrentShape" id="PackageDiagramBuilder.__getCurrentShape" ref="eric5.Graphics.PackageDiagramBuilder.html#PackageDiagramBuilder.__getCurrentShape" /> <keyword name="PackageDiagramBuilder.buildDiagram" id="PackageDiagramBuilder.buildDiagram" ref="eric5.Graphics.PackageDiagramBuilder.html#PackageDiagramBuilder.buildDiagram" /> + <keyword name="PackageDiagramBuilder.getPersistenceData" id="PackageDiagramBuilder.getPersistenceData" ref="eric5.Graphics.PackageDiagramBuilder.html#PackageDiagramBuilder.getPersistenceData" /> + <keyword name="PackageDiagramBuilder.initialize" id="PackageDiagramBuilder.initialize" ref="eric5.Graphics.PackageDiagramBuilder.html#PackageDiagramBuilder.initialize" /> + <keyword name="PackageDiagramBuilder.parsePersistenceData" id="PackageDiagramBuilder.parsePersistenceData" ref="eric5.Graphics.PackageDiagramBuilder.html#PackageDiagramBuilder.parsePersistenceData" /> <keyword name="PackageItem" id="PackageItem" ref="eric5.Graphics.PackageItem.html#PackageItem" /> <keyword name="PackageItem (Constructor)" id="PackageItem (Constructor)" ref="eric5.Graphics.PackageItem.html#PackageItem.__init__" /> <keyword name="PackageItem (Module)" id="PackageItem (Module)" ref="eric5.Graphics.PackageItem.html" /> @@ -10621,17 +10629,27 @@ <keyword name="UMLClassDiagramBuilder.__createAssociations" id="UMLClassDiagramBuilder.__createAssociations" ref="eric5.Graphics.UMLClassDiagramBuilder.html#UMLClassDiagramBuilder.__createAssociations" /> <keyword name="UMLClassDiagramBuilder.__getCurrentShape" id="UMLClassDiagramBuilder.__getCurrentShape" ref="eric5.Graphics.UMLClassDiagramBuilder.html#UMLClassDiagramBuilder.__getCurrentShape" /> <keyword name="UMLClassDiagramBuilder.buildDiagram" id="UMLClassDiagramBuilder.buildDiagram" ref="eric5.Graphics.UMLClassDiagramBuilder.html#UMLClassDiagramBuilder.buildDiagram" /> + <keyword name="UMLClassDiagramBuilder.getPersistenceData" id="UMLClassDiagramBuilder.getPersistenceData" ref="eric5.Graphics.UMLClassDiagramBuilder.html#UMLClassDiagramBuilder.getPersistenceData" /> + <keyword name="UMLClassDiagramBuilder.initialize" id="UMLClassDiagramBuilder.initialize" ref="eric5.Graphics.UMLClassDiagramBuilder.html#UMLClassDiagramBuilder.initialize" /> + <keyword name="UMLClassDiagramBuilder.parsePersistenceData" id="UMLClassDiagramBuilder.parsePersistenceData" ref="eric5.Graphics.UMLClassDiagramBuilder.html#UMLClassDiagramBuilder.parsePersistenceData" /> <keyword name="UMLDiagramBuilder" id="UMLDiagramBuilder" ref="eric5.Graphics.UMLDiagramBuilder.html#UMLDiagramBuilder" /> <keyword name="UMLDiagramBuilder (Constructor)" id="UMLDiagramBuilder (Constructor)" ref="eric5.Graphics.UMLDiagramBuilder.html#UMLDiagramBuilder.__init__" /> <keyword name="UMLDiagramBuilder (Module)" id="UMLDiagramBuilder (Module)" ref="eric5.Graphics.UMLDiagramBuilder.html" /> <keyword name="UMLDiagramBuilder.buildDiagram" id="UMLDiagramBuilder.buildDiagram" ref="eric5.Graphics.UMLDiagramBuilder.html#UMLDiagramBuilder.buildDiagram" /> + <keyword name="UMLDiagramBuilder.getPersistenceData" id="UMLDiagramBuilder.getPersistenceData" ref="eric5.Graphics.UMLDiagramBuilder.html#UMLDiagramBuilder.getPersistenceData" /> + <keyword name="UMLDiagramBuilder.initialize" id="UMLDiagramBuilder.initialize" ref="eric5.Graphics.UMLDiagramBuilder.html#UMLDiagramBuilder.initialize" /> <keyword name="UMLDiagramBuilder.parsePersistenceData" id="UMLDiagramBuilder.parsePersistenceData" ref="eric5.Graphics.UMLDiagramBuilder.html#UMLDiagramBuilder.parsePersistenceData" /> <keyword name="UMLDialog" id="UMLDialog" ref="eric5.Graphics.UMLDialog.html#UMLDialog" /> <keyword name="UMLDialog (Constructor)" id="UMLDialog (Constructor)" ref="eric5.Graphics.UMLDialog.html#UMLDialog.__init__" /> <keyword name="UMLDialog (Module)" id="UMLDialog (Module)" ref="eric5.Graphics.UMLDialog.html" /> <keyword name="UMLDialog.__diagramBuilder" id="UMLDialog.__diagramBuilder" ref="eric5.Graphics.UMLDialog.html#UMLDialog.__diagramBuilder" /> + <keyword name="UMLDialog.__diagramTypeString" id="UMLDialog.__diagramTypeString" ref="eric5.Graphics.UMLDialog.html#UMLDialog.__diagramTypeString" /> + <keyword name="UMLDialog.__initActions" id="UMLDialog.__initActions" ref="eric5.Graphics.UMLDialog.html#UMLDialog.__initActions" /> + <keyword name="UMLDialog.__initToolBars" id="UMLDialog.__initToolBars" ref="eric5.Graphics.UMLDialog.html#UMLDialog.__initToolBars" /> <keyword name="UMLDialog.__relayout" id="UMLDialog.__relayout" ref="eric5.Graphics.UMLDialog.html#UMLDialog.__relayout" /> - <keyword name="UMLDialog.diagramTypeToString" id="UMLDialog.diagramTypeToString" ref="eric5.Graphics.UMLDialog.html#UMLDialog.diagramTypeToString" /> + <keyword name="UMLDialog.__save" id="UMLDialog.__save" ref="eric5.Graphics.UMLDialog.html#UMLDialog.__save" /> + <keyword name="UMLDialog.__saveAs" id="UMLDialog.__saveAs" ref="eric5.Graphics.UMLDialog.html#UMLDialog.__saveAs" /> + <keyword name="UMLDialog.generateDialogFromFile" id="UMLDialog.generateDialogFromFile" ref="eric5.Graphics.UMLDialog.html#UMLDialog.generateDialogFromFile" /> <keyword name="UMLDialog.show" id="UMLDialog.show" ref="eric5.Graphics.UMLDialog.html#UMLDialog.show" /> <keyword name="UMLGraphicsView" id="UMLGraphicsView" ref="eric5.Graphics.UMLGraphicsView.html#UMLGraphicsView" /> <keyword name="UMLGraphicsView (Constructor)" id="UMLGraphicsView (Constructor)" ref="eric5.Graphics.UMLGraphicsView.html#UMLGraphicsView.__init__" /> @@ -10644,12 +10662,8 @@ <keyword name="UMLGraphicsView.__incHeight" id="UMLGraphicsView.__incHeight" ref="eric5.Graphics.UMLGraphicsView.html#UMLGraphicsView.__incHeight" /> <keyword name="UMLGraphicsView.__incWidth" id="UMLGraphicsView.__incWidth" ref="eric5.Graphics.UMLGraphicsView.html#UMLGraphicsView.__incWidth" /> <keyword name="UMLGraphicsView.__initActions" id="UMLGraphicsView.__initActions" ref="eric5.Graphics.UMLGraphicsView.html#UMLGraphicsView.__initActions" /> - <keyword name="UMLGraphicsView.__printDiagram" id="UMLGraphicsView.__printDiagram" ref="eric5.Graphics.UMLGraphicsView.html#UMLGraphicsView.__printDiagram" /> - <keyword name="UMLGraphicsView.__printPreviewDiagram" id="UMLGraphicsView.__printPreviewDiagram" ref="eric5.Graphics.UMLGraphicsView.html#UMLGraphicsView.__printPreviewDiagram" /> + <keyword name="UMLGraphicsView.__printPreviewPrint" id="UMLGraphicsView.__printPreviewPrint" ref="eric5.Graphics.UMLGraphicsView.html#UMLGraphicsView.__printPreviewPrint" /> <keyword name="UMLGraphicsView.__relayout" id="UMLGraphicsView.__relayout" ref="eric5.Graphics.UMLGraphicsView.html#UMLGraphicsView.__relayout" /> - <keyword name="UMLGraphicsView.__save" id="UMLGraphicsView.__save" ref="eric5.Graphics.UMLGraphicsView.html#UMLGraphicsView.__save" /> - <keyword name="UMLGraphicsView.__saveAs" id="UMLGraphicsView.__saveAs" ref="eric5.Graphics.UMLGraphicsView.html#UMLGraphicsView.__saveAs" /> - <keyword name="UMLGraphicsView.__saveImage" id="UMLGraphicsView.__saveImage" ref="eric5.Graphics.UMLGraphicsView.html#UMLGraphicsView.__saveImage" /> <keyword name="UMLGraphicsView.__sceneChanged" id="UMLGraphicsView.__sceneChanged" ref="eric5.Graphics.UMLGraphicsView.html#UMLGraphicsView.__sceneChanged" /> <keyword name="UMLGraphicsView.__setSize" id="UMLGraphicsView.__setSize" ref="eric5.Graphics.UMLGraphicsView.html#UMLGraphicsView.__setSize" /> <keyword name="UMLGraphicsView.__zoom" id="UMLGraphicsView.__zoom" ref="eric5.Graphics.UMLGraphicsView.html#UMLGraphicsView.__zoom" /> @@ -10661,10 +10675,13 @@ <keyword name="UMLGraphicsView.getItemId" id="UMLGraphicsView.getItemId" ref="eric5.Graphics.UMLGraphicsView.html#UMLGraphicsView.getItemId" /> <keyword name="UMLGraphicsView.getPersistenceData" id="UMLGraphicsView.getPersistenceData" ref="eric5.Graphics.UMLGraphicsView.html#UMLGraphicsView.getPersistenceData" /> <keyword name="UMLGraphicsView.initToolBar" id="UMLGraphicsView.initToolBar" ref="eric5.Graphics.UMLGraphicsView.html#UMLGraphicsView.initToolBar" /> + <keyword name="UMLGraphicsView.parsePersistenceData" id="UMLGraphicsView.parsePersistenceData" ref="eric5.Graphics.UMLGraphicsView.html#UMLGraphicsView.parsePersistenceData" /> + <keyword name="UMLGraphicsView.printDiagram" id="UMLGraphicsView.printDiagram" ref="eric5.Graphics.UMLGraphicsView.html#UMLGraphicsView.printDiagram" /> + <keyword name="UMLGraphicsView.printPreviewDiagram" id="UMLGraphicsView.printPreviewDiagram" ref="eric5.Graphics.UMLGraphicsView.html#UMLGraphicsView.printPreviewDiagram" /> + <keyword name="UMLGraphicsView.saveImage" id="UMLGraphicsView.saveImage" ref="eric5.Graphics.UMLGraphicsView.html#UMLGraphicsView.saveImage" /> <keyword name="UMLGraphicsView.selectItem" id="UMLGraphicsView.selectItem" ref="eric5.Graphics.UMLGraphicsView.html#UMLGraphicsView.selectItem" /> <keyword name="UMLGraphicsView.selectItems" id="UMLGraphicsView.selectItems" ref="eric5.Graphics.UMLGraphicsView.html#UMLGraphicsView.selectItems" /> <keyword name="UMLGraphicsView.setDiagramName" id="UMLGraphicsView.setDiagramName" ref="eric5.Graphics.UMLGraphicsView.html#UMLGraphicsView.setDiagramName" /> - <keyword name="UMLGraphicsView.setPersistenceData" id="UMLGraphicsView.setPersistenceData" ref="eric5.Graphics.UMLGraphicsView.html#UMLGraphicsView.setPersistenceData" /> <keyword name="UMLGraphicsView.wheelEvent" id="UMLGraphicsView.wheelEvent" ref="eric5.Graphics.UMLGraphicsView.html#UMLGraphicsView.wheelEvent" /> <keyword name="UMLItem" id="UMLItem" ref="eric5.Graphics.UMLItem.html#UMLItem" /> <keyword name="UMLItem (Constructor)" id="UMLItem (Constructor)" ref="eric5.Graphics.UMLItem.html#UMLItem.__init__" /> @@ -10673,6 +10690,7 @@ <keyword name="UMLItem.adjustAssociations" id="UMLItem.adjustAssociations" ref="eric5.Graphics.UMLItem.html#UMLItem.adjustAssociations" /> <keyword name="UMLItem.buildItemDataString" id="UMLItem.buildItemDataString" ref="eric5.Graphics.UMLItem.html#UMLItem.buildItemDataString" /> <keyword name="UMLItem.getId" id="UMLItem.getId" ref="eric5.Graphics.UMLItem.html#UMLItem.getId" /> + <keyword name="UMLItem.getItemType" id="UMLItem.getItemType" ref="eric5.Graphics.UMLItem.html#UMLItem.getItemType" /> <keyword name="UMLItem.itemChange" id="UMLItem.itemChange" ref="eric5.Graphics.UMLItem.html#UMLItem.itemChange" /> <keyword name="UMLItem.moveBy" id="UMLItem.moveBy" ref="eric5.Graphics.UMLItem.html#UMLItem.moveBy" /> <keyword name="UMLItem.paint" id="UMLItem.paint" ref="eric5.Graphics.UMLItem.html#UMLItem.paint" />
--- a/Documentation/Source/eric5.Graphics.ApplicationDiagramBuilder.html Sun Sep 09 17:46:32 2012 +0200 +++ b/Documentation/Source/eric5.Graphics.ApplicationDiagramBuilder.html Sun Sep 09 19:38:07 2012 +0200 @@ -72,6 +72,12 @@ </tr><tr> <td><a href="#ApplicationDiagramBuilder.buildDiagram">buildDiagram</a></td> <td>Public method to build the packages shapes of the diagram.</td> +</tr><tr> +<td><a href="#ApplicationDiagramBuilder.getPersistenceData">getPersistenceData</a></td> +<td>Public method to get a string for data to be persisted.</td> +</tr><tr> +<td><a href="#ApplicationDiagramBuilder.parsePersistenceData">parsePersistenceData</a></td> +<td>Public method to parse persisted data.</td> </tr> </table> <h3>Static Methods</h3> @@ -143,7 +149,27 @@ <b>buildDiagram</b>(<i></i>) <p> Public method to build the packages shapes of the diagram. -</p> +</p><a NAME="ApplicationDiagramBuilder.getPersistenceData" ID="ApplicationDiagramBuilder.getPersistenceData"></a> +<h4>ApplicationDiagramBuilder.getPersistenceData</h4> +<b>getPersistenceData</b>(<i></i>) +<p> + Public method to get a string for data to be persisted. +</p><dl> +<dt>Returns:</dt> +<dd> +persisted data string (string) +</dd> +</dl><a NAME="ApplicationDiagramBuilder.parsePersistenceData" ID="ApplicationDiagramBuilder.parsePersistenceData"></a> +<h4>ApplicationDiagramBuilder.parsePersistenceData</h4> +<b>parsePersistenceData</b>(<i>data</i>) +<p> + Public method to parse persisted data. +</p><dl> +<dt><i>dat</i></dt> +<dd> +persisted data to be parsed (string) +</dd> +</dl> <div align="right"><a href="#top">Up</a></div> <hr /> </body></html> \ No newline at end of file
--- a/Documentation/Source/eric5.Graphics.ImportsDiagramBuilder.html Sun Sep 09 17:46:32 2012 +0200 +++ b/Documentation/Source/eric5.Graphics.ImportsDiagramBuilder.html Sun Sep 09 19:38:07 2012 +0200 @@ -75,6 +75,15 @@ </tr><tr> <td><a href="#ImportsDiagramBuilder.buildDiagram">buildDiagram</a></td> <td>Public method to build the modules shapes of the diagram.</td> +</tr><tr> +<td><a href="#ImportsDiagramBuilder.getPersistenceData">getPersistenceData</a></td> +<td>Public method to get a string for data to be persisted.</td> +</tr><tr> +<td><a href="#ImportsDiagramBuilder.initialize">initialize</a></td> +<td>Public method to initialize the object.</td> +</tr><tr> +<td><a href="#ImportsDiagramBuilder.parsePersistenceData">parsePersistenceData</a></td> +<td>Public method to parse persisted data.</td> </tr> </table> <h3>Static Methods</h3> @@ -150,7 +159,32 @@ <b>buildDiagram</b>(<i></i>) <p> Public method to build the modules shapes of the diagram. -</p> +</p><a NAME="ImportsDiagramBuilder.getPersistenceData" ID="ImportsDiagramBuilder.getPersistenceData"></a> +<h4>ImportsDiagramBuilder.getPersistenceData</h4> +<b>getPersistenceData</b>(<i></i>) +<p> + Public method to get a string for data to be persisted. +</p><dl> +<dt>Returns:</dt> +<dd> +persisted data string (string) +</dd> +</dl><a NAME="ImportsDiagramBuilder.initialize" ID="ImportsDiagramBuilder.initialize"></a> +<h4>ImportsDiagramBuilder.initialize</h4> +<b>initialize</b>(<i></i>) +<p> + Public method to initialize the object. +</p><a NAME="ImportsDiagramBuilder.parsePersistenceData" ID="ImportsDiagramBuilder.parsePersistenceData"></a> +<h4>ImportsDiagramBuilder.parsePersistenceData</h4> +<b>parsePersistenceData</b>(<i>data</i>) +<p> + Public method to parse persisted data. +</p><dl> +<dt><i>dat</i></dt> +<dd> +persisted data to be parsed (string) +</dd> +</dl> <div align="right"><a href="#top">Up</a></div> <hr /> </body></html> \ No newline at end of file
--- a/Documentation/Source/eric5.Graphics.PackageDiagramBuilder.html Sun Sep 09 17:46:32 2012 +0200 +++ b/Documentation/Source/eric5.Graphics.PackageDiagramBuilder.html Sun Sep 09 19:38:07 2012 +0200 @@ -81,6 +81,15 @@ </tr><tr> <td><a href="#PackageDiagramBuilder.buildDiagram">buildDiagram</a></td> <td>Public method to build the class shapes of the package diagram.</td> +</tr><tr> +<td><a href="#PackageDiagramBuilder.getPersistenceData">getPersistenceData</a></td> +<td>Public method to get a string for data to be persisted.</td> +</tr><tr> +<td><a href="#PackageDiagramBuilder.initialize">initialize</a></td> +<td>Public method to initialize the object.</td> +</tr><tr> +<td><a href="#PackageDiagramBuilder.parsePersistenceData">parsePersistenceData</a></td> +<td>Public method to parse persisted data.</td> </tr> </table> <h3>Static Methods</h3> @@ -199,7 +208,32 @@ Public method to build the class shapes of the package diagram. </p><p> The algorithm is borrowed from Boa Constructor. -</p> +</p><a NAME="PackageDiagramBuilder.getPersistenceData" ID="PackageDiagramBuilder.getPersistenceData"></a> +<h4>PackageDiagramBuilder.getPersistenceData</h4> +<b>getPersistenceData</b>(<i></i>) +<p> + Public method to get a string for data to be persisted. +</p><dl> +<dt>Returns:</dt> +<dd> +persisted data string (string) +</dd> +</dl><a NAME="PackageDiagramBuilder.initialize" ID="PackageDiagramBuilder.initialize"></a> +<h4>PackageDiagramBuilder.initialize</h4> +<b>initialize</b>(<i></i>) +<p> + Public method to initialize the object. +</p><a NAME="PackageDiagramBuilder.parsePersistenceData" ID="PackageDiagramBuilder.parsePersistenceData"></a> +<h4>PackageDiagramBuilder.parsePersistenceData</h4> +<b>parsePersistenceData</b>(<i>data</i>) +<p> + Public method to parse persisted data. +</p><dl> +<dt><i>dat</i></dt> +<dd> +persisted data to be parsed (string) +</dd> +</dl> <div align="right"><a href="#top">Up</a></div> <hr /> </body></html> \ No newline at end of file
--- a/Documentation/Source/eric5.Graphics.UMLClassDiagramBuilder.html Sun Sep 09 17:46:32 2012 +0200 +++ b/Documentation/Source/eric5.Graphics.UMLClassDiagramBuilder.html Sun Sep 09 19:38:07 2012 +0200 @@ -78,6 +78,15 @@ </tr><tr> <td><a href="#UMLClassDiagramBuilder.buildDiagram">buildDiagram</a></td> <td>Public method to build the class shapes of the class diagram.</td> +</tr><tr> +<td><a href="#UMLClassDiagramBuilder.getPersistenceData">getPersistenceData</a></td> +<td>Public method to get a string for data to be persisted.</td> +</tr><tr> +<td><a href="#UMLClassDiagramBuilder.initialize">initialize</a></td> +<td>Public method to initialize the object.</td> +</tr><tr> +<td><a href="#UMLClassDiagramBuilder.parsePersistenceData">parsePersistenceData</a></td> +<td>Public method to parse persisted data.</td> </tr> </table> <h3>Static Methods</h3> @@ -186,7 +195,32 @@ Public method to build the class shapes of the class diagram. </p><p> The algorithm is borrowed from Boa Constructor. -</p> +</p><a NAME="UMLClassDiagramBuilder.getPersistenceData" ID="UMLClassDiagramBuilder.getPersistenceData"></a> +<h4>UMLClassDiagramBuilder.getPersistenceData</h4> +<b>getPersistenceData</b>(<i></i>) +<p> + Public method to get a string for data to be persisted. +</p><dl> +<dt>Returns:</dt> +<dd> +persisted data string (string) +</dd> +</dl><a NAME="UMLClassDiagramBuilder.initialize" ID="UMLClassDiagramBuilder.initialize"></a> +<h4>UMLClassDiagramBuilder.initialize</h4> +<b>initialize</b>(<i></i>) +<p> + Public method to initialize the object. +</p><a NAME="UMLClassDiagramBuilder.parsePersistenceData" ID="UMLClassDiagramBuilder.parsePersistenceData"></a> +<h4>UMLClassDiagramBuilder.parsePersistenceData</h4> +<b>parsePersistenceData</b>(<i>data</i>) +<p> + Public method to parse persisted data. +</p><dl> +<dt><i>dat</i></dt> +<dd> +persisted data to be parsed (string) +</dd> +</dl> <div align="right"><a href="#top">Up</a></div> <hr /> </body></html> \ No newline at end of file
--- a/Documentation/Source/eric5.Graphics.UMLDiagramBuilder.html Sun Sep 09 17:46:32 2012 +0200 +++ b/Documentation/Source/eric5.Graphics.UMLDiagramBuilder.html Sun Sep 09 19:38:07 2012 +0200 @@ -64,6 +64,12 @@ <td><a href="#UMLDiagramBuilder.buildDiagram">buildDiagram</a></td> <td>Public method to build the diagram.</td> </tr><tr> +<td><a href="#UMLDiagramBuilder.getPersistenceData">getPersistenceData</a></td> +<td>Public method to get a string for data to be persisted.</td> +</tr><tr> +<td><a href="#UMLDiagramBuilder.initialize">initialize</a></td> +<td>Public method to initialize the object.</td> +</tr><tr> <td><a href="#UMLDiagramBuilder.parsePersistenceData">parsePersistenceData</a></td> <td>Public method to parse persisted data.</td> </tr> @@ -95,6 +101,21 @@ Public method to build the diagram. </p><p> This class must be implemented in subclasses. +</p><a NAME="UMLDiagramBuilder.getPersistenceData" ID="UMLDiagramBuilder.getPersistenceData"></a> +<h4>UMLDiagramBuilder.getPersistenceData</h4> +<b>getPersistenceData</b>(<i></i>) +<p> + Public method to get a string for data to be persisted. +</p><dl> +<dt>Returns:</dt> +<dd> +persisted data string (string) +</dd> +</dl><a NAME="UMLDiagramBuilder.initialize" ID="UMLDiagramBuilder.initialize"></a> +<h4>UMLDiagramBuilder.initialize</h4> +<b>initialize</b>(<i></i>) +<p> + Public method to initialize the object. </p><a NAME="UMLDiagramBuilder.parsePersistenceData" ID="UMLDiagramBuilder.parsePersistenceData"></a> <h4>UMLDiagramBuilder.parsePersistenceData</h4> <b>parsePersistenceData</b>(<i>data</i>)
--- a/Documentation/Source/eric5.Graphics.UMLDialog.html Sun Sep 09 17:46:32 2012 +0200 +++ b/Documentation/Source/eric5.Graphics.UMLDialog.html Sun Sep 09 19:38:07 2012 +0200 @@ -53,7 +53,10 @@ </table> <h3>Class Methods</h3> <table> -<tr><td>None</td></tr> +<tr> +<td><a href="#UMLDialog.generateDialogFromFile">generateDialogFromFile</a></td> +<td>Class method to generate a dialog reading data from a file.</td> +</tr> </table> <h3>Methods</h3> <table> @@ -64,11 +67,23 @@ <td><a href="#UMLDialog.__diagramBuilder">__diagramBuilder</a></td> <td>Private method to instantiate a diagram builder object.</td> </tr><tr> +<td><a href="#UMLDialog.__diagramTypeString">__diagramTypeString</a></td> +<td>Private method to generate a readable string for the diagram type.</td> +</tr><tr> +<td><a href="#UMLDialog.__initActions">__initActions</a></td> +<td>Private slot to initialize the actions.</td> +</tr><tr> +<td><a href="#UMLDialog.__initToolBars">__initToolBars</a></td> +<td>Private slot to initialize the toolbars.</td> +</tr><tr> <td><a href="#UMLDialog.__relayout">__relayout</a></td> <td>Private method to relayout the diagram.</td> </tr><tr> -<td><a href="#UMLDialog.diagramTypeToString">diagramTypeToString</a></td> -<td>Public method to convert the diagram type to a readable string.</td> +<td><a href="#UMLDialog.__save">__save</a></td> +<td>Private slot to save the diagram with the current name.</td> +</tr><tr> +<td><a href="#UMLDialog.__saveAs">__saveAs</a></td> +<td>Private slot to save the diagram.</td> </tr><tr> <td><a href="#UMLDialog.show">show</a></td> <td>Overriden method to show the dialog.</td> @@ -78,9 +93,27 @@ <table> <tr><td>None</td></tr> </table> -<a NAME="UMLDialog.__init__" ID="UMLDialog.__init__"></a> +<a NAME="UMLDialog.generateDialogFromFile" ID="UMLDialog.generateDialogFromFile"></a> +<h4>UMLDialog.generateDialogFromFile (class method)</h4> +<b>generateDialogFromFile</b>(<i>project, parent=None</i>) +<p> + Class method to generate a dialog reading data from a file. +</p><dl> +<dt><i>project</i></dt> +<dd> +reference to the project object (Project) +</dd><dt><i>parent</i></dt> +<dd> +parent widget of the dialog (QWidget) +</dd> +</dl><dl> +<dt>Returns:</dt> +<dd> +generated dialog (UMLDialog) +</dd> +</dl><a NAME="UMLDialog.__init__" ID="UMLDialog.__init__"></a> <h4>UMLDialog (Constructor)</h4> -<b>UMLDialog</b>(<i>diagramType, project, path, parent=None, **kwargs</i>) +<b>UMLDialog</b>(<i>diagramType, project, path="", parent=None, initBuilder=True, **kwargs</i>) <p> Constructor </p><dl> @@ -96,7 +129,10 @@ file or directory path to build the diagram from (string) </dd><dt><i>parent</i></dt> <dd> -parent widget of the view (QWidget) +parent widget of the dialog (QWidget) +</dd><dt><i>initBuilder=</i></dt> +<dd> +flag indicating to initialize the diagram builder (boolean) </dd><dt><i>kwargs</i></dt> <dd> diagram specific data @@ -121,26 +157,45 @@ <dd> diagram specific data </dd> -</dl><a NAME="UMLDialog.__relayout" ID="UMLDialog.__relayout"></a> +</dl><a NAME="UMLDialog.__diagramTypeString" ID="UMLDialog.__diagramTypeString"></a> +<h4>UMLDialog.__diagramTypeString</h4> +<b>__diagramTypeString</b>(<i></i>) +<p> + Private method to generate a readable string for the diagram type. +</p><dl> +<dt>Returns:</dt> +<dd> +readable type string (string) +</dd> +</dl><a NAME="UMLDialog.__initActions" ID="UMLDialog.__initActions"></a> +<h4>UMLDialog.__initActions</h4> +<b>__initActions</b>(<i></i>) +<p> + Private slot to initialize the actions. +</p><a NAME="UMLDialog.__initToolBars" ID="UMLDialog.__initToolBars"></a> +<h4>UMLDialog.__initToolBars</h4> +<b>__initToolBars</b>(<i></i>) +<p> + Private slot to initialize the toolbars. +</p><a NAME="UMLDialog.__relayout" ID="UMLDialog.__relayout"></a> <h4>UMLDialog.__relayout</h4> <b>__relayout</b>(<i></i>) <p> Private method to relayout the diagram. -</p><a NAME="UMLDialog.diagramTypeToString" ID="UMLDialog.diagramTypeToString"></a> -<h4>UMLDialog.diagramTypeToString</h4> -<b>diagramTypeToString</b>(<i>diagramType</i>) +</p><a NAME="UMLDialog.__save" ID="UMLDialog.__save"></a> +<h4>UMLDialog.__save</h4> +<b>__save</b>(<i></i>) <p> - Public method to convert the diagram type to a readable string. + Private slot to save the diagram with the current name. +</p><a NAME="UMLDialog.__saveAs" ID="UMLDialog.__saveAs"></a> +<h4>UMLDialog.__saveAs</h4> +<b>__saveAs</b>(<i>filename=""</i>) +<p> + Private slot to save the diagram. </p><dl> -<dt><i>diagramType</i></dt> +<dt><i>filename</i></dt> <dd> -type of the diagram - (one of ApplicationDiagram, ClassDiagram, ImportsDiagram, PackageDiagram) -</dd> -</dl><dl> -<dt>Returns:</dt> -<dd> -readable type string (string) +name of the file to write to (string) </dd> </dl><a NAME="UMLDialog.show" ID="UMLDialog.show"></a> <h4>UMLDialog.show</h4>
--- a/Documentation/Source/eric5.Graphics.UMLGraphicsView.html Sun Sep 09 17:46:32 2012 +0200 +++ b/Documentation/Source/eric5.Graphics.UMLGraphicsView.html Sun Sep 09 19:38:07 2012 +0200 @@ -92,24 +92,12 @@ <td><a href="#UMLGraphicsView.__initActions">__initActions</a></td> <td>Private method to initialize the view actions.</td> </tr><tr> -<td><a href="#UMLGraphicsView.__printDiagram">__printDiagram</a></td> -<td>Private slot called to print the diagram.</td> -</tr><tr> -<td><a href="#UMLGraphicsView.__printPreviewDiagram">__printPreviewDiagram</a></td> -<td>Private slot called to show a print preview of the diagram.</td> +<td><a href="#UMLGraphicsView.__printPreviewPrint">__printPreviewPrint</a></td> +<td>Private slot to generate a print preview.</td> </tr><tr> <td><a href="#UMLGraphicsView.__relayout">__relayout</a></td> <td>Private method to handle the re-layout context menu entry.</td> </tr><tr> -<td><a href="#UMLGraphicsView.__save">__save</a></td> -<td>Private slot to save the diagram with the current name.</td> -</tr><tr> -<td><a href="#UMLGraphicsView.__saveAs">__saveAs</a></td> -<td>Private slot to save the diagram.</td> -</tr><tr> -<td><a href="#UMLGraphicsView.__saveImage">__saveImage</a></td> -<td>Private method to handle the save context menu entry.</td> -</tr><tr> <td><a href="#UMLGraphicsView.__sceneChanged">__sceneChanged</a></td> <td>Private slot called when the scene changes.</td> </tr><tr> @@ -138,11 +126,23 @@ <td>Public method to get the ID to be assigned to an item.</td> </tr><tr> <td><a href="#UMLGraphicsView.getPersistenceData">getPersistenceData</a></td> -<td>Public method to get the additional persistence data.</td> +<td>Public method to get a list of data to be persisted.</td> </tr><tr> <td><a href="#UMLGraphicsView.initToolBar">initToolBar</a></td> <td>Public method to populate a toolbar with our actions.</td> </tr><tr> +<td><a href="#UMLGraphicsView.parsePersistenceData">parsePersistenceData</a></td> +<td>Public method to parse persisted data.</td> +</tr><tr> +<td><a href="#UMLGraphicsView.printDiagram">printDiagram</a></td> +<td>Public slot called to print the diagram.</td> +</tr><tr> +<td><a href="#UMLGraphicsView.printPreviewDiagram">printPreviewDiagram</a></td> +<td>Public slot called to show a print preview of the diagram.</td> +</tr><tr> +<td><a href="#UMLGraphicsView.saveImage">saveImage</a></td> +<td>Public method to handle the save context menu entry.</td> +</tr><tr> <td><a href="#UMLGraphicsView.selectItem">selectItem</a></td> <td>Public method to select an item.</td> </tr><tr> @@ -152,9 +152,6 @@ <td><a href="#UMLGraphicsView.setDiagramName">setDiagramName</a></td> <td>Public slot to set the diagram name.</td> </tr><tr> -<td><a href="#UMLGraphicsView.setPersistenceData">setPersistenceData</a></td> -<td>Public method to set additional persistence data.</td> -</tr><tr> <td><a href="#UMLGraphicsView.wheelEvent">wheelEvent</a></td> <td>Protected method to handle wheel events.</td> </tr> @@ -165,16 +162,13 @@ </table> <a NAME="UMLGraphicsView.__init__" ID="UMLGraphicsView.__init__"></a> <h4>UMLGraphicsView (Constructor)</h4> -<b>UMLGraphicsView</b>(<i>scene, diagramType, parent=None</i>) +<b>UMLGraphicsView</b>(<i>scene, parent=None</i>) <p> Constructor </p><dl> <dt><i>scene</i></dt> <dd> reference to the scene object (QGraphicsScene) -</dd><dt><i>diagramType</i></dt> -<dd> -type of the diagram (string) </dd><dt><i>parent</i></dt> <dd> parent widget of the view (QWidget) @@ -224,41 +218,16 @@ <b>__initActions</b>(<i></i>) <p> Private method to initialize the view actions. -</p><a NAME="UMLGraphicsView.__printDiagram" ID="UMLGraphicsView.__printDiagram"></a> -<h4>UMLGraphicsView.__printDiagram</h4> -<b>__printDiagram</b>(<i></i>) +</p><a NAME="UMLGraphicsView.__printPreviewPrint" ID="UMLGraphicsView.__printPreviewPrint"></a> +<h4>UMLGraphicsView.__printPreviewPrint</h4> +<b>__printPreviewPrint</b>(<i>printer</i>) <p> - Private slot called to print the diagram. -</p><a NAME="UMLGraphicsView.__printPreviewDiagram" ID="UMLGraphicsView.__printPreviewDiagram"></a> -<h4>UMLGraphicsView.__printPreviewDiagram</h4> -<b>__printPreviewDiagram</b>(<i></i>) -<p> - Private slot called to show a print preview of the diagram. + Private slot to generate a print preview. </p><a NAME="UMLGraphicsView.__relayout" ID="UMLGraphicsView.__relayout"></a> <h4>UMLGraphicsView.__relayout</h4> <b>__relayout</b>(<i></i>) <p> Private method to handle the re-layout context menu entry. -</p><a NAME="UMLGraphicsView.__save" ID="UMLGraphicsView.__save"></a> -<h4>UMLGraphicsView.__save</h4> -<b>__save</b>(<i></i>) -<p> - Private slot to save the diagram with the current name. -</p><a NAME="UMLGraphicsView.__saveAs" ID="UMLGraphicsView.__saveAs"></a> -<h4>UMLGraphicsView.__saveAs</h4> -<b>__saveAs</b>(<i>filename=""</i>) -<p> - Private slot to save the diagram. -</p><dl> -<dt><i>filename</i></dt> -<dd> -name of the file to write to (string) -</dd> -</dl><a NAME="UMLGraphicsView.__saveImage" ID="UMLGraphicsView.__saveImage"></a> -<h4>UMLGraphicsView.__saveImage</h4> -<b>__saveImage</b>(<i></i>) -<p> - Private method to handle the save context menu entry. </p><a NAME="UMLGraphicsView.__sceneChanged" ID="UMLGraphicsView.__sceneChanged"></a> <h4>UMLGraphicsView.__sceneChanged</h4> <b>__sceneChanged</b>(<i>areas</i>) @@ -363,11 +332,11 @@ <h4>UMLGraphicsView.getPersistenceData</h4> <b>getPersistenceData</b>(<i></i>) <p> - Public method to get the additional persistence data. + Public method to get a list of data to be persisted. </p><dl> <dt>Returns:</dt> <dd> -additional persistence data (string) +list of data to be persisted (list of strings) </dd> </dl><a NAME="UMLGraphicsView.initToolBar" ID="UMLGraphicsView.initToolBar"></a> <h4>UMLGraphicsView.initToolBar</h4> @@ -379,7 +348,32 @@ <dd> the populated toolBar (QToolBar) </dd> -</dl><a NAME="UMLGraphicsView.selectItem" ID="UMLGraphicsView.selectItem"></a> +</dl><a NAME="UMLGraphicsView.parsePersistenceData" ID="UMLGraphicsView.parsePersistenceData"></a> +<h4>UMLGraphicsView.parsePersistenceData</h4> +<b>parsePersistenceData</b>(<i>data</i>) +<p> + Public method to parse persisted data. +</p><dl> +<dt><i>dat</i></dt> +<dd> +persisted data to be parsed (string) +</dd> +</dl><a NAME="UMLGraphicsView.printDiagram" ID="UMLGraphicsView.printDiagram"></a> +<h4>UMLGraphicsView.printDiagram</h4> +<b>printDiagram</b>(<i></i>) +<p> + Public slot called to print the diagram. +</p><a NAME="UMLGraphicsView.printPreviewDiagram" ID="UMLGraphicsView.printPreviewDiagram"></a> +<h4>UMLGraphicsView.printPreviewDiagram</h4> +<b>printPreviewDiagram</b>(<i></i>) +<p> + Public slot called to show a print preview of the diagram. +</p><a NAME="UMLGraphicsView.saveImage" ID="UMLGraphicsView.saveImage"></a> +<h4>UMLGraphicsView.saveImage</h4> +<b>saveImage</b>(<i></i>) +<p> + Public method to handle the save context menu entry. +</p><a NAME="UMLGraphicsView.selectItem" ID="UMLGraphicsView.selectItem"></a> <h4>UMLGraphicsView.selectItem</h4> <b>selectItem</b>(<i>item</i>) <p> @@ -409,16 +403,6 @@ <dd> diagram name (string) </dd> -</dl><a NAME="UMLGraphicsView.setPersistenceData" ID="UMLGraphicsView.setPersistenceData"></a> -<h4>UMLGraphicsView.setPersistenceData</h4> -<b>setPersistenceData</b>(<i>data</i>) -<p> - Public method to set additional persistence data. -</p><dl> -<dt><i>data</i></dt> -<dd> -string of additional data to be made persistent (string) -</dd> </dl><a NAME="UMLGraphicsView.wheelEvent" ID="UMLGraphicsView.wheelEvent"></a> <h4>UMLGraphicsView.wheelEvent</h4> <b>wheelEvent</b>(<i>evt</i>)
--- a/Documentation/Source/eric5.Graphics.UMLItem.html Sun Sep 09 17:46:32 2012 +0200 +++ b/Documentation/Source/eric5.Graphics.UMLItem.html Sun Sep 09 19:38:07 2012 +0200 @@ -49,7 +49,7 @@ QGraphicsRectItem <h3>Class Attributes</h3> <table> -<tr><td>None</td></tr> +<tr><td>ItemType</td></tr> </table> <h3>Class Methods</h3> <table> @@ -73,6 +73,9 @@ <td><a href="#UMLItem.getId">getId</a></td> <td>Public method to get the item ID.</td> </tr><tr> +<td><a href="#UMLItem.getItemType">getItemType</a></td> +<td>Public method to get the item's type.</td> +</tr><tr> <td><a href="#UMLItem.itemChange">itemChange</a></td> <td>Protected method called when an items state changes.</td> </tr><tr> @@ -163,6 +166,16 @@ <dd> ID of the item (integer) </dd> +</dl><a NAME="UMLItem.getItemType" ID="UMLItem.getItemType"></a> +<h4>UMLItem.getItemType</h4> +<b>getItemType</b>(<i></i>) +<p> + Public method to get the item's type. +</p><dl> +<dt>Returns:</dt> +<dd> +item type (string) +</dd> </dl><a NAME="UMLItem.itemChange" ID="UMLItem.itemChange"></a> <h4>UMLItem.itemChange</h4> <b>itemChange</b>(<i>change, value</i>)
--- a/Graphics/ApplicationDiagramBuilder.py Sun Sep 09 17:46:32 2012 +0200 +++ b/Graphics/ApplicationDiagramBuilder.py Sun Sep 09 19:38:07 2012 +0200 @@ -39,14 +39,10 @@ super().__init__(dialog, view, project) self.setObjectName("ApplicationDiagram") - self.project = project self.noModules = noModules - self.umlView.setDiagramName( - self.trUtf8("Application Diagram {0}").format(project.getProjectName())) - - self.umlView.setPersistenceData( - "project={0}".format(self.project.getProjectFile())) + self.umlView.setDiagramName( self.trUtf8("Application Diagram {0}").format( + self.project.getProjectName())) def __buildModulesDict(self): """ @@ -241,3 +237,21 @@ shapes[package][0], shapes[rel][0], Imports) self.scene.addItem(assoc) + + def getPersistenceData(self): + """ + Public method to get a string for data to be persisted. + + @return persisted data string (string) + """ + return "project={0}, no_modules={1}".format( + self.project.getProjectFile(), self.noModules) + + def parsePersistenceData(self, data): + """ + Public method to parse persisted data. + + @param dat persisted data to be parsed (string) + """ + # TODO: implement this + return
--- a/Graphics/ClassItem.py Sun Sep 09 17:46:32 2012 +0200 +++ b/Graphics/ClassItem.py Sun Sep 09 19:38:07 2012 +0200 @@ -229,7 +229,6 @@ @return persistence data (string) """ entries = [ - "item_type={0}".format(ClassItem.ItemType), "is_external={0}".format(self.external), "no_attributes={0}".format(self.noAttrs), "name={0}".format(self.model.getName()),
--- a/Graphics/ImportsDiagramBuilder.py Sun Sep 09 17:46:32 2012 +0200 +++ b/Graphics/ImportsDiagramBuilder.py Sun Sep 09 19:38:07 2012 +0200 @@ -45,6 +45,11 @@ self.showExternalImports = showExternalImports self.packagePath = Utilities.normabspath(package) + + def initialize(self): + """ + Public method to initialize the object. + """ self.package = os.path.splitdrive(self.packagePath)[1].replace(os.sep, '.')[1:] hasInit = True ppath = self.packagePath @@ -53,16 +58,14 @@ hasInit = len(glob.glob(os.path.join(ppath, '__init__.*'))) > 0 self.shortPackage = self.packagePath.replace(ppath, '').replace(os.sep, '.')[1:] - self.umlView.setPersistenceData("package={0}".format(self.packagePath)) - - pname = project.getProjectName() + pname = self.project.getProjectName() if pname: name = self.trUtf8("Imports Diagramm {0}: {1}").format( - pname, project.getRelativePath(self.packagePath)) + pname, self.project.getRelativePath(self.packagePath)) else: name = self.trUtf8("Imports Diagramm: {0}").format(self.packagePath) self.umlView.setDiagramName(name) - + def __buildModulesDict(self): """ Private method to build a dictionary of modules contained in the package. @@ -102,7 +105,7 @@ finally: progress.setValue(tot) return moduleDict - + def buildDiagram(self): """ Public method to build the modules shapes of the diagram. @@ -207,7 +210,7 @@ self.__createAssociations(shapes) self.umlView.autoAdjustSceneSize(limit=True) - + def __addModule(self, name, classes, x, y): """ Private method to add a module to the diagram. @@ -223,7 +226,7 @@ impW = ModuleItem(impM, x, y, scene=self.scene) impW.setId(self.umlView.getItemId()) return impW - + def __createAssociations(self, shapes): """ Private method to generate the associations between the module shapes. @@ -236,3 +239,21 @@ shapes[module][0], shapes[rel][0], Imports) self.scene.addItem(assoc) + + def getPersistenceData(self): + """ + Public method to get a string for data to be persisted. + + @return persisted data string (string) + """ + return "package={0}, show_external={1}".format( + self.packagePath, self.showExternalImports) + + def parsePersistenceData(self, data): + """ + Public method to parse persisted data. + + @param dat persisted data to be parsed (string) + """ + # TODO: implement this + return
--- a/Graphics/ModuleItem.py Sun Sep 09 17:46:32 2012 +0200 +++ b/Graphics/ModuleItem.py Sun Sep 09 19:38:07 2012 +0200 @@ -175,7 +175,6 @@ @return persistence data (string) """ entries = [ - "item_type={0}".format(ModuleItem.ItemType), "name={0}".format(self.model.getName()), ] classes = self.model.getClasses()
--- a/Graphics/PackageDiagramBuilder.py Sun Sep 09 17:46:32 2012 +0200 +++ b/Graphics/PackageDiagramBuilder.py Sun Sep 09 19:38:07 2012 +0200 @@ -42,17 +42,19 @@ self.package = Utilities.normabspath(package) self.noAttrs = noAttrs - - self.umlView.setPersistenceData("package={0}".format(self.package)) - - pname = project.getProjectName() + + def initialize(self): + """ + Public method to initialize the object. + """ + pname = self.project.getProjectName() if pname: name = self.trUtf8("Package Diagram {0}: {1}").format( - pname, project.getRelativePath(self.package)) + pname, self.project.getRelativePath(self.package)) else: name = self.trUtf8("Package Diagram: {0}").format(self.package) self.umlView.setDiagramName(name) - + def __getCurrentShape(self, name): """ Private method to get the named shape. @@ -61,7 +63,7 @@ @return shape (QCanvasItem) """ return self.allClasses.get(name) - + def __buildModulesDict(self): """ Private method to build a dictionary of modules contained in the package. @@ -102,7 +104,7 @@ finally: progress.setValue(tot) return moduleDict - + def buildDiagram(self): """ Public method to build the class shapes of the package diagram. @@ -190,7 +192,7 @@ self.__arrangeClasses(nodes, routes[:]) self.__createAssociations(routes) self.umlView.autoAdjustSceneSize(limit=True) - + def __arrangeClasses(self, nodes, routes, whiteSpaceFactor=1.2): """ Private method to arrange the shapes on the canvas. @@ -260,7 +262,7 @@ rect = cw.sceneBoundingRect() x = x + rect.width() + whiteSpace y = y + currentHeight + verticalWhiteSpace - + def __addLocalClass(self, className, _class, x, y, isRbModule=False): """ Private method to add a class defined in the module. @@ -280,7 +282,7 @@ cw = ClassItem(cl, False, x, y, noAttrs=self.noAttrs, scene=self.scene) cw.setId(self.umlView.getItemId()) self.allClasses[className] = cw - + def __addExternalClass(self, _class, x, y): """ Private method to add a class defined outside the module. @@ -296,7 +298,7 @@ cw = ClassItem(cl, True, x, y, noAttrs=self.noAttrs, scene=self.scene) cw.setId(self.umlView.getItemId()) self.allClasses[_class] = cw - + def __createAssociations(self, routes): """ Private method to generate the associations between the class shapes. @@ -311,3 +313,20 @@ Generalisation, topToBottom=True) self.scene.addItem(assoc) + + def getPersistenceData(self): + """ + Public method to get a string for data to be persisted. + + @return persisted data string (string) + """ + return "package={0}, no_attributes={1}".format(self.package, self.noAttrs) + + def parsePersistenceData(self, data): + """ + Public method to parse persisted data. + + @param dat persisted data to be parsed (string) + """ + # TODO: implement this + return
--- a/Graphics/PackageItem.py Sun Sep 09 17:46:32 2012 +0200 +++ b/Graphics/PackageItem.py Sun Sep 09 19:38:07 2012 +0200 @@ -194,7 +194,6 @@ @return persistence data (string) """ entries = [ - "item_type={0}".format(PackageItem.ItemType), "no_modules={0}".format(self.noModules), "name={0}".format(self.model.getName()), ]
--- a/Graphics/UMLClassDiagramBuilder.py Sun Sep 09 17:46:32 2012 +0200 +++ b/Graphics/UMLClassDiagramBuilder.py Sun Sep 09 19:38:07 2012 +0200 @@ -39,13 +39,15 @@ self.file = file self.noAttrs = noAttrs - - self.umlView.setPersistenceData("file={0}".format(file)) - + + def initialize(self): + """ + Public method to initialize the object. + """ pname = self.project.getProjectName() if pname and self.project.isProjectSource(self.file): name = self.trUtf8("Class Diagram {0}: {1}").format( - pname, project.getRelativePath(self.file)) + pname, self.project.getRelativePath(self.file)) else: name = self.trUtf8("Class Diagram: {0}").format(self.file) self.umlView.setDiagramName(name) @@ -264,3 +266,20 @@ Generalisation, topToBottom=True) self.scene.addItem(assoc) + + def getPersistenceData(self): + """ + Public method to get a string for data to be persisted. + + @return persisted data string (string) + """ + return "file={0}, no_attributes={1}".format(self.file, self.noAttrs) + + def parsePersistenceData(self, data): + """ + Public method to parse persisted data. + + @param dat persisted data to be parsed (string) + """ + # TODO: implement this + return
--- a/Graphics/UMLDiagramBuilder.py Sun Sep 09 17:46:32 2012 +0200 +++ b/Graphics/UMLDiagramBuilder.py Sun Sep 09 19:38:07 2012 +0200 @@ -28,6 +28,12 @@ self.scene = self.umlView.scene() self.project = project + def initialize(self): + """ + Public method to initialize the object. + """ + return + def buildDiagram(self): """ Public method to build the diagram. @@ -37,6 +43,14 @@ raise NotImplementedError( "Method 'buildDiagram' must be implemented in subclasses.") + def getPersistenceData(self): + """ + Public method to get a string for data to be persisted. + + @return persisted data string (string) + """ + return "" + def parsePersistenceData(self, data): """ Public method to parse persisted data.
--- a/Graphics/UMLDialog.py Sun Sep 09 17:46:32 2012 +0200 +++ b/Graphics/UMLDialog.py Sun Sep 09 19:38:07 2012 +0200 @@ -7,9 +7,11 @@ Module implementing a dialog showing UML like diagrams. """ -from PyQt4.QtCore import Qt +from PyQt4.QtCore import Qt, QFileInfo from PyQt4.QtGui import QMainWindow, QAction, QToolBar, QGraphicsScene +from E5Gui import E5MessageBox, E5FileDialog + from .UMLGraphicsView import UMLGraphicsView import UI.Config @@ -25,7 +27,8 @@ ImportsDiagram = 2 ApplicationDiagram = 3 - def __init__(self, diagramType, project, path, parent=None, **kwargs): + def __init__(self, diagramType, project, path="", parent=None, initBuilder=True, + **kwargs): """ Constructor @@ -33,33 +36,86 @@ (one of ApplicationDiagram, ClassDiagram, ImportsDiagram, PackageDiagram) @param project reference to the project object (Project) @param path file or directory path to build the diagram from (string) - @param parent parent widget of the view (QWidget) + @param parent parent widget of the dialog (QWidget) + @keyparam initBuilder flag indicating to initialize the diagram builder (boolean) @param kwargs diagram specific data """ super().__init__(parent) self.setObjectName("UMLDialog") + self.__diagramType = diagramType + self.scene = QGraphicsScene(0.0, 0.0, 800.0, 600.0) - self.umlView = UMLGraphicsView(self.scene, diagramType, parent=self) - self.builder = self.__diagramBuilder(diagramType, project, path, **kwargs) + self.umlView = UMLGraphicsView(self.scene, parent=self) + self.builder = self.__diagramBuilder(self.__diagramType, project, path, **kwargs) + if initBuilder: + self.builder.initialize() + + self.__fileName = "" + self.__initActions() + self.__initToolBars() + + self.setCentralWidget(self.umlView) + + self.umlView.relayout.connect(self.__relayout) + + def __initActions(self): + """ + Private slot to initialize the actions. + """ self.closeAct = \ QAction(UI.PixmapCache.getIcon("close.png"), self.trUtf8("Close"), self) self.closeAct.triggered[()].connect(self.close) + self.saveAct = \ + QAction(UI.PixmapCache.getIcon("fileSave.png"), + self.trUtf8("Save"), self) + self.saveAct.triggered[()].connect(self.__save) + + self.saveAsAct = \ + QAction(UI.PixmapCache.getIcon("fileSaveAs.png"), + self.trUtf8("Save As..."), self) + self.saveAsAct.triggered[()].connect(self.__saveAs) + + self.saveImageAct = \ + QAction(UI.PixmapCache.getIcon("fileSavePixmap.png"), + self.trUtf8("Save as PNG"), self) + self.saveImageAct.triggered[()].connect(self.umlView.saveImage) + + self.printAct = \ + QAction(UI.PixmapCache.getIcon("print.png"), + self.trUtf8("Print"), self) + self.printAct.triggered[()].connect(self.umlView.printDiagram) + + self.printPreviewAct = \ + QAction(UI.PixmapCache.getIcon("printPreview.png"), + self.trUtf8("Print Preview"), self) + self.printPreviewAct.triggered[()].connect(self.umlView.printPreviewDiagram) + + def __initToolBars(self): + """ + Private slot to initialize the toolbars. + """ self.windowToolBar = QToolBar(self.trUtf8("Window"), self) self.windowToolBar.setIconSize(UI.Config.ToolBarIconSize) self.windowToolBar.addAction(self.closeAct) + self.fileToolBar = QToolBar(self.trUtf8("File"), self) + self.fileToolBar.setIconSize(UI.Config.ToolBarIconSize) + self.fileToolBar.addAction(self.saveAct) + self.fileToolBar.addAction(self.saveAsAct) + self.fileToolBar.addAction(self.saveImageAct) + self.fileToolBar.addSeparator() + self.fileToolBar.addAction(self.printPreviewAct) + self.fileToolBar.addAction(self.printAct) + self.umlToolBar = self.umlView.initToolBar() + self.addToolBar(Qt.TopToolBarArea, self.fileToolBar) self.addToolBar(Qt.TopToolBarArea, self.windowToolBar) self.addToolBar(Qt.TopToolBarArea, self.umlToolBar) - - self.setCentralWidget(self.umlView) - - self.umlView.relayout.connect(self.__relayout) def show(self): """ @@ -100,21 +156,91 @@ raise ValueError( self.trUtf8("Illegal diagram type '{0}' given.").format(diagramType)) - def diagramTypeToString(self, diagramType): + def __diagramTypeString(self): """ - Public method to convert the diagram type to a readable string. + Private method to generate a readable string for the diagram type. - @param diagramType type of the diagram - (one of ApplicationDiagram, ClassDiagram, ImportsDiagram, PackageDiagram) @return readable type string (string) """ - if diagramType == UMLDialog.ClassDiagram: + if self.__diagramType == UMLDialog.ClassDiagram: return "Class Diagram" - elif diagramType == UMLDialog.PackageDiagram: + elif self.__diagramType == UMLDialog.PackageDiagram: return "Package Diagram" - elif diagramType == UMLDialog.ImportsDiagram: + elif self.__diagramType == UMLDialog.ImportsDiagram: return "Imports Diagram" - elif diagramType == UMLDialog.ApplicationDiagram: + elif self.__diagramType == UMLDialog.ApplicationDiagram: return "Application Diagram" else: return "Illegal Diagram Type" + + def __save(self): + """ + Private slot to save the diagram with the current name. + """ + self.__saveAs(self.__fileName) + + def __saveAs(self, filename=""): + """ + Private slot to save the diagram. + + @param filename name of the file to write to (string) + """ + if not filename: + fname, selectedFilter = E5FileDialog.getSaveFileNameAndFilter( + self, + self.trUtf8("Save Diagram"), + "", + self.trUtf8("Eric5 Graphics File (*.e5g);;All Files (*)"), + "", + E5FileDialog.Options(E5FileDialog.DontConfirmOverwrite)) + if not fname: + return + ext = QFileInfo(fname).suffix() + if not ext: + ex = selectedFilter.split("(*")[1].split(")")[0] + if ex: + fname += ex + if QFileInfo(fname).exists(): + res = E5MessageBox.yesNo(self, + self.trUtf8("Save Diagram"), + self.trUtf8("<p>The file <b>{0}</b> already exists." + " Overwrite it?</p>").format(fname), + icon=E5MessageBox.Warning) + if not res: + return + filename = fname + + lines = [ + "version: 1.0", + "diagram_type: {0} ({1})".format(self.__diagramType, + self.__diagramTypeString()), + "scene_size: {0};{1}".format(self.scene.width(), self.scene.height()), + ] + persistenceData = self.builder.getPersistenceData() + if persistenceData: + lines.append("builder_data: {0}".format(persistenceData)) + lines.extend(self.umlView.getPersistenceData()) + + try: + f = open(filename, "w", encoding="utf-8") + f.write("\n".join(lines)) + f.close() + except (IOError, OSError) as err: + E5MessageBox.critical(self, + self.trUtf8("Save Diagram"), + self.trUtf8("""<p>The file <b>{0}</b> could not be saved.</p>""" + """<p>Reason: {1}</p>""").format(fname, str(err))) + + self.__fileName = filename + + @classmethod + def generateDialogFromFile(cls, project, parent=None): + """ + Class method to generate a dialog reading data from a file. + + @param project reference to the project object (Project) + @param parent parent widget of the dialog (QWidget) + @return generated dialog (UMLDialog) + """ + # TODO: implement this + return None
--- a/Graphics/UMLGraphicsView.py Sun Sep 09 17:46:32 2012 +0200 +++ b/Graphics/UMLGraphicsView.py Sun Sep 09 19:38:07 2012 +0200 @@ -34,12 +34,11 @@ """ relayout = pyqtSignal() - def __init__(self, scene, diagramType, parent=None): + def __init__(self, scene, parent=None): """ Constructor @param scene reference to the scene object (QGraphicsScene) - @param diagramType type of the diagram (string) @param parent parent widget of the view (QWidget) """ E5GraphicsView.__init__(self, scene, parent) @@ -47,10 +46,6 @@ self.setViewportUpdateMode(QGraphicsView.FullViewportUpdate) self.diagramName = "Unnamed" - self.diagramType = diagramType - - self.persistenceData = "" - self.__fileName = "" self.__itemId = -1 self.border = 10 @@ -74,31 +69,6 @@ self.trUtf8("Delete shapes"), self) self.deleteShapeAct.triggered[()].connect(self.__deleteShape) - self.saveAct = \ - QAction(UI.PixmapCache.getIcon("fileSave.png"), - self.trUtf8("Save"), self) - self.saveAct.triggered[()].connect(self.__save) - - self.saveAsAct = \ - QAction(UI.PixmapCache.getIcon("fileSaveAs.png"), - self.trUtf8("Save As..."), self) - self.saveAsAct.triggered[()].connect(self.__saveAs) - - self.saveImageAct = \ - QAction(UI.PixmapCache.getIcon("fileSavePixmap.png"), - self.trUtf8("Save as PNG"), self) - self.saveImageAct.triggered[()].connect(self.__saveImage) - - self.printAct = \ - QAction(UI.PixmapCache.getIcon("print.png"), - self.trUtf8("Print"), self) - self.printAct.triggered[()].connect(self.__printDiagram) - - self.printPreviewAct = \ - QAction(UI.PixmapCache.getIcon("printPreview.png"), - self.trUtf8("Print Preview"), self) - self.printPreviewAct.triggered[()].connect(self.__printPreviewDiagram) - self.zoomInAct = \ QAction(UI.PixmapCache.getIcon("zoomIn.png"), self.trUtf8("Zoom in"), self) @@ -238,13 +208,6 @@ toolBar.setIconSize(UI.Config.ToolBarIconSize) toolBar.addAction(self.deleteShapeAct) toolBar.addSeparator() - toolBar.addAction(self.saveAct) - toolBar.addAction(self.saveAsAct) - toolBar.addAction(self.saveImageAct) - toolBar.addSeparator() - toolBar.addAction(self.printPreviewAct) - toolBar.addAction(self.printAct) - toolBar.addSeparator() toolBar.addAction(self.zoomInAct) toolBar.addAction(self.zoomOutAct) toolBar.addAction(self.zoomAct) @@ -362,9 +325,9 @@ super().autoAdjustSceneSize(limit=limit) self.__checkSizeActions() - def __saveImage(self): + def saveImage(self): """ - Private method to handle the save context menu entry. + Public method to handle the save context menu entry. """ fname, selectedFilter = E5FileDialog.getSaveFileNameAndFilter( self, @@ -389,7 +352,7 @@ if not res: return - success = self.saveImage(fname, QFileInfo(fname).suffix().upper()) + success = super().saveImage(fname, QFileInfo(fname).suffix().upper()) if not success: E5MessageBox.critical(self, self.trUtf8("Save Diagram"), @@ -404,9 +367,9 @@ self.scene().clear() self.relayout.emit() - def __printDiagram(self): + def printDiagram(self): """ - Private slot called to print the diagram. + Public slot called to print the diagram. """ printer = QPrinter(mode=QPrinter.ScreenResolution) printer.setFullPage(True) @@ -429,11 +392,11 @@ printDialog = QPrintDialog(printer, self) if printDialog.exec_(): - self.printDiagram(printer, self.diagramName) + super().printDiagram(printer, self.diagramName) - def __printPreviewDiagram(self): + def printPreviewDiagram(self): """ - Private slot called to show a print preview of the diagram. + Public slot called to show a print preview of the diagram. """ from PyQt4.QtGui import QPrintPreviewDialog @@ -457,10 +420,15 @@ printer.setPrinterName(Preferences.getPrinter("PrinterName")) preview = QPrintPreviewDialog(printer, self) - preview.paintRequested[QPrinter].connect( - lambda x: self.printDiagram(x, self.diagramName)) + preview.paintRequested[QPrinter].connect(self.__printPreviewPrint) preview.exec_() + def __printPreviewPrint(self, printer): + """ + Private slot to generate a print preview. + """ + super().printDiagram(printer, self.diagramName) + def __zoom(self): """ Private method to handle the zoom context menu action. @@ -588,22 +556,6 @@ self.setZoom(pinch.scaleFactor()) evt.accept() - def setPersistenceData(self, data): - """ - Public method to set additional persistence data. - - @param data string of additional data to be made persistent (string) - """ - self.persistenceData = data - - def getPersistenceData(self): - """ - Public method to get the additional persistence data. - - @return additional persistence data (string) - """ - return self.persistenceData - def getItemId(self): """ Public method to get the ID to be assigned to an item. @@ -631,66 +583,31 @@ return None - def __save(self): - """ - Private slot to save the diagram with the current name. + def getPersistenceData(self): """ - self.__saveAs(self.__fileName) - - def __saveAs(self, filename=""): - """ - Private slot to save the diagram. + Public method to get a list of data to be persisted. - @param filename name of the file to write to (string) + @return list of data to be persisted (list of strings) """ - if not filename: - fname, selectedFilter = E5FileDialog.getSaveFileNameAndFilter( - self, - self.trUtf8("Save Diagram"), - "", - self.trUtf8("Eric5 Graphics File (*.e5g);;All Files (*)"), - "", - E5FileDialog.Options(E5FileDialog.DontConfirmOverwrite)) - if not fname: - return - ext = QFileInfo(fname).suffix() - if not ext: - ex = selectedFilter.split("(*")[1].split(")")[0] - if ex: - fname += ex - if QFileInfo(fname).exists(): - res = E5MessageBox.yesNo(self, - self.trUtf8("Save Diagram"), - self.trUtf8("<p>The file <b>{0}</b> already exists." - " Overwrite it?</p>").format(fname), - icon=E5MessageBox.Warning) - if not res: - return - filename = fname + lines = [ + "diagram_name: {0}".format(self.diagramName), + ] - lines = [ - "version: 1.0", - "diagram_type: {0} ({1})".format(self.diagramType, - self.parent().diagramTypeToString(self.diagramType)), - "diagram_name: {0}".format(self.diagramName), - "scene_size: {0};{1}".format(self.scene().width(), self.scene().height()), - ] - if self.persistenceData: - lines.append("diagram_data: {0}".format(self.persistenceData)) for item in self.filteredItems(self.scene().items(), UMLItem): - lines.append("item: id={0}, x={1}, y={2}{3}".format( - item.getId(), item.x(), item.y(), item.buildItemDataString())) + lines.append("item: id={0}, x={1}, y={2}, item_type={3}{4}".format( + item.getId(), item.x(), item.y(), item.getItemType(), + item.buildItemDataString())) + for item in self.filteredItems(self.scene().items(), AssociationItem): lines.append("association: {0}".format(item.buildAssociationItemDataString())) - try: - f = open(filename, "w", encoding="utf-8") - f.write("\n".join(lines)) - f.close() - except (IOError, OSError) as err: - E5MessageBox.critical(self, - self.trUtf8("Save Diagram"), - self.trUtf8("""<p>The file <b>{0}</b> could not be saved.</p>""" - """<p>Reason: {1}</p>""").format(fname, str(err))) + return lines + + def parsePersistenceData(self, data): + """ + Public method to parse persisted data. - self.__fileName = filename + @param dat persisted data to be parsed (string) + """ + # TODO: implement this + return
--- a/Graphics/UMLItem.py Sun Sep 09 17:46:32 2012 +0200 +++ b/Graphics/UMLItem.py Sun Sep 09 19:38:07 2012 +0200 @@ -17,6 +17,8 @@ """ Class implementing the UMLItem base class. """ + ItemType = "UMLItem" + def __init__(self, x=0, y=0, rounded=False, parent=None): """ Constructor @@ -162,6 +164,14 @@ """ return self.__id + def getItemType(self): + """ + Public method to get the item's type. + + @return item type (string) + """ + return self.ItemType + def buildItemDataString(self): """ Public method to build a string to persist the specific item data.