Пример #1
0
 def retranslateUi(self):
     self.background_color_group_box.setTitle(UiStrings().BackgroundColor)
     self.background_color_label.setText(UiStrings().DefaultColor)
     self.information_label.setText(
         translate(
             'ImagesPlugin.ImageTab',
             'Visible background for images with aspect ratio different to screen.'
         ))
Пример #2
0
 def update_text_format(self, value):
     """
     Called when html copy check box is selected.
     """
     if value == QtCore.Qt.Checked:
         self.copyTextButton.setText(UiStrings().CopyToHtml)
     else:
         self.copyTextButton.setText(UiStrings().CopyToText)
Пример #3
0
 def retranslateUi(self, custom_slide_edit_dialog):
     custom_slide_edit_dialog.setWindowTitle(
         translate('CustomPlugin.EditVerseForm', 'Edit Slide'))
     self.split_button.setText(UiStrings().Split)
     self.split_button.setToolTip(UiStrings().SplitToolTip)
     self.insert_button.setText(
         translate('CustomPlugin.EditCustomForm', 'Insert Slide'))
     self.insert_button.setToolTip(
         translate('CustomPlugin.EditCustomForm',
                   'Split a slide into two by inserting a slide splitter.'))
Пример #4
0
 def retranslateUi(self):
     self.font_group_box.setTitle(translate('AlertsPlugin.AlertsTab', 'Font'))
     self.font_label.setText(translate('AlertsPlugin.AlertsTab', 'Font name:'))
     self.font_color_label.setText(translate('AlertsPlugin.AlertsTab', 'Font color:'))
     self.background_color_label.setText(translate('AlertsPlugin.AlertsTab', 'Background color:'))
     self.font_size_label.setText(translate('AlertsPlugin.AlertsTab', 'Font size:'))
     self.font_size_spin_box.setSuffix(UiStrings().FontSizePtUnit)
     self.timeout_label.setText(translate('AlertsPlugin.AlertsTab', 'Alert timeout:'))
     self.timeout_spin_box.setSuffix(UiStrings().Seconds)
     self.preview_group_box.setTitle(UiStrings().Preview)
     self.font_preview.setText(UiStrings().OLPV2x)
Пример #5
0
    def check_same_instance_test(self):
        """
        Test the UiStrings class - we always should have only one instance of the UiStrings class.
        """
        # WHEN: Create two instances of the UiStrings class.
        first_instance = UiStrings()
        second_instance = UiStrings()

        # THEN: Check if the instances are the same.
        self.assertIs(first_instance, second_instance,
                      'Two UiStrings objects should be the same instance')
Пример #6
0
 def initialise(self):
     """
     Initialise the UI so it can provide Searches
     """
     self.search_text_edit.set_search_types(
         [(CustomSearch.Titles, ':/songs/song_search_title.png', translate('SongsPlugin.MediaItem', 'Titles'),
           translate('SongsPlugin.MediaItem', 'Search Titles...')),
          (CustomSearch.Themes, ':/slides/slide_theme.png', UiStrings().Themes, UiStrings().SearchThemes)])
     self.search_text_edit.set_current_search_type(Settings().value('%s/last search type' % self.settings_section))
     self.load_list(self.plugin.db_manager.get_all_objects(CustomSlide, order_by_ref=CustomSlide.title))
     self.config_update()
Пример #7
0
 def retranslateUi(self):
     """
     Translate the UI on the fly
     """
     self.media_player_group_box.setTitle(translate('OpenLP.PlayerTab', 'Available Media Players'))
     self.player_order_group_box.setTitle(translate('OpenLP.PlayerTab', 'Player Search Order'))
     self.background_color_group_box.setTitle(UiStrings().BackgroundColor)
     self.background_color_label.setText(UiStrings().BackgroundColorColon)
     self.information_label.setText(translate('OpenLP.PlayerTab',
                                    'Visible background for videos with aspect ratio different to screen.'))
     self.retranslate_players()
Пример #8
0
def create_valign_selection_widgets(parent):
    """
    Creates a standard label and combo box for asking users to select a vertical alignment.

    :param parent: The parent object. This should be a ``QWidget`` descendant.
    """
    label = QtWidgets.QLabel(parent)
    label.setText(translate('OpenLP.Ui', '&Vertical Align:'))
    combo_box = QtWidgets.QComboBox(parent)
    combo_box.addItems([UiStrings().Top, UiStrings().Middle, UiStrings().Bottom])
    label.setBuddy(combo_box)
    return label, combo_box
Пример #9
0
 def retranslateUi(self, custom_edit_dialog):
     custom_edit_dialog.setWindowTitle(translate('CustomPlugin.EditCustomForm', 'Edit Custom Slides'))
     self.title_label.setText(translate('CustomPlugin.EditCustomForm', '&Title:'))
     self.add_button.setText(UiStrings().Add)
     self.add_button.setToolTip(translate('CustomPlugin.EditCustomForm', 'Add a new slide at bottom.'))
     self.edit_button.setText(UiStrings().Edit)
     self.edit_button.setToolTip(translate('CustomPlugin.EditCustomForm', 'Edit the selected slide.'))
     self.edit_all_button.setText(translate('CustomPlugin.EditCustomForm', 'Ed&it All'))
     self.edit_all_button.setToolTip(translate('CustomPlugin.EditCustomForm', 'Edit all the slides at once.'))
     self.theme_label.setText(translate('CustomPlugin.EditCustomForm', 'The&me:'))
     self.credit_label.setText(translate('CustomPlugin.EditCustomForm', '&Credits:'))
     self.preview_button.setText(UiStrings().SaveAndPreview)
Пример #10
0
 def add_custom_context_actions(self):
     create_widget_action(self.list_view, separator=True)
     self.replace_action_context = create_widget_action(
         self.list_view,
         text=UiStrings().ReplaceBG,
         icon=':/slides/slide_blank.png',
         triggers=self.on_replace_click)
     self.reset_action_context = create_widget_action(
         self.list_view,
         text=UiStrings().ReplaceLiveBG,
         icon=':/system/system_close.png',
         visible=False,
         triggers=self.on_reset_click)
Пример #11
0
def critical_error_message_box(title=None, message=None, parent=None, question=False):
    """
    Provides a standard critical message box for errors that OpenLP displays to users.

    :param title: The title for the message box.
    :param message: The message to display to the user.
    :param parent: The parent UI element to attach the dialog to.
    :param question: Should this message box question the user.
    """
    if question:
        return QtWidgets.QMessageBox.critical(parent, UiStrings().Error, message,
                                              QtWidgets.QMessageBox.StandardButtons(QtWidgets.QMessageBox.Yes |
                                                                                    QtWidgets.QMessageBox.No))
    return Registry().get('main_window').error_message(title if title else UiStrings().Error, message)
Пример #12
0
    def set_plugin_ui_text_strings(self, tooltips):
        """
        Called to define all translatable texts of the plugin

        :param tooltips:
        """
        # Load Action
        self.__set_name_text_string(StringContent.Load,
                                    UiStrings().Load, tooltips['load'])
        # Import Action
        self.__set_name_text_string(StringContent.Import,
                                    UiStrings().Import, tooltips['import'])
        # New Action
        self.__set_name_text_string(StringContent.New,
                                    UiStrings().Add, tooltips['new'])
        # Edit Action
        self.__set_name_text_string(StringContent.Edit,
                                    UiStrings().Edit, tooltips['edit'])
        # Delete Action
        self.__set_name_text_string(StringContent.Delete,
                                    UiStrings().Delete, tooltips['delete'])
        # Preview Action
        self.__set_name_text_string(StringContent.Preview,
                                    UiStrings().Preview, tooltips['preview'])
        # Send Live Action
        self.__set_name_text_string(StringContent.Live,
                                    UiStrings().Live, tooltips['live'])
        # Add to Service Action
        self.__set_name_text_string(StringContent.Service,
                                    UiStrings().Service, tooltips['service'])
Пример #13
0
 def retranslateUi(self, pluginViewDialog):
     """
     Translate the UI on the fly
     """
     pluginViewDialog.setWindowTitle(
         translate('OpenLP.PluginForm', 'Plugin List'))
     self.plugin_info_group_box.setTitle(
         translate('OpenLP.PluginForm', 'Plugin Details'))
     self.version_label.setText('%s:' % UiStrings().Version)
     self.about_label.setText('%s:' % UiStrings().About)
     self.status_label.setText(translate('OpenLP.PluginForm', 'Status:'))
     self.status_combo_box.setItemText(
         0, translate('OpenLP.PluginForm', 'Active'))
     self.status_combo_box.setItemText(
         1, translate('OpenLP.PluginForm', 'Inactive'))
Пример #14
0
    def test_create_valign_selection_widgets(self):
        """
        Test creating a combo box for valign selection
        """
        # GIVEN: A dialog
        dialog = QtWidgets.QDialog()

        # WHEN: We create the widgets
        label, combo = create_valign_selection_widgets(dialog)

        # THEN: We should get a label and a combobox.
        self.assertEqual(translate('OpenLP.Ui', '&Vertical Align:'), label.text())
        self.assertIsInstance(combo, QtWidgets.QComboBox)
        self.assertEqual(combo, label.buddy())
        for text in [UiStrings().Top, UiStrings().Middle, UiStrings().Bottom]:
            self.assertTrue(combo.findText(text) >= 0)
Пример #15
0
 def save(self):
     """
     Save settings to disk.
     """
     settings = Settings()
     settings.beginGroup(self.settings_section)
     settings.setValue('default service enabled', self.service_name_check_box.isChecked())
     service_name = self.service_name_edit.text()
     preset_is_valid = self.generate_service_name_example()[0]
     if service_name == UiStrings().DefaultServiceName or not preset_is_valid:
         settings.remove('default service name')
         self.service_name_edit.setText(service_name)
     else:
         settings.setValue('default service name', service_name)
     settings.setValue('default service day', self.service_name_day.currentIndex())
     settings.setValue('default service hour', self.service_name_time.time().hour())
     settings.setValue('default service minute', self.service_name_time.time().minute())
     settings.setValue('recent file count', self.recent_spin_box.value())
     settings.setValue('save current plugin', self.media_plugin_check_box.isChecked())
     settings.setValue('double click live', self.double_click_live_check_box.isChecked())
     settings.setValue('single click preview', self.single_click_preview_check_box.isChecked())
     settings.setValue('expand service item', self.expand_service_item_check_box.isChecked())
     settings.setValue('enable exit confirmation', self.enable_auto_close_check_box.isChecked())
     settings.setValue('hide mouse', self.hide_mouse_check_box.isChecked())
     settings.setValue('alternate rows', self.alternate_rows_check_box.isChecked())
     settings.setValue('default color', self.default_color)
     settings.setValue('default image', self.default_file_edit.text())
     settings.setValue('slide limits', self.slide_limits)
     if self.x11_bypass_check_box.isChecked() != settings.value('x11 bypass wm'):
         settings.setValue('x11 bypass wm', self.x11_bypass_check_box.isChecked())
         self.settings_form.register_post_process('config_screen_changed')
     self.settings_form.register_post_process('slidecontroller_update_slide_limits')
     settings.setValue('search as type', self.is_search_as_you_type_enabled)
     settings.endGroup()
Пример #16
0
 def on_clone_click(self):
     """
     Clone a Song
     """
     log.debug('on_clone_click')
     if check_item_selected(self.list_view, UiStrings().SelectEdit):
         self.edit_item = self.list_view.currentItem()
         item_id = self.edit_item.data(QtCore.Qt.UserRole)
         old_song = self.plugin.manager.get_object(Song, item_id)
         song_xml = self.open_lyrics.song_to_xml(old_song)
         new_song = self.open_lyrics.xml_to_song(song_xml)
         new_song.title = '{title} <{text}>'.format(title=new_song.title,
                                                    text=translate('SongsPlugin.MediaItem',
                                                                   'copy', 'For song cloning'))
         # Copy audio files from the old to the new song
         if len(old_song.media_files) > 0:
             save_path = os.path.join(AppLocation.get_section_data_path(self.plugin.name), 'audio', str(new_song.id))
             check_directory_exists(save_path)
             for media_file in old_song.media_files:
                 new_media_file_name = os.path.join(save_path, os.path.basename(media_file.file_name))
                 shutil.copyfile(media_file.file_name, new_media_file_name)
                 new_media_file = MediaFile()
                 new_media_file.file_name = new_media_file_name
                 new_media_file.type = media_file.type
                 new_media_file.weight = media_file.weight
                 new_song.media_files.append(new_media_file)
         self.plugin.manager.save_object(new_song)
     self.on_song_list_load()
Пример #17
0
 def set_up_default_values():
     """
     This static method is called on start up. It is used to perform any operation on the __default_settings__ dict.
     """
     # Make sure the string is translated (when building the dict the string is not translated because the translate
     # function was not set up as this stage).
     Settings.__default_settings__['advanced/default service name'] = UiStrings().DefaultServiceName
Пример #18
0
 def retranslateUi(self):
     """
     Song wizard localisation.
     """
     self.setWindowTitle(translate('SongsPlugin.ExportWizardForm', 'Song Export Wizard'))
     # TODO: Verify format() with template variables
     self.title_label.setText(WizardStrings.HeaderStyle %
                              translate('OpenLP.Ui', 'Welcome to the Song Export Wizard'))
     self.information_label.setText(
         translate('SongsPlugin.ExportWizardForm', 'This wizard will help to export your songs to the open and free '
                                                   '<strong>OpenLyrics </strong> worship song format.'))
     self.available_songs_page.setTitle(translate('SongsPlugin.ExportWizardForm', 'Select Songs'))
     self.available_songs_page.setSubTitle(translate('SongsPlugin.ExportWizardForm',
                                           'Check the songs you want to export.'))
     self.search_label.setText('{text}:'.format(text=UiStrings().Search))
     self.uncheck_button.setText(translate('SongsPlugin.ExportWizardForm', 'Uncheck All'))
     self.check_button.setText(translate('SongsPlugin.ExportWizardForm', 'Check All'))
     self.export_song_page.setTitle(translate('SongsPlugin.ExportWizardForm', 'Select Directory'))
     self.export_song_page.setSubTitle(translate('SongsPlugin.ExportWizardForm',
                                       'Select the directory where you want the songs to be saved.'))
     self.directory_label.setText(translate('SongsPlugin.ExportWizardForm', 'Directory:'))
     self.progress_page.setTitle(translate('SongsPlugin.ExportWizardForm', 'Exporting'))
     self.progress_page.setSubTitle(translate('SongsPlugin.ExportWizardForm',
                                    'Please wait while your songs are exported.'))
     self.progress_label.setText(WizardStrings.Ready)
     self.progress_bar.setFormat(WizardStrings.PercentSymbolFormat)
Пример #19
0
 def validateCurrentPage(self):
     """
     Validate the current page before moving on to the next page.
     """
     if self.currentPage() == self.welcome_page:
         return True
     elif self.currentPage() == self.available_songs_page:
         items = [
             item for item in find_list_widget_items(self.available_list_widget) if item.checkState()
         ]
         if not items:
             critical_error_message_box(
                 UiStrings().NISp,
                 translate('SongsPlugin.ExportWizardForm', 'You need to add at least one Song to export.'))
             return False
         self.selected_list_widget.clear()
         # Add the songs to the list of selected songs.
         for item in items:
             song = QtWidgets.QListWidgetItem(item.text())
             song.setData(QtCore.Qt.UserRole, item.data(QtCore.Qt.UserRole))
             song.setFlags(QtCore.Qt.ItemIsEnabled)
             self.selected_list_widget.addItem(song)
         return True
     elif self.currentPage() == self.export_song_page:
         if not self.directory_line_edit.text():
             critical_error_message_box(
                 translate('SongsPlugin.ExportWizardForm', 'No Save Location specified'),
                 translate('SongsPlugin.ExportWizardForm', 'You need to specify a directory.'))
             return False
         return True
     elif self.currentPage() == self.progress_page:
         self.available_list_widget.clear()
         self.selected_list_widget.clear()
         return True
Пример #20
0
 def retranslateUi(self):
     """
     Make any translation changes
     """
     self.controllers_group_box.setTitle(
         translate('PresentationPlugin.PresentationTab',
                   'Available Controllers'))
     for key in self.controllers:
         controller = self.controllers[key]
         checkbox = self.presenter_check_boxes[controller.name]
         self.set_controller_text(checkbox, controller)
     self.advanced_group_box.setTitle(UiStrings().Advanced)
     self.pdf_group_box.setTitle(
         translate('PresentationPlugin.PresentationTab', 'PDF options'))
     self.powerpoint_group_box.setTitle(
         translate('PresentationPlugin.PresentationTab',
                   'PowerPoint options'))
     self.override_app_check_box.setText(
         translate('PresentationPlugin.PresentationTab',
                   'Allow presentation application to be overridden'))
     self.ppt_slide_click_check_box.setText(
         translate(
             'PresentationPlugin.PresentationTab',
             'Clicking on the current slide advances to the next effect'))
     self.ppt_window_check_box.setText(
         translate(
             'PresentationPlugin.PresentationTab',
             'Let PowerPoint control the size and monitor of the presentations\n'
             '(This may fix PowerPoint scaling issues in Windows 8 and 10)')
     )
     self.pdf_program_check_box.setText(
         translate('PresentationPlugin.PresentationTab',
                   'Use given full path for mudraw or ghostscript binary:'))
Пример #21
0
 def retranslateUi(self):
     """
     Translate the general settings tab to the currently selected language
     """
     self.tab_title_visible = translate('OpenLP.GeneralTab', 'General')
     self.monitor_group_box.setTitle(
         translate('OpenLP.GeneralTab', 'Monitors'))
     self.monitor_radio_button.setText(
         translate('OpenLP.GeneralTab',
                   'Select monitor for output display:'))
     self.display_on_monitor_check.setText(
         translate('OpenLP.GeneralTab', 'Display if a single screen'))
     self.startup_group_box.setTitle(
         translate('OpenLP.GeneralTab', 'Application Startup'))
     self.warning_check_box.setText(
         translate('OpenLP.GeneralTab', 'Show blank screen warning'))
     self.auto_open_check_box.setText(
         translate('OpenLP.GeneralTab',
                   'Automatically open the last service'))
     self.show_splash_check_box.setText(
         translate('OpenLP.GeneralTab', 'Show the splash screen'))
     self.check_for_updates_check_box.setText(
         translate('OpenLP.GeneralTab', 'Check for updates to OpenLP'))
     self.settings_group_box.setTitle(
         translate('OpenLP.GeneralTab', 'Application Settings'))
     self.save_check_service_check_box.setText(
         translate('OpenLP.GeneralTab',
                   'Prompt to save before starting a new service'))
     self.auto_unblank_check_box.setText(
         translate('OpenLP.GeneralTab',
                   'Unblank display when adding new live item'))
     self.auto_preview_check_box.setText(
         translate('OpenLP.GeneralTab',
                   'Automatically preview next item in service'))
     self.timeout_label.setText(
         translate('OpenLP.GeneralTab', 'Timed slide interval:'))
     self.timeout_spin_box.setSuffix(translate('OpenLP.GeneralTab', ' sec'))
     self.ccli_group_box.setTitle(
         translate('OpenLP.GeneralTab', 'CCLI Details'))
     self.number_label.setText(UiStrings().CCLINumberLabel)
     self.username_label.setText(
         translate('OpenLP.GeneralTab', 'SongSelect username:'******'OpenLP.GeneralTab', 'SongSelect password:'******'OpenLP.GeneralTab', 'Override display position:'))
     self.custom_x_label.setText(translate('OpenLP.GeneralTab', 'X'))
     self.custom_y_label.setText(translate('OpenLP.GeneralTab', 'Y'))
     self.custom_height_label.setText(
         translate('OpenLP.GeneralTab', 'Height'))
     self.custom_width_label.setText(translate('OpenLP.GeneralTab',
                                               'Width'))
     self.audio_group_box.setTitle(
         translate('OpenLP.GeneralTab', 'Background Audio'))
     self.start_paused_check_box.setText(
         translate('OpenLP.GeneralTab', 'Start background audio paused'))
     self.repeat_list_check_box.setText(
         translate('OpenLP.GeneralTab', 'Repeat track list'))
Пример #22
0
 def retranslateUi(self):
     self.advanced_group_box.setTitle(UiStrings().Advanced)
     self.override_player_check_box.setText(
         translate('MediaPlugin.MediaTab',
                   'Allow media player to be overridden'))
     self.auto_start_check_box.setText(
         translate('MediaPlugin.MediaTab',
                   'Start Live items automatically'))
Пример #23
0
    def verse_search(self, bible, second_bible, text):
        """
        Does a verse search for the given bible and text.

        :param bible: The bible to search in (unicode).
        :param second_bible: The second bible (unicode). We do not search in this bible.
        :param text: The text to search for (unicode).
        """
        log.debug('BibleManager.verse_search("{bible}", "{text}")'.format(
            bible=bible, text=text))
        # If no bibles are installed, message is given.
        if not bible:
            self.main_window.information_message(
                UiStrings().BibleNoBiblesTitle,
                UiStrings().BibleNoBibles)
            return None
        # Check if the bible or second_bible is a web bible.
        web_bible = self.db_cache[bible].get_object(BibleMeta,
                                                    'download_source')
        second_web_bible = ''
        if second_bible:
            second_web_bible = self.db_cache[second_bible].get_object(
                BibleMeta, 'download_source')
        if web_bible or second_web_bible:
            # If either Bible is Web, cursor is reset to normal and message is given.
            self.application.set_normal_cursor()
            self.main_window.information_message(
                translate('BiblesPlugin.BibleManager',
                          'Web Bible cannot be used in Text Search'),
                translate(
                    'BiblesPlugin.BibleManager',
                    'Text Search is not available with Web Bibles.\n'
                    'Please use the Scripture Reference Search instead.\n\n'
                    'This means that the currently used Bible\nor Second Bible '
                    'is installed as Web Bible.\n\n'
                    'If you were trying to perform a Reference search\nin Combined '
                    'Search, your reference is invalid.'))
            return None
        # Shorter than 3 char searches break OpenLP with very long search times, thus they are blocked.
        if len(text) - text.count(' ') < 3:
            return None
        # Fetch the results from db. If no results are found, return None, no message is given for this.
        elif text:
            return self.db_cache[bible].verse_search(text)
        else:
            return None
Пример #24
0
 def bootstrap_post_set_up(self):
     """
     Process the bootstrap post setup request
     """
     self.load_loops()
     self.file_rename_form = FileRenameForm()
     self.on_new_prompt = translate('OpenLP.LoopManager', 'Select Video Loop')
     self.on_new_file_masks = translate('OpenLP.LoopManager', 'Videos (%s);;%s (*)') % (
         ' '.join(self.media_controller.video_extensions_list), UiStrings().AllFiles)
Пример #25
0
 def getOpenFileNames(parent, *args, **kwargs):
     """
     Reimplement getOpenFileNames to fix the way it returns some file names that url encoded when selecting multiple
     files
     """
     files = QtGui.QFileDialog.getOpenFileNames(parent, *args, **kwargs)
     file_list = []
     for file in files:
         if not os.path.exists(file):
             log.info('File not found. Attempting to unquote.')
             file = parse.unquote(file)
             if not os.path.exists(file):
                 log.error('File %s not found.' % file)
                 QtGui.QMessageBox.information(parent, UiStrings().FileNotFound,
                                               UiStrings().FileNotFoundMessage % file)
                 continue
         file_list.append(file)
     return file_list
Пример #26
0
 def exec(self):
     """
     Run the Dialog with correct heading.
     """
     hour, minutes, seconds = self._time_split(self.item['service_item'].start_time)
     self.hour_spin_box.setValue(hour)
     self.minute_spin_box.setValue(minutes)
     self.second_spin_box.setValue(seconds)
     hours, minutes, seconds = self._time_split(self.item['service_item'].end_time)
     if hours == 0 and minutes == 0 and seconds == 0:
         hours, minutes, seconds = self._time_split(self.item['service_item'].media_length)
     self.hour_finish_spin_box.setValue(hours)
     self.minute_finish_spin_box.setValue(minutes)
     self.second_finish_spin_box.setValue(seconds)
     self.hour_finish_label.setText('{val:d}{text}'.format(val=hour, text=UiStrings().Hours))
     self.minute_finish_label.setText('{val:d}{text}'.format(val=minutes, text=UiStrings().Minutes))
     self.second_finish_label.setText('{val:d}{text}'.format(val=seconds, text=UiStrings().Seconds))
     return QtWidgets.QDialog.exec(self)
Пример #27
0
 def initialise(self):
     """
     Initialise the plugin
     """
     log.info('Songs Initialising')
     super(SongsPlugin, self).initialise()
     self.songselect_form = SongSelectForm(Registry().get('main_window'),
                                           self, self.manager)
     self.songselect_form.initialise()
     self.song_import_item.setVisible(True)
     self.song_export_item.setVisible(True)
     self.tools_reindex_item.setVisible(True)
     self.tools_find_duplicates.setVisible(True)
     action_list = ActionList.get_instance()
     action_list.add_action(self.song_import_item, UiStrings().Import)
     action_list.add_action(self.song_export_item, UiStrings().Export)
     action_list.add_action(self.tools_reindex_item, UiStrings().Tools)
     action_list.add_action(self.tools_find_duplicates, UiStrings().Tools)
Пример #28
0
 def is_already_running(self):
     """
     Look to see if OpenLP is already running and ask if a 2nd instance is to be started.
     """
     self.shared_memory = QtCore.QSharedMemory('OpenLP')
     if self.shared_memory.attach():
         status = QtWidgets.QMessageBox.critical(
             None,
             UiStrings().Error,
             UiStrings().OpenLPStart,
             QtWidgets.QMessageBox.StandardButtons(
                 QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No))
         if status == QtWidgets.QMessageBox.No:
             return True
         return False
     else:
         self.shared_memory.create(1)
         return False
Пример #29
0
 def rebuild_players(self):
     """
     Rebuild the tab in the media manager when changes are made in the settings.
     """
     self.populate_display_types()
     self.on_new_file_masks = translate(
         'MediaPlugin.MediaItem', 'Videos (%s);;Audio (%s);;%s (*)'
     ) % (' '.join(self.media_controller.video_extensions_list), ' '.join(
         self.media_controller.audio_extensions_list), UiStrings().AllFiles)
Пример #30
0
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