Enumm Conversion

This commit is contained in:
Tim Bentley 2023-06-05 16:57:24 +00:00
parent 06da7904ba
commit 6600ca150b
74 changed files with 404 additions and 362 deletions

View File

@ -65,7 +65,7 @@ class ApiTab(SettingsTab):
self.address_label.setObjectName('address_label')
self.server_settings_layout.addRow(self.address_label)
self.address_edit = QtWidgets.QLineEdit(self.server_settings_group_box)
self.address_edit.setSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed)
self.address_edit.setSizePolicy(QtWidgets.QSizePolicy.Policy.Preferred, QtWidgets.QSizePolicy.Policy.Fixed)
self.address_edit.setValidator(QtGui.QRegExpValidator(QtCore.QRegExp(r'\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}'),
self))
self.address_edit.setObjectName('address_edit')

View File

@ -247,7 +247,7 @@ class LanguageManager(object):
"""
log.debug('Translation files: {files}'.format(files=AppLocation.get_directory(AppLocation.LanguageDir)))
trans_dir = QtCore.QDir(str(AppLocation.get_directory(AppLocation.LanguageDir)))
file_names = trans_dir.entryList(['*.qm'], QtCore.QDir.Files, QtCore.QDir.Name)
file_names = trans_dir.entryList(['*.qm'], QtCore.QDir.Filter.Files, QtCore.QDir.Name)
# Remove qm files from the list which start with "qt".
file_names = [file_ for file_ in file_names if not file_.startswith('qt')]
return list(map(trans_dir.filePath, file_names))

View File

@ -535,56 +535,56 @@ class Settings(QtCore.QSettings):
'shortcuts/blankScreen': [QtGui.QKeySequence(QtCore.Qt.Key_Period)],
'shortcuts/collapse': [QtGui.QKeySequence(QtCore.Qt.Key_Minus)],
'shortcuts/desktopScreen': [QtGui.QKeySequence(QtCore.Qt.Key_D), QtGui.QKeySequence(QtCore.Qt.Key_Escape)],
'shortcuts/delete': [QtGui.QKeySequence(QtGui.QKeySequence.Delete)],
'shortcuts/delete': [QtGui.QKeySequence(QtGui.QKeySequence.StandardKey.Delete)],
'shortcuts/down': [QtGui.QKeySequence(QtCore.Qt.Key_Down)],
'shortcuts/editSong': [],
'shortcuts/expand': [QtGui.QKeySequence(QtCore.Qt.Key_Plus)],
'shortcuts/exportThemeItem': [],
'shortcuts/fileNewItem': [QtGui.QKeySequence(QtGui.QKeySequence.New)],
'shortcuts/fileSaveAsItem': [QtGui.QKeySequence(QtGui.QKeySequence.SaveAs)],
'shortcuts/fileExitItem': [QtGui.QKeySequence(QtGui.QKeySequence.Quit)],
'shortcuts/fileSaveItem': [QtGui.QKeySequence(QtGui.QKeySequence.Save)],
'shortcuts/fileOpenItem': [QtGui.QKeySequence(QtGui.QKeySequence.Open)],
'shortcuts/fileNewItem': [QtGui.QKeySequence(QtGui.QKeySequence.StandardKey.New)],
'shortcuts/fileSaveAsItem': [QtGui.QKeySequence(QtGui.QKeySequence.StandardKey.SaveAs)],
'shortcuts/fileExitItem': [QtGui.QKeySequence(QtGui.QKeySequence.StandardKey.Quit)],
'shortcuts/fileSaveItem': [QtGui.QKeySequence(QtGui.QKeySequence.StandardKey.Save)],
'shortcuts/fileOpenItem': [QtGui.QKeySequence(QtGui.QKeySequence.StandardKey.Open)],
'shortcuts/goLive': [],
'shortcuts/userManualItem': [QtGui.QKeySequence(QtGui.QKeySequence.HelpContents)],
'shortcuts/userManualItem': [QtGui.QKeySequence(QtGui.QKeySequence.StandardKey.HelpContents)],
'shortcuts/importThemeItem': [],
'shortcuts/importBibleItem': [],
'shortcuts/listViewBiblesDeleteItem': [QtGui.QKeySequence(QtGui.QKeySequence.Delete)],
'shortcuts/listViewBiblesDeleteItem': [QtGui.QKeySequence(QtGui.QKeySequence.StandardKey.Delete)],
'shortcuts/listViewBiblesPreviewItem': [QtGui.QKeySequence(QtCore.Qt.Key_Return),
QtGui.QKeySequence(QtCore.Qt.Key_Enter)],
'shortcuts/listViewBiblesLiveItem': [QtGui.QKeySequence(QtCore.Qt.SHIFT + QtCore.Qt.Key_Return),
QtGui.QKeySequence(QtCore.Qt.SHIFT + QtCore.Qt.Key_Enter)],
'shortcuts/listViewBiblesServiceItem': [QtGui.QKeySequence(QtCore.Qt.Key_Plus),
QtGui.QKeySequence(QtCore.Qt.Key_Equal)],
'shortcuts/listViewCustomDeleteItem': [QtGui.QKeySequence(QtGui.QKeySequence.Delete)],
'shortcuts/listViewCustomDeleteItem': [QtGui.QKeySequence(QtGui.QKeySequence.StandardKey.Delete)],
'shortcuts/listViewCustomPreviewItem': [QtGui.QKeySequence(QtCore.Qt.Key_Return),
QtGui.QKeySequence(QtCore.Qt.Key_Enter)],
'shortcuts/listViewCustomLiveItem': [QtGui.QKeySequence(QtCore.Qt.SHIFT + QtCore.Qt.Key_Return),
QtGui.QKeySequence(QtCore.Qt.SHIFT + QtCore.Qt.Key_Enter)],
'shortcuts/listViewCustomServiceItem': [QtGui.QKeySequence(QtCore.Qt.Key_Plus),
QtGui.QKeySequence(QtCore.Qt.Key_Equal)],
'shortcuts/listViewImagesDeleteItem': [QtGui.QKeySequence(QtGui.QKeySequence.Delete)],
'shortcuts/listViewImagesDeleteItem': [QtGui.QKeySequence(QtGui.QKeySequence.StandardKey.Delete)],
'shortcuts/listViewImagesPreviewItem': [QtGui.QKeySequence(QtCore.Qt.Key_Return),
QtGui.QKeySequence(QtCore.Qt.Key_Enter)],
'shortcuts/listViewImagesLiveItem': [QtGui.QKeySequence(QtCore.Qt.SHIFT + QtCore.Qt.Key_Return),
QtGui.QKeySequence(QtCore.Qt.SHIFT + QtCore.Qt.Key_Enter)],
'shortcuts/listViewImagesServiceItem': [QtGui.QKeySequence(QtCore.Qt.Key_Plus),
QtGui.QKeySequence(QtCore.Qt.Key_Equal)],
'shortcuts/listViewMediaDeleteItem': [QtGui.QKeySequence(QtGui.QKeySequence.Delete)],
'shortcuts/listViewMediaDeleteItem': [QtGui.QKeySequence(QtGui.QKeySequence.StandardKey.Delete)],
'shortcuts/listViewMediaPreviewItem': [QtGui.QKeySequence(QtCore.Qt.Key_Return),
QtGui.QKeySequence(QtCore.Qt.Key_Enter)],
'shortcuts/listViewMediaLiveItem': [QtGui.QKeySequence(QtCore.Qt.SHIFT + QtCore.Qt.Key_Return),
QtGui.QKeySequence(QtCore.Qt.SHIFT + QtCore.Qt.Key_Enter)],
'shortcuts/listViewMediaServiceItem': [QtGui.QKeySequence(QtCore.Qt.Key_Plus),
QtGui.QKeySequence(QtCore.Qt.Key_Equal)],
'shortcuts/listViewPresentationsDeleteItem': [QtGui.QKeySequence(QtGui.QKeySequence.Delete)],
'shortcuts/listViewPresentationsDeleteItem': [QtGui.QKeySequence(QtGui.QKeySequence.StandardKey.Delete)],
'shortcuts/listViewPresentationsPreviewItem': [QtGui.QKeySequence(QtCore.Qt.Key_Return),
QtGui.QKeySequence(QtCore.Qt.Key_Enter)],
'shortcuts/listViewPresentationsLiveItem': [QtGui.QKeySequence(QtCore.Qt.SHIFT + QtCore.Qt.Key_Return),
QtGui.QKeySequence(QtCore.Qt.SHIFT + QtCore.Qt.Key_Enter)],
'shortcuts/listViewPresentationsServiceItem': [QtGui.QKeySequence(QtCore.Qt.Key_Plus),
QtGui.QKeySequence(QtCore.Qt.Key_Equal)],
'shortcuts/listViewSongsDeleteItem': [QtGui.QKeySequence(QtGui.QKeySequence.Delete)],
'shortcuts/listViewSongsDeleteItem': [QtGui.QKeySequence(QtGui.QKeySequence.StandardKey.Delete)],
'shortcuts/listViewSongsPreviewItem': [QtGui.QKeySequence(QtCore.Qt.Key_Return),
QtGui.QKeySequence(QtCore.Qt.Key_Enter)],
'shortcuts/listViewSongsLiveItem': [QtGui.QKeySequence(QtCore.Qt.SHIFT + QtCore.Qt.Key_Return),
@ -619,15 +619,15 @@ class Settings(QtCore.QSettings):
'shortcuts/previousService': [QtGui.QKeySequence(QtCore.Qt.Key_Left)],
'shortcuts/previousItem_preview': [QtGui.QKeySequence(QtCore.Qt.Key_Up),
QtGui.QKeySequence(QtCore.Qt.Key_PageUp)],
'shortcuts/printServiceItem': [QtGui.QKeySequence(QtGui.QKeySequence.Print)],
'shortcuts/printServiceItem': [QtGui.QKeySequence(QtGui.QKeySequence.StandardKey.Print)],
'shortcuts/songExportItem': [],
'shortcuts/songUsageStatus': [QtGui.QKeySequence(QtCore.Qt.Key_F4)],
'shortcuts/searchShortcut': [QtGui.QKeySequence(QtGui.QKeySequence.Find)],
'shortcuts/searchShortcut': [QtGui.QKeySequence(QtGui.QKeySequence.StandardKey.Find)],
'shortcuts/settingsShortcutsItem': [],
'shortcuts/settingsImportItem': [],
'shortcuts/settingsPluginListItem': [QtGui.QKeySequence(QtCore.Qt.ALT + QtCore.Qt.Key_F7)],
'shortcuts/songUsageDelete': [],
'shortcuts/settingsConfigureItem': [QtGui.QKeySequence(QtGui.QKeySequence.Preferences)],
'shortcuts/settingsConfigureItem': [QtGui.QKeySequence(QtGui.QKeySequence.StandardKey.Preferences)],
'shortcuts/shortcutAction_B': [QtGui.QKeySequence(QtCore.Qt.Key_B)],
'shortcuts/shortcutAction_C': [QtGui.QKeySequence(QtCore.Qt.Key_C)],
'shortcuts/shortcutAction_E': [QtGui.QKeySequence(QtCore.Qt.Key_E)],
@ -823,7 +823,7 @@ class Settings(QtCore.QSettings):
self.remove('SettingsImport')
# Get the settings.
keys = self.allKeys()
export_settings = QtCore.QSettings(str(temp_path), QtCore.QSettings.IniFormat)
export_settings = QtCore.QSettings(str(temp_path), QtCore.QSettings.Format.IniFormat)
# Add a header section.
# This is to insure it's our conf file for import.
now = datetime.datetime.now()

View File

@ -258,7 +258,7 @@ def build_icon(icon):
elif isinstance(icon, QtGui.QImage): # pragma: no cover
pix_map = QtGui.QPixmap.fromImage(icon)
if pix_map:
button_icon.addPixmap(pix_map, QtGui.QIcon.Normal, QtGui.QIcon.Off)
button_icon.addPixmap(pix_map, QtGui.QIcon.Mode.Normal, QtGui.QIcon.State.Off)
return button_icon
@ -391,7 +391,7 @@ def resize_image(image_path, width, height, background='#000000', ignore_aspect_
real_width = preview.width()
real_height = preview.height()
# and move it to the centre of the preview space
new_image = QtGui.QImage(width, height, QtGui.QImage.Format_ARGB32_Premultiplied)
new_image = QtGui.QImage(width, height, QtGui.QImage.Format.Format_ARGB32_Premultiplied)
painter = QtGui.QPainter(new_image)
painter.fillRect(new_image.rect(), QtGui.QColor(background))
painter.drawImage((width - real_width) // 2, (height - real_height) // 2, preview)

View File

@ -45,7 +45,7 @@ def add_welcome_page(parent, image):
:param image: A splash image for the wizard.
"""
parent.welcome_page = QtWidgets.QWizardPage()
parent.welcome_page.setPixmap(QtWidgets.QWizard.WatermarkPixmap, QtGui.QPixmap(image))
parent.welcome_page.setPixmap(QtWidgets.QWizard.WizardPixmap.WatermarkPixmap, QtGui.QPixmap(image))
parent.welcome_page.setObjectName('welcome_page')
parent.welcome_layout = QtWidgets.QVBoxLayout(parent.welcome_page)
parent.welcome_layout.setObjectName('WelcomeLayout')
@ -72,31 +72,32 @@ def create_button_box(dialog, name, standard_buttons, custom_buttons=None):
:param standard_buttons: A list of strings for the used buttons. It might contain: ``ok``, ``save``, ``cancel``,
``close``, and ``defaults``.
:param custom_buttons: A list of additional buttons. If an item is an instance of QtWidgets.QAbstractButton it is
added with QDialogButtonBox.ActionRole. Otherwise the item has to be a tuple of a Button and a ButtonRole.
added with QDialogButtonBox.ButtonRole.ActionRole.
Otherwise the item has to be a tuple of a Button and a ButtonRole.
"""
if custom_buttons is None:
custom_buttons = []
if standard_buttons is None:
standard_buttons = []
buttons = QtWidgets.QDialogButtonBox.NoButton
buttons = QtWidgets.QDialogButtonBox.StandardButton.NoButton
if 'ok' in standard_buttons:
buttons |= QtWidgets.QDialogButtonBox.Ok
buttons |= QtWidgets.QDialogButtonBox.StandardButton.Ok
if 'save' in standard_buttons:
buttons |= QtWidgets.QDialogButtonBox.Save
buttons |= QtWidgets.QDialogButtonBox.StandardButton.Save
if 'cancel' in standard_buttons:
buttons |= QtWidgets.QDialogButtonBox.Cancel
buttons |= QtWidgets.QDialogButtonBox.StandardButton.Cancel
if 'close' in standard_buttons:
buttons |= QtWidgets.QDialogButtonBox.Close
buttons |= QtWidgets.QDialogButtonBox.StandardButton.Close
if 'help' in standard_buttons and hasattr(dialog, 'provide_help'):
buttons |= QtWidgets.QDialogButtonBox.Help
buttons |= QtWidgets.QDialogButtonBox.StandardButton.Help
if 'defaults' in standard_buttons:
buttons |= QtWidgets.QDialogButtonBox.RestoreDefaults
buttons |= QtWidgets.QDialogButtonBox.StandardButton.RestoreDefaults
button_box = QtWidgets.QDialogButtonBox(dialog)
button_box.setObjectName(name)
button_box.setStandardButtons(buttons)
for button in custom_buttons:
if isinstance(button, QtWidgets.QAbstractButton):
button_box.addButton(button, QtWidgets.QDialogButtonBox.ActionRole)
button_box.addButton(button, QtWidgets.QDialogButtonBox.ButtonRole.ActionRole)
else:
button_box.addButton(*button)
button_box.accepted.connect(dialog.accept)
@ -152,8 +153,8 @@ def create_horizontal_adjusting_combo_box(parent, name):
"""
combo = QtWidgets.QComboBox(parent)
combo.setObjectName(name)
combo.setSizeAdjustPolicy(QtWidgets.QComboBox.AdjustToMinimumContentsLength)
combo.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
combo.setSizeAdjustPolicy(QtWidgets.QComboBox.SizeAdjustPolicy.AdjustToMinimumContentsLength)
combo.setSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Fixed)
return combo

View File

@ -82,13 +82,13 @@ class FontSelectPage(GridLayoutPage):
self.style_bold_button = QtWidgets.QToolButton(self)
self.style_bold_button.setCheckable(True)
self.style_bold_button.setIcon(UiIcons().bold)
self.style_bold_button.setShortcut(QtGui.QKeySequence(QtGui.QKeySequence.Bold))
self.style_bold_button.setShortcut(QtGui.QKeySequence(QtGui.QKeySequence.StandardKey.Bold))
self.style_bold_button.setObjectName('style_bold_button')
self.style_layout.addWidget(self.style_bold_button)
self.style_italic_button = QtWidgets.QToolButton(self)
self.style_italic_button.setCheckable(True)
self.style_italic_button.setIcon(UiIcons().italic)
self.style_italic_button.setShortcut(QtGui.QKeySequence(QtGui.QKeySequence.Italic))
self.style_italic_button.setShortcut(QtGui.QKeySequence(QtGui.QKeySequence.StandardKey.Italic))
self.style_italic_button.setObjectName('style_italic_button')
self.style_layout.addWidget(self.style_italic_button)
self.style_layout.addStretch(1)
@ -175,11 +175,11 @@ class FontSelectPage(GridLayoutPage):
self.font_style_label.setText(translate('OpenLP.FontSelectWidget', 'Style:'))
self.style_bold_button.setToolTip('{name} ({shortcut})'.format(
name=translate('OpenLP.FontSelectWidget', 'Bold'),
shortcut=QtGui.QKeySequence(QtGui.QKeySequence.Bold).toString()
shortcut=QtGui.QKeySequence(QtGui.QKeySequence.StandardKey.Bold).toString()
))
self.style_italic_button.setToolTip('{name} ({shortcut})'.format(
name=translate('OpenLP.FontSelectWidget', 'Italic'),
shortcut=QtGui.QKeySequence(QtGui.QKeySequence.Italic).toString()
shortcut=QtGui.QKeySequence(QtGui.QKeySequence.StandardKey.Italic).toString()
))
self.font_size_label.setText(translate('OpenLP.FontSelectWidget', 'Size:'))
self.font_size_spinbox.setSuffix(' {unit}'.format(unit=UiStrings().FontSizePtUnit))

View File

@ -182,11 +182,11 @@ class Ui_ProjectorEditForm(object):
self.dialog_layout.addWidget(self.notes_label, _row, 0, alignment=QtCore.Qt.AlignTop)
self.dialog_layout.addWidget(self.notes_text, _row, 1)
# Time for the buttons
self.button_box_edit = QtWidgets.QDialogButtonBox(QtWidgets.QDialogButtonBox.Help |
QtWidgets.QDialogButtonBox.Save |
QtWidgets.QDialogButtonBox.Cancel)
self.button_box_edit = QtWidgets.QDialogButtonBox(QtWidgets.QDialogButtonBox.StandardButton.Help |
QtWidgets.QDialogButtonBox.StandardButton.Save |
QtWidgets.QDialogButtonBox.StandardButton.Cancel)
self.dialog_layout.addWidget(self.button_box_edit, 8, 0, 1, 2)
self.button_box_view = QtWidgets.QDialogButtonBox(QtWidgets.QDialogButtonBox.Ok)
self.button_box_view = QtWidgets.QDialogButtonBox(QtWidgets.QDialogButtonBox.StandardButton.Ok)
self.dialog_layout.addWidget(self.button_box_view, 8, 0, 1, 2)
def retranslate_ui(self, edit_projector_dialog):

View File

@ -185,7 +185,7 @@ class UiProjectorManager(object):
self.projector_one_widget.setObjectName('projector_one_toolbar_widget')
# Create projector manager list
self.projector_list_widget = QtWidgets.QListWidget(widget)
self.projector_list_widget.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection)
self.projector_list_widget.setSelectionMode(QtWidgets.QAbstractItemView.SelectionMode.ExtendedSelection)
self.projector_list_widget.setAlternatingRowColors(True)
self.projector_list_widget.setIconSize(QtCore.QSize(90, 50))
self.projector_list_widget.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)

View File

@ -146,16 +146,16 @@ def set_button_tooltip(button_bar):
:param button_bar: QDialogButtonBar instance to update
"""
for button in button_bar.buttons():
if button_bar.standardButton(button) == QtWidgets.QDialogButtonBox.Cancel:
if button_bar.standardButton(button) == QtWidgets.QDialogButtonBox.StandardButton.Cancel:
button.setToolTip(translate('OpenLP.SourceSelectForm',
'Ignoring current changes and return to OpenLP'))
elif button_bar.standardButton(button) == QtWidgets.QDialogButtonBox.Reset:
elif button_bar.standardButton(button) == QtWidgets.QDialogButtonBox.StandardButton.Reset:
button.setToolTip(translate('OpenLP.SourceSelectForm',
'Delete all user-defined text and revert to PJLink default text'))
elif button_bar.standardButton(button) == QtWidgets.QDialogButtonBox.Discard:
elif button_bar.standardButton(button) == QtWidgets.QDialogButtonBox.StandardButton.Discard:
button.setToolTip(translate('OpenLP.SourceSelectForm',
'Discard changes and reset to previous user-defined text'))
elif button_bar.standardButton(button) == QtWidgets.QDialogButtonBox.Ok:
elif button_bar.standardButton(button) == QtWidgets.QDialogButtonBox.StandardButton.Ok:
button.setToolTip(translate('OpenLP.SourceSelectForm',
'Save changes and return to OpenLP'))
else:
@ -256,9 +256,9 @@ class SourceSelectTabs(QtWidgets.QDialog):
self.tabwidget.setObjectName('source_select_tabs_tabwidget')
self.tabwidget.setUsesScrollButtons(False)
if is_macosx():
self.tabwidget.setTabPosition(QtWidgets.QTabWidget.North)
self.tabwidget.setTabPosition(QtWidgets.QTabWidget.TabPosition.North)
else:
self.tabwidget.setTabPosition(QtWidgets.QTabWidget.West)
self.tabwidget.setTabPosition(QtWidgets.QTabWidget.TabPosition.West)
self.layout.addWidget(self.tabwidget)
self.setLayout(self.layout)
@ -285,10 +285,10 @@ class SourceSelectTabs(QtWidgets.QDialog):
thistab = self.tabwidget.addTab(tab, PJLINK_DEFAULT_SOURCES[key])
if buttonchecked:
self.tabwidget.setCurrentIndex(thistab)
self.button_box = QtWidgets.QDialogButtonBox(QtWidgets.QDialogButtonBox.Reset |
QtWidgets.QDialogButtonBox.Discard |
QtWidgets.QDialogButtonBox.Ok |
QtWidgets.QDialogButtonBox.Cancel)
self.button_box = QtWidgets.QDialogButtonBox(QtWidgets.QDialogButtonBox.StandardButton.Reset |
QtWidgets.QDialogButtonBox.StandardButton.Discard |
QtWidgets.QDialogButtonBox.StandardButton.Ok |
QtWidgets.QDialogButtonBox.StandardButton.Cancel)
else:
for key in keys:
(tab, button_count, buttonchecked) = build_tab(group=self.button_group,
@ -300,8 +300,8 @@ class SourceSelectTabs(QtWidgets.QDialog):
thistab = self.tabwidget.addTab(tab, PJLINK_DEFAULT_SOURCES[key])
if buttonchecked:
self.tabwidget.setCurrentIndex(thistab)
self.button_box = QtWidgets.QDialogButtonBox(QtWidgets.QDialogButtonBox.Ok |
QtWidgets.QDialogButtonBox.Cancel)
self.button_box = QtWidgets.QDialogButtonBox(QtWidgets.QDialogButtonBox.StandardButton.Ok |
QtWidgets.QDialogButtonBox.StandardButton.Cancel)
self.button_box.clicked.connect(self.button_clicked)
self.layout.addWidget(self.button_box)
set_button_tooltip(self.button_box)
@ -432,10 +432,10 @@ class SourceSelectSingle(QtWidgets.QDialog):
item.setText(source_item.text)
self.layout.addRow(PJLINK_DEFAULT_CODES[key], item)
self.button_group.append(item)
self.button_box = QtWidgets.QDialogButtonBox(QtWidgets.QDialogButtonBox.Reset |
QtWidgets.QDialogButtonBox.Discard |
QtWidgets.QDialogButtonBox.Ok |
QtWidgets.QDialogButtonBox.Cancel)
self.button_box = QtWidgets.QDialogButtonBox(QtWidgets.QDialogButtonBox.StandardButton.Reset |
QtWidgets.QDialogButtonBox.StandardButton.Discard |
QtWidgets.QDialogButtonBox.StandardButton.Ok |
QtWidgets.QDialogButtonBox.StandardButton.Cancel)
else:
for key in keys:
source_text = self.projectordb.get_source_by_code(code=key, projector_id=self.projector.db_item.id)
@ -445,8 +445,8 @@ class SourceSelectSingle(QtWidgets.QDialog):
self.layout.addWidget(button)
self.button_group.addButton(button, int(key))
button_list.append(key)
self.button_box = QtWidgets.QDialogButtonBox(QtWidgets.QDialogButtonBox.Ok |
QtWidgets.QDialogButtonBox.Cancel)
self.button_box = QtWidgets.QDialogButtonBox(QtWidgets.QDialogButtonBox.StandardButton.Ok |
QtWidgets.QDialogButtonBox.StandardButton.Cancel)
self.button_box.clicked.connect(self.button_clicked)
self.layout.addWidget(self.button_box)
self.setMinimumHeight(key_count * 25)

View File

@ -74,7 +74,7 @@ class Ui_ConfirmationDialog():
self.message_label.setWordWrap(True)
self.message_and_buttons_layout.addWidget(self.message_label)
button_types = QtWidgets.QDialogButtonBox.Yes | QtWidgets.QDialogButtonBox.No
button_types = QtWidgets.QDialogButtonBox.StandardButton.Yes | QtWidgets.QDialogButtonBox.StandardButton.No
self.buttonBox = QtWidgets.QDialogButtonBox(button_types)
self.buttonBox.setObjectName('buttons')
self.message_and_buttons_layout.addWidget(self.buttonBox)

View File

@ -48,7 +48,7 @@ class Ui_ExceptionDialog(object):
self.message_layout.addSpacing(12)
self.bug_label = QtWidgets.QLabel(exception_dialog)
self.bug_label.setPixmap(UiIcons().exception.pixmap(40, 40))
self.bug_label.setSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
self.bug_label.setSizePolicy(QtWidgets.QSizePolicy.Policy.Fixed, QtWidgets.QSizePolicy.Policy.Fixed)
self.bug_label.setObjectName('bug_label')
self.message_layout.addWidget(self.bug_label)
self.message_layout.addSpacing(12)

View File

@ -110,7 +110,7 @@ class FirstTimeForm(QtWidgets.QWizard, UiFirstTimeWizard, RegistryProperties):
self.themes_list_widget.itemSelectionChanged.connect(self.on_themes_list_widget_selection_changed)
self.themes_deselect_all_button.clicked.connect(self.themes_list_widget.clearSelection)
self.themes_select_all_button.clicked.connect(self.themes_list_widget.selectAll)
self.setOption(QtWidgets.QWizard.HaveHelpButton, True)
self.setOption(QtWidgets.QWizard.WizardOption.HaveHelpButton, True)
self.helpRequested.connect(self.provide_help)
def provide_help(self):
@ -247,7 +247,7 @@ class FirstTimeForm(QtWidgets.QWizard, UiFirstTimeWizard, RegistryProperties):
create_paths(Path(gettempdir(), 'openlp'))
self.theme_combo_box.clear()
self.remote_page.can_download_remote = False
self.button(QtWidgets.QWizard.CustomButton1).setVisible(False)
self.button(QtWidgets.QWizard.WizardButton.CustomButton1).setVisible(False)
if self.has_run_wizard:
self.songs_check_box.setChecked(self.plugin_manager.get_plugin_by_name('songs').is_active())
self.bible_check_box.setChecked(self.plugin_manager.get_plugin_by_name('bibles').is_active())
@ -274,10 +274,10 @@ class FirstTimeForm(QtWidgets.QWizard, UiFirstTimeWizard, RegistryProperties):
"""
Detects Page changes and updates as appropriate.
"""
back_button = self.button(QtWidgets.QWizard.BackButton)
cancel_button = self.button(QtWidgets.QWizard.CancelButton)
internet_settings_button = self.button(QtWidgets.QWizard.CustomButton1)
next_button = self.button(QtWidgets.QWizard.NextButton)
back_button = self.button(QtWidgets.QWizard.WizardButton.BackButton)
cancel_button = self.button(QtWidgets.QWizard.WizardButton.CancelButton)
internet_settings_button = self.button(QtWidgets.QWizard.WizardButton.CustomButton1)
next_button = self.button(QtWidgets.QWizard.WizardButton.NextButton)
back_button.setVisible(True)
next_button.setVisible(True)
internet_settings_button.setVisible(False)
@ -352,7 +352,7 @@ class FirstTimeForm(QtWidgets.QWizard, UiFirstTimeWizard, RegistryProperties):
:rtype: None
"""
# Internet settings button
if which == QtWidgets.QWizard.CustomButton1:
if which == QtWidgets.QWizard.WizardButton.CustomButton1:
proxy_dialog = ProxyDialog(self)
proxy_dialog.retranslate_ui()
proxy_dialog.exec()
@ -408,7 +408,7 @@ class FirstTimeForm(QtWidgets.QWizard, UiFirstTimeWizard, RegistryProperties):
Prepare the UI for the process.
"""
self.max_progress = 0
self.button(QtWidgets.QWizard.FinishButton).setEnabled(False)
self.button(QtWidgets.QWizard.WizardButton.FinishButton).setEnabled(False)
self.application.process_events()
try:
# Loop through the songs list and increase for each selected item
@ -480,8 +480,8 @@ class FirstTimeForm(QtWidgets.QWizard, UiFirstTimeWizard, RegistryProperties):
else:
text = translate('OpenLP.FirstTimeWizard', 'Click the \'{finish_button}\' button to start OpenLP.')
self.progress_label.setText(text.format(finish_button=self.finish_button_text))
self.button(QtWidgets.QWizard.FinishButton).setEnabled(True)
self.button(QtWidgets.QWizard.CancelButton).setVisible(False)
self.button(QtWidgets.QWizard.WizardButton.FinishButton).setEnabled(True)
self.button(QtWidgets.QWizard.WizardButton.CancelButton).setVisible(False)
self.application.process_events()
def _perform_wizard(self):
@ -549,7 +549,7 @@ class FirstTimeForm(QtWidgets.QWizard, UiFirstTimeWizard, RegistryProperties):
for entry in missed_files:
file_list += '{text}<br \\>'.format(text=entry)
msg = QtWidgets.QMessageBox()
msg.setIcon(QtWidgets.QMessageBox.Warning)
msg.setIcon(QtWidgets.QMessageBox.Icon.Warning)
msg.setWindowTitle(translate('OpenLP.FirstTimeWizard', 'Network Error'))
msg.setText(translate('OpenLP.FirstTimeWizard', 'Unable to download some files'))
msg.setInformativeText(translate('OpenLP.FirstTimeWizard',

View File

@ -52,7 +52,7 @@ class Ui_FirstTimeLanguageDialog(object):
self.language_label.setObjectName('language_label')
self.language_layout.addWidget(self.language_label)
self.language_combo_box = QtWidgets.QComboBox(language_dialog)
self.language_combo_box.setSizeAdjustPolicy(QtWidgets.QComboBox.AdjustToContents)
self.language_combo_box.setSizeAdjustPolicy(QtWidgets.QComboBox.SizeAdjustPolicy.AdjustToContents)
self.language_combo_box.setObjectName("language_combo_box")
self.language_layout.addWidget(self.language_combo_box)
self.dialog_layout.addLayout(self.language_layout)

View File

@ -102,15 +102,15 @@ class ThemeListWidget(QtWidgets.QListWidget):
self.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers)
self.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
self.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn)
self.setVerticalScrollMode(QtWidgets.QAbstractItemView.ScrollPerPixel)
self.setSelectionMode(QtWidgets.QAbstractItemView.MultiSelection)
self.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows)
self.setVerticalScrollMode(QtWidgets.QAbstractItemView.ScrollMode.ScrollPerPixel)
self.setSelectionMode(QtWidgets.QAbstractItemView.SelectionMode.MultiSelection)
self.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectionBehavior.SelectRows)
self.setIconSize(QtCore.QSize(133, 100))
self.setMovement(QtWidgets.QListView.Static)
self.setFlow(QtWidgets.QListView.LeftToRight)
self.setMovement(QtWidgets.QListView.Movement.Static)
self.setFlow(QtWidgets.QListView.Flow.LeftToRight)
self.setProperty("isWrapping", True)
self.setResizeMode(QtWidgets.QListView.Adjust)
self.setViewMode(QtWidgets.QListView.IconMode)
self.setResizeMode(QtWidgets.QListView.ResizeMode.Adjust)
self.setViewMode(QtWidgets.QListView.ViewMode.IconMode)
self.setUniformItemSizes(True)
def resizeEvent(self, event):
@ -141,14 +141,16 @@ class UiFirstTimeWizard(object):
first_time_wizard.setWindowIcon(UiIcons().main_icon)
first_time_wizard.resize(640, 400)
first_time_wizard.setModal(True)
first_time_wizard.setOptions(QtWidgets.QWizard.IndependentPages | QtWidgets.QWizard.NoBackButtonOnStartPage |
QtWidgets.QWizard.NoBackButtonOnLastPage | QtWidgets.QWizard.HaveCustomButton1)
first_time_wizard.setOptions(QtWidgets.QWizard.WizardOption.IndependentPages |
QtWidgets.QWizard.WizardOption.NoBackButtonOnStartPage |
QtWidgets.QWizard.WizardOption.NoBackButtonOnLastPage |
QtWidgets.QWizard.WizardOption.HaveCustomButton1)
if is_macosx(): # pragma: nocover
first_time_wizard.setPixmap(QtWidgets.QWizard.BackgroundPixmap,
first_time_wizard.setPixmap(QtWidgets.QWizard.WizardPixmap.BackgroundPixmap,
QtGui.QPixmap(':/wizards/openlp-osx-wizard.png'))
first_time_wizard.resize(634, 386)
else:
first_time_wizard.setWizardStyle(QtWidgets.QWizard.ModernStyle)
first_time_wizard.setWizardStyle(QtWidgets.QWizard.WizardStyle.ModernStyle)
add_welcome_page(first_time_wizard, ':/wizards/wizard_firsttime.bmp')
# The screen config page
self.screen_page = QtWidgets.QWizardPage()
@ -304,9 +306,9 @@ class UiFirstTimeWizard(object):
:param first_time_wizard: The wizard form
"""
self.finish_button_text = clean_button_text(self.buttonText(QtWidgets.QWizard.FinishButton))
back_button_text = clean_button_text(self.buttonText(QtWidgets.QWizard.BackButton))
next_button_text = clean_button_text(self.buttonText(QtWidgets.QWizard.NextButton))
self.finish_button_text = clean_button_text(self.buttonText(QtWidgets.QWizard.WizardButton.FinishButton))
back_button_text = clean_button_text(self.buttonText(QtWidgets.QWizard.WizardButton.BackButton))
next_button_text = clean_button_text(self.buttonText(QtWidgets.QWizard.WizardButton.NextButton))
self.setWindowTitle(translate('OpenLP.FirstTimeWizard', 'First Time Wizard'))
text = translate('OpenLP.FirstTimeWizard', 'Welcome to the First Time Wizard')
@ -316,7 +318,7 @@ class UiFirstTimeWizard(object):
'Click the \'{next_button}\' button below to start.'
).format(next_button=next_button_text))
self.setButtonText(
QtWidgets.QWizard.CustomButton1, translate('OpenLP.FirstTimeWizard', 'Internet Settings'))
QtWidgets.QWizard.WizardButton.CustomButton1, translate('OpenLP.FirstTimeWizard', 'Internet Settings'))
self.download_page.setTitle(translate('OpenLP.FirstTimeWizard', 'Downloading Resource Index'))
self.download_page.setSubTitle(translate('OpenLP.FirstTimeWizard',
'Please wait while the resource index is downloaded.'))

View File

@ -183,7 +183,7 @@ class ChooseFolderForm(QtWidgets.QDialog, FolderPopulateMixin):
self.setObjectName('ChooseFolderForm')
self.resize(399, 119)
self.choose_folder_layout = QtWidgets.QFormLayout(self)
self.choose_folder_layout.setFieldGrowthPolicy(QtWidgets.QFormLayout.ExpandingFieldsGrow)
self.choose_folder_layout.setFieldGrowthPolicy(QtWidgets.QFormLayout.FieldGrowthPolicy.ExpandingFieldsGrow)
self.choose_folder_layout.setContentsMargins(8, 8, 8, 8)
self.choose_folder_layout.setSpacing(8)
self.choose_folder_layout.setLabelAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
@ -191,29 +191,29 @@ class ChooseFolderForm(QtWidgets.QDialog, FolderPopulateMixin):
self.folder_question_label = QtWidgets.QLabel(self)
self.folder_question_label.setWordWrap(True)
self.folder_question_label.setObjectName('folder_question_label')
self.choose_folder_layout.setWidget(1, QtWidgets.QFormLayout.SpanningRole, self.folder_question_label)
self.choose_folder_layout.setWidget(1, QtWidgets.QFormLayout.ItemRole.SpanningRole, self.folder_question_label)
self.nofolder_radio_button = QtWidgets.QRadioButton(self)
self.nofolder_radio_button.setChecked(True)
self.nofolder_radio_button.setObjectName('nofolder_radio_button')
self.choose_folder_layout.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.nofolder_radio_button)
self.choose_folder_layout.setWidget(2, QtWidgets.QFormLayout.ItemRole.LabelRole, self.nofolder_radio_button)
self.existing_radio_button = QtWidgets.QRadioButton(self)
self.existing_radio_button.setChecked(False)
self.existing_radio_button.setObjectName('existing_radio_button')
self.choose_folder_layout.setWidget(3, QtWidgets.QFormLayout.LabelRole, self.existing_radio_button)
self.choose_folder_layout.setWidget(3, QtWidgets.QFormLayout.ItemRole.LabelRole, self.existing_radio_button)
self.folder_combobox = QtWidgets.QComboBox(self)
self.folder_combobox.setObjectName('folder_combobox')
self.folder_combobox.activated.connect(self.on_folder_combobox_selected)
self.choose_folder_layout.setWidget(3, QtWidgets.QFormLayout.FieldRole, self.folder_combobox)
self.choose_folder_layout.setWidget(3, QtWidgets.QFormLayout.ItemRole.FieldRole, self.folder_combobox)
self.new_radio_button = QtWidgets.QRadioButton(self)
self.new_radio_button.setChecked(False)
self.new_radio_button.setObjectName('new_radio_button')
self.choose_folder_layout.setWidget(4, QtWidgets.QFormLayout.LabelRole, self.new_radio_button)
self.choose_folder_layout.setWidget(4, QtWidgets.QFormLayout.ItemRole.LabelRole, self.new_radio_button)
self.new_folder_edit = QtWidgets.QLineEdit(self)
self.new_folder_edit.setObjectName('new_folder_edit')
self.new_folder_edit.textEdited.connect(self.on_new_folder_edit_changed)
self.choose_folder_layout.setWidget(4, QtWidgets.QFormLayout.FieldRole, self.new_folder_edit)
self.choose_folder_layout.setWidget(4, QtWidgets.QFormLayout.ItemRole.FieldRole, self.new_folder_edit)
self.folder_button_box = create_button_box(self, 'buttonBox', ['ok'])
self.choose_folder_layout.setWidget(5, QtWidgets.QFormLayout.FieldRole, self.folder_button_box)
self.choose_folder_layout.setWidget(5, QtWidgets.QFormLayout.ItemRole.FieldRole, self.folder_button_box)
self.retranslate_ui()
QtCore.QMetaObject.connectSlotsByName(self)

View File

@ -68,8 +68,8 @@ class Ui_FormattingTagDialog(object):
self.tag_table_widget.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
self.tag_table_widget.setEditTriggers(QtWidgets.QAbstractItemView.AllEditTriggers)
self.tag_table_widget.setAlternatingRowColors(True)
self.tag_table_widget.setSelectionMode(QtWidgets.QAbstractItemView.SingleSelection)
self.tag_table_widget.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows)
self.tag_table_widget.setSelectionMode(QtWidgets.QAbstractItemView.SelectionMode.SingleSelection)
self.tag_table_widget.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectionBehavior.SelectRows)
self.tag_table_widget.setCornerButtonEnabled(False)
self.tag_table_widget.setObjectName('tag_table_widget')
self.tag_table_widget.setColumnCount(5)
@ -98,9 +98,9 @@ class Ui_FormattingTagDialog(object):
self.edit_button_layout.addStretch()
self.list_data_grid_layout.addLayout(self.edit_button_layout)
self.button_box = create_button_box(formatting_tag_dialog, 'button_box', ['cancel', 'save', 'defaults'])
self.save_button = self.button_box.button(QtWidgets.QDialogButtonBox.Save)
self.save_button = self.button_box.button(QtWidgets.QDialogButtonBox.StandardButton.Save)
self.save_button.setObjectName('save_button')
self.restore_button = self.button_box.button(QtWidgets.QDialogButtonBox.RestoreDefaults)
self.restore_button = self.button_box.button(QtWidgets.QDialogButtonBox.StandardButton.RestoreDefaults)
self.restore_button.setIcon(UiIcons().undo)
self.restore_button.setObjectName('restore_button')
self.list_data_grid_layout.addWidget(self.button_box)

View File

@ -49,8 +49,8 @@ class UiIcons(metaclass=Singleton):
qta.load_font('op', font_path, charmap_path)
palette = QtWidgets.QApplication.palette()
self._default_icon_colors = {
"color": palette.color(QtGui.QPalette.Active, QtGui.QPalette.WindowText),
"color_disabled": palette.color(QtGui.QPalette.Disabled, QtGui.QPalette.WindowText)
"color": palette.color(QtGui.QPalette.ColorGroup.Active, QtGui.QPalette.ColorRole.WindowText),
"color_disabled": palette.color(QtGui.QPalette.ColorGroup.Disabled, QtGui.QPalette.ColorRole.WindowText)
}
qta.set_defaults(**self._default_icon_colors)
self._icon_list = {

View File

@ -187,7 +187,7 @@ class Ui_MainWindow(object):
can_shortcuts=True,
category=UiStrings().File, triggers=main_window.close)
# Give QT Extra Hint that this is the Exit Menu Item
self.file_exit_item.setMenuRole(QtWidgets.QAction.QuitRole)
self.file_exit_item.setMenuRole(QtWidgets.QAction.MenuRole.QuitRole)
action_list.add_category(UiStrings().Import, CategoryOrder.standard_menu)
self.import_theme_item = create_action(main_window, 'importThemeItem', category=UiStrings().Import,
can_shortcuts=True)
@ -280,7 +280,7 @@ class Ui_MainWindow(object):
icon=UiIcons().settings, can_shortcuts=True,
category=UiStrings().Settings)
# Give Qt Extra Hint that this is the Preferences Menu Item
self.settings_configure_item.setMenuRole(QtWidgets.QAction.PreferencesRole)
self.settings_configure_item.setMenuRole(QtWidgets.QAction.MenuRole.PreferencesRole)
self.settings_import_item = create_action(main_window, 'settingsImportItem',
category=UiStrings().Import, can_shortcuts=True)
self.settings_export_item = create_action(main_window, 'settingsExportItem',
@ -290,7 +290,7 @@ class Ui_MainWindow(object):
can_shortcuts=True, category=UiStrings().Help,
triggers=self.on_about_item_clicked)
# Give Qt Extra Hint that this is an About Menu Item
self.about_item.setMenuRole(QtWidgets.QAction.AboutRole)
self.about_item.setMenuRole(QtWidgets.QAction.MenuRole.AboutRole)
if is_win():
self.local_help_file = AppLocation.get_directory(AppLocation.AppDir) / 'OpenLP.chm'
elif is_macosx():
@ -326,10 +326,10 @@ class Ui_MainWindow(object):
add_actions(self.settings_language_menu, self.language_group.actions())
# Qt on OS X looks for keywords in the menu items title to determine which menu items get added to the main
# menu. If we are running on Mac OS X the menu items whose title contains those keywords but don't belong in the
# main menu need to be marked as such with QAction.NoRole.
# main menu need to be marked as such with QAction.MenuRole.NoRole.
if is_macosx():
self.settings_shortcuts_item.setMenuRole(QtWidgets.QAction.NoRole)
self.formatting_tag_item.setMenuRole(QtWidgets.QAction.NoRole)
self.settings_shortcuts_item.setMenuRole(QtWidgets.QAction.MenuRole.NoRole)
self.formatting_tag_item.setMenuRole(QtWidgets.QAction.MenuRole.NoRole)
add_actions(self.settings_menu, (self.settings_plugin_list_item, self.settings_language_menu.menuAction(),
None, self.formatting_tag_item, self.settings_shortcuts_item, self.settings_configure_item))
add_actions(self.tools_menu, (self.tools_add_tool_item, None))
@ -897,7 +897,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow, LogMixin, RegistryPropert
create_paths(temp_dir_path)
temp_config_path = temp_dir_path / import_file_path.name
shutil.copyfile(import_file_path, temp_config_path)
import_settings = Settings(str(temp_config_path), QtCore.QSettings.IniFormat)
import_settings = Settings(str(temp_config_path), QtCore.QSettings.Format.IniFormat)
self.log_info('hook upgrade_plugin_settings')
self.plugin_manager.hook_upgrade_plugin_settings(import_settings)
@ -1081,7 +1081,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow, LogMixin, RegistryPropert
event.ignore()
else:
if self.settings.value('advanced/enable exit confirmation'):
msg_box = QtWidgets.QMessageBox(QtWidgets.QMessageBox.Question,
msg_box = QtWidgets.QMessageBox(QtWidgets.QMessageBox.Icon.Question,
translate('OpenLP.MainWindow', 'Exit OpenLP'),
translate('OpenLP.MainWindow', 'Are you sure you want to exit OpenLP?'),
QtWidgets.QMessageBox.StandardButtons(QtWidgets.QMessageBox.Close |
@ -1244,10 +1244,10 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow, LogMixin, RegistryPropert
Sets the ability to stop the toolbars being changed.
"""
if lock:
self.theme_manager_dock.setFeatures(QtWidgets.QDockWidget.NoDockWidgetFeatures)
self.service_manager_dock.setFeatures(QtWidgets.QDockWidget.NoDockWidgetFeatures)
self.media_manager_dock.setFeatures(QtWidgets.QDockWidget.NoDockWidgetFeatures)
self.projector_manager_dock.setFeatures(QtWidgets.QDockWidget.NoDockWidgetFeatures)
self.theme_manager_dock.setFeatures(QtWidgets.QDockWidget.DockWidgetFeature.NoDockWidgetFeatures)
self.service_manager_dock.setFeatures(QtWidgets.QDockWidget.DockWidgetFeature.NoDockWidgetFeatures)
self.media_manager_dock.setFeatures(QtWidgets.QDockWidget.DockWidgetFeature.NoDockWidgetFeatures)
self.projector_manager_dock.setFeatures(QtWidgets.QDockWidget.DockWidgetFeature.NoDockWidgetFeatures)
self.view_mode_menu.setEnabled(False)
self.view_media_manager_item.setEnabled(False)
self.view_service_manager_item.setEnabled(False)
@ -1256,10 +1256,10 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow, LogMixin, RegistryPropert
self.view_preview_panel.setEnabled(False)
self.view_live_panel.setEnabled(False)
else:
self.theme_manager_dock.setFeatures(QtWidgets.QDockWidget.AllDockWidgetFeatures)
self.service_manager_dock.setFeatures(QtWidgets.QDockWidget.AllDockWidgetFeatures)
self.media_manager_dock.setFeatures(QtWidgets.QDockWidget.AllDockWidgetFeatures)
self.projector_manager_dock.setFeatures(QtWidgets.QDockWidget.AllDockWidgetFeatures)
self.theme_manager_dock.setFeatures(QtWidgets.QDockWidget.DockWidgetFeature.AllDockWidgetFeatures)
self.service_manager_dock.setFeatures(QtWidgets.QDockWidget.DockWidgetFeature.AllDockWidgetFeatures)
self.media_manager_dock.setFeatures(QtWidgets.QDockWidget.DockWidgetFeature.AllDockWidgetFeatures)
self.projector_manager_dock.setFeatures(QtWidgets.QDockWidget.DockWidgetFeature.AllDockWidgetFeatures)
self.view_mode_menu.setEnabled(True)
self.view_media_manager_item.setEnabled(True)
self.view_service_manager_item.setEnabled(True)

View File

@ -363,6 +363,8 @@ class MediaController(QtWidgets.QWidget, RegistryBase, LogMixin, RegistryPropert
is_autoplay = True
if controller.media_info.media_type == MediaType.Stream:
is_autoplay = True
if controller.media_info.media_type == MediaType.Stream:
is_autoplay = True
return is_autoplay
@staticmethod

View File

@ -314,7 +314,7 @@ class PrintServiceForm(QtWidgets.QDialog, Ui_PrintServiceDialog, RegistryPropert
"""
self.update_song_usage()
cursor = QtGui.QTextCursor(self.document)
cursor.select(QtGui.QTextCursor.Document)
cursor.select(QtGui.QTextCursor.SelectionType.Document)
clipboard_text = cursor.selectedText()
# We now have the unprocessed unicode service text in the cursor
# So we replace u2028 with \n and u2029 with \n\n and a few others

View File

@ -64,7 +64,7 @@ class ServiceManagerList(QtWidgets.QTreeWidget):
Constructor
"""
super(ServiceManagerList, self).__init__(parent)
self.setDragDropMode(QtWidgets.QAbstractItemView.DragDrop)
self.setDragDropMode(QtWidgets.QAbstractItemView.DragDropMode.DragDrop)
self.setAlternatingRowColors(True)
self.setHeaderHidden(True)
self.setExpandsOnDoubleClick(False)
@ -159,8 +159,8 @@ class Ui_ServiceManager(object):
self.toolbar.add_toolbar_widget(self.theme_label)
self.theme_combo_box = QtWidgets.QComboBox(self.toolbar)
self.theme_combo_box.setToolTip(translate('OpenLP.ServiceManager', 'Select a theme for the service.'))
self.theme_combo_box.setSizeAdjustPolicy(QtWidgets.QComboBox.AdjustToMinimumContentsLength)
self.theme_combo_box.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
self.theme_combo_box.setSizeAdjustPolicy(QtWidgets.QComboBox.SizeAdjustPolicy.AdjustToMinimumContentsLength)
self.theme_combo_box.setSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Fixed)
self.theme_combo_box.setObjectName('theme_combo_box')
self.toolbar.add_toolbar_widget(self.theme_combo_box)
self.toolbar.setObjectName('toolbar')
@ -168,9 +168,9 @@ class Ui_ServiceManager(object):
# Create the service manager list
self.service_manager_list = ServiceManagerList(widget)
self.service_manager_list.setEditTriggers(
QtWidgets.QAbstractItemView.CurrentChanged |
QtWidgets.QAbstractItemView.DoubleClicked |
QtWidgets.QAbstractItemView.EditKeyPressed)
QtWidgets.QAbstractItemView.EditTrigger.CurrentChanged |
QtWidgets.QAbstractItemView.EditTrigger.DoubleClicked |
QtWidgets.QAbstractItemView.EditTrigger.EditKeyPressed)
self.service_manager_list.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
self.service_manager_list.customContextMenuRequested.connect(self.context_menu)
self.service_manager_list.setObjectName('service_manager_list')
@ -367,7 +367,7 @@ class ServiceManager(QtWidgets.QWidget, RegistryBase, Ui_ServiceManager, LogMixi
self.start_time_form = StartTimeForm()
def _delete_confirmation_dialog(self):
msg_box = QtWidgets.QMessageBox(QtWidgets.QMessageBox.Question,
msg_box = QtWidgets.QMessageBox(QtWidgets.QMessageBox.Icon.Question,
translate('OpenLP.ServiceManager', 'Delete item from service'),
translate('OpenLP.ServiceManager', 'Are you sure you want to delete '
'this item from the service?'),
@ -467,7 +467,7 @@ class ServiceManager(QtWidgets.QWidget, RegistryBase, Ui_ServiceManager, LogMixi
return False
if not self.service_items and self.settings.value('advanced/new service message'):
do_not_show_again = QtWidgets.QCheckBox(translate('OpenLP.Ui', 'Do not show this message again'), None)
message_box = QtWidgets.QMessageBox(QtWidgets.QMessageBox.Information,
message_box = QtWidgets.QMessageBox(QtWidgets.QMessageBox.Icon.Information,
translate('OpenLP.Ui', 'Create a new service.'),
translate('OpenLP.Ui', 'You already have a blank new service.\n'
'Add some items to it then press Save'),
@ -1704,7 +1704,7 @@ class ServiceManager(QtWidgets.QWidget, RegistryBase, Ui_ServiceManager, LogMixi
title = self.service_items[item]['service_item'].title
title, ok = QtWidgets.QInputDialog.getText(self, translate('OpenLP.ServiceManager', 'Rename item title'),
translate('OpenLP.ServiceManager', 'Title:'),
QtWidgets.QLineEdit.Normal, self.tr(title))
QtWidgets.QLineEdit.EchoMode.Normal, self.tr(title))
if ok:
self.service_items[item]['service_item'].title = title
self.repaint_service_list(item, -1)

View File

@ -278,7 +278,7 @@ class ShortcutListForm(QtWidgets.QDialog, Ui_ShortcutListDialog, RegistryPropert
"""
Restores all default shortcuts.
"""
if self.button_box.buttonRole(button) != QtWidgets.QDialogButtonBox.ResetRole:
if self.button_box.buttonRole(button) != QtWidgets.QDialogButtonBox.ButtonRole.ResetRole:
return
if QtWidgets.QMessageBox.question(self, translate('OpenLP.ShortcutListDialog', 'Restore Default Shortcuts'),
translate('OpenLP.ShortcutListDialog', 'Do you want to restore all '
@ -475,9 +475,9 @@ class ShortcutListForm(QtWidgets.QDialog, Ui_ShortcutListDialog, RegistryPropert
def get_shortcut_string(shortcut, for_display=False):
if for_display:
if any(modifier in shortcut.toString() for modifier in ['Ctrl', 'Alt', 'Meta', 'Shift']):
sequence_format = QtGui.QKeySequence.NativeText
sequence_format = QtGui.QKeySequence.SequenceFormat.NativeText
else:
sequence_format = QtGui.QKeySequence.PortableText
sequence_format = QtGui.QKeySequence.SequenceFormat.PortableText
else:
sequence_format = QtGui.QKeySequence.PortableText
sequence_format = QtGui.QKeySequence.SequenceFormat.PortableText
return shortcut.toString(sequence_format)

View File

@ -226,7 +226,7 @@ class SlideController(QtWidgets.QWidget, LogMixin, RegistryProperties):
self.type_label.setText(UiStrings().Preview)
# Info label for the title of the current item, at the top of the slide controller
self.info_label = InfoLabel(self.panel)
self.info_label.setSizePolicy(QtWidgets.QSizePolicy.Ignored, QtWidgets.QSizePolicy.Preferred)
self.info_label.setSizePolicy(QtWidgets.QSizePolicy.Policy.Ignored, QtWidgets.QSizePolicy.Policy.Preferred)
self.top_label_vertical.addWidget(self.type_label)
self.top_label_vertical.addWidget(self.info_label)
# Splitter
@ -236,8 +236,8 @@ class SlideController(QtWidgets.QWidget, LogMixin, RegistryProperties):
# Actual controller section
self.controller = QtWidgets.QWidget(self.splitter)
self.controller.setGeometry(QtCore.QRect(0, 0, 100, 536))
self.controller.setSizePolicy(QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred,
QtWidgets.QSizePolicy.Maximum))
self.controller.setSizePolicy(QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Preferred,
QtWidgets.QSizePolicy.Policy.Maximum))
self.controller_layout = QtWidgets.QVBoxLayout(self.controller)
self.controller_layout.setSpacing(0)
self.controller_layout.setContentsMargins(0, 0, 0, 0)
@ -247,7 +247,8 @@ class SlideController(QtWidgets.QWidget, LogMixin, RegistryProperties):
# Build the full toolbar
self.toolbar = OpenLPToolbar(self)
self.toolbar.setObjectName('slide_controller_toolbar')
size_toolbar_policy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
size_toolbar_policy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Fixed,
QtWidgets.QSizePolicy.Policy.Fixed)
size_toolbar_policy.setHorizontalStretch(0)
size_toolbar_policy.setVerticalStretch(0)
size_toolbar_policy.setHeightForWidth(self.toolbar.sizePolicy().hasHeightForWidth())
@ -278,7 +279,7 @@ class SlideController(QtWidgets.QWidget, LogMixin, RegistryProperties):
self.hide_menu = QtWidgets.QToolButton(self.toolbar)
self.hide_menu.setObjectName('hide_menu')
self.hide_menu.setText(translate('OpenLP.SlideController', 'Hide'))
self.hide_menu.setPopupMode(QtWidgets.QToolButton.MenuButtonPopup)
self.hide_menu.setPopupMode(QtWidgets.QToolButton.ToolButtonPopupMode.MenuButtonPopup)
self.hide_menu.setMenu(QtWidgets.QMenu(translate('OpenLP.SlideController', 'Hide'), self.toolbar))
self.toolbar.add_toolbar_widget(self.hide_menu)
# The order of the blank to modes in Shortcuts list comes from here.
@ -329,7 +330,7 @@ class SlideController(QtWidgets.QWidget, LogMixin, RegistryProperties):
self.play_slides_menu = QtWidgets.QToolButton(self.toolbar)
self.play_slides_menu.setObjectName('play_slides_menu')
self.play_slides_menu.setText(translate('OpenLP.SlideController', 'Play Slides'))
self.play_slides_menu.setPopupMode(QtWidgets.QToolButton.MenuButtonPopup)
self.play_slides_menu.setPopupMode(QtWidgets.QToolButton.ToolButtonPopupMode.MenuButtonPopup)
self.play_slides_menu.setMenu(QtWidgets.QMenu(translate('OpenLP.SlideController', 'Play Slides'),
self.toolbar))
self.toolbar.add_toolbar_widget(self.play_slides_menu)
@ -386,9 +387,9 @@ class SlideController(QtWidgets.QWidget, LogMixin, RegistryProperties):
self.preview_frame = QtWidgets.QFrame(self.splitter)
self.preview_frame.setGeometry(QtCore.QRect(0, 0, 300, int(300 * self.ratio)))
self.preview_frame.setMinimumHeight(100)
self.preview_frame.setSizePolicy(QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Ignored,
QtWidgets.QSizePolicy.Ignored,
QtWidgets.QSizePolicy.Label))
self.preview_frame.setSizePolicy(QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Ignored,
QtWidgets.QSizePolicy.Policy.Ignored,
QtWidgets.QSizePolicy.ControlType.Label))
self.preview_frame.setFrameShape(QtWidgets.QFrame.StyledPanel)
self.preview_frame.setFrameShadow(QtWidgets.QFrame.Sunken)
self.preview_frame.setObjectName('preview_frame')
@ -471,7 +472,7 @@ class SlideController(QtWidgets.QWidget, LogMixin, RegistryProperties):
self.song_menu = QtWidgets.QToolButton(self.toolbar)
self.song_menu.setObjectName('song_menu')
self.song_menu.setText(translate('OpenLP.SlideController', 'Go To'))
self.song_menu.setPopupMode(QtWidgets.QToolButton.InstantPopup)
self.song_menu.setPopupMode(QtWidgets.QToolButton.ToolButtonPopupMode.InstantPopup)
self.song_menu.setMenu(QtWidgets.QMenu(translate('OpenLP.SlideController', 'Go To'), self.toolbar))
def _raise_displays(self):

View File

@ -144,7 +144,7 @@ def is_windows_darkmode():
"""
theme_settings = QtCore.QSettings('HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Themes'
'\\Personalize',
QtCore.QSettings.NativeFormat)
QtCore.QSettings.Format.NativeFormat)
return theme_settings.value('AppsUseLightTheme') == 0
@ -201,28 +201,28 @@ def set_default_darkmode(app):
dark_palette = QtGui.QPalette()
dark_color = QtGui.QColor(45, 45, 45)
disabled_color = QtGui.QColor(127, 127, 127)
dark_palette.setColor(QtGui.QPalette.Window, dark_color)
dark_palette.setColor(QtGui.QPalette.WindowText, QtCore.Qt.white)
dark_palette.setColor(QtGui.QPalette.Disabled, QtGui.QPalette.WindowText, disabled_color)
dark_palette.setColor(QtGui.QPalette.Base, QtGui.QColor(18, 18, 18))
dark_palette.setColor(QtGui.QPalette.AlternateBase, dark_color)
dark_palette.setColor(QtGui.QPalette.ToolTipBase, QtCore.Qt.white)
dark_palette.setColor(QtGui.QPalette.ToolTipText, QtCore.Qt.black)
dark_palette.setColor(QtGui.QPalette.Text, QtCore.Qt.white)
dark_palette.setColor(QtGui.QPalette.Disabled, QtGui.QPalette.Text, disabled_color)
dark_palette.setColor(QtGui.QPalette.Button, dark_color)
dark_palette.setColor(QtGui.QPalette.ButtonText, QtCore.Qt.white)
dark_palette.setColor(QtGui.QPalette.Disabled, QtGui.QPalette.ButtonText, disabled_color)
dark_palette.setColor(QtGui.QPalette.BrightText, QtCore.Qt.red)
dark_palette.setColor(QtGui.QPalette.Link, QtGui.QColor(42, 130, 218))
dark_palette.setColor(QtGui.QPalette.Highlight, QtGui.QColor(42, 130, 218))
dark_palette.setColor(QtGui.QPalette.HighlightedText, QtCore.Qt.black)
dark_palette.setColor(QtGui.QPalette.Disabled, QtGui.QPalette.HighlightedText, disabled_color)
dark_palette.setColor(QtGui.QPalette.ColorRole.Window, dark_color)
dark_palette.setColor(QtGui.QPalette.ColorRole.WindowText, QtCore.Qt.white)
dark_palette.setColor(QtGui.QPalette.ColorGroup.Disabled, QtGui.QPalette.ColorRole.WindowText, disabled_color)
dark_palette.setColor(QtGui.QPalette.ColorRole.Base, QtGui.QColor(18, 18, 18))
dark_palette.setColor(QtGui.QPalette.ColorRole.AlternateBase, dark_color)
dark_palette.setColor(QtGui.QPalette.ColorRole.ToolTipBase, QtCore.Qt.white)
dark_palette.setColor(QtGui.QPalette.ColorRole.ToolTipText, QtCore.Qt.black)
dark_palette.setColor(QtGui.QPalette.ColorRole.Text, QtCore.Qt.white)
dark_palette.setColor(QtGui.QPalette.ColorGroup.Disabled, QtGui.QPalette.ColorRole.Text, disabled_color)
dark_palette.setColor(QtGui.QPalette.ColorRole.Button, dark_color)
dark_palette.setColor(QtGui.QPalette.ColorRole.ButtonText, QtCore.Qt.white)
dark_palette.setColor(QtGui.QPalette.ColorGroup.Disabled, QtGui.QPalette.ColorRole.ButtonText, disabled_color)
dark_palette.setColor(QtGui.QPalette.ColorRole.BrightText, QtCore.Qt.red)
dark_palette.setColor(QtGui.QPalette.ColorRole.Link, QtGui.QColor(42, 130, 218))
dark_palette.setColor(QtGui.QPalette.ColorRole.Highlight, QtGui.QColor(42, 130, 218))
dark_palette.setColor(QtGui.QPalette.ColorRole.HighlightedText, QtCore.Qt.black)
dark_palette.setColor(QtGui.QPalette.ColorGroup.Disabled, QtGui.QPalette.ColorRole.HighlightedText, disabled_color)
# Fixes ugly (not to mention hard to read) disabled menu items.
# Source: https://bugreports.qt.io/browse/QTBUG-10322?focusedCommentId=371060#comment-371060
dark_palette.setColor(QtGui.QPalette.Disabled, QtGui.QPalette.Light, QtCore.Qt.transparent)
dark_palette.setColor(QtGui.QPalette.ColorGroup.Disabled, QtGui.QPalette.ColorRole.Light, QtCore.Qt.transparent)
# Fixes ugly media manager headers.
dark_palette.setColor(QtGui.QPalette.Mid, QtGui.QColor(64, 64, 64))
dark_palette.setColor(QtGui.QPalette.ColorRole.Mid, QtGui.QColor(64, 64, 64))
app.setPalette(dark_palette)
@ -241,7 +241,8 @@ def get_application_stylesheet():
stylesheet = qdarkstyle.load_stylesheet_pyqt5()
else:
if not Registry().get('settings').value('advanced/alternate rows'):
base_color = QtWidgets.QApplication.palette().color(QtGui.QPalette.Active, QtGui.QPalette.Base)
base_color = QtWidgets.QApplication.palette().color(QtGui.QPalette.ColorGroup.Active,
QtGui.QPalette.ColorRole.Base)
alternate_rows_repair_stylesheet = get_alternate_rows_repair_stylesheet(base_color.name())
stylesheet += alternate_rows_repair_stylesheet
if is_win():

View File

@ -76,7 +76,7 @@ class ThemeForm(QtWidgets.QWizard, Ui_ThemeWizard, RegistryProperties):
self.main_area_page.shadow_size_changed.connect(self.calculate_lines)
self.footer_area_page.font_name_changed.connect(self.update_theme)
self.footer_area_page.font_size_changed.connect(self.update_theme)
self.setOption(QtWidgets.QWizard.HaveHelpButton, True)
self.setOption(QtWidgets.QWizard.WizardOption.HaveHelpButton, True)
self.helpRequested.connect(self.provide_help)
def provide_help(self):
@ -167,7 +167,7 @@ class ThemeForm(QtWidgets.QWizard, Ui_ThemeWizard, RegistryProperties):
:param page_id: current page number
"""
enabled = self.page(page_id) == self.area_position_page
self.setOption(QtWidgets.QWizard.HaveCustomButton1, enabled)
self.setOption(QtWidgets.QWizard.WizardOption.HaveCustomButton1, enabled)
if self.page(page_id) == self.preview_page:
self.update_theme()
self.resizeEvent()

View File

@ -54,8 +54,8 @@ class ThemesTab(SettingsTab):
self.global_group_box_layout = QtWidgets.QVBoxLayout(self.global_group_box)
self.global_group_box_layout.setObjectName('global_group_box_layout')
self.default_combo_box = QtWidgets.QComboBox(self.global_group_box)
self.default_combo_box.setSizeAdjustPolicy(QtWidgets.QComboBox.AdjustToMinimumContentsLength)
self.default_combo_box.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
self.default_combo_box.setSizeAdjustPolicy(QtWidgets.QComboBox.SizeAdjustPolicy.AdjustToMinimumContentsLength)
self.default_combo_box.setSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Fixed)
self.default_combo_box.setObjectName('default_combo_box')
self.global_group_box_layout.addWidget(self.default_combo_box)
self.default_list_view = QtWidgets.QLabel(self.global_group_box)

View File

@ -46,14 +46,17 @@ class Ui_ThemeWizard(object):
theme_wizard.setObjectName('OpenLP.ThemeWizard')
theme_wizard.setWindowIcon(UiIcons().main_icon)
theme_wizard.setModal(True)
theme_wizard.setOptions(QtWidgets.QWizard.IndependentPages |
QtWidgets.QWizard.NoBackButtonOnStartPage | QtWidgets.QWizard.HaveCustomButton1)
theme_wizard.setOptions(QtWidgets.QWizard.WizardOption.IndependentPages |
QtWidgets.QWizard.WizardOption.NoBackButtonOnStartPage |
QtWidgets.QWizard.WizardOption.HaveCustomButton1)
theme_wizard.setFixedWidth(640)
if is_macosx(): # pragma: no cover
theme_wizard.setPixmap(QtWidgets.QWizard.BackgroundPixmap, QtGui.QPixmap(':/wizards/openlp-osx-wizard.png'))
theme_wizard.setPixmap(QtWidgets.QWizard.WizardPixmap.BackgroundPixmap,
QtGui.QPixmap(':/wizards/openlp-osx-wizard.png'))
else:
theme_wizard.setWizardStyle(QtWidgets.QWizard.ModernStyle)
self.spacer = QtWidgets.QSpacerItem(10, 0, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum)
theme_wizard.setWizardStyle(QtWidgets.QWizard.WizardStyle.ModernStyle)
self.spacer = QtWidgets.QSpacerItem(10, 0, QtWidgets.QSizePolicy.Policy.Fixed,
QtWidgets.QSizePolicy.Policy.Minimum)
# Welcome Page
add_welcome_page(theme_wizard, ':/wizards/wizard_createtheme.bmp')
# Background Page
@ -130,8 +133,9 @@ class Ui_ThemeWizard(object):
self.area_position_page.setTitle(translate('OpenLP.ThemeWizard', 'Output Area Locations'))
self.area_position_page.setSubTitle(translate('OpenLP.ThemeWizard', 'Allows you to change and move the'
' Main and Footer areas.'))
theme_wizard.setOption(QtWidgets.QWizard.HaveCustomButton1, False)
theme_wizard.setButtonText(QtWidgets.QWizard.CustomButton1, translate('OpenLP.ThemeWizard', 'Layout Preview'))
theme_wizard.setOption(QtWidgets.QWizard.WizardOption.HaveCustomButton1, False)
theme_wizard.setButtonText(QtWidgets.QWizard.WizardButton.CustomButton1,
translate('OpenLP.ThemeWizard', 'Layout Preview'))
self.preview_page.setTitle(translate('OpenLP.ThemeWizard', 'Preview and Save'))
self.preview_page.setSubTitle(translate('OpenLP.ThemeWizard', 'Preview the theme and save it.'))
self.theme_name_label.setText(translate('OpenLP.ThemeWizard', 'Theme name:'))

View File

@ -156,7 +156,7 @@ class SearchEdit(QtWidgets.QLineEdit):
self.menu_button = QtWidgets.QToolButton(self)
self.menu_button.setIcon(UiIcons().shortcuts)
self.menu_button.setCursor(QtCore.Qt.ArrowCursor)
self.menu_button.setPopupMode(QtWidgets.QToolButton.InstantPopup)
self.menu_button.setPopupMode(QtWidgets.QToolButton.ToolButtonPopupMode.InstantPopup)
self.menu_button.setStyleSheet('QToolButton { border: none; padding: 0px 10px 0px 0px; }')
self.menu_button.resize(QtCore.QSize(28, 18))
self.menu_button.setMenu(menu)
@ -400,7 +400,7 @@ class SpellTextEdit(QtWidgets.QPlainTextEdit):
cursor = self.textCursor()
# only select text if not already selected
if not cursor.hasSelection():
cursor.select(QtGui.QTextCursor.WordUnderCursor)
cursor.select(QtGui.QTextCursor.SelectionType.WordUnderCursor)
self.setTextCursor(cursor)
# Add menu with available languages.
if ENCHANT_AVAILABLE:
@ -509,7 +509,7 @@ class Highlighter(QtGui.QSyntaxHighlighter):
text = str(text)
char_format = QtGui.QTextCharFormat()
char_format.setUnderlineColor(QtCore.Qt.red)
char_format.setUnderlineStyle(QtGui.QTextCharFormat.SpellCheckUnderline)
char_format.setUnderlineStyle(QtGui.QTextCharFormat.UnderlineStyle.SpellCheckUnderline)
for word_object in re.finditer(self.WORDS, text):
if not self.spelling_dictionary.check(word_object.group()):
self.setFormat(word_object.start(), word_object.end() - word_object.start(), char_format)
@ -546,8 +546,8 @@ class HistoryComboBox(QtWidgets.QComboBox):
super().__init__(parent)
self.setDuplicatesEnabled(False)
self.setEditable(True)
self.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred)
self.setInsertPolicy(QtWidgets.QComboBox.InsertAtTop)
self.setSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Preferred)
self.setInsertPolicy(QtWidgets.QComboBox.InsertPolicy.InsertAtTop)
def keyPressEvent(self, event):
"""

View File

@ -130,7 +130,8 @@ class OpenLPToolbar(QtWidgets.QToolBar):
log.warning(f'No handle {name} in actions list.')
def add_spacer(self):
size_policy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred)
size_policy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding,
QtWidgets.QSizePolicy.Policy.Preferred)
separator = QtWidgets.QWidget()
separator.setSizePolicy(size_policy)
self.addWidget(separator)
@ -230,7 +231,7 @@ class MediaToolbar(OpenLPToolbar):
# Build the volume_slider.
self.volume_slider = QtWidgets.QSlider(QtCore.Qt.Horizontal)
self.volume_slider.setTickInterval(10)
self.volume_slider.setTickPosition(QtWidgets.QSlider.TicksAbove)
self.volume_slider.setTickPosition(QtWidgets.QSlider.TickPosition.TicksAbove)
self.volume_slider.setMinimum(0)
self.volume_slider.setMaximum(100)
self.volume_slider.setTracking(True)

View File

@ -89,8 +89,8 @@ class ListPreviewWidget(QtWidgets.QTableWidget, RegistryProperties):
self.setColumnCount(1)
self.horizontalHeader().setVisible(False)
self.setColumnWidth(0, self.parent().width())
self.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows)
self.setSelectionMode(QtWidgets.QAbstractItemView.SingleSelection)
self.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectionBehavior.SelectRows)
self.setSelectionMode(QtWidgets.QAbstractItemView.SelectionMode.SingleSelection)
self.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers)
self.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
self.setAlternatingRowColors(True)
@ -293,7 +293,7 @@ class ListWidgetWithDnD(QtWidgets.QListWidget):
self.mime_data_text = name
self.no_results_text = UiStrings().NoResults
self.setSpacing(1)
self.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection)
self.setSelectionMode(QtWidgets.QAbstractItemView.SelectionMode.ExtendedSelection)
self.setAlternatingRowColors(True)
self.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
@ -302,7 +302,7 @@ class ListWidgetWithDnD(QtWidgets.QListWidget):
Activate DnD of widget
"""
self.setAcceptDrops(True)
self.setDragDropMode(QtWidgets.QAbstractItemView.DragDrop)
self.setDragDropMode(QtWidgets.QAbstractItemView.DragDropMode.DragDrop)
Registry().register_function(('%s_dnd' % self.mime_data_text), self.parent().handle_mime_data)
def clear(self, search_while_typing=False):
@ -417,7 +417,7 @@ class TreeWidgetWithDnD(QtWidgets.QTreeWidget):
Activate DnD of widget
"""
self.setAcceptDrops(True)
self.setDragDropMode(QtWidgets.QAbstractItemView.DragDrop)
self.setDragDropMode(QtWidgets.QAbstractItemView.DragDropMode.DragDrop)
Registry().register_function(('%s_dnd' % self.mime_data_text), self.parent().handle_mime_data)
Registry().register_function(('%s_dnd_internal' % self.mime_data_text), self.parent().dnd_move_internal)

View File

@ -76,13 +76,13 @@ class ProxyWidget(QtWidgets.QGroupBox):
self.radio_group = QtWidgets.QButtonGroup(self)
self.no_proxy_radio = QtWidgets.QRadioButton('', self)
self.radio_group.addButton(self.no_proxy_radio, ProxyMode.NO_PROXY)
self.layout.setWidget(0, QtWidgets.QFormLayout.SpanningRole, self.no_proxy_radio)
self.layout.setWidget(0, QtWidgets.QFormLayout.ItemRole.SpanningRole, self.no_proxy_radio)
self.use_sysem_proxy_radio = QtWidgets.QRadioButton('', self)
self.radio_group.addButton(self.use_sysem_proxy_radio, ProxyMode.SYSTEM_PROXY)
self.layout.setWidget(1, QtWidgets.QFormLayout.SpanningRole, self.use_sysem_proxy_radio)
self.layout.setWidget(1, QtWidgets.QFormLayout.ItemRole.SpanningRole, self.use_sysem_proxy_radio)
self.manual_proxy_radio = QtWidgets.QRadioButton('', self)
self.radio_group.addButton(self.manual_proxy_radio, ProxyMode.MANUAL_PROXY)
self.layout.setWidget(2, QtWidgets.QFormLayout.SpanningRole, self.manual_proxy_radio)
self.layout.setWidget(2, QtWidgets.QFormLayout.ItemRole.SpanningRole, self.manual_proxy_radio)
self.http_edit = QtWidgets.QLineEdit(self)
self.layout.addRow('HTTP:', self.http_edit)
self.https_edit = QtWidgets.QLineEdit(self)
@ -90,7 +90,7 @@ class ProxyWidget(QtWidgets.QGroupBox):
self.username_edit = QtWidgets.QLineEdit(self)
self.layout.addRow('Username:', self.username_edit)
self.password_edit = QtWidgets.QLineEdit(self)
self.password_edit.setEchoMode(QtWidgets.QLineEdit.Password)
self.password_edit.setEchoMode(QtWidgets.QLineEdit.EchoMode.Password)
self.layout.addRow('Password:', self.password_edit)
# Signal / Slots
self.radio_group.buttonToggled.connect(self.on_radio_group_button_toggled)
@ -160,7 +160,8 @@ class ProxyDialog(QtWidgets.QDialog):
self.proxy_widget = ProxyWidget(self)
self.layout.addWidget(self.proxy_widget)
self.button_box = \
QtWidgets.QDialogButtonBox(QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel, self)
QtWidgets.QDialogButtonBox(QtWidgets.QDialogButtonBox.StandardButton.Ok |
QtWidgets.QDialogButtonBox.StandardButton.Cancel, self)
self.layout.addWidget(self.button_box)
self.button_box.accepted.connect(self.accept)
self.button_box.rejected.connect(self.reject)

View File

@ -105,8 +105,8 @@ class OpenLPWizard(QtWidgets.QWizard, RegistryProperties):
self.setObjectName(name)
self.open_icon = UiIcons().open
self.delete_icon = UiIcons().delete
self.finish_button = self.button(QtWidgets.QWizard.FinishButton)
self.cancel_button = self.button(QtWidgets.QWizard.CancelButton)
self.finish_button = self.button(QtWidgets.QWizard.WizardButton.FinishButton)
self.cancel_button = self.button(QtWidgets.QWizard.WizardButton.CancelButton)
self.setup_ui(image)
self.register_fields()
self.custom_init()
@ -123,16 +123,18 @@ class OpenLPWizard(QtWidgets.QWizard, RegistryProperties):
"""
self.setWindowIcon(UiIcons().main_icon)
self.setModal(True)
self.setOptions(QtWidgets.QWizard.IndependentPages |
QtWidgets.QWizard.NoBackButtonOnStartPage | QtWidgets.QWizard.NoBackButtonOnLastPage)
self.setOptions(QtWidgets.QWizard.WizardOption.IndependentPages |
QtWidgets.QWizard.WizardOption.NoBackButtonOnStartPage |
QtWidgets.QWizard.WizardOption.NoBackButtonOnLastPage)
# Set up a help button if the class of this instance has overridden the provide_help method
if (self.provide_help.__module__ != __name__):
self.setOption(QtWidgets.QWizard.HaveHelpButton, True)
self.setOption(QtWidgets.QWizard.WizardOption.HaveHelpButton, True)
self.helpRequested.connect(self.provide_help)
if is_macosx():
self.setPixmap(QtWidgets.QWizard.BackgroundPixmap, QtGui.QPixmap(':/wizards/openlp-osx-wizard.png'))
self.setPixmap(QtWidgets.QWizard.WizardPixmap.BackgroundPixmap,
QtGui.QPixmap(':/wizards/openlp-osx-wizard.png'))
else:
self.setWizardStyle(QtWidgets.QWizard.ModernStyle)
self.setWizardStyle(QtWidgets.QWizard.WizardStyle.ModernStyle)
add_welcome_page(self, image)
self.add_custom_pages()
if self.with_progress_page:
@ -189,7 +191,8 @@ class OpenLPWizard(QtWidgets.QWizard, RegistryProperties):
self.progress_layout.addWidget(self.error_report_text_edit)
self.error_button_layout = QtWidgets.QHBoxLayout()
self.error_button_layout.setObjectName('error_button_layout')
spacer = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
spacer = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Policy.Expanding,
QtWidgets.QSizePolicy.Policy.Minimum)
self.error_button_layout.addItem(spacer)
self.error_copy_to_button = QtWidgets.QPushButton(self.progress_page)
self.error_copy_to_button.setObjectName('error_copy_to_button')

View File

@ -144,8 +144,9 @@ class BibleImportForm(OpenLPWizard):
self.format_combo_box.addItems(['', '', '', '', '', '', ''])
self.format_combo_box.setObjectName('FormatComboBox')
self.format_layout.addRow(self.format_label, self.format_combo_box)
self.spacer = QtWidgets.QSpacerItem(10, 0, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum)
self.format_layout.setItem(1, QtWidgets.QFormLayout.LabelRole, self.spacer)
self.spacer = QtWidgets.QSpacerItem(10, 0, QtWidgets.QSizePolicy.Policy.Fixed,
QtWidgets.QSizePolicy.Policy.Minimum)
self.format_layout.setItem(1, QtWidgets.QFormLayout.ItemRole.LabelRole, self.spacer)
self.select_page_layout.addLayout(self.format_layout)
self.select_stack = QtWidgets.QStackedLayout()
self.select_stack.setObjectName('SelectStack')
@ -162,7 +163,7 @@ class BibleImportForm(OpenLPWizard):
dialog_caption=WizardStrings.OpenTypeFile.format(file_type=WizardStrings.OSIS),
show_revert=False)
self.osis_layout.addRow(self.osis_file_label, self.osis_path_edit)
self.osis_layout.setItem(1, QtWidgets.QFormLayout.LabelRole, self.spacer)
self.osis_layout.setItem(1, QtWidgets.QFormLayout.ItemRole.LabelRole, self.spacer)
self.select_stack.addWidget(self.osis_widget)
self.csv_widget = QtWidgets.QWidget(self.select_page)
self.csv_widget.setObjectName('CsvWidget')
@ -192,7 +193,7 @@ class BibleImportForm(OpenLPWizard):
'{name} (*.csv)'.format(name=translate('BiblesPlugin.ImportWizardForm', 'CSV File'))
self.csv_layout.addRow(self.csv_books_label, self.csv_books_path_edit)
self.csv_layout.addRow(self.csv_verses_label, self.csv_verses_path_edit)
self.csv_layout.setItem(3, QtWidgets.QFormLayout.LabelRole, self.spacer)
self.csv_layout.setItem(3, QtWidgets.QFormLayout.ItemRole.LabelRole, self.spacer)
self.select_stack.addWidget(self.csv_widget)
self.open_song_widget = QtWidgets.QWidget(self.select_page)
self.open_song_widget.setObjectName('OpenSongWidget')
@ -208,7 +209,7 @@ class BibleImportForm(OpenLPWizard):
show_revert=False,
)
self.open_song_layout.addRow(self.open_song_file_label, self.open_song_path_edit)
self.open_song_layout.setItem(1, QtWidgets.QFormLayout.LabelRole, self.spacer)
self.open_song_layout.setItem(1, QtWidgets.QFormLayout.ItemRole.LabelRole, self.spacer)
self.select_stack.addWidget(self.open_song_widget)
self.web_widget = QtWidgets.QWidget(self.select_page)
self.web_widget.setObjectName('WebWidget')
@ -218,31 +219,31 @@ class BibleImportForm(OpenLPWizard):
self.web_bible_layout.setObjectName('WebBibleLayout')
self.web_update_label = QtWidgets.QLabel(self.web_widget)
self.web_update_label.setObjectName('WebUpdateLabel')
self.web_bible_layout.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.web_update_label)
self.web_bible_layout.setWidget(0, QtWidgets.QFormLayout.ItemRole.LabelRole, self.web_update_label)
self.web_update_button = QtWidgets.QPushButton(self.web_widget)
self.web_update_button.setObjectName('WebUpdateButton')
self.web_bible_layout.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.web_update_button)
self.web_bible_layout.setWidget(0, QtWidgets.QFormLayout.ItemRole.FieldRole, self.web_update_button)
self.web_source_label = QtWidgets.QLabel(self.web_widget)
self.web_source_label.setObjectName('WebSourceLabel')
self.web_bible_layout.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.web_source_label)
self.web_bible_layout.setWidget(1, QtWidgets.QFormLayout.ItemRole.LabelRole, self.web_source_label)
self.web_source_combo_box = QtWidgets.QComboBox(self.web_widget)
self.web_source_combo_box.setObjectName('WebSourceComboBox')
self.web_source_combo_box.addItems(['', '', ''])
self.web_source_combo_box.setEnabled(False)
self.web_bible_layout.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.web_source_combo_box)
self.web_bible_layout.setWidget(1, QtWidgets.QFormLayout.ItemRole.FieldRole, self.web_source_combo_box)
self.web_translation_label = QtWidgets.QLabel(self.web_bible_tab)
self.web_translation_label.setObjectName('web_translation_label')
self.web_bible_layout.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.web_translation_label)
self.web_bible_layout.setWidget(2, QtWidgets.QFormLayout.ItemRole.LabelRole, self.web_translation_label)
self.web_translation_combo_box = QtWidgets.QComboBox(self.web_bible_tab)
self.web_translation_combo_box.setSizeAdjustPolicy(QtWidgets.QComboBox.AdjustToContents)
self.web_translation_combo_box.setSizeAdjustPolicy(QtWidgets.QComboBox.SizeAdjustPolicy.AdjustToContents)
self.web_translation_combo_box.setObjectName('WebTranslationComboBox')
self.web_translation_combo_box.setEnabled(False)
self.web_bible_layout.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.web_translation_combo_box)
self.web_bible_layout.setWidget(2, QtWidgets.QFormLayout.ItemRole.FieldRole, self.web_translation_combo_box)
self.web_progress_bar = QtWidgets.QProgressBar(self)
self.web_progress_bar.setRange(0, 3)
self.web_progress_bar.setObjectName('WebTranslationProgressBar')
self.web_progress_bar.setVisible(False)
self.web_bible_layout.setWidget(3, QtWidgets.QFormLayout.SpanningRole, self.web_progress_bar)
self.web_bible_layout.setWidget(3, QtWidgets.QFormLayout.ItemRole.SpanningRole, self.web_progress_bar)
self.select_stack.addWidget(self.web_widget)
self.zefania_widget = QtWidgets.QWidget(self.select_page)
self.zefania_widget.setObjectName('ZefaniaWidget')
@ -258,7 +259,7 @@ class BibleImportForm(OpenLPWizard):
show_revert=False,
)
self.zefania_layout.addRow(self.zefania_file_label, self.zefania_path_edit)
self.zefania_layout.setItem(2, QtWidgets.QFormLayout.LabelRole, self.spacer)
self.zefania_layout.setItem(2, QtWidgets.QFormLayout.ItemRole.LabelRole, self.spacer)
self.select_stack.addWidget(self.zefania_widget)
self.sword_widget = QtWidgets.QWidget(self.select_page)
self.sword_widget.setObjectName('SwordWidget')
@ -285,8 +286,8 @@ class BibleImportForm(OpenLPWizard):
self.sword_bible_label = QtWidgets.QLabel(self.sword_folder_tab)
self.sword_bible_label.setObjectName('SwordBibleLabel')
self.sword_bible_combo_box = QtWidgets.QComboBox(self.sword_folder_tab)
self.sword_bible_combo_box.setSizeAdjustPolicy(QtWidgets.QComboBox.AdjustToContents)
self.sword_bible_combo_box.setInsertPolicy(QtWidgets.QComboBox.InsertAlphabetically)
self.sword_bible_combo_box.setSizeAdjustPolicy(QtWidgets.QComboBox.SizeAdjustPolicy.AdjustToContents)
self.sword_bible_combo_box.setInsertPolicy(QtWidgets.QComboBox.InsertPolicy.InsertAlphabetically)
self.sword_bible_combo_box.setObjectName('SwordBibleComboBox')
self.sword_folder_tab_layout.addRow(self.sword_bible_label, self.sword_bible_combo_box)
self.sword_tab_widget.addTab(self.sword_folder_tab, '')
@ -306,8 +307,8 @@ class BibleImportForm(OpenLPWizard):
self.sword_zipbible_label = QtWidgets.QLabel(self.sword_folder_tab)
self.sword_zipbible_label.setObjectName('SwordZipBibleLabel')
self.sword_zipbible_combo_box = QtWidgets.QComboBox(self.sword_zip_tab)
self.sword_zipbible_combo_box.setSizeAdjustPolicy(QtWidgets.QComboBox.AdjustToContents)
self.sword_zipbible_combo_box.setInsertPolicy(QtWidgets.QComboBox.InsertAlphabetically)
self.sword_zipbible_combo_box.setSizeAdjustPolicy(QtWidgets.QComboBox.SizeAdjustPolicy.AdjustToContents)
self.sword_zipbible_combo_box.setInsertPolicy(QtWidgets.QComboBox.InsertPolicy.InsertAlphabetically)
self.sword_zipbible_combo_box.setObjectName('SwordZipBibleComboBox')
self.sword_zip_layout.addRow(self.sword_zipbible_label, self.sword_zipbible_combo_box)
self.sword_tab_widget.addTab(self.sword_zip_tab, '')
@ -330,7 +331,7 @@ class BibleImportForm(OpenLPWizard):
dialog_caption=WizardStrings.OpenTypeFile.format(file_type=WizardStrings.WordProject),
show_revert=False)
self.wordproject_layout.addRow(self.wordproject_file_label, self.wordproject_path_edit)
self.wordproject_layout.setItem(1, QtWidgets.QFormLayout.LabelRole, self.spacer)
self.wordproject_layout.setItem(1, QtWidgets.QFormLayout.ItemRole.LabelRole, self.spacer)
self.select_stack.addWidget(self.wordproject_widget)
self.select_page_layout.addLayout(self.select_stack)
self.addPage(self.select_page)
@ -341,28 +342,28 @@ class BibleImportForm(OpenLPWizard):
self.license_details_layout.setObjectName('LicenseDetailsLayout')
self.version_name_label = QtWidgets.QLabel(self.license_details_page)
self.version_name_label.setObjectName('VersionNameLabel')
self.license_details_layout.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.version_name_label)
self.license_details_layout.setWidget(0, QtWidgets.QFormLayout.ItemRole.LabelRole, self.version_name_label)
self.version_name_edit = QtWidgets.QLineEdit(self.license_details_page)
self.version_name_edit.setObjectName('VersionNameEdit')
self.license_details_layout.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.version_name_edit)
self.license_details_layout.setWidget(0, QtWidgets.QFormLayout.ItemRole.FieldRole, self.version_name_edit)
self.copyright_label = QtWidgets.QLabel(self.license_details_page)
self.copyright_label.setObjectName('CopyrightLabel')
self.license_details_layout.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.copyright_label)
self.license_details_layout.setWidget(1, QtWidgets.QFormLayout.ItemRole.LabelRole, self.copyright_label)
self.copyright_edit = QtWidgets.QLineEdit(self.license_details_page)
self.copyright_edit.setObjectName('CopyrightEdit')
self.license_details_layout.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.copyright_edit)
self.license_details_layout.setWidget(1, QtWidgets.QFormLayout.ItemRole.FieldRole, self.copyright_edit)
self.permissions_label = QtWidgets.QLabel(self.license_details_page)
self.permissions_label.setObjectName('PermissionsLabel')
self.license_details_layout.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.permissions_label)
self.license_details_layout.setWidget(2, QtWidgets.QFormLayout.ItemRole.LabelRole, self.permissions_label)
self.permissions_edit = QtWidgets.QLineEdit(self.license_details_page)
self.permissions_edit.setObjectName('PermissionsEdit')
self.license_details_layout.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.permissions_edit)
self.license_details_layout.setWidget(2, QtWidgets.QFormLayout.ItemRole.FieldRole, self.permissions_edit)
self.full_license_label = QtWidgets.QLabel(self.license_details_page)
self.full_license_label.setObjectName('FullLicenseLabel')
self.license_details_layout.setWidget(3, QtWidgets.QFormLayout.LabelRole, self.full_license_label)
self.license_details_layout.setWidget(3, QtWidgets.QFormLayout.ItemRole.LabelRole, self.full_license_label)
self.full_license_edit = QtWidgets.QPlainTextEdit(self.license_details_page)
self.full_license_edit.setObjectName('FullLicenseEdit')
self.license_details_layout.setWidget(3, QtWidgets.QFormLayout.FieldRole, self.full_license_edit)
self.license_details_layout.setWidget(3, QtWidgets.QFormLayout.ItemRole.FieldRole, self.full_license_edit)
self.addPage(self.license_details_page)
def retranslate_ui(self):
@ -438,7 +439,7 @@ class BibleImportForm(OpenLPWizard):
self.csv_verses_label.minimumSizeHint().width(),
self.open_song_file_label.minimumSizeHint().width(),
self.zefania_file_label.minimumSizeHint().width())
self.spacer.changeSize(label_width, 0, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
self.spacer.changeSize(label_width, 0, QtWidgets.QSizePolicy.Policy.Fixed, QtWidgets.QSizePolicy.Policy.Fixed)
def validateCurrentPage(self):
"""

View File

@ -49,7 +49,8 @@ class Ui_LanguageDialog(object):
self.language_label.setObjectName('language_label')
self.language_h_box_layout.addWidget(self.language_label)
self.language_combo_box = QtWidgets.QComboBox(language_dialog)
size_policy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Fixed)
size_policy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.MinimumExpanding,
QtWidgets.QSizePolicy.Policy.Fixed)
size_policy.setHorizontalStretch(0)
size_policy.setVerticalStretch(0)
size_policy.setHeightForWidth(self.language_combo_box.sizePolicy().hasHeightForWidth())

View File

@ -77,8 +77,10 @@ class BiblesTab(SettingsTab):
self.bible_theme_label = QtWidgets.QLabel(self.verse_display_group_box)
self.bible_theme_label.setObjectName('BibleTheme_label')
self.bible_theme_combo_box = QtWidgets.QComboBox(self.verse_display_group_box)
self.bible_theme_combo_box.setSizeAdjustPolicy(QtWidgets.QComboBox.AdjustToMinimumContentsLength)
self.bible_theme_combo_box.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
self.bible_theme_combo_box.setSizeAdjustPolicy(
QtWidgets.QComboBox.SizeAdjustPolicy.AdjustToMinimumContentsLength)
self.bible_theme_combo_box.setSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding,
QtWidgets.QSizePolicy.Policy.Fixed)
self.bible_theme_combo_box.addItem('')
self.bible_theme_combo_box.setObjectName('BibleThemecombo_box')
self.verse_display_layout.addRow(self.bible_theme_label, self.bible_theme_combo_box)
@ -117,7 +119,7 @@ class BiblesTab(SettingsTab):
self.end_separator_line_edit))
self.scripture_reference_layout.addWidget(self.end_separator_line_edit, 3, 1)
self.left_layout.addWidget(self.scripture_reference_group_box)
self.right_column.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred)
self.right_column.setSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Preferred)
self.language_selection_group_box = QtWidgets.QGroupBox(self.right_column)
self.language_selection_group_box.setObjectName('language_selection_group_box')
self.language_selection_layout = QtWidgets.QVBoxLayout(self.language_selection_group_box)
@ -468,10 +470,10 @@ class BiblesTab(SettingsTab):
Returns a QPalette with greyed out text as used for placeholderText.
"""
palette = QtGui.QPalette()
color = self.palette().color(QtGui.QPalette.Active, QtGui.QPalette.Text)
color = self.palette().color(QtGui.QPalette.ColorGroup.Active, QtGui.QPalette.ColorRole.Text)
if greyed:
color.setAlpha(128)
palette.setColor(QtGui.QPalette.Active, QtGui.QPalette.Text, color)
palette.setColor(QtGui.QPalette.ColorGroup.Active, QtGui.QPalette.ColorRole.Text, color)
return palette
def check_is_verse_number_visible(self):

View File

@ -147,7 +147,7 @@ class BibleMediaItem(MediaManagerItem):
self.page_layout.addWidget(self.search_tab_bar)
# Add the Search tab.
self.search_tab = QtWidgets.QWidget()
self.search_tab.setSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum)
self.search_tab.setSizePolicy(QtWidgets.QSizePolicy.Policy.Minimum, QtWidgets.QSizePolicy.Policy.Minimum)
self.search_tab_bar.addTab(translate('BiblesPlugin.MediaItem', 'Find'))
self.search_layout = QtWidgets.QFormLayout(self.search_tab)
self.search_edit = SearchEdit(self.search_tab, 'bibles')
@ -156,7 +156,7 @@ class BibleMediaItem(MediaManagerItem):
self.page_layout.addWidget(self.search_tab)
# Add the Select tab.
self.select_tab = QtWidgets.QWidget()
self.select_tab.setSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum)
self.select_tab.setSizePolicy(QtWidgets.QSizePolicy.Policy.Minimum, QtWidgets.QSizePolicy.Policy.Minimum)
self.search_tab_bar.addTab(translate('BiblesPlugin.MediaItem', 'Select'))
self.select_layout = QtWidgets.QFormLayout(self.select_tab)
self.book_layout = QtWidgets.QHBoxLayout()
@ -190,7 +190,7 @@ class BibleMediaItem(MediaManagerItem):
self.page_layout.addWidget(self.select_tab)
# General Search Opions
self.options_tab = QtWidgets.QWidget()
self.options_tab.setSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum)
self.options_tab.setSizePolicy(QtWidgets.QSizePolicy.Policy.Minimum, QtWidgets.QSizePolicy.Policy.Minimum)
self.search_tab_bar.addTab(translate('BiblesPlugin.MediaItem', 'Options'))
self.general_bible_layout = QtWidgets.QFormLayout(self.options_tab)
self.version_combo_box = create_horizontal_adjusting_combo_box(self, 'version_combo_box')

View File

@ -65,11 +65,11 @@ def upgrade_2(session, metadata):
msg_box = QtWidgets.QMessageBox()
msg_box.setText(translate('BiblesPlugin', f'The proxy server {proxy} was found in the bible {name}.<br>'
f'Would you like to set it as the proxy for OpenLP?'))
msg_box.setIcon(QtWidgets.QMessageBox.Question)
msg_box.setIcon(QtWidgets.QMessageBox.Icon.Question)
msg_box.addButton(QtWidgets.QMessageBox.No)
http_button = msg_box.addButton('http', QtWidgets.QMessageBox.ActionRole)
both_button = msg_box.addButton(translate('BiblesPlugin', 'both'), QtWidgets.QMessageBox.ActionRole)
https_button = msg_box.addButton('https', QtWidgets.QMessageBox.ActionRole)
http_button = msg_box.addButton('http', QtWidgets.QMessageBox.ButtonRole.ActionRole)
both_button = msg_box.addButton(translate('BiblesPlugin', 'both'), QtWidgets.QMessageBox.ButtonRole.ActionRole)
https_button = msg_box.addButton('https', QtWidgets.QMessageBox.ButtonRole.ActionRole)
msg_box.setDefaultButton(both_button)
msg_box.exec()

View File

@ -82,7 +82,7 @@ class Ui_CustomEditDialog(object):
self.theme_label = QtWidgets.QLabel(custom_edit_dialog)
self.theme_label.setObjectName('theme_label')
self.theme_combo_box = QtWidgets.QComboBox(custom_edit_dialog)
self.theme_combo_box.setSizeAdjustPolicy(QtWidgets.QComboBox.AdjustToContents)
self.theme_combo_box.setSizeAdjustPolicy(QtWidgets.QComboBox.SizeAdjustPolicy.AdjustToContents)
self.theme_combo_box.setObjectName('theme_combo_box')
self.theme_label.setBuddy(self.theme_combo_box)
self.bottom_form_layout.addRow(self.theme_label, self.theme_combo_box)
@ -96,7 +96,7 @@ class Ui_CustomEditDialog(object):
self.preview_button = QtWidgets.QPushButton()
self.button_box = create_button_box(custom_edit_dialog, 'button_box', ['cancel', 'save', 'help'],
[self.preview_button])
self.save_button = self.button_box.button(QtWidgets.QDialogButtonBox.Save)
self.save_button = self.button_box.button(QtWidgets.QDialogButtonBox.StandardButton.Save)
self.dialog_layout.addWidget(self.button_box)
self.retranslate_ui(custom_edit_dialog)

View File

@ -38,7 +38,7 @@ class Ui_ChooseGroupDialog(object):
choose_group_dialog.setObjectName('choose_group_dialog')
choose_group_dialog.resize(399, 119)
self.choose_group_layout = QtWidgets.QFormLayout(choose_group_dialog)
self.choose_group_layout.setFieldGrowthPolicy(QtWidgets.QFormLayout.ExpandingFieldsGrow)
self.choose_group_layout.setFieldGrowthPolicy(QtWidgets.QFormLayout.FieldGrowthPolicy.ExpandingFieldsGrow)
self.choose_group_layout.setContentsMargins(8, 8, 8, 8)
self.choose_group_layout.setSpacing(8)
self.choose_group_layout.setLabelAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
@ -46,29 +46,30 @@ class Ui_ChooseGroupDialog(object):
self.group_question_label = QtWidgets.QLabel(choose_group_dialog)
self.group_question_label.setWordWrap(True)
self.group_question_label.setObjectName('group_question_label')
self.choose_group_layout.setWidget(1, QtWidgets.QFormLayout.SpanningRole, self.group_question_label)
self.choose_group_layout.setWidget(1, QtWidgets.QFormLayout.ItemRole.SpanningRole, self.group_question_label)
self.nogroup_radio_button = QtWidgets.QRadioButton(choose_group_dialog)
self.nogroup_radio_button.setChecked(True)
self.nogroup_radio_button.setObjectName('nogroup_radio_button')
self.choose_group_layout.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.nogroup_radio_button)
self.choose_group_layout.setWidget(2, QtWidgets.QFormLayout.ItemRole.LabelRole, self.nogroup_radio_button)
self.existing_radio_button = QtWidgets.QRadioButton(choose_group_dialog)
self.existing_radio_button.setChecked(False)
self.existing_radio_button.setObjectName('existing_radio_button')
self.choose_group_layout.setWidget(3, QtWidgets.QFormLayout.LabelRole, self.existing_radio_button)
self.choose_group_layout.setWidget(3, QtWidgets.QFormLayout.ItemRole.LabelRole, self.existing_radio_button)
self.group_combobox = QtWidgets.QComboBox(choose_group_dialog)
self.group_combobox.setObjectName('group_combobox')
self.group_combobox.activated.connect(self.on_group_combobox_selected)
self.choose_group_layout.setWidget(3, QtWidgets.QFormLayout.FieldRole, self.group_combobox)
self.choose_group_layout.setWidget(3, QtWidgets.QFormLayout.ItemRole.FieldRole, self.group_combobox)
self.new_radio_button = QtWidgets.QRadioButton(choose_group_dialog)
self.new_radio_button.setChecked(False)
self.new_radio_button.setObjectName('new_radio_button')
self.choose_group_layout.setWidget(4, QtWidgets.QFormLayout.LabelRole, self.new_radio_button)
self.choose_group_layout.setWidget(3, QtWidgets.QFormLayout.ItemRole.FieldRole, self.group_combobox)
self.choose_group_layout.setWidget(4, QtWidgets.QFormLayout.ItemRole.LabelRole, self.new_radio_button)
self.new_group_edit = QtWidgets.QLineEdit(choose_group_dialog)
self.new_group_edit.setObjectName('new_group_edit')
self.new_group_edit.textEdited.connect(self.on_new_group_edit_changed)
self.choose_group_layout.setWidget(4, QtWidgets.QFormLayout.FieldRole, self.new_group_edit)
self.choose_group_layout.setWidget(4, QtWidgets.QFormLayout.ItemRole.FieldRole, self.new_group_edit)
self.group_button_box = create_button_box(choose_group_dialog, 'buttonBox', ['ok'])
self.choose_group_layout.setWidget(5, QtWidgets.QFormLayout.FieldRole, self.group_button_box)
self.choose_group_layout.setWidget(5, QtWidgets.QFormLayout.ItemRole.FieldRole, self.group_button_box)
self.retranslate_ui(choose_group_dialog)
QtCore.QMetaObject.connectSlotsByName(choose_group_dialog)

View File

@ -43,14 +43,16 @@ class ImageTab(SettingsTab):
self.radio_group = QtWidgets.QButtonGroup(self)
self.use_black_radio = QtWidgets.QRadioButton('', self)
self.radio_group.addButton(self.use_black_radio, ImageThemeMode.Black)
self.image_theme_group_box_layout.setWidget(0, QtWidgets.QFormLayout.SpanningRole, self.use_black_radio)
self.image_theme_group_box_layout.setWidget(0, QtWidgets.QFormLayout.ItemRole.SpanningRole,
self.use_black_radio)
self.custom_theme_radio = QtWidgets.QRadioButton('', self)
self.radio_group.addButton(self.custom_theme_radio, ImageThemeMode.CustomTheme)
self.image_theme_group_box_layout.setWidget(2, QtWidgets.QFormLayout.SpanningRole, self.custom_theme_radio)
self.image_theme_group_box_layout.setWidget(2, QtWidgets.QFormLayout.ItemRole.SpanningRole,
self.custom_theme_radio)
# Theme selection
self.theme_combo_box = QtWidgets.QComboBox(self.image_theme_group_box)
self.theme_combo_box.setSizeAdjustPolicy(QtWidgets.QComboBox.AdjustToMinimumContentsLength)
self.theme_combo_box.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
self.theme_combo_box.setSizeAdjustPolicy(QtWidgets.QComboBox.SizeAdjustPolicy.AdjustToMinimumContentsLength)
self.theme_combo_box.setSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Fixed)
self.theme_combo_box.setObjectName('theme_combo_box')
self.image_theme_label = QtWidgets.QLabel(self.theme_combo_box)
self.image_theme_label.setObjectName('image_theme_label')
@ -58,7 +60,7 @@ class ImageTab(SettingsTab):
# Add all to layout
self.left_layout.addWidget(self.image_theme_group_box)
self.left_layout.addStretch()
self.right_column.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred)
self.right_column.setSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Preferred)
self.right_layout.addStretch()
# Signals and slots
self.radio_group.buttonToggled.connect(self.on_radio_group_button_toggled)

View File

@ -46,10 +46,11 @@ class StreamSelectorFormBase(QtWidgets.QDialog):
def setup_base_ui(self):
self.setObjectName('stream_selector')
self.combobox_size_policy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding,
QtWidgets.QSizePolicy.Fixed)
self.combobox_size_policy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.MinimumExpanding,
QtWidgets.QSizePolicy.Policy.Fixed)
self.setSizePolicy(
QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.MinimumExpanding))
QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.MinimumExpanding,
QtWidgets.QSizePolicy.Policy.MinimumExpanding))
self.main_layout = QtWidgets.QVBoxLayout(self)
self.main_layout.setObjectName('main_layout')

View File

@ -30,10 +30,11 @@ class Ui_MediaClipSelector(object):
def setup_ui(self, media_clip_selector):
media_clip_selector.setObjectName('media_clip_selector')
media_clip_selector.resize(554, 654)
self.combobox_size_policy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding,
QtWidgets.QSizePolicy.Fixed)
self.combobox_size_policy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.MinimumExpanding,
QtWidgets.QSizePolicy.Policy.Fixed)
media_clip_selector.setSizePolicy(
QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.MinimumExpanding))
QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.MinimumExpanding,
QtWidgets.QSizePolicy.Policy.MinimumExpanding))
self.main_layout = QtWidgets.QVBoxLayout(media_clip_selector)
self.main_layout.setContentsMargins(8, 8, 8, 8)
self.main_layout.setObjectName('main_layout')
@ -95,8 +96,8 @@ class Ui_MediaClipSelector(object):
# Preview frame
self.preview_frame = QtWidgets.QFrame(media_clip_selector)
self.preview_frame.setMinimumSize(QtCore.QSize(320, 240))
self.preview_frame.setSizePolicy(QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding,
QtWidgets.QSizePolicy.MinimumExpanding))
self.preview_frame.setSizePolicy(QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.MinimumExpanding,
QtWidgets.QSizePolicy.Policy.MinimumExpanding))
self.preview_frame.setStyleSheet('background-color:black;')
self.preview_frame.setFrameShape(QtWidgets.QFrame.NoFrame)
self.preview_frame.setObjectName('preview_frame')
@ -154,10 +155,10 @@ class Ui_MediaClipSelector(object):
self.main_layout.addWidget(self.range_groupbox)
# Save and close buttons
self.button_box = QtWidgets.QDialogButtonBox(media_clip_selector)
self.button_box.addButton(QtWidgets.QDialogButtonBox.Save)
self.button_box.addButton(QtWidgets.QDialogButtonBox.Close)
self.close_button = self.button_box.button(QtWidgets.QDialogButtonBox.Close)
self.save_button = self.button_box.button(QtWidgets.QDialogButtonBox.Save)
self.button_box.addButton(QtWidgets.QDialogButtonBox.StandardButton.Save)
self.button_box.addButton(QtWidgets.QDialogButtonBox.StandardButton.Close)
self.close_button = self.button_box.button(QtWidgets.QDialogButtonBox.StandardButton.Close)
self.save_button = self.button_box.button(QtWidgets.QDialogButtonBox.StandardButton.Save)
self.main_layout.addWidget(self.button_box)
self.retranslate_ui(media_clip_selector)

View File

@ -594,7 +594,7 @@ class MediaClipSelectorForm(QtWidgets.QDialog, Ui_MediaClipSelector, RegistryPro
'Set name of mediaclip'),
translate('MediaPlugin.MediaClipSelectorForm',
'Name of mediaclip:'),
QtWidgets.QLineEdit.Normal)
QtWidgets.QLineEdit.EchoMode.Normal)
# User pressed cancel, don't save the clip
if not ok:
return

View File

@ -59,10 +59,10 @@ class NetworkStreamSelectorForm(StreamSelectorFormBase):
self.main_layout.addWidget(self.more_options_group)
# Save and close buttons
self.button_box = QtWidgets.QDialogButtonBox(self)
self.button_box.addButton(QtWidgets.QDialogButtonBox.Save)
self.button_box.addButton(QtWidgets.QDialogButtonBox.Close)
self.close_button = self.button_box.button(QtWidgets.QDialogButtonBox.Close)
self.save_button = self.button_box.button(QtWidgets.QDialogButtonBox.Save)
self.button_box.addButton(QtWidgets.QDialogButtonBox.StandardButton.Save)
self.button_box.addButton(QtWidgets.QDialogButtonBox.StandardButton.Close)
self.close_button = self.button_box.button(QtWidgets.QDialogButtonBox.StandardButton.Close)
self.save_button = self.button_box.button(QtWidgets.QDialogButtonBox.StandardButton.Save)
self.main_layout.addWidget(self.button_box)
# translate

View File

@ -710,10 +710,10 @@ class Ui_StreamSelector(object):
self.main_layout.addWidget(self.more_options_group)
# Save and close buttons
self.button_box = QtWidgets.QDialogButtonBox(stream_selector)
self.button_box.addButton(QtWidgets.QDialogButtonBox.Save)
self.button_box.addButton(QtWidgets.QDialogButtonBox.Close)
self.close_button = self.button_box.button(QtWidgets.QDialogButtonBox.Close)
self.save_button = self.button_box.button(QtWidgets.QDialogButtonBox.Save)
self.button_box.addButton(QtWidgets.QDialogButtonBox.StandardButton.Save)
self.button_box.addButton(QtWidgets.QDialogButtonBox.StandardButton.Close)
self.close_button = self.button_box.button(QtWidgets.QDialogButtonBox.StandardButton.Close)
self.save_button = self.button_box.button(QtWidgets.QDialogButtonBox.StandardButton.Save)
self.main_layout.addWidget(self.button_box)
# translate

View File

@ -172,7 +172,7 @@ class MediaMediaItem(FolderLibraryItem):
self.load_menu.addAction(self.open_network_stream)
self.toolbar.actions['mediaLoadAction'].setMenu(self.load_menu)
button = self.toolbar.widgetForAction(self.toolbar.actions['mediaLoadAction'])
button.setPopupMode(QtWidgets.QToolButton.MenuButtonPopup)
button.setPopupMode(QtWidgets.QToolButton.ToolButtonPopupMode.MenuButtonPopup)
def generate_slide_data(self, service_item, *, item=None, remote=False, context=ServiceItemContext.Service,
**kwargs):

View File

@ -36,7 +36,7 @@ class Ui_SelectPlanDialog(object):
self.planningcenter_layout = QtWidgets.QFormLayout(planningcenter_dialog)
self.planningcenter_layout.setContentsMargins(50, 50, 50, 50)
self.planningcenter_layout.setSpacing(8)
self.planningcenter_layout.setFieldGrowthPolicy(QtWidgets.QFormLayout.ExpandingFieldsGrow)
self.planningcenter_layout.setFieldGrowthPolicy(QtWidgets.QFormLayout.FieldGrowthPolicy.ExpandingFieldsGrow)
# Service Type GUI Elements -- service_type combo_box
self.service_type_label = QtWidgets.QLabel(planningcenter_dialog)
self.service_type_combo_box = QtWidgets.QComboBox(planningcenter_dialog)
@ -55,11 +55,11 @@ class Ui_SelectPlanDialog(object):
# Import Button
self.button_layout = QtWidgets.QDialogButtonBox(planningcenter_dialog)
self.import_as_new_button = QtWidgets.QPushButton(planningcenter_dialog)
self.button_layout.addButton(self.import_as_new_button, QtWidgets.QDialogButtonBox.AcceptRole)
self.button_layout.addButton(self.import_as_new_button, QtWidgets.QDialogButtonBox.ButtonRole.AcceptRole)
self.update_existing_button = QtWidgets.QPushButton(planningcenter_dialog)
self.button_layout.addButton(self.update_existing_button, QtWidgets.QDialogButtonBox.AcceptRole)
self.button_layout.addButton(self.update_existing_button, QtWidgets.QDialogButtonBox.ButtonRole.AcceptRole)
self.edit_auth_button = QtWidgets.QPushButton(planningcenter_dialog)
self.button_layout.addButton(self.edit_auth_button, QtWidgets.QDialogButtonBox.ActionRole)
self.button_layout.addButton(self.edit_auth_button, QtWidgets.QDialogButtonBox.ButtonRole.ActionRole)
self.planningcenter_layout.addRow(self.button_layout)
self.retranslate_ui(planningcenter_dialog)

View File

@ -41,7 +41,7 @@ class PlanningCenterTab(SettingsTab):
self.auth_group_box = QtWidgets.QGroupBox(self)
self.tab_layout.addWidget(self.auth_group_box)
self.auth_layout = QtWidgets.QFormLayout(self.auth_group_box)
self.auth_layout.setFieldGrowthPolicy(QtWidgets.QFormLayout.AllNonFixedFieldsGrow)
self.auth_layout.setFieldGrowthPolicy(QtWidgets.QFormLayout.FieldGrowthPolicy.AllNonFixedFieldsGrow)
# notice
self.notice_label = QtWidgets.QLabel(self.auth_group_box)
self.notice_label.setWordWrap(True)
@ -63,7 +63,7 @@ class PlanningCenterTab(SettingsTab):
# Buttons
self.button_layout = QtWidgets.QDialogButtonBox(self.auth_group_box)
self.test_credentials_button = QtWidgets.QPushButton(self.auth_group_box)
self.button_layout.addButton(self.test_credentials_button, QtWidgets.QDialogButtonBox.AcceptRole)
self.button_layout.addButton(self.test_credentials_button, QtWidgets.QDialogButtonBox.ButtonRole.AcceptRole)
self.auth_layout.addRow(self.button_layout)
# signals
self.test_credentials_button.clicked.connect(self.on_test_credentials_button_clicked)

View File

@ -87,7 +87,7 @@ class PresentationTab(SettingsTab):
self.left_layout.addWidget(self.impress_group_box)
# setup layout
self.left_layout.addStretch()
self.right_column.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred)
self.right_column.setSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Preferred)
self.right_layout.addStretch()
def retranslate_ui(self):

View File

@ -118,7 +118,7 @@ class DuplicateSongRemovalForm(OpenLPWizard, RegistryProperties):
self.review_scroll_area_widget.setObjectName('review_scroll_area_widget')
self.review_scroll_area_layout = QtWidgets.QHBoxLayout(self.review_scroll_area_widget)
self.review_scroll_area_layout.setObjectName('review_scroll_area_layout')
self.review_scroll_area_layout.setSizeConstraint(QtWidgets.QLayout.SetMinAndMaxSize)
self.review_scroll_area_layout.setSizeConstraint(QtWidgets.QLayout.SizeConstraint.SetMinAndMaxSize)
self.review_scroll_area_layout.setContentsMargins(0, 0, 0, 0)
self.review_scroll_area_layout.setSpacing(0)
self.review_scroll_area.setWidget(self.review_scroll_area_widget)
@ -163,11 +163,11 @@ class DuplicateSongRemovalForm(OpenLPWizard, RegistryProperties):
:param page_id: ID of the page the wizard changed to.
"""
# Hide back button.
self.button(QtWidgets.QWizard.BackButton).hide()
self.button(QtWidgets.QWizard.WizardButton.BackButton).hide()
if page_id == self.searching_page_id:
self.application.set_busy_cursor()
try:
self.button(QtWidgets.QWizard.NextButton).hide()
self.button(QtWidgets.QWizard.WizardButton.NextButton).hide()
# Search duplicate songs.
max_songs = self.plugin.manager.get_object_count(Song)
if max_songs == 0 or max_songs == 1:
@ -202,7 +202,7 @@ class DuplicateSongRemovalForm(OpenLPWizard, RegistryProperties):
self.found_duplicates_edit.appendPlainText(song1.title + " = " + song2.title)
self.review_total_count = len(self.duplicate_song_list)
if self.duplicate_song_list:
self.button(QtWidgets.QWizard.NextButton).show()
self.button(QtWidgets.QWizard.WizardButton.NextButton).show()
else:
self.notify_no_duplicates()
finally:
@ -214,10 +214,10 @@ class DuplicateSongRemovalForm(OpenLPWizard, RegistryProperties):
"""
Notifies the user, that there were no duplicates found in the database.
"""
self.button(QtWidgets.QWizard.FinishButton).show()
self.button(QtWidgets.QWizard.FinishButton).setEnabled(True)
self.button(QtWidgets.QWizard.NextButton).hide()
self.button(QtWidgets.QWizard.CancelButton).hide()
self.button(QtWidgets.QWizard.WizardButton.FinishButton).show()
self.button(QtWidgets.QWizard.WizardButton.FinishButton).setEnabled(True)
self.button(QtWidgets.QWizard.WizardButton.NextButton).hide()
self.button(QtWidgets.QWizard.WizardButton.CancelButton).hide()
QtWidgets.QMessageBox.information(
self, translate('Wizard', 'Information'),
translate('Wizard', 'No duplicate songs have been found in the database.'))
@ -343,7 +343,7 @@ class DuplicateSongRemovalForm(OpenLPWizard, RegistryProperties):
self.review_scroll_area_layout.addStretch(1)
# Change next button to finish button on last review.
if len(self.duplicate_song_list) == 1:
self.button(QtWidgets.QWizard.FinishButton).show()
self.button(QtWidgets.QWizard.FinishButton).setEnabled(True)
self.button(QtWidgets.QWizard.NextButton).hide()
self.button(QtWidgets.QWizard.CancelButton).hide()
self.button(QtWidgets.QWizard.WizardButton.FinishButton).show()
self.button(QtWidgets.QWizard.WizardButton.FinishButton).setEnabled(True)
self.button(QtWidgets.QWizard.WizardButton.NextButton).hide()
self.button(QtWidgets.QWizard.WizardButton.CancelButton).hide()

View File

@ -69,8 +69,8 @@ class Ui_EditSongDialog(object):
self.lyrics_tab_layout.addWidget(self.lyrics_label, 2, 0, QtCore.Qt.AlignTop)
self.verse_list_widget = SingleColumnTableWidget(self.lyrics_tab)
self.verse_list_widget.setAlternatingRowColors(True)
self.verse_list_widget.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows)
self.verse_list_widget.setSelectionMode(QtWidgets.QAbstractItemView.SingleSelection)
self.verse_list_widget.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectionBehavior.SelectRows)
self.verse_list_widget.setSelectionMode(QtWidgets.QAbstractItemView.SelectionMode.SingleSelection)
self.verse_list_widget.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers)
self.verse_list_widget.setObjectName('verse_list_widget')
self.lyrics_label.setBuddy(self.verse_list_widget)
@ -350,9 +350,9 @@ def create_combo_box(parent, name, editable=True):
:param name: The object name
"""
combo_box = QtWidgets.QComboBox(parent)
combo_box.setSizeAdjustPolicy(QtWidgets.QComboBox.AdjustToMinimumContentsLength)
combo_box.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
combo_box.setSizeAdjustPolicy(QtWidgets.QComboBox.SizeAdjustPolicy.AdjustToMinimumContentsLength)
combo_box.setSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Fixed)
combo_box.setEditable(editable)
combo_box.setInsertPolicy(QtWidgets.QComboBox.NoInsert)
combo_box.setInsertPolicy(QtWidgets.QComboBox.InsertPolicy.NoInsert)
combo_box.setObjectName(name)
return combo_box

View File

@ -98,7 +98,7 @@ class EditSongForm(QtWidgets.QDialog, Ui_EditSongDialog, RegistryProperties):
self.preview_button = QtWidgets.QPushButton()
self.preview_button.setObjectName('preview_button')
self.preview_button.setText(UiStrings().SaveAndPreview)
self.button_box.addButton(self.preview_button, QtWidgets.QDialogButtonBox.ActionRole)
self.button_box.addButton(self.preview_button, QtWidgets.QDialogButtonBox.ButtonRole.ActionRole)
self.button_box.clicked.connect(self.on_preview)
# Create other objects and forms
self.manager = manager

View File

@ -138,7 +138,7 @@ class EditVerseForm(QtWidgets.QDialog, Ui_EditVerseDialog):
.format(err_msg=ke)))
return
self.verse_text_edit.setFocus()
self.verse_text_edit.moveCursor(QtGui.QTextCursor.End)
self.verse_text_edit.moveCursor(QtGui.QTextCursor.MoveOperation.End)
def on_transpose_down_button_clicked(self):
"""
@ -160,7 +160,7 @@ class EditVerseForm(QtWidgets.QDialog, Ui_EditVerseDialog):
.format(err_msg=ke)))
return
self.verse_text_edit.setFocus()
self.verse_text_edit.moveCursor(QtGui.QTextCursor.End)
self.verse_text_edit.moveCursor(QtGui.QTextCursor.MoveOperation.End)
def update_suggested_verse_number(self):
"""
@ -219,7 +219,7 @@ class EditVerseForm(QtWidgets.QDialog, Ui_EditVerseDialog):
self.transpose_widget.setVisible(True)
self.verse_text_edit.setPlainText(text)
self.verse_text_edit.setFocus()
self.verse_text_edit.moveCursor(QtGui.QTextCursor.End)
self.verse_text_edit.moveCursor(QtGui.QTextCursor.MoveOperation.End)
def get_verse(self):
"""

View File

@ -49,7 +49,7 @@ class Ui_MediaFilesDialog(object):
self.files_vertical_layout.addWidget(self.select_label)
self.file_list_widget = QtWidgets.QListWidget(media_files_dialog)
self.file_list_widget.setAlternatingRowColors(True)
self.file_list_widget.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection)
self.file_list_widget.setSelectionMode(QtWidgets.QAbstractItemView.SelectionMode.ExtendedSelection)
self.file_list_widget.setObjectName('file_list_widget')
self.files_vertical_layout.addWidget(self.file_list_widget)
self.button_box = create_button_box(media_files_dialog, 'button_box', ['cancel', 'ok'])

View File

@ -103,7 +103,8 @@ class SongExportForm(OpenLPWizard):
self.search_line_edit = QtWidgets.QLineEdit(self.available_songs_page)
self.search_line_edit.setObjectName('search_line_edit')
self.horizontal_layout.addWidget(self.search_line_edit)
spacer_item = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
spacer_item = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Policy.Expanding,
QtWidgets.QSizePolicy.Policy.Minimum)
self.horizontal_layout.addItem(spacer_item)
self.uncheck_button = QtWidgets.QPushButton(self.available_songs_page)
self.uncheck_button.setObjectName('uncheck_button')

View File

@ -112,13 +112,15 @@ class SongImportForm(OpenLPWizard, RegistryProperties):
self.format_combo_box = QtWidgets.QComboBox(self.source_page)
self.format_combo_box.setObjectName('format_combo_box')
self.format_layout.addRow(self.format_label, self.format_combo_box)
self.format_spacer = QtWidgets.QSpacerItem(10, 0, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum)
self.format_layout.setItem(1, QtWidgets.QFormLayout.LabelRole, self.format_spacer)
self.format_spacer = QtWidgets.QSpacerItem(10, 0, QtWidgets.QSizePolicy.Policy.Fixed,
QtWidgets.QSizePolicy.Policy.Minimum)
self.format_layout.setItem(1, QtWidgets.QFormLayout.ItemRole.LabelRole, self.format_spacer)
self.source_layout.addLayout(self.format_layout)
self.format_h_spacing = self.format_layout.horizontalSpacing()
self.format_v_spacing = self.format_layout.verticalSpacing()
self.format_layout.setVerticalSpacing(0)
self.stack_spacer = QtWidgets.QSpacerItem(10, 0, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Expanding)
self.stack_spacer = QtWidgets.QSpacerItem(10, 0, QtWidgets.QSizePolicy.Policy.Fixed,
QtWidgets.QSizePolicy.Policy.Expanding)
self.format_stack = QtWidgets.QStackedLayout()
self.format_stack.setObjectName('format_stack')
self.disablable_formats = []
@ -179,8 +181,8 @@ class SongImportForm(OpenLPWizard, RegistryProperties):
for format_list in SongFormat.get_format_list():
if SongFormat.get(format_list, 'descriptionText') is not None:
self.format_widgets[format_list]['descriptionSpacer'].changeSize(
max_label_width + self.format_h_spacing, 0, QtWidgets.QSizePolicy.Fixed,
QtWidgets.QSizePolicy.Fixed)
max_label_width + self.format_h_spacing, 0, QtWidgets.QSizePolicy.Policy.Fixed,
QtWidgets.QSizePolicy.Policy.Fixed)
def custom_page_changed(self, page_id):
"""
@ -374,7 +376,8 @@ class SongImportForm(OpenLPWizard, RegistryProperties):
if description_text is not None:
description_layout = QtWidgets.QHBoxLayout()
description_layout.setObjectName(prefix + 'DescriptionLayout')
description_spacer = QtWidgets.QSpacerItem(0, 0, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
description_spacer = QtWidgets.QSpacerItem(0, 0, QtWidgets.QSizePolicy.Policy.Fixed,
QtWidgets.QSizePolicy.Policy.Fixed)
description_layout.addSpacerItem(description_spacer)
description_label = QtWidgets.QLabel(import_widget)
description_label.setWordWrap(True)
@ -409,7 +412,7 @@ class SongImportForm(OpenLPWizard, RegistryProperties):
self.format_widgets[this_format]['path_edit'] = path_edit
elif select_mode == SongFormatSelect.MultipleFiles:
file_list_widget = QtWidgets.QListWidget(import_widget)
file_list_widget.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection)
file_list_widget.setSelectionMode(QtWidgets.QAbstractItemView.SelectionMode.ExtendedSelection)
file_list_widget.setObjectName(prefix + 'FileListWidget')
import_layout.addWidget(file_list_widget)
button_layout = QtWidgets.QHBoxLayout()

View File

@ -72,94 +72,97 @@ class SongReviewWidget(QtWidgets.QWidget):
# Add title widget.
self.song_title_label = QtWidgets.QLabel(self)
self.song_title_label.setObjectName('song_title_label')
self.song_info_form_layout.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.song_title_label)
self.song_info_form_layout.setWidget(0, QtWidgets.QFormLayout.ItemRole.LabelRole, self.song_title_label)
self.song_title_content = QtWidgets.QLabel(self)
self.song_title_content.setObjectName('song_title_content')
self.song_title_content.setText(self.song.title)
self.song_title_content.setWordWrap(True)
self.song_info_form_layout.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.song_title_content)
self.song_info_form_layout.setWidget(0, QtWidgets.QFormLayout.ItemRole.FieldRole, self.song_title_content)
# Add alternate title widget.
self.song_alternate_title_label = QtWidgets.QLabel(self)
self.song_alternate_title_label.setObjectName('song_alternate_title_label')
self.song_info_form_layout.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.song_alternate_title_label)
self.song_info_form_layout.setWidget(1, QtWidgets.QFormLayout.ItemRole.LabelRole,
self.song_alternate_title_label)
self.song_alternate_title_content = QtWidgets.QLabel(self)
self.song_alternate_title_content.setObjectName('song_alternate_title_content')
self.song_alternate_title_content.setText(self.song.alternate_title)
self.song_alternate_title_content.setWordWrap(True)
self.song_info_form_layout.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.song_alternate_title_content)
self.song_info_form_layout.setWidget(1, QtWidgets.QFormLayout.ItemRole.FieldRole,
self.song_alternate_title_content)
# Add last modified date.
self.song_last_modified_label = QtWidgets.QLabel(self)
self.song_last_modified_label.setObjectName('last_modified_label')
self.song_last_modified_label.setText('Last Modified:')
self.song_info_form_layout.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.song_last_modified_label)
self.song_info_form_layout.setWidget(2, QtWidgets.QFormLayout.ItemRole.LabelRole, self.song_last_modified_label)
self.song_last_modified_content = QtWidgets.QLabel(self)
self.song_last_modified_content.setObjectName('last_modified_content')
self.song_last_modified_content.setText(self.song.last_modified.strftime("%Y-%m-%d %H:%M:%S"))
self.song_last_modified_content.setWordWrap(True)
self.song_info_form_layout.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.song_last_modified_content)
self.song_info_form_layout.setWidget(2, QtWidgets.QFormLayout.ItemRole.FieldRole,
self.song_last_modified_content)
# Add Theme widget.
self.song_theme_label = QtWidgets.QLabel(self)
self.song_theme_label.setObjectName('song_theme_label')
self.song_theme_label.setText('Theme:')
self.song_info_form_layout.setWidget(3, QtWidgets.QFormLayout.LabelRole, self.song_theme_label)
self.song_info_form_layout.setWidget(3, QtWidgets.QFormLayout.ItemRole.LabelRole, self.song_theme_label)
self.song_theme_content = QtWidgets.QLabel(self)
self.song_theme_content.setObjectName('song_theme_content')
self.song_theme_content.setText(self.song.theme_name)
self.song_theme_content.setWordWrap(True)
self.song_info_form_layout.setWidget(3, QtWidgets.QFormLayout.FieldRole, self.song_theme_content)
self.song_info_form_layout.setWidget(3, QtWidgets.QFormLayout.ItemRole.FieldRole, self.song_theme_content)
# Add CCLI number widget.
self.song_ccli_number_label = QtWidgets.QLabel(self)
self.song_ccli_number_label.setObjectName('song_ccli_number_label')
self.song_info_form_layout.setWidget(4, QtWidgets.QFormLayout.LabelRole, self.song_ccli_number_label)
self.song_info_form_layout.setWidget(4, QtWidgets.QFormLayout.ItemRole.LabelRole, self.song_ccli_number_label)
self.song_ccli_number_content = QtWidgets.QLabel(self)
self.song_ccli_number_content.setObjectName('song_ccli_number_content')
self.song_ccli_number_content.setText(self.song.ccli_number)
self.song_ccli_number_content.setWordWrap(True)
self.song_info_form_layout.setWidget(4, QtWidgets.QFormLayout.FieldRole, self.song_ccli_number_content)
self.song_info_form_layout.setWidget(4, QtWidgets.QFormLayout.ItemRole.FieldRole, self.song_ccli_number_content)
# Add copyright widget.
self.song_copyright_label = QtWidgets.QLabel(self)
self.song_copyright_label.setObjectName('song_copyright_label')
self.song_info_form_layout.setWidget(5, QtWidgets.QFormLayout.LabelRole, self.song_copyright_label)
self.song_info_form_layout.setWidget(5, QtWidgets.QFormLayout.ItemRole.LabelRole, self.song_copyright_label)
self.song_copyright_content = QtWidgets.QLabel(self)
self.song_copyright_content.setObjectName('song_copyright_content')
self.song_copyright_content.setWordWrap(True)
self.song_copyright_content.setText(self.song.copyright)
self.song_info_form_layout.setWidget(5, QtWidgets.QFormLayout.FieldRole, self.song_copyright_content)
self.song_info_form_layout.setWidget(5, QtWidgets.QFormLayout.ItemRole.FieldRole, self.song_copyright_content)
# Add comments widget.
self.song_comments_label = QtWidgets.QLabel(self)
self.song_comments_label.setObjectName('song_comments_label')
self.song_info_form_layout.setWidget(6, QtWidgets.QFormLayout.LabelRole, self.song_comments_label)
self.song_info_form_layout.setWidget(6, QtWidgets.QFormLayout.ItemRole.LabelRole, self.song_comments_label)
self.song_comments_content = QtWidgets.QLabel(self)
self.song_comments_content.setObjectName('song_comments_content')
self.song_comments_content.setText(self.song.comments)
self.song_comments_content.setWordWrap(True)
self.song_info_form_layout.setWidget(6, QtWidgets.QFormLayout.FieldRole, self.song_comments_content)
self.song_info_form_layout.setWidget(6, QtWidgets.QFormLayout.ItemRole.FieldRole, self.song_comments_content)
# Add authors widget.
self.song_authors_label = QtWidgets.QLabel(self)
self.song_authors_label.setObjectName('song_authors_label')
self.song_info_form_layout.setWidget(7, QtWidgets.QFormLayout.LabelRole, self.song_authors_label)
self.song_info_form_layout.setWidget(7, QtWidgets.QFormLayout.ItemRole.LabelRole, self.song_authors_label)
self.song_authors_content = QtWidgets.QLabel(self)
self.song_authors_content.setObjectName('song_authors_content')
self.song_authors_content.setWordWrap(True)
authors_text = ', '.join([author.display_name for author in self.song.authors])
self.song_authors_content.setText(authors_text)
self.song_info_form_layout.setWidget(7, QtWidgets.QFormLayout.FieldRole, self.song_authors_content)
self.song_info_form_layout.setWidget(7, QtWidgets.QFormLayout.ItemRole.FieldRole, self.song_authors_content)
# Add verse order widget.
self.song_verse_order_label = QtWidgets.QLabel(self)
self.song_verse_order_label.setObjectName('song_verse_order_label')
self.song_info_form_layout.setWidget(8, QtWidgets.QFormLayout.LabelRole, self.song_verse_order_label)
self.song_info_form_layout.setWidget(8, QtWidgets.QFormLayout.ItemRole.LabelRole, self.song_verse_order_label)
self.song_verse_order_content = QtWidgets.QLabel(self)
self.song_verse_order_content.setObjectName('song_verse_order_content')
self.song_verse_order_content.setText(self.song.verse_order)
self.song_verse_order_content.setWordWrap(True)
self.song_info_form_layout.setWidget(8, QtWidgets.QFormLayout.FieldRole, self.song_verse_order_content)
self.song_info_form_layout.setWidget(8, QtWidgets.QFormLayout.ItemRole.FieldRole, self.song_verse_order_content)
self.song_group_box_layout.addLayout(self.song_info_form_layout)
# Add verses widget.
self.song_info_verse_list_widget = QtWidgets.QTableWidget(self.song_group_box)
self.song_info_verse_list_widget.setColumnCount(1)
self.song_info_verse_list_widget.horizontalHeader().setVisible(False)
self.song_info_verse_list_widget.setObjectName('song_info_verse_list_widget')
self.song_info_verse_list_widget.setSelectionMode(QtWidgets.QAbstractItemView.NoSelection)
self.song_info_verse_list_widget.setSelectionMode(QtWidgets.QAbstractItemView.SelectionMode.NoSelection)
self.song_info_verse_list_widget.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers)
self.song_info_verse_list_widget.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
self.song_info_verse_list_widget.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
@ -202,7 +205,7 @@ class SongReviewWidget(QtWidgets.QWidget):
self.song_remove_button = QtWidgets.QPushButton(self)
self.song_remove_button.setObjectName('song_remove_button')
self.song_remove_button.setIcon(UiIcons().delete)
self.song_remove_button.setSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
self.song_remove_button.setSizePolicy(QtWidgets.QSizePolicy.Policy.Fixed, QtWidgets.QSizePolicy.Policy.Fixed)
self.song_vertical_layout.addWidget(self.song_remove_button, alignment=QtCore.Qt.AlignHCenter)
def retranslate_ui(self):

View File

@ -137,7 +137,7 @@ class SongsTab(SettingsTab):
self.ccli_password_label = QtWidgets.QLabel(self.ccli_login_group_box)
self.ccli_password_label.setObjectName('ccli_password_label')
self.ccli_password = QtWidgets.QLineEdit(self.ccli_login_group_box)
self.ccli_password.setEchoMode(QtWidgets.QLineEdit.Password)
self.ccli_password.setEchoMode(QtWidgets.QLineEdit.EchoMode.Password)
self.ccli_password.setObjectName('ccli_password')
self.ccli_login_layout.addRow(self.ccli_password_label, self.ccli_password)
self.right_layout.addWidget(self.ccli_login_group_box)

View File

@ -49,7 +49,7 @@ class Ui_SongUsageDeleteDialog(object):
self.delete_calendar = QtWidgets.QCalendarWidget(song_usage_delete_dialog)
self.delete_calendar.setFirstDayOfWeek(QtCore.Qt.Sunday)
self.delete_calendar.setGridVisible(True)
self.delete_calendar.setVerticalHeaderFormat(QtWidgets.QCalendarWidget.NoVerticalHeader)
self.delete_calendar.setVerticalHeaderFormat(QtWidgets.QCalendarWidget.VerticalHeaderFormat.NoVerticalHeader)
self.delete_calendar.setObjectName('delete_calendar')
self.vertical_layout.addWidget(self.delete_calendar)
self.button_box = create_button_box(song_usage_delete_dialog, 'button_box', ['cancel', 'ok', 'help'])

View File

@ -47,13 +47,13 @@ class SongUsageDeleteForm(QtWidgets.QDialog, Ui_SongUsageDeleteDialog, RegistryP
:param button: The button pressed
"""
if self.button_box.standardButton(button) == QtWidgets.QDialogButtonBox.Ok:
if self.button_box.standardButton(button) == QtWidgets.QDialogButtonBox.StandardButton.Ok:
ret = QtWidgets.QMessageBox.question(self,
translate('SongUsagePlugin.SongUsageDeleteForm',
'Delete Selected Song Usage Events?'),
translate('SongUsagePlugin.SongUsageDeleteForm',
'Are you sure you want to delete selected Song Usage data?'),
defaultButton=QtWidgets.QMessageBox.No)
defaultButton=QtWidgets.QMessageBox.StandardButton.No)
if ret == QtWidgets.QMessageBox.Yes:
delete_date = self.delete_calendar.selectedDate().toPyDate()
self.manager.delete_all_objects(SongUsageItem, SongUsageItem.usagedate <= delete_date)

View File

@ -74,7 +74,7 @@ def settings(qapp, registry):
"""A Settings() instance"""
fd, ini_file = mkstemp('.ini')
Settings.set_filename(ini_file)
Settings().setDefaultFormat(QtCore.QSettings.IniFormat)
Settings().setDefaultFormat(QtCore.QSettings.Format.IniFormat)
# Needed on windows to make sure a Settings object is available during the tests
sets = Settings()
sets.setValue('themes/global theme', 'my_theme')

View File

@ -206,8 +206,10 @@ def test_build_icon_with_resource():
patch('openlp.core.lib.QtGui.QPixmap') as MockedQPixmap:
# GIVEN: A mocked QIcon and a mocked QPixmap
MockedQtGui.QIcon = MagicMock
MockedQtGui.QIcon.Normal = 1
MockedQtGui.QIcon.Off = 2
MockedQtGui.QIcon.Mode = MagicMock
MockedQtGui.QIcon.State = MagicMock
MockedQtGui.QIcon.Mode.Normal = 1
MockedQtGui.QIcon.State.Off = 2
MockedQPixmap.return_value = 'mocked_pixmap'
resource_uri = ':/resource/uri'

View File

@ -45,7 +45,7 @@ def test_add_welcome_page():
# THEN: The wizard should have one page with a pixmap.
assert 1 == len(wizard.pageIds()), 'The wizard should have one page.'
assert isinstance(wizard.page(0).pixmap(QtWidgets.QWizard.WatermarkPixmap), QtGui.QPixmap)
assert isinstance(wizard.page(0).pixmap(QtWidgets.QWizard.WizardPixmap.WatermarkPixmap), QtGui.QPixmap)
def test_create_button_box():
@ -70,11 +70,11 @@ def test_create_button_box():
# WHEN: We create the button box with a custom button and a custom role
btnbox = create_button_box(dialog, 'my_btns', None,
[(QtWidgets.QPushButton('Help'), QtWidgets.QDialogButtonBox.HelpRole)])
[(QtWidgets.QPushButton('Help'), QtWidgets.QDialogButtonBox.ButtonRole.HelpRole)])
# THEN: We should get a QDialogButtonBox with one button with a certain role
assert isinstance(btnbox, QtWidgets.QDialogButtonBox)
assert 1 == len(btnbox.buttons())
assert QtWidgets.QDialogButtonBox.HelpRole, btnbox.buttonRole(btnbox.buttons()[0])
assert QtWidgets.QDialogButtonBox.ButtonRole.HelpRole, btnbox.buttonRole(btnbox.buttons()[0])
@patch('openlp.core.lib.ui.Registry')
@ -136,7 +136,7 @@ def test_create_horizontal_adjusting_combo_box():
# THEN: We should get a ComboBox
assert isinstance(combo, QtWidgets.QComboBox)
assert combo.objectName() == 'combo1'
assert QtWidgets.QComboBox.AdjustToMinimumContentsLength == combo.sizeAdjustPolicy()
assert QtWidgets.QComboBox.SizeAdjustPolicy.AdjustToMinimumContentsLength == combo.sizeAdjustPolicy()
@patch('openlp.core.lib.ui.log')

View File

@ -273,7 +273,7 @@ def test_on_custom_button_clicked(mocked_proxy_dialog):
frw = FirstTimeForm(None)
# WHEN: Calling _on_custom_button_clicked with a different button to the 'internet settings button.
frw._on_custom_button_clicked(QtWidgets.QWizard.CustomButton2)
frw._on_custom_button_clicked(QtWidgets.QWizard.WizardButton.CustomButton2)
# THEN: The ProxyDialog should not be shown.
mocked_proxy_dialog.assert_not_called()
@ -288,7 +288,7 @@ def test_on_custom_button_clicked_internet_settings(mocked_proxy_dialog):
frw = FirstTimeForm(None)
# WHEN: Calling _on_custom_button_clicked with the constant for the 'internet settings' button (CustomButton1)
frw._on_custom_button_clicked(QtWidgets.QWizard.CustomButton1)
frw._on_custom_button_clicked(QtWidgets.QWizard.WizardButton.CustomButton1)
# THEN: The ProxyDialog should be shown.
mocked_proxy_dialog.assert_called_with(frw)
@ -493,7 +493,7 @@ def test_help(mocked_help, settings):
frw = FirstTimeForm(None)
# WHEN: The Help button is clicked
QtTest.QTest.mouseClick(frw.button(QtWidgets.QWizard.HelpButton), QtCore.Qt.LeftButton)
QtTest.QTest.mouseClick(frw.button(QtWidgets.QWizard.WizardButton.HelpButton), QtCore.Qt.LeftButton)
# THEN: The Help function should be called
mocked_help.assert_called_once()

View File

@ -1436,7 +1436,7 @@ def test_service_manager_delete_confirmation_dialog(MockMessageBox, registry):
mocked_message_box = MagicMock()
MockMessageBox.return_value = mocked_message_box
# Restore a couple of items for a more realistic situation
MockMessageBox.Question = QtWidgets.QMessageBox.Question
MockMessageBox.Question = QtWidgets.QMessageBox.Icon.Question
MockMessageBox.Close = QtWidgets.QMessageBox.Close
MockMessageBox.Cancel = QtWidgets.QMessageBox.Cancel
MockMessageBox.StandardButtons = QtWidgets.QMessageBox.StandardButtons
@ -1445,7 +1445,7 @@ def test_service_manager_delete_confirmation_dialog(MockMessageBox, registry):
service_manager._delete_confirmation_dialog()
# THEN: All the correct things should have been called
MockMessageBox.assert_called_once_with(QtWidgets.QMessageBox.Question, 'Delete item from service',
MockMessageBox.assert_called_once_with(QtWidgets.QMessageBox.Icon.Question, 'Delete item from service',
'Are you sure you want to delete this item from the service?',
QtWidgets.QMessageBox.StandardButtons(QtWidgets.QMessageBox.Close |
QtWidgets.QMessageBox.Cancel),

View File

@ -178,7 +178,8 @@ def test_help(mocked_help, settings):
settings_form = SettingsForm(None)
# WHEN: The Help button is clicked
QtTest.QTest.mouseClick(settings_form.button_box.button(QtWidgets.QDialogButtonBox.Help), QtCore.Qt.LeftButton)
QtTest.QTest.mouseClick(settings_form.button_box.button(QtWidgets.QDialogButtonBox.StandardButton.Help),
QtCore.Qt.LeftButton)
# THEN: The Help function should be called
mocked_help.assert_called_once()

View File

@ -37,7 +37,8 @@ def test_help(mocked_help, settings):
alert_form = AlertForm(MagicMock())
# WHEN: The Help button is clicked
QtTest.QTest.mouseClick(alert_form.button_box.button(QtWidgets.QDialogButtonBox.Help), QtCore.Qt.LeftButton)
QtTest.QTest.mouseClick(alert_form.button_box.button(QtWidgets.QDialogButtonBox.StandardButton.Help),
QtCore.Qt.LeftButton)
# THEN: The Help function should be called
mocked_help.assert_called_once()

View File

@ -99,7 +99,8 @@ class TestBibleImportForm(TestCase, TestMixin):
bible_import_form = BibleImportForm(None, MagicMock(), None)
# WHEN: The Help button is clicked
QtTest.QTest.mouseClick(bible_import_form.button(QtWidgets.QWizard.HelpButton), QtCore.Qt.LeftButton)
QtTest.QTest.mouseClick(bible_import_form.button(QtWidgets.QWizard.WizardButton.HelpButton),
QtCore.Qt.LeftButton)
# THEN: The Help function should be called
mocked_help.assert_called_once()

View File

@ -38,7 +38,8 @@ def test_help(mocked_help, settings):
edit_bible_form = EditBibleForm(MagicMock(), main_window, MagicMock())
# WHEN: The Help button is clicked
QtTest.QTest.mouseClick(edit_bible_form.button_box.button(QtWidgets.QDialogButtonBox.Help), QtCore.Qt.LeftButton)
QtTest.QTest.mouseClick(edit_bible_form.button_box.button(QtWidgets.QDialogButtonBox.StandardButton.Help),
QtCore.Qt.LeftButton)
# THEN: The Help function should be called
mocked_help.assert_called_once()

View File

@ -144,7 +144,8 @@ def test_help(mocked_help, settings):
custom_form = EditCustomForm(MagicMock(), main_window, MagicMock())
# WHEN: The Help button is clicked
QtTest.QTest.mouseClick(custom_form.button_box.button(QtWidgets.QDialogButtonBox.Help), QtCore.Qt.LeftButton)
QtTest.QTest.mouseClick(custom_form.button_box.button(QtWidgets.QDialogButtonBox.StandardButton.Help),
QtCore.Qt.LeftButton)
# THEN: The Help function should be called
mocked_help.assert_called_once()

View File

@ -157,7 +157,8 @@ def test_help(mocked_help, settings):
edit_song_form = EditSongForm(MagicMock(), main_window, MagicMock())
# WHEN: The Help button is clicked
QtTest.QTest.mouseClick(edit_song_form.button_box.button(QtWidgets.QDialogButtonBox.Help), QtCore.Qt.LeftButton)
QtTest.QTest.mouseClick(edit_song_form.button_box.button(QtWidgets.QDialogButtonBox.StandardButton.Help),
QtCore.Qt.LeftButton)
# THEN: The Help function should be called
mocked_help.assert_called_once()

View File

@ -306,7 +306,7 @@ def test_set_verse_single(settings, edit_verse_form):
mocked_transpose_widget.setVisible.assert_called_once_with(False)
mocked_verse_text_edit.setPlainText.assert_called_once_with('Amazing grace, how sweet the sound')
mocked_verse_text_edit.setFocus.assert_called_once_with()
mocked_verse_text_edit.moveCursor.assert_called_once_with(QtGui.QTextCursor.End)
mocked_verse_text_edit.moveCursor.assert_called_once_with(QtGui.QTextCursor.MoveOperation.End)
def test_set_verse_multiple(settings, edit_verse_form):
@ -331,7 +331,7 @@ def test_set_verse_multiple(settings, edit_verse_form):
mocked_transpose_widget.setVisible.assert_called_once_with(True)
mocked_verse_text_edit.setPlainText.assert_called_once_with('---[Verse:1]---\n')
mocked_verse_text_edit.setFocus.assert_called_once_with()
mocked_verse_text_edit.moveCursor.assert_called_once_with(QtGui.QTextCursor.End)
mocked_verse_text_edit.moveCursor.assert_called_once_with(QtGui.QTextCursor.MoveOperation.End)
def test_set_verse_multiple_chords_disabled(settings, edit_verse_form):
@ -356,7 +356,7 @@ def test_set_verse_multiple_chords_disabled(settings, edit_verse_form):
mocked_transpose_widget.setVisible.assert_not_called()
mocked_verse_text_edit.setPlainText.assert_called_once_with('---[Verse:1]---\n')
mocked_verse_text_edit.setFocus.assert_called_once_with()
mocked_verse_text_edit.moveCursor.assert_called_once_with(QtGui.QTextCursor.End)
mocked_verse_text_edit.moveCursor.assert_called_once_with(QtGui.QTextCursor.MoveOperation.End)
def test_add_splitter_to_text(edit_verse_form):

View File

@ -38,7 +38,8 @@ def test_help(mocked_help, settings):
delete_form = SongUsageDeleteForm(MagicMock(), main_window)
# WHEN: The Help button is clicked
QtTest.QTest.mouseClick(delete_form.button_box.button(QtWidgets.QDialogButtonBox.Help), QtCore.Qt.LeftButton)
QtTest.QTest.mouseClick(delete_form.button_box.button(
QtWidgets.QDialogButtonBox.StandardButton.Help), QtCore.Qt.LeftButton)
# THEN: The Help function should be called
mocked_help.assert_called_once()

View File

@ -38,7 +38,8 @@ def test_help(mocked_help, settings):
detail_form = SongUsageDetailForm(MagicMock(), main_window)
# WHEN: The Help button is clicked
QtTest.QTest.mouseClick(detail_form.button_box.button(QtWidgets.QDialogButtonBox.Help), QtCore.Qt.LeftButton)
QtTest.QTest.mouseClick(detail_form.button_box.button(QtWidgets.QDialogButtonBox.StandardButton.Help),
QtCore.Qt.LeftButton)
# THEN: The Help function should be called
mocked_help.assert_called_once()