~ubuntu-branches/ubuntu/karmic/eric/karmic

« back to all changes in this revision

Viewing changes to eric/Graphics/UMLDialog.py

  • Committer: Bazaar Package Importer
  • Author(s): Scott Kitterman
  • Date: 2008-01-28 18:02:25 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20080128180225-6nrox6yrworh2c4v
Tags: 4.0.4-1ubuntu1
* Add python-qt3 to build-depends becuase that's where Ubuntu puts 
  pyqtconfig
* Change maintainer to MOTU

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- coding: utf-8 -*-
 
2
 
 
3
# Copyright (c) 2007 Detlev Offenbach <detlev@die-offenbachs.de>
 
4
#
 
5
 
 
6
"""
 
7
Module implementing a dialog showing UML like diagrams.
 
8
"""
 
9
 
 
10
from PyQt4.QtCore import *
 
11
from PyQt4.QtGui import *
 
12
 
 
13
from UMLGraphicsView import UMLGraphicsView
 
14
 
 
15
import UI.Config
 
16
import UI.PixmapCache
 
17
 
 
18
class UMLDialog(QMainWindow):
 
19
    """
 
20
    Class implementing a dialog showing UML like diagrams.
 
21
    """
 
22
    def __init__(self, diagramName = "Unnamed", parent = None, name = None):
 
23
        """
 
24
        Constructor
 
25
        
 
26
        @param parent parent widget of the view (QWidget)
 
27
        @param name name of the view widget (QString or string)
 
28
        """
 
29
        QMainWindow.__init__(self, parent)
 
30
        
 
31
        if not name:
 
32
            self.setObjectName("UMLDialog")
 
33
        else:
 
34
            self.setObjectName(name)
 
35
        
 
36
        self.scene = QGraphicsScene(0.0, 0.0, 800.0, 600.0)
 
37
        self.umlView = UMLGraphicsView(self.scene, diagramName, self, "umlView")
 
38
        
 
39
        self.closeAct = \
 
40
            QAction(UI.PixmapCache.getIcon("close.png"),
 
41
                    self.trUtf8("Close"), self)
 
42
        self.connect(self.closeAct, SIGNAL("triggered()"), self.close)
 
43
        
 
44
        self.windowToolBar = QToolBar(self.trUtf8("Window"), self)
 
45
        self.windowToolBar.setIconSize(UI.Config.ToolBarIconSize)
 
46
        self.windowToolBar.addAction(self.closeAct)
 
47
        
 
48
        self.umlToolBar = self.umlView.initToolBar()
 
49
        
 
50
        self.addToolBar(Qt.TopToolBarArea, self.windowToolBar)
 
51
        self.addToolBar(Qt.TopToolBarArea, self.umlToolBar)
 
52
        
 
53
        self.setCentralWidget(self.umlView)