def __init__(self, parent, is_ask, price_type, quantity_type): DialogContainer.__init__(self, parent) self.is_ask = is_ask self.price = -1 self.price_type = price_type self.quantity = -1 self.quantity_type = quantity_type 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' % (quantity_type, price_type)) else: self.dialog_widget.new_order_title_label.setText( 'Buy %s for %s' % (quantity_type, price_type)) self.dialog_widget.quantity_label.setText("Volume (%s):" % quantity_type) self.dialog_widget.price_label.setText("Price per unit (%s):" % price_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): QWidget.__init__(self, parent) uic.loadUi(get_ui_file_path('video_info_popup.ui'), self) self.setWindowFlags(Qt.Window | Qt.FramelessWindowHint) self.setAttribute(Qt.WA_TranslucentBackground)
def __init__(self, settings): QMainWindow.__init__(self) self.request_mgr = None self.cpu_plot = None self.memory_plot = None self.initialized_cpu_plot = False self.initialized_memory_plot = False self.cpu_plot_timer = None self.memory_plot_timer = None uic.loadUi(get_ui_file_path('debugwindow.ui'), self) self.setWindowTitle("Tribler debug pane") self.window().debug_tab_widget.setCurrentIndex(0) self.window().dispersy_tab_widget.setCurrentIndex(0) self.window().system_tab_widget.setCurrentIndex(0) self.window().debug_tab_widget.currentChanged.connect(self.tab_changed) self.window().dispersy_tab_widget.currentChanged.connect( self.dispersy_tab_changed) self.window().events_tree_widget.itemClicked.connect( self.on_event_clicked) self.window().system_tab_widget.currentChanged.connect( self.system_tab_changed) self.load_general_tab() self.window().open_files_tree_widget.header().setSectionResizeMode( 0, QHeaderView.Stretch) if not settings['trustchain']['enabled']: self.window().debug_tab_widget.setTabEnabled(2, False)
def __init__(self, parent, title, main_text, buttons, show_input=False): 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() if not show_input: self.dialog_widget.dialog_input.setHidden(True) else: self.dialog_widget.dialog_input.returnPressed.connect(lambda: self.button_clicked.emit(0)) 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) self.window().escape_pressed.connect(self.close_dialog) self.on_main_window_resize()
def __init__(self, parent, label_text=None): QWidget.__init__(self, parent) uic.loadUi(get_ui_file_path('text_list_item.ui'), self) if label_text is not None: self.textlabel.setText(label_text)
def __init__(self, parent, title, main_text, buttons, show_input=False): 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() if not show_input: self.dialog_widget.dialog_input.setHidden(True) else: self.dialog_widget.dialog_input.returnPressed.connect( lambda: self.button_clicked.emit(0)) 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) self.window().escape_pressed.connect(self.close_dialog) self.on_main_window_resize()
def __init__(self, parent, download_uri, torrent_name): DialogContainer.__init__(self, parent) self.download_uri = download_uri gui_settings = self.window().gui_settings uic.loadUi(get_ui_file_path('startdownloaddialog.ui'), self.dialog_widget) self.dialog_widget.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Expanding) self.dialog_widget.browse_dir_button.clicked.connect(self.on_browse_dir_clicked) self.dialog_widget.cancel_button.clicked.connect(lambda: self.button_clicked.emit(0)) self.dialog_widget.download_button.clicked.connect(lambda: self.button_clicked.emit(1)) if self.window().tribler_settings: self.dialog_widget.destination_input.setText(self.window().tribler_settings['downloadconfig']['saveas']) self.dialog_widget.torrent_name_label.setText(torrent_name) self.dialog_widget.safe_seed_checkbox.setChecked(get_gui_setting(gui_settings, "default_safeseeding_enabled", True, is_bool=True)) self.dialog_widget.anon_download_checkbox.setChecked(get_gui_setting(gui_settings, "default_anonymity_enabled", True, is_bool=True)) self.dialog_widget.safe_seed_checkbox.setEnabled(self.dialog_widget.anon_download_checkbox.isChecked()) self.dialog_widget.anon_download_checkbox.stateChanged.connect(self.on_anon_download_state_changed) self.perform_files_request() self.dialog_widget.files_list_view.setHidden(True) self.dialog_widget.adjustSize() self.on_main_window_resize()
def __init__(self, settings, tribler_version): self._logger = logging.getLogger(self.__class__.__name__) QMainWindow.__init__(self) self.request_mgr = None self.cpu_plot = None self.memory_plot = None self.initialized_cpu_plot = False self.initialized_memory_plot = False self.cpu_plot_timer = None self.memory_plot_timer = None self.tribler_version = tribler_version self.profiler_enabled = False self.toggling_profiler = False uic.loadUi(get_ui_file_path('debugwindow.ui'), self) self.setWindowTitle("Tribler debug pane") self.window().dump_memory_core_button.clicked.connect(lambda: self.on_memory_dump_button_clicked(True)) self.window().dump_memory_gui_button.clicked.connect(lambda: self.on_memory_dump_button_clicked(False)) self.window().toggle_profiler_button.clicked.connect(self.on_toggle_profiler_button_clicked) self.window().debug_tab_widget.setCurrentIndex(0) self.window().ipv8_tab_widget.setCurrentIndex(0) self.window().tunnel_tab_widget.setCurrentIndex(0) self.window().system_tab_widget.setCurrentIndex(0) self.window().debug_tab_widget.currentChanged.connect(self.tab_changed) self.window().ipv8_tab_widget.currentChanged.connect(self.ipv8_tab_changed) self.window().tunnel_tab_widget.currentChanged.connect(self.tunnel_tab_changed) self.window().events_tree_widget.itemClicked.connect(self.on_event_clicked) self.window().system_tab_widget.currentChanged.connect(self.system_tab_changed) self.load_general_tab() self.window().open_files_tree_widget.header().setSectionResizeMode(0, QHeaderView.Stretch) # Enable/disable tabs, based on settings self.window().debug_tab_widget.setTabEnabled(2, settings and settings['trustchain']['enabled']) self.window().debug_tab_widget.setTabEnabled(3, settings and settings['ipv8']['enabled']) self.window().system_tab_widget.setTabEnabled(3, settings and settings['resource_monitor']['enabled']) self.window().system_tab_widget.setTabEnabled(4, settings and settings['resource_monitor']['enabled']) # Refresh logs self.window().log_refresh_button.clicked.connect(lambda: self.load_logs_tab()) self.window().log_tab_widget.currentChanged.connect(lambda index: self.load_logs_tab()) # IPv8 statistics enabled? self.ipv8_statistics_enabled = settings['ipv8']['statistics'] # Libtorrent tab self.init_libtorrent_tab() # Position to center frame_geometry = self.frameGeometry() screen = QDesktopWidget().screenNumber(QDesktopWidget().cursor().pos()) center_point = QDesktopWidget().screenGeometry(screen).center() frame_geometry.moveCenter(center_point) self.move(frame_geometry.topLeft()) # Refresh timer self.refresh_timer = None
def __init__(self, parent, exception_text, tribler_version, start_time): QDialog.__init__(self, parent) uic.loadUi(get_ui_file_path('feedback_dialog.ui'), self) self.setWindowTitle("Unexpected error") self.selected_item_index = 0 self.tribler_version = tribler_version self.request_mgr = None # Qt 5.2 does not have the setPlaceholderText property if hasattr(self.comments_text_edit, "setPlaceholderText"): self.comments_text_edit.setPlaceholderText("Comments (optional)") def add_item_to_info_widget(key, value): item = QTreeWidgetItem(self.env_variables_list) item.setText(0, key) item.setText(1, value) self.error_text_edit.setPlainText(exception_text.rstrip()) self.cancel_button.clicked.connect(self.on_cancel_clicked) self.send_report_button.clicked.connect(self.on_send_clicked) # Add machine information to the tree widget add_item_to_info_widget('os.getcwd', '%s' % os.getcwd()) add_item_to_info_widget('sys.executable', '%s' % sys.executable) add_item_to_info_widget('os', os.name) add_item_to_info_widget('platform', sys.platform) add_item_to_info_widget('platform.details', platform.platform()) add_item_to_info_widget('platform.machine', platform.machine()) add_item_to_info_widget('python.version', sys.version) add_item_to_info_widget('indebug', str(__debug__)) add_item_to_info_widget('tribler_uptime', "%s" % (time.time() - start_time)) for argv in sys.argv: add_item_to_info_widget('sys.argv', '%s' % argv) for path in sys.path: add_item_to_info_widget('sys.path', '%s' % path) for key in os.environ.keys(): add_item_to_info_widget('os.environ', '%s: %s' % (key, os.environ[key])) request_ind = 1 for endpoint, method, data, timestamp, status_code in sorted( tribler_performed_requests.values(), key=lambda x: x[3])[-30:]: add_item_to_info_widget( 'request_%d' % request_ind, '%s %s %s (time: %s, code: %s)' % (endpoint, method, data, timestamp, status_code)) request_ind += 1 # Users can remove specific lines in the report self.env_variables_list.customContextMenuRequested.connect( self.on_right_click_item)
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, bank_name, required_input): DialogContainer.__init__(self, parent) self.required_input = required_input uic.loadUi(get_ui_file_path('iom_input_dialog.ui'), self.dialog_widget) self.dialog_widget.cancel_button.clicked.connect( lambda: self.button_clicked.emit(0)) self.dialog_widget.confirm_button.clicked.connect( lambda: self.button_clicked.emit(1)) if 'error_text' in required_input: self.dialog_widget.error_text_label.setText( required_input['error_text']) else: self.dialog_widget.error_text_label.hide() if 'image' in required_input['additional_data']: qimg = QImage() qimg.loadFromData( b64decode(required_input['additional_data']['image'])) image = QPixmap.fromImage(qimg) scene = QGraphicsScene(self.dialog_widget.img_graphics_view) scene.addPixmap(image) self.dialog_widget.img_graphics_view.setScene(scene) else: self.dialog_widget.img_graphics_view.hide() self.dialog_widget.iom_input_title_label.setText(bank_name) vlayout = QVBoxLayout() self.dialog_widget.user_input_container.setLayout(vlayout) self.input_widgets = {} for specific_input in self.required_input['required_fields']: label_widget = QLabel(self.dialog_widget.user_input_container) label_widget.setText(specific_input['text'] + ":") label_widget.show() vlayout.addWidget(label_widget) input_widget = QLineEdit(self.dialog_widget.user_input_container) input_widget.setPlaceholderText(specific_input['placeholder']) if specific_input['type'] == 'password': input_widget.setEchoMode(QLineEdit.Password) input_widget.show() vlayout.addWidget(input_widget) self.input_widgets[specific_input['name']] = input_widget self.dialog_widget.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Expanding) self.dialog_widget.adjustSize() self.on_main_window_resize()
def __init__(self, parent=None): QWidget.__init__(self, parent=parent) uic.loadUi(get_ui_file_path('torrents_list.ui'), self) self.model = None self.details_tab_widget = None self.details_tab_widget = self.findChild(TorrentDetailsTabWidget, "details_tab_widget") self.details_tab_widget.initialize_details_widget()
def __init__(self, settings, tribler_version): QMainWindow.__init__(self) self.request_mgr = None self.cpu_plot = None self.memory_plot = None self.initialized_cpu_plot = False self.initialized_memory_plot = False self.cpu_plot_timer = None self.memory_plot_timer = None self.tribler_version = tribler_version self.profiler_enabled = False self.toggling_profiler = False uic.loadUi(get_ui_file_path('debugwindow.ui'), self) self.setWindowTitle("Tribler debug pane") self.window().dump_memory_core_button.clicked.connect(lambda: self.on_memory_dump_button_clicked(True)) self.window().dump_memory_gui_button.clicked.connect(lambda: self.on_memory_dump_button_clicked(False)) self.window().toggle_profiler_button.clicked.connect(self.on_toggle_profiler_button_clicked) self.window().debug_tab_widget.setCurrentIndex(0) self.window().ipv8_tab_widget.setCurrentIndex(0) self.window().tunnel_tab_widget.setCurrentIndex(0) self.window().system_tab_widget.setCurrentIndex(0) self.window().debug_tab_widget.currentChanged.connect(self.tab_changed) self.window().ipv8_tab_widget.currentChanged.connect(self.ipv8_tab_changed) self.window().tunnel_tab_widget.currentChanged.connect(self.tunnel_tab_changed) self.window().events_tree_widget.itemClicked.connect(self.on_event_clicked) self.window().system_tab_widget.currentChanged.connect(self.system_tab_changed) self.load_general_tab() self.window().open_files_tree_widget.header().setSectionResizeMode(0, QHeaderView.Stretch) # Enable/disable tabs, based on settings self.window().debug_tab_widget.setTabEnabled(2, settings and settings['trustchain']['enabled']) self.window().debug_tab_widget.setTabEnabled(3, settings and settings['ipv8']['enabled']) self.window().system_tab_widget.setTabEnabled(3, settings and settings['resource_monitor']['enabled']) self.window().system_tab_widget.setTabEnabled(4, settings and settings['resource_monitor']['enabled']) # Refresh logs self.window().log_refresh_button.clicked.connect(lambda: self.load_logs_tab()) self.window().log_tab_widget.currentChanged.connect(lambda index: self.load_logs_tab()) # IPv8 statistics enabled? self.ipv8_statistics_enabled = settings['ipv8']['statistics'] # Position to center frame_geometry = self.frameGeometry() screen = QDesktopWidget().screenNumber(QDesktopWidget().cursor().pos()) center_point = QDesktopWidget().screenGeometry(screen).center() frame_geometry.moveCenter(center_point) self.move(frame_geometry.topLeft())
def __init__(self, parent, bank_name, required_input): DialogContainer.__init__(self, parent) self.required_input = required_input uic.loadUi(get_ui_file_path('iom_input_dialog.ui'), self.dialog_widget) self.dialog_widget.cancel_button.clicked.connect(lambda: self.button_clicked.emit(0)) self.dialog_widget.confirm_button.clicked.connect(lambda: self.button_clicked.emit(1)) if 'error_text' in required_input: self.dialog_widget.error_text_label.setText(required_input['error_text']) else: self.dialog_widget.error_text_label.hide() if 'image' in required_input['additional_data']: qimg = QImage() qimg.loadFromData(b64decode(required_input['additional_data']['image'])) image = QPixmap.fromImage(qimg) scene = QGraphicsScene(self.dialog_widget.img_graphics_view) scene.addPixmap(image) self.dialog_widget.img_graphics_view.setScene(scene) else: self.dialog_widget.img_graphics_view.hide() self.dialog_widget.iom_input_title_label.setText(bank_name) vlayout = QVBoxLayout() self.dialog_widget.user_input_container.setLayout(vlayout) self.input_widgets = {} for specific_input in self.required_input['required_fields']: label_widget = QLabel(self.dialog_widget.user_input_container) label_widget.setText(specific_input['text'] + ":") label_widget.show() vlayout.addWidget(label_widget) input_widget = QLineEdit(self.dialog_widget.user_input_container) input_widget.setPlaceholderText(specific_input['placeholder']) if specific_input['type'] == 'password': input_widget.setEchoMode(QLineEdit.Password) input_widget.show() vlayout.addWidget(input_widget) self.input_widgets[specific_input['name']] = input_widget self.dialog_widget.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Expanding) self.dialog_widget.adjustSize() self.on_main_window_resize()
def __init__(self, settings): QMainWindow.__init__(self) self.request_mgr = None self.cpu_plot = None self.memory_plot = None self.initialized_cpu_plot = False self.initialized_memory_plot = False self.cpu_plot_timer = None self.memory_plot_timer = None uic.loadUi(get_ui_file_path('debugwindow.ui'), self) self.setWindowTitle("Tribler debug pane") self.window().dump_memory_core_button.clicked.connect( lambda: self.on_memory_dump_button_clicked(True)) self.window().dump_memory_gui_button.clicked.connect( lambda: self.on_memory_dump_button_clicked(False)) self.window().debug_tab_widget.setCurrentIndex(0) self.window().dispersy_tab_widget.setCurrentIndex(0) self.window().system_tab_widget.setCurrentIndex(0) self.window().debug_tab_widget.currentChanged.connect(self.tab_changed) self.window().dispersy_tab_widget.currentChanged.connect( self.dispersy_tab_changed) self.window().events_tree_widget.itemClicked.connect( self.on_event_clicked) self.window().system_tab_widget.currentChanged.connect( self.system_tab_changed) self.load_general_tab() self.window().open_files_tree_widget.header().setSectionResizeMode( 0, QHeaderView.Stretch) if settings and not settings['multichain']['enabled']: self.window().debug_tab_widget.setTabEnabled(2, False) # Refresh logs self.window().log_refresh_button.clicked.connect( lambda: self.load_logs_tab()) self.window().log_tab_widget.currentChanged.connect( lambda index: self.load_logs_tab()) # Position to center frame_geometry = self.frameGeometry() screen = QDesktopWidget().screenNumber(QDesktopWidget().cursor().pos()) center_point = QDesktopWidget().screenGeometry(screen).center() frame_geometry.moveCenter(center_point) self.move(frame_geometry.topLeft())
def __init__(self): QMainWindow.__init__(self) self.request_mgr = None uic.loadUi(get_ui_file_path('debugwindow.ui'), self) self.setWindowTitle("Tribler debug pane") self.window().debug_tab_widget.setCurrentIndex(0) self.window().dispersy_tab_widget.setCurrentIndex(0) self.window().debug_tab_widget.currentChanged.connect(self.tab_changed) self.window().dispersy_tab_widget.currentChanged.connect( self.dispersy_tab_changed) self.window().events_tree_widget.itemClicked.connect( self.on_event_clicked) self.load_general_tab()
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, core_args=None, core_env=None, api_port=None): QMainWindow.__init__(self) QCoreApplication.setOrganizationDomain("nl") QCoreApplication.setOrganizationName("TUDelft") QCoreApplication.setApplicationName("Tribler") QCoreApplication.setAttribute(Qt.AA_UseHighDpiPixmaps) self.gui_settings = QSettings() api_port = api_port or int(get_gui_setting(self.gui_settings, "api_port", DEFAULT_API_PORT)) dispatcher.update_worker_settings(port=api_port) self.navigation_stack = [] self.tribler_started = False self.tribler_settings = None self.debug_window = None self.core_manager = CoreManager(api_port) self.pending_requests = {} self.pending_uri_requests = [] self.download_uri = None self.dialog = None self.new_version_dialog = None self.start_download_dialog_active = False self.request_mgr = None self.search_request_mgr = None self.search_suggestion_mgr = None self.selected_torrent_files = [] self.vlc_available = True self.has_search_results = False self.last_search_query = None self.last_search_time = None self.start_time = time.time() self.exception_handler_called = False self.token_refresh_timer = None self.shutdown_timer = None self.add_torrent_url_dialog_active = False sys.excepthook = self.on_exception uic.loadUi(get_ui_file_path('mainwindow.ui'), self) TriblerRequestManager.window = self self.tribler_status_bar.hide() self.token_balance_widget.mouseReleaseEvent = self.on_token_balance_click def on_state_update(new_state): self.loading_text_label.setText(new_state) self.core_manager.core_state_update.connect(on_state_update) self.magnet_handler = MagnetHandler(self.window) QDesktopServices.setUrlHandler("magnet", self.magnet_handler, "on_open_magnet_link") self.debug_pane_shortcut = QShortcut(QKeySequence("Ctrl+d"), self) self.debug_pane_shortcut.activated.connect(self.clicked_menu_button_debug) self.import_torrent_shortcut = QShortcut(QKeySequence("Ctrl+o"), self) self.import_torrent_shortcut.activated.connect(self.on_add_torrent_browse_file) self.add_torrent_url_shortcut = QShortcut(QKeySequence("Ctrl+i"), self) self.add_torrent_url_shortcut.activated.connect(self.on_add_torrent_from_url) # Remove the focus rect on OS X for widget in self.findChildren(QLineEdit) + self.findChildren(QListWidget) + self.findChildren(QTreeWidget): widget.setAttribute(Qt.WA_MacShowFocusRect, 0) self.menu_buttons = [self.left_menu_button_home, self.left_menu_button_search, self.left_menu_button_my_channel, self.left_menu_button_subscriptions, self.left_menu_button_video_player, self.left_menu_button_downloads, self.left_menu_button_discovered] self.video_player_page.initialize_player() self.search_results_page.initialize_search_results_page(self.gui_settings) self.settings_page.initialize_settings_page() self.subscribed_channels_page.initialize() self.edit_channel_page.initialize_edit_channel_page(self.gui_settings) self.downloads_page.initialize_downloads_page() self.home_page.initialize_home_page() self.loading_page.initialize_loading_page() self.discovering_page.initialize_discovering_page() self.discovered_page.initialize_discovered_page(self.gui_settings) self.channel_page.initialize_channel_page(self.gui_settings) self.trust_page.initialize_trust_page() self.token_mining_page.initialize_token_mining_page() self.stackedWidget.setCurrentIndex(PAGE_LOADING) # Create the system tray icon if QSystemTrayIcon.isSystemTrayAvailable(): self.tray_icon = QSystemTrayIcon() use_monochrome_icon = get_gui_setting(self.gui_settings, "use_monochrome_icon", False, is_bool=True) self.update_tray_icon(use_monochrome_icon) # Create the tray icon menu menu = self.create_add_torrent_menu() show_downloads_action = QAction('Show downloads', self) show_downloads_action.triggered.connect(self.clicked_menu_button_downloads) token_balance_action = QAction('Show token balance', self) token_balance_action.triggered.connect(lambda: self.on_token_balance_click(None)) quit_action = QAction('Quit Tribler', self) quit_action.triggered.connect(self.close_tribler) menu.addSeparator() menu.addAction(show_downloads_action) menu.addAction(token_balance_action) menu.addSeparator() menu.addAction(quit_action) self.tray_icon.setContextMenu(menu) else: self.tray_icon = None self.hide_left_menu_playlist() self.left_menu_button_debug.setHidden(True) self.top_menu_button.setHidden(True) self.left_menu.setHidden(True) self.token_balance_widget.setHidden(True) self.settings_button.setHidden(True) self.add_torrent_button.setHidden(True) self.top_search_bar.setHidden(True) # Set various icons self.top_menu_button.setIcon(QIcon(get_image_path('menu.png'))) self.search_completion_model = QStringListModel() completer = QCompleter() completer.setModel(self.search_completion_model) completer.setCompletionMode(QCompleter.UnfilteredPopupCompletion) self.item_delegate = QStyledItemDelegate() completer.popup().setItemDelegate(self.item_delegate) completer.popup().setStyleSheet(""" QListView { background-color: #404040; } QListView::item { color: #D0D0D0; padding-top: 5px; padding-bottom: 5px; } QListView::item:hover { background-color: #707070; } """) self.top_search_bar.setCompleter(completer) # Toggle debug if developer mode is enabled self.window().left_menu_button_debug.setHidden( not get_gui_setting(self.gui_settings, "debug", False, is_bool=True)) # Start Tribler self.core_manager.start(core_args=core_args, core_env=core_env) self.core_manager.events_manager.torrent_finished.connect(self.on_torrent_finished) self.core_manager.events_manager.new_version_available.connect(self.on_new_version_available) self.core_manager.events_manager.tribler_started.connect(self.on_tribler_started) self.core_manager.events_manager.events_started.connect(self.on_events_started) self.core_manager.events_manager.low_storage_signal.connect(self.on_low_storage) self.core_manager.events_manager.credit_mining_signal.connect(self.on_credit_mining_error) self.core_manager.events_manager.tribler_shutdown_signal.connect(self.on_tribler_shutdown_state_update) self.core_manager.events_manager.upgrader_tick.connect( lambda text: self.show_status_bar("Upgrading Tribler database: " + text)) self.core_manager.events_manager.upgrader_finished.connect( lambda _: self.hide_status_bar()) self.core_manager.events_manager.received_search_result.connect( self.search_results_page.received_search_result) # Install signal handler for ctrl+c events def sigint_handler(*_): self.close_tribler() signal.signal(signal.SIGINT, sigint_handler) self.installEventFilter(self.video_player_page) # Resize the window according to the settings center = QApplication.desktop().availableGeometry(self).center() pos = self.gui_settings.value("pos", QPoint(center.x() - self.width() * 0.5, center.y() - self.height() * 0.5)) size = self.gui_settings.value("size", self.size()) self.move(pos) self.resize(size) self.show()
def __init__(self, core_args=None, core_env=None, api_port=None): QMainWindow.__init__(self) QCoreApplication.setOrganizationDomain("nl") QCoreApplication.setOrganizationName("TUDelft") QCoreApplication.setApplicationName("Tribler") QCoreApplication.setAttribute(Qt.AA_UseHighDpiPixmaps) self.gui_settings = QSettings() api_port = api_port or int(get_gui_setting(self.gui_settings, "api_port", DEFAULT_API_PORT)) dispatcher.update_worker_settings(port=api_port) self.navigation_stack = [] self.tribler_started = False self.tribler_settings = None self.debug_window = None self.core_manager = CoreManager(api_port) self.pending_requests = {} self.pending_uri_requests = [] self.download_uri = None self.dialog = None self.new_version_dialog = None self.start_download_dialog_active = False self.request_mgr = None self.search_request_mgr = None self.search_suggestion_mgr = None self.selected_torrent_files = [] self.vlc_available = True self.has_search_results = False self.last_search_query = None self.last_search_time = None self.start_time = time.time() self.exception_handler_called = False self.token_refresh_timer = None sys.excepthook = self.on_exception uic.loadUi(get_ui_file_path('mainwindow.ui'), self) TriblerRequestManager.window = self self.tribler_status_bar.hide() # Load dynamic widgets uic.loadUi(get_ui_file_path('torrent_channel_list_container.ui'), self.channel_page_container) self.channel_torrents_list = self.channel_page_container.items_list self.channel_torrents_detail_widget = self.channel_page_container.details_tab_widget self.channel_torrents_detail_widget.initialize_details_widget() self.channel_torrents_list.itemSelectionChanged.connect(self.channel_page.clicked_item) uic.loadUi(get_ui_file_path('torrent_channel_list_container.ui'), self.search_page_container) self.search_results_list = self.search_page_container.items_list self.search_torrents_detail_widget = self.search_page_container.details_tab_widget self.search_torrents_detail_widget.initialize_details_widget() self.search_results_list.itemClicked.connect(self.on_channel_item_click) self.search_results_list.itemSelectionChanged.connect(self.search_results_page.clicked_item) self.token_balance_widget.mouseReleaseEvent = self.on_token_balance_click def on_state_update(new_state): self.loading_text_label.setText(new_state) self.core_manager.core_state_update.connect(on_state_update) self.magnet_handler = MagnetHandler(self.window) QDesktopServices.setUrlHandler("magnet", self.magnet_handler, "on_open_magnet_link") self.debug_pane_shortcut = QShortcut(QKeySequence("Ctrl+d"), self) self.debug_pane_shortcut.activated.connect(self.clicked_menu_button_debug) # Remove the focus rect on OS X for widget in self.findChildren(QLineEdit) + self.findChildren(QListWidget) + self.findChildren(QTreeWidget): widget.setAttribute(Qt.WA_MacShowFocusRect, 0) self.menu_buttons = [self.left_menu_button_home, self.left_menu_button_search, self.left_menu_button_my_channel, self.left_menu_button_subscriptions, self.left_menu_button_video_player, self.left_menu_button_downloads, self.left_menu_button_discovered] self.video_player_page.initialize_player() self.search_results_page.initialize_search_results_page() self.settings_page.initialize_settings_page() self.subscribed_channels_page.initialize() self.edit_channel_page.initialize_edit_channel_page() self.downloads_page.initialize_downloads_page() self.home_page.initialize_home_page() self.loading_page.initialize_loading_page() self.discovering_page.initialize_discovering_page() self.discovered_page.initialize_discovered_page() self.trust_page.initialize_trust_page() self.stackedWidget.setCurrentIndex(PAGE_LOADING) # Create the system tray icon if QSystemTrayIcon.isSystemTrayAvailable(): self.tray_icon = QSystemTrayIcon() use_monochrome_icon = get_gui_setting(self.gui_settings, "use_monochrome_icon", False, is_bool=True) self.update_tray_icon(use_monochrome_icon) # Create the tray icon menu menu = self.create_add_torrent_menu() show_downloads_action = QAction('Show downloads', self) show_downloads_action.triggered.connect(self.clicked_menu_button_downloads) token_balance_action = QAction('Show token balance', self) token_balance_action.triggered.connect(lambda: self.on_token_balance_click(None)) quit_action = QAction('Quit Tribler', self) quit_action.triggered.connect(self.close_tribler) menu.addSeparator() menu.addAction(show_downloads_action) menu.addAction(token_balance_action) menu.addSeparator() menu.addAction(quit_action) self.tray_icon.setContextMenu(menu) else: self.tray_icon = None self.hide_left_menu_playlist() self.left_menu_button_debug.setHidden(True) self.top_menu_button.setHidden(True) self.left_menu.setHidden(True) self.token_balance_widget.setHidden(True) self.settings_button.setHidden(True) self.add_torrent_button.setHidden(True) self.top_search_bar.setHidden(True) # Set various icons self.top_menu_button.setIcon(QIcon(get_image_path('menu.png'))) self.search_completion_model = QStringListModel() completer = QCompleter() completer.setModel(self.search_completion_model) completer.setCompletionMode(QCompleter.UnfilteredPopupCompletion) self.item_delegate = QStyledItemDelegate() completer.popup().setItemDelegate(self.item_delegate) completer.popup().setStyleSheet(""" QListView { background-color: #404040; } QListView::item { color: #D0D0D0; padding-top: 5px; padding-bottom: 5px; } QListView::item:hover { background-color: #707070; } """) self.top_search_bar.setCompleter(completer) # Toggle debug if developer mode is enabled self.window().left_menu_button_debug.setHidden( not get_gui_setting(self.gui_settings, "debug", False, is_bool=True)) # Start Tribler self.core_manager.start(core_args=core_args, core_env=core_env) self.core_manager.events_manager.received_search_result_channel.connect( self.search_results_page.received_search_result_channel) self.core_manager.events_manager.received_search_result_torrent.connect( self.search_results_page.received_search_result_torrent) self.core_manager.events_manager.torrent_finished.connect(self.on_torrent_finished) self.core_manager.events_manager.new_version_available.connect(self.on_new_version_available) self.core_manager.events_manager.tribler_started.connect(self.on_tribler_started) self.core_manager.events_manager.events_started.connect(self.on_events_started) self.core_manager.events_manager.low_storage_signal.connect(self.on_low_storage) # Install signal handler for ctrl+c events def sigint_handler(*_): self.close_tribler() signal.signal(signal.SIGINT, sigint_handler) self.installEventFilter(self.video_player_page) # Resize the window according to the settings center = QApplication.desktop().availableGeometry(self).center() pos = self.gui_settings.value("pos", QPoint(center.x() - self.width() * 0.5, center.y() - self.height() * 0.5)) size = self.gui_settings.value("size", self.size()) self.move(pos) self.resize(size) self.show()
from Tribler.Core.Modules.process_checker import ProcessChecker from TriblerGUI.tribler_action_menu import TriblerActionMenu from TriblerGUI.core_manager import CoreManager from TriblerGUI.debug_window import DebugWindow from TriblerGUI.defs import PAGE_SEARCH_RESULTS, \ PAGE_HOME, PAGE_EDIT_CHANNEL, PAGE_VIDEO_PLAYER, PAGE_DOWNLOADS, PAGE_SETTINGS, PAGE_SUBSCRIBED_CHANNELS, \ PAGE_CHANNEL_DETAILS, PAGE_PLAYLIST_DETAILS, BUTTON_TYPE_NORMAL, BUTTON_TYPE_CONFIRM, PAGE_LOADING, \ PAGE_DISCOVERING, PAGE_DISCOVERED, PAGE_TRUST, SHUTDOWN_WAITING_PERIOD, DEFAULT_API_PORT from TriblerGUI.dialogs.confirmationdialog import ConfirmationDialog from TriblerGUI.dialogs.feedbackdialog import FeedbackDialog from TriblerGUI.dialogs.startdownloaddialog import StartDownloadDialog from TriblerGUI.tribler_request_manager import request_queue, TriblerRequestManager, dispatcher from TriblerGUI.utilities import get_ui_file_path, get_image_path, get_gui_setting, is_dir_writable, quote_plus_unicode # Pre-load form UI classes fc_channel_torrent_list_item, _ = uic.loadUiType(get_ui_file_path('channel_torrent_list_item.ui')) fc_channel_list_item, _ = uic.loadUiType(get_ui_file_path('channel_list_item.ui')) fc_playlist_list_item, _ = uic.loadUiType(get_ui_file_path('playlist_list_item.ui')) fc_home_recommended_item, _ = uic.loadUiType(get_ui_file_path('home_recommended_item.ui')) fc_loading_list_item, _ = uic.loadUiType(get_ui_file_path('loading_list_item.ui')) class MagnetHandler(QObject): def __init__(self, window): QObject.__init__(self) self.window = window @pyqtSlot(QUrl) def on_open_magnet_link(self, url): self.window.start_download_from_uri(url)
def __init__(self, parent, exception_text, tribler_version, start_time): QDialog.__init__(self, parent) uic.loadUi(get_ui_file_path('feedback_dialog.ui'), self) self.setWindowTitle("Unexpected error") self.selected_item_index = 0 self.tribler_version = tribler_version self.request_mgr = None # Qt 5.2 does not have the setPlaceholderText property if hasattr(self.comments_text_edit, "setPlaceholderText"): self.comments_text_edit.setPlaceholderText("Comments (optional)") def add_item_to_info_widget(key, value): item = QTreeWidgetItem(self.env_variables_list) item.setText(0, key) item.setText(1, value) self.error_text_edit.setPlainText(exception_text.rstrip()) self.cancel_button.clicked.connect(self.on_cancel_clicked) self.send_report_button.clicked.connect(self.on_send_clicked) # Add machine information to the tree widget add_item_to_info_widget('os.getcwd', '%s' % os.getcwd()) add_item_to_info_widget('sys.executable', '%s' % sys.executable) add_item_to_info_widget('os', os.name) add_item_to_info_widget('platform', sys.platform) add_item_to_info_widget('platform.details', platform.platform()) add_item_to_info_widget('platform.machine', platform.machine()) add_item_to_info_widget('python.version', sys.version) add_item_to_info_widget('indebug', str(__debug__)) add_item_to_info_widget('tribler_uptime', "%s" % (time.time() - start_time)) for argv in sys.argv: add_item_to_info_widget('sys.argv', '%s' % argv) for path in sys.path: add_item_to_info_widget('sys.path', '%s' % path) for key in os.environ.keys(): add_item_to_info_widget('os.environ', '%s: %s' % (key, os.environ[key])) # Add recent requests to feedback dialog request_ind = 1 for endpoint, method, data, timestamp, status_code in sorted(tribler_performed_requests, key=lambda x: x[3])[-30:]: add_item_to_info_widget('request_%d' % request_ind, '%s %s %s (time: %s, code: %s)' % (endpoint, method, data, timestamp, status_code)) request_ind += 1 # Add recent events to feedback dialog events_ind = 1 for event, event_time in received_events[:30][::-1]: add_item_to_info_widget('event_%d' % events_ind, '%s (time: %s)' % (json.dumps(event), event_time)) events_ind += 1 # Users can remove specific lines in the report self.env_variables_list.customContextMenuRequested.connect(self.on_right_click_item)
def __init__(self): QMainWindow.__init__(self) self.navigation_stack = [] self.feedback_dialog_is_open = False self.tribler_started = False self.tribler_settings = None self.debug_window = None self.core_manager = CoreManager() self.pending_requests = {} self.pending_uri_requests = [] self.download_uri = None self.dialog = None self.start_download_dialog_active = False self.request_mgr = None self.search_request_mgr = None self.search_suggestion_mgr = None self.selected_torrent_files = [] self.vlc_available = True self.has_search_results = False self.start_time = time.time() sys.excepthook = self.on_exception uic.loadUi(get_ui_file_path('mainwindow.ui'), self) TriblerRequestManager.window = self self.tribler_status_bar.hide() self.magnet_handler = MagnetHandler(self.window) QDesktopServices.setUrlHandler("magnet", self.magnet_handler, "on_open_magnet_link") QCoreApplication.setOrganizationDomain("nl") QCoreApplication.setOrganizationName("TUDelft") QCoreApplication.setApplicationName("Tribler") QCoreApplication.setAttribute(Qt.AA_UseHighDpiPixmaps) self.read_settings() # Remove the focus rect on OS X for widget in self.findChildren(QLineEdit) + self.findChildren( QListWidget) + self.findChildren(QTreeWidget): widget.setAttribute(Qt.WA_MacShowFocusRect, 0) self.menu_buttons = [ self.left_menu_button_home, self.left_menu_button_search, self.left_menu_button_my_channel, self.left_menu_button_subscriptions, self.left_menu_button_video_player, self.left_menu_button_downloads, self.left_menu_button_discovered ] self.video_player_page.initialize_player() self.search_results_page.initialize_search_results_page() self.settings_page.initialize_settings_page() self.subscribed_channels_page.initialize() self.edit_channel_page.initialize_edit_channel_page() self.downloads_page.initialize_downloads_page() self.home_page.initialize_home_page() self.loading_page.initialize_loading_page() self.discovering_page.initialize_discovering_page() self.discovered_page.initialize_discovered_page() self.trust_page.initialize_trust_page() self.stackedWidget.setCurrentIndex(PAGE_LOADING) # Create the system tray icon if QSystemTrayIcon.isSystemTrayAvailable(): self.tray_icon = QSystemTrayIcon() use_monochrome_icon = get_gui_setting(self.gui_settings, "use_monochrome_icon", False, is_bool=True) self.update_tray_icon(use_monochrome_icon) self.hide_left_menu_playlist() self.left_menu_button_debug.setHidden(True) self.top_menu_button.setHidden(True) self.left_menu.setHidden(True) self.trust_button.setHidden(True) self.settings_button.setHidden(True) self.add_torrent_button.setHidden(True) self.top_search_bar.setHidden(True) # Set various icons self.top_menu_button.setIcon(QIcon(get_image_path('menu.png'))) self.search_completion_model = QStringListModel() completer = QCompleter() completer.setModel(self.search_completion_model) completer.setCompletionMode(QCompleter.UnfilteredPopupCompletion) self.item_delegate = QStyledItemDelegate() completer.popup().setItemDelegate(self.item_delegate) completer.popup().setStyleSheet(""" QListView { background-color: #404040; } QListView::item { color: #D0D0D0; padding-top: 5px; padding-bottom: 5px; } QListView::item:hover { background-color: #707070; } """) self.top_search_bar.setCompleter(completer) # Toggle debug if developer mode is enabled self.window().left_menu_button_debug.setHidden(not get_gui_setting( self.gui_settings, "debug", False, is_bool=True)) self.core_manager.start() self.core_manager.events_manager.received_search_result_channel.connect( self.search_results_page.received_search_result_channel) self.core_manager.events_manager.received_search_result_torrent.connect( self.search_results_page.received_search_result_torrent) self.core_manager.events_manager.torrent_finished.connect( self.on_torrent_finished) self.core_manager.events_manager.new_version_available.connect( self.on_new_version_available) self.core_manager.events_manager.tribler_started.connect( self.on_tribler_started) # Install signal handler for ctrl+c events def sigint_handler(*_): self.close_tribler() signal.signal(signal.SIGINT, sigint_handler) self.installEventFilter(self.video_player_page) self.show()
def __init__(self, parent): QWidget.__init__(self, parent) uic.loadUi(get_ui_file_path('torrent_details_container.ui'), self)
from TriblerGUI.debug_window import DebugWindow from TriblerGUI.defs import BUTTON_TYPE_CONFIRM, BUTTON_TYPE_NORMAL, DEFAULT_API_PORT, PAGE_CHANNEL_DETAILS, \ PAGE_DISCOVERED, PAGE_DISCOVERING, PAGE_DOWNLOADS, PAGE_EDIT_CHANNEL, PAGE_HOME, PAGE_LOADING, \ PAGE_SEARCH_RESULTS, PAGE_SETTINGS, PAGE_SUBSCRIBED_CHANNELS, PAGE_TRUST, PAGE_VIDEO_PLAYER, SHUTDOWN_WAITING_PERIOD from TriblerGUI.dialogs.confirmationdialog import ConfirmationDialog from TriblerGUI.dialogs.feedbackdialog import FeedbackDialog from TriblerGUI.dialogs.startdownloaddialog import StartDownloadDialog from TriblerGUI.tribler_action_menu import TriblerActionMenu from TriblerGUI.tribler_request_manager import TriblerRequestManager, dispatcher, request_queue from TriblerGUI.utilities import get_gui_setting, get_image_path, get_ui_file_path, is_dir_writable from TriblerGUI.widgets.triblertablecontrollers import sanitize_for_fts # Pre-load form UI classes fc_home_recommended_item, _ = uic.loadUiType( get_ui_file_path('home_recommended_item.ui')) fc_loading_list_item, _ = uic.loadUiType( get_ui_file_path('loading_list_item.ui')) class MagnetHandler(QObject): def __init__(self, window): QObject.__init__(self) self.window = window @pyqtSlot(QUrl) def on_open_magnet_link(self, url): self.window.start_download_from_uri(url) class TriblerWindow(QMainWindow):
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 uic.loadUi(get_ui_file_path('startdownloaddialog.ui'), self.dialog_widget) self.dialog_widget.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Expanding) self.dialog_widget.browse_dir_button.clicked.connect(self.on_browse_dir_clicked) self.dialog_widget.cancel_button.clicked.connect(lambda: self.button_clicked.emit(0)) self.dialog_widget.download_button.clicked.connect(self.on_download_clicked) self.dialog_widget.select_all_files_button.clicked.connect(self.on_all_files_selected_clicked) self.dialog_widget.deselect_all_files_button.clicked.connect(self.on_all_files_deselected_clicked) 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')) 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 = [url.decode('hex').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) self.dialog_widget.anon_download_checkbox.stateChanged.connect(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.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()
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 gui_settings = self.window().gui_settings uic.loadUi(get_ui_file_path('startdownloaddialog.ui'), self.dialog_widget) self.dialog_widget.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Expanding) self.dialog_widget.browse_dir_button.clicked.connect( self.on_browse_dir_clicked) self.dialog_widget.cancel_button.clicked.connect( lambda: self.button_clicked.emit(0)) self.dialog_widget.download_button.clicked.connect( self.on_download_clicked) self.dialog_widget.select_all_files_button.clicked.connect( self.on_all_files_selected_clicked) self.dialog_widget.deselect_all_files_button.clicked.connect( self.on_all_files_deselected_clicked) 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')) 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 = [ url.decode('hex') 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) self.dialog_widget.anon_download_checkbox.stateChanged.connect( 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.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()
from TriblerGUI.tribler_action_menu import TriblerActionMenu from TriblerGUI.core_manager import CoreManager from TriblerGUI.debug_window import DebugWindow from TriblerGUI.defs import PAGE_SEARCH_RESULTS, \ PAGE_HOME, PAGE_EDIT_CHANNEL, PAGE_VIDEO_PLAYER, PAGE_DOWNLOADS, PAGE_SETTINGS, PAGE_SUBSCRIBED_CHANNELS, \ PAGE_CHANNEL_DETAILS, PAGE_PLAYLIST_DETAILS, BUTTON_TYPE_NORMAL, BUTTON_TYPE_CONFIRM, PAGE_LOADING,\ PAGE_DISCOVERING, PAGE_DISCOVERED, PAGE_TRUST from TriblerGUI.dialogs.confirmationdialog import ConfirmationDialog from TriblerGUI.dialogs.feedbackdialog import FeedbackDialog from TriblerGUI.dialogs.startdownloaddialog import StartDownloadDialog from TriblerGUI.tribler_request_manager import TriblerRequestManager from TriblerGUI.utilities import get_ui_file_path, get_image_path, get_gui_setting # Pre-load form UI classes fc_channel_torrent_list_item, _ = uic.loadUiType( get_ui_file_path('channel_torrent_list_item.ui')) fc_channel_list_item, _ = uic.loadUiType( get_ui_file_path('channel_list_item.ui')) fc_playlist_list_item, _ = uic.loadUiType( get_ui_file_path('playlist_list_item.ui')) fc_home_recommended_item, _ = uic.loadUiType( get_ui_file_path('home_recommended_item.ui')) fc_loading_list_item, _ = uic.loadUiType( get_ui_file_path('loading_list_item.ui')) class MagnetHandler(QObject): def __init__(self, window): QObject.__init__(self) self.window = window
from TriblerGUI.core_manager import CoreManager from TriblerGUI.debug_window import DebugWindow from TriblerGUI.defs import BUTTON_TYPE_CONFIRM, BUTTON_TYPE_NORMAL, DEFAULT_API_PORT, PAGE_CHANNEL_DETAILS, \ PAGE_DISCOVERED, PAGE_DISCOVERING, PAGE_DOWNLOADS, PAGE_EDIT_CHANNEL, PAGE_HOME, PAGE_LOADING, \ PAGE_SEARCH_RESULTS, PAGE_SETTINGS, PAGE_SUBSCRIBED_CHANNELS, PAGE_TRUST, PAGE_VIDEO_PLAYER, SHUTDOWN_WAITING_PERIOD from TriblerGUI.dialogs.confirmationdialog import ConfirmationDialog from TriblerGUI.dialogs.feedbackdialog import FeedbackDialog from TriblerGUI.dialogs.startdownloaddialog import StartDownloadDialog from TriblerGUI.tribler_action_menu import TriblerActionMenu from TriblerGUI.tribler_request_manager import TriblerRequestManager, dispatcher, request_queue from TriblerGUI.utilities import get_gui_setting, get_image_path, get_ui_file_path, is_dir_writable from TriblerGUI.widgets.triblertablecontrollers import sanitize_for_fts # Pre-load form UI classes fc_home_recommended_item, _ = uic.loadUiType(get_ui_file_path('home_recommended_item.ui')) fc_loading_list_item, _ = uic.loadUiType(get_ui_file_path('loading_list_item.ui')) class MagnetHandler(QObject): def __init__(self, window): QObject.__init__(self) self.window = window @pyqtSlot(QUrl) def on_open_magnet_link(self, url): self.window.start_download_from_uri(url) class TriblerWindow(QMainWindow): resize_event = pyqtSignal()