2010-09-26 08:38:11 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
2019-04-13 13:00:22 +00:00
|
|
|
##########################################################################
|
|
|
|
# OpenLP - Open Source Lyrics Projection #
|
|
|
|
# ---------------------------------------------------------------------- #
|
|
|
|
# Copyright (c) 2008-2019 OpenLP Developers #
|
|
|
|
# ---------------------------------------------------------------------- #
|
|
|
|
# This program is free software: you can redistribute it and/or modify #
|
|
|
|
# it under the terms of the GNU General Public License as published by #
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or #
|
|
|
|
# (at your option) any later version. #
|
|
|
|
# #
|
|
|
|
# This program is distributed in the hope that it will be useful, #
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
|
|
|
|
# GNU General Public License for more details. #
|
|
|
|
# #
|
|
|
|
# You should have received a copy of the GNU General Public License #
|
|
|
|
# along with this program. If not, see <https://www.gnu.org/licenses/>. #
|
|
|
|
##########################################################################
|
2013-02-01 19:58:18 +00:00
|
|
|
"""
|
|
|
|
The UI widgets for the rename dialog
|
|
|
|
"""
|
2015-11-07 00:49:40 +00:00
|
|
|
from PyQt5 import QtCore, QtGui, QtWidgets
|
2010-09-26 08:38:11 +00:00
|
|
|
|
2017-10-07 07:05:07 +00:00
|
|
|
from openlp.core.common.i18n import translate
|
2012-04-01 21:19:56 +00:00
|
|
|
from openlp.core.lib.ui import create_button_box
|
2018-04-21 19:57:51 +00:00
|
|
|
from openlp.core.ui.icons import UiIcons
|
2010-09-26 12:23:50 +00:00
|
|
|
|
2013-02-01 19:58:18 +00:00
|
|
|
|
2010-09-26 08:38:11 +00:00
|
|
|
class Ui_FileRenameDialog(object):
|
2013-02-01 19:58:18 +00:00
|
|
|
"""
|
|
|
|
The UI widgets for the rename dialog
|
|
|
|
"""
|
2018-09-12 05:43:27 +00:00
|
|
|
def setup_ui(self, file_rename_dialog):
|
2013-02-01 19:58:18 +00:00
|
|
|
"""
|
|
|
|
Set up the UI
|
|
|
|
"""
|
2013-08-31 18:17:38 +00:00
|
|
|
file_rename_dialog.setObjectName('file_rename_dialog')
|
2018-04-21 19:57:51 +00:00
|
|
|
file_rename_dialog.setWindowIcon(UiIcons().main_icon)
|
2013-03-01 11:12:23 +00:00
|
|
|
file_rename_dialog.resize(300, 10)
|
2015-11-07 00:49:40 +00:00
|
|
|
self.dialog_layout = QtWidgets.QGridLayout(file_rename_dialog)
|
2013-08-31 18:17:38 +00:00
|
|
|
self.dialog_layout.setObjectName('dialog_layout')
|
2015-11-07 00:49:40 +00:00
|
|
|
self.file_name_label = QtWidgets.QLabel(file_rename_dialog)
|
2013-08-31 18:17:38 +00:00
|
|
|
self.file_name_label.setObjectName('file_name_label')
|
2013-03-01 11:12:23 +00:00
|
|
|
self.dialog_layout.addWidget(self.file_name_label, 0, 0)
|
2015-11-07 00:49:40 +00:00
|
|
|
self.file_name_edit = QtWidgets.QLineEdit(file_rename_dialog)
|
2013-03-01 11:12:23 +00:00
|
|
|
self.file_name_edit.setValidator(QtGui.QRegExpValidator(QtCore.QRegExp(r'[^/\\?*|<>\[\]":+%]+'), self))
|
2013-08-31 18:17:38 +00:00
|
|
|
self.file_name_edit.setObjectName('file_name_edit')
|
2013-03-01 11:12:23 +00:00
|
|
|
self.dialog_layout.addWidget(self.file_name_edit, 0, 1)
|
2013-08-31 18:17:38 +00:00
|
|
|
self.button_box = create_button_box(file_rename_dialog, 'button_box', ['cancel', 'ok'])
|
2013-03-01 11:12:23 +00:00
|
|
|
self.dialog_layout.addWidget(self.button_box, 1, 0, 1, 2)
|
2018-09-12 05:43:27 +00:00
|
|
|
self.retranslate_ui(file_rename_dialog)
|
2010-12-31 18:10:45 +00:00
|
|
|
self.setMaximumHeight(self.sizeHint().height())
|
2010-09-26 08:38:11 +00:00
|
|
|
|
2018-09-12 05:43:27 +00:00
|
|
|
def retranslate_ui(self, file_rename_dialog):
|
2013-02-01 19:58:18 +00:00
|
|
|
"""
|
|
|
|
Translate the UI on the fly.
|
|
|
|
"""
|
2013-03-01 11:12:23 +00:00
|
|
|
self.file_name_label.setText(translate('OpenLP.FileRenameForm', 'New File Name:'))
|