Пример #1
0
    def locale_combo_changed(self, index):
        selected_locale = self.locale_combo.currentData()
        locale_to_change = str(selected_locale)
        set_config_value('locale', locale_to_change)

        if selected_locale is None:
            preferred_locales = []

            system_locale = get_ui_locale()
            if system_locale is not None:
                preferred_locales.append(system_locale)

            negotiated_locale = Locale.negotiate(
                preferred_locales, get_available_locales(get_locale_path()))
            if negotiated_locale is None:
                locale_to_change = 'en'
            else:
                locale_to_change = str(negotiated_locale)

        self.app_locale = locale_to_change
        load_gettext_locale(get_locale_path(), locale_to_change)

        main_app = QApplication.instance()
        main_app.main_win.set_text()
        central_widget = main_app.main_win.central_widget
        main_tab = central_widget.main_tab
        game_dir_group_box = main_tab.game_dir_group_box
        update_group_box = main_tab.update_group_box

        game_dir_group_box.last_game_directory = None
        game_dir_group_box.game_directory_changed()

        update_group_box.refresh_builds()
Пример #2
0
def run_cddagl():
    load_gettext_no_locale()
    init_logging()
    init_exception_catcher()

    init_config(get_cddagl_path())

    start_ui(get_preferred_locale(get_available_locales(get_locale_path())),
             init_single_instance())
Пример #3
0
    def __init__(self):
        super(LauncherSettingsGroupBox, self).__init__()

        layout = QGridLayout()

        command_line_parameters_label = QLabel()
        layout.addWidget(command_line_parameters_label, 0, 0, Qt.AlignRight)
        self.command_line_parameters_label = command_line_parameters_label

        command_line_parameters_edit = QLineEdit()
        command_line_parameters_edit.setText(
            get_config_value('command.params', ''))
        command_line_parameters_edit.editingFinished.connect(self.clp_changed)
        layout.addWidget(command_line_parameters_edit, 0, 1)
        self.command_line_parameters_edit = command_line_parameters_edit

        keep_launcher_open_checkbox = QCheckBox()
        check_state = (Qt.Checked if config_true(
            get_config_value('keep_launcher_open', 'False')) else Qt.Unchecked)
        keep_launcher_open_checkbox.setCheckState(check_state)
        keep_launcher_open_checkbox.stateChanged.connect(self.klo_changed)
        layout.addWidget(keep_launcher_open_checkbox, 1, 0, 1, 2)
        self.keep_launcher_open_checkbox = keep_launcher_open_checkbox

        locale_group = QWidget()
        locale_group.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Maximum)
        locale_layout = QHBoxLayout()
        locale_layout.setContentsMargins(0, 0, 0, 0)

        locale_label = QLabel()
        locale_layout.addWidget(locale_label)
        self.locale_label = locale_label

        current_locale = get_config_value('locale', None)

        locale_combo = QComboBox()
        locale_combo.setSizeAdjustPolicy(QComboBox.AdjustToContents)
        locale_combo.addItem(
            _('System language or best match ({locale})').format(
                locale=get_ui_locale()), None)
        selected_index = 0
        for index, locale in enumerate(get_available_locales(
                get_locale_path())):
            if locale == current_locale:
                selected_index = index + 1
            locale = Locale.parse(locale)
            locale_name = locale.display_name
            english_name = locale.english_name
            if locale_name != english_name:
                formatted_name = f'{locale_name} - {english_name}'
            else:
                formatted_name = locale_name
            locale_combo.addItem(formatted_name, str(locale))
        locale_combo.setCurrentIndex(selected_index)
        locale_combo.currentIndexChanged.connect(self.locale_combo_changed)
        locale_layout.addWidget(locale_combo)
        self.locale_combo = locale_combo

        locale_group.setLayout(locale_layout)
        layout.addWidget(locale_group, 2, 0, 1, 2)
        self.locale_group = locale_group
        self.locale_layout = locale_layout

        allow_mul_insts_checkbox = QCheckBox()
        check_state = (Qt.Checked if config_true(
            get_config_value('allow_multiple_instances', 'False')) else
                       Qt.Unchecked)
        allow_mul_insts_checkbox.setCheckState(check_state)
        allow_mul_insts_checkbox.stateChanged.connect(self.ami_changed)
        layout.addWidget(allow_mul_insts_checkbox, 3, 0, 1, 2)
        self.allow_mul_insts_checkbox = allow_mul_insts_checkbox

        no_launcher_version_check_checkbox = QCheckBox()
        check_state = (Qt.Checked if config_true(
            get_config_value('prevent_version_check_launch', 'False')) else
                       Qt.Unchecked)
        no_launcher_version_check_checkbox.setCheckState(check_state)
        no_launcher_version_check_checkbox.stateChanged.connect(
            self.nlvcc_changed)
        layout.addWidget(no_launcher_version_check_checkbox, 4, 0, 1, 2)
        self.no_launcher_version_check_checkbox = (
            no_launcher_version_check_checkbox)

        self.setLayout(layout)
        self.set_text()