Пример #1
0
 def addWorkspace(self):
     newDir = self.dirLabel.text()
     if newDir == '':
         QMessageBox.warning(self, 'Invalid Workspace', 'This is not a catkin workspace or specified path was not found')
     elif self.isValidWorkspace(newDir):
         workspaces = readWorkspaces()
         workspaces.append(newDir)
         writeWorkspaces(workspaces)
         self.drawWorkspaces(workspaces)
     else:
         QMessageBox.warning(self, 'Invalid Workspace', 'The catkin workspace dir:' + newDir +
                             ' is not a valid. Please make sure that the directory has src, devel and build directories.')
Пример #2
0
    def __init__(self):
        super(QWidget, self).__init__()

        layout = QVBoxLayout()
        self.setLayout(layout)

        scrollArea = QScrollArea()
        scrollArea.setMinimumHeight(200)
        scrollArea.setWidgetResizable(True)
        scrollArea.setStyleSheet('QScrollArea {border: 0;}')
        layout.addWidget(scrollArea)

        workspaceBox = QGroupBox('Catkin Workspaces')
        scrollArea.setWidget(workspaceBox)
        self.workspaceLayout = QVBoxLayout()
        self.workspaceLayout.setDirection(QBoxLayout.TopToBottom)
        self.workspaceLayout.setAlignment(Qt.AlignTop)
        workspaceBox.setLayout(self.workspaceLayout)

        buildRowLayout = QHBoxLayout()
        self.workspaceLayout.addLayout(buildRowLayout)
        chooseDirButton = QPushButton('Choose File')
        chooseDirButton.setMaximumWidth(100)
        chooseDirButton.setObjectName('choose')
        chooseDirButton.clicked.connect(self.chooseDir)
        buildRowLayout.addWidget(chooseDirButton)
        self.dirLabel = QLabel()
        self.dirLabel.setMinimumWidth(400)
        buildRowLayout.addWidget(self.dirLabel)

        addButton = QPushButton('Add')
        addButton.setMaximumWidth(100)
        addButton.setObjectName('build')
        addButton.clicked.connect(self.addWorkspace)
        buildRowLayout.addWidget(addButton)

        # load current workspaces
        self.workspaceUIs = []
        self.drawWorkspaces(readWorkspaces())
Пример #3
0
 def removeWorkspace(self):
     dir = self.sender().objectName()
     workspaces = readWorkspaces()
     workspaces.remove(dir)
     writeWorkspaces(workspaces)
     self.drawWorkspaces(workspaces)