4
4
###############################################################################
5
5
# OpenLP - Open Source Lyrics Projection #
6
6
# --------------------------------------------------------------------------- #
7
# Copyright (c) 2008-2018 OpenLP Developers #
7
# Copyright (c) 2008-2019 OpenLP Developers #
8
8
# --------------------------------------------------------------------------- #
9
9
# This program is free software; you can redistribute it and/or modify it #
10
10
# under the terms of the GNU General Public License as published by the Free #
27
27
from PyQt5 import QtCore, QtGui, QtWidgets
29
29
from openlp.core.common import is_macosx
30
from openlp.core.common.i18n import UiStrings, translate
31
from openlp.core.ui.icons import UiIcons
30
from openlp.core.common.i18n import translate
32
31
from openlp.core.common.mixins import RegistryProperties
33
32
from openlp.core.common.registry import Registry
34
from openlp.core.common.settings import Settings
35
from openlp.core.lib import build_icon
36
33
from openlp.core.lib.ui import add_welcome_page
37
from openlp.core.widgets.dialogs import FileDialog
34
from openlp.core.ui.icons import UiIcons
39
37
log = logging.getLogger(__name__)
119
117
self.error_copy_to_button.clicked.connect(self.on_error_copy_to_button_clicked)
120
118
self.error_save_to_button.clicked.connect(self.on_error_save_to_button_clicked)
122
def setupUi(self, image):
120
def setup_ui(self, image):
124
122
Set up the wizard UI.
125
123
:param image: path to start up image
280
278
self.finish_button.setVisible(True)
281
279
self.cancel_button.setVisible(False)
282
280
self.application.process_events()
284
def get_file_name(self, title, editbox, setting_name, filters=''):
286
Opens a FileDialog and saves the filename to the given editbox.
288
:param str title: The title of the dialog.
289
:param QtWidgets.QLineEdit editbox: An QLineEdit.
290
:param str setting_name: The place where to save the last opened directory.
291
:param str filters: The file extension filters. It should contain the file description
292
as well as the file extension. For example::
294
'OpenLP 2 Databases (*.sqlite)'
299
filters += '%s (*)' % UiStrings().AllFiles
300
file_path, filter_used = FileDialog.getOpenFileName(
301
self, title, Settings().value(self.plugin.settings_section + '/' + setting_name), filters)
303
editbox.setText(str(file_path))
304
Settings().setValue(self.plugin.settings_section + '/' + setting_name, file_path.parent)
306
def get_folder(self, title, editbox, setting_name):
308
Opens a FileDialog and saves the selected folder to the given editbox.
310
:param str title: The title of the dialog.
311
:param QtWidgets.QLineEdit editbox: An QLineEditbox.
312
:param str setting_name: The place where to save the last opened directory.
315
folder_path = FileDialog.getExistingDirectory(
316
self, title, Settings().value(self.plugin.settings_section + '/' + setting_name),
317
FileDialog.ShowDirsOnly)
319
editbox.setText(str(folder_path))
320
Settings().setValue(self.plugin.settings_section + '/' + setting_name, folder_path)