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


Python ConfirmationDialog.setParent方法代码示例

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


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

示例1: MyChannelPage

# 需要导入模块: from TriblerGUI.dialogs.confirmationdialog import ConfirmationDialog [as 别名]
# 或者: from TriblerGUI.dialogs.confirmationdialog.ConfirmationDialog import setParent [as 别名]

#.........这里部分代码省略.........

        self.my_channel_torrents_export_button = self.findChild(QToolButton, "my_channel_torrents_export_button")
        self.my_channel_torrents_export_button.clicked.connect(self.on_torrents_export_clicked)

        # Tab bar buttons
        self.channel_settings_tab = self.findChild(QWidget, "channel_settings_tab")
        self.channel_settings_tab.initialize()
        self.channel_settings_tab.clicked_tab_button.connect(self.clicked_tab_button)

        # add some dummy items to rss feeds list
        for i in range(0, 10):
            item = QTreeWidgetItem(self.my_channel_rss_feeds_list)
            item.setText(0, "http://fancyurl.com/rss_feed.xml")

            self.my_channel_rss_feeds_list.addTopLevelItem(item)

    def load_my_channel_overview(self):
        self.mychannel_request_mgr = TriblerRequestManager()
        self.mychannel_request_mgr.get_my_channel_overview(self.initialize_with_overview)

    def initialize_with_overview(self, overview):
        self.my_channel_overview = overview
        self.my_channel_name_label.setText(overview["name"])
        self.my_channel_description_label.setText(overview["description"])
        self.my_channel_identifier_label.setText(overview["identifier"])

        self.my_channel_name_input.setText(overview["name"])
        self.my_channel_description_input.setText(overview["description"])

    def load_my_channel_torrents(self):
        self.mychannel_request_mgr = TriblerRequestManager()
        self.mychannel_request_mgr.get_my_channel_torrents(self.initialize_with_torrents)

    def initialize_with_torrents(self, torrents):
        self.my_channel_torrents_list.clear()
        for torrent in torrents:
            item = QTreeWidgetItem(self.my_channel_torrents_list)
            item.setText(0, torrent["name"])
            item.setText(1, str(torrent["added"]))

            self.my_channel_torrents_list.addTopLevelItem(item)

    def load_my_channel_rss_feeds(self):
        self.mychannel_request_mgr = TriblerRequestManager()
        self.mychannel_request_mgr.get_my_channel_rss_feeds(self.initialize_with_rss_feeds)

    def initialize_with_rss_feeds(self, rss_feeds):
        self.my_channel_rss_feeds_list.clear()
        for feed in rss_feeds:
            item = QTreeWidgetItem(self.my_channel_rss_feeds_list)
            item.setText(0, feed["url"])

            self.my_channel_rss_feeds_list.addTopLevelItem(item)

    def on_torrents_remove_selected_clicked(self):
        num_selected = len(self.my_channel_torrents_list.selectedItems())
        if num_selected == 0:
            return

        self.dialog = ConfirmationDialog(self, "Remove %s selected torrents" % num_selected,
                    "Are you sure that you want to remove %s selected torrents from your channel?" % num_selected)
        self.dialog.button_clicked.connect(self.on_torrents_remove_selected_action)
        self.dialog.show()

    def on_torrents_remove_all_clicked(self):
        self.dialog = ConfirmationDialog(self.window(), "Remove all torrents",
                    "Are you sure that you want to remove all torrents from your channel? You cannot undo this action.")
        self.dialog.button_clicked.connect(self.on_torrents_remove_all_action)
        self.dialog.show()

    def on_torrents_export_clicked(self):
        selected_dir = QFileDialog.getExistingDirectory(self, "Choose a directory to export the torrent files to")
        # TODO Martijn: actually export the .torrent files

    def on_torrents_remove_selected_action(self, result):
        self.dialog.setParent(None)
        self.dialog = None

    def on_torrents_remove_all_action(self, result):
        self.dialog.setParent(None)
        self.dialog = None

    def clicked_tab_button(self, tab_button_name):
        if tab_button_name == "my_channel_overview_button":
            self.my_channel_details_stacked_widget.setCurrentIndex(PAGE_MY_CHANNEL_OVERVIEW)
        elif tab_button_name == "my_channel_settings_button":
            self.my_channel_details_stacked_widget.setCurrentIndex(PAGE_MY_CHANNEL_SETTINGS)
        elif tab_button_name == "my_channel_torrents_button":
            self.my_channel_details_stacked_widget.setCurrentIndex(PAGE_MY_CHANNEL_TORRENTS)
            self.load_my_channel_torrents()
        elif tab_button_name == "my_channel_playlists_button":
            self.my_channel_details_stacked_widget.setCurrentIndex(PAGE_MY_CHANNEL_PLAYLISTS)
        elif tab_button_name == "my_channel_rss_feeds_button":
            self.my_channel_details_stacked_widget.setCurrentIndex(PAGE_MY_CHANNEL_RSS_FEEDS)
            self.load_my_channel_rss_feeds()

    def on_create_channel_intro_button_clicked(self):
        self.create_channel_form.show()
        self.create_channel_intro_button_container.hide()
        self.create_new_channel_intro_label.setText("Please enter your channel details below.")
开发者ID:devos50,项目名称:TriblerGUI,代码行数:104,代码来源:mychannelpage.py


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