Beispiel #1
0
    def __init__(self, project, parent=None):
        """
        Initialize the project block.
        :type project: str
        :type parent: QtWidgets.QWidget
        """
        super().__init__(parent)

        self.nameLabel = QtWidgets.QLabel(os.path.basename(project), self)
        self.nameLabel.setContentsMargins(20, 0, 20, 0)
        self.nameLabel.setProperty('class', 'name')
        self.nameLabel.setFont(Font('Roboto', 12, bold=True))
        self.pathLabel = QtWidgets.QLabel(compressPath(shortPath(project), 34),
                                          self)
        self.pathLabel.setContentsMargins(20, 0, 20, 0)
        self.pathLabel.setProperty('class', 'path')
        self.pathLabel.setFont(Font('Roboto', 12))
        self.deleteBtn = PHCQPushButton(self)
        self.deleteBtn.setIcon(QtGui.QIcon(':/icons/24/ic_delete_black'))
        self.deleteBtn.setVisible(
            not isSubPath(expandPath('@examples/'), project))
        connect(self.deleteBtn.clicked, self.onDeleteButtonClicked)
        self.leftWidget = QtWidgets.QWidget(self)
        self.leftWidget.setContentsMargins(0, 0, 0, 0)
        self.leftLayout = QtWidgets.QVBoxLayout(self.leftWidget)
        self.leftLayout.setContentsMargins(0, 0, 0, 0)
        self.leftLayout.setSpacing(0)
        self.leftLayout.addWidget(self.nameLabel)
        self.leftLayout.addWidget(self.pathLabel)
        self.rightWidget = QtWidgets.QWidget(self)
        self.rightWidget.setContentsMargins(0, 0, 10, 0)
        self.rightLayout = QtWidgets.QVBoxLayout(self.rightWidget)
        self.rightLayout.setContentsMargins(0, 0, 0, 0)
        self.rightLayout.setSpacing(0)
        self.rightLayout.addWidget(self.deleteBtn)
        self.mainLayout = QtWidgets.QHBoxLayout(self)
        self.mainLayout.setContentsMargins(0, 0, 0, 0)
        self.mainLayout.addWidget(self.leftWidget)
        self.mainLayout.addWidget(self.rightWidget, 1, QtCore.Qt.AlignRight)
        self.setContentsMargins(0, 0, 0, 0)
        self.setFixedHeight(40)
        self.path = project
Beispiel #2
0
    def __init__(self, project, parent=None):
        """
        Initialize the project block.
        :type project: str
        :type parent: QtWidgets.QWidget
        """
        super().__init__(parent)

        self.nameLabel = QtWidgets.QLabel(os.path.basename(project), self)
        self.nameLabel.setContentsMargins(20, 0, 20, 0)
        self.nameLabel.setProperty('class', 'name')
        self.nameLabel.setFont(Font('Roboto', 12, bold=True))
        self.pathLabel = QtWidgets.QLabel(compressPath(shortPath(project), 34), self)
        self.pathLabel.setContentsMargins(20, 0, 20, 0)
        self.pathLabel.setProperty('class', 'path')
        self.pathLabel.setFont(Font('Roboto', 12))
        self.deleteBtn = PHCQPushButton(self)
        self.deleteBtn.setIcon(QtGui.QIcon(':/icons/24/ic_delete_black'))
        self.deleteBtn.setVisible(not isSubPath(expandPath('@examples/'), project))
        connect(self.deleteBtn.clicked, self.onDeleteButtonClicked)
        self.leftWidget = QtWidgets.QWidget(self)
        self.leftWidget.setContentsMargins(0, 0, 0, 0)
        self.leftLayout = QtWidgets.QVBoxLayout(self.leftWidget)
        self.leftLayout.setContentsMargins(0, 0, 0, 0)
        self.leftLayout.setSpacing(0)
        self.leftLayout.addWidget(self.nameLabel)
        self.leftLayout.addWidget(self.pathLabel)
        self.rightWidget = QtWidgets.QWidget(self)
        self.rightWidget.setContentsMargins(0, 0, 10, 0)
        self.rightLayout = QtWidgets.QVBoxLayout(self.rightWidget)
        self.rightLayout.setContentsMargins(0, 0, 0, 0)
        self.rightLayout.setSpacing(0)
        self.rightLayout.addWidget(self.deleteBtn)
        self.mainLayout = QtWidgets.QHBoxLayout(self)
        self.mainLayout.setContentsMargins(0, 0, 0, 0)
        self.mainLayout.addWidget(self.leftWidget)
        self.mainLayout.addWidget(self.rightWidget, 1, QtCore.Qt.AlignRight)
        self.setContentsMargins(0, 0, 0, 0)
        self.setFixedHeight(40)
        self.path = project
Beispiel #3
0
 def isBuiltIn(self):
     """
     Returns True if this plugin is a built-in one, False otherwise.
     :rtype: bool
     """
     return isSubPath('@plugins/', inspect.getfile(self.__class__))
Beispiel #4
0
 def isBuiltIn(self):
     """
     Returns True if this plugin is a built-in one, False otherwise.
     :rtype: bool
     """
     return isSubPath('@plugins/', inspect.getfile(self.__class__))