This commit is contained in:
Tim Bentley 2014-04-14 19:28:28 +01:00
commit f04c47c9c9
51 changed files with 275 additions and 200 deletions

View File

@ -30,7 +30,6 @@
The :mod:`openlp` module contains all the project produced OpenLP functionality The :mod:`openlp` module contains all the project produced OpenLP functionality
""" """
import openlp.core from openlp import core, plugins
import openlp.plugins
__all__ = ['core', 'plugins'] __all__ = ['core', 'plugins']

View File

@ -76,6 +76,9 @@ def check_directory_exists(directory, do_not_log=False):
def get_frozen_path(frozen_option, non_frozen_option): def get_frozen_path(frozen_option, non_frozen_option):
""" """
Return a path based on the system status. Return a path based on the system status.
:param frozen_option:
:param non_frozen_option:
""" """
if hasattr(sys, 'frozen') and sys.frozen == 1: if hasattr(sys, 'frozen') and sys.frozen == 1:
return frozen_option return frozen_option

View File

@ -168,29 +168,29 @@ class MediaManagerItem(QtGui.QWidget, RegistryProperties):
Create buttons for the media item toolbar Create buttons for the media item toolbar
""" """
toolbar_actions = [] toolbar_actions = []
## Import Button ## # Import Button
if self.has_import_icon: if self.has_import_icon:
toolbar_actions.append(['Import', StringContent.Import, toolbar_actions.append(['Import', StringContent.Import,
':/general/general_import.png', self.on_import_click]) ':/general/general_import.png', self.on_import_click])
## Load Button ## # Load Button
if self.has_file_icon: if self.has_file_icon:
toolbar_actions.append(['Load', StringContent.Load, ':/general/general_open.png', self.on_file_click]) toolbar_actions.append(['Load', StringContent.Load, ':/general/general_open.png', self.on_file_click])
## New Button ## # New Button
if self.has_new_icon: if self.has_new_icon:
toolbar_actions.append(['New', StringContent.New, ':/general/general_new.png', self.on_new_click]) toolbar_actions.append(['New', StringContent.New, ':/general/general_new.png', self.on_new_click])
## Edit Button ## # Edit Button
if self.has_edit_icon: if self.has_edit_icon:
toolbar_actions.append(['Edit', StringContent.Edit, ':/general/general_edit.png', self.on_edit_click]) toolbar_actions.append(['Edit', StringContent.Edit, ':/general/general_edit.png', self.on_edit_click])
## Delete Button ## # Delete Button
if self.has_delete_icon: if self.has_delete_icon:
toolbar_actions.append(['Delete', StringContent.Delete, toolbar_actions.append(['Delete', StringContent.Delete,
':/general/general_delete.png', self.on_delete_click]) ':/general/general_delete.png', self.on_delete_click])
## Preview ## # Preview
toolbar_actions.append(['Preview', StringContent.Preview, toolbar_actions.append(['Preview', StringContent.Preview,
':/general/general_preview.png', self.on_preview_click]) ':/general/general_preview.png', self.on_preview_click])
## Live Button ## # Live Button
toolbar_actions.append(['Live', StringContent.Live, ':/general/general_live.png', self.on_live_click]) toolbar_actions.append(['Live', StringContent.Live, ':/general/general_live.png', self.on_live_click])
## Add to service Button ## # Add to service Button
toolbar_actions.append(['Service', StringContent.Service, ':/general/general_add.png', self.on_add_click]) toolbar_actions.append(['Service', StringContent.Service, ':/general/general_add.png', self.on_add_click])
for action in toolbar_actions: for action in toolbar_actions:
if action[0] == StringContent.Preview: if action[0] == StringContent.Preview:

View File

@ -101,7 +101,7 @@ class Plugin(QtCore.QObject, RegistryProperties):
``add_import_menu_item(import_menu)`` ``add_import_menu_item(import_menu)``
Add an item to the Import menu. Add an item to the Import menu.
``add_export_menu_Item(export_menu)`` ``add_export_menu_item(export_menu)``
Add an item to the Export menu. Add an item to the Export menu.
``create_settings_tab()`` ``create_settings_tab()``
@ -226,7 +226,7 @@ class Plugin(QtCore.QObject, RegistryProperties):
""" """
pass pass
def add_export_menu_Item(self, export_menu): def add_export_menu_item(self, export_menu):
""" """
Create a menu item and add it to the "Export" menu. Create a menu item and add it to the "Export" menu.
@ -329,22 +329,24 @@ class Plugin(QtCore.QObject, RegistryProperties):
def set_plugin_ui_text_strings(self, tooltips): def set_plugin_ui_text_strings(self, tooltips):
""" """
Called to define all translatable texts of the plugin Called to define all translatable texts of the plugin
:param tooltips:
""" """
## Load Action ## # Load Action
self.__set_name_text_string(StringContent.Load, UiStrings().Load, tooltips['load']) self.__set_name_text_string(StringContent.Load, UiStrings().Load, tooltips['load'])
## Import Action ## # Import Action
self.__set_name_text_string(StringContent.Import, UiStrings().Import, tooltips['import']) self.__set_name_text_string(StringContent.Import, UiStrings().Import, tooltips['import'])
## New Action ## # New Action
self.__set_name_text_string(StringContent.New, UiStrings().Add, tooltips['new']) self.__set_name_text_string(StringContent.New, UiStrings().Add, tooltips['new'])
## Edit Action ## # Edit Action
self.__set_name_text_string(StringContent.Edit, UiStrings().Edit, tooltips['edit']) self.__set_name_text_string(StringContent.Edit, UiStrings().Edit, tooltips['edit'])
## Delete Action ## # Delete Action
self.__set_name_text_string(StringContent.Delete, UiStrings().Delete, tooltips['delete']) self.__set_name_text_string(StringContent.Delete, UiStrings().Delete, tooltips['delete'])
## Preview Action ## # Preview Action
self.__set_name_text_string(StringContent.Preview, UiStrings().Preview, tooltips['preview']) self.__set_name_text_string(StringContent.Preview, UiStrings().Preview, tooltips['preview'])
## Send Live Action ## # Send Live Action
self.__set_name_text_string(StringContent.Live, UiStrings().Live, tooltips['live']) self.__set_name_text_string(StringContent.Live, UiStrings().Live, tooltips['live'])
## Add to Service Action ## # Add to Service Action
self.__set_name_text_string(StringContent.Service, UiStrings().Service, tooltips['service']) self.__set_name_text_string(StringContent.Service, UiStrings().Service, tooltips['service'])
def __set_name_text_string(self, name, title, tooltip): def __set_name_text_string(self, name, title, tooltip):

View File

@ -161,7 +161,7 @@ class PluginManager(RegistryMixin, OpenLPMixin, RegistryProperties):
""" """
for plugin in self.plugins: for plugin in self.plugins:
if plugin.status is not PluginStatus.Disabled: if plugin.status is not PluginStatus.Disabled:
plugin.add_export_menu_Item(self.main_window.file_export_menu) plugin.add_export_menu_item(self.main_window.file_export_menu)
def hook_tools_menu(self): def hook_tools_menu(self):
""" """

View File

@ -387,7 +387,7 @@ class ServiceItem(RegistryProperties):
self.will_auto_start = header.get('will_auto_start', False) self.will_auto_start = header.get('will_auto_start', False)
self.processor = header.get('processor', None) self.processor = header.get('processor', None)
self.has_original_files = True self.has_original_files = True
#TODO Remove me in 2,3 build phase # TODO: Remove me in 2,3 build phase
if self.is_capable(ItemCapabilities.HasDetailedTitleDisplay): if self.is_capable(ItemCapabilities.HasDetailedTitleDisplay):
self.capabilities.remove(ItemCapabilities.HasDetailedTitleDisplay) self.capabilities.remove(ItemCapabilities.HasDetailedTitleDisplay)
self.processor = self.title self.processor = self.title

View File

@ -95,12 +95,12 @@ class Ui_ExceptionDialog(object):
Translate the widgets on the fly. Translate the widgets on the fly.
""" """
exception_dialog.setWindowTitle(translate('OpenLP.ExceptionDialog', 'Error Occurred')) exception_dialog.setWindowTitle(translate('OpenLP.ExceptionDialog', 'Error Occurred'))
self.description_explanation.setText(translate('OpenLP.ExceptionDialog', self.description_explanation.setText(
'Please enter a description of what you were doing to cause this error ' translate('OpenLP.ExceptionDialog', 'Please enter a description of what you were doing to cause this error '
'\n(Minimum 20 characters)')) '\n(Minimum 20 characters)'))
self.message_label.setText(translate('OpenLP.ExceptionDialog', 'Oops! ' self.message_label.setText(
'OpenLP hit a problem, and couldn\'t recover. The text in the box ' translate('OpenLP.ExceptionDialog', 'Oops! OpenLP hit a problem, and couldn\'t recover. The text in the '
'below contains information that might be helpful to the OpenLP ' 'box below contains information that might be helpful to the OpenLP '
'developers, so please e-mail it to bugs@openlp.org, along with a ' 'developers, so please e-mail it to bugs@openlp.org, along with a '
'detailed description of what you were doing when the problem ' 'detailed description of what you were doing when the problem '
'occurred.')) 'occurred.'))

View File

@ -211,8 +211,8 @@ class Ui_FirstTimeWizard(object):
first_time_wizard.setWindowTitle(translate('OpenLP.FirstTimeWizard', 'First Time Wizard')) first_time_wizard.setWindowTitle(translate('OpenLP.FirstTimeWizard', 'First Time Wizard'))
self.title_label.setText('<span style="font-size:14pt; font-weight:600;">%s</span>' % self.title_label.setText('<span style="font-size:14pt; font-weight:600;">%s</span>' %
translate('OpenLP.FirstTimeWizard', 'Welcome to the First Time Wizard')) translate('OpenLP.FirstTimeWizard', 'Welcome to the First Time Wizard'))
self.information_label.setText(translate('OpenLP.FirstTimeWizard', self.information_label.setText(
'This wizard will help you to configure OpenLP for initial use. ' translate('OpenLP.FirstTimeWizard', 'This wizard will help you to configure OpenLP for initial use. '
'Click the next button below to start.')) 'Click the next button below to start.'))
self.plugin_page.setTitle(translate('OpenLP.FirstTimeWizard', 'Activate required Plugins')) self.plugin_page.setTitle(translate('OpenLP.FirstTimeWizard', 'Activate required Plugins'))
self.plugin_page.setSubTitle(translate('OpenLP.FirstTimeWizard', 'Select the Plugins you wish to use. ')) self.plugin_page.setSubTitle(translate('OpenLP.FirstTimeWizard', 'Select the Plugins you wish to use. '))

View File

@ -63,7 +63,6 @@ class FormattingTagForm(QtGui.QDialog, Ui_FormattingTagDialog, FormattingTagCont
self.services = FormattingTagController() self.services = FormattingTagController()
self.tag_table_widget.itemSelectionChanged.connect(self.on_row_selected) self.tag_table_widget.itemSelectionChanged.connect(self.on_row_selected)
self.new_button.clicked.connect(self.on_new_clicked) self.new_button.clicked.connect(self.on_new_clicked)
#self.save_button.clicked.connect(self.on_saved_clicked)
self.delete_button.clicked.connect(self.on_delete_clicked) self.delete_button.clicked.connect(self.on_delete_clicked)
self.tag_table_widget.currentCellChanged.connect(self.on_current_cell_changed) self.tag_table_widget.currentCellChanged.connect(self.on_current_cell_changed)
self.button_box.rejected.connect(self.close) self.button_box.rejected.connect(self.close)
@ -202,5 +201,4 @@ class FormattingTagForm(QtGui.QDialog, Ui_FormattingTagDialog, FormattingTagCont
if errors: if errors:
QtGui.QMessageBox.warning(self, translate('OpenLP.FormattingTagForm', 'Validation Error'), errors, QtGui.QMessageBox.warning(self, translate('OpenLP.FormattingTagForm', 'Validation Error'), errors,
QtGui.QMessageBox.Ok) QtGui.QMessageBox.Ok)
#self.tag_table_widget.selectRow(pre_row - 1)
self.tag_table_widget.resizeRowsToContents() self.tag_table_widget.resizeRowsToContents()

View File

@ -61,16 +61,14 @@ MEDIA_MANAGER_STYLE = """
} }
QToolBox::tab { QToolBox::tab {
background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
stop: 0 palette(button), stop: 0.5 palette(button), stop: 0 palette(button), stop: 1.0 palette(mid));
stop: 1.0 palette(mid)); border: 1px solid palette(mid);
border: 1px groove palette(mid); border-radius: 3px;
border-radius: 5px;
} }
QToolBox::tab:selected { QToolBox::tab:selected {
background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
stop: 0 palette(light), stop: 0.5 palette(midlight), stop: 0 palette(light), stop: 1.0 palette(button));
stop: 1.0 palette(dark)); border: 1px solid palette(mid);
border: 1px groove palette(dark);
font-weight: bold; font-weight: bold;
} }
""" """
@ -369,7 +367,7 @@ class Ui_MainWindow(object):
self.settings_menu.setTitle(translate('OpenLP.MainWindow', '&Settings')) self.settings_menu.setTitle(translate('OpenLP.MainWindow', '&Settings'))
self.settings_language_menu.setTitle(translate('OpenLP.MainWindow', '&Language')) self.settings_language_menu.setTitle(translate('OpenLP.MainWindow', '&Language'))
self.help_menu.setTitle(translate('OpenLP.MainWindow', '&Help')) self.help_menu.setTitle(translate('OpenLP.MainWindow', '&Help'))
self.media_manager_dock.setWindowTitle(translate('OpenLP.MainWindow', 'Media Manager')) self.media_manager_dock.setWindowTitle(translate('OpenLP.MainWindow', 'Library'))
self.service_manager_dock.setWindowTitle(translate('OpenLP.MainWindow', 'Service Manager')) self.service_manager_dock.setWindowTitle(translate('OpenLP.MainWindow', 'Service Manager'))
self.theme_manager_dock.setWindowTitle(translate('OpenLP.MainWindow', 'Theme Manager')) self.theme_manager_dock.setWindowTitle(translate('OpenLP.MainWindow', 'Theme Manager'))
self.file_new_item.setText(translate('OpenLP.MainWindow', '&New')) self.file_new_item.setText(translate('OpenLP.MainWindow', '&New'))
@ -396,11 +394,11 @@ class Ui_MainWindow(object):
self.settings_shortcuts_item.setText(translate('OpenLP.MainWindow', 'Configure &Shortcuts...')) self.settings_shortcuts_item.setText(translate('OpenLP.MainWindow', 'Configure &Shortcuts...'))
self.formatting_tag_item.setText(translate('OpenLP.MainWindow', 'Configure &Formatting Tags...')) self.formatting_tag_item.setText(translate('OpenLP.MainWindow', 'Configure &Formatting Tags...'))
self.settings_configure_item.setText(translate('OpenLP.MainWindow', '&Configure OpenLP...')) self.settings_configure_item.setText(translate('OpenLP.MainWindow', '&Configure OpenLP...'))
self.settings_export_item.setStatusTip(translate('OpenLP.MainWindow', self.settings_export_item.setStatusTip(
'Export OpenLP settings to a specified *.config file')) translate('OpenLP.MainWindow', 'Export OpenLP settings to a specified *.config file'))
self.settings_export_item.setText(translate('OpenLP.MainWindow', 'Settings')) self.settings_export_item.setText(translate('OpenLP.MainWindow', 'Settings'))
self.settings_import_item.setStatusTip(translate('OpenLP.MainWindow', self.settings_import_item.setStatusTip(
'Import OpenLP settings from a specified *.config file previously ' translate('OpenLP.MainWindow', 'Import OpenLP settings from a specified *.config file previously '
'exported on this or another machine')) 'exported on this or another machine'))
self.settings_import_item.setText(translate('OpenLP.MainWindow', 'Settings')) self.settings_import_item.setText(translate('OpenLP.MainWindow', 'Settings'))
self.view_media_manager_item.setText(translate('OpenLP.MainWindow', '&Media Manager')) self.view_media_manager_item.setText(translate('OpenLP.MainWindow', '&Media Manager'))
@ -862,7 +860,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow, RegistryProperties):
section = 'general' section = 'general'
section_key = section + "/" + key section_key = section + "/" + key
# Make sure it's a valid section for us. # Make sure it's a valid section for us.
if not section in setting_sections: if section not in setting_sections:
continue continue
# We have a good file, import it. # We have a good file, import it.
for section_key in import_keys: for section_key in import_keys:

View File

@ -137,7 +137,7 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
for player in list(self.media_players.values()): for player in list(self.media_players.values()):
if player.is_active: if player.is_active:
for item in player.audio_extensions_list: for item in player.audio_extensions_list:
if not item in self.audio_extensions_list: if item not in self.audio_extensions_list:
self.audio_extensions_list.append(item) self.audio_extensions_list.append(item)
suffix_list.append(item[2:]) suffix_list.append(item[2:])
self.video_extensions_list = [] self.video_extensions_list = []
@ -184,8 +184,8 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
return False return False
saved_players, overridden_player = get_media_players() saved_players, overridden_player = get_media_players()
invalid_media_players = \ invalid_media_players = \
[mediaPlayer for mediaPlayer in saved_players if not mediaPlayer in self.media_players or [media_player for media_player in saved_players if media_player not in self.media_players or
not self.media_players[mediaPlayer].check_available()] not self.media_players[media_player].check_available()]
if invalid_media_players: if invalid_media_players:
for invalidPlayer in invalid_media_players: for invalidPlayer in invalid_media_players:
saved_players.remove(invalidPlayer) saved_players.remove(invalidPlayer)

View File

@ -174,34 +174,11 @@ FLASH_HTML = """
<div id="flash" class="size" style="visibility:hidden"></div> <div id="flash" class="size" style="visibility:hidden"></div>
""" """
VIDEO_EXT = [ VIDEO_EXT = ['*.3gp', '*.3gpp', '*.3g2', '*.3gpp2', '*.aac', '*.flv', '*.f4a', '*.f4b', '*.f4p', '*.f4v', '*.mov',
'*.3gp', '*.m4a', '*.m4b', '*.m4p', '*.m4v', '*.mkv', '*.mp4', '*.ogv', '*.webm', '*.mpg', '*.wmv', '*.mpeg',
'*.3gpp', '*.avi', '*.swf']
'*.3g2',
'*.3gpp2',
'*.aac',
'*.flv',
'*.f4a',
'*.f4b',
'*.f4p',
'*.f4v',
'*.mov',
'*.m4a',
'*.m4b',
'*.m4p',
'*.m4v',
'*.mkv',
'*.mp4',
'*.ogv',
'*.webm',
'*.mpg', '*.wmv', '*.mpeg', '*.avi',
'*.swf'
]
AUDIO_EXT = [ AUDIO_EXT = ['*.mp3', '*.ogg']
'*.mp3',
'*.ogg'
]
class WebkitPlayer(MediaPlayer): class WebkitPlayer(MediaPlayer):
@ -411,10 +388,9 @@ class WebkitPlayer(MediaPlayer):
""" """
Return some information about this player Return some information about this player
""" """
return(translate('Media.player', 'Webkit is a media player which runs ' part1 = translate('Media.player', 'Webkit is a media player which runs inside a web browser. This player '
'inside a web browser. This player allows text over video to be ' 'allows text over video to be rendered.')
'rendered.') + part2 = translate('Media.player', 'Audio')
'<br/> <strong>' + translate('Media.player', 'Audio') + part3 = translate('Media.player', 'Video')
'</strong><br/>' + str(AUDIO_EXT) + '<br/><strong>' + return part1 + '<br/> <strong>' + part2 + '</strong><br/>' + str(AUDIO_EXT) + '<br/><strong>' + part3 + \
translate('Media.player', 'Video') + '</strong><br/>' + '</strong><br/>' + str(VIDEO_EXT) + '<br/>'
str(VIDEO_EXT) + '<br/>')

View File

@ -401,7 +401,7 @@ class ServiceManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ServiceManage
:param suffix_list: New Suffix's to be supported :param suffix_list: New Suffix's to be supported
""" """
for suffix in suffix_list: for suffix in suffix_list:
if not suffix in self.suffixes: if suffix not in self.suffixes:
self.suffixes.append(suffix) self.suffixes.append(suffix)
def on_new_service_clicked(self, field=None): def on_new_service_clicked(self, field=None):
@ -756,8 +756,9 @@ class ServiceManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ServiceManage
items = json.load(file_to) items = json.load(file_to)
else: else:
critical_error_message_box(message=translate('OpenLP.ServiceManager', critical_error_message_box(message=translate('OpenLP.ServiceManager',
'The service file you are trying to open is in an old format.\n ' 'The service file you are trying to open is in an old '
'Please save it using OpenLP 2.0.2 or greater.')) 'format.\n Please save it using OpenLP 2.0.2 or '
'greater.'))
return return
file_to.close() file_to.close()
self.new_file() self.new_file()

View File

@ -150,5 +150,5 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog, RegistryProperties):
:param function: The function to be called :param function: The function to be called
""" """
if not function in self.processes: if function not in self.processes:
self.processes.append(function) self.processes.append(function)

View File

@ -44,7 +44,6 @@ class Ui_ThemeLayoutDialog(object):
Set up the UI Set up the UI
""" """
themeLayoutDialog.setObjectName('themeLayoutDialogDialog') themeLayoutDialog.setObjectName('themeLayoutDialogDialog')
#themeLayoutDialog.resize(300, 200)
self.preview_layout = QtGui.QVBoxLayout(themeLayoutDialog) self.preview_layout = QtGui.QVBoxLayout(themeLayoutDialog)
self.preview_layout.setObjectName('preview_layout') self.preview_layout.setObjectName('preview_layout')
self.preview_area = QtGui.QWidget(themeLayoutDialog) self.preview_area = QtGui.QWidget(themeLayoutDialog)

View File

@ -114,17 +114,19 @@ class ThemesTab(SettingsTab):
self.global_group_box.setTitle(translate('OpenLP.ThemesTab', 'Global Theme')) self.global_group_box.setTitle(translate('OpenLP.ThemesTab', 'Global Theme'))
self.level_group_box.setTitle(translate('OpenLP.ThemesTab', 'Theme Level')) self.level_group_box.setTitle(translate('OpenLP.ThemesTab', 'Theme Level'))
self.song_level_radio_button.setText(translate('OpenLP.ThemesTab', 'S&ong Level')) self.song_level_radio_button.setText(translate('OpenLP.ThemesTab', 'S&ong Level'))
self.song_level_label.setText(translate('OpenLP.ThemesTab', 'Use the theme from each song ' self.song_level_label.setText(
'in the database. If a song doesn\'t have a theme associated with ' translate('OpenLP.ThemesTab', 'Use the theme from each song in the database. If a song doesn\'t have a '
'it, then use the service\'s theme. If the service doesn\'t have ' 'theme associated with it, then use the service\'s theme. If the service '
'a theme, then use the global theme.')) 'doesn\'t have a theme, then use the global theme.'))
self.service_level_radio_button.setText(translate('OpenLP.ThemesTab', '&Service Level')) self.service_level_radio_button.setText(translate('OpenLP.ThemesTab', '&Service Level'))
self.service_level_label.setText(translate('OpenLP.ThemesTab', 'Use the theme from the service, ' self.service_level_label.setText(
'overriding any of the individual songs\' themes. If the ' translate('OpenLP.ThemesTab', 'Use the theme from the service, overriding any of the individual '
'service doesn\'t have a theme, then use the global theme.')) 'songs\' themes. If the service doesn\'t have a theme, then use the global '
'theme.'))
self.global_level_radio_button.setText(translate('OpenLP.ThemesTab', '&Global Level')) self.global_level_radio_button.setText(translate('OpenLP.ThemesTab', '&Global Level'))
self.global_level_label.setText(translate('OpenLP.ThemesTab', 'Use the global theme, overriding ' self.global_level_label.setText(translate('OpenLP.ThemesTab', 'Use the global theme, overriding any themes '
'any themes associated with either the service or the songs.')) 'associated with either the service or the '
'songs.'))
def load(self): def load(self):
""" """

View File

@ -207,12 +207,12 @@ class AlertsPlugin(Plugin):
""" """
Called to define all translatable texts of the plugin Called to define all translatable texts of the plugin
""" """
## Name PluginList ## # Name PluginList
self.text_strings[StringContent.Name] = { self.text_strings[StringContent.Name] = {
'singular': translate('AlertsPlugin', 'Alert', 'name singular'), 'singular': translate('AlertsPlugin', 'Alert', 'name singular'),
'plural': translate('AlertsPlugin', 'Alerts', 'name plural') 'plural': translate('AlertsPlugin', 'Alerts', 'name plural')
} }
## Name for MediaDockManager, SettingsManager ## # Name for MediaDockManager, SettingsManager
self.text_strings[StringContent.VisibleName] = { self.text_strings[StringContent.VisibleName] = {
'title': translate('AlertsPlugin', 'Alerts', 'container title') 'title': translate('AlertsPlugin', 'Alerts', 'container title')
} }

View File

@ -88,8 +88,6 @@ class BiblePlugin(Plugin):
self.import_bible_item.setVisible(True) self.import_bible_item.setVisible(True)
action_list = ActionList.get_instance() action_list = ActionList.get_instance()
action_list.add_action(self.import_bible_item, UiStrings().Import) action_list.add_action(self.import_bible_item, UiStrings().Import)
# Do not add the action to the list yet.
#action_list.add_action(self.export_bible_item, UiStrings().Export)
# Set to invisible until we can export bibles # Set to invisible until we can export bibles
self.export_bible_item.setVisible(False) self.export_bible_item.setVisible(False)
self.tools_upgrade_item.setVisible(bool(self.manager.old_bible_databases)) self.tools_upgrade_item.setVisible(bool(self.manager.old_bible_databases))
@ -104,7 +102,6 @@ class BiblePlugin(Plugin):
action_list = ActionList.get_instance() action_list = ActionList.get_instance()
action_list.remove_action(self.import_bible_item, UiStrings().Import) action_list.remove_action(self.import_bible_item, UiStrings().Import)
self.import_bible_item.setVisible(False) self.import_bible_item.setVisible(False)
#action_list.remove_action(self.export_bible_item, UiStrings().Export)
self.export_bible_item.setVisible(False) self.export_bible_item.setVisible(False)
def app_startup(self): def app_startup(self):
@ -115,19 +112,27 @@ class BiblePlugin(Plugin):
if self.manager.old_bible_databases: if self.manager.old_bible_databases:
if QtGui.QMessageBox.information( if QtGui.QMessageBox.information(
self.main_window, translate('OpenLP', 'Information'), self.main_window, translate('OpenLP', 'Information'),
translate('OpenLP', 'Bible format has changed.\nYou have to upgrade your existing Bibles.\n' translate('OpenLP', 'Bible format has changed.\nYou have to upgrade your '
'Should OpenLP upgrade now?'), 'existing Bibles.\nShould OpenLP upgrade now?'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)) == \ QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)) == \
QtGui.QMessageBox.Yes: QtGui.QMessageBox.Yes:
self.on_tools_upgrade_Item_triggered() self.on_tools_upgrade_Item_triggered()
def add_import_menu_item(self, import_menu): def add_import_menu_item(self, import_menu):
"""
:param import_menu:
"""
self.import_bible_item = create_action(import_menu, 'importBibleItem', self.import_bible_item = create_action(import_menu, 'importBibleItem',
text=translate('BiblesPlugin', '&Bible'), visible=False, text=translate('BiblesPlugin', '&Bible'), visible=False,
triggers=self.on_bible_import_click) triggers=self.on_bible_import_click)
import_menu.addAction(self.import_bible_item) import_menu.addAction(self.import_bible_item)
def add_export_menu_Item(self, export_menu): def add_export_menu_item(self, export_menu):
"""
:param export_menu:
"""
self.export_bible_item = create_action(export_menu, 'exportBibleItem', self.export_bible_item = create_action(export_menu, 'exportBibleItem',
text=translate('BiblesPlugin', '&Bible'), visible=False) text=translate('BiblesPlugin', '&Bible'), visible=False)
export_menu.addAction(self.export_bible_item) export_menu.addAction(self.export_bible_item)
@ -190,12 +195,12 @@ class BiblePlugin(Plugin):
""" """
Called to define all translatable texts of the plugin Called to define all translatable texts of the plugin
""" """
## Name PluginList ## # Name PluginList
self.text_strings[StringContent.Name] = { self.text_strings[StringContent.Name] = {
'singular': translate('BiblesPlugin', 'Bible', 'name singular'), 'singular': translate('BiblesPlugin', 'Bible', 'name singular'),
'plural': translate('BiblesPlugin', 'Bibles', 'name plural') 'plural': translate('BiblesPlugin', 'Bibles', 'name plural')
} }
## Name for MediaDockManager, SettingsManager ## # Name for MediaDockManager, SettingsManager
self.text_strings[StringContent.VisibleName] = { self.text_strings[StringContent.VisibleName] = {
'title': translate('BiblesPlugin', 'Bibles', 'container title') 'title': translate('BiblesPlugin', 'Bibles', 'container title')
} }

View File

@ -552,10 +552,10 @@ class HTTPBible(BibleDB, RegistryProperties):
self.application.set_busy_cursor() self.application.set_busy_cursor()
search_results = self.get_chapter(book, reference[1]) search_results = self.get_chapter(book, reference[1])
if search_results and search_results.has_verse_list(): if search_results and search_results.has_verse_list():
## We have found a book of the bible lets check to see # We have found a book of the bible lets check to see
## if it was there. By reusing the returned book name # if it was there. By reusing the returned book name
## we get a correct book. For example it is possible # we get a correct book. For example it is possible
## to request ac and get Acts back. # to request ac and get Acts back.
book_name = search_results.book book_name = search_results.book
self.application.process_events() self.application.process_events()
# Check to see if book/chapter exists. # Check to see if book/chapter exists.

View File

@ -480,6 +480,10 @@ class BibleMediaItem(MediaManagerItem):
self.reload_bibles() self.reload_bibles()
def on_delete_click(self): def on_delete_click(self):
"""
When the delete button is pressed
"""
bible = None
if self.quickTab.isVisible(): if self.quickTab.isVisible():
bible = self.quickVersionComboBox.currentText() bible = self.quickVersionComboBox.currentText()
elif self.advancedTab.isVisible(): elif self.advancedTab.isVisible():
@ -488,7 +492,8 @@ class BibleMediaItem(MediaManagerItem):
if QtGui.QMessageBox.question( if QtGui.QMessageBox.question(
self, UiStrings().ConfirmDelete, self, UiStrings().ConfirmDelete,
translate('BiblesPlugin.MediaItem', 'Are you sure you want to completely delete "%s" Bible from ' translate('BiblesPlugin.MediaItem', 'Are you sure you want to completely delete "%s" Bible from '
'OpenLP?\n\nYou will need to re-import this Bible to use it again.') % bible, 'OpenLP?\n\nYou will need to re-import this Bible to use it '
'again.') % bible,
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No), QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No),
QtGui.QMessageBox.Yes) == QtGui.QMessageBox.No: QtGui.QMessageBox.Yes) == QtGui.QMessageBox.No:
return return

View File

@ -97,12 +97,12 @@ class CustomPlugin(Plugin):
""" """
Called to define all translatable texts of the plugin Called to define all translatable texts of the plugin
""" """
## Name PluginList ## # Name PluginList
self.text_strings[StringContent.Name] = { self.text_strings[StringContent.Name] = {
'singular': translate('CustomPlugin', 'Custom Slide', 'name singular'), 'singular': translate('CustomPlugin', 'Custom Slide', 'name singular'),
'plural': translate('CustomPlugin', 'Custom Slides', 'name plural') 'plural': translate('CustomPlugin', 'Custom Slides', 'name plural')
} }
## Name for MediaDockManager, SettingsManager ## # Name for MediaDockManager, SettingsManager
self.text_strings[StringContent.VisibleName] = { self.text_strings[StringContent.VisibleName] = {
'title': translate('CustomPlugin', 'Custom Slides', 'container title') 'title': translate('CustomPlugin', 'Custom Slides', 'container title')
} }

View File

@ -1,4 +1,3 @@
#lint:disable
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4 # vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4

View File

@ -95,12 +95,12 @@ class ImagePlugin(Plugin):
""" """
Called to define all translatable texts of the plugin. Called to define all translatable texts of the plugin.
""" """
## Name PluginList ## # Name PluginList
self.text_strings[StringContent.Name] = { self.text_strings[StringContent.Name] = {
'singular': translate('ImagePlugin', 'Image', 'name singular'), 'singular': translate('ImagePlugin', 'Image', 'name singular'),
'plural': translate('ImagePlugin', 'Images', 'name plural') 'plural': translate('ImagePlugin', 'Images', 'name plural')
} }
## Name for MediaDockManager, SettingsManager ## # Name for MediaDockManager, SettingsManager
self.text_strings[StringContent.VisibleName] = {'title': translate('ImagePlugin', 'Images', 'container title')} self.text_strings[StringContent.VisibleName] = {'title': translate('ImagePlugin', 'Images', 'container title')}
# Middle Header Bar # Middle Header Bar
tooltips = { tooltips = {

View File

@ -95,7 +95,6 @@ class MediaMediaItem(MediaManagerItem, RegistryProperties):
self.reset_action.setToolTip(UiStrings().ResetLiveBG) self.reset_action.setToolTip(UiStrings().ResetLiveBG)
self.automatic = UiStrings().Automatic self.automatic = UiStrings().Automatic
self.display_type_label.setText(translate('MediaPlugin.MediaItem', 'Use Player:')) self.display_type_label.setText(translate('MediaPlugin.MediaItem', 'Use Player:'))
#self.rebuild_players()
def required_icons(self): def required_icons(self):
""" """

View File

@ -73,12 +73,12 @@ class MediaPlugin(Plugin):
""" """
Called to define all translatable texts of the plugin Called to define all translatable texts of the plugin
""" """
## Name PluginList ## # Name PluginList
self.text_strings[StringContent.Name] = { self.text_strings[StringContent.Name] = {
'singular': translate('MediaPlugin', 'Media', 'name singular'), 'singular': translate('MediaPlugin', 'Media', 'name singular'),
'plural': translate('MediaPlugin', 'Media', 'name plural') 'plural': translate('MediaPlugin', 'Media', 'name plural')
} }
## Name for MediaDockManager, SettingsManager ## # Name for MediaDockManager, SettingsManager
self.text_strings[StringContent.VisibleName] = { self.text_strings[StringContent.VisibleName] = {
'title': translate('MediaPlugin', 'Media', 'container title') 'title': translate('MediaPlugin', 'Media', 'container title')
} }

View File

@ -377,8 +377,6 @@ class ImpressDocument(PresentationDocument):
Stop the presentation, remove from screen. Stop the presentation, remove from screen.
""" """
log.debug('stop presentation OpenOffice') log.debug('stop presentation OpenOffice')
# deactivate should hide the screen according to docs, but doesn't
#self.control.deactivate()
self.presentation.end() self.presentation.end()
self.control = None self.control = None

View File

@ -156,12 +156,12 @@ class PresentationPlugin(Plugin):
""" """
Called to define all translatable texts of the plugin. Called to define all translatable texts of the plugin.
""" """
## Name PluginList ## # Name PluginList
self.text_strings[StringContent.Name] = { self.text_strings[StringContent.Name] = {
'singular': translate('PresentationPlugin', 'Presentation', 'name singular'), 'singular': translate('PresentationPlugin', 'Presentation', 'name singular'),
'plural': translate('PresentationPlugin', 'Presentations', 'name plural') 'plural': translate('PresentationPlugin', 'Presentations', 'name plural')
} }
## Name for MediaDockManager, SettingsManager ## # Name for MediaDockManager, SettingsManager
self.text_strings[StringContent.VisibleName] = { self.text_strings[StringContent.VisibleName] = {
'title': translate('PresentationPlugin', 'Presentations', 'container title') 'title': translate('PresentationPlugin', 'Presentations', 'container title')
} }

View File

@ -101,12 +101,12 @@ class RemotesPlugin(Plugin):
""" """
Called to define all translatable texts of the plugin Called to define all translatable texts of the plugin
""" """
## Name PluginList ## # Name PluginList
self.text_strings[StringContent.Name] = { self.text_strings[StringContent.Name] = {
'singular': translate('RemotePlugin', 'Remote', 'name singular'), 'singular': translate('RemotePlugin', 'Remote', 'name singular'),
'plural': translate('RemotePlugin', 'Remotes', 'name plural') 'plural': translate('RemotePlugin', 'Remotes', 'name plural')
} }
## Name for MediaDockManager, SettingsManager ## # Name for MediaDockManager, SettingsManager
self.text_strings[StringContent.VisibleName] = { self.text_strings[StringContent.VisibleName] = {
'title': translate('RemotePlugin', 'Remote', 'container title') 'title': translate('RemotePlugin', 'Remote', 'container title')
} }

View File

@ -217,12 +217,12 @@ class DuplicateSongRemovalForm(OpenLPWizard, RegistryProperties):
duplicate_added = False duplicate_added = False
for duplicate_group in self.duplicate_song_list: for duplicate_group in self.duplicate_song_list:
# Skip the first song in the duplicate lists, since the first one has to be an earlier song. # Skip the first song in the duplicate lists, since the first one has to be an earlier song.
if search_song in duplicate_group and not duplicate_song in duplicate_group: if search_song in duplicate_group and duplicate_song not in duplicate_group:
duplicate_group.append(duplicate_song) duplicate_group.append(duplicate_song)
duplicate_group_found = True duplicate_group_found = True
duplicate_added = True duplicate_added = True
break break
elif not search_song in duplicate_group and duplicate_song in duplicate_group: elif search_song not in duplicate_group and duplicate_song in duplicate_group:
duplicate_group.append(search_song) duplicate_group.append(search_song)
duplicate_group_found = True duplicate_group_found = True
duplicate_added = True duplicate_added = True

View File

@ -682,7 +682,6 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog, RegistryProperties):
verse_index = VerseType.from_loose_input(verse_name) verse_index = VerseType.from_loose_input(verse_name)
verse_tag = VerseType.tags[verse_index] verse_tag = VerseType.tags[verse_index]
# Later we need to handle v1a as well. # Later we need to handle v1a as well.
#regex = re.compile(r'(\d+\w.)')
regex = re.compile(r'\D*(\d+)\D*') regex = re.compile(r'\D*(\d+)\D*')
match = regex.match(verse_num) match = regex.match(verse_num)
if match: if match:

View File

@ -66,8 +66,10 @@ class Ui_MediaFilesDialog(object):
def retranslateUi(self, media_files_dialog): def retranslateUi(self, media_files_dialog):
""" """
Translate the UI on the fly. Translate the UI on the fly.
:param media_files_dialog:
""" """
media_files_dialog.setWindowTitle(translate('SongsPlugin.MediaFilesForm', 'Select Media File(s)')) media_files_dialog.setWindowTitle(translate('SongsPlugin.MediaFilesForm', 'Select Media File(s)'))
self.select_label.setText(translate('SongsPlugin.MediaFilesForm', self.select_label.setText(translate('SongsPlugin.MediaFilesForm', 'Select one or more audio files from the '
'Select one or more audio files from the list below, and click OK to import them ' 'list below, and click OK to import them '
'into this song.')) 'into this song.'))

View File

@ -152,9 +152,9 @@ class SongExportForm(OpenLPWizard):
self.setWindowTitle(translate('SongsPlugin.ExportWizardForm', 'Song Export Wizard')) self.setWindowTitle(translate('SongsPlugin.ExportWizardForm', 'Song Export Wizard'))
self.title_label.setText(WizardStrings.HeaderStyle % self.title_label.setText(WizardStrings.HeaderStyle %
translate('OpenLP.Ui', 'Welcome to the Song Export Wizard')) translate('OpenLP.Ui', 'Welcome to the Song Export Wizard'))
self.information_label.setText(translate('SongsPlugin.ExportWizardForm', 'This wizard will help to' self.information_label.setText(
' export your songs to the open and free <strong>OpenLyrics </strong> worship ' translate('SongsPlugin.ExportWizardForm', 'This wizard will help to export your songs to the open and free '
'song format.')) '<strong>OpenLyrics </strong> worship song format.'))
self.available_songs_page.setTitle(translate('SongsPlugin.ExportWizardForm', 'Select Songs')) self.available_songs_page.setTitle(translate('SongsPlugin.ExportWizardForm', 'Select Songs'))
self.available_songs_page.setSubTitle(translate('SongsPlugin.ExportWizardForm', self.available_songs_page.setSubTitle(translate('SongsPlugin.ExportWizardForm',
'Check the songs you want to export.')) 'Check the songs you want to export.'))

View File

@ -96,7 +96,7 @@ class SongMediaItem(MediaManagerItem):
def add_end_header_bar(self): def add_end_header_bar(self):
self.toolbar.addSeparator() self.toolbar.addSeparator()
## Song Maintenance Button ## # Song Maintenance Button
self.maintenance_action = self.toolbar.add_toolbar_action('maintenance_action', self.maintenance_action = self.toolbar.add_toolbar_action('maintenance_action',
icon=':/songs/song_maintenance.png', icon=':/songs/song_maintenance.png',
triggers=self.on_song_maintenance_click) triggers=self.on_song_maintenance_click)
@ -266,7 +266,7 @@ class SongMediaItem(MediaManagerItem):
# Do not display temporary songs # Do not display temporary songs
if song.temporary: if song.temporary:
continue continue
if song_number and not song_number in song.song_number: if song_number and song_number not in song.song_number:
continue continue
song_detail = '%s - %s (%s)' % (book.name, song.song_number, song.title) song_detail = '%s - %s (%s)' % (book.name, song.song_number, song.title)
song_name = QtGui.QListWidgetItem(song_detail) song_name = QtGui.QListWidgetItem(song_detail)

View File

@ -132,7 +132,7 @@ class SongsPlugin(Plugin):
) )
import_menu.addAction(self.import_songselect_item) import_menu.addAction(self.import_songselect_item)
def add_export_menu_Item(self, export_menu): def add_export_menu_item(self, export_menu):
""" """
Give the Songs plugin the opportunity to add items to the **Export** menu. Give the Songs plugin the opportunity to add items to the **Export** menu.
@ -261,12 +261,12 @@ class SongsPlugin(Plugin):
""" """
Called to define all translatable texts of the plugin Called to define all translatable texts of the plugin
""" """
## Name PluginList ## # Name PluginList
self.text_strings[StringContent.Name] = { self.text_strings[StringContent.Name] = {
'singular': translate('SongsPlugin', 'Song', 'name singular'), 'singular': translate('SongsPlugin', 'Song', 'name singular'),
'plural': translate('SongsPlugin', 'Songs', 'name plural') 'plural': translate('SongsPlugin', 'Songs', 'name plural')
} }
## Name for MediaDockManager, SettingsManager ## # Name for MediaDockManager, SettingsManager
self.text_strings[StringContent.VisibleName] = { self.text_strings[StringContent.VisibleName] = {
'title': translate('SongsPlugin', 'Songs', 'container title') 'title': translate('SongsPlugin', 'Songs', 'container title')
} }

View File

@ -246,12 +246,12 @@ class SongUsagePlugin(Plugin):
""" """
Called to define all translatable texts of the plugin Called to define all translatable texts of the plugin
""" """
## Name PluginList ## # Name PluginList
self.text_strings[StringContent.Name] = { self.text_strings[StringContent.Name] = {
'singular': translate('SongUsagePlugin', 'SongUsage', 'name singular'), 'singular': translate('SongUsagePlugin', 'SongUsage', 'name singular'),
'plural': translate('SongUsagePlugin', 'SongUsage', 'name plural') 'plural': translate('SongUsagePlugin', 'SongUsage', 'name plural')
} }
## Name for MediaDockManager, SettingsManager ## # Name for MediaDockManager, SettingsManager
self.text_strings[StringContent.VisibleName] = { self.text_strings[StringContent.VisibleName] = {
'title': translate('SongUsagePlugin', 'SongUsage', 'container title') 'title': translate('SongUsagePlugin', 'SongUsage', 'container title')
} }

View File

@ -32,12 +32,13 @@ Functional tests to test the AppLocation class and related methods.
from unittest import TestCase from unittest import TestCase
from openlp.core.common import de_hump from openlp.core.common import de_hump, trace_error_handler
from tests.functional import MagicMock, patch
class TestInitFunctions(TestCase): class TestCommonFunctions(TestCase):
""" """
A test suite to test out various functions in the __init__ class. A test suite to test out various functions in the openlp.core.common module.
""" """
def de_hump_conversion_test(self): def de_hump_conversion_test(self):
""" """
@ -64,3 +65,19 @@ class TestInitFunctions(TestCase):
# THEN: the new string should be converted to python format # THEN: the new string should be converted to python format
self.assertTrue(new_string == "my_class", 'The class name should have been preserved') self.assertTrue(new_string == "my_class", 'The class name should have been preserved')
def trace_error_handler_test(self):
"""
Test the trace_error_handler() method
"""
# GIVEN: Mocked out objects
with patch('openlp.core.common.traceback') as mocked_traceback:
mocked_traceback.extract_stack.return_value = [('openlp.fake', 56, None, 'trace_error_handler_test')]
mocked_logger = MagicMock()
# WHEN: trace_error_handler() is called
trace_error_handler(mocked_logger)
# THEN: The mocked_logger.error() method should have been called with the correct parameters
mocked_logger.error.assert_called_with('OpenLP Error trace\n File openlp.fake at line 56 \n\t called trace_error_handler_test')

View File

@ -212,9 +212,9 @@ class TestPluginManager(TestCase):
# WHEN: We run hook_export_menu() # WHEN: We run hook_export_menu()
plugin_manager.hook_export_menu() plugin_manager.hook_export_menu()
# THEN: The add_export_menu_Item() method should not have been called # THEN: The add_export_menu_item() method should not have been called
self.assertEqual(0, mocked_plugin.add_export_menu_Item.call_count, self.assertEqual(0, mocked_plugin.add_export_menu_item.call_count,
'The add_export_menu_Item() method should not have been called.') 'The add_export_menu_item() method should not have been called.')
def hook_export_menu_with_active_plugin_test(self): def hook_export_menu_with_active_plugin_test(self):
""" """
@ -229,8 +229,8 @@ class TestPluginManager(TestCase):
# WHEN: We run hook_export_menu() # WHEN: We run hook_export_menu()
plugin_manager.hook_export_menu() plugin_manager.hook_export_menu()
# THEN: The add_export_menu_Item() method should have been called # THEN: The add_export_menu_item() method should have been called
mocked_plugin.add_export_menu_Item.assert_called_with(self.mocked_main_window.file_export_menu) mocked_plugin.add_export_menu_item.assert_called_with(self.mocked_main_window.file_export_menu)
def hook_upgrade_plugin_settings_with_disabled_plugin_test(self): def hook_upgrade_plugin_settings_with_disabled_plugin_test(self):
""" """
@ -264,7 +264,7 @@ class TestPluginManager(TestCase):
# WHEN: We run hook_upgrade_plugin_settings() # WHEN: We run hook_upgrade_plugin_settings()
plugin_manager.hook_upgrade_plugin_settings(settings) plugin_manager.hook_upgrade_plugin_settings(settings)
# THEN: The add_export_menu_Item() method should have been called # THEN: The add_export_menu_item() method should have been called
mocked_plugin.upgrade_settings.assert_called_with(settings) mocked_plugin.upgrade_settings.assert_called_with(settings)
def hook_tools_menu_with_disabled_plugin_test(self): def hook_tools_menu_with_disabled_plugin_test(self):

View File

@ -0,0 +1,73 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
# Copyright (c) 2008-2014 Raoul Snyman #
# Portions copyright (c) 2008-2014 Tim Bentley, Gerald Britton, Jonathan #
# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub, #
# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer. #
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free #
# Software Foundation; version 2 of the License. #
# #
# This program is distributed in the hope that it will be useful, but WITHOUT #
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
# more details. #
# #
# You should have received a copy of the GNU General Public License along #
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
"""
Package to test for proper bzr tags.
"""
from unittest import TestCase
from subprocess import Popen, PIPE
TAGS = [
['1.9.0', '1'],
['1.9.1', '775'],
['1.9.2', '890'],
['1.9.3', '1063'],
['1.9.4', '1196'],
['1.9.5', '1421'],
['1.9.6', '1657'],
['1.9.7', '1761'],
['1.9.8', '1856'],
['1.9.9', '1917'],
['1.9.10', '2003'],
['1.9.11', '2039'],
['1.9.12', '2063'],
['2.0', '2118'],
['2.0.1', '?'],
['2.0.2', '?'],
['2.0.3', '?'],
['2.1.0', '2119']
]
class TestBzrTags(TestCase):
def bzr_tags_test(self):
"""
Test for proper bzr tags
"""
# GIVEN: A bzr branch
# WHEN getting the branches tags
bzr = Popen(('bzr', 'tags'), stdout=PIPE)
stdout = bzr.communicate()[0]
tags = [line.decode('utf-8').split() for line in stdout.splitlines()]
# THEN the tags should match the accepted tags
self.assertEqual(TAGS, tags, 'List of tags should match')