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


Python Qt.AscendingOrder方法代码示例

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


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

示例1: load_profile

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AscendingOrder [as 别名]
def load_profile(self, profile: dict):
        self.blockSignals(True)
        self.setSortingEnabled(False)
        self.clear()

        for name, settings in profile.items():
            parent = self.make_option(name, self, settings['state'], 0, settings['tooltip'], settings['dependency'])
            if settings['options']:
                for number, choice in enumerate(settings['options']):
                    if settings['active option'] == number:
                        option = self.make_option(str(choice), parent, True, 1, subindex=number)
                        option.setFlags(option.flags() ^ Qt.ItemIsUserCheckable)
                    else:
                        option = self.make_option(str(choice), parent, False, 1, subindex=number)
            self.make_exclusive(parent)

        self.hock_dependency()
        self.update_size()
        self.setSortingEnabled(True)
        self.sortByColumn(0, Qt.AscendingOrder)
        self.blockSignals(False) 
开发者ID:Thomasedv,项目名称:Grabber,代码行数:23,代码来源:parameter_tree.py

示例2: on_treeWidget_itemChanged

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AscendingOrder [as 别名]
def on_treeWidget_itemChanged(self, item, column):
        if item is self._get_current_treewidget_item() and column == 0:
            newText = str(item.text(0))
            if ui_common.validate(
                    not ui_common.EMPTY_FIELD_REGEX.match(newText),
                    "The name can't be empty.",
                    None,
                    self.window()):
                self.window().app.monitor.suspend()
                self.stack.currentWidget().set_item_title(newText)
                self.stack.currentWidget().rebuild_item_path()

                persistGlobal = self.stack.currentWidget().save()
                self.window().app.monitor.unsuspend()
                self.window().app.config_altered(persistGlobal)

                self.treeWidget.sortItems(0, Qt.AscendingOrder)
            else:
                item.update() 
开发者ID:autokey,项目名称:autokey,代码行数:21,代码来源:centralwidget.py

示例3: __createFolder

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AscendingOrder [as 别名]
def __createFolder(self, parent_item):
        folder = model.Folder("New Folder")
        new_item = ak_tree.FolderWidgetItem(parent_item, folder)
        self.window().app.monitor.suspend()

        if parent_item is not None:
            parentFolder = self.__extractData(parent_item)
            parentFolder.add_folder(folder)
        else:
            self.treeWidget.addTopLevelItem(new_item)
            self.configManager.folders.append(folder)

        folder.persist()
        self.window().app.monitor.unsuspend()

        self.treeWidget.sortItems(0, Qt.AscendingOrder)
        self.treeWidget.setCurrentItem(new_item)
        self.on_treeWidget_itemSelectionChanged()
        self.on_rename() 
开发者ID:autokey,项目名称:autokey,代码行数:21,代码来源:centralwidget.py

示例4: on_new_phrase

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AscendingOrder [as 别名]
def on_new_phrase(self):
        self.window().app.monitor.suspend()
        tree_widget = self.treeWidget  # type: ak_tree.AkTreeWidget
        parent_item = tree_widget.selectedItems()[0]  # type: ak_tree.ItemWidgetType
        parent = self.__extractData(parent_item)

        phrase = model.Phrase("New Phrase", "Enter phrase contents")
        new_item = ak_tree.PhraseWidgetItem(parent_item, phrase)
        parent.add_item(phrase)
        phrase.persist()

        self.window().app.monitor.unsuspend()

        tree_widget.sortItems(0, Qt.AscendingOrder)
        tree_widget.setCurrentItem(new_item)
        parent_item.setSelected(False)
        self.on_treeWidget_itemSelectionChanged()
        self.on_rename() 
开发者ID:autokey,项目名称:autokey,代码行数:20,代码来源:centralwidget.py

示例5: on_new_script

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AscendingOrder [as 别名]
def on_new_script(self):
        self.window().app.monitor.suspend()
        tree_widget = self.treeWidget  # type: ak_tree.AkTreeWidget
        parent_item = tree_widget.selectedItems()[0]  # type: ak_tree.ItemWidgetType
        parent = self.__extractData(parent_item)

        script = model.Script("New Script", "#Enter script code")
        new_item = ak_tree.ScriptWidgetItem(parent_item, script)
        parent.add_item(script)
        script.persist()

        self.window().app.monitor.unsuspend()
        tree_widget.sortItems(0, Qt.AscendingOrder)
        tree_widget.setCurrentItem(new_item)
        parent_item.setSelected(False)
        self.on_treeWidget_itemSelectionChanged()
        self.on_rename() 
开发者ID:autokey,项目名称:autokey,代码行数:19,代码来源:centralwidget.py

示例6: move_items

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AscendingOrder [as 别名]
def move_items(self, sourceItems, target):
        target_model_item = self.__extractData(target)

        # Filter out any child objects that belong to a parent already in the list
        result = [f for f in sourceItems if f.parent() not in sourceItems]

        self.window().app.monitor.suspend()

        for source in result:
            self.__removeItem(source)
            source_model_item = self.__extractData(source)

            if isinstance(source_model_item, model.Folder):
                target_model_item.add_folder(source_model_item)
                self.__moveRecurseUpdate(source_model_item)
            else:
                target_model_item.add_item(source_model_item)
                source_model_item.path = None
                source_model_item.persist()

            target.addChild(source)

        self.window().app.monitor.unsuspend()
        self.treeWidget.sortItems(0, Qt.AscendingOrder)
        self.window().app.config_altered(True) 
开发者ID:autokey,项目名称:autokey,代码行数:27,代码来源:centralwidget.py

示例7: lessThan

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AscendingOrder [as 别名]
def lessThan(self, source_left, source_right):
        if not source_left.isValid() or not source_right.isValid():
            return False
        # 获取数据
        leftData = self.sourceModel().data(source_left)
        rightData = self.sourceModel().data(source_right)
        if self.sortOrder() == Qt.DescendingOrder:
            # 按照时间倒序排序
            leftData = leftData.split('-')[-1]
            rightData = rightData.split('-')[-1]
            return leftData < rightData
#         elif self.sortOrder() == Qt.AscendingOrder:
#             #按照名字升序排序
#             leftData = leftData.split('-')[0]
#             rightData = rightData.split('-')[0]
#             return leftData < rightData
        return super(SortFilterProxyModel, self).lessThan(source_left, source_right) 
开发者ID:PyQt5,项目名称:PyQt,代码行数:19,代码来源:CustomWidgetSortItem.py

示例8: lessThan

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AscendingOrder [as 别名]
def lessThan(self, source_left, source_right):
        if not source_left.isValid() or not source_right.isValid():
            return False

        if self.sortRole() == ClassifyRole and \
                source_left.column() == self.sortColumn() and \
                source_right.column() == self.sortColumn():
            # 获取左右两个的分类
            leftIndex = source_left.data(ClassifyRole)
            rightIndex = source_right.data(ClassifyRole)

            # 升序
            if self.sortOrder() == Qt.AscendingOrder:
                # 保持在最前面
                if leftIndex == self._topIndex:
                    leftIndex = -1
                if rightIndex == self._topIndex:
                    rightIndex = -1

                return leftIndex < rightIndex

        return super(SortFilterProxyModel, self).lessThan(source_left, source_right) 
开发者ID:PyQt5,项目名称:PyQt,代码行数:24,代码来源:SortItemByRole.py

示例9: __init__

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AscendingOrder [as 别名]
def __init__(self, parent, columns: List[TableModelColumn], columns_movable):
        object.__init__(self)
        self.parent_widget = parent
        self._columns = columns
        self._col_idx_by_name: Dict[str, int] = {}
        self._rebuild_column_index()
        self.view: QAbstractItemView = None
        self.columns_movable = columns_movable
        self.sorting_column_name = ''
        self.sorting_order = Qt.AscendingOrder
        self.proxy_model: ColumnedSortFilterProxyModel = None 
开发者ID:Bertrand256,项目名称:dash-masternode-tool,代码行数:13,代码来源:ext_item_model.py

示例10: __init__

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AscendingOrder [as 别名]
def __init__(self, cues=None, properties=('index', 'name'),
                 selection_mode=QTreeWidget.SingleSelection, **kwargs):
        super().__init__(**kwargs)

        self.setMinimumSize(600, 400)

        self._properties = list(properties)
        self._cues = {}

        self.list = QTreeWidget(self)
        self.list.setSelectionMode(selection_mode)
        self.list.setSelectionBehavior(QTreeWidget.SelectRows)
        self.list.setAlternatingRowColors(True)
        self.list.setIndentation(0)
        self.list.setHeaderLabels([prop.title() for prop in properties])
        self.list.header().setSectionResizeMode(QHeaderView.Fixed)
        self.list.header().setSectionResizeMode(1, QHeaderView.Stretch)
        self.list.header().setStretchLastSection(False)
        self.list.sortByColumn(0, Qt.AscendingOrder)
        self.list.setSortingEnabled(True)

        if cues is not None:
            self.add_cues(cues)

        self.setLayout(QVBoxLayout())
        self.layout().addWidget(self.list)

        self.buttons = QDialogButtonBox(self)
        self.buttons.addButton(QDialogButtonBox.Cancel)
        self.buttons.addButton(QDialogButtonBox.Ok)
        self.layout().addWidget(self.buttons)

        self.buttons.accepted.connect(self.accept)
        self.buttons.rejected.connect(self.reject) 
开发者ID:FrancescoCeruti,项目名称:linux-show-player,代码行数:36,代码来源:cuelistdialog.py

示例11: __init__

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AscendingOrder [as 别名]
def __init__(self, profile: dict, parent=None):
        """
        Data table:
        All data is in column 0.
        --
        0  - Visual name.
        32 - main data entry, name of parents, full data for children
        33 - 0 for parent, 1 for children, 3 for custom option.
        34 - Name of item that needs to be checked
        35 - index for children used for active option
        37 - List of QModelIndex to items that this depends on.

        """
        super().__init__(parent=parent)

        self.favorite = False

        self.setExpandsOnDoubleClick(False)
        # self.setHeaderHidden(True)
        self.setRootIsDecorated(False)
        self.setHeaderHidden(True)
        # self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.setContextMenuPolicy(Qt.CustomContextMenu)
        self.customContextMenuRequested.connect(self.contextMenu)

        # self.header().setSectionResizeMode(0,QHeaderView.ResizeToContents)
        # self.headerItem().setResizeMode(QHeaderView.ResizeToContents)

        # self.setItemWidget()
        if isinstance(profile, dict):
            self.load_profile(profile)
        else:
            raise TypeError(f'Expected dict, not type {type(profile)}')

        self.setSortingEnabled(True)
        self.sortByColumn(0, Qt.AscendingOrder)

        self.itemChanged.connect(self.make_exclusive)
        self.itemChanged.connect(self.check_dependency) 
开发者ID:Thomasedv,项目名称:Grabber,代码行数:41,代码来源:parameter_tree.py

示例12: populate_tree

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AscendingOrder [as 别名]
def populate_tree(self, config):
        self.factory = ak_tree.WidgetItemFactory(config.folders)
        root_folders = self.factory.get_root_folder_list()
        for item in root_folders:
            self.treeWidget.addTopLevelItem(item)

        self.treeWidget.sortItems(0, Qt.AscendingOrder)
        self.treeWidget.setCurrentItem(self.treeWidget.topLevelItem(0))
        self.on_treeWidget_itemSelectionChanged() 
开发者ID:autokey,项目名称:autokey,代码行数:11,代码来源:centralwidget.py

示例13: on_paste

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AscendingOrder [as 别名]
def on_paste(self):
        parent_item = self._get_current_treewidget_item()
        parent = self.__extractData(parent_item)
        self.window().app.monitor.suspend()

        new_items = []
        for item in self.cutCopiedItems:
            if isinstance(item, model.Folder):
                new_item = ak_tree.FolderWidgetItem(parent_item, item)
                ak_tree.WidgetItemFactory.process_folder(new_item, item)
                parent.add_folder(item)
            elif isinstance(item, model.Phrase):
                new_item = ak_tree.PhraseWidgetItem(parent_item, item)
                parent.add_item(item)
            else:
                new_item = ak_tree.ScriptWidgetItem(parent_item, item)
                parent.add_item(item)

            item.persist()

            new_items.append(new_item)

        self.treeWidget.sortItems(0, Qt.AscendingOrder)
        self.treeWidget.setCurrentItem(new_items[-1])
        self.on_treeWidget_itemSelectionChanged()
        self.cutCopiedItems = []
        for item in new_items:
            item.setSelected(True)
        self.window().app.monitor.unsuspend()
        self.window().app.config_altered(False) 
开发者ID:autokey,项目名称:autokey,代码行数:32,代码来源:centralwidget.py

示例14: on_save

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AscendingOrder [as 别名]
def on_save(self):
        logger.info("User requested file save.")
        if self.stack.currentWidget().validate():
            self.window().app.monitor.suspend()
            persist_global = self.stack.currentWidget().save()
            self.window().save_completed(persist_global)
            self.set_dirty(False)
            item = self._get_current_treewidget_item()
            item.update()
            self.treeWidget.update()
            self.treeWidget.sortItems(0, Qt.AscendingOrder)
            self.window().app.monitor.unsuspend()
            return False

        return True 
开发者ID:autokey,项目名称:autokey,代码行数:17,代码来源:centralwidget.py

示例15: __removeItem

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AscendingOrder [as 别名]
def __removeItem(self, widgetItem):
        parent = widgetItem.parent()
        item = self.__extractData(widgetItem)
        self.__deleteHotkeys(item)

        if parent is None:
            removed_index = self.treeWidget.indexOfTopLevelItem(widgetItem)
            self.treeWidget.takeTopLevelItem(removed_index)
            self.configManager.folders.remove(item)
        else:
            removed_index = parent.indexOfChild(widgetItem)
            parent.removeChild(widgetItem)

            if isinstance(item, model.Folder):
                item.parent.remove_folder(item)
            else:
                item.parent.remove_item(item)

        item.remove_data()
        self.treeWidget.sortItems(0, Qt.AscendingOrder)

        if parent is not None:
            if parent.childCount() > 0:
                new_index = min((removed_index, parent.childCount() - 1))
                self.treeWidget.setCurrentItem(parent.child(new_index))
            else:
                self.treeWidget.setCurrentItem(parent)
        else:
            new_index = min((removed_index, self.treeWidget.topLevelItemCount() - 1))
            self.treeWidget.setCurrentItem(self.treeWidget.topLevelItem(new_index)) 
开发者ID:autokey,项目名称:autokey,代码行数:32,代码来源:centralwidget.py


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