Esempio n. 1
0
 def save(self):
     settings = Settings()
     settings.beginGroup(self.settings_section)
     settings.setValue('background color', self.background_color)
     settings.endGroup()
     if self.initial_color != self.background_color:
         self.settings_form.register_post_process('images_config_updated')
Esempio n. 2
0
 def save(self):
     """
     Save the screen settings
     """
     self._save_screen(self.current_screen)
     settings = Settings()
     screen_settings = {}
     for screen in self.screens:
         screen_settings[screen.number] = screen.to_dict()
     settings.setValue('core/screens', screen_settings)
Esempio n. 3
0
 def save(self):
     """
     Save the Dialog settings
     """
     settings = Settings()
     settings.beginGroup(self.settings_section)
     settings.setValue('display footer', self.display_footer)
     settings.setValue('add custom from service', self.update_load)
     settings.endGroup()
     if self.tab_visited:
         self.settings_form.register_post_process('custom_config_updated')
     self.tab_visited = False
Esempio n. 4
0
def settings(qapp, registry):
    """A Settings() instance"""
    fd, ini_file = mkstemp('.ini')
    Settings.set_filename(ini_file)
    Settings().setDefaultFormat(QtCore.QSettings.IniFormat)
    # Needed on windows to make sure a Settings object is available during the tests
    sets = Settings()
    sets.setValue('themes/global theme', 'my_theme')
    Registry().register('settings', sets)
    yield sets
    del sets
    os.close(fd)
    os.unlink(Settings().fileName())
Esempio n. 5
0
 def save(self):
     """
     Save the settings
     """
     settings = Settings()
     settings.beginGroup(self.settings_section)
     settings.setValue('background color', self.background_color)
     settings.endGroup()
     old_players, override_player = get_media_players()
     if self.used_players != old_players:
         # clean old Media stuff
         set_media_players(self.used_players, override_player)
         self.settings_form.register_post_process('mediaitem_suffix_reset')
         self.settings_form.register_post_process('mediaitem_media_rebuild')
         self.settings_form.register_post_process('config_screen_changed')
Esempio n. 6
0
 def save(self):
     """
     Save the widget data to the settings
     """
     settings = Settings()  # TODO: Migrate from old system
     settings.setValue('advanced/proxy mode', self.radio_group.checkedId())
     settings.setValue('advanced/proxy http', self.http_edit.text())
     settings.setValue('advanced/proxy https', self.https_edit.text())
     settings.setValue('advanced/proxy username', self.username_edit.text())
     settings.setValue('advanced/proxy password', self.password_edit.text())
Esempio n. 7
0
 def save(self):
     """
     Save the shortcuts. **Note**, that we do not have to load the shortcuts, as they are loaded in
     :class:`~openlp.core.utils.ActionList`.
     """
     settings = Settings()
     settings.beginGroup('shortcuts')
     for category in self.action_list.categories:
         # Check if the category is for internal use only.
         if category.name is None:
             continue
         for action in category.actions:
             if action in self.changed_actions:
                 old_shortcuts = list(map(self.get_shortcut_string, action.shortcuts()))
                 action.setShortcuts(self.changed_actions[action])
                 self.action_list.update_shortcut_map(action, old_shortcuts)
             settings.setValue(action.objectName(), action.shortcuts())
     settings.endGroup()
Esempio n. 8
0
 def save_options(self):
     """
     Save the settings and close the dialog.
     """
     # Save the settings for this dialog.
     settings = Settings()
     settings.beginGroup('advanced')
     settings.setValue('print slide text', self.slide_text_check_box.isChecked())
     settings.setValue('add page break', self.page_break_after_text.isChecked())
     settings.setValue('print file meta data', self.meta_data_check_box.isChecked())
     settings.setValue('print notes', self.notes_check_box.isChecked())
     settings.endGroup()
Esempio n. 9
0
 def display_size_changed(self, display):
     """
     The Zoom Combo box has changed so set up the size.
     """
     if display == ZoomSize.Page:
         self.preview_widget.fitInView()
     elif display == ZoomSize.Width:
         self.preview_widget.fitToWidth()
     elif display == ZoomSize.OneHundred:
         self.preview_widget.fitToWidth()
         self.preview_widget.zoomIn(1)
     elif display == ZoomSize.SeventyFive:
         self.preview_widget.fitToWidth()
         self.preview_widget.zoomIn(0.75)
     elif display == ZoomSize.Fifty:
         self.preview_widget.fitToWidth()
         self.preview_widget.zoomIn(0.5)
     elif display == ZoomSize.TwentyFive:
         self.preview_widget.fitToWidth()
         self.preview_widget.zoomIn(0.25)
     settings = Settings()
     settings.beginGroup('advanced')
     settings.setValue('display size', display)
     settings.endGroup()
Esempio n. 10
0
 def save(self):
     """
     Save the settings
     """
     settings = Settings()
     settings.beginGroup(self.settings_section)
     settings.setValue('theme level', self.theme_level)
     settings.setValue('global theme', self.global_theme)
     settings.setValue('wrap footer',
                       self.wrap_footer_check_box.isChecked())
     settings.endGroup()
     self.renderer.set_theme_level(self.theme_level)
     if self.tab_visited:
         self.settings_form.register_post_process('theme_update_global')
     self.tab_visited = False
Esempio n. 11
0
 def save(self):
     """
     Save the settings from the form
     """
     settings = Settings()
     settings.beginGroup(self.settings_section)
     settings.setValue('monitor', self.monitor_combo_box.currentIndex())
     settings.setValue('display on monitor',
                       self.display_on_monitor_check.isChecked())
     settings.setValue('blank warning', self.warning_check_box.isChecked())
     settings.setValue('auto open', self.auto_open_check_box.isChecked())
     settings.setValue('show splash',
                       self.show_splash_check_box.isChecked())
     settings.setValue('logo background color', self.logo_background_color)
     settings.setValue('logo file', self.logo_file_path_edit.path)
     settings.setValue('logo hide on startup',
                       self.logo_hide_on_startup_check_box.isChecked())
     settings.setValue('update check',
                       self.check_for_updates_check_box.isChecked())
     settings.setValue('save prompt',
                       self.save_check_service_check_box.isChecked())
     settings.setValue('auto unblank',
                       self.auto_unblank_check_box.isChecked())
     settings.setValue(
         'click live slide to unblank',
         self.click_live_slide_to_unblank_check_box.isChecked())
     settings.setValue('auto preview',
                       self.auto_preview_check_box.isChecked())
     settings.setValue('loop delay', self.timeout_spin_box.value())
     settings.setValue('ccli number', self.number_edit.displayText())
     settings.setValue('songselect username',
                       self.username_edit.displayText())
     settings.setValue('songselect password',
                       self.password_edit.displayText())
     settings.setValue('x position', self.custom_X_value_edit.value())
     settings.setValue('y position', self.custom_Y_value_edit.value())
     settings.setValue('height', self.custom_height_value_edit.value())
     settings.setValue('width', self.custom_width_value_edit.value())
     settings.setValue('override position',
                       self.override_radio_button.isChecked())
     settings.setValue('audio start paused',
                       self.start_paused_check_box.isChecked())
     settings.setValue('audio repeat list',
                       self.repeat_list_check_box.isChecked())
     settings.endGroup()
     # On save update the screens as well
     self.post_set_up(True)
Esempio n. 12
0
 def save(self):
     """
     Save the settings from the form
     """
     settings = Settings()
     settings.beginGroup(self.settings_section)
     settings.setValue('blank warning', self.warning_check_box.isChecked())
     settings.setValue('auto open', self.auto_open_check_box.isChecked())
     settings.setValue('show splash',
                       self.show_splash_check_box.isChecked())
     settings.setValue('logo background color', self.logo_background_color)
     settings.setValue('logo file', self.logo_file_path_edit.path)
     settings.setValue('logo hide on startup',
                       self.logo_hide_on_startup_check_box.isChecked())
     settings.setValue('update check',
                       self.check_for_updates_check_box.isChecked())
     settings.setValue('save prompt',
                       self.save_check_service_check_box.isChecked())
     settings.setValue('auto unblank',
                       self.auto_unblank_check_box.isChecked())
     settings.setValue(
         'click live slide to unblank',
         self.click_live_slide_to_unblank_check_box.isChecked())
     settings.setValue('auto preview',
                       self.auto_preview_check_box.isChecked())
     settings.setValue('loop delay', self.timeout_spin_box.value())
     settings.setValue('ccli number', self.number_edit.displayText())
     settings.setValue('songselect username',
                       self.username_edit.displayText())
     settings.setValue('songselect password',
                       self.password_edit.displayText())
     settings.endGroup()
     self.post_set_up()
Esempio n. 13
0
 def save(self):
     """
     Save the changes on exit of the Settings dialog.
     """
     settings = Settings()
     settings.beginGroup(self.settings_section)
     # Check value has changed as no event handles this field
     if settings.value(
             'location') != self.vertical_combo_box.currentIndex():
         self.changed = True
     settings.setValue('background color', self.background_color)
     settings.setValue('font color', self.font_color)
     settings.setValue('font size', self.font_size)
     self.font_face = self.font_combo_box.currentFont().family()
     settings.setValue('font face', self.font_face)
     settings.setValue('timeout', self.timeout)
     self.location = self.vertical_combo_box.currentIndex()
     settings.setValue('location', self.location)
     settings.endGroup()
     if self.changed:
         self.settings_form.register_post_process('update_display_css')
     self.changed = False
Esempio n. 14
0
 def save(self):
     settings = Settings()
     settings.beginGroup(self.settings_section)
     settings.setValue('display songbar', self.tool_bar)
     settings.setValue('update service on edit', self.update_edit)
     settings.setValue('add song from service', self.update_load)
     settings.setValue('display songbook', self.display_songbook)
     settings.setValue('display written by', self.display_written_by)
     settings.setValue('display copyright symbol', self.display_copyright_symbol)
     settings.setValue('enable chords', self.chords_group_box.isChecked())
     settings.setValue('mainview chords', self.mainview_chords)
     settings.setValue('disable chords import', self.disable_chords_import)
     settings.setValue('chord notation', self.chord_notation)
     settings.setValue('add songbook slide', self.songbook_slide)
     settings.endGroup()
     if self.tab_visited:
         self.settings_form.register_post_process('songs_config_updated')
     self.tab_visited = False
Esempio n. 15
0
 def save(self):
     """
     Save settings to disk.
     """
     settings = Settings()
     settings.beginGroup(self.settings_section)
     settings.setValue('default service enabled',
                       self.service_name_check_box.isChecked())
     service_name = self.service_name_edit.text()
     preset_is_valid = self.generate_service_name_example()[0]
     if service_name == UiStrings(
     ).DefaultServiceName or not preset_is_valid:
         settings.remove('default service name')
         self.service_name_edit.setText(service_name)
     else:
         settings.setValue('default service name', service_name)
     settings.setValue('default service day',
                       self.service_name_day.currentIndex())
     settings.setValue('default service hour',
                       self.service_name_time.time().hour())
     settings.setValue('default service minute',
                       self.service_name_time.time().minute())
     settings.setValue('recent file count', self.recent_spin_box.value())
     settings.setValue('save current plugin',
                       self.media_plugin_check_box.isChecked())
     settings.setValue('double click live',
                       self.double_click_live_check_box.isChecked())
     settings.setValue('single click preview',
                       self.single_click_preview_check_box.isChecked())
     settings.setValue(
         'single click service preview',
         self.single_click_service_preview_check_box.isChecked())
     settings.setValue('expand service item',
                       self.expand_service_item_check_box.isChecked())
     slide_max_height_index = self.slide_max_height_combo_box.currentIndex()
     slide_max_height_value = self.slide_max_height_combo_box.itemData(
         slide_max_height_index)
     settings.setValue('slide max height', slide_max_height_value)
     settings.setValue(
         'autoscrolling',
         self.autoscroll_map[self.autoscroll_combo_box.currentIndex()])
     settings.setValue('experimental',
                       self.experimental_check_box.isChecked())
     settings.setValue('enable exit confirmation',
                       self.enable_auto_close_check_box.isChecked())
     settings.setValue('hide mouse', self.hide_mouse_check_box.isChecked())
     settings.setValue('alternate rows',
                       self.alternate_rows_check_box.isChecked())
     settings.setValue('slide limits', self.slide_limits)
     settings.setValue('ignore aspect ratio',
                       self.ignore_aspect_ratio_check_box.isChecked())
     if self.x11_bypass_check_box.isChecked() != settings.value(
             'x11 bypass wm'):
         settings.setValue('x11 bypass wm',
                           self.x11_bypass_check_box.isChecked())
         self.settings_form.register_post_process('config_screen_changed')
     self.settings_form.register_post_process(
         'slidecontroller_update_slide_limits')
     settings.setValue('search as type', self.is_search_as_you_type_enabled)
     if HAS_DARK_STYLE:
         settings.setValue('use_dark_style',
                           self.use_dark_style_checkbox.isChecked())
     settings.endGroup()
     self.proxy_widget.save()
Esempio n. 16
0
def main(args=None):
    """
    The main function which parses command line options and then runs

    :param args: Some args
    """
    args = parse_options(args)
    qt_args = []
    if args and args.loglevel.lower() in ['d', 'debug']:
        log.setLevel(logging.DEBUG)
    elif args and args.loglevel.lower() in ['w', 'warning']:
        log.setLevel(logging.WARNING)
    else:
        log.setLevel(logging.INFO)
    # Throw the rest of the arguments at Qt, just in case.
    qt_args.extend(args.rargs)
    # Bug #1018855: Set the WM_CLASS property in X11
    if not is_win() and not is_macosx():
        qt_args.append('OpenLP')
    # Initialise the resources
    qInitResources()
    # Now create and actually run the application.
    application = OpenLP(qt_args)
    application.setOrganizationName('OpenLP')
    application.setOrganizationDomain('openlp.org')
    application.setAttribute(QtCore.Qt.AA_UseHighDpiPixmaps, True)
    application.setAttribute(QtCore.Qt.AA_DontCreateNativeWidgetSiblings, True)
    if args.portable:
        application.setApplicationName('OpenLPPortable')
        Settings.setDefaultFormat(Settings.IniFormat)
        # Get location OpenLPPortable.ini
        portable_path = (AppLocation.get_directory(AppLocation.AppDir) / '..' /
                         '..').resolve()
        data_path = portable_path / 'Data'
        set_up_logging(portable_path / 'Other')
        log.info('Running portable')
        portable_settings_path = data_path / 'OpenLP.ini'
        # Make this our settings file
        log.info('INI file: {name}'.format(name=portable_settings_path))
        Settings.set_filename(str(portable_settings_path))
        portable_settings = Settings()
        # Set our data path
        log.info('Data path: {name}'.format(name=data_path))
        # Point to our data path
        portable_settings.setValue('advanced/data path', data_path)
        portable_settings.setValue('advanced/is portable', True)
        portable_settings.sync()
    else:
        application.setApplicationName('OpenLP')
        set_up_logging(AppLocation.get_directory(AppLocation.CacheDir))
    Registry.create()
    Registry().register('application', application)
    Registry().set_flag('no_web_server', args.no_web_server)
    application.setApplicationVersion(get_version()['version'])
    # Check if an instance of OpenLP is already running. Quit if there is a running instance and the user only wants one
    server = Server()
    if server.is_another_instance_running():
        application.is_already_running()
        server.post_to_server(qt_args)
        sys.exit()
    else:
        server.start_server()
        application.server = server
    # If the custom data path is missing and the user wants to restore the data path, quit OpenLP.
    if application.is_data_path_missing():
        server.close_server()
        sys.exit()
    # Upgrade settings.
    settings = Settings()
    if settings.can_upgrade():
        now = datetime.now()
        # Only back up if OpenLP has previously run.
        if settings.value('core/has run wizard'):
            back_up_path = AppLocation.get_data_path() / (
                now.strftime('%Y-%m-%d %H-%M') + '.conf')
            log.info(
                'Settings about to be upgraded. Existing settings are being backed up to {back_up_path}'
                .format(back_up_path=back_up_path))
            QtWidgets.QMessageBox.information(
                None, translate('OpenLP', 'Settings Upgrade'),
                translate(
                    'OpenLP',
                    'Your settings are about to be upgraded. A backup will be created at '
                    '{back_up_path}').format(back_up_path=back_up_path))
            settings.export(back_up_path)
        settings.upgrade_settings()
    # First time checks in settings
    if not Settings().value('core/has run wizard'):
        if not FirstTimeLanguageForm().exec():
            # if cancel then stop processing
            server.close_server()
            sys.exit()
    # i18n Set Language
    language = LanguageManager.get_language()
    translators = LanguageManager.get_translators(language)
    for translator in translators:
        if not translator.isEmpty():
            application.installTranslator(translator)
    if not translators:
        log.debug('Could not find translators.')
    if args and not args.no_error_form:
        sys.excepthook = application.hook_exception
    sys.exit(application.run(qt_args))
Esempio n. 17
0
 def save(self):
     settings = Settings()
     settings.beginGroup(self.settings_section)
     settings.setValue('is verse number visible',
                       self.is_verse_number_visible)
     settings.setValue('display new chapter', self.show_new_chapters)
     settings.setValue('display brackets', self.display_style)
     settings.setValue('verse layout style', self.layout_style)
     settings.setValue('second bibles', self.second_bibles)
     settings.setValue('bible theme', self.bible_theme)
     if self.verse_separator_check_box.isChecked():
         settings.setValue('verse separator',
                           self.verse_separator_line_edit.text())
     else:
         settings.remove('verse separator')
     if self.range_separator_check_box.isChecked():
         settings.setValue('range separator',
                           self.range_separator_line_edit.text())
     else:
         settings.remove('range separator')
     if self.list_separator_check_box.isChecked():
         settings.setValue('list separator',
                           self.list_separator_line_edit.text())
     else:
         settings.remove('list separator')
     if self.end_separator_check_box.isChecked():
         settings.setValue('end separator',
                           self.end_separator_line_edit.text())
     else:
         settings.remove('end separator')
     update_reference_separators()
     if self.language_selection != settings.value('book name language'):
         settings.setValue('book name language', self.language_selection)
         self.settings_form.register_post_process('bibles_load_list')
     settings.setValue('reset to combined quick search',
                       self.reset_to_combined_quick_search)
     settings.setValue('hide combined quick error',
                       self.hide_combined_quick_error)
     settings.setValue('is search while typing enabled',
                       self.bible_search_while_typing)
     settings.endGroup()
     if self.tab_visited:
         self.settings_form.register_post_process('bibles_config_updated')
     self.tab_visited = False