예제 #1
0
    def _init_toolbar(self):
        self.basedir = os.path.join(matplotlib.rcParams[ 'datapath' ],'images')

        for text, tooltip_text, image_file, callback in self.toolitems:
            if text is None:
                self.addSeparator()
            else:
                a = self.addAction(self._icon(image_file + '.png'),
                                         text, getattr(self, callback))
                self._actions[callback] = a
                if callback in ['zoom', 'pan']:
                    a.setCheckable(True)
                if tooltip_text is not None:
                    a.setToolTip(tooltip_text)

        # Add the x,y location widget at the right side of the toolbar
        # The stretch factor is 1 which means any resizing of the toolbar
        # will resize this label instead of the buttons.
        if self.coordinates:
            self.locLabel = QtWidgets.QLabel( "", self )
            self.locLabel.setAlignment(
                    QtCore.Qt.AlignRight | QtCore.Qt.AlignTop )
            self.locLabel.setSizePolicy(
                QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding,
                                  QtWidgets.QSizePolicy.Ignored))
            labelAction = self.addWidget(self.locLabel)
            labelAction.setVisible(True)
예제 #2
0
    def generateNewNodeListWindow(self):
        # the New Node window
        self._list_win = QtWidgets.QWidget()
        self._list_win.setFixedWidth(500)
        self._new_node_list = QtWidgets.QListWidget(self._list_win)

        self._create_button = QtWidgets.QPushButton("Create Node", self._list_win)
        self._create_button.setDisabled(True)
        self._create_button.clicked.connect(self._createNewNode)
        button_layout = QtWidgets.QHBoxLayout()
        button_layout.addStretch(1)
        button_layout.addWidget(self._create_button)

        self._new_node_list.itemDoubleClicked.connect(self._listItemDoubleClicked)
        self._new_node_list.itemClicked.connect(self._listItemClicked)

        self._list_label = QtWidgets.QLabel("GPI Libraries", self._list_win)

        node_name_layout = QtWidgets.QHBoxLayout()
        new_node_name_label = QtWidgets.QLabel("Name:", self._list_win)
        self._new_node_name_field = QtWidgets.QLineEdit(self._list_win)
        self._new_node_name_field.setPlaceholderText("NewNodeName_GPI.py")
        self._new_node_name_field.textChanged.connect(self._newNodeNameEdited)
        node_name_layout.addWidget(new_node_name_label)
        node_name_layout.addWidget(self._new_node_name_field)

        new_node_path_label = QtWidgets.QLabel("Path:", self._list_win)
        self._new_node_path = ''
        self._new_node_path_field = QtWidgets.QLabel(NOPATH_MESSAGE, self._list_win)
        self._new_node_path_field.setSizePolicy(QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed))
        path_layout = QtWidgets.QHBoxLayout()
        path_layout.addWidget(new_node_path_label)
        path_layout.addWidget(self._new_node_path_field)

        list_layout = QtWidgets.QVBoxLayout()
        list_layout.addWidget(self._list_label)
        list_layout.addWidget(self._new_node_list)
        list_layout.addLayout(node_name_layout)
        list_layout.addLayout(path_layout)
        list_layout.addLayout(button_layout)
        self._list_win.setLayout(list_layout)