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


Python ConfirmationDialog.show_message方法代码示例

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


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

示例1: on_rss_feeds_remove_selected_clicked

# 需要导入模块: from TriblerGUI.dialogs.confirmationdialog import ConfirmationDialog [as 别名]
# 或者: from TriblerGUI.dialogs.confirmationdialog.ConfirmationDialog import show_message [as 别名]
 def on_rss_feeds_remove_selected_clicked(self):
     if len(self.window().edit_channel_rss_feeds_list.selectedItems()) == 0:
         ConfirmationDialog.show_message(self, "Remove RSS Feeds",
                                         "Selection is empty. Please select the feeds to remove.", "OK")
         return
     self.dialog = ConfirmationDialog(self, "Remove RSS feed",
                                      "Are you sure you want to remove the selected RSS feed?",
                                      [('REMOVE', BUTTON_TYPE_NORMAL), ('CANCEL', BUTTON_TYPE_CONFIRM)])
     self.dialog.button_clicked.connect(self.on_rss_feed_dialog_removed)
     self.dialog.show()
开发者ID:synctext,项目名称:tribler,代码行数:12,代码来源:editchannelpage.py

示例2: on_browse_dir_clicked

# 需要导入模块: from TriblerGUI.dialogs.confirmationdialog import ConfirmationDialog [as 别名]
# 或者: from TriblerGUI.dialogs.confirmationdialog.ConfirmationDialog import show_message [as 别名]
    def on_browse_dir_clicked(self):
        chosen_dir = QFileDialog.getExistingDirectory(self.window(), "Please select the destination directory of your "
                                                                     "download", "", QFileDialog.ShowDirsOnly)

        if len(chosen_dir) != 0:
            self.dialog_widget.destination_input.setCurrentText(chosen_dir)

        is_writable, error = is_dir_writable(chosen_dir)
        if not is_writable:
            gui_error_message = "Tribler cannot download to <i>%s</i> directory. Please add proper write " \
                                "permissions to the directory or choose another download directory. [%s]" \
                                % (chosen_dir, error)
            ConfirmationDialog.show_message(self.dialog_widget, "Insufficient Permissions", gui_error_message, "OK")
开发者ID:synctext,项目名称:tribler,代码行数:15,代码来源:startdownloaddialog.py

示例3: on_choose_log_dir_clicked

# 需要导入模块: from TriblerGUI.dialogs.confirmationdialog import ConfirmationDialog [as 别名]
# 或者: from TriblerGUI.dialogs.confirmationdialog.ConfirmationDialog import show_message [as 别名]
    def on_choose_log_dir_clicked(self):
        previous_log_dir = self.window().log_location_input.text() or ""
        log_dir = QFileDialog.getExistingDirectory(self.window(), "Please select the log directory",
                                                   previous_log_dir, QFileDialog.ShowDirsOnly)

        if not log_dir or log_dir == previous_log_dir:
            return

        is_writable, error = is_dir_writable(log_dir)
        if not is_writable:
            gui_error_message = "<i>%s</i> is not writable. [%s]" % (log_dir, error)
            ConfirmationDialog.show_message(self.window(), "Insufficient Permissions", gui_error_message, "OK")
        else:
            self.window().log_location_input.setText(log_dir)
开发者ID:Tribler,项目名称:tribler,代码行数:16,代码来源:settingspage.py

示例4: on_download_clicked

# 需要导入模块: from TriblerGUI.dialogs.confirmationdialog import ConfirmationDialog [as 别名]
# 或者: from TriblerGUI.dialogs.confirmationdialog.ConfirmationDialog import show_message [as 别名]
 def on_download_clicked(self):
     if self.has_metainfo and len(self.get_selected_files()) == 0:  # User deselected all torrents
         ConfirmationDialog.show_error(self.window(), "No files selected",
                                       "Please select at least one file to download.")
     else:
         download_dir = self.dialog_widget.destination_input.currentText()
         is_writable, error = is_dir_writable(download_dir)
         if not is_writable:
             gui_error_message = "Tribler cannot download to <i>%s</i> directory. Please add proper write " \
                                 "permissions to the directory or choose another download directory and try " \
                                 "to download again. [%s]" % (download_dir, error)
             ConfirmationDialog.show_message(self.dialog_widget, "Insufficient Permissions", gui_error_message, "OK")
         else:
             self.button_clicked.emit(1)
开发者ID:synctext,项目名称:tribler,代码行数:16,代码来源:startdownloaddialog.py

示例5: perform_start_download_request

# 需要导入模块: from TriblerGUI.dialogs.confirmationdialog import ConfirmationDialog [as 别名]
# 或者: from TriblerGUI.dialogs.confirmationdialog.ConfirmationDialog import show_message [as 别名]
    def perform_start_download_request(self, uri, anon_download, safe_seeding, destination, selected_files,
                                       total_files=0, callback=None):
        # Check if destination directory is writable
        is_writable, error = is_dir_writable(destination)
        if not is_writable:
            gui_error_message = "Insufficient write permissions to <i>%s</i> directory. Please add proper " \
                                "write permissions on the directory and add the torrent again. %s" \
                                % (destination, error)
            ConfirmationDialog.show_message(self.window(), "Download error <i>%s</i>" % uri, gui_error_message, "OK")
            return

        selected_files_list = []
        if len(selected_files) != total_files:  # Not all files included
            selected_files_list = [filename for filename in selected_files]

        anon_hops = int(self.tribler_settings['download_defaults']['number_hops']) if anon_download else 0
        safe_seeding = 1 if safe_seeding else 0
        post_data = {
            "uri": uri,
            "anon_hops": anon_hops,
            "safe_seeding": safe_seeding,
            "destination": destination,
            "selected_files": selected_files_list
        }
        request_mgr = TriblerRequestManager()
        request_mgr.perform_request("downloads", callback if callback else self.on_download_added,
                                    method='PUT', data=post_data)

        # Save the download location to the GUI settings
        current_settings = get_gui_setting(self.gui_settings, "recent_download_locations", "")
        recent_locations = current_settings.split(",") if len(current_settings) > 0 else []
        if isinstance(destination, six.text_type):
            destination = destination.encode('utf-8')
        encoded_destination = hexlify(destination)
        if encoded_destination in recent_locations:
            recent_locations.remove(encoded_destination)
        recent_locations.insert(0, encoded_destination)

        if len(recent_locations) > 5:
            recent_locations = recent_locations[:5]

        self.gui_settings.setValue("recent_download_locations", ','.join(recent_locations))
开发者ID:Tribler,项目名称:tribler,代码行数:44,代码来源:tribler_window.py

示例6: perform_start_download_request

# 需要导入模块: from TriblerGUI.dialogs.confirmationdialog import ConfirmationDialog [as 别名]
# 或者: from TriblerGUI.dialogs.confirmationdialog.ConfirmationDialog import show_message [as 别名]
    def perform_start_download_request(self, uri, anon_download, safe_seeding, destination, selected_files,
                                       total_files=0, callback=None):
        # Check if destination directory is writable
        is_writable, error = is_dir_writable(destination)
        if not is_writable:
            gui_error_message = "Insufficient write permissions to <i>%s</i> directory. Please add proper " \
                                "write permissions on the directory and add the torrent again. %s" \
                                % (destination, error)
            ConfirmationDialog.show_message(self.window(), "Download error <i>%s</i>" % uri, gui_error_message, "OK")
            return

        selected_files_uri = ""
        if len(selected_files) != total_files:  # Not all files included
            selected_files_uri = u'&' + u''.join(u"selected_files[]=%s&" %
                                                 quote_plus_unicode(filename) for filename in selected_files)[:-1]

        anon_hops = int(self.tribler_settings['download_defaults']['number_hops']) if anon_download else 0
        safe_seeding = 1 if safe_seeding else 0
        post_data = "uri=%s&anon_hops=%d&safe_seeding=%d&destination=%s%s" % (quote_plus_unicode(uri), anon_hops,
                                                                              safe_seeding, destination,
                                                                              selected_files_uri)
        post_data = post_data.encode('utf-8')  # We need to send bytes in the request, not unicode

        request_mgr = TriblerRequestManager()
        request_mgr.perform_request("downloads", callback if callback else self.on_download_added,
                                    method='PUT', data=post_data)

        # Save the download location to the GUI settings
        current_settings = get_gui_setting(self.gui_settings, "recent_download_locations", "")
        recent_locations = current_settings.split(",") if len(current_settings) > 0 else []
        if isinstance(destination, unicode):
            destination = destination.encode('utf-8')
        encoded_destination = destination.encode('hex')
        if encoded_destination in recent_locations:
            recent_locations.remove(encoded_destination)
        recent_locations.insert(0, encoded_destination)

        if len(recent_locations) > 5:
            recent_locations = recent_locations[:5]

        self.gui_settings.setValue("recent_download_locations", ','.join(recent_locations))
开发者ID:synctext,项目名称:tribler,代码行数:43,代码来源:tribler_window.py


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