forked from openlp/openlp
Start deobfuscating UI library
This commit is contained in:
parent
2816db8be3
commit
baf18ea1c7
@ -38,6 +38,9 @@ def add_welcome_page(parent, image):
|
||||
"""
|
||||
Generate an opening welcome page for a wizard using a provided image.
|
||||
|
||||
``parent``
|
||||
A ``QWizard`` object to add the welcome page to.
|
||||
|
||||
``image``
|
||||
A splash image for the wizard.
|
||||
"""
|
||||
@ -58,9 +61,14 @@ def add_welcome_page(parent, image):
|
||||
parent.welcomeLayout.addStretch()
|
||||
parent.addPage(parent.welcomePage)
|
||||
|
||||
def save_cancel_button_box(parent):
|
||||
def create_save_cancel_button_box(parent):
|
||||
"""
|
||||
Return a standard dialog button box with save and cancel buttons.
|
||||
Creates a standard dialog button box with save and cancel buttons. The
|
||||
button box is connected to the parent's ``accept()`` and ``reject()``
|
||||
methods to handle the default ``accepted()`` and ``rejected()`` signals.
|
||||
|
||||
``parent``
|
||||
The parent object. This should be a ``QWidget`` descendant.
|
||||
"""
|
||||
button_box = QtGui.QDialogButtonBox(parent)
|
||||
button_box.setStandardButtons(
|
||||
@ -109,9 +117,18 @@ def media_item_combo_box(parent, name):
|
||||
combo.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
|
||||
return combo
|
||||
|
||||
def delete_push_button(parent, icon=None):
|
||||
def create_delete_push_button(parent, icon=None):
|
||||
"""
|
||||
Return a standard push button with delete label.
|
||||
Creates a standard push button with a delete label and optional icon. The
|
||||
button is connected to the parent's ``onDeleteButtonClicked()`` method to
|
||||
handle the ``clicked()`` signal.
|
||||
|
||||
``parent``
|
||||
The parent object. This should be a ``QWidget`` descendant.
|
||||
|
||||
``icon``
|
||||
An icon to display on the button. This can be either a ``QIcon``, a
|
||||
resource path or a file name.
|
||||
"""
|
||||
delete_button = QtGui.QPushButton(parent)
|
||||
delete_button.setObjectName(u'deleteButton')
|
||||
@ -124,9 +141,15 @@ def delete_push_button(parent, icon=None):
|
||||
QtCore.SIGNAL(u'clicked()'), parent.onDeleteButtonClicked)
|
||||
return delete_button
|
||||
|
||||
def up_down_push_button_set(parent):
|
||||
def create_up_down_push_button_set(parent):
|
||||
"""
|
||||
Return a standard set of two push buttons for up and down use with lists.
|
||||
Creates a standard set of two push buttons, one for up and the other for
|
||||
down, for use with lists. The buttons use arrow icons and no text and are
|
||||
connected to the parent's ``onUpButtonClicked()`` and
|
||||
``onDownButtonClicked()`` to handle their respective ``clicked()`` signals.
|
||||
|
||||
``parent``
|
||||
The parent object. This should be a ``QWidget`` descendant.
|
||||
"""
|
||||
up_button = QtGui.QPushButton(parent)
|
||||
up_button.setIcon(build_icon(u':/services/service_up.png'))
|
||||
@ -185,7 +208,13 @@ def shortcut_action(parent, text, shortcuts, function):
|
||||
|
||||
def add_widget_completer(cache, widget):
|
||||
"""
|
||||
Add a text autocompleter to a widget.
|
||||
Adds a text autocompleter to a widget.
|
||||
|
||||
``cache``
|
||||
The list of items to use as suggestions.
|
||||
|
||||
``widget``
|
||||
The object to use the completer.
|
||||
"""
|
||||
completer = QtGui.QCompleter(cache)
|
||||
completer.setCaseSensitivity(QtCore.Qt.CaseInsensitive)
|
||||
|
@ -27,8 +27,8 @@
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import translate
|
||||
from openlp.core.lib.ui import save_cancel_button_box, delete_push_button, \
|
||||
up_down_push_button_set
|
||||
from openlp.core.lib.ui import create_save_cancel_button_box, \
|
||||
create_delete_push_button, create_up_down_push_button_set
|
||||
|
||||
class Ui_ServiceItemEditDialog(object):
|
||||
def setupUi(self, serviceItemEditDialog):
|
||||
@ -41,16 +41,16 @@ class Ui_ServiceItemEditDialog(object):
|
||||
self.dialogLayout.addWidget(self.listWidget, 0, 0)
|
||||
self.buttonLayout = QtGui.QVBoxLayout()
|
||||
self.buttonLayout.setObjectName(u'buttonLayout')
|
||||
self.deleteButton = delete_push_button(serviceItemEditDialog)
|
||||
self.deleteButton = create_delete_push_button(serviceItemEditDialog)
|
||||
self.buttonLayout.addWidget(self.deleteButton)
|
||||
self.buttonLayout.addStretch()
|
||||
self.upButton, self.downButton = up_down_push_button_set(
|
||||
self.upButton, self.downButton = create_up_down_push_button_set(
|
||||
serviceItemEditDialog)
|
||||
self.buttonLayout.addWidget(self.upButton)
|
||||
self.buttonLayout.addWidget(self.downButton)
|
||||
self.dialogLayout.addLayout(self.buttonLayout, 0, 1)
|
||||
self.dialogLayout.addWidget(
|
||||
save_cancel_button_box(serviceItemEditDialog), 1, 0, 1, 2)
|
||||
create_save_cancel_button_box(serviceItemEditDialog), 1, 0, 1, 2)
|
||||
self.retranslateUi(serviceItemEditDialog)
|
||||
QtCore.QMetaObject.connectSlotsByName(serviceItemEditDialog)
|
||||
|
||||
|
@ -27,7 +27,7 @@
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import translate
|
||||
from openlp.core.lib.ui import save_cancel_button_box
|
||||
from openlp.core.lib.ui import create_save_cancel_button_box
|
||||
|
||||
class ServiceNoteForm(QtGui.QDialog):
|
||||
"""
|
||||
@ -48,7 +48,7 @@ class ServiceNoteForm(QtGui.QDialog):
|
||||
self.textEdit = QtGui.QTextEdit(self)
|
||||
self.textEdit.setObjectName(u'textEdit')
|
||||
self.dialogLayout.addWidget(self.textEdit)
|
||||
self.dialogLayout.addWidget(save_cancel_button_box(self))
|
||||
self.dialogLayout.addWidget(create_save_cancel_button_box(self))
|
||||
QtCore.QMetaObject.connectSlotsByName(self)
|
||||
|
||||
def retranslateUi(self):
|
||||
|
@ -27,7 +27,7 @@
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import build_icon, translate
|
||||
from openlp.core.lib.ui import delete_push_button
|
||||
from openlp.core.lib.ui import create_delete_push_button
|
||||
|
||||
class Ui_AlertDialog(object):
|
||||
def setupUi(self, alertDialog):
|
||||
@ -66,7 +66,7 @@ class Ui_AlertDialog(object):
|
||||
self.saveButton.setIcon(build_icon(u':/general/general_save.png'))
|
||||
self.saveButton.setObjectName(u'saveButton')
|
||||
self.manageButtonLayout.addWidget(self.saveButton)
|
||||
self.deleteButton = delete_push_button(alertDialog)
|
||||
self.deleteButton = create_delete_push_button(alertDialog)
|
||||
self.deleteButton.setEnabled(False)
|
||||
self.manageButtonLayout.addWidget(self.deleteButton)
|
||||
self.manageButtonLayout.addStretch()
|
||||
|
@ -27,8 +27,8 @@
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import build_icon, translate
|
||||
from openlp.core.lib.ui import save_cancel_button_box, delete_push_button, \
|
||||
up_down_push_button_set
|
||||
from openlp.core.lib.ui import create_save_cancel_button_box, \
|
||||
create_delete_push_button, create_up_down_push_button_set
|
||||
|
||||
class Ui_CustomEditDialog(object):
|
||||
def setupUi(self, customEditDialog):
|
||||
@ -66,11 +66,11 @@ class Ui_CustomEditDialog(object):
|
||||
self.editAllButton = QtGui.QPushButton(customEditDialog)
|
||||
self.editAllButton.setObjectName(u'editAllButton')
|
||||
self.buttonLayout.addWidget(self.editAllButton)
|
||||
self.deleteButton = delete_push_button(customEditDialog)
|
||||
self.deleteButton = create_delete_push_button(customEditDialog)
|
||||
self.deleteButton.setEnabled(False)
|
||||
self.buttonLayout.addWidget(self.deleteButton)
|
||||
self.buttonLayout.addStretch()
|
||||
self.upButton, self.downButton = up_down_push_button_set(
|
||||
self.upButton, self.downButton = create_up_down_push_button_set(
|
||||
customEditDialog)
|
||||
self.upButton.setEnabled(False)
|
||||
self.downButton.setEnabled(False)
|
||||
@ -94,7 +94,7 @@ class Ui_CustomEditDialog(object):
|
||||
self.creditLabel.setBuddy(self.creditEdit)
|
||||
self.bottomFormLayout.addRow(self.creditLabel, self.creditEdit)
|
||||
self.dialogLayout.addLayout(self.bottomFormLayout)
|
||||
self.buttonBox = save_cancel_button_box(customEditDialog)
|
||||
self.buttonBox = create_save_cancel_button_box(customEditDialog)
|
||||
self.previewButton = QtGui.QPushButton()
|
||||
self.buttonBox.addButton(
|
||||
self.previewButton, QtGui.QDialogButtonBox.ActionRole)
|
||||
|
@ -27,7 +27,7 @@
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import translate, SpellTextEdit
|
||||
from openlp.core.lib.ui import save_cancel_button_box
|
||||
from openlp.core.lib.ui import create_save_cancel_button_box
|
||||
|
||||
class Ui_CustomSlideEditDialog(object):
|
||||
def setupUi(self, customSlideEditDialog):
|
||||
@ -37,7 +37,7 @@ class Ui_CustomSlideEditDialog(object):
|
||||
self.slideTextEdit = SpellTextEdit(self)
|
||||
self.slideTextEdit.setObjectName(u'slideTextEdit')
|
||||
self.dialogLayout.addWidget(self.slideTextEdit)
|
||||
self.buttonBox = save_cancel_button_box(customSlideEditDialog)
|
||||
self.buttonBox = create_save_cancel_button_box(customSlideEditDialog)
|
||||
self.splitButton = QtGui.QPushButton(customSlideEditDialog)
|
||||
self.splitButton.setObjectName(u'splitButton')
|
||||
self.buttonBox.addButton(self.splitButton,
|
||||
|
@ -27,7 +27,7 @@
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import translate
|
||||
from openlp.core.lib.ui import save_cancel_button_box
|
||||
from openlp.core.lib.ui import create_save_cancel_button_box
|
||||
|
||||
class Ui_AuthorsDialog(object):
|
||||
def setupUi(self, authorsDialog):
|
||||
@ -56,7 +56,8 @@ class Ui_AuthorsDialog(object):
|
||||
self.displayLabel.setBuddy(self.displayEdit)
|
||||
self.authorLayout.addRow(self.displayLabel, self.displayEdit)
|
||||
self.dialogLayout.addLayout(self.authorLayout)
|
||||
self.dialogLayout.addWidget(save_cancel_button_box(authorsDialog))
|
||||
self.dialogLayout.addWidget(
|
||||
create_save_cancel_button_box(authorsDialog))
|
||||
self.retranslateUi(authorsDialog)
|
||||
authorsDialog.setMaximumHeight(authorsDialog.sizeHint().height())
|
||||
QtCore.QMetaObject.connectSlotsByName(authorsDialog)
|
||||
|
@ -27,7 +27,7 @@
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import build_icon, translate
|
||||
from openlp.core.lib.ui import save_cancel_button_box
|
||||
from openlp.core.lib.ui import create_save_cancel_button_box
|
||||
|
||||
class Ui_EditSongDialog(object):
|
||||
def setupUi(self, editSongDialog):
|
||||
@ -241,7 +241,7 @@ class Ui_EditSongDialog(object):
|
||||
self.themeTabLayout.addWidget(self.commentsGroupBox)
|
||||
self.songTabWidget.addTab(self.themeTab, u'')
|
||||
self.dialogLayout.addWidget(self.songTabWidget)
|
||||
self.buttonBox = save_cancel_button_box(editSongDialog)
|
||||
self.buttonBox = create_save_cancel_button_box(editSongDialog)
|
||||
self.dialogLayout.addWidget(self.buttonBox)
|
||||
self.retranslateUi(editSongDialog)
|
||||
QtCore.QMetaObject.connectSlotsByName(editSongDialog)
|
||||
|
@ -27,7 +27,7 @@
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import build_icon, translate, SpellTextEdit
|
||||
from openlp.core.lib.ui import save_cancel_button_box
|
||||
from openlp.core.lib.ui import create_save_cancel_button_box
|
||||
from openlp.plugins.songs.lib import VerseType
|
||||
|
||||
class Ui_EditVerseDialog(object):
|
||||
@ -60,7 +60,8 @@ class Ui_EditVerseDialog(object):
|
||||
self.verseTypeLayout.addWidget(self.insertButton)
|
||||
self.verseTypeLayout.addStretch()
|
||||
self.dialogLayout.addLayout(self.verseTypeLayout)
|
||||
self.dialogLayout.addWidget(save_cancel_button_box(editVerseDialog))
|
||||
self.dialogLayout.addWidget(
|
||||
create_save_cancel_button_box(editVerseDialog))
|
||||
self.retranslateUi(editVerseDialog)
|
||||
QtCore.QMetaObject.connectSlotsByName(editVerseDialog)
|
||||
|
||||
|
@ -27,7 +27,7 @@
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import translate
|
||||
from openlp.core.lib.ui import save_cancel_button_box
|
||||
from openlp.core.lib.ui import create_save_cancel_button_box
|
||||
|
||||
class Ui_SongBookDialog(object):
|
||||
def setupUi(self, songBookDialog):
|
||||
@ -50,7 +50,8 @@ class Ui_SongBookDialog(object):
|
||||
self.publisherLabel.setBuddy(self.publisherEdit)
|
||||
self.bookLayout.addRow(self.publisherLabel, self.publisherEdit)
|
||||
self.dialogLayout.addLayout(self.bookLayout)
|
||||
self.dialogLayout.addWidget(save_cancel_button_box(songBookDialog))
|
||||
self.dialogLayout.addWidget(
|
||||
create_save_cancel_button_box(songBookDialog))
|
||||
self.retranslateUi(songBookDialog)
|
||||
songBookDialog.setMaximumHeight(songBookDialog.sizeHint().height())
|
||||
QtCore.QMetaObject.connectSlotsByName(songBookDialog)
|
||||
|
@ -27,7 +27,7 @@
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import translate
|
||||
from openlp.core.lib.ui import save_cancel_button_box
|
||||
from openlp.core.lib.ui import create_save_cancel_button_box
|
||||
|
||||
class Ui_TopicsDialog(object):
|
||||
def setupUi(self, topicsDialog):
|
||||
@ -44,7 +44,8 @@ class Ui_TopicsDialog(object):
|
||||
self.nameLabel.setBuddy(self.nameEdit)
|
||||
self.nameLayout.addRow(self.nameLabel, self.nameEdit)
|
||||
self.dialogLayout.addLayout(self.nameLayout)
|
||||
self.dialogLayout.addWidget(save_cancel_button_box(topicsDialog))
|
||||
self.dialogLayout.addWidget(
|
||||
create_save_cancel_button_box(topicsDialog))
|
||||
self.retranslateUi(topicsDialog)
|
||||
topicsDialog.setMaximumHeight(topicsDialog.sizeHint().height())
|
||||
QtCore.QMetaObject.connectSlotsByName(topicsDialog)
|
||||
|
Loading…
Reference in New Issue
Block a user