Esempio n. 1
0
    def _initFileExplorer(self, base_dir=None):
        """
        Create the File explorer object based on the QFileSystemModel widget.
        """

        model = QtWidgets.QFileSystemModel()
        rootp = ''
        if base_dir:
            rootp = base_dir
        elif self.case_dir:
            rootp = self.case_dir

        model.setRootPath(rootp)

        tree = QtWidgets.QTreeView(None)

        tree.setModel(model)
        tree.setSortingEnabled(True)
        tree.setWindowTitle('Explorer')
        tree.setRootIndex(model.index(rootp))

        # Hide unnecessary columns
        nc = tree.header().count()
        for i in range(1, nc):
            tree.hideColumn(i)

        # Right click menu
        tree.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
        tree.customContextMenuRequested.connect(self.explorerContextMenu)

        # Double click
        tree.doubleClicked.connect(self._explorerDoubleClick)

        return tree
Esempio n. 2
0
    def __init__(self, parent, wlist):
        super(FormWidget, self).__init__(parent)

        self.layout = QtWidgets.QHBoxLayout(self)

        for w in wlist:
            if w == wlist[0]:
                w.setMaximumWidth(400)
            self.layout.addWidget(w)

        self.setLayout(self.layout)
Esempio n. 3
0
    def __init__(self, parent, wlist):
        super(FormWidget, self).__init__(parent)

        self.layout = QtWidgets.QGridLayout(self)

        n = len(wlist) - 1
        for i, w in enumerate(wlist):
            if i < n:
                w.setMaximumWidth(400)
                self.layout.addWidget(w, i, 0)
            else:
                self.layout.addWidget(w, 0, 1, 2, 1)

        self.setLayout(self.layout)
Esempio n. 4
0
    def _initFileExplorer(self):
        """
        Create the File explorer object based on the QFileSystemModel widget.
        """

        if self.dir_type == 'SHARE':
            name = 'Reference'
        elif self.dir_type in ('SRC', 'DATA'):
            name = 'User files'
        else:
            name = 'Name'

        model = FileSystemModel(name)
        if self.root_dir:
            model.setRootPath(self.root_dir)

        tree = QtWidgets.QTreeView(None)

        tree.setModel(model)
        tree.setSortingEnabled(True)
        tree.setWindowTitle('Explorer')
        if self.root_dir:
            tree.setRootIndex(model.index(self.root_dir))

        # Hide unnecessary columns
        nc = tree.header().count()

        for i in range(1, nc):
            tree.hideColumn(i)

        # Right click menu
        tree.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
        tree.customContextMenuRequested.connect(self.explorerContextMenu)

        # Double click
        tree.doubleClicked.connect(self._explorerDoubleClick)

        return tree