forked from openlp/openlp
Added some extra params to the constructor
This commit is contained in:
parent
f4227c93b2
commit
47b640004e
@ -155,9 +155,8 @@ class AdvancedTab(SettingsTab):
|
||||
self.data_directory_layout.setObjectName('data_directory_layout')
|
||||
self.data_directory_new_label = QtWidgets.QLabel(self.data_directory_group_box)
|
||||
self.data_directory_new_label.setObjectName('data_directory_current_label')
|
||||
self.data_directory_path_edit = PathEdit(self.data_directory_group_box)
|
||||
self.data_directory_path_edit.path_type = PathType.Directories
|
||||
self.data_directory_path_edit.default_path = AppLocation.get_directory(AppLocation.DataDir)
|
||||
self.data_directory_path_edit = PathEdit(self.data_directory_group_box, path_type=PathType.Directories,
|
||||
default_path=AppLocation.get_directory(AppLocation.DataDir))
|
||||
self.data_directory_layout.addRow(self.data_directory_new_label, self.data_directory_path_edit)
|
||||
self.new_data_directory_has_files_label = QtWidgets.QLabel(self.data_directory_group_box)
|
||||
self.new_data_directory_has_files_label.setObjectName('new_data_directory_has_files_label')
|
||||
|
@ -172,9 +172,7 @@ class GeneralTab(SettingsTab):
|
||||
self.logo_layout.setObjectName('logo_layout')
|
||||
self.logo_file_label = QtWidgets.QLabel(self.logo_group_box)
|
||||
self.logo_file_label.setObjectName('logo_file_label')
|
||||
self.logo_file_path_edit = \
|
||||
PathEdit(self.logo_group_box)
|
||||
self.logo_file_path_edit.default_path = ':/graphics/openlp-splash-screen.png'
|
||||
self.logo_file_path_edit = PathEdit(self.logo_group_box, default_path=':/graphics/openlp-splash-screen.png')
|
||||
self.logo_layout.addRow(self.logo_file_label, self.logo_file_path_edit)
|
||||
self.logo_color_label = QtWidgets.QLabel(self.logo_group_box)
|
||||
self.logo_color_label.setObjectName('logo_color_label')
|
||||
|
@ -40,32 +40,42 @@ class PathEdit(QtWidgets.QWidget):
|
||||
"""
|
||||
pathChanged = QtCore.pyqtSignal(str)
|
||||
|
||||
def __init__(self, parent=None, show_revert=True):
|
||||
def __init__(self, parent=None, path_type=PathType.Files, default_path=None, dialog_caption=None, show_revert=True):
|
||||
"""
|
||||
Initalise the PathEdit widget
|
||||
|
||||
:param parent: The parent of the widget. This is just passed to the super method.
|
||||
:type parent: QWidget or None
|
||||
|
||||
:param dialog_caption: Used to customise the caption in the QFileDialog.
|
||||
:param dialog_caption: str
|
||||
|
||||
:param default_path: The default path. This is set as the path when the revert button is clicked
|
||||
:type default_path: str
|
||||
|
||||
:param show_revert: Used to determin if the 'revert button' should be visible.
|
||||
:type show_revert: bool
|
||||
|
||||
:ivar default_path: The default path. This is set as the path when the revert button is clicked
|
||||
:vartype default_path: str
|
||||
|
||||
:ivar dialog_caption: Used to customise the caption in the QFileDialog.
|
||||
:vartype dialog_caption: str
|
||||
|
||||
:return: None
|
||||
:rtype: None
|
||||
"""
|
||||
super().__init__(parent)
|
||||
self.default_path = ''
|
||||
self.dialog_caption = ''
|
||||
self._path_type = PathType.Files
|
||||
self._path = ''
|
||||
self.default_path = default_path
|
||||
self.dialog_caption = dialog_caption
|
||||
self._path_type = path_type
|
||||
self._path = None
|
||||
self.filters = '{all_files} (*)'.format(all_files=UiStrings().AllFiles)
|
||||
self._setup(show_revert)
|
||||
|
||||
def _setup(self, show_revert):
|
||||
|
||||
"""
|
||||
Set up the widget
|
||||
:param show_revert: Show or hide the revert button
|
||||
:type show_revert: bool
|
||||
|
||||
:return: None
|
||||
:rtype: None
|
||||
"""
|
||||
widget_layout = QtWidgets.QHBoxLayout()
|
||||
widget_layout.setContentsMargins(0, 0, 0, 0)
|
||||
self.line_edit = QtWidgets.QLineEdit(self)
|
||||
@ -79,12 +89,10 @@ class PathEdit(QtWidgets.QWidget):
|
||||
self.revert_button.setVisible(show_revert)
|
||||
widget_layout.addWidget(self.revert_button)
|
||||
self.setLayout(widget_layout)
|
||||
|
||||
# Signals and Slots
|
||||
self.browse_button.clicked.connect(self.on_browse_button_clicked)
|
||||
self.revert_button.clicked.connect(self.on_revert_button_clicked)
|
||||
self.line_edit.editingFinished.connect(self.on_line_edit_editing_finished)
|
||||
|
||||
self.update_button_tool_tips()
|
||||
|
||||
@property
|
||||
|
@ -116,8 +116,9 @@ class Ui_ThemeWizard(object):
|
||||
self.image_layout.addRow(self.image_color_label, self.image_color_button)
|
||||
self.image_label = QtWidgets.QLabel(self.image_widget)
|
||||
self.image_label.setObjectName('image_label')
|
||||
self.image_path_edit = PathEdit(self.image_widget, show_revert=False)
|
||||
self.image_path_edit.dialog_caption = translate('OpenLP.ThemeWizard', 'Select Image')
|
||||
self.image_path_edit = PathEdit(self.image_widget,
|
||||
dialog_caption=translate('OpenLP.ThemeWizard', 'Select Image'),
|
||||
show_revert=False)
|
||||
self.image_layout.addRow(self.image_label, self.image_path_edit)
|
||||
self.image_layout.setItem(2, QtWidgets.QFormLayout.LabelRole, self.spacer)
|
||||
self.background_stack.addWidget(self.image_widget)
|
||||
@ -140,8 +141,9 @@ class Ui_ThemeWizard(object):
|
||||
self.video_layout.addRow(self.video_color_label, self.video_color_button)
|
||||
self.video_label = QtWidgets.QLabel(self.video_widget)
|
||||
self.video_label.setObjectName('video_label')
|
||||
self.video_path_edit = PathEdit(self.video_widget, show_revert=False)
|
||||
self.video_path_edit.dialog_caption = translate('OpenLP.ThemeWizard', 'Select Video')
|
||||
self.video_path_edit = PathEdit(self.video_widget,
|
||||
dialog_caption=translate('OpenLP.ThemeWizard', 'Select Video'),
|
||||
show_revert=False)
|
||||
self.video_layout.addRow(self.video_label, self.video_path_edit)
|
||||
self.video_layout.setItem(2, QtWidgets.QFormLayout.LabelRole, self.spacer)
|
||||
self.background_stack.addWidget(self.video_widget)
|
||||
|
@ -69,8 +69,7 @@ class Ui_SongUsageDetailDialog(object):
|
||||
self.file_horizontal_layout.setSpacing(8)
|
||||
self.file_horizontal_layout.setContentsMargins(8, 8, 8, 8)
|
||||
self.file_horizontal_layout.setObjectName('file_horizontal_layout')
|
||||
self.report_path_edit = PathEdit(self.file_group_box, show_revert=False)
|
||||
self.report_path_edit.path_type = PathType.Directories
|
||||
self.report_path_edit = PathEdit(self.file_group_box, path_type = PathType.Directories, show_revert=False)
|
||||
self.file_horizontal_layout.addWidget(self.report_path_edit)
|
||||
self.vertical_layout.addWidget(self.file_group_box)
|
||||
self.button_box = create_button_box(song_usage_detail_dialog, 'button_box', ['cancel', 'ok'])
|
||||
|
Loading…
Reference in New Issue
Block a user