Пример #1
0
    def __itemClicked(self, index):
        typ = index.data(TYPE_ROLE)
        if typ == FOLDER_TYPE:
            uid = index.data(ID_ROLE)
            EventManager.FolderOfInterest.emit(uid)

        elif typ == JOB_TYPE:
            copyToClipboard(index.data(OBJECT_ROLE).name)
Пример #2
0
    def __init__(self, attrs, parent=None):
        QtGui.QWidget.__init__(self, parent)
        layout = QtGui.QVBoxLayout(self)
        layout.setContentsMargins(4,0,4,4)

        self.attrs = attrs
        self.__jobs = {}

        self.__tree = tree = QtGui.QTreeWidget(self)
        tree.setHeaderLabels(self.HEADER)
        tree.setColumnCount(len(self.HEADER))
        tree.setUniformRowHeights(True)
        tree.viewport().setFocusPolicy(QtCore.Qt.NoFocus)
        tree.header().setStretchLastSection(True)
        tree.setSelectionMode(tree.ExtendedSelection)
        tree.setAlternatingRowColors(True)
        
        for i, v in enumerate(self.WIDTH):
            tree.setColumnWidth(i, v) 

        layout.addWidget(tree)

        # connections
        tree.itemClicked.connect(lambda item: copyToClipboard(item.text(0)))
        tree.itemDoubleClicked.connect(self.__itemDoubleClicked)
        tree.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
        tree.customContextMenuRequested.connect(self.__showContextMenu)
Пример #3
0
    def __init__(self, attrs, parent=None):
        QtGui.QWidget.__init__(self, parent)
        layout = QtGui.QVBoxLayout(self)
        layout.setContentsMargins(4, 0, 4, 4)

        self.attrs = attrs
        self.__jobs = {}

        self.__tree = tree = QtGui.QTreeWidget(self)
        tree.setHeaderLabels(self.HEADER)
        tree.setColumnCount(len(self.HEADER))
        tree.setUniformRowHeights(True)
        tree.viewport().setFocusPolicy(QtCore.Qt.NoFocus)
        tree.header().setStretchLastSection(True)
        tree.setSelectionMode(tree.ExtendedSelection)
        tree.setAlternatingRowColors(True)

        for i, v in enumerate(self.WIDTH):
            tree.setColumnWidth(i, v)

        layout.addWidget(tree)

        # connections
        tree.itemClicked.connect(lambda item: copyToClipboard(item.text(0)))
        tree.itemDoubleClicked.connect(self.__itemDoubleClicked)
        tree.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
        tree.customContextMenuRequested.connect(self.__showContextMenu)
Пример #4
0
 def __itemClicked(self, index):
     copyToClipboard(index.data(self.__model.ObjectRole).name)
Пример #5
0
 def __copyValueToClipboard(self, item):
     if item.childCount() == 0:
         value = item.text(1)
     else:
         value = item.text(0)
     copyToClipboard(value)