def __init__(self): super(SongUsagePlugin, self).__init__('songusage', __default_settings__) self.manager = Manager('songusage', init_schema, upgrade_mod=upgrade) self.weight = -4 self.icon = build_icon(':/plugins/plugin_songusage.png') self.active_icon = build_icon(':/songusage/song_usage_active.png') self.inactive_icon = build_icon(':/songusage/song_usage_inactive.png') self.song_usage_active = False
def setup(self): """ Allow early setup to be mocked. """ self.icon_path = 'images/image' self.background = False self.automatic = '' self.optical_icon = build_icon(':/media/media_optical.png') self.video_icon = build_icon(':/media/media_video.png') self.audio_icon = build_icon(':/media/media_audio.png') self.error_icon = build_icon(':/general/general_delete.png')
def setupUi(self, alert_dialog): """ Setup the Alert UI dialog :param alert_dialog: The dialog """ alert_dialog.setObjectName('alert_dialog') alert_dialog.resize(400, 300) alert_dialog.setWindowIcon(build_icon(u':/icon/openlp-logo.svg')) self.alert_dialog_layout = QtGui.QGridLayout(alert_dialog) self.alert_dialog_layout.setObjectName('alert_dialog_layout') self.alert_text_layout = QtGui.QFormLayout() self.alert_text_layout.setObjectName('alert_text_layout') self.alert_entry_label = QtGui.QLabel(alert_dialog) self.alert_entry_label.setObjectName('alert_entry_label') self.alert_text_edit = QtGui.QLineEdit(alert_dialog) self.alert_text_edit.setObjectName('alert_text_edit') self.alert_entry_label.setBuddy(self.alert_text_edit) self.alert_text_layout.addRow(self.alert_entry_label, self.alert_text_edit) self.alert_parameter = QtGui.QLabel(alert_dialog) self.alert_parameter.setObjectName('alert_parameter') self.parameter_edit = QtGui.QLineEdit(alert_dialog) self.parameter_edit.setObjectName('parameter_edit') self.alert_parameter.setBuddy(self.parameter_edit) self.alert_text_layout.addRow(self.alert_parameter, self.parameter_edit) self.alert_dialog_layout.addLayout(self.alert_text_layout, 0, 0, 1, 2) self.alert_list_widget = QtGui.QListWidget(alert_dialog) self.alert_list_widget.setAlternatingRowColors(True) self.alert_list_widget.setObjectName('alert_list_widget') self.alert_dialog_layout.addWidget(self.alert_list_widget, 1, 0) self.manage_button_layout = QtGui.QVBoxLayout() self.manage_button_layout.setObjectName('manage_button_layout') self.new_button = QtGui.QPushButton(alert_dialog) self.new_button.setIcon(build_icon(':/general/general_new.png')) self.new_button.setObjectName('new_button') self.manage_button_layout.addWidget(self.new_button) self.save_button = QtGui.QPushButton(alert_dialog) self.save_button.setEnabled(False) self.save_button.setIcon(build_icon(':/general/general_save.png')) self.save_button.setObjectName('save_button') self.manage_button_layout.addWidget(self.save_button) self.delete_button = create_button(alert_dialog, 'delete_button', role='delete', enabled=False, click=alert_dialog.on_delete_button_clicked) self.manage_button_layout.addWidget(self.delete_button) self.manage_button_layout.addStretch() self.alert_dialog_layout.addLayout(self.manage_button_layout, 1, 1) display_icon = build_icon(':/general/general_live.png') self.display_button = create_button(alert_dialog, 'display_button', icon=display_icon, enabled=False) self.display_close_button = create_button(alert_dialog, 'display_close_button', icon=display_icon, enabled=False) self.button_box = create_button_box(alert_dialog, 'button_box', ['close'], [self.display_button, self.display_close_button]) self.alert_dialog_layout.addWidget(self.button_box, 2, 0, 1, 2) self.retranslateUi(alert_dialog)
def setupUi(self, edit_verse_dialog): edit_verse_dialog.setObjectName('edit_verse_dialog') edit_verse_dialog.setWindowIcon(build_icon(u':/icon/openlp-logo.svg')) edit_verse_dialog.resize(400, 400) edit_verse_dialog.setModal(True) self.dialog_layout = QtGui.QVBoxLayout(edit_verse_dialog) self.dialog_layout.setObjectName('dialog_layout') self.chord_hint_label = QtGui.QLabel(edit_verse_dialog) self.chord_hint_label.setObjectName('chord_hint_label') self.dialog_layout.addWidget(self.chord_hint_label) self.verse_text_edit = SpellTextEdit(edit_verse_dialog) self.verse_text_edit.setObjectName('verse_text_edit') self.chord_font = self.verse_text_edit.document().defaultFont() self.chord_font.setFamily('Hack') self.chord_font.setStyleHint(QtGui.QFont.Courier) self.chord_font.setPointSize(9) self.verse_text_edit.document().setDefaultFont(self.chord_font) self.dialog_layout.addWidget(self.verse_text_edit) self.verse_type_layout = QtGui.QHBoxLayout() self.verse_type_layout.setObjectName('verse_type_layout') # Button to insert forced split [br] # Author: nikukatansa self.force_split_button = QtGui.QPushButton(edit_verse_dialog) self.force_split_button.setIcon( build_icon(':/general/general_add.png')) self.force_split_button.setObjectName('force_split_button') self.verse_type_layout.addWidget(self.force_split_button) # END self.split_button = QtGui.QPushButton(edit_verse_dialog) self.split_button.setIcon(build_icon(':/general/general_add.png')) self.split_button.setObjectName('split_button') self.verse_type_layout.addWidget(self.split_button) self.verse_type_label = QtGui.QLabel(edit_verse_dialog) self.verse_type_label.setObjectName('verse_type_label') self.verse_type_layout.addWidget(self.verse_type_label) self.verse_type_combo_box = QtGui.QComboBox(edit_verse_dialog) self.verse_type_combo_box.addItems(['', '', '', '', '', '', '']) self.verse_type_combo_box.setObjectName('verse_type_combo_box') self.verse_type_label.setBuddy(self.verse_type_combo_box) self.verse_type_layout.addWidget(self.verse_type_combo_box) self.verse_number_box = QtGui.QSpinBox(edit_verse_dialog) self.verse_number_box.setMinimum(1) self.verse_number_box.setObjectName('verse_number_box') self.verse_type_layout.addWidget(self.verse_number_box) self.insert_button = QtGui.QPushButton(edit_verse_dialog) self.insert_button.setIcon(build_icon(':/general/general_add.png')) self.insert_button.setObjectName('insert_button') self.verse_type_layout.addWidget(self.insert_button) self.verse_type_layout.addStretch() self.dialog_layout.addLayout(self.verse_type_layout) self.button_box = create_button_box(edit_verse_dialog, 'button_box', ['cancel', 'ok']) self.dialog_layout.addWidget(self.button_box) self.retranslateUi(edit_verse_dialog)
def setupUi(self, edit_verse_dialog): edit_verse_dialog.setObjectName('edit_verse_dialog') edit_verse_dialog.setWindowIcon(build_icon(u':/icon/openlp-logo.svg')) edit_verse_dialog.resize(400, 400) edit_verse_dialog.setModal(True) self.dialog_layout = QtGui.QVBoxLayout(edit_verse_dialog) self.dialog_layout.setObjectName('dialog_layout') self.chord_hint_label = QtGui.QLabel(edit_verse_dialog) self.chord_hint_label.setObjectName('chord_hint_label') self.dialog_layout.addWidget(self.chord_hint_label) self.verse_text_edit = SpellTextEdit(edit_verse_dialog) self.verse_text_edit.setObjectName('verse_text_edit') self.chord_font = self.verse_text_edit.document().defaultFont() self.chord_font.setFamily('Hack') self.chord_font.setStyleHint(QtGui.QFont.Courier) self.chord_font.setPointSize(9) self.verse_text_edit.document().setDefaultFont(self.chord_font) self.dialog_layout.addWidget(self.verse_text_edit) self.verse_type_layout = QtGui.QHBoxLayout() self.verse_type_layout.setObjectName('verse_type_layout') # Button to insert forced split [br] # Author: nikukatansa self.force_split_button = QtGui.QPushButton(edit_verse_dialog) self.force_split_button.setIcon(build_icon(':/general/general_add.png')) self.force_split_button.setObjectName('force_split_button') self.verse_type_layout.addWidget(self.force_split_button) # END self.split_button = QtGui.QPushButton(edit_verse_dialog) self.split_button.setIcon(build_icon(':/general/general_add.png')) self.split_button.setObjectName('split_button') self.verse_type_layout.addWidget(self.split_button) self.verse_type_label = QtGui.QLabel(edit_verse_dialog) self.verse_type_label.setObjectName('verse_type_label') self.verse_type_layout.addWidget(self.verse_type_label) self.verse_type_combo_box = QtGui.QComboBox(edit_verse_dialog) self.verse_type_combo_box.addItems(['', '', '', '', '', '', '']) self.verse_type_combo_box.setObjectName('verse_type_combo_box') self.verse_type_label.setBuddy(self.verse_type_combo_box) self.verse_type_layout.addWidget(self.verse_type_combo_box) self.verse_number_box = QtGui.QSpinBox(edit_verse_dialog) self.verse_number_box.setMinimum(1) self.verse_number_box.setObjectName('verse_number_box') self.verse_type_layout.addWidget(self.verse_number_box) self.insert_button = QtGui.QPushButton(edit_verse_dialog) self.insert_button.setIcon(build_icon(':/general/general_add.png')) self.insert_button.setObjectName('insert_button') self.verse_type_layout.addWidget(self.insert_button) self.verse_type_layout.addStretch() self.dialog_layout.addLayout(self.verse_type_layout) self.button_box = create_button_box(edit_verse_dialog, 'button_box', ['cancel', 'ok']) self.dialog_layout.addWidget(self.button_box) self.retranslateUi(edit_verse_dialog)
def setupUi(self, song_usage_detail_dialog): """ Set up the UI :param song_usage_detail_dialog: """ song_usage_detail_dialog.setObjectName('song_usage_detail_dialog') song_usage_detail_dialog.setWindowIcon(build_icon(u':/icon/openlp-logo.svg')) song_usage_detail_dialog.resize(609, 413) self.vertical_layout = QtGui.QVBoxLayout(song_usage_detail_dialog) self.vertical_layout.setSpacing(8) self.vertical_layout.setContentsMargins(8, 8, 8, 8) self.vertical_layout.setObjectName('vertical_layout') self.date_range_group_box = QtGui.QGroupBox(song_usage_detail_dialog) self.date_range_group_box.setObjectName('date_range_group_box') self.date_horizontal_layout = QtGui.QHBoxLayout(self.date_range_group_box) self.date_horizontal_layout.setSpacing(8) self.date_horizontal_layout.setContentsMargins(8, 8, 8, 8) self.date_horizontal_layout.setObjectName('date_horizontal_layout') self.from_date_calendar = QtGui.QCalendarWidget(self.date_range_group_box) self.from_date_calendar.setObjectName('from_date_calendar') self.date_horizontal_layout.addWidget(self.from_date_calendar) self.to_label = QtGui.QLabel(self.date_range_group_box) self.to_label.setScaledContents(False) self.to_label.setAlignment(QtCore.Qt.AlignCenter) self.to_label.setObjectName('to_label') self.date_horizontal_layout.addWidget(self.to_label) self.to_date_calendar = QtGui.QCalendarWidget(self.date_range_group_box) self.to_date_calendar.setObjectName('to_date_calendar') self.date_horizontal_layout.addWidget(self.to_date_calendar) self.vertical_layout.addWidget(self.date_range_group_box) self.file_group_box = QtGui.QGroupBox(self.date_range_group_box) self.file_group_box.setObjectName('file_group_box') self.file_horizontal_layout = QtGui.QHBoxLayout(self.file_group_box) self.file_horizontal_layout.setSpacing(8) self.file_horizontal_layout.setContentsMargins(8, 8, 8, 8) self.file_horizontal_layout.setObjectName('file_horizontal_layout') self.file_line_edit = QtGui.QLineEdit(self.file_group_box) self.file_line_edit.setObjectName('file_line_edit') self.file_line_edit.setReadOnly(True) self.file_horizontal_layout.addWidget(self.file_line_edit) self.save_file_push_button = QtGui.QPushButton(self.file_group_box) self.save_file_push_button.setMaximumWidth(self.save_file_push_button.size().height()) self.save_file_push_button.setIcon(build_icon(':/general/general_open.png')) self.save_file_push_button.setObjectName('save_file_push_button') self.file_horizontal_layout.addWidget(self.save_file_push_button) self.vertical_layout.addWidget(self.file_group_box) self.button_box = create_button_box(song_usage_detail_dialog, 'button_box', ['cancel', 'ok']) self.vertical_layout.addWidget(self.button_box) self.retranslateUi(song_usage_detail_dialog) self.save_file_push_button.clicked.connect(song_usage_detail_dialog.define_output_location)
def load_full_list(self, images, initial_load=False, open_group=None): """ Replace the list of images and groups in the interface. ``images`` A List of ImageFilenames objects that will be used to reload the mediamanager list. ``initial_load`` When set to False, the busy cursor and progressbar will be shown while loading images. ``open_group`` ImageGroups object of the group that must be expanded after reloading the list in the interface. """ if not initial_load: self.application.set_busy_cursor() self.main_window.display_progress_bar(len(images)) self.list_view.clear() # Load the list of groups and add them to the treeView. group_items = {} self.add_sub_groups(group_items, parent_group_id=0) if open_group is not None: self.expand_group(open_group.id) # Sort the images by its filename considering language specific. # characters. images.sort(key=lambda image_object: get_locale_key(os.path.split(str(image_object.filename))[1])) for imageFile in images: log.debug('Loading image: %s', imageFile.filename) filename = os.path.split(imageFile.filename)[1] thumb = os.path.join(self.servicePath, filename) if not os.path.exists(imageFile.filename): icon = build_icon(':/general/general_delete.png') else: if validate_thumb(imageFile.filename, thumb): icon = build_icon(thumb) else: icon = create_thumb(imageFile.filename, thumb) item_name = QtGui.QTreeWidgetItem(filename) item_name.setText(0, filename) item_name.setIcon(0, icon) item_name.setToolTip(0, imageFile.filename) item_name.setData(0, QtCore.Qt.UserRole, imageFile) if imageFile.group_id == 0: self.list_view.addTopLevelItem(item_name) else: group_items[imageFile.group_id].addChild(item_name) if not initial_load: self.main_window.increment_progress_bar() if not initial_load: self.main_window.finished_progress_bar() self.application.set_normal_cursor()
def setupUi(self, alertDialog): alertDialog.setObjectName(u'alertDialog') alertDialog.resize(400, 300) alertDialog.setWindowIcon(build_icon(u':/icon/openlp-logo-16x16.png')) self.alertDialogLayout = QtGui.QGridLayout(alertDialog) self.alertDialogLayout.setObjectName(u'alertDialogLayout') self.alertTextLayout = QtGui.QFormLayout() self.alertTextLayout.setObjectName(u'alertTextLayout') self.alertEntryLabel = QtGui.QLabel(alertDialog) self.alertEntryLabel.setObjectName(u'alertEntryLabel') self.alertTextEdit = QtGui.QLineEdit(alertDialog) self.alertTextEdit.setObjectName(u'alertTextEdit') self.alertEntryLabel.setBuddy(self.alertTextEdit) self.alertTextLayout.addRow(self.alertEntryLabel, self.alertTextEdit) self.alertParameter = QtGui.QLabel(alertDialog) self.alertParameter.setObjectName(u'alertParameter') self.parameterEdit = QtGui.QLineEdit(alertDialog) self.parameterEdit.setObjectName(u'parameterEdit') self.alertParameter.setBuddy(self.parameterEdit) self.alertTextLayout.addRow(self.alertParameter, self.parameterEdit) self.alertDialogLayout.addLayout(self.alertTextLayout, 0, 0, 1, 2) self.alertListWidget = QtGui.QListWidget(alertDialog) self.alertListWidget.setAlternatingRowColors(True) self.alertListWidget.setObjectName(u'alertListWidget') self.alertDialogLayout.addWidget(self.alertListWidget, 1, 0) self.manageButtonLayout = QtGui.QVBoxLayout() self.manageButtonLayout.setObjectName(u'manageButtonLayout') self.newButton = QtGui.QPushButton(alertDialog) self.newButton.setIcon(build_icon(u':/general/general_new.png')) self.newButton.setObjectName(u'newButton') self.manageButtonLayout.addWidget(self.newButton) self.saveButton = QtGui.QPushButton(alertDialog) self.saveButton.setEnabled(False) self.saveButton.setIcon(build_icon(u':/general/general_save.png')) self.saveButton.setObjectName(u'saveButton') self.manageButtonLayout.addWidget(self.saveButton) self.deleteButton = create_button(alertDialog, u'deleteButton', role=u'delete', enabled=False, click=alertDialog.onDeleteButtonClicked) self.manageButtonLayout.addWidget(self.deleteButton) self.manageButtonLayout.addStretch() self.alertDialogLayout.addLayout(self.manageButtonLayout, 1, 1) displayIcon = build_icon(u':/general/general_live.png') self.displayButton = create_button(alertDialog, u'displayButton', icon=displayIcon, enabled=False) self.displayCloseButton = create_button(alertDialog, u'displayCloseButton', icon=displayIcon, enabled=False) self.button_box = create_button_box(alertDialog, u'button_box', [u'close'], [self.displayButton, self.displayCloseButton]) self.alertDialogLayout.addWidget(self.button_box, 2, 0, 1, 2) self.retranslateUi(alertDialog)
def setupUi(self, edit_projector_dialog): """ Create the interface layout. """ edit_projector_dialog.setObjectName('edit_projector_dialog') edit_projector_dialog.setWindowIcon(build_icon(u':/icon/openlp-logo-32x32.png')) edit_projector_dialog.setMinimumWidth(400) edit_projector_dialog.setModal(True) # Define the basic layout self.dialog_layout = QtWidgets.QGridLayout(edit_projector_dialog) self.dialog_layout.setObjectName('dialog_layout') self.dialog_layout.setSpacing(8) self.dialog_layout.setContentsMargins(8, 8, 8, 8) # IP Address self.ip_label = QtWidgets.QLabel(edit_projector_dialog) self.ip_label.setObjectName('projector_edit_ip_label') self.ip_text = QtWidgets.QLineEdit(edit_projector_dialog) self.ip_text.setObjectName('projector_edit_ip_text') self.dialog_layout.addWidget(self.ip_label, 0, 0) self.dialog_layout.addWidget(self.ip_text, 0, 1) # Port number self.port_label = QtWidgets.QLabel(edit_projector_dialog) self.port_label.setObjectName('projector_edit_ip_label') self.port_text = QtWidgets.QLineEdit(edit_projector_dialog) self.port_text.setObjectName('projector_edit_port_text') self.dialog_layout.addWidget(self.port_label, 1, 0) self.dialog_layout.addWidget(self.port_text, 1, 1) # PIN self.pin_label = QtWidgets.QLabel(edit_projector_dialog) self.pin_label.setObjectName('projector_edit_pin_label') self.pin_text = QtWidgets.QLineEdit(edit_projector_dialog) self.pin_label.setObjectName('projector_edit_pin_text') self.dialog_layout.addWidget(self.pin_label, 2, 0) self.dialog_layout.addWidget(self.pin_text, 2, 1) # Name self.name_label = QtWidgets.QLabel(edit_projector_dialog) self.name_label.setObjectName('projector_edit_name_label') self.name_text = QtWidgets.QLineEdit(edit_projector_dialog) self.name_text.setObjectName('projector_edit_name_text') self.dialog_layout.addWidget(self.name_label, 3, 0) self.dialog_layout.addWidget(self.name_text, 3, 1) # Location self.location_label = QtWidgets.QLabel(edit_projector_dialog) self.location_label.setObjectName('projector_edit_location_label') self.location_text = QtWidgets.QLineEdit(edit_projector_dialog) self.location_text.setObjectName('projector_edit_location_text') self.dialog_layout.addWidget(self.location_label, 4, 0) self.dialog_layout.addWidget(self.location_text, 4, 1) # Notes self.notes_label = QtWidgets.QLabel(edit_projector_dialog) self.notes_label.setObjectName('projector_edit_notes_label') self.notes_text = QtWidgets.QPlainTextEdit(edit_projector_dialog) self.notes_text.setObjectName('projector_edit_notes_text') self.dialog_layout.addWidget(self.notes_label, 5, 0, alignment=QtCore.Qt.AlignTop) self.dialog_layout.addWidget(self.notes_text, 5, 1) # Time for the buttons self.button_box = QtWidgets.QDialogButtonBox(QtWidgets.QDialogButtonBox.Help | QtWidgets.QDialogButtonBox.Save | QtWidgets.QDialogButtonBox.Cancel) self.dialog_layout.addWidget(self.button_box, 8, 0, 1, 2)
def setupUi(self, media_files_dialog): """ Set up the user interface. """ media_files_dialog.setObjectName('media_files_dialog') media_files_dialog.setWindowIcon(build_icon(u':/icon/openlp-logo.svg')) media_files_dialog.setWindowModality(QtCore.Qt.ApplicationModal) media_files_dialog.resize(400, 300) media_files_dialog.setModal(True) self.files_vertical_layout = QtGui.QVBoxLayout(media_files_dialog) self.files_vertical_layout.setSpacing(8) self.files_vertical_layout.setMargin(8) self.files_vertical_layout.setObjectName('files_vertical_layout') self.select_label = QtGui.QLabel(media_files_dialog) self.select_label.setWordWrap(True) self.select_label.setObjectName('select_label') self.files_vertical_layout.addWidget(self.select_label) self.file_list_widget = QtGui.QListWidget(media_files_dialog) self.file_list_widget.setAlternatingRowColors(True) self.file_list_widget.setSelectionMode(QtGui.QAbstractItemView.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']) self.files_vertical_layout.addWidget(self.button_box) self.retranslateUi(media_files_dialog)
def __init__(self): super(BiblePlugin, self).__init__('bibles', __default_settings__, BibleMediaItem, BiblesTab) self.weight = -9 self.icon_path = ':/plugins/plugin_bibles.png' self.icon = build_icon(self.icon_path) self.manager = BibleManager(self)
def __init__(self, parent=None, plugin=None, icon=None): """ Constructor to create the media manager item. """ QtGui.QWidget.__init__(self) self.hide() self.whitespace = re.compile(r'[\W_]+', re.UNICODE) self.plugin = plugin visible_title = self.plugin.getString(StringContent.VisibleName) self.title = unicode(visible_title[u'title']) Registry().register(self.plugin.name, self) self.settingsSection = self.plugin.name self.icon = None if icon: self.icon = build_icon(icon) self.toolbar = None self.remoteTriggered = None self.singleServiceItem = True self.quickPreviewAllowed = False self.hasSearch = False self.pageLayout = QtGui.QVBoxLayout(self) self.pageLayout.setSpacing(0) self.pageLayout.setMargin(0) self.requiredIcons() self.setupUi() self.retranslateUi() self.autoSelectId = -1 QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'%s_service_load' % self.plugin.name), self.serviceLoad)
def setupUi(self, language_dialog): language_dialog.setObjectName('language_dialog') language_dialog.setWindowIcon(build_icon(u':/icon/openlp-logo.svg')) language_dialog.resize(400, 165) self.language_layout = QtGui.QVBoxLayout(language_dialog) self.language_layout.setSpacing(8) self.language_layout.setMargin(8) self.language_layout.setObjectName('language_layout') self.bible_label = QtGui.QLabel(language_dialog) self.bible_label.setObjectName('bible_label') self.language_layout.addWidget(self.bible_label) self.info_label = QtGui.QLabel(language_dialog) self.info_label.setWordWrap(True) self.info_label.setObjectName('info_label') self.language_layout.addWidget(self.info_label) self.language_h_box_layout = QtGui.QHBoxLayout() self.language_h_box_layout.setSpacing(8) self.language_h_box_layout.setObjectName('language_h_box_layout') self.language_label = QtGui.QLabel(language_dialog) self.language_label.setObjectName('language_label') self.language_h_box_layout.addWidget(self.language_label) self.language_combo_box = QtGui.QComboBox(language_dialog) size_policy = QtGui.QSizePolicy(QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Fixed) size_policy.setHorizontalStretch(0) size_policy.setVerticalStretch(0) size_policy.setHeightForWidth(self.language_combo_box.sizePolicy().hasHeightForWidth()) self.language_combo_box.setSizePolicy(size_policy) self.language_combo_box.setObjectName('language_combo_box') self.language_h_box_layout.addWidget(self.language_combo_box) self.language_layout.addLayout(self.language_h_box_layout) self.button_box = create_button_box(language_dialog, 'button_box', ['cancel', 'ok']) self.language_layout.addWidget(self.button_box) self.retranslateUi(language_dialog)
def setupUi(self, serviceItemEditDialog): """ Set up the UI """ serviceItemEditDialog.setObjectName('serviceItemEditDialog') serviceItemEditDialog.setWindowIcon(build_icon(u':/icon/openlp-logo.svg')) self.dialog_layout = QtGui.QGridLayout(serviceItemEditDialog) self.dialog_layout.setContentsMargins(8, 8, 8, 8) self.dialog_layout.setSpacing(8) self.dialog_layout.setObjectName('dialog_layout') self.list_widget = QtGui.QListWidget(serviceItemEditDialog) self.list_widget.setAlternatingRowColors(True) self.list_widget.setObjectName('list_widget') self.dialog_layout.addWidget(self.list_widget, 0, 0) self.button_layout = QtGui.QVBoxLayout() self.button_layout.setObjectName('button_layout') self.delete_button = create_button(serviceItemEditDialog, 'deleteButton', role='delete', click=serviceItemEditDialog.on_delete_button_clicked) self.button_layout.addWidget(self.delete_button) self.button_layout.addStretch() self.up_button = create_button(serviceItemEditDialog, 'up_button', role='up', click=serviceItemEditDialog.on_up_button_clicked) self.down_button = create_button(serviceItemEditDialog, 'down_button', role='down', click=serviceItemEditDialog.on_down_button_clicked) self.button_layout.addWidget(self.up_button) self.button_layout.addWidget(self.down_button) self.dialog_layout.addLayout(self.button_layout, 0, 1) self.button_box = create_button_box(serviceItemEditDialog, 'button_box', ['cancel', 'save']) self.dialog_layout.addWidget(self.button_box, 1, 0, 1, 2) self.retranslateUi(serviceItemEditDialog)
def setupUi(self, plugin_view_dialog): """ Set up the UI """ plugin_view_dialog.setObjectName('plugin_view_dialog') plugin_view_dialog.setWindowIcon(build_icon(':/icon/openlp-logo.svg')) plugin_view_dialog.setWindowModality(QtCore.Qt.ApplicationModal) self.plugin_layout = QtWidgets.QVBoxLayout(plugin_view_dialog) self.plugin_layout.setObjectName('plugin_layout') self.list_layout = QtWidgets.QHBoxLayout() self.list_layout.setObjectName('list_layout') self.plugin_list_widget = QtWidgets.QListWidget(plugin_view_dialog) self.plugin_list_widget.setObjectName('plugin_list_widget') self.list_layout.addWidget(self.plugin_list_widget) self.plugin_info_group_box = QtWidgets.QGroupBox(plugin_view_dialog) self.plugin_info_group_box.setObjectName('plugin_info_group_box') self.plugin_info_layout = QtWidgets.QFormLayout(self.plugin_info_group_box) self.plugin_info_layout.setObjectName('plugin_info_layout') self.status_label = QtWidgets.QLabel(self.plugin_info_group_box) self.status_label.setObjectName('status_label') self.status_checkbox = QtWidgets.QCheckBox(self.plugin_info_group_box) self.status_checkbox.setObjectName('status_checkbox') self.plugin_info_layout.addRow(self.status_label, self.status_checkbox) self.about_label = QtWidgets.QLabel(self.plugin_info_group_box) self.about_label.setObjectName('about_label') self.about_text_browser = QtWidgets.QTextBrowser(self.plugin_info_group_box) self.about_text_browser.setTextInteractionFlags(QtCore.Qt.LinksAccessibleByMouse) self.about_text_browser.setObjectName('aboutTextBrowser') self.plugin_info_layout.addRow(self.about_label, self.about_text_browser) self.list_layout.addWidget(self.plugin_info_group_box) self.plugin_layout.addLayout(self.list_layout) self.button_box = create_button_box(plugin_view_dialog, 'button_box', ['ok']) self.plugin_layout.addWidget(self.button_box) self.retranslateUi(plugin_view_dialog)
def setupUi(self, language_dialog): language_dialog.setObjectName('language_dialog') language_dialog.setWindowIcon(build_icon(':/icon/openlp-logo.svg')) language_dialog.resize(400, 165) self.language_layout = QtWidgets.QVBoxLayout(language_dialog) self.language_layout.setSpacing(8) self.language_layout.setContentsMargins(8, 8, 8, 8) self.language_layout.setObjectName('language_layout') self.bible_label = QtWidgets.QLabel(language_dialog) self.bible_label.setObjectName('bible_label') self.language_layout.addWidget(self.bible_label) self.info_label = QtWidgets.QLabel(language_dialog) self.info_label.setWordWrap(True) self.info_label.setObjectName('info_label') self.language_layout.addWidget(self.info_label) self.language_h_box_layout = QtWidgets.QHBoxLayout() self.language_h_box_layout.setSpacing(8) self.language_h_box_layout.setObjectName('language_h_box_layout') self.language_label = QtWidgets.QLabel(language_dialog) 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.setHorizontalStretch(0) size_policy.setVerticalStretch(0) size_policy.setHeightForWidth(self.language_combo_box.sizePolicy().hasHeightForWidth()) self.language_combo_box.setSizePolicy(size_policy) self.language_combo_box.setObjectName('language_combo_box') self.language_h_box_layout.addWidget(self.language_combo_box) self.language_layout.addLayout(self.language_h_box_layout) self.button_box = create_button_box(language_dialog, 'button_box', ['cancel', 'ok']) self.language_layout.addWidget(self.button_box) self.retranslateUi(language_dialog)
def setupUi(self, themeLayoutDialog): """ Set up the UI """ themeLayoutDialog.setObjectName('themeLayoutDialogDialog') themeLayoutDialog.setWindowIcon(build_icon(':/icon/openlp-logo.svg')) self.preview_layout = QtWidgets.QVBoxLayout(themeLayoutDialog) self.preview_layout.setObjectName('preview_layout') self.preview_area = QtWidgets.QWidget(themeLayoutDialog) self.preview_area.setObjectName('preview_area') self.preview_area_layout = QtWidgets.QGridLayout(self.preview_area) self.preview_area_layout.setContentsMargins(0, 0, 0, 0) self.preview_area_layout.setColumnStretch(0, 1) self.preview_area_layout.setRowStretch(0, 1) self.preview_area_layout.setObjectName('preview_area_layout') self.theme_display_label = QtWidgets.QLabel(self.preview_area) self.theme_display_label.setFrameShape(QtWidgets.QFrame.Box) self.theme_display_label.setScaledContents(True) self.theme_display_label.setObjectName('theme_display_label') self.preview_area_layout.addWidget(self.theme_display_label) self.preview_layout.addWidget(self.preview_area) self.main_colour_label = QtWidgets.QLabel(self.preview_area) self.main_colour_label.setObjectName('main_colour_label') self.preview_layout.addWidget(self.main_colour_label) self.footer_colour_label = QtWidgets.QLabel(self.preview_area) self.footer_colour_label.setObjectName('footer_colour_label') self.preview_layout.addWidget(self.footer_colour_label) self.button_box = create_button_box(themeLayoutDialog, 'button_box', ['ok']) self.preview_layout.addWidget(self.button_box) self.retranslateUi(themeLayoutDialog)
def __init__(self): Plugin.__init__(self, u'media', __default_settings__, MediaMediaItem) self.weight = -6 self.iconPath = u':/plugins/plugin_media.png' self.icon = build_icon(self.iconPath) # passed with drag and drop messages self.dnd_id = u'Media'
def loadList(self, media): # Sort the media by its filename considering language specific # characters. media.sort(cmp=locale_compare, key=lambda filename: os.path.split(unicode(filename))[1]) for track in media: track_info = QtCore.QFileInfo(track) if not os.path.exists(track): filename = os.path.split(unicode(track))[1] item_name = QtGui.QListWidgetItem(filename) item_name.setIcon(ERROR) item_name.setData(QtCore.Qt.UserRole, track) elif track_info.isFile(): filename = os.path.split(unicode(track))[1] item_name = QtGui.QListWidgetItem(filename) if u'*.%s' % (filename.split(u'.')[-1].lower()) in self.media_controller.audio_extensions_list: item_name.setIcon(AUDIO) else: item_name.setIcon(VIDEO) item_name.setData(QtCore.Qt.UserRole, track) else: filename = os.path.split(unicode(track))[1] item_name = QtGui.QListWidgetItem(filename) item_name.setIcon(build_icon(DVDICON)) item_name.setData(QtCore.Qt.UserRole, track) item_name.setToolTip(track) self.listView.addItem(item_name)
def setupUi(self, language_dialog): """ Set up the UI. """ language_dialog.setObjectName('language_dialog') language_dialog.setWindowIcon(build_icon(u':/icon/openlp-logo.svg')) language_dialog.resize(300, 50) self.dialog_layout = QtWidgets.QVBoxLayout(language_dialog) self.dialog_layout.setContentsMargins(8, 8, 8, 8) self.dialog_layout.setSpacing(8) self.dialog_layout.setObjectName('dialog_layout') self.info_label = QtWidgets.QLabel(language_dialog) self.info_label.setObjectName('info_label') self.dialog_layout.addWidget(self.info_label) self.language_layout = QtWidgets.QHBoxLayout() self.language_layout.setObjectName('language_layout') self.language_label = QtWidgets.QLabel(language_dialog) 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.setObjectName("language_combo_box") self.language_layout.addWidget(self.language_combo_box) self.dialog_layout.addLayout(self.language_layout) self.button_box = create_button_box(language_dialog, 'button_box', ['cancel', 'ok']) self.dialog_layout.addWidget(self.button_box) self.retranslateUi(language_dialog) self.setMaximumHeight(self.sizeHint().height())
def __init__(self): super(ImagePlugin, self).__init__('images', __default_settings__, ImageMediaItem, ImageTab) self.manager = Manager('images', init_schema) self.weight = -7 self.icon_path = ':/plugins/plugin_images.png' self.icon = build_icon(self.icon_path)
def setupUi(self, song_book_dialog): """ Set up the user interface. """ song_book_dialog.setObjectName('song_book_dialog') song_book_dialog.setWindowIcon(build_icon(u':/icon/openlp-logo.svg')) song_book_dialog.resize(300, 10) self.dialog_layout = QtGui.QVBoxLayout(song_book_dialog) self.dialog_layout.setObjectName('dialog_layout') self.book_layout = QtGui.QFormLayout() self.book_layout.setObjectName('book_layout') self.name_label = QtGui.QLabel(song_book_dialog) self.name_label.setObjectName('name_label') self.name_edit = QtGui.QLineEdit(song_book_dialog) self.name_edit.setObjectName('name_edit') self.name_label.setBuddy(self.name_edit) self.book_layout.addRow(self.name_label, self.name_edit) self.publisher_label = QtGui.QLabel(song_book_dialog) self.publisher_label.setObjectName('publisher_label') self.publisher_edit = QtGui.QLineEdit(song_book_dialog) self.publisher_edit.setObjectName('publisher_edit') self.publisher_label.setBuddy(self.publisher_edit) self.book_layout.addRow(self.publisher_label, self.publisher_edit) self.dialog_layout.addLayout(self.book_layout) self.button_box = create_button_box(song_book_dialog, 'button_box', ['cancel', 'save']) self.dialog_layout.addWidget(self.button_box) self.retranslateUi(song_book_dialog) song_book_dialog.setMaximumHeight(song_book_dialog.sizeHint().height())
def __init__(self, parent, projectordb, edit=False): """ Build the source select dialog using tabbed interface. :param projectordb: ProjectorDB session to use """ log.debug('Initializing SourceSelectTabs()') super(SourceSelectTabs, self).__init__(parent, QtCore.Qt.WindowSystemMenuHint | QtCore.Qt.WindowTitleHint) self.setMinimumWidth(350) self.projectordb = projectordb self.edit = edit if self.edit: title = translate('OpenLP.SourceSelectForm', 'Edit Projector Source Text') else: title = translate('OpenLP.SourceSelectForm', 'Select Projector Source') self.setWindowTitle(title) self.setObjectName('source_select_tabs') self.setWindowIcon(build_icon(':/icon/openlp-log.svg')) self.setModal(True) self.layout = QtWidgets.QVBoxLayout() self.layout.setObjectName('source_select_tabs_layout') if is_macosx(): self.tabwidget = QtWidgets.QTabWidget(self) else: self.tabwidget = FingerTabWidget(self) self.tabwidget.setObjectName('source_select_tabs_tabwidget') self.tabwidget.setUsesScrollButtons(False) if is_macosx(): self.tabwidget.setTabPosition(QtWidgets.QTabWidget.North) else: self.tabwidget.setTabPosition(QtWidgets.QTabWidget.West) self.layout.addWidget(self.tabwidget) self.setLayout(self.layout)
def setupUi(self, song_book_dialog): """ Set up the user interface. """ song_book_dialog.setObjectName('song_book_dialog') song_book_dialog.setWindowIcon(build_icon(u':/icon/openlp-logo.svg')) song_book_dialog.resize(300, 10) self.dialog_layout = QtWidgets.QVBoxLayout(song_book_dialog) self.dialog_layout.setObjectName('dialog_layout') self.book_layout = QtWidgets.QFormLayout() self.book_layout.setObjectName('book_layout') self.name_label = QtWidgets.QLabel(song_book_dialog) self.name_label.setObjectName('name_label') self.name_edit = QtWidgets.QLineEdit(song_book_dialog) self.name_edit.setObjectName('name_edit') self.name_label.setBuddy(self.name_edit) self.book_layout.addRow(self.name_label, self.name_edit) self.publisher_label = QtWidgets.QLabel(song_book_dialog) self.publisher_label.setObjectName('publisher_label') self.publisher_edit = QtWidgets.QLineEdit(song_book_dialog) self.publisher_edit.setObjectName('publisher_edit') self.publisher_label.setBuddy(self.publisher_edit) self.book_layout.addRow(self.publisher_label, self.publisher_edit) self.dialog_layout.addLayout(self.book_layout) self.button_box = create_button_box(song_book_dialog, 'button_box', ['cancel', 'save']) self.dialog_layout.addWidget(self.button_box) self.retranslateUi(song_book_dialog) song_book_dialog.setMaximumHeight(song_book_dialog.sizeHint().height())
def setupUi(self, edit_projector_dialog): """ Create the interface layout. """ edit_projector_dialog.setObjectName('edit_projector_dialog') edit_projector_dialog.setWindowIcon(build_icon(':/icon/openlp-logo.svg')) edit_projector_dialog.setMinimumWidth(400) edit_projector_dialog.setModal(True) # Define the basic layout self.dialog_layout = QtWidgets.QGridLayout(edit_projector_dialog) self.dialog_layout.setObjectName('dialog_layout') self.dialog_layout.setSpacing(8) self.dialog_layout.setContentsMargins(8, 8, 8, 8) # IP Address self.ip_label = QtWidgets.QLabel(edit_projector_dialog) self.ip_label.setObjectName('projector_edit_ip_label') self.ip_text = QtWidgets.QLineEdit(edit_projector_dialog) self.ip_text.setObjectName('projector_edit_ip_text') self.dialog_layout.addWidget(self.ip_label, 0, 0) self.dialog_layout.addWidget(self.ip_text, 0, 1) # Port number self.port_label = QtWidgets.QLabel(edit_projector_dialog) self.port_label.setObjectName('projector_edit_ip_label') self.port_text = QtWidgets.QLineEdit(edit_projector_dialog) self.port_text.setObjectName('projector_edit_port_text') self.dialog_layout.addWidget(self.port_label, 1, 0) self.dialog_layout.addWidget(self.port_text, 1, 1) # PIN self.pin_label = QtWidgets.QLabel(edit_projector_dialog) self.pin_label.setObjectName('projector_edit_pin_label') self.pin_text = QtWidgets.QLineEdit(edit_projector_dialog) self.pin_label.setObjectName('projector_edit_pin_text') self.dialog_layout.addWidget(self.pin_label, 2, 0) self.dialog_layout.addWidget(self.pin_text, 2, 1) # Name self.name_label = QtWidgets.QLabel(edit_projector_dialog) self.name_label.setObjectName('projector_edit_name_label') self.name_text = QtWidgets.QLineEdit(edit_projector_dialog) self.name_text.setObjectName('projector_edit_name_text') self.dialog_layout.addWidget(self.name_label, 3, 0) self.dialog_layout.addWidget(self.name_text, 3, 1) # Location self.location_label = QtWidgets.QLabel(edit_projector_dialog) self.location_label.setObjectName('projector_edit_location_label') self.location_text = QtWidgets.QLineEdit(edit_projector_dialog) self.location_text.setObjectName('projector_edit_location_text') self.dialog_layout.addWidget(self.location_label, 4, 0) self.dialog_layout.addWidget(self.location_text, 4, 1) # Notes self.notes_label = QtWidgets.QLabel(edit_projector_dialog) self.notes_label.setObjectName('projector_edit_notes_label') self.notes_text = QtWidgets.QPlainTextEdit(edit_projector_dialog) self.notes_text.setObjectName('projector_edit_notes_text') self.dialog_layout.addWidget(self.notes_label, 5, 0, alignment=QtCore.Qt.AlignTop) self.dialog_layout.addWidget(self.notes_text, 5, 1) # Time for the buttons self.button_box = QtWidgets.QDialogButtonBox(QtWidgets.QDialogButtonBox.Help | QtWidgets.QDialogButtonBox.Save | QtWidgets.QDialogButtonBox.Cancel) self.dialog_layout.addWidget(self.button_box, 8, 0, 1, 2)
def setupUi(self, song_usage_delete_dialog): """ Setup the UI :param song_usage_delete_dialog: """ song_usage_delete_dialog.setObjectName('song_usage_delete_dialog') song_usage_delete_dialog.setWindowIcon( build_icon(u':/icon/openlp-logo.svg')) song_usage_delete_dialog.resize(291, 243) self.vertical_layout = QtGui.QVBoxLayout(song_usage_delete_dialog) self.vertical_layout.setSpacing(8) self.vertical_layout.setContentsMargins(8, 8, 8, 8) self.vertical_layout.setObjectName('vertical_layout') self.delete_label = QtGui.QLabel(song_usage_delete_dialog) self.delete_label.setObjectName('delete_label') self.vertical_layout.addWidget(self.delete_label) self.delete_calendar = QtGui.QCalendarWidget(song_usage_delete_dialog) self.delete_calendar.setFirstDayOfWeek(QtCore.Qt.Sunday) self.delete_calendar.setGridVisible(True) self.delete_calendar.setVerticalHeaderFormat( QtGui.QCalendarWidget.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']) self.vertical_layout.addWidget(self.button_box) self.retranslateUi(song_usage_delete_dialog)
def __init__(self): super(MediaPlugin, self).__init__('media', __default_settings__, MediaMediaItem) self.weight = -6 self.icon_path = ':/plugins/plugin_media.png' self.icon = build_icon(self.icon_path) # passed with drag and drop messages self.dnd_id = 'Media'
def setupUi(self, authors_dialog): """ Set up the UI for the dialog. """ authors_dialog.setObjectName('authors_dialog') authors_dialog.setWindowIcon(build_icon(':/icon/openlp-logo.svg')) authors_dialog.resize(300, 10) authors_dialog.setModal(True) self.dialog_layout = QtWidgets.QVBoxLayout(authors_dialog) self.dialog_layout.setObjectName('dialog_layout') self.author_layout = QtWidgets.QFormLayout() self.author_layout.setObjectName('author_layout') self.first_name_label = QtWidgets.QLabel(authors_dialog) self.first_name_label.setObjectName('first_name_label') self.first_name_edit = QtWidgets.QLineEdit(authors_dialog) self.first_name_edit.setObjectName('first_name_edit') self.first_name_label.setBuddy(self.first_name_edit) self.author_layout.addRow(self.first_name_label, self.first_name_edit) self.last_name_label = QtWidgets.QLabel(authors_dialog) self.last_name_label.setObjectName('last_name_label') self.last_name_edit = QtWidgets.QLineEdit(authors_dialog) self.last_name_edit.setObjectName('last_name_edit') self.last_name_label.setBuddy(self.last_name_edit) self.author_layout.addRow(self.last_name_label, self.last_name_edit) self.display_label = QtWidgets.QLabel(authors_dialog) self.display_label.setObjectName('display_label') self.display_edit = QtWidgets.QLineEdit(authors_dialog) self.display_edit.setObjectName('display_edit') self.display_label.setBuddy(self.display_edit) self.author_layout.addRow(self.display_label, self.display_edit) self.dialog_layout.addLayout(self.author_layout) self.button_box = create_button_box(authors_dialog, 'button_box', ['cancel', 'save']) self.dialog_layout.addWidget(self.button_box) self.retranslateUi(authors_dialog) authors_dialog.setMaximumHeight(authors_dialog.sizeHint().height())
def load_list(self, media, target_group=None): # Sort the media by its filename considering language specific characters. media.sort(key=lambda filename: get_locale_key(os.path.split(str(filename))[1])) for track in media: track_info = QtCore.QFileInfo(track) if not os.path.exists(track): filename = os.path.split(str(track))[1] item_name = QtGui.QListWidgetItem(filename) item_name.setIcon(ERROR_ICON) item_name.setData(QtCore.Qt.UserRole, track) elif track_info.isFile(): filename = os.path.split(str(track))[1] item_name = QtGui.QListWidgetItem(filename) if '*.%s' % (filename.split('.')[-1].lower()) in self.media_controller.audio_extensions_list: item_name.setIcon(AUDIO_ICON) else: item_name.setIcon(VIDEO_ICON) item_name.setData(QtCore.Qt.UserRole, track) else: filename = os.path.split(str(track))[1] item_name = QtGui.QListWidgetItem(filename) item_name.setIcon(build_icon(DVD_ICON)) item_name.setData(QtCore.Qt.UserRole, track) item_name.setToolTip(track) self.list_view.addItem(item_name)
def setupUi(self, themeLayoutDialog): """ Set up the UI """ themeLayoutDialog.setObjectName('themeLayoutDialogDialog') themeLayoutDialog.setWindowIcon(build_icon(u':/icon/openlp-logo.svg')) self.preview_layout = QtWidgets.QVBoxLayout(themeLayoutDialog) self.preview_layout.setObjectName('preview_layout') self.preview_area = QtWidgets.QWidget(themeLayoutDialog) self.preview_area.setObjectName('preview_area') self.preview_area_layout = QtWidgets.QGridLayout(self.preview_area) self.preview_area_layout.setContentsMargins(0, 0, 0, 0) self.preview_area_layout.setColumnStretch(0, 1) self.preview_area_layout.setRowStretch(0, 1) self.preview_area_layout.setObjectName('preview_area_layout') self.theme_display_label = QtWidgets.QLabel(self.preview_area) self.theme_display_label.setFrameShape(QtWidgets.QFrame.Box) self.theme_display_label.setScaledContents(True) self.theme_display_label.setObjectName('theme_display_label') self.preview_area_layout.addWidget(self.theme_display_label) self.preview_layout.addWidget(self.preview_area) self.main_colour_label = QtWidgets.QLabel(self.preview_area) self.main_colour_label.setObjectName('main_colour_label') self.preview_layout.addWidget(self.main_colour_label) self.footer_colour_label = QtWidgets.QLabel(self.preview_area) self.footer_colour_label.setObjectName('footer_colour_label') self.preview_layout.addWidget(self.footer_colour_label) self.button_box = create_button_box(themeLayoutDialog, 'button_box', ['ok']) self.preview_layout.addWidget(self.button_box) self.retranslateUi(themeLayoutDialog)
def load_themes(self): """ Loads the theme lists and triggers updates across the whole system using direct calls or core functions and events for the plugins. The plugins will call back in to get the real list if they want it. """ self.theme_list = [] self.theme_list_widget.clear() files = AppLocation.get_files(self.settings_section, '.png') # Sort the themes by its name considering language specific files.sort(key=lambda file_name: get_locale_key(str(file_name))) # now process the file list of png files for name in files: # check to see file is in theme root directory theme = os.path.join(self.path, name) if os.path.exists(theme): text_name = os.path.splitext(name)[0] if text_name == self.global_theme: name = translate('OpenLP.ThemeManager', '{name} (default)').format(name=text_name) else: name = text_name thumb = os.path.join(self.thumb_path, '{name}.png'.format(name=text_name)) item_name = QtWidgets.QListWidgetItem(name) if validate_thumb(theme, thumb): icon = build_icon(thumb) else: icon = create_thumb(theme, thumb) item_name.setIcon(icon) item_name.setData(QtCore.Qt.UserRole, text_name) self.theme_list_widget.addItem(item_name) self.theme_list.append(text_name) self._push_themes()
def load_themes(self): """ Loads the theme lists and triggers updates across the whole system using direct calls or core functions and events for the plugins. The plugins will call back in to get the real list if they want it. """ self._theme_list.clear() self.theme_list_widget.clear() files = AppLocation.get_files(self.settings_section, '/*.json') # Sort the themes by its name considering language specific files.sort(key=lambda file_name: get_locale_key(str(file_name))) # now process the file list of png files for file in files: # check to see file is in theme root directory theme_path = self.theme_path / file if theme_path.exists(): text_name = theme_path.stem if text_name == self.global_theme: name = translate('OpenLP.ThemeManager', '{name} (default)').format(name=text_name) else: name = text_name thumb_path = self.thumb_path / '{name}.png'.format( name=text_name) item_name = QtWidgets.QListWidgetItem(name) if validate_thumb(theme_path, thumb_path): icon = build_icon(thumb_path) else: icon = create_thumb(theme_path, thumb_path) item_name.setIcon(icon) item_name.setData(QtCore.Qt.UserRole, text_name) self.theme_list_widget.addItem(item_name) self._theme_list[text_name] = self._get_theme_data(text_name) self._push_themes()
def __init__(self): super(CustomPlugin, self).__init__('custom', __default_settings__, CustomMediaItem, CustomTab) self.weight = -5 self.db_manager = Manager('custom', init_schema) self.icon_path = ':/plugins/plugin_custom.png' self.icon = build_icon(self.icon_path)
def set_search_types(self, items): """ A list of tuples to be used in the search type menu. The first item in the list will be preselected as the default. :param items: The list of tuples to use. The tuples should contain an integer identifier, an icon (QIcon instance or string) and a title for the item in the menu. In short, they should look like this:: (<identifier>, <icon>, <title>, <place holder text>) For instance:: (1, <QIcon instance>, "Titles", "Search Song Titles...") Or:: (2, ":/songs/authors.png", "Authors", "Search Authors...") """ menu = QtWidgets.QMenu(self) for identifier, icon, title, placeholder in items: action = create_widget_action( menu, text=title, icon=icon, data=identifier, triggers=self._on_menu_action_triggered) action.placeholder_text = placeholder if not hasattr(self, 'menu_button'): self.menu_button = QtWidgets.QToolButton(self) self.menu_button.setIcon(build_icon(':/system/clear_shortcut.png')) self.menu_button.setCursor(QtCore.Qt.ArrowCursor) self.menu_button.setPopupMode(QtWidgets.QToolButton.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) self.set_current_search_type( Settings().value('{section}/last search type'.format(section=self.settings_section))) self.menu_button.show() self._update_style_sheet()
def load_themes(self): """ Loads the theme lists and triggers updates across the whole system using direct calls or core functions and events for the plugins. The plugins will call back in to get the real list if they want it. """ self.theme_list = [] self.theme_list_widget.clear() files = AppLocation.get_files(self.settings_section, '.png') # Sort the themes by its name considering language specific files.sort(key=lambda file_name: get_locale_key(str(file_name))) # now process the file list of png files for name in files: # check to see file is in theme root directory theme = os.path.join(self.path, name) if os.path.exists(theme): text_name = os.path.splitext(name)[0] if text_name == self.global_theme: name = translate('OpenLP.ThemeManager', '%s (default)') % text_name else: name = text_name thumb = os.path.join(self.thumb_path, '%s.png' % text_name) item_name = QtGui.QListWidgetItem(name) if validate_thumb(theme, thumb): icon = build_icon(thumb) else: icon = create_thumb(theme, thumb) item_name.setIcon(icon) item_name.setData(QtCore.Qt.UserRole, text_name) self.theme_list_widget.addItem(item_name) self.theme_list.append(text_name) self._push_themes()
def setupUi(self, song_usage_delete_dialog): """ Setup the UI :param song_usage_delete_dialog: """ song_usage_delete_dialog.setObjectName('song_usage_delete_dialog') song_usage_delete_dialog.setWindowIcon(build_icon(u':/icon/openlp-logo.svg')) song_usage_delete_dialog.resize(291, 243) self.vertical_layout = QtGui.QVBoxLayout(song_usage_delete_dialog) self.vertical_layout.setSpacing(8) self.vertical_layout.setContentsMargins(8, 8, 8, 8) self.vertical_layout.setObjectName('vertical_layout') self.delete_label = QtGui.QLabel(song_usage_delete_dialog) self.delete_label.setObjectName('delete_label') self.vertical_layout.addWidget(self.delete_label) self.delete_calendar = QtGui.QCalendarWidget(song_usage_delete_dialog) self.delete_calendar.setFirstDayOfWeek(QtCore.Qt.Sunday) self.delete_calendar.setGridVisible(True) self.delete_calendar.setVerticalHeaderFormat(QtGui.QCalendarWidget.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']) self.vertical_layout.addWidget(self.button_box) self.retranslateUi(song_usage_delete_dialog)
def setupUi(self, media_files_dialog): """ Set up the user interface. """ media_files_dialog.setObjectName('media_files_dialog') media_files_dialog.setWindowIcon(build_icon(u':/icon/openlp-logo.svg')) media_files_dialog.setWindowModality(QtCore.Qt.ApplicationModal) media_files_dialog.resize(400, 300) media_files_dialog.setModal(True) self.files_vertical_layout = QtWidgets.QVBoxLayout(media_files_dialog) self.files_vertical_layout.setSpacing(8) self.files_vertical_layout.setContentsMargins(8, 8, 8, 8) self.files_vertical_layout.setObjectName('files_vertical_layout') self.select_label = QtWidgets.QLabel(media_files_dialog) self.select_label.setWordWrap(True) self.select_label.setObjectName('select_label') 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.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']) self.files_vertical_layout.addWidget(self.button_box) self.retranslateUi(media_files_dialog)
def setupUi(self, language_dialog): """ Set up the UI. """ language_dialog.setObjectName('language_dialog') language_dialog.setWindowIcon(build_icon(':/icon/openlp-logo.svg')) language_dialog.resize(300, 50) self.dialog_layout = QtWidgets.QVBoxLayout(language_dialog) self.dialog_layout.setContentsMargins(8, 8, 8, 8) self.dialog_layout.setSpacing(8) self.dialog_layout.setObjectName('dialog_layout') self.info_label = QtWidgets.QLabel(language_dialog) self.info_label.setObjectName('info_label') self.dialog_layout.addWidget(self.info_label) self.language_layout = QtWidgets.QHBoxLayout() self.language_layout.setObjectName('language_layout') self.language_label = QtWidgets.QLabel(language_dialog) 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.setObjectName("language_combo_box") self.language_layout.addWidget(self.language_combo_box) self.dialog_layout.addLayout(self.language_layout) self.button_box = create_button_box(language_dialog, 'button_box', ['cancel', 'ok']) self.dialog_layout.addWidget(self.button_box) self.retranslateUi(language_dialog) self.setMaximumHeight(self.sizeHint().height())
def load_full_list(self, images, initial_load=False, open_group=None): """ Replace the list of images and groups in the interface. :param images: A List of Image Filenames objects that will be used to reload the mediamanager list. :param initial_load: When set to False, the busy cursor and progressbar will be shown while loading images. :param open_group: ImageGroups object of the group that must be expanded after reloading the list in the interface. """ if not initial_load: self.application.set_busy_cursor() self.main_window.display_progress_bar(len(images)) self.list_view.clear() # Load the list of groups and add them to the treeView. group_items = {} self.add_sub_groups(group_items, parent_group_id=0) if open_group is not None: self.expand_group(open_group.id) # Sort the images by its filename considering language specific. # characters. images.sort(key=lambda image_object: get_locale_key( os.path.split(str(image_object.filename))[1])) for image_file in images: log.debug('Loading image: %s', image_file.filename) filename = os.path.split(image_file.filename)[1] thumb = self.generate_thumbnail_path(image_file) if not os.path.exists(image_file.filename): icon = build_icon(':/general/general_delete.png') else: if validate_thumb(image_file.filename, thumb): icon = build_icon(thumb) else: icon = create_thumb(image_file.filename, thumb) item_name = QtWidgets.QTreeWidgetItem([filename]) item_name.setText(0, filename) item_name.setIcon(0, icon) item_name.setToolTip(0, image_file.filename) item_name.setData(0, QtCore.Qt.UserRole, image_file) if image_file.group_id == 0: self.list_view.addTopLevelItem(item_name) else: group_items[image_file.group_id].addChild(item_name) if not initial_load: self.main_window.increment_progress_bar() if not initial_load: self.main_window.finished_progress_bar() self.application.set_normal_cursor()
def add_custom_pages(self): """ Add song wizard specific pages. """ # The page with all available songs. self.available_songs_page = QtGui.QWizardPage() self.available_songs_page.setObjectName('available_songs_page') self.available_songs_layout = QtGui.QHBoxLayout(self.available_songs_page) self.available_songs_layout.setObjectName('available_songs_layout') self.vertical_layout = QtGui.QVBoxLayout() self.vertical_layout.setObjectName('vertical_layout') self.available_list_widget = QtGui.QListWidget(self.available_songs_page) self.available_list_widget.setObjectName('available_list_widget') self.vertical_layout.addWidget(self.available_list_widget) self.horizontal_layout = QtGui.QHBoxLayout() self.horizontal_layout.setObjectName('horizontal_layout') self.search_label = QtGui.QLabel(self.available_songs_page) self.search_label.setObjectName('search_label') self.horizontal_layout.addWidget(self.search_label) self.search_line_edit = QtGui.QLineEdit(self.available_songs_page) self.search_line_edit.setObjectName('search_line_edit') self.horizontal_layout.addWidget(self.search_line_edit) spacer_item = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontal_layout.addItem(spacer_item) self.uncheck_button = QtGui.QPushButton(self.available_songs_page) self.uncheck_button.setObjectName('uncheck_button') self.horizontal_layout.addWidget(self.uncheck_button) self.check_button = QtGui.QPushButton(self.available_songs_page) self.check_button.setObjectName('selectButton') self.horizontal_layout.addWidget(self.check_button) self.vertical_layout.addLayout(self.horizontal_layout) self.available_songs_layout.addLayout(self.vertical_layout) self.addPage(self.available_songs_page) # The page with the selected songs. self.export_song_page = QtGui.QWizardPage() self.export_song_page.setObjectName('available_songs_page') self.export_song_layout = QtGui.QHBoxLayout(self.export_song_page) self.export_song_layout.setObjectName('export_song_layout') self.grid_layout = QtGui.QGridLayout() self.grid_layout.setObjectName('range_layout') self.selected_list_widget = QtGui.QListWidget(self.export_song_page) self.selected_list_widget.setObjectName('selected_list_widget') self.grid_layout.addWidget(self.selected_list_widget, 1, 0, 1, 1) # FIXME: self.horizontal_layout is already defined above?!?!? self.horizontal_layout = QtGui.QHBoxLayout() self.horizontal_layout.setObjectName('horizontal_layout') self.directory_label = QtGui.QLabel(self.export_song_page) self.directory_label.setObjectName('directory_label') self.horizontal_layout.addWidget(self.directory_label) self.directory_line_edit = QtGui.QLineEdit(self.export_song_page) self.directory_line_edit.setObjectName('directory_line_edit') self.horizontal_layout.addWidget(self.directory_line_edit) self.directory_button = QtGui.QToolButton(self.export_song_page) self.directory_button.setIcon(build_icon(':/exports/export_load.png')) self.directory_button.setObjectName('directory_button') self.horizontal_layout.addWidget(self.directory_button) self.grid_layout.addLayout(self.horizontal_layout, 0, 0, 1, 1) self.export_song_layout.addLayout(self.grid_layout) self.addPage(self.export_song_page)
def add_custom_pages(self): """ Add song wizard specific pages. """ # The page with all available songs. self.available_songs_page = QtWidgets.QWizardPage() self.available_songs_page.setObjectName('available_songs_page') self.available_songs_layout = QtWidgets.QHBoxLayout(self.available_songs_page) self.available_songs_layout.setObjectName('available_songs_layout') self.vertical_layout = QtWidgets.QVBoxLayout() self.vertical_layout.setObjectName('vertical_layout') self.available_list_widget = QtWidgets.QListWidget(self.available_songs_page) self.available_list_widget.setObjectName('available_list_widget') self.vertical_layout.addWidget(self.available_list_widget) self.horizontal_layout = QtWidgets.QHBoxLayout() self.horizontal_layout.setObjectName('horizontal_layout') self.search_label = QtWidgets.QLabel(self.available_songs_page) self.search_label.setObjectName('search_label') self.horizontal_layout.addWidget(self.search_label) 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) self.horizontal_layout.addItem(spacer_item) self.uncheck_button = QtWidgets.QPushButton(self.available_songs_page) self.uncheck_button.setObjectName('uncheck_button') self.horizontal_layout.addWidget(self.uncheck_button) self.check_button = QtWidgets.QPushButton(self.available_songs_page) self.check_button.setObjectName('selectButton') self.horizontal_layout.addWidget(self.check_button) self.vertical_layout.addLayout(self.horizontal_layout) self.available_songs_layout.addLayout(self.vertical_layout) self.addPage(self.available_songs_page) # The page with the selected songs. self.export_song_page = QtWidgets.QWizardPage() self.export_song_page.setObjectName('available_songs_page') self.export_song_layout = QtWidgets.QHBoxLayout(self.export_song_page) self.export_song_layout.setObjectName('export_song_layout') self.grid_layout = QtWidgets.QGridLayout() self.grid_layout.setObjectName('range_layout') self.selected_list_widget = QtWidgets.QListWidget(self.export_song_page) self.selected_list_widget.setObjectName('selected_list_widget') self.grid_layout.addWidget(self.selected_list_widget, 1, 0, 1, 1) # FIXME: self.horizontal_layout is already defined above?!?!? self.horizontal_layout = QtWidgets.QHBoxLayout() self.horizontal_layout.setObjectName('horizontal_layout') self.directory_label = QtWidgets.QLabel(self.export_song_page) self.directory_label.setObjectName('directory_label') self.horizontal_layout.addWidget(self.directory_label) self.directory_line_edit = QtWidgets.QLineEdit(self.export_song_page) self.directory_line_edit.setObjectName('directory_line_edit') self.horizontal_layout.addWidget(self.directory_line_edit) self.directory_button = QtWidgets.QToolButton(self.export_song_page) self.directory_button.setIcon(build_icon(':/exports/export_load.png')) self.directory_button.setObjectName('directory_button') self.horizontal_layout.addWidget(self.directory_button) self.grid_layout.addLayout(self.horizontal_layout, 0, 0, 1, 1) self.export_song_layout.addLayout(self.grid_layout) self.addPage(self.export_song_page)
def __init__(self): Plugin.__init__(self, u'alerts', __default_settings__, settings_tab_class=AlertsTab) self.weight = -3 self.iconPath = u':/plugins/plugin_alerts.png' self.icon = build_icon(self.iconPath) self.alertsmanager = AlertsManager(self) self.manager = Manager(u'alerts', init_schema) self.alertForm = AlertForm(self)
def __init__(self): super(AlertsPlugin, self).__init__('alerts', __default_settings__, settings_tab_class=AlertsTab) self.weight = -3 self.icon_path = ':/plugins/plugin_alerts.png' self.icon = build_icon(self.icon_path) self.alerts_manager = AlertsManager(self) self.manager = Manager('alerts', init_schema) self.alert_form = AlertForm(self)
def add_icon(self, icon): """ Add an icon to the service item. This is used when displaying the service item in the service manager. :param icon: A string to an icon in the resources or on disk. """ self.icon = icon self.iconic_representation = build_icon(icon)
def _on_thumbnail_downloaded(self, thumbnail_path): """ Load the thumbnail as the icon when it has downloaded. :param Path thumbnail_path: Path to the file to use as a thumbnail :rtype: None """ self.setIcon(build_icon(thumbnail_path))
def addCustomPages(self): """ Add song wizard specific pages. """ # The page with all available songs. self.availableSongsPage = QtGui.QWizardPage() self.availableSongsPage.setObjectName(u'availableSongsPage') self.availableSongsLayout = QtGui.QHBoxLayout(self.availableSongsPage) self.availableSongsLayout.setObjectName(u'availableSongsLayout') self.verticalLayout = QtGui.QVBoxLayout() self.verticalLayout.setObjectName(u'verticalLayout') self.availableListWidget = QtGui.QListWidget(self.availableSongsPage) self.availableListWidget.setObjectName(u'availableListWidget') self.verticalLayout.addWidget(self.availableListWidget) self.horizontalLayout = QtGui.QHBoxLayout() self.horizontalLayout.setObjectName(u'horizontalLayout') self.searchLabel = QtGui.QLabel(self.availableSongsPage) self.searchLabel.setObjectName(u'searchLabel') self.horizontalLayout.addWidget(self.searchLabel) self.searchLineEdit = QtGui.QLineEdit(self.availableSongsPage) self.searchLineEdit.setObjectName(u'searchLineEdit') self.horizontalLayout.addWidget(self.searchLineEdit) spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout.addItem(spacerItem) self.uncheckButton = QtGui.QPushButton(self.availableSongsPage) self.uncheckButton.setObjectName(u'uncheckButton') self.horizontalLayout.addWidget(self.uncheckButton) self.checkButton = QtGui.QPushButton(self.availableSongsPage) self.checkButton.setObjectName(u'selectButton') self.horizontalLayout.addWidget(self.checkButton) self.verticalLayout.addLayout(self.horizontalLayout) self.availableSongsLayout.addLayout(self.verticalLayout) self.addPage(self.availableSongsPage) # The page with the selected songs. self.exportSongPage = QtGui.QWizardPage() self.exportSongPage.setObjectName(u'availableSongsPage') self.exportSongLayout = QtGui.QHBoxLayout(self.exportSongPage) self.exportSongLayout.setObjectName(u'exportSongLayout') self.gridLayout = QtGui.QGridLayout() self.gridLayout.setObjectName(u'gridLayout') self.selectedListWidget = QtGui.QListWidget(self.exportSongPage) self.selectedListWidget.setObjectName(u'selectedListWidget') self.gridLayout.addWidget(self.selectedListWidget, 1, 0, 1, 1) self.horizontalLayout = QtGui.QHBoxLayout() self.horizontalLayout.setObjectName(u'horizontalLayout') self.directoryLabel = QtGui.QLabel(self.exportSongPage) self.directoryLabel.setObjectName(u'directoryLabel') self.horizontalLayout.addWidget(self.directoryLabel) self.directoryLineEdit = QtGui.QLineEdit(self.exportSongPage) self.directoryLineEdit.setObjectName(u'directoryLineEdit') self.horizontalLayout.addWidget(self.directoryLineEdit) self.directoryButton = QtGui.QToolButton(self.exportSongPage) self.directoryButton.setIcon(build_icon(u':/exports/export_load.png')) self.directoryButton.setObjectName(u'directoryButton') self.horizontalLayout.addWidget(self.directoryButton) self.gridLayout.addLayout(self.horizontalLayout, 0, 0, 1, 1) self.exportSongLayout.addLayout(self.gridLayout) self.addPage(self.exportSongPage)
def setupUi(self, book_name_dialog): book_name_dialog.setObjectName('book_name_dialog') book_name_dialog.setWindowIcon(build_icon(u':/icon/openlp-logo.svg')) book_name_dialog.resize(400, 271) self.book_name_layout = QtWidgets.QVBoxLayout(book_name_dialog) self.book_name_layout.setSpacing(8) self.book_name_layout.setContentsMargins(8, 8, 8, 8) self.book_name_layout.setObjectName('book_name_layout') self.info_label = QtWidgets.QLabel(book_name_dialog) self.info_label.setWordWrap(True) self.info_label.setObjectName('info_label') self.book_name_layout.addWidget(self.info_label) self.corresponding_layout = QtWidgets.QGridLayout() self.corresponding_layout.setColumnStretch(1, 1) self.corresponding_layout.setSpacing(8) self.corresponding_layout.setObjectName('corresponding_layout') self.current_label = QtWidgets.QLabel(book_name_dialog) self.current_label.setObjectName('current_label') self.corresponding_layout.addWidget(self.current_label, 0, 0, 1, 1) self.current_book_label = QtWidgets.QLabel(book_name_dialog) self.current_book_label.setObjectName('current_book_label') self.corresponding_layout.addWidget(self.current_book_label, 0, 1, 1, 1) self.corresponding_label = QtWidgets.QLabel(book_name_dialog) self.corresponding_label.setObjectName('corresponding_label') self.corresponding_layout.addWidget(self.corresponding_label, 1, 0, 1, 1) self.corresponding_combo_box = QtWidgets.QComboBox(book_name_dialog) self.corresponding_combo_box.setObjectName('corresponding_combo_box') self.corresponding_layout.addWidget(self.corresponding_combo_box, 1, 1, 1, 1) self.book_name_layout.addLayout(self.corresponding_layout) self.options_group_box = QtWidgets.QGroupBox(book_name_dialog) self.options_group_box.setObjectName('options_group_box') self.options_layout = QtWidgets.QVBoxLayout(self.options_group_box) self.options_layout.setSpacing(8) self.options_layout.setContentsMargins(8, 8, 8, 8) self.options_layout.setObjectName('options_layout') self.old_testament_check_box = QtWidgets.QCheckBox( self.options_group_box) self.old_testament_check_box.setObjectName('old_testament_check_box') self.old_testament_check_box.setCheckState(QtCore.Qt.Checked) self.options_layout.addWidget(self.old_testament_check_box) self.new_testament_check_box = QtWidgets.QCheckBox( self.options_group_box) self.new_testament_check_box.setObjectName('new_testament_check_box') self.new_testament_check_box.setCheckState(QtCore.Qt.Checked) self.options_layout.addWidget(self.new_testament_check_box) self.apocrypha_check_box = QtWidgets.QCheckBox(self.options_group_box) self.apocrypha_check_box.setObjectName('apocrypha_check_box') self.apocrypha_check_box.setCheckState(QtCore.Qt.Checked) self.options_layout.addWidget(self.apocrypha_check_box) self.book_name_layout.addWidget(self.options_group_box) self.button_box = create_button_box(book_name_dialog, 'button_box', ['cancel', 'ok']) self.book_name_layout.addWidget(self.button_box) self.retranslateUi(book_name_dialog)
def __init__(self): """ remotes constructor """ super(RemotesPlugin, self).__init__('remotes', __default_settings__, settings_tab_class=RemoteTab) self.icon_path = ':/plugins/plugin_remote.png' self.icon = build_icon(self.icon_path) self.weight = -1 self.server = None
def __init__(self): super(ImagePlugin, self).__init__('images', __default_settings__, ImageMediaItem, ImageTab) self.manager = Manager('images', init_schema, upgrade_mod=upgrade) self.weight = -7 self.icon_path = UiIcons().picture self.icon = build_icon(self.icon_path) register_endpoint(images_endpoint) register_endpoint(api_images_endpoint)
def __init__(self): super(CustomPlugin, self).__init__('custom', __default_settings__, CustomMediaItem, CustomTab) self.weight = -5 self.db_manager = Manager('custom', init_schema) self.icon_path = UiIcons().clone self.icon = build_icon(self.icon_path) register_endpoint(custom_endpoint) register_endpoint(api_custom_endpoint)
def create_button(parent, name, **kwargs): """ Return an button with the object name set and the given parameters. :param parent: A QtCore.QWidget for the buttons parent (required). :param name: A string which is set as object name (required). :param kwargs: ``role`` A string which can have one value out of ``delete``, ``up``, and ``down``. This decides about default values for properties like text, icon, or tooltip. ``text`` A string for the action text. ``icon`` Either a QIcon, a resource string, or a file location string for the action icon. ``tooltip`` A string for the action tool tip. ``enabled`` False in case the button should be disabled. """ if 'role' in kwargs: role = kwargs.pop('role') if role == 'delete': kwargs.setdefault('text', UiStrings().Delete) kwargs.setdefault('tooltip', translate('OpenLP.Ui', 'Delete the selected item.')) elif role == 'up': kwargs.setdefault('icon', ':/services/service_up.png') kwargs.setdefault('tooltip', translate('OpenLP.Ui', 'Move selection up one position.')) elif role == 'down': kwargs.setdefault('icon', ':/services/service_down.png') kwargs.setdefault('tooltip', translate('OpenLP.Ui', 'Move selection down one position.')) else: log.warning('The role "{role}" is not defined in create_push_button().'.format(role=role)) if kwargs.pop('btn_class', '') == 'toolbutton': button = QtWidgets.QToolButton(parent) else: button = QtWidgets.QPushButton(parent) button.setObjectName(name) if kwargs.get('text'): button.setText(kwargs.pop('text')) if kwargs.get('icon'): button.setIcon(build_icon(kwargs.pop('icon'))) if kwargs.get('tooltip'): button.setToolTip(kwargs.pop('tooltip')) if not kwargs.pop('enabled', True): button.setEnabled(False) if kwargs.get('click'): button.clicked.connect(kwargs.pop('click')) for key in list(kwargs.keys()): if key not in ['text', 'icon', 'tooltip', 'click']: log.warning('Parameter {key} was not consumed in create_button().'.format(key=key)) return button
def __init__(self): super(ImagePlugin, self).__init__('images', ImageMediaItem, ImageTab) self.manager = Manager('images', init_schema, upgrade_mod=upgrade) self.weight = -7 self.icon_path = UiIcons().picture self.icon = build_icon(self.icon_path) register_endpoint(images_endpoint) register_endpoint(api_images_endpoint) State().add_service('image', self.weight, is_plugin=True) State().update_pre_conditions('image', self.check_pre_conditions())
def __init__(self): """ PluginPresentation constructor. """ log.debug('Initialised') self.controllers = {} Plugin.__init__(self, 'presentations', __default_settings__, __default_settings__) self.weight = -8 self.icon_path = ':/plugins/plugin_presentations.png' self.icon = build_icon(self.icon_path)
def __init__(self): super(MediaPlugin, self).__init__('media', __default_settings__, MediaMediaItem) self.weight = -6 self.icon_path = UiIcons().video self.icon = build_icon(self.icon_path) # passed with drag and drop messages self.dnd_id = 'Media' register_endpoint(media_endpoint) register_endpoint(api_media_endpoint)