Made the constants more like constants!

This commit is contained in:
Philip Ridout 2010-08-28 21:46:03 +01:00
parent f712ccca50
commit 271bbe22b2
1 changed files with 10 additions and 8 deletions

View File

@ -43,6 +43,12 @@ class SongImport(QtCore.QObject):
whether the authors etc already exist and add them or refer to them whether the authors etc already exist and add them or refer to them
as necessary as necessary
""" """
COPYRIGHT_STRING = unicode(translate(
'SongsPlugin.SongImport', 'copyright'))
COPYRIGHT_SYMBOL = unicode(translate(
'SongsPlugin.SongImport', '\xa9'))
def __init__(self, manager): def __init__(self, manager):
""" """
Initialise and create defaults for properties Initialise and create defaults for properties
@ -52,10 +58,6 @@ class SongImport(QtCore.QObject):
""" """
self.manager = manager self.manager = manager
self.stop_import_flag = False self.stop_import_flag = False
self.copyright_string = unicode(translate(
'SongsPlugin.SongImport', 'copyright'))
self.copyright_symbol = unicode(translate(
'SongsPlugin.SongImport', '\xa9'))
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'songs_stop_import'), self.stop_import) QtCore.SIGNAL(u'songs_stop_import'), self.stop_import)
self.setDefaults() self.setDefaults()
@ -129,13 +131,13 @@ class SongImport(QtCore.QObject):
def process_verse_text(self, text): def process_verse_text(self, text):
lines = text.split(u'\n') lines = text.split(u'\n')
if text.lower().find(self.copyright_string) >= 0 \ if text.lower().find(COPYRIGHT_STRING) >= 0 \
or text.lower().find(self.copyright_symbol) >= 0: or text.lower().find(COPYRIGHT_SYMBOL) >= 0:
copyright_found = False copyright_found = False
for line in lines: for line in lines:
if (copyright_found or if (copyright_found or
line.lower().find(self.copyright_string) >= 0 or line.lower().find(COPYRIGHT_STRING) >= 0 or
line.lower().find(self.copyright_symbol) >= 0): line.lower().find(COPYRIGHT_SYMBOL) >= 0):
copyright_found = True copyright_found = True
self.add_copyright(line) self.add_copyright(line)
else: else: