Various string fixes and other tidying up

- Fix some string errors
- remove unused variable
- Fix method name
- Add setup.cfg with config for pep8 (pep8 reads this file)
- Fixed errors in translation utils

bzr-revno: 2388
This commit is contained in:
Samuel Mehrbrodt 2014-06-08 16:12:23 +02:00 committed by Raoul Snyman
commit 007e18945e
9 changed files with 34 additions and 18 deletions

View File

@ -91,10 +91,9 @@ class FormattingTagForm(QtGui.QDialog, Ui_FormattingTagDialog, FormattingTagCont
"""
new_row = self.tag_table_widget.rowCount()
self.tag_table_widget.insertRow(new_row)
self.tag_table_widget.setItem(new_row, 0,
QtGui.QTableWidgetItem(translate('OpenLP.FormattingTagForm', 'New Tag%s')
% str(new_row)))
self.tag_table_widget.setItem(new_row, 1, QtGui.QTableWidgetItem('n%s' % str(new_row)))
self.tag_table_widget.setItem(new_row, 0, QtGui.QTableWidgetItem(translate('OpenLP.FormattingTagForm',
'New Tag %d' % new_row)))
self.tag_table_widget.setItem(new_row, 1, QtGui.QTableWidgetItem('n%d' % new_row))
self.tag_table_widget.setItem(new_row, 2,
QtGui.QTableWidgetItem(translate('OpenLP.FormattingTagForm', '<HTML here>')))
self.tag_table_widget.setItem(new_row, 3, QtGui.QTableWidgetItem(''))

View File

@ -18,11 +18,11 @@
# Software Foundation; version 2 of the License. #
# #
# This program is distributed in the hope that it will be useful, but WITHOUT #
# AN_y WARRANT_y; without even the implied warranty of MERCHANTABILIT_y or #
# 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 #
# 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 #
###############################################################################
@ -179,7 +179,7 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard, RegistryProperties):
if self.page(self.currentId()) == self.background_page and \
self.theme.background_type == background_image and is_not_image_file(self.theme.background_filename):
QtGui.QMessageBox.critical(self, translate('OpenLP.ThemeWizard', 'Background Image Empty'),
translate('OpenLP.ThemeWizard', '_you have not selected a '
translate('OpenLP.ThemeWizard', 'You have not selected a '
'background image. Please select one before continuing.'))
return False
else:

View File

@ -149,7 +149,7 @@ class CSVBible(BibleDB):
book_ptr = book.name
self.wizard.increment_progress_bar(
translate('BiblesPlugin.CSVBible',
'Importing verses from %s... Importing verses from <book name>...') % book.name)
'Importing verses from %s...' % book.name, 'Importing verses from <book name>...'))
self.session.commit()
try:
verse_text = str(line[3], details['encoding'])

View File

@ -63,7 +63,6 @@ class CCLIFileImport(SongImport):
for filename in self.import_source:
filename = str(filename)
log.debug('Importing CCLI File: %s', filename)
lines = []
if os.path.isfile(filename):
detect_file = open(filename, 'r')
detect_content = detect_file.read(2048)
@ -250,7 +249,7 @@ class CCLIFileImport(SongImport):
# e.g. For use solely with the SongSelect Terms of Use.
All rights Reserved. www.ccli.com
CCLI Licence number of user
# e.g. CCL-Liedlizenznummer: 14 / CCLI License No. 14
# e.g. CCLI-Liedlizenznummer: 14 / CCLI License No. 14
"""
log.debug('TXT file text: %s', text_list)

View File

@ -74,10 +74,11 @@ class AuthorType(object):
WordsAndMusic = 'words+music'
Translation = 'translation'
Types = {
Words: translate('OpenLP.Ui', 'Words'),
Music: translate('OpenLP.Ui', 'Music'),
WordsAndMusic: translate('OpenLP.Ui', 'Words and Music'),
Translation: translate('OpenLP.Ui', 'Translation')
Words: translate('SongsPlugin.AuthorType', 'Words', 'Author who wrote the lyrics of a song'),
Music: translate('SongsPlugin.AuthorType', 'Music', 'Author who wrote the music of a song'),
WordsAndMusic: translate('SongsPlugin.AuthorType', 'Words and Music',
'Author who wrote both lyrics and music of a song'),
Translation: translate('SongsPlugin.AuthorType', 'Translation', 'Author who translated the song')
}

View File

@ -661,7 +661,7 @@ class OpenLyrics(object):
# OpenLyrics 0.8 uses <br/> for new lines. Append text from "lines" element to verse text.
if version > '0.7':
text = self._process_lines_mixed_content(element)
# OpenLyrics version <= 0.7 contais <line> elements to represent lines. First child element is tested.
# OpenLyrics version <= 0.7 contains <line> elements to represent lines. First child element is tested.
else:
# Loop over the "line" elements removing comments and chords.
for line in element:

View File

@ -175,7 +175,7 @@ def run(command):
process = QtCore.QProcess()
process.start(command)
while process.waitForReadyRead():
print_verbose('ReadyRead: %s' % QtCore.QString(process.readAll()))
print_verbose('ReadyRead: %s' % process.readAll())
print_verbose('Error(s):\n%s' % process.readAllStandardError())
print_verbose('Output:\n%s' % process.readAllStandardOutput())
@ -194,7 +194,7 @@ def download_translations():
password = getpass(' Transifex password: ')
# First get the list of languages
url = SERVER_URL + 'resource/ents/'
base64string = base64.encodbytes('%s:%s' % (username, password))[:-1]
base64string = base64.encodebytes('%s:%s' % (username, password))[:-1]
auth_header = 'Basic %s' % base64string
request = urllib.request.Request(url + '?details')
request.add_header('Authorization', auth_header)
@ -261,7 +261,7 @@ def prepare_project():
lines.append('TRANSLATIONS += %s' % line)
lines.sort()
file = open(os.path.join(start_dir, 'openlp.pro'), 'w')
file.write('\n'.join(lines).encode('utf8'))
file.write('\n'.join(lines))
file.close()
print_quiet(' Done.')

3
setup.cfg Normal file
View File

@ -0,0 +1,3 @@
[pep8]
exclude=resources.py,vlc.py
max-line-length = 120

View File

@ -198,6 +198,20 @@ class TestUi(TestCase):
# THEN: The index should have changed
self.assertEqual(2, combo.currentIndex())
def test_create_widget_action(self):
"""
Test creating an action for a widget
"""
# GIVEN: A button
button = QtGui.QPushButton()
# WHEN: We call the function
action = create_widget_action(button, 'some action')
# THEN: The action should be returned
self.assertIsInstance(action, QtGui.QAction)
self.assertEqual(action.objectName(), 'some action')
def test_set_case_insensitive_completer(self):
"""
Test setting a case insensitive completer on a widget