Пример #1
0
 def validate_meta(self, name, copyright):
     """
     Validate the Meta before saving.
     """
     if not name:
         self.version_name_edit.setFocus()
         critical_error_message_box(
             UiStrings().EmptyField,
             translate(
                 'BiblesPlugin.BibleEditForm',
                 'You need to specify a version name for your Bible.'))
         return False
     elif not copyright:
         self.copyright_edit.setFocus()
         critical_error_message_box(
             UiStrings().EmptyField,
             translate(
                 'BiblesPlugin.BibleEditForm',
                 'You need to set a copyright for your Bible. Bibles in the Public Domain need to be marked '
                 'as such.'))
         return False
     elif self.manager.exists(name) and self.manager.get_meta_data(
             self.bible, 'name').value != name:
         self.version_name_edit.setFocus()
         critical_error_message_box(
             translate('BiblesPlugin.BibleEditForm', 'Bible Exists'),
             translate(
                 'BiblesPlugin.BibleEditForm',
                 'This Bible already exists. Please import '
                 'a different Bible or first delete the existing one.'))
         return False
     return True
Пример #2
0
 def on_delete_click(self):
     """
     Remove a song from the list and database
     """
     if check_item_selected(self.list_view, UiStrings().SelectDelete):
         items = self.list_view.selectedItems()
         if QtWidgets.QMessageBox.question(
                 self,
                 UiStrings().ConfirmDelete,
                 translate(
                     'SongsPlugin.MediaItem',
                     'Are you sure you want to delete the following songs?')
                 + '\n\n- {songs}'.format(
                     songs='\n- '.join([item.text() for item in items])),
                 defaultButton=QtWidgets.QMessageBox.Yes
         ) == QtWidgets.QMessageBox.No:
             return
         self.application.set_busy_cursor()
         self.main_window.display_progress_bar(len(items))
         for item in items:
             item_id = item.data(QtCore.Qt.UserRole)
             delete_song(item_id, self.plugin)
             self.main_window.increment_progress_bar()
         self.main_window.finished_progress_bar()
         self.application.set_normal_cursor()
         self.on_search_text_button_clicked()
Пример #3
0
 def initialise(self):
     """
     Initialise variables when they cannot be initialised in the constructor.
     """
     self.song_maintenance_form = SongMaintenanceForm(self.plugin.manager, self)
     self.edit_song_form = EditSongForm(self, self.main_window, self.plugin.manager)
     self.open_lyrics = OpenLyrics(self.plugin.manager)
     self.search_text_edit.set_search_types([
         (SongSearch.Entire, UiIcons().music,
             translate('SongsPlugin.MediaItem', 'Entire Song'),
             translate('SongsPlugin.MediaItem', 'Search Entire Song...')),
         (SongSearch.Titles, UiIcons().search_text,
             translate('SongsPlugin.MediaItem', 'Titles'),
             translate('SongsPlugin.MediaItem', 'Search Titles...')),
         (SongSearch.Lyrics, UiIcons().search_lyrcs,
             translate('SongsPlugin.MediaItem', 'Lyrics'),
             translate('SongsPlugin.MediaItem', 'Search Lyrics...')),
         (SongSearch.Authors, UiIcons().user, SongStrings.Authors,
             translate('SongsPlugin.MediaItem', 'Search Authors...')),
         (SongSearch.Topics, UiIcons().theme, SongStrings.Topics,
             translate('SongsPlugin.MediaItem', 'Search Topics...')),
         (SongSearch.Books, UiIcons().address, SongStrings.SongBooks,
             translate('SongsPlugin.MediaItem', 'Search Songbooks...')),
         (SongSearch.Themes, UiIcons().theme, UiStrings().Themes, UiStrings().SearchThemes),
         (SongSearch.Copyright, UiIcons().copyright,
             translate('SongsPlugin.MediaItem', 'Copyright'),
             translate('SongsPlugin.MediaItem', 'Search Copyright...')),
         (SongSearch.CCLInumber, UiIcons().search_ccli,
             translate('SongsPlugin.MediaItem', 'CCLI number'),
             translate('SongsPlugin.MediaItem', 'Search CCLI number...'))
     ])
     self.config_update()
Пример #4
0
 def on_add_edit_click(self):
     """
     Add a selected item to an existing item in the current service.
     """
     if not self.list_view.selectedIndexes() and not self.remote_triggered:
         QtWidgets.QMessageBox.information(
             self,
             UiStrings().NISp,
             translate('OpenLP.MediaManagerItem',
                       'You must select one or more items.'))
     else:
         log.debug('{plugin} Add requested'.format(plugin=self.plugin.name))
         service_item = self.service_manager.get_service_item()
         if not service_item:
             QtWidgets.QMessageBox.information(
                 self,
                 UiStrings().NISs,
                 translate(
                     'OpenLP.MediaManagerItem',
                     'You must select an existing service item to add to.'))
         elif self.plugin.name == service_item.name:
             self.generate_slide_data(service_item)
             self.service_manager.add_service_item(service_item,
                                                   replace=True)
         else:
             # Turn off the remote edit update message indicator
             QtWidgets.QMessageBox.information(
                 self,
                 translate('OpenLP.MediaManagerItem',
                           'Invalid Service Item'),
                 translate('OpenLP.MediaManagerItem',
                           'You must select a {title} '
                           'service item.').format(title=self.title))
Пример #5
0
 def retranslate_ui(self, formatting_tag_dialog):
     """
     Translate the UI on the fly
     """
     formatting_tag_dialog.setWindowTitle(
         translate('OpenLP.FormattingTagDialog',
                   'Configure Formatting Tags'))
     self.delete_button.setText(UiStrings().Delete)
     self.new_button.setText(UiStrings().New)
     self.tag_table_widget_read_label.setText(
         translate('OpenLP.FormattingTagDialog', 'Default Formatting'))
     self.tag_table_widget_read.horizontalHeaderItem(0).\
         setText(translate('OpenLP.FormattingTagDialog', 'Description'))
     self.tag_table_widget_read.horizontalHeaderItem(1).setText(
         translate('OpenLP.FormattingTagDialog', 'Tag'))
     self.tag_table_widget_read.horizontalHeaderItem(2).\
         setText(translate('OpenLP.FormattingTagDialog', 'Start HTML'))
     self.tag_table_widget_read.horizontalHeaderItem(3).setText(
         translate('OpenLP.FormattingTagDialog', 'End HTML'))
     self.tag_table_widget_read.setColumnWidth(0, 120)
     self.tag_table_widget_read.setColumnWidth(1, 80)
     self.tag_table_widget_read.setColumnWidth(2, 330)
     self.tag_table_widget_label.setText(
         translate('OpenLP.FormattingTagDialog', 'Custom Formatting'))
     self.tag_table_widget.horizontalHeaderItem(0).setText(
         translate('OpenLP.FormattingTagDialog', 'Description'))
     self.tag_table_widget.horizontalHeaderItem(1).setText(
         translate('OpenLP.FormattingTagDialog', 'Tag'))
     self.tag_table_widget.horizontalHeaderItem(2).setText(
         translate('OpenLP.FormattingTagDialog', 'Start HTML'))
     self.tag_table_widget.horizontalHeaderItem(3).setText(
         translate('OpenLP.FormattingTagDialog', 'End HTML'))
     self.tag_table_widget.setColumnWidth(0, 120)
     self.tag_table_widget.setColumnWidth(1, 80)
     self.tag_table_widget.setColumnWidth(2, 330)
Пример #6
0
 def retranslate_ui(self):
     self.font_group_box.setTitle(
         translate('AlertsPlugin.AlertsTab', 'Font Settings'))
     self.font_label.setText(
         translate('AlertsPlugin.AlertsTab', 'Font name:'))
     self.font_color_label.setText(
         translate('AlertsPlugin.AlertsTab', 'Font color:'))
     self.background_color_label.setText(UiStrings().BackgroundColorColon)
     self.font_size_label.setText(
         translate('AlertsPlugin.AlertsTab', 'Font size:'))
     self.font_size_spin_box.setSuffix(
         ' {unit}'.format(unit=UiStrings().FontSizePtUnit))
     self.background_group_box.setTitle(
         translate('AlertsPlugin.AlertsTab', 'Background Settings'))
     self.settings_group_box.setTitle(
         translate('AlertsPlugin.AlertsTab', 'Other Settings'))
     self.timeout_label.setText(
         translate('AlertsPlugin.AlertsTab', 'Alert timeout:'))
     self.timeout_spin_box.setSuffix(
         ' {unit}'.format(unit=UiStrings().Seconds))
     self.repeat_label.setText(
         translate('AlertsPlugin.AlertsTab', 'Repeat (no. of times):'))
     self.scroll_check_box.setText(
         translate('AlertsPlugin.AlertsTab', 'Enable Scrolling'))
     self.preview_group_box.setTitle(UiStrings().Preview)
     self.font_preview.setText(UiStrings().OpenLP)
Пример #7
0
 def validateCurrentPage(self):
     """
     Re-implement the validateCurrentPage() method. Validate the current page before moving on to the next page.
     Provide each song format class with a chance to validate its input by overriding is_valid_source().
     """
     if self.currentPage() == self.welcome_page:
         return True
     elif self.currentPage() == self.source_page:
         this_format = self.current_format
         self.settings.setValue('songs/last import type', this_format)
         select_mode, class_, error_msg = SongFormat.get(this_format, 'selectMode', 'class', 'invalidSourceMsg')
         if select_mode == SongFormatSelect.MultipleFiles:
             import_source = self.get_list_of_paths(self.format_widgets[this_format]['file_list_widget'])
             error_title = UiStrings().IFSp
             focus_button = self.format_widgets[this_format]['addButton']
         else:
             import_source = self.format_widgets[this_format]['path_edit'].path
             error_title = (UiStrings().IFSs if select_mode == SongFormatSelect.SingleFile else UiStrings().IFdSs)
             focus_button = self.format_widgets[this_format]['path_edit']
         if not class_.is_valid_source(import_source):
             critical_error_message_box(error_title, error_msg)
             focus_button.setFocus()
             return False
         return True
     elif self.currentPage() == self.progress_page:
         return True
Пример #8
0
 def on_delete_click(self):
     """
     Remove a custom item from the list and database
     """
     if check_item_selected(self.list_view, UiStrings().SelectDelete):
         items = self.list_view.selectedIndexes()
         if QtWidgets.QMessageBox.question(
                 self,
                 UiStrings().ConfirmDelete,
                 translate(
                     'CustomPlugin.MediaItem',
                     'Are you sure you want to delete the "{items:d}" '
                     'selected custom slide(s)?').format(items=len(items)),
                 defaultButton=QtWidgets.QMessageBox.Yes
         ) == QtWidgets.QMessageBox.No:
             return
         row_list = [
             item.row() for item in self.list_view.selectedIndexes()
         ]
         row_list.sort(reverse=True)
         id_list = [(item.data(QtCore.Qt.UserRole))
                    for item in self.list_view.selectedIndexes()]
         for id in id_list:
             self.plugin.db_manager.delete_object(CustomSlide, id)
         self.on_search_text_button_clicked()
Пример #9
0
 def add_custom_context_actions(self):
     """
     Add custom actions to the context menu.
     """
     create_widget_action(self.list_view, separator=True)
     create_widget_action(self.list_view,
                          text=UiStrings().AddGroup,
                          icon=UiIcons().group,
                          triggers=self.on_add_group_click)
     create_widget_action(self.list_view,
                          text=translate('ImagePlugin', 'Add new image(s)'),
                          icon=UiIcons().open,
                          triggers=self.on_file_click)
     create_widget_action(self.list_view, separator=True)
     self.replace_action_context = create_widget_action(
         self.list_view,
         text=UiStrings().ReplaceBG,
         icon=UiIcons().theme,
         triggers=self.on_replace_click)
     self.reset_action_context = create_widget_action(
         self.list_view,
         text=UiStrings().ReplaceLiveBG,
         icon=UiIcons().close,
         visible=False,
         triggers=self.on_reset_click)
Пример #10
0
    def retranslateUi(self):
        """

        """
        self.search_text_label.setText(
            '{text}:'.format(text=UiStrings().Search))
        self.search_text_button.setText(UiStrings().Search)
Пример #11
0
 def retranslateUi(self):
     self.background_color_group_box.setTitle(UiStrings().BackgroundColor)
     self.background_color_label.setText(UiStrings().BackgroundColorColon)
     self.information_label.setText(
         translate(
             'ImagesPlugin.ImageTab',
             'Visible background for images with aspect ratio different to screen.'
         ))
Пример #12
0
 def retranslate_ui(self):
     self.search_text_label.setText(
         '{text}:'.format(text=UiStrings().Search))
     self.search_text_button.setText(UiStrings().Search)
     self.maintenance_action.setText(SongStrings.SongMaintenance)
     self.maintenance_action.setToolTip(
         translate('SongsPlugin.MediaItem',
                   'Maintain the lists of authors, topics and books.'))
Пример #13
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)
Пример #14
0
 def is_already_running():
     """
     Tell the user there is a 2nd instance running.
     """
     QtWidgets.QMessageBox.critical(
         None,
         UiStrings().Error,
         UiStrings().OpenLPStart,
         QtWidgets.QMessageBox.StandardButtons(QtWidgets.QMessageBox.Ok))
Пример #15
0
def test_check_same_instance():
    """
    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.
    assert first_instance is second_instance, 'Two UiStrings objects should be the same instance'
Пример #16
0
 def retranslate_ui(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.'))
Пример #17
0
 def test_bug_1404967(self):
     """
     Test for CCLI label showing correct text
     """
     # GIVEN; Mocked methods
     form = self.form
     # THEN: CCLI label should be CCLI song label
     assert form.ccli_label.text() is not UiStrings().CCLINumberLabel, \
         'CCLI label should not be "{}"'.format(UiStrings().CCLINumberLabel)
     assert form.ccli_label.text() == UiStrings().CCLISongNumberLabel, \
         'CCLI label text should be "{}"'.format(UiStrings().CCLISongNumberLabel)
Пример #18
0
 def retranslate_ui(self):
     log.debug('retranslate_ui')
     self.chapter_label.setText(translate('BiblesPlugin.MediaItem', 'Chapter:'))
     self.verse_label.setText(translate('BiblesPlugin.MediaItem', 'Verse:'))
     self.style_combo_box.setItemText(LayoutStyle.VersePerSlide, UiStrings().VersePerSlide)
     self.style_combo_box.setItemText(LayoutStyle.VersePerLine, UiStrings().VersePerLine)
     self.style_combo_box.setItemText(LayoutStyle.Continuous, UiStrings().Continuous)
     self.clear_button.setToolTip(translate('BiblesPlugin.MediaItem', 'Clear the results on the current tab.'))
     self.save_results_button.setToolTip(
         translate('BiblesPlugin.MediaItem', 'Add the search results to the saved list.'))
     self.search_button.setText(UiStrings().Search)
Пример #19
0
    def clear(self, search_while_typing=False):
        """
        Re-implement clear, so that we can customise feedback when using 'Search as you type'

        :param search_while_typing: True if we want to display the customised message
        :return: None
        """
        if search_while_typing:
            self.no_results_text = UiStrings().ShortResults
        else:
            self.no_results_text = UiStrings().NoResults
        super().clear()
Пример #20
0
 def retranslate_ui(self):
     """
     Translate the general settings tab to the currently selected language
     """
     self.tab_title_visible = translate('OpenLP.GeneralTab', 'General')
     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 previous service file'))
     self.show_splash_check_box.setText(
         translate('OpenLP.GeneralTab', 'Show the splash screen'))
     self.logo_group_box.setTitle(translate('OpenLP.GeneralTab', 'Logo'))
     self.logo_color_label.setText(UiStrings().BackgroundColorColon)
     self.logo_file_label.setText(
         translate('OpenLP.GeneralTab', 'Logo file:'))
     self.logo_hide_on_startup_check_box.setText(
         translate('OpenLP.GeneralTab', 'Don\'t show logo on startup'))
     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.click_live_slide_to_unblank_check_box.setText(
         translate('OpenLP.GeneralTab',
                   'Unblank display when changing slide in Live'))
     self.auto_unblank_check_box.setText(
         translate('OpenLP.GeneralTab', 'Unblank display when sending '
                   'items to Live'))
     self.auto_preview_check_box.setText(
         translate('OpenLP.GeneralTab',
                   'Automatically preview the 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.AdvancedTab', 'Select Logo File')
     self.logo_file_path_edit.dialog_caption = translate(
         'OpenLP.AdvancedTab', 'Select Logo File')
     self.logo_file_path_edit.filters = '{text};;{names} (*)'.format(
         text=get_images_filter(), names=UiStrings().AllFiles)
Пример #21
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_theme.png',
         triggers=self.on_replace_click)
     self.reset_action_context = create_widget_action(
         self.list_view,
         text=UiStrings().ReplaceLiveBG,
         icon=UiIcons().close,
         visible=False,
         triggers=self.on_reset_click)
Пример #22
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'])
Пример #23
0
    def load_list(self, media, target_group=None):
        """
        Load the media list

        :param media: The media
        :param target_group:
        """
        media.sort(key=lambda file_path: get_natural_key(os.path.split(str(file_path))[1]))
        file_name = translate('MediaPlugin.MediaItem', 'Live Stream')
        item_name = QtWidgets.QListWidgetItem(file_name)
        item_name.setIcon(UiIcons().video)
        item_name.setData(QtCore.Qt.UserRole, UiStrings().LiveStream)
        item_name.setToolTip(translate('MediaPlugin.MediaItem', 'Show Live Stream'))
        self.list_view.addItem(item_name)
        for track in media:
            track_str = str(track)
            track_info = QtCore.QFileInfo(track_str)
            item_name = None
            # Dont add the live stream in when reloading the UI.
            if track_str == UiStrings().LiveStream:
                continue
            elif track_str.startswith('optical:'):
                # Handle optical based item
                (file_name, title, audio_track, subtitle_track, start, end, clip_name) = parse_optical_path(track_str)
                item_name = QtWidgets.QListWidgetItem(clip_name)
                item_name.setIcon(UiIcons().optical)
                item_name.setData(QtCore.Qt.UserRole, track)
                item_name.setToolTip('{name}@{start}-{end}'.format(name=file_name,
                                                                   start=format_milliseconds(start),
                                                                   end=format_milliseconds(end)))
            elif not os.path.exists(track):
                # File doesn't exist, mark as error.
                file_name = os.path.split(track_str)[1]
                item_name = QtWidgets.QListWidgetItem(file_name)
                item_name.setIcon(UiIcons().error)
                item_name.setData(QtCore.Qt.UserRole, track)
                item_name.setToolTip(track_str)
            elif track_info.isFile():
                # Normal media file handling.
                file_name = os.path.split(track_str)[1]
                item_name = QtWidgets.QListWidgetItem(file_name)
                search = file_name.split('.')[-1].lower()
                if search in AUDIO_EXT:
                    item_name.setIcon(UiIcons().audio)
                else:
                    item_name.setIcon(UiIcons().video)
                item_name.setData(QtCore.Qt.UserRole, track)
                item_name.setToolTip(track_str)
            if item_name:
                self.list_view.addItem(item_name)
Пример #24
0
 def initialise(self):
     """
     Initialise the UI so it can provide Searches
     """
     self.search_text_edit.set_search_types([
         (CustomSearch.Titles, UiIcons().search,
          translate('SongsPlugin.MediaItem', 'Titles'),
          translate('SongsPlugin.MediaItem', 'Search Titles...')),
         (CustomSearch.Themes, UiIcons().theme, UiStrings().Themes,
          UiStrings().SearchThemes)
     ])
     self.load_list(
         self.plugin.db_manager.get_all_objects(
             CustomSlide, order_by_ref=CustomSlide.title))
     self.config_update()
Пример #25
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
Пример #26
0
 def text_search(self):
     """
     This triggers the proper 'Search' search based on which search type is used.
     "Eg. "Reference Search", "Text Search" or "Combined search".
     """
     self.search_results = []
     log.debug('text_search called')
     text = self.search_edit.text()
     if text == '':
         self.display_results()
         return
     self.on_results_view_tab_total_update(ResultsTab.Search)
     if self.search_edit.current_search_type() == BibleSearch.Reference:
         if get_reference_match('full').match(text):
             # Valid reference found. Do reference search.
             self.text_reference_search(text)
         elif self.search_status == SearchStatus.SearchButton:
             self.main_window.information_message(
                 translate('BiblesPlugin.BibleManager', 'Scripture Reference Error'),
                 translate('BiblesPlugin.BibleManager',
                           '<strong>The reference you typed is invalid!<br><br>'
                           'Please make sure that your reference follows one of these patterns:</strong><br><br>%s')
                 % UiStrings().BibleScriptureError % get_reference_separators())
     elif self.search_edit.current_search_type() == BibleSearch.Combined and get_reference_match('full').match(text):
         # Valid reference found. Do reference search.
         self.text_reference_search(text)
     else:
         # It can only be a 'Combined' search without a valid reference, or a 'Text' search
         if self.search_status == SearchStatus.SearchAsYouType:
             if len(text) <= 8:
                 self.search_status = SearchStatus.NotEnoughText
                 self.display_results()
                 return
         if VALID_TEXT_SEARCH.search(text):
             self.on_text_search(text)
Пример #27
0
    def test_delete_item_no_item_id(self, mocked_critical_error_message_box):
        """
        Test the _delete_item() method when there is no item selected
        """
        # GIVEN: Some mocked items
        mocked_item_class = MagicMock()
        mocked_list_widget = MagicMock()
        mocked_reset_func = MagicMock()
        dialog_title = 'Delete Item'
        delete_text = 'Are you sure you want to delete this item?'
        error_text = 'There was a problem deleting this item'

        # WHEN: _delete_item() is called
        with patch.object(
                self.form,
                '_get_current_item_id') as mocked_get_current_item_id:
            mocked_get_current_item_id.return_value = -1
            self.form._delete_item(mocked_item_class, mocked_list_widget,
                                   mocked_reset_func, dialog_title,
                                   delete_text, error_text)

        # THEN: The right things should have been called
        mocked_get_current_item_id.assert_called_once_with(mocked_list_widget)
        mocked_critical_error_message_box.assert_called_once_with(
            dialog_title,
            UiStrings().NISs)
Пример #28
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()
Пример #29
0
 def retranslateUi(self):
     """
     Translate the UI on the fly
     """
     self.tab_title_visible = UiStrings().Projectors
     self.connect_box.setTitle(
         translate('OpenLP.ProjectorTab', 'Communication Options'))
     self.connect_on_startup.setText(
         translate('OpenLP.ProjectorTab',
                   'Connect to projectors on startup'))
     self.socket_timeout_label.setText(
         translate('OpenLP.ProjectorTab', 'Socket timeout (seconds)'))
     self.socket_poll_label.setText(
         translate('OpenLP.ProjectorTab', 'Poll time (seconds)'))
     self.dialog_type_label.setText(
         translate('Openlp.ProjectorTab', 'Source select dialog interface'))
     self.dialog_type_combo_box.setItemText(
         DialogSourceStyle.Tabbed,
         translate('OpenLP.ProjectorTab', 'Tabbed dialog box'))
     self.dialog_type_combo_box.setItemText(
         DialogSourceStyle.Single,
         translate('OpenLP.ProjectorTab', 'Single dialog box'))
     self.connect_on_linkup.setText(
         translate('OpenLP.ProjectorTab',
                   'Connect to projector when LINKUP received (v2 only)'))
Пример #30
0
 def retranslate_ui(self, print_service_dialog):
     """
     Translate the UI on the fly
     """
     print_service_dialog.setWindowTitle(UiStrings().PrintService)
     self.zoom_out_button.setToolTip(translate('OpenLP.PrintServiceForm', 'Zoom Out'))
     self.zoom_original_button.setToolTip(translate('OpenLP.PrintServiceForm', 'Zoom Original'))
     self.zoom_in_button.setToolTip(translate('OpenLP.PrintServiceForm', 'Zoom In'))
     self.options_button.setText(translate('OpenLP.PrintServiceForm', 'Options'))
     self.title_label.setText(translate('OpenLP.PrintServiceForm', 'Title:'))
     self.footer_label.setText(translate('OpenLP.PrintServiceForm', 'Service Note Text:'))
     self.options_group_box.setTitle(translate('OpenLP.PrintServiceForm', 'Other Options'))
     self.slide_text_check_box.setText(translate('OpenLP.PrintServiceForm', 'Include slide text if available'))
     self.page_break_after_text.setText(translate('OpenLP.PrintServiceForm', 'Add page break before each text item'))
     self.notes_check_box.setText(translate('OpenLP.PrintServiceForm', 'Include service item notes'))
     self.meta_data_check_box.setText(translate('OpenLP.PrintServiceForm', 'Include play length of media items'))
     self.show_chords_check_box.setText(translate('OpenLP.PrintServiceForm', 'Show chords'))
     self.title_line_edit.setText(translate('OpenLP.PrintServiceForm', 'Service Sheet'))
     # Do not change the order.
     self.zoom_combo_box.addItems([
         translate('OpenLP.PrintServiceDialog', 'Fit Page'),
         translate('OpenLP.PrintServiceDialog', 'Fit Width'),
         '100%',
         '75%',
         '50%',
         '25%'
     ])