当前位置: 首页>>代码示例>>Python>>正文


Python QtWidgets.QFileSystemModel方法代码示例

本文整理汇总了Python中PyQt5.QtWidgets.QFileSystemModel方法的典型用法代码示例。如果您正苦于以下问题:Python QtWidgets.QFileSystemModel方法的具体用法?Python QtWidgets.QFileSystemModel怎么用?Python QtWidgets.QFileSystemModel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt5.QtWidgets的用法示例。


在下文中一共展示了QtWidgets.QFileSystemModel方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: columnCount

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QFileSystemModel [as 别名]
def columnCount(self, parent):
        # The QFileSystemModel returns 4 columns by default
        # Columns 1, 2, 3 will be present but hidden
        return 6 
开发者ID:BasioMeusPuga,项目名称:Lector,代码行数:6,代码来源:models.py

示例2: data

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QFileSystemModel [as 别名]
def data(self, index, role):
        if (index.column() in (4, 5)
                and (role == QtCore.Qt.DisplayRole or role == QtCore.Qt.EditRole)):

            read_field = self.field_dict[index.column()]
            try:
                return self.tag_data[self.filePath(index)][read_field]
            except KeyError:
                return QtCore.QVariant()

        if role == QtCore.Qt.CheckStateRole and index.column() == 0:
            return self.checkState(index)

        return QtWidgets.QFileSystemModel.data(self, index, role) 
开发者ID:BasioMeusPuga,项目名称:Lector,代码行数:16,代码来源:models.py

示例3: flags

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QFileSystemModel [as 别名]
def flags(self, index):
        if index.column() in (4, 5):
            return QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEditable
        else:
            return QtWidgets.QFileSystemModel.flags(self, index) | QtCore.Qt.ItemIsUserCheckable 
开发者ID:BasioMeusPuga,项目名称:Lector,代码行数:7,代码来源:models.py

示例4: __init__

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QFileSystemModel [as 别名]
def __init__(self, *args, **kwargs):
        QtWidgets.QDialog.__init__(self, *args, **kwargs)

        self.completer = QtWidgets.QCompleter()
        self.completer_model = QtWidgets.QFileSystemModel(self.completer)
        self.completer.setModel(self.completer_model)
        self.completer.setMaxVisibleItems(8)

        loadUi(get_resource('dialog_config.ui'), self)

        self.ok_button.released.connect(
            self.setAttributes)
        self.ok_button.released.connect(
            self.close)

        self.apply_button.released.connect(
            self.setAttributes)

        self.vector_color_picker = QtWidgets.QColorDialog(self)
        self.vector_color_picker. \
            setCurrentColor(QtGui.QColor(*getConfig().vector_color))
        self.vector_color_picker. \
            setOption(self.vector_color_picker.ShowAlphaChannel)
        self.vector_color_picker.colorSelected.connect(
            self.updateVectorColor)
        self.vector_color_picker.setModal(True)
        self.vector_color.clicked.connect(
            self.vector_color_picker.show)

        self.vector_color.setValue = self.setButtonColor
        self.vector_color.value = self.getButtonColor

        self.chooseStoreDirButton.released.connect(
            self.chooseStoreDir)
        self.completer_model.setRootPath('')
        self.completer.setParent(self.default_gf_dir)
        self.default_gf_dir.setCompleter(self.completer)

        self.getAttributes() 
开发者ID:pyrocko,项目名称:kite,代码行数:41,代码来源:config.py

示例5: __init__

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QFileSystemModel [as 别名]
def __init__(self, callback, app=None, palette=None):
        super().__init__()

        directoryFont = QFont()
        self.app = app
        self.palette = palette

        self.currentPath: str = ""
        self.indexPath: str = ""

        directoryFont.setFamily(editor["directoryFont"])
        directoryFont.setPointSize(editor["directoryFontSize"])
        self.open_callback = callback
        self.setContextMenuPolicy(Qt.CustomContextMenu)
        self.customContextMenuRequested.connect(self.openMenu)
        self.setFont(directoryFont)
        self.layout = QHBoxLayout()
        self.model = QFileSystemModel()
        self.setModel(self.model)
        self.model.setRootPath(QDir.rootPath())
        self.setMaximumWidth(300)
        self.setIndentation(10)
        self.setAnimated(True)
        self.newFile()
        self.deleteFile()
        self.setSortingEnabled(True)
        self.setWindowTitle("Dir View")
        self.hideColumn(1)
        self.resize(200, 600)
        self.hideColumn(2)
        self.confirmation = MessageBox(self)
        self.hideColumn(3)
        self.doubleClicked.connect(self.openFile) 
开发者ID:CountryTk,项目名称:Hydra,代码行数:35,代码来源:Directory.py

示例6: __init__

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QFileSystemModel [as 别名]
def __init__(self):
        super().__init__(argv)
        signal(SIGINT, SIG_DFL)
        
        views = dirname(realpath(__file__)) + '/views/'
        
        self.welcome = loadUi(views + 'welcome.ui')
        self.choose_extractor = loadUi(views + 'choose_extractor.ui')
        self.choose_proto = loadUi(views + 'choose_proto.ui')
        self.create_endpoint = loadUi(views + 'create_endpoint.ui')
        self.choose_endpoint = loadUi(views + 'choose_endpoint.ui')
        self.fuzzer = loadUi(views + 'fuzzer.ui')

        self.welcome.step1.clicked.connect(self.load_extractors)
        self.choose_extractor.rejected.connect(partial(self.set_view, self.welcome))
        self.choose_extractor.extractors.itemClicked.connect(self.prompt_extractor)
        
        self.welcome.step2.clicked.connect(self.load_protos)
        self.proto_fs = QFileSystemModel()
        self.choose_proto.protos.setModel(self.proto_fs)
        self.proto_fs.directoryLoaded.connect(self.choose_proto.protos.expandAll)
        
        for i in range(1, self.proto_fs.columnCount()):
            self.choose_proto.protos.hideColumn(i)
        self.choose_proto.protos.setRootIndex(self.proto_fs.index(str(BASE_PATH / 'protos')))
        self.choose_proto.rejected.connect(partial(self.set_view, self.welcome))
        self.choose_proto.protos.clicked.connect(self.new_endpoint)
        
        self.create_endpoint.transports.itemClicked.connect(self.pick_transport)
        self.create_endpoint.loadRespPbBtn.clicked.connect(self.load_another_pb)
        self.create_endpoint.rejected.connect(partial(self.set_view, self.choose_proto))
        self.create_endpoint.buttonBox.accepted.connect(self.write_endpoint)
                
        self.welcome.step3.clicked.connect(self.load_endpoints)
        self.choose_endpoint.rejected.connect(partial(self.set_view, self.welcome))
        self.choose_endpoint.endpoints.itemClicked.connect(self.launch_fuzzer)
        
        self.fuzzer.rejected.connect(partial(self.set_view, self.choose_endpoint))
        self.fuzzer.fuzzFields.clicked.connect(self.fuzz_endpoint)
        self.fuzzer.deleteThis.clicked.connect(self.delete_endpoint)
        self.fuzzer.comboBox.activated.connect(self.launch_fuzzer)
        self.fuzzer.getAdd.clicked.connect(self.add_tab_data)

        self.fuzzer.urlField.setWordWrapMode(QTextOption.WrapAnywhere)
        
        for tree in (self.fuzzer.pbTree, self.fuzzer.getTree):
            tree.itemEntered.connect(lambda item, _: item.edit() if hasattr(item, 'edit') else None)
            tree.itemClicked.connect(lambda item, col: item.update_check(col=col))
            tree.itemExpanded.connect(lambda item: item.expanded() if hasattr(item, 'expanded') else None)
            tree.header().setSectionResizeMode(QHeaderView.ResizeToContents)
        
        self.welcome.mydirLabel.setText(self.welcome.mydirLabel.text() % BASE_PATH)
        self.welcome.mydirBtn.clicked.connect(partial(QDesktopServices.openUrl, QUrl.fromLocalFile(str(BASE_PATH))))
        
        self.set_view(self.welcome)
        self.exec_() 
开发者ID:marin-m,项目名称:pbtk,代码行数:58,代码来源:gui.py

示例7: init_ui

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QFileSystemModel [as 别名]
def init_ui(self):

        layout = QtWidgets.QVBoxLayout()
        self.setLayout(layout)

        self.layout().setContentsMargins(0, 0, 0, 0)
        self.layout().setSpacing(0)

        self.title_frame = QtWidgets.QFrame()
        self.title_frame.setStyleSheet('background: #57bd4f;'
                                       'border-top-left-radius: 6px;'
                                       'border-top-right-radius: 6px;'
                                       'color: white;')

        self.title_layout = QtWidgets.QHBoxLayout()
        self.title_frame.setLayout(self.title_layout)
        self.layout().addWidget(self.title_frame)

        self.library_frame = QtWidgets.QFrame()
        self.library_frame.setStyleSheet('background: #78543b;'
                                         'border-bottom-left-radius: 6px;'
                                         'border-bottom-right-radius: 6px;'
                                         'color: white;')
        self.library_layout = QtWidgets.QVBoxLayout()
        self.library_frame.setLayout(self.library_layout)
        self.layout().addWidget(self.library_frame)

        title_font = QtGui.QFont('Raleway', 16)
        title_font.setBold(True)

        self.media_library_title = QtWidgets.QLabel('Media Library')
        self.media_library_title.setFont(title_font)

        self.title_layout.addWidget(self.media_library_title)

        self.filesystem_model = QtWidgets.QFileSystemModel()
        self.filesystem_model.setNameFilters(['*.mp3', '*.m4a', '*.wav', '*.m3u', '*.ogg', '*.wma'])
        self.filesystem_model.setNameFilterDisables(False)
        self.filesystem_model.setFilter(QtCore.QDir.AllEntries | QtCore.QDir.NoDotAndDotDot)

        self.music_tree = QtWidgets.QTreeView(self)
        self.music_tree.setModel(self.filesystem_model)

        self.music_tree.hideColumn(1)  # Size Column
        self.music_tree.hideColumn(2)  # Type Column
        self.music_tree.hideColumn(3)  # Date Modified Column

        self.music_tree.setObjectName('music_library')
        self.music_tree.setHeaderHidden(True)

        # Add slot
        self.music_tree.activated.connect(self.item_clicked)

        # Add widget
        self.library_layout.addWidget(self.music_tree)

        self.change_path_button = QtWidgets.QPushButton('Change Path')
        self.library_layout.addWidget(self.change_path_button)
        self.change_path_button.clicked.connect(self.choose_path) 
开发者ID:python-discord,项目名称:code-jam-5,代码行数:61,代码来源:media_library.py


注:本文中的PyQt5.QtWidgets.QFileSystemModel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。