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


Python Backend.populatecategorytreewidget方法代码示例

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


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

示例1: MainWindow

# 需要导入模块: from backend import Backend [as 别名]
# 或者: from backend.Backend import populatecategorytreewidget [as 别名]
class MainWindow(QMainWindow, Ui_ui_4ca):
    """Main Window implementation."""
    def __init__(self, parent=None):
        """Creates a new instance of MainWindow.
        @param parent Qt parent.
        """
        super(MainWindow, self).__init__(parent)
        self.setupUi(self)
        self._backend = Backend()
        self._setupforumstable()
        self._setupthreadstable()
        self._setuppoststabwidget()
        self._setuparchivetab()
        self._openthreads = {}
        self._masterobserver = BackendObserver(self._backend, self)
        self._resumeobservedthreads()
        self.buttonManualArchive.clicked.connect(self._archivethreadmanually)

    def _setuparchivetab(self):
        self._setupfilterwidgets()
        self._setuparchivedthreadstable()
        self._setuparchivedpoststable()
        self.buttonShowThreads.clicked.connect(self._showarchivedthreads)

    def _setupfilterwidgets(self):
        self.widgetDateTo.hide()
        self.frameCategoryFilter.hide()
        self.frameForumFilter.hide()
        self.frameDateFilter.hide()
        self.frameTagFilter.hide()
        self.checkCategoryFilter.stateChanged.connect(
                self._categoryfilterstatechanged)
        self.checkForumFilter.stateChanged.connect(
                self._forumfilterstatechanged)
        self.checkDateFilter.stateChanged.connect(
                self._datefiltervisibilitystatechanged)
        self.checkTagFilter.stateChanged.connect(
                self._tagfilterstatechanged)
        self.radioDateOlder.clicked.connect(self._datefilterstatechanged)
        self.radioDateNewer.clicked.connect(self._datefilterstatechanged)
        self.radioDateBetween.clicked.connect(self._datefilterstatechanged)
        self._populatecategorytreewidget()
        self._populatetagswidget()

    def _populatetagswidget(self):
        """Populates the QListWidget, that contains all available tags for tag
        filtering.
        """
        for tag in self._backend.tags():
            item = QListWidgetItem(tag[1], self.listTags)
            item.setFlags(Qt.ItemIsEnabled | Qt.ItemIsSelectable)
            item.setData(Qt.UserRole, tag[0])

    def _datefilterstatechanged(self):
        """The check state of one of the three date selection radio buttons
        has changed.
        """
        if self.radioDateBetween.isChecked():
            self.labelFrom.setText("From")
            self.widgetDateTo.show()
        else:
            self.widgetDateTo.hide()
            if self.radioDateOlder.isChecked():
                self.labelFrom.setText("Older Than")
            else:
                self.labelFrom.setText("Newer Than")

    def _populatecategorytreewidget(self):
        """Populates the QTreeWidget that shows the available categories for
        thread filtering.
        """
        self._backend.populatecategorytreewidget(self.treeCategory)
        self.treeCategory.expandAll()

    def _categoryfilterstatechanged(self, state):
        if state == Qt.Checked:
            self.frameCategoryFilter.show()
        else:
            self.frameCategoryFilter.hide()

    def _forumfilterstatechanged(self, state):
        if state == Qt.Checked:
            self.frameForumFilter.show()
        else:
            self.frameForumFilter.hide()

    def _datefiltervisibilitystatechanged(self, state):
        if state == Qt.Checked:
            self.frameDateFilter.show()
        else:
            self.frameDateFilter.hide()

    def _tagfilterstatechanged(self, state):
        if state == Qt.Checked:
            self.frameTagFilter.show()
        else:
            self.frameTagFilter.hide()

    def _setuparchivedpoststable(self):
        self.tableArchivedPosts.doubleClicked.connect(self._showarchivedpost)
#.........这里部分代码省略.........
开发者ID:Hydrael,项目名称:4ca,代码行数:103,代码来源:mainwindow.py


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