示例#1
0
    def on_update_timer_tick(self):
        total_duration_str = "-:--"
        if self.media and self.media.get_duration() != 0:
            total_duration_str = seconds_to_string(self.media.get_duration() / 1000)

        if self.active_infohash == "" or self.active_index == -1:
            self.window().video_player_position_slider.setValue(0)
            self.window().video_player_time_label.setText("0:00 / -:--")
        else:
            video_time = self.mediaplayer.get_time()
            if video_time == -1:
                video_time = 0

            self.window().video_player_position_slider.setValue(self.mediaplayer.get_position() * 1000)
            self.window().video_player_time_label.setText("%s / %s" %
                                                          (seconds_to_string(video_time / 1000), total_duration_str))
示例#2
0
    def initialize_with_settings(self, settings):
        # General settings
        self.nickname_input.setText(settings['general']['nickname'])
        self.download_location_input.setText(settings['Tribler']['saveas'])
        self.always_ask_location_checkbox.setChecked(settings['Tribler']['showsaveas'])
        self.download_settings_anon_checkbox.setChecked(settings['Tribler']['default_anonymity_enabled'])
        self.download_settings_anon_seeding_checkbox.setChecked(settings['Tribler']['default_safeseeding_enabled'])
        self.watchfolder_enabled_checkbox.setChecked(settings['watch_folder']['enabled'])
        self.watchfolder_location_input.setText(settings['watch_folder']['watch_folder_dir'])

        # Connection settings
        self.firewall_current_port_input.setText(str(settings['general']['minport']))
        self.lt_proxy_type_combobox.setCurrentIndex(settings['libtorrent']['lt_proxytype'])
        if settings['libtorrent']['lt_proxyserver']:
            self.lt_proxy_server_input = settings['libtorrent']['lt_proxyserver'][0]
            self.lt_proxy_port_input = settings['libtorrent']['lt_proxyserver'][1]
        if settings['libtorrent']['lt_proxyauth']:
            self.lt_proxy_username_input = settings['libtorrent']['lt_proxyauth'][0]
            self.lt_proxy_password_input = settings['libtorrent']['lt_proxyauth'][1]
        self.lt_utp_checkbox.setChecked(settings['libtorrent']['utp'])

        # Bandwidth settings
        self.upload_rate_limit_input.setText(str(settings['Tribler']['maxuploadrate']))
        self.download_rate_limit_input.setText(str(settings['Tribler']['maxdownloadrate']))

        # Seeding settings
        getattr(self, "seeding_" + settings['downloadconfig']['seeding_mode'] + "_radio").setChecked(True)
        self.seeding_time_input.setText(seconds_to_string(settings['downloadconfig']['seeding_time']))
        ind = self.seeding_ratio_combobox.findText(str(settings['downloadconfig']['seeding_ratio']))
        if ind != -1:
            self.seeding_ratio_combobox.setCurrentIndex(ind)

        # Anonymity settings
        self.allow_exit_node_checkbox.setChecked(settings['tunnel_community']['exitnode_enabled'])
        self.number_hops_slider.setValue(int(settings['Tribler']['default_number_hops']) - 1)
        self.multichain_enabled_checkbox.setChecked(settings['multichain']['enabled'])
示例#3
0
    def initialize_with_settings(self, settings):
        self.settings = settings
        settings = settings["settings"]
        gui_settings = self.window().gui_settings

        # General settings
        self.window().developer_mode_enabled_checkbox.setChecked(
            get_gui_setting(gui_settings, "debug", False, is_bool=True))
        self.window().family_filter_checkbox.setChecked(
            settings['general']['family_filter'])
        self.window().download_location_input.setText(
            settings['downloadconfig']['saveas'])
        self.window().always_ask_location_checkbox.setChecked(
            get_gui_setting(gui_settings,
                            "ask_download_settings",
                            True,
                            is_bool=True))
        self.window().download_settings_anon_checkbox.setChecked(
            get_gui_setting(gui_settings,
                            "default_anonymity_enabled",
                            True,
                            is_bool=True))
        self.window().download_settings_anon_seeding_checkbox.setChecked(
            get_gui_setting(gui_settings,
                            "default_safeseeding_enabled",
                            True,
                            is_bool=True))
        self.window().watchfolder_enabled_checkbox.setChecked(
            settings['watch_folder']['enabled'])
        self.window().watchfolder_location_input.setText(
            settings['watch_folder']['watch_folder_dir'])

        # Connection settings
        self.window().firewall_current_port_input.setText(
            str(settings['general']['minport']))
        self.window().lt_proxy_type_combobox.setCurrentIndex(
            settings['libtorrent']['lt_proxytype'])
        if settings['libtorrent']['lt_proxyserver']:
            self.window().lt_proxy_server_input.setText(
                settings['libtorrent']['lt_proxyserver'][0])
            self.window().lt_proxy_port_input.setText(
                settings['libtorrent']['lt_proxyserver'][1])
        if settings['libtorrent']['lt_proxyauth']:
            self.window().lt_proxy_username_input.setText(
                settings['libtorrent']['lt_proxyauth'][0])
            self.window().lt_proxy_password_input.setText(
                settings['libtorrent']['lt_proxyauth'][1])
        self.window().lt_utp_checkbox.setChecked(settings['libtorrent']['utp'])

        max_conn_download = settings['libtorrent']['max_connections_download']
        if max_conn_download == -1:
            max_conn_download = 0
        self.window().max_connections_download_input.setText(
            str(max_conn_download))

        # Bandwidth settings
        self.window().upload_rate_limit_input.setText(
            str(settings['Tribler']['maxuploadrate']))
        self.window().download_rate_limit_input.setText(
            str(settings['Tribler']['maxdownloadrate']))

        # Seeding settings
        getattr(
            self.window(),
            "seeding_" + settings['downloadconfig']['seeding_mode'] +
            "_radio").setChecked(True)
        self.window().seeding_time_input.setText(
            seconds_to_string(settings['downloadconfig']['seeding_time']))
        ind = self.window().seeding_ratio_combobox.findText(
            str(settings['downloadconfig']['seeding_ratio']))
        if ind != -1:
            self.window().seeding_ratio_combobox.setCurrentIndex(ind)

        # Anonymity settings
        self.window().allow_exit_node_checkbox.setChecked(
            settings['tunnel_community']['exitnode_enabled'])
        self.window().number_hops_slider.setValue(
            int(settings['Tribler']['default_number_hops']) - 1)
        self.window().multichain_enabled_checkbox.setChecked(
            settings['multichain']['enabled'])