def __init__(self, parent: QWidget, infohash: str) -> None: DialogContainer.__init__(self, parent, left_right_margin=400) self.index: Optional[QModelIndex] = None self.infohash = infohash uic.loadUi(get_ui_file_path('add_tags_dialog.ui'), self.dialog_widget) self.dialog_widget.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Expanding) connect(self.dialog_widget.close_button.clicked, self.close_dialog) connect(self.dialog_widget.save_button.clicked, self.on_save_tags_button_clicked) connect(self.dialog_widget.edit_tags_input.enter_pressed, lambda: self.on_save_tags_button_clicked(None)) connect(self.dialog_widget.edit_tags_input.escape_pressed, self.close_dialog) self.dialog_widget.edit_tags_input.setFocus() self.dialog_widget.error_text_label.hide() self.dialog_widget.suggestions_container.hide() # Fetch suggestions TriblerNetworkRequest(f"tags/{infohash}/suggestions", self.on_received_suggestions) self.update_window()
def __init__(self, parent): DialogContainer.__init__(self, parent) uic.loadUi(get_ui_file_path('createtorrentdialog.ui'), self.dialog_widget) self.dialog_widget.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Expanding) connect(self.dialog_widget.btn_cancel.clicked, self.close_dialog) connect(self.dialog_widget.create_torrent_choose_files_button.clicked, self.on_choose_files_clicked) connect(self.dialog_widget.create_torrent_choose_dir_button.clicked, self.on_choose_dir_clicked) connect(self.dialog_widget.btn_create.clicked, self.on_create_clicked) connect( self.dialog_widget.create_torrent_files_list. customContextMenuRequested, self.on_right_click_file_item) self.dialog_widget.create_torrent_files_list.clear() connect(self.dialog_widget.save_directory_chooser.clicked, self.on_select_save_directory) self.dialog_widget.edit_channel_create_torrent_progress_label.setText( "") self.dialog_widget.file_export_dir.setText(os.path.expanduser("~")) self.dialog_widget.adjustSize() self.on_main_window_resize() self.name = None self.rest_request1 = None self.rest_request2 = None
def __init__(self, parent, title, main_text, buttons, show_input=False, checkbox_text=None): DialogContainer.__init__(self, parent) uic.loadUi(get_ui_file_path('buttonsdialog.ui'), self.dialog_widget) self.dialog_widget.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Expanding) self.dialog_widget.dialog_title_label.setText(title) self.dialog_widget.dialog_main_text_label.setText(main_text) self.dialog_widget.dialog_main_text_label.adjustSize() self.checkbox = self.dialog_widget.checkbox if not show_input: self.dialog_widget.dialog_input.setHidden(True) else: connect(self.dialog_widget.dialog_input.returnPressed, lambda: self.button_clicked.emit(0)) if not checkbox_text: self.dialog_widget.checkbox.setHidden(True) else: self.dialog_widget.checkbox.setText(checkbox_text) hspacer_left = QSpacerItem(1, 1, QSizePolicy.Expanding, QSizePolicy.Fixed) self.dialog_widget.dialog_button_container.layout().addSpacerItem(hspacer_left) self.buttons = [] for index in range(len(buttons)): self.create_button(index, *buttons[index]) hspacer_right = QSpacerItem(1, 1, QSizePolicy.Expanding, QSizePolicy.Fixed) self.dialog_widget.dialog_button_container.layout().addSpacerItem(hspacer_right) if hasattr(self.window(), 'escape_pressed'): connect(self.window().escape_pressed, self.close_dialog) self.on_main_window_resize()
def __init__(self, parent): DialogContainer.__init__(self, parent) uic.loadUi(get_ui_file_path('trustexplanation.ui'), self.dialog_widget) self.dialog_widget.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Expanding) self.dialog_widget.close_button.clicked.connect(self.close_dialog) self.update_window()
def __init__(self, parent): DialogContainer.__init__(self, parent) uic.loadUi(get_ui_file_path('addtochanneldialog.ui'), self.dialog_widget) self.dialog_widget.btn_cancel.clicked.connect(self.close_dialog) self.dialog_widget.btn_confirm.clicked.connect(self.on_confirm_clicked) self.dialog_widget.btn_new_channel.clicked.connect( self.on_create_new_channel_clicked) self.dialog_widget.btn_new_folder.clicked.connect( self.on_create_new_folder_clicked) self.confirm_clicked_callback = None self.root_requests_list = [] self.channels_tree = {} self.id2wt_mapping = {0: self.dialog_widget.channels_tree_wt} self.dialog_widget.channels_tree_wt.itemExpanded.connect( self.on_item_expanded) self.dialog_widget.channels_tree_wt.setHeaderLabels(['Name']) self.on_main_window_resize()
def __init__(self, parent, is_ask, asset1_type, asset2_type, wallets): DialogContainer.__init__(self, parent) self.is_ask = is_ask self.price = 0.0 self.price_type = asset2_type self.quantity = -1 self.quantity_type = asset1_type self.wallets = wallets # These asset amount values are only set when the order has been verified on the GUI side self.asset1_amount = 0 self.asset2_amount = 0 uic.loadUi(get_ui_file_path('newmarketorderdialog.ui'), self.dialog_widget) self.dialog_widget.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Expanding) self.dialog_widget.error_text_label.hide() if is_ask: self.dialog_widget.new_order_title_label.setText( 'Sell %s for %s' % (asset1_type, asset2_type)) else: self.dialog_widget.new_order_title_label.setText( 'Buy %s for %s' % (asset1_type, asset2_type)) self.dialog_widget.quantity_label.setText("Volume (%s):" % asset1_type) self.dialog_widget.price_label.setText("Price per unit (%s / %s):" % (asset2_type, asset1_type)) self.dialog_widget.create_button.clicked.connect( self.on_create_clicked) self.dialog_widget.cancel_button.clicked.connect( lambda: self.button_clicked.emit(0)) self.update_window()
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