コード例 #1
0
    def setUpWidgets(self) -> None:

        log("[        ] Now loading widgets...")

        self.model = QtWidgets.QFileSystemModel(self)
        self.model.setRootPath(os.path.expanduser("~"))
        self.model.setFilter(QtCore.QDir.AllDirs | QtCore.QDir.NoDotAndDotDot
                             | QtCore.QDir.Files)
        self.model.setNameFilterDisables(False)

        self.fileExplorerTreeWidget = QtWidgets.QTreeView(self)
        self.fileExplorerTreeWidget.setSelectionMode(
            QtWidgets.QTreeView.SelectionMode.ContiguousSelection)
        self.fileExplorerTreeWidget.setDragEnabled(True)
        self.fileExplorerTreeWidget.setModel(self.model)
        self.fileExplorerTreeWidget.setColumnWidth(0, 400)
        self.fileExplorerTreeWidget.setColumnHidden(2, True)
        self.fileExplorerTreeWidget.setRootIndex(
            self.model.index(os.path.expanduser(os.path.expanduser("~"))))

        self.treeWidget = TreeWidget(self)
        self.treeWidget.setSortingEnabled(True)
        self.treeWidget.setEmptyText(
            "Add some files or folders to start compressing\n\nThen, click \"Compress\" to save them in a zip file"
        )
        self.treeWidget.connectFileDragEvent(self.openFile)
        self.treeWidget.itemDoubleClicked.connect(self.openItemFile)
        self.treeWidget.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
        self.treeWidget.customContextMenuRequested.connect(
            self.showRightClickMenu)

        self.magicButton = QtWidgets.QPushButton(self)
        self.magicButton.setFixedHeight(30)
        self.magicButton.setObjectName("AccentButton")
        self.magicButton.setText("Compress")
        self.magicButton.clicked.connect(self.magicButtonAction)

        self.currentStatusBar = ProgressUpdater(self, self.mainWindow,
                                                "Compressing...",
                                                "Click compress to start")
        self.currentStatusBar.setFixedHeight(30)

        self.horLayout1 = QtWidgets.QHBoxLayout()

        verLayout1 = QtWidgets.QVBoxLayout()
        verLayout2 = QtWidgets.QVBoxLayout()

        verLayout1.addWidget(self.fileExplorerTreeWidget)
        verLayout2.addWidget(self.treeWidget)
        verLayout1.addWidget(self.magicButton)
        verLayout2.addWidget(self.currentStatusBar)

        self.horLayout1.addLayout(verLayout1)
        self.horLayout1.addLayout(verLayout2, stretch=1)

        self.mainVerLayout = QtWidgets.QVBoxLayout(self)
        self.mainVerLayout.addWidget(self.toolBar)
        self.mainVerLayout.addLayout(self.horLayout1)

        self.setLayout(self.mainVerLayout)
コード例 #2
0
 def initfb(self):
     path = "Ce PC"
     self.model = QtWidgets.QFileSystemModel()
     self.model.setRootPath((QtCore.QDir.rootPath()))
     self.treeView.setModel(self.model)
     self.treeView.setRootIndex(self.model.index(path))
     self.treeView.setSortingEnabled(True)
コード例 #3
0
    def __init__(self, collection_root="", parent=None):
        super(CollectionMenu, self).__init__(parent=parent)

        self.setProperty("houdiniStyle", True)

        self.collection = parent
        self.setFixedWidth(150)
        self.setStyleSheet( """QTreeView::branch {border-image: url(none.png);}
                               QTreeView{outline: 0}
                               QTreeView::item:selected{border: None;
                                                        background-color: rgba(20,20,120,128);}
                            """ );

        self.current_category = None
        self.collection_root = collection_root

        self.filemodel = QtWidgets.QFileSystemModel(self)
        self.filemodel.setIconProvider(CollectionIconProvider())
        
        self.filemodel.setFilter(QtCore.QDir.AllDirs|QtCore.QDir.NoDotAndDotDot)

        r = self.filemodel.setRootPath(collection_root)
        self.filemodel.setHeaderData(0, QtCore.Qt.Horizontal, "Folders");
        self.setModel(self.filemodel)
        self.setRootIndex(r)
        
        for i in range(self.header().count()):

            if i == 0: continue
            self.hideColumn(i)

        self.header().close()
コード例 #4
0
ファイル: GUI.py プロジェクト: glik44/EyeShield
 def populateProcessImage(self):
     path = "//C"
     self.model = QtWidgets.QFileSystemModel()
     self.model.setRootPath((QtCore.QDir.rootPath()))
     self.dialog.treeView.setModel(self.model)
     self.dialog.treeView.setRootIndex(self.model.index(path))
     self.dialog.treeView.setSortingEnabled(True)
コード例 #5
0
 def __init__(self):
     super(MyFileBrowser, self).__init__()
     self.model = QtWidgets.QFileSystemModel()
     self.setupUi(self)
     self.treeView.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
     self.treeView.customContextMenuRequested.connect(self.context_menu)
     self.populate()
コード例 #6
0
 def populate(self):
     path = r"C:\Users\Alexandr\.PyCharmCE2018.3\config\scratches\waiting"
     self.model = QtWidgets.QFileSystemModel()
     self.model.setRootPath((QtCore.QDir.rootPath()))
     self.treeView.setModel(self.model)
     self.treeView.setRootIndex(self.model.index(path))
     self.treeView.setSortingEnabled(True)
コード例 #7
0
 def populate(self):
     path = r"C:\Users\HP\Desktop\MyProject"
     self.model = QtWidgets.QFileSystemModel()
     self.model.setRootPath((QtCore.QDir.rootPath()))
     self.treeView.setModel(self.model)
     self.treeView.setRootIndex(self.model.index(path))
     self.treeView.setSortingEnabled(True)
コード例 #8
0
ファイル: ui.py プロジェクト: bneall/mariImageBrowser
    def __init__(self, parent=None):
        super(MIBFileBrowser, self).__init__(parent)

        self.setFocusPolicy(QtCore.Qt.NoFocus)
        self.setStyleSheet(MIB_STYLESHEET)

        # Layouts
        mainLayout = QtWidgets.QVBoxLayout()
        mainLayout.setContentsMargins(0, 0, 0, 0)
        self.setLayout(mainLayout)

        # Widget -- FileSystem View/Model
        self.fileModel = QtWidgets.QFileSystemModel()
        self.fileModel.setRootPath(QtCore.QDir.rootPath())
        self.fileModel.setFilter(QtCore.QDir.Dirs | QtCore.QDir.NoDot)
        self.fileViewer = QtWidgets.QTreeView()
        self.fileViewer.setModel(self.fileModel)
        self.fileViewer.hideColumn(1)
        self.fileViewer.hideColumn(2)
        self.fileViewer.hideColumn(3)
        self.fileViewer.setHeaderHidden(True)
        self.fileViewer.setDragEnabled(True)

        # Populate Layouts
        mainLayout.addWidget(self.fileViewer)

        # Connections
        self.fileViewer.doubleClicked.connect(self.setDirFromIndex)
コード例 #9
0
ファイル: main_window.py プロジェクト: ThibH/PyExplorer
 def create_widgets(self):
     self.toolbar = QtWidgets.QToolBar()
     self.main_widget = QtWidgets.QWidget()
     self.tree_view = QtWidgets.QTreeView()
     self.list_view = QtWidgets.QListView()
     self.model = QtWidgets.QFileSystemModel()
     self.sld_iconSize = QtWidgets.QSlider()
コード例 #10
0
ファイル: main.py プロジェクト: blkmajik/project-tree
    def setupUi(self):
        super().setupUi()
        self.model = QtWidgets.QFileSystemModel()
        self.model.setRootPath(self.base)
        self.ui.treeView.setModel(self.model)
        self.ui.treeView.setRootIndex(self.model.index(self.base))

        self.fixColumns()
コード例 #11
0
 def create_file_model(self):
     self.model = QtWidgets.QFileSystemModel()
     root_path = QtCore.QDir.rootPath()
     self.model.setRootPath(root_path)
     self.tree_view.setModel(self.model)
     self.list_view.setModel(self.model)
     self.list_view.setRootIndex(self.model.index(root_path))
     self.tree_view.setRootIndex(self.model.index(root_path))
コード例 #12
0
 def create_widgets(self):
     self.toolbar = QtWidgets.QToolBar()
     self.main_widget = QtWidgets.QWidget()
     self.tree_view = QtWidgets.QTreeView()
     self.list_view = QtWidgets.QListView()
     self.path = "/"
     self.model = QtWidgets.QFileSystemModel()
     self.model.setRootPath((QtCore.QDir.rootPath()))
     self.sld_iconSize = QtWidgets.QSlider()
コード例 #13
0
def host_tree(root_path='.'):
    tree = HostFileTree()
    model = QtWidgets.QFileSystemModel()
    model.setRootPath(root_path)
    tree.setModel(model)
    tree.setSortingEnabled(True)
    tree.setRootIndex(model.index(root_path))
    tree.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection)
    tree.setDragDropMode(QtWidgets.QAbstractItemView.DragDrop)
    tree.setDropIndicatorShown(True)
    return tree
コード例 #14
0
    def create_file_model(self):
        # Création du modèle
        self.model = QtWidgets.QFileSystemModel()
        # Configurer le chemin par défaut indépendant du système OS, tous les modifications seront reconnus
        root_path = QtCore.QDir.rootPath()
        self.model.setRootPath(root_path)
        self.tree_view.setModel(self.model)
        self.list_view.setModel(self.model)

        # Root index, là ou notre vue va commencer
        self.tree_view.setRootIndex(self.model.index(root_path))
        self.list_view.setRootIndex(self.model.index(root_path))
コード例 #15
0
    def __init__(self, title, parent):
        super().__init__(title, parent)

        self.model = QtWidgets.QFileSystemModel()
        self.model.setRootPath(QtCore.QDir.currentPath())
        self.main_window = parent

        self.tree = QtWidgets.QTreeView()
        self.tree.setModel(self.model)
        self.tree.setRootIndex(self.model.index(QtCore.QDir.currentPath()))
        self.tree.clicked.connect(self.file_clicked)

        self.setWidget(self.tree)
コード例 #16
0
    def create_widgets(self):
        root_path = "{}".format(cmds.internalVar(userScriptDir=True))

        self.model = QtWidgets.QFileSystemModel()
        self.model.setRootPath(root_path)
        #self.model.setFilter(QtCore.QDir.Dirs | QtCore.QDir.NoDotAndDotDot)
        self.model.setNameFilters(["*.py"])
        self.model.setNameFilterDisables(False)

        self.tree_view = QtWidgets.QTreeView()
        self.tree_view.setModel(self.model)
        self.tree_view.setRootIndex(self.model.index(root_path))
        self.tree_view.hideColumn(1)
        self.tree_view.setColumnWidth(0, 240)
コード例 #17
0
ファイル: autofocus.py プロジェクト: p-leroy/posar
    def buildView(self):
        self.modelDirs = QtWidgets.QFileSystemModel()
        self.modelDirs.setRootPath(self.sbg_dir)

        self.treeView = self.ui.treeView
        self.treeView.setModel(self.modelDirs)
        self.treeView.setRootIndex(self.modelDirs.index(self.sbg_dir))
        self.treeView.setColumnHidden(1, True)
        self.treeView.setColumnHidden(2, True)
        self.treeView.setColumnHidden(3, True)

        self.viewHours = self.ui.viewHours

        self.treeView.doubleClicked.connect(self.treeview_doubleclicked)
コード例 #18
0
    def __init__(self, editor, parent, path="."):
        self.editor = editor

        self.model = QtWidgets.QFileSystemModel()
        self.model.setRootPath(path)
        self.model.setNameFilters(["*.rpy"])

        self.tree_view = QtWidgets.QTreeView(parent=parent)
        self.tree_view.setModel(self.model)
        self.tree_view.setRootIndex(self.model.index(path))
        self.tree_view.hideColumn(1)
        self.tree_view.hideColumn(2)
        self.tree_view.hideColumn(3)

        self.tree_view.clicked.connect(self._onClick)
コード例 #19
0
    def __init__(self, root_dir, title=None, parent=None, create=False):
        super(PresetsDialog, self).__init__(parent)

        self.setWindowTitle(title)

        layout = QtWidgets.QVBoxLayout(self)

        self.name_field = None
        self.label = QtWidgets.QLabel(self)

        self.list_view = QtWidgets.QListView(self)
        self.list_view.setAlternatingRowColors(True)

        self.file_model = QtWidgets.QFileSystemModel(self.list_view)
        self.file_model.setFilter(QtCore.QDir.Files | QtCore.QDir.Dirs | QtCore.QDir.NoDot)
        self.proxy_model = ProxyModel(self.list_view, root_dir)
        self.list_view.setModel(self.proxy_model)
        self.proxy_model.setSourceModel(self.file_model)

        layout.addWidget(self.label)
        layout.addWidget(self.list_view)

        buttons_widget = QtWidgets.QWidget(self)
        buttons_lay = QtWidgets.QHBoxLayout(buttons_widget)

        self.open_button = QtWidgets.QPushButton('Open', self, enabled=False)
        cancel_button = QtWidgets.QPushButton('Cancel', self)

        buttons_lay.addWidget(self.open_button)
        buttons_lay.addWidget(cancel_button)

        layout.addWidget(self.list_view)
        if create:
            self.name_field = QtWidgets.QLineEdit(self)
            layout.addWidget(self.name_field)
        layout.addWidget(buttons_widget)

        self.list_view.doubleClicked.connect(self.handle_double_click)
        self.list_view.clicked.connect(self.handle_click)
        self.list_view.mouseReleaseEvent = self.on_mouse_release
        self.open_button.clicked.connect(self.accept)
        cancel_button.clicked.connect(self.reject)

        for widget in (self, buttons_widget, buttons_lay):
            widget.setContentsMargins(0, 0, 0, 0)

        self.set_root(root_dir)
        self.update_path_label()
コード例 #20
0
    def create_tree_view(self):
        root_path = "{0}scripts".format(cmds.internalVar(userAppDir=True))

        self.model = QtWidgets.QFileSystemModel()
        self.model.setRootPath(root_path)

        self.tree_view = QtWidgets.QTreeView()
        self.tree_view.setModel(self.model)
        self.tree_view.setRootIndex(self.model.index(root_path))
        self.tree_view.hideColumn(1)
        self.tree_view.hideColumn(3)
        self.tree_view.setColumnWidth(0, 240)
        self.tree_view.setFixedWidth(360)

        self.model.setNameFilters(["*.py"])
        self.model.setNameFilterDisables(False)
コード例 #21
0
ファイル: _DataSourceFile.py プロジェクト: demjanp/deposit
    def __init__(self, model, view, parent):

        self.model = model
        self.view = view
        self.parent = parent

        DModule.__init__(self)
        QtWidgets.QFrame.__init__(self, parent)

        self.setLayout(QtWidgets.QVBoxLayout())
        self.layout().setContentsMargins(0, 0, 0, 0)

        homedir = self.view.registry.get("recent_dir")
        if not homedir:
            homedir = str(Path.home())
        self.fs_model = QtWidgets.QFileSystemModel()
        self.fs_model.setRootPath(homedir)
        self.fs_model.setNameFilters(["*.%s" % self.EXTENSION])
        self.fs_model.setNameFilterDisables(False)
        self.tree = FileTree()
        self.tree.setModel(self.fs_model)
        for i in range(1, self.fs_model.columnCount()):
            self.tree.hideColumn(i)
        self.tree.setCurrentIndex(self.fs_model.index(homedir))
        self.tree.setExpanded(self.fs_model.index(homedir), True)
        self.tree.setAnimated(False)
        self.tree.setIndentation(20)
        self.tree.setSortingEnabled(True)
        self.tree.selected.connect(self.on_selected)

        self.path_edit = QtWidgets.QLineEdit()
        self.path_edit.textChanged.connect(self.on_path_changed)

        self.connect_button = QtWidgets.QPushButton(
            self.parent.connect_caption())
        self.connect_button.clicked.connect(self.on_connect)

        self.layout().addWidget(self.tree)
        self.layout().addWidget(self.path_edit)
        self.layout().addWidget(self.connect_button)

        self.update()
コード例 #22
0
ファイル: commitview.py プロジェクト: REW1L/VcsPresenter
    def __init__(self, controller, hash, parent=None):
        super(CommitView, self).__init__(parent)
        self.setupUi(self)
        self.controller = controller
        self.hash = hash
        commit = controller.getCommit(hash)
        self.txtHash.setText(hash)
        self.txtAuthor.setText(commit.author)
        self.txtDate.setText(
            QtCore.QDateTime.fromTime_t(int(
                commit.timestamp)).toString("dd.MM.yyyy hh:mm"))
        self.txtDescription.setText(commit.description)
        self.lblLinesAdded.setText(commit.addedLines)
        if commit.deletedLines != '':
            self.lblLinesDeleted.setText(commit.deletedLines)
        else:
            self.lblLinesDeleted.setText("0")

        filesModel = QtWidgets.QFileSystemModel()
        filesModel.setRootPath(controller.project.getPath())
        dir = QtCore.QDir()
        nameFilters = [
            x.strip().split(os.sep)[-1] for x in self.controller.getDiff(hash)
        ]
        if nameFilters == []:
            dir.setNameFilters([""])
        else:
            dir.setNameFilters(nameFilters)

        filesModel.setNameFilters(dir.nameFilters())
        print(dir.nameFilters())
        filesModel.setNameFilterDisables(False)

        self.treeFiles.setModel(filesModel)
        self.treeFiles.setRootIndex(
            filesModel.index(controller.project.getPath()))
        for i in range(1, 4):
            self.treeFiles.hideColumn(i)

        self.treeFiles.activated.connect(self.fileDiff)
コード例 #23
0
ファイル: mainview.py プロジェクト: REW1L/VcsPresenter
    def outCommitFiles(self, commits):
        filesModel = QtWidgets.QFileSystemModel()
        filesModel.setNameFilterDisables(False)
        filesModel.setRootPath(self.controller.project.getPath())
        dir = QtCore.QDir()
        filesModel.setNameFilterDisables(False)
        if commits == []:
            dir.setNameFilters("[!@#$%^&*]+.[/]+")
        else:
            firstCommit = commits[-1]
            lastCommit = commits[0]

            self.commitsView.setModel(
                QtCore.QStringListModel([x.hash for x in commits]))
            dir.setNameFilters([
                x.strip().split(os.sep)[-1] for x in self.controller.getDiff(
                    firstCommit.hash, lastCommit.hash)
            ])
        filesModel.setNameFilters(dir.nameFilters())
        self.filesView.setModel(filesModel)
        self.filesView.setRootIndex(
            filesModel.index(self.controller.project.getPath()))
        for i in range(1, 4):
            self.filesView.hideColumn(i)
コード例 #24
0
    def __init__(self):
        super().__init__()

        self.sourceModel = QtWidgets.QFileSystemModel()
        self.watcher = QtCore.QFileSystemWatcher()
        self.proxyModel = SortFilterProxyModel()
        self.proxyView = QtWidgets.QListView()

        self.proxyView.setModel(self.proxyModel)
        self.proxyModel.setSourceModel(self.sourceModel)
        self.proxyModel.filterOut.append(config.markedImageFolderName.lower())
        self.proxyModel.filterOut.append(config.imageWaoMetaFolderName.lower())
        self.proxyModel.filterOut.append(config.flightDataFolderName.lower())

        self.address = AddressBar()

        # When the root path changes, we'll need to update the file watcher
        self.sourceModel.rootPathChanged.connect(self._changeWatchedPath)

        # When the file watcher has the directory change, we'll want to *maybe* update the layout
        self.watcher.directoryChanged.connect(self.setConditionalLayout)
        self.watcher.fileChanged.connect(self.setConditionalLayout)

        # Context menu policy must be CustomContextMenu for us to implement
        # our own context menu. Connect the context menu request to our internal slot.
        self.menu: LibraryMenu = LibraryMenu(self)
        self.menu.showFlightInfoRequested.connect(
            self.showFlightInfoRequested.emit)
        self.menu.showMigrationLogRequested.connect(
            self.showMigrationLogRequested.emit)
        self.menu.showDistributionFormRequested.connect(
            self.showDistributionFormRequested.emit)
        self.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
        self.customContextMenuRequested.connect(self._customMenuRequested)

        # For optimization purposes, determining the proper layout
        self._rootDirPreviouslyBlank = None

        # Handle selection changes and map to appropriate signals
        self.proxyView.selectionModel().selectionChanged.connect(
            self._handleSelectionChange)

        # Root path. Defaults to $HOME$/Pictures/ImageWAO
        rootPath: str = config.libraryDirectory

        # Widget for use when there are no folders
        label = QtWidgets.QLabel(
            "  There is nothing here :(  \n  Right click to import flight images  "
        )
        label.setAlignment(QtCore.Qt.AlignHCenter | QtCore.Qt.AlignVCenter)

        # add to layout
        layout = QtWidgets.QVBoxLayout()
        layout.addWidget(label, stretch=1)

        # Make widget with this layout
        self.noFoldersWidget = QtWidgets.QWidget()
        self.noFoldersWidget.setLayout(layout)

        # Widget for use when there are folders
        layout = QtWidgets.QVBoxLayout()
        layout.setContentsMargins(0, 0, 0, 0)
        layout.setSpacing(0)
        layout.addWidget(self.address)
        layout.addWidget(self.proxyView, stretch=1)
        self.hasFoldersWidget = QtWidgets.QWidget()
        self.hasFoldersWidget.setLayout(layout)

        # Create the stacked layout
        self.stackedLayout = QtWidgets.QStackedLayout()
        self.setLayout(self.stackedLayout)
        self.stackedLayout.addWidget(self.noFoldersWidget)
        self.stackedLayout.addWidget(self.hasFoldersWidget)

        # Re-base the model on the new root path.
        self.rebase(rootPath)
コード例 #25
0
ファイル: ui.py プロジェクト: ireneher/andre_jukebox
    def __init__(self, mayaFile=None, parent=None):
        super(TapeBrowser, self).__init__(parent)
        #self.mayaFile = mayaFile or cmds.file(query=True, l=True)[0]
        #self.projectPath = cmds.workspace(q=True, active=True)
        self.projectPath = "C:/Users/their/Documents/AJ_test/MAYA"
        self.projectPath = os.environ["AJ_PROJECT"]

        self.publishCurrentCheckbox = QtWidgets.QCheckBox("Publish Current")
        self.publishCurrentCheckbox.setChecked(True)

        self.setWindowTitle(WINDOW_NAME)
        self.setObjectName(WINDOW_NAME)
        self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
        self.setWindowFlags(QtCore.Qt.Dialog)
        screenGeometry = QtWidgets.QDesktopWidget.screenGeometry(
            QtWidgets.QDesktopWidget()
        )
        self.setMinimumWidth(screenGeometry.width() * 0.5)
        self.setMinimumHeight(screenGeometry.height() * 0.5)

        # ----- Components -----
        # Splitter
        self.splitter = QtWidgets.QSplitter()
        self.splitter.setWindowState(QtCore.Qt.WindowMaximized)
        # Directories model
        self.assetsRoot = templates.ASSETS_ROOT.format(DCC_ROOT=self.projectPath)
        self.tapeTypeModel = QtWidgets.QFileSystemModel()
        self.tapeTypeModel.setRootPath(self.assetsRoot)
        self.tapeTypeModel.setFilter(QtCore.QDir.AllDirs | QtCore.QDir.NoDotAndDotDot)

        self.tapeModel = QtWidgets.QFileSystemModel()
        
        self.tapeModel.setFilter(QtCore.QDir.AllDirs | QtCore.QDir.NoDotAndDotDot)
        self.nameFilters = []  # placeholder for potential filters
        self.extendedNameFilters = []  # to be populated by search bar
        self.tapeModel.setNameFilters(self.nameFilters)

        # Tape type view
        self.tapeTypeView = QtWidgets.QTreeView(self.splitter)
        self.tapeTypeView.setModel(self.tapeTypeModel)
        self.tapeTypeView.hideColumn(1)
        self.tapeTypeView.hideColumn(2)
        self.tapeTypeView.hideColumn(3)
        self.tapeTypeView.resizeColumnToContents(0)
        self.tapeTypeView.expandAll()
        self.tapeTypeView.setItemsExpandable(False)
        self.tapeTypeView.setRootIndex(self.tapeTypeModel.setRootPath(self.assetsRoot))

        # Tape view
        self.tapeView = QtWidgets.QTreeView(self.splitter)
        self.tapeView.setModel(self.tapeModel)
        self.tapeView.hideColumn(1)
        self.tapeView.hideColumn(2)
        self.tapeView.hideColumn(3)
        self.tapeView.resizeColumnToContents(0)
        self.tapeView.setSelectionMode(QtWidgets.QAbstractItemView.MultiSelection)
        self.tapeView.expandAll()
        self.tapeView.setItemsExpandable(False)

        # maya project location 
        # self.projectBar = QtWidgets.QLineEdit()
        # self.projectBar.setPlaceholderText("/path/to/project/root/MAYA")
        # self.projectBar.setText(self.projectPath)
        # self.projectBar.setFont(QtGui.QFont("Open Sans", 12))

        # Search bar
        # self.searchBar = QtWidgets.QLineEdit()
        # self.searchBar.setPlaceholderText("Search")
        # self.searchBar.setFont(QtGui.QFont("Open Sans", 12))
        
        # Task input
        self.taskBar = QtWidgets.QLineEdit()
        self.taskBar.setPlaceholderText("Task")
        self.taskBar.setFont(QtGui.QFont("Open Sans", 12))

        # Dropdown
        self.optionsDropdown = QtWidgets.QComboBox()
        self.optionsDropdown.addItems(["USD Asset", "USD Composition", "Anim Cache"])

        # Button
        self.publishButton = QtWidgets.QPushButton("Publish")

        # ----- Layout -----
        self.splitter.setStretchFactor(0, 1)
        self.splitter.setStretchFactor(1, 2)
        self.splitter.setStretchFactor(2, 4)
        layout = QtWidgets.QVBoxLayout(self)
        #layout.addWidget(self.projectBar)
        #layout.addWidget(self.searchBar)
        layout.addWidget(self.publishCurrentCheckbox)
        layout.addWidget(self.splitter)
        layout.addWidget(self.taskBar)
        layout.addWidget(self.optionsDropdown)
        layout.addWidget(self.publishButton)

        # ----- Connections -----
        self.tapeTypeView.clicked.connect(self.onTreeClicked)
        #self.projectBar.returnPressed.connect(self.updateProject)
        self.publishButton.clicked.connect(self.onButtonClicked)
コード例 #26
0
from PySide2 import QtWidgets, QtCore, QtGui

app = QtWidgets.QApplication([])

splitter = QtWidgets.QSplitter()

model = QtWidgets.QFileSystemModel()
model.setRootPath(QtCore.QDir.currentPath())

tree = QtWidgets.QTreeView(splitter)
tree.setModel(model)
tree.setRootIndex(model.index(
    QtCore.QDir.currentPath()))  # 获取当前路径的 Index 并作为视图的根路径

list_ = QtWidgets.QListView(splitter)
list_.setModel(model)
list_.setRootIndex(model.index(QtCore.QDir.currentPath()))

parentIndex = model.index(QtCore.QDir.currentPath())  # 获取当前路径的 Index
parentIndex = model.index(0, 0, QtCore.QModelIndex())  # 获取当前路径的 Index
numRows = model.rowCount(parentIndex)
print(numRows)

for row in range(numRows):
    index = model.index(row, 0, parentIndex)
    text = model.data(index, QtGui.Qt.DisplayRole)
    print(text)

splitter.setWindowTitle("Two Views")
splitter.show()
コード例 #27
0
ファイル: GUI.py プロジェクト: glik44/EyeShield
 def populateForReview(self, path):
     self.model = QtWidgets.QFileSystemModel()
     self.model.setRootPath((QtCore.QDir.rootPath()))
     self.dialog.treeViewForReview.setModel(self.model)
     self.dialog.treeViewForReview.setRootIndex(self.model.index(path))
     self.dialog.treeViewForReview.setSortingEnabled(True)