def initialize_settings_page(self): self.window().settings_tab.initialize() connect(self.window().settings_tab.clicked_tab_button, self.clicked_tab_button) connect(self.window().settings_save_button.clicked, self.save_settings) connect(self.window().download_location_chooser_button.clicked, self.on_choose_download_dir_clicked) connect(self.window().watch_folder_chooser_button.clicked, self.on_choose_watch_dir_clicked) connect(self.window().channel_autocommit_checkbox.stateChanged, self.on_channel_autocommit_checkbox_changed) connect(self.window().family_filter_checkbox.stateChanged, self.on_family_filter_checkbox_changed) connect(self.window().developer_mode_enabled_checkbox.stateChanged, self.on_developer_mode_checkbox_changed) connect(self.window().use_monochrome_icon_checkbox.stateChanged, self.on_use_monochrome_icon_checkbox_changed) connect(self.window().download_settings_anon_checkbox.stateChanged, self.on_anon_download_state_changed) connect(self.window().log_location_chooser_button.clicked, self.on_choose_log_dir_clicked) checkbox_style = get_checkbox_style() for checkbox in [ self.window().family_filter_checkbox, self.window().channel_autocommit_checkbox, self.window().always_ask_location_checkbox, self.window().developer_mode_enabled_checkbox, self.window().use_monochrome_icon_checkbox, self.window().download_settings_anon_checkbox, self.window().download_settings_anon_seeding_checkbox, self.window().lt_utp_checkbox, self.window().watchfolder_enabled_checkbox, self.window().allow_exit_node_checkbox, self.window().developer_mode_enabled_checkbox, self.window().checkbox_enable_network_statistics, self.window().checkbox_enable_resource_log, self.window().download_settings_add_to_channel_checkbox, ]: checkbox.setStyleSheet(checkbox_style) self.update_stacked_widget_height()
def __init__(self, parent, download_uri): DialogContainer.__init__(self, parent) torrent_name = download_uri if torrent_name.startswith('file:'): torrent_name = torrent_name[5:] elif torrent_name.startswith('magnet:'): torrent_name = unquote_plus(torrent_name) self.download_uri = download_uri self.has_metainfo = False self.metainfo_fetch_timer = None self.metainfo_retries = 0 uic.loadUi(get_ui_file_path('startdownloaddialog.ui'), self.dialog_widget) self.dialog_widget.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Expanding) connect(self.dialog_widget.browse_dir_button.clicked, self.on_browse_dir_clicked) connect(self.dialog_widget.cancel_button.clicked, lambda _: self.button_clicked.emit(0)) connect(self.dialog_widget.download_button.clicked, self.on_download_clicked) connect(self.dialog_widget.select_all_files_button.clicked, self.on_all_files_selected_clicked) connect(self.dialog_widget.deselect_all_files_button.clicked, self.on_all_files_deselected_clicked) connect(self.dialog_widget.loading_files_label.clicked, self.on_reload_torrent_info) connect(self.dialog_widget.anon_download_checkbox.clicked, self.on_reload_torrent_info) self.dialog_widget.destination_input.setStyleSheet(""" QComboBox { background-color: #444; border: none; color: #C0C0C0; padding: 4px; } QComboBox::drop-down { width: 20px; border: 1px solid #999; border-radius: 2px; } QComboBox QAbstractItemView { selection-background-color: #707070; color: #C0C0C0; } QComboBox::down-arrow { width: 12px; height: 12px; image: url('%s'); } """ % get_image_path('down_arrow_input.png')) # self.dialog_widget.add_to_channel_checkbox.setStyleSheet(get_checkbox_style()) checkbox_style = get_checkbox_style() for checkbox in [ self.dialog_widget.add_to_channel_checkbox, self.dialog_widget.safe_seed_checkbox, self.dialog_widget.anon_download_checkbox, ]: checkbox.setStyleSheet(checkbox_style) if self.window().tribler_settings: # Set the most recent download locations in the QComboBox current_settings = get_gui_setting(self.window().gui_settings, "recent_download_locations", "") if len(current_settings) > 0: recent_locations = [ unhexlify(url).decode('utf-8') for url in current_settings.split(",") ] self.dialog_widget.destination_input.addItems(recent_locations) else: self.dialog_widget.destination_input.setCurrentText( self.window().tribler_settings['download_defaults'] ['saveas']) self.dialog_widget.torrent_name_label.setText(torrent_name) connect(self.dialog_widget.anon_download_checkbox.stateChanged, self.on_anon_download_state_changed) self.dialog_widget.anon_download_checkbox.setChecked( self.window().tribler_settings['download_defaults'] ['anonymity_enabled']) self.dialog_widget.safe_seed_checkbox.setChecked( self.window().tribler_settings['download_defaults'] ['safeseeding_enabled']) self.dialog_widget.add_to_channel_checkbox.setChecked( self.window().tribler_settings['download_defaults'] ['add_download_to_channel']) self.dialog_widget.safe_seed_checkbox.setEnabled( self.dialog_widget.anon_download_checkbox.isChecked()) self.perform_files_request() self.dialog_widget.files_list_view.setHidden(True) self.dialog_widget.download_files_container.setHidden(True) self.dialog_widget.adjustSize() self.on_anon_download_state_changed(None) self.on_main_window_resize() self.rest_request = None