def __init__ (self, name, graph_view, scene, parent=None): QFrame.__init__(self, parent) self.graph_view = graph_view self.graph_view.setView0 (self) self.scene = scene self.setFrameStyle (QFrame.Sunken | QFrame.StyledPanel) self.font = QFont() self.font.setPointSize(10) self.graphicsView = CustomGraphicsView () self.graphicsView.setRenderHint (QPainter.Antialiasing, True) self.graphicsView.setDragMode (QGraphicsView.RubberBandDrag) self.graphicsView.setViewportUpdateMode (QGraphicsView.SmartViewportUpdate) #self.graphicsView.setMouseTracking(True) # toolbox definition + group page definition sizePolicy = QSizePolicy (QSizePolicy.Fixed, QSizePolicy.Expanding) self.setObjectName ('Form') self.resize (900, 1000) self._toolBox = QToolBox (self) self._toolBox.setGeometry (QRect (0, 0, 131, 301)) self._toolBox.setFont (self.font) self._toolBox.setObjectName ('_toolBox') self._toolBox.setCursor (Qt.PointingHandCursor) self.groupCluster = QWidget () self.groupCluster.setGeometry (QRect(0, 0, 91, 241)) self.groupCluster.setObjectName ('groupCluster') self.groupLineEdit = QLineEdit (self.groupCluster) self.groupLineEdit.setGeometry (QRect (2, 20, 60, 16)) self.groupLineEdit.setObjectName ('groupLineEdit') self.label = QLabel (self.groupCluster) self.label.setGeometry (QRect (4, 6, 62, 16)) self.label.setFont (self.font) self.label.setObjectName ('label') self.label_2 = QLabel (self.groupCluster) self.label_2.setGeometry (QRect (4, 40, 62, 16)) self.label_2.setFont (self.font) self.label_2.setObjectName ('label_2') self.groupLineEdit_2 = QLineEdit (self.groupCluster) self.groupLineEdit_2.setGeometry (QRect(2, 54, 60, 16)) self.groupLineEdit_2.setObjectName ('groupLineEdit_2') self.pushButton = QPushButton (self.groupCluster) self.pushButton.setGeometry (QRect (2, 90, 60, 16)) self.pushButton.setFont (self.font) self.pushButton.setObjectName ('pushButton') self._toolBox.addItem (self.groupCluster, '') self._toolBox.setItemText (self._toolBox.indexOf (self.groupCluster), QApplication.translate ("Form", "Group", None, QApplication.UnicodeUTF8)) self.setWindowTitle (QApplication.translate ("Form", "Form", None, QApplication.UnicodeUTF8)) self.label.setText (QApplication.translate ("Form", "name group", None, QApplication.UnicodeUTF8)) self.label_2.setText (QApplication.translate ("Form", "group id", None, QApplication.UnicodeUTF8)) self.pushButton.setText (QApplication.translate ("Form", "add cluster", None, QApplication.UnicodeUTF8)) self._toolBox.setSizePolicy (sizePolicy) self._toolBox.setEnabled (False) # adding the first cluster to the toolbox - a cluster is always present! self._cluster_page_list = [] self.connect (self.pushButton, SIGNAL ("clicked()"), self.addCluster) # connect the 'add-cluster' button to the method that taps into the model for cluster addition. self.connect (self.graph_view.getComm(), SIGNAL ("addCluster_MSignal(int)"), self.addClusterPage) self.connect (self.graph_view.getComm(), SIGNAL ("deleteCluster_MSignal(int)"), self.removeClusterPage) self.connect (self.graph_view.getComm(), SIGNAL ("updateClusterName_MSignal(int, QString)"), self.updateClusterViewName) self.addCluster () # add the first cluster. At least one cluster needs to be always present. self.disableAllClusterPagesDeleteButton() # since there's only one cluster page, the delete button is disabled. #size = self.style ().pixelMetric (QStyle.PM_ToolBarIconSize) iconSize = QSize (16, 16) #QSize (size, size) zoomInIcon = QToolButton () zoomInIcon.setCursor (Qt.PointingHandCursor) zoomInIcon.setAutoRepeat (True) zoomInIcon.setAutoRepeatInterval (33) zoomInIcon.setAutoRepeatDelay (0) zoomInIcon.setIconSize (iconSize) zoomOutIcon = QToolButton () zoomOutIcon.setCursor (Qt.PointingHandCursor) zoomOutIcon.setAutoRepeat (True) zoomOutIcon.setAutoRepeatInterval (33) zoomOutIcon.setAutoRepeatDelay (0) zoomOutIcon.setIconSize (iconSize) self.zoomSlider = QSlider () self.zoomSlider.setCursor (Qt.PointingHandCursor) self.zoomSlider.setMinimum (200) self.zoomSlider.setMaximum (280) self.zoomSlider.setValue (240) self.zoomSlider.setTickPosition (QSlider.TicksRight) # Zoom slider layout zoomSliderLayout = QVBoxLayout () zoomSliderLayout.addWidget (zoomInIcon) zoomSliderLayout.addWidget (self.zoomSlider) zoomSliderLayout.addWidget (zoomOutIcon) self.printOutBtn = QPushButton() self.printOutBtn.setText ("print") self.printOutBtn.setFont (self.font) self.printOutBtn.setEnabled (False) self.newJADESceneBtn = QPushButton() self.newJADESceneBtn.setText ("new") self.newJADESceneBtn.setFont (self.font) self.newJADESceneBtn.setEnabled (False) self.loadNodesDescrpBtn = QPushButton() self.loadNodesDescrpBtn.setText ("load Nodes Description") self.loadNodesDescrpBtn.setFont (self.font) self.loadNodesDescrpBtn.setEnabled (True) self.graphLoadBtn = QPushButton() self.graphLoadBtn.setText ("load") self.graphLoadBtn.setFont (self.font) self.graphLoadBtn.setEnabled (False) self.graphSaveBtn = QPushButton() self.graphSaveBtn.setText ("save") self.graphSaveBtn.setFont (self.font) self.graphSaveBtn.setEnabled (False) self.resetButton = QToolButton () self.resetButton.setText ("r") self.resetButton.setFont (self.font) self.resetButton.setEnabled (False) self.message_bar = QLineEdit () self.message_bar.setGeometry (QRect (0, 0, 190, 12)) self.message_bar.setObjectName ('message_bar') self.message_bar.setText ('Node description file, please.') self.message_bar.setFont (self.font) self.message_bar.setEnabled (True) self.message_bar.setReadOnly (True) self.spacer = QSpacerItem (30, 20, QSizePolicy.Fixed, QSizePolicy.Fixed ); # Label layout labelLayout = QHBoxLayout () self.label = QLabel (name) self.label.setFont (self.font) labelLayout.addWidget (self.loadNodesDescrpBtn) labelLayout.addWidget (self.newJADESceneBtn) labelLayout.addWidget (self.graphLoadBtn) labelLayout.addWidget (self.graphSaveBtn) labelLayout.addWidget (self.printOutBtn) labelLayout.addItem (self.spacer) labelLayout.addWidget (self.message_bar) #labelLayout.addWidget (self.label) labelLayout.addStretch () # top layout topLayout = QGridLayout () topLayout.setHorizontalSpacing (0) topLayout.setVerticalSpacing (0) topLayout.addLayout (labelLayout, 0, 1) topLayout.addWidget (self._toolBox, 1, 0) topLayout.addWidget (self.resetButton, 0, 2) topLayout.addWidget (self.graphicsView, 1, 1) topLayout.addLayout (zoomSliderLayout, 1, 2) self.setLayout (topLayout) self.connect (self.resetButton, SIGNAL ("clicked()"), self.resetView) self.connect (self.zoomSlider, SIGNAL ("valueChanged(int)"), self.setupMatrix) self.connect (self.graphicsView.verticalScrollBar (), SIGNAL ("valueChanged(int)"), self.setResetButtonEnabled) self.connect (self.graphicsView.horizontalScrollBar (), SIGNAL ("valueChanged(int)"), self.setResetButtonEnabled) self.connect (zoomInIcon, SIGNAL ("clicked()"), self.zoomIn) self.connect (zoomOutIcon, SIGNAL ("clicked()"), self.zoomOut) self.setupMatrix () self.printer = QPrinter (QPrinter.HighResolution) self.prev_selection_list = [] self.isClusterRemovalOverridden = False