diff --git a/cnvdb.py b/cnvdb.py deleted file mode 100755 index 1e1acdd32..000000000 --- a/cnvdb.py +++ /dev/null @@ -1,61 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 - -############################################################################### -# OpenLP - Open Source Lyrics Projection # -# --------------------------------------------------------------------------- # -# Copyright (c) 2008-2009 Raoul Snyman # -# Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley, Carsten # -# Tinggaard, Jon Tibble, Jonathan Corwin, Maikel Stuivenberg, Scott Guerrieri # -# --------------------------------------------------------------------------- # -# 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 # -############################################################################### - -import codecs -import sys - -def convert_file(inname, outname): - """ - Convert a file from another encoding into UTF-8. - - ``inname`` - The name of the file to be opened and converted. - - ``outname`` - The output file name. - """ - infile = codecs.open(inname, 'r', encoding='CP1252') - writefile = codecs.open(outname, 'w', encoding='utf-8') - for line in infile: - #replace the quotes with quotes - #TODO fix double quotes - #line = line.replace(u'\'\'', u'@') - writefile.write(line) - infile.close() - writefile.close() - -if __name__ == '__main__': - """ - Run the conversion script. - """ - if len(sys.argv) < 2: - print 'No action specified.' - sys.exit() - print 'Uncode conversion:' - print 'Input file = ', sys.argv[1] - print 'Output file = ', sys.argv[2] - print 'Converting...' - convert_file(sys.argv[1], sys.argv[2]) - print 'Done.' diff --git a/i18n/openlp_en.ts b/i18n/openlp_en.ts new file mode 100644 index 000000000..d92273c1d --- /dev/null +++ b/i18n/openlp_en.ts @@ -0,0 +1,991 @@ + + + + + BibleMediaItem + + + Quick + + + + + AlertsTab + + + Alerts + + + + + Font + + + + + Ui_OpenLPExportDialog + + + Author + + + + + Ui_AmendThemeDialog + + + Vertical + + + + + AlertForm + + + Display + + + + + SplashScreen + + + Starting + + + + + MediaManagerItem + + + New + + + + + EditCustomForm + + + Error + + + + + Ui_AmendThemeDialog + + + Center + + + + + TestMediaManager: + + + Item2 + + + + + AboutForm + + + License + + + + + TestMediaManager: + + + Item1 + + + + + Ui_MainWindow + + + English + + + + + Ui_AmendThemeDialog + + + pt + + + + + Ui_OpenSongImportDialog + + + Close + + + + + Ui_AmendThemeDialog + + + Middle + + + + + Opaque + + + + + Ui_customEditDialog + + + Clear + + + + + Save + + + + + BibleImportForm + + + Information + + + + + Ui_OpenSongExportDialog + + + Lyrics + + + + + Ui_customEditDialog + + + Delete + + + + + Ui_OpenLPImportDialog + + + Close + + + + + ImageTab + + + sec + + + + + Ui_OpenSongExportDialog + + + Close + + + + + BibleMediaItem + + + Clear + + + + + Ui_OpenSongExportDialog + + + Author + + + + + Ui_PluginViewDialog + + + Inactive + + + + + Ui_OpenLPImportDialog + + + Import + + + + + Ui_MainWindow + + + F9 + + + + + F8 + + + + + Ui_SongMaintenanceDialog + + + Topics + + + + + Ui_AmendThemeDialog + + + Left + + + + + SongMaintenanceForm + + + Error + + + + + Ui_AmendThemeDialog + + + Top + + + + + Ui_MainWindow + + + F7 + + + + + Ui_AmendThemeDialog + + + Alignment + + + + + MediaManagerItem + + + Add + + + + + BibleMediaItem + + + Search + + + + + Ui_SongMaintenanceDialog + + + Edit + + + + + Ui_EditSongDialog + + + Theme + + + + + SongsPlugin + + + OpenSong + + + + + MediaManagerItem + + + Edit + + + + + Load + + + + + Ui_AmendThemeDialog + + + Bottom + + + + + Ui_BibleImportDialog + + + NIV + + + + + Ui_AmendThemeDialog + + + Image + + + + + GeneralTab + + + Screen + + + + + ThemeManager + + + Error + + + + + Ui_AmendThemeDialog + + + Normal + + + + + AlertsTab + + + s + + + + + Ui_OpenLPExportDialog + + + Close + + + + + Ui_OpenLPImportDialog + + + Author + + + + + BiblesTab + + + Bibles + + + + + Ui_AuditDetailDialog + + + Summary + + + + + Ui_BibleImportDialog + + + Import + + + + + SongBookForm + + + Error + + + + + Ui_OpenLPImportDialog + + + Title + + + + + Ui_PluginViewDialog + + + TextLabel + + + + + AboutForm + + + Contribute + + + + + GeneralTab + + + Monitors + + + + + Ui_AmendThemeDialog + + + Bold + + + + + TopicsForm + + + Error + + + + + SlideController + + + Preview + + + + + Ui_OpenLPExportDialog + + + Export + + + + + BibleMediaItem + + + Keep + + + + + Ui_AmendThemeDialog + + + Right + + + + + Ui_EditSongDialog + + + Comments + + + + + AboutForm + + + Credits + + + + + AlertForm + + + Cancel + + + + + AuthorsForm + + + Error + + + + + Ui_OpenSongExportDialog + + + Export + + + + + MediaManagerItem + + + Preview + + + + + Ui_SettingsDialog + + + Settings + + + + + BibleMediaItem + + + Information + + + + + Ui_OpenLPExportDialog + + + Lyrics + + + + + ImageTab + + + Images + + + + + Ui_AmendThemeDialog + + + Horizontal + + + + + Circular + + + + + Ui_EditSongDialog + + + Topic + + + + + BibleMediaItem + + + Advanced + + + + + MediaTab + + + Media + + + + + AboutForm + + + Close + + + + + Ui_EditSongDialog + + + Edit + + + + + Ui_OpenLPImportDialog + + + Lyrics + + + + + Ui_AmendThemeDialog + + + px + + + + + Ui_EditSongDialog + + + Delete + + + + + Ui_OpenSongExportDialog + + + Title + + + + + ThemesTab + + + Themes + + + + + Ui_EditSongDialog + + + Authors + + + + + Ui_BibleImportDialog + + + KJV + + + + + Ui_SongMaintenanceDialog + + + Authors + + + + + Ui_AuditDetailDialog + + + Detailed + + + + + Ui_SongMaintenanceDialog + + + Delete + + + + + SlideController + + + s + + + + + SongMediaItem + + + Titles + + + + + Clear + + + + + Ui_BibleImportDialog + + + Crosswalk + + + + + Ui_customEditDialog + + + Edit + + + + + PresentationTab + + + available + + + + + ThemeManager + + + default + + + + + EditSongForm + + + Error + + + + + Ui_SongMaintenanceDialog + + + Add + + + + + Ui_BibleImportDialog + + + Cancel + + + + + Ui_OpenLPExportDialog + + + Title + + + + + GeneralTab + + + General + + + + + primary + + + + + Ui_AmendThemeDialog + + + Preview + + + + + SlideController + + + Live + + + + + AlertsTab + + + Preview + + + + + BiblesTab + + + continuous + + + + + Ui_AmendThemeDialog + + + Transparent + + + + + SongMediaItem + + + Search + + + + + Ui_OpenSongImportDialog + + + Import + + + + + Ui_AmendThemeDialog + + + Background + + + + + Ui_EditSongDialog + + + Add + + + + + SongMediaItem + + + Lyrics + + + + + MediaManagerItem + + + Delete + + + + + Ui_MainWindow + + + F11 + + + + + F10 + + + + + Ui_AuditDetailDialog + + + to + + + + + Ui_MainWindow + + + F12 + + + + + SongMediaItem + + + Authors + + + + + Ui_PluginViewDialog + + + Active + + + + + Ui_AmendThemeDialog + + + Italics + + + + + Gradient + + + + + diff --git a/openlp-1to2-converter.py b/openlp-1to2-converter.py new file mode 100755 index 000000000..bccb44d31 --- /dev/null +++ b/openlp-1to2-converter.py @@ -0,0 +1,318 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 + +############################################################################### +# OpenLP - Open Source Lyrics Projection # +# --------------------------------------------------------------------------- # +# Copyright (c) 2008-2009 Raoul Snyman # +# Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley, Carsten # +# Tinggaard, Jon Tibble, Jonathan Corwin, Maikel Stuivenberg, Scott Guerrieri # +# --------------------------------------------------------------------------- # +# 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 # +############################################################################### + +import sys +import os +import sqlite +import sqlite3 +import re +from optparse import OptionParser +from traceback import format_tb as get_traceback + +# Some global options to be used throughout the import process +dirty_chars = re.compile(r'\W ', re.UNICODE) +verbose = False +debug = False +old_cursor = None +new_cursor = None + +# SQL create statments +create_statements = [ + (u'table "authors"', u"""CREATE TABLE authors ( + id INTEGER NOT NULL, + first_name VARCHAR(128), + last_name VARCHAR(128), + display_name VARCHAR(255) NOT NULL, + PRIMARY KEY (id) +)"""), + (u'table "song_books"', u"""CREATE TABLE song_books ( + id INTEGER NOT NULL, + name VARCHAR(128) NOT NULL, + publisher VARCHAR(128), + PRIMARY KEY (id) +)"""), + (u'table "songs"', u"""CREATE TABLE songs ( + id INTEGER NOT NULL, + song_book_id INTEGER, + title VARCHAR(255) NOT NULL, + lyrics TEXT NOT NULL, + verse_order VARCHAR(128), + copyright VARCHAR(255), + comments TEXT, + ccli_number VARCHAR(64), + song_number VARCHAR(64), + theme_name VARCHAR(128), + search_title VARCHAR(255) NOT NULL, + search_lyrics TEXT NOT NULL, + PRIMARY KEY (id), + FOREIGN KEY(song_book_id) REFERENCES song_books (id) +)"""), + (u'table "topics"', u"""CREATE TABLE topics ( + id INTEGER NOT NULL, + name VARCHAR(128) NOT NULL, + PRIMARY KEY (id) +)"""), + (u'index "ix_songs_search_lyrics"', + u"""CREATE INDEX ix_songs_search_lyrics ON songs (search_lyrics)"""), + (u'index "ix_songs_search_title', + u"""CREATE INDEX ix_songs_search_title ON songs (search_title)"""), + (u'table "authors_songs"', u"""CREATE TABLE authors_songs ( + author_id INTEGER NOT NULL, + song_id INTEGER NOT NULL, + PRIMARY KEY (author_id, song_id), + FOREIGN KEY(author_id) REFERENCES authors (id), + FOREIGN KEY(song_id) REFERENCES songs (id) +)"""), + (u'table "songs_topics"', u"""CREATE TABLE songs_topics ( + song_id INTEGER NOT NULL, + topic_id INTEGER NOT NULL, + PRIMARY KEY (song_id, topic_id), + FOREIGN KEY(song_id) REFERENCES songs (id), + FOREIGN KEY(topic_id) REFERENCES topics (id) +)""") +] + +def clean_string(dirty): + return dirty_chars.sub(u'', dirty.replace(u'\r\n', ' ').replace(u'\n', ' ')) + +def display_sql(sql, params): + prepared_params = [] + for param in params: + if isinstance(param, basestring): + prepared_params.append(u'"%s"' % param) + elif isinstance(param, (int, long)): + prepared_params.append(u'%d' % param) + elif isinstance(param, (float, complex)): + prepared_params.append(u'%f' % param) + else: + prepared_params.append(u'"%s"' % str(param)) + for prepared_param in prepared_params: + sql = sql.replace(u'?', prepared_param, 1) + return sql + +def create_database(): + global new_cursor, create_statements + if debug or verbose: + print 'Creating new database:' + else: + print 'Creating new database...', + for statement_type, sql_create in create_statements: + if debug: + print '... ', sql_create.replace('\n', ' ').replace(' ', ' ') + elif verbose: + print '... creating %s...' % statement_type, + new_cursor.execute(sql_create) + if verbose and not debug: + print 'done.' + if not verbose and not debug: + print 'done.' + +def import_songs(): + global old_cursor, new_cursor, debug, verbose + if debug or verbose: + print 'Importing authors:' + else: + print 'Importing authors...', + if debug: + print '... SELECT authorid AS id, authorname AS displayname FROM authors' + elif verbose: + print '... fetching authors from old database...', + old_cursor.execute(u'SELECT authorid AS id, authorname AS displayname FROM authors') + rows = old_cursor.fetchall() + if not debug and verbose: + print 'done.' + author_map = {} + for row in rows: + display_name = unicode(row[1], u'cp1252') + names = display_name.split(u' ') + first_name = names[0] + last_name = u' '.join(names[1:]) + if last_name is None: + last_name = u'' + sql_insert = u'INSERT INTO authors '\ + '(id, first_name, last_name, display_name) '\ + 'VALUES (NULL, ?, ?, ?)' + sql_params = (first_name, last_name, display_name) + if debug: + print '...', display_sql(sql_insert, sql_params) + elif verbose: + print '... importing "%s"' % display_name + new_cursor.execute(sql_insert, sql_params) + author_map[row[0]] = new_cursor.lastrowid + if debug: + print ' >>> authors.authorid =', row[0], 'authors.id =', author_map[row[0]] + if not verbose and not debug: + print 'done.' + if debug or verbose: + print 'Importing songs:' + else: + print 'Importing songs...', + if debug: + print '... SELECT songid AS id, songtitle AS title, lyrics || \'\' AS lyrics, copyrightinfo AS copyright FROM songs...', + elif verbose: + print '... fetching songs from old database...', + old_cursor.execute(u'SELECT songid AS id, songtitle AS title, lyrics || \'\' AS lyrics, copyrightinfo AS copyright FROM songs') + rows = old_cursor.fetchall() + if debug or verbose: + print 'done.' + song_map = {} + xml_lyrics_template = u'%s' + xml_verse_template = u'' + for row in rows: + clean_title = unicode(row[1], u'cp1252') + clean_lyrics = unicode(row[2], u'cp1252') + clean_copyright = unicode(row[3], u'cp1252') + verse_order = u'' + text_lyrics = clean_lyrics.split(u'\n\n') + xml_verse = u'' + for line, verse in enumerate(text_lyrics): + if not verse: + continue + xml_verse += (xml_verse_template % (line + 1, verse)) + verse_order += '%d ' % (line + 1) + xml_lyrics = xml_lyrics_template % xml_verse + search_title = clean_string(clean_title) + search_lyrics = clean_string(clean_lyrics) + sql_insert = u'INSERT INTO songs '\ + '(id, song_book_id, title, lyrics, verse_order, copyright, search_title, search_lyrics) '\ + 'VALUES (NULL, 0, ?, ?, ?, ?, ?, ?)' + sql_params = (clean_title, xml_lyrics, verse_order, clean_copyright, clean_title, clean_lyrics) + if debug: + print '...', display_sql(sql_insert, (sql_params[0], u'%s...' % clean_lyrics[:7], sql_params[2], sql_params[3], sql_params[4], u'%s...' % search_lyrics[:7])) + elif verbose: + print '... importing "%s"' % clean_title + new_cursor.execute(sql_insert, sql_params) + song_map[row[0]] = new_cursor.lastrowid + if debug: + print ' >>> songs.songid =', row[0], 'songs.id =', song_map[row[0]] + if not verbose and not debug: + print 'done.' + if debug or verbose: + print 'Importing song-to-author mapping:' + else: + print 'Importing song-to-author mapping...', + if debug: + print '... SELECT authorid AS author_id, songid AS song_id FROM songauthors' + elif verbose: + print '... fetching song-to-author mapping from old database...', + old_cursor.execute(u'SELECT authorid AS author_id, songid AS song_id FROM songauthors') + rows = old_cursor.fetchall() + if not debug and verbose: + print 'done.' + for row in rows: + sql_insert = u'INSERT INTO authors_songs '\ + '(author_id, song_id) '\ + 'VALUES (?, ?)' + sql_params = (author_map[row[0]], song_map[row[1]]) + if debug: + print '... ', display_sql(sql_insert, sql_params) + elif verbose: + print '... Author %d (was %d) => Song %d (was %d)'\ + % (int(row[0]), author_map[row[0]], + int(row[1]), song_map[row[1]]) + new_cursor.execute(sql_insert, sql_params) + if not verbose and not debug: + print 'done.' + +def main(old_db, new_db): + global old_cursor, new_cursor, debug + old_connection = None + new_connection = None + try: + old_connection = sqlite.connect(old_db) + except: + if debug: + errormsg = '\n' + ''.join(get_traceback(sys.exc_info()[2]))\ + + str(sys.exc_info()[1]) + else: + errormsg = sys.exc_info()[1] + print 'There was a problem connecting to the old database:', errormsg + return 1 + try: + new_connection = sqlite3.connect(new_db) + except: + if debug: + errormsg = '\n' + ''.join(get_traceback(sys.exc_info()[2]))\ + + str(sys.exc_info()[1]) + else: + errormsg = sys.exc_info()[1] + print 'There was a problem creating the new database:', errormsg + return 1 + old_cursor = old_connection.cursor() + new_cursor = new_connection.cursor() + try: + create_database() + except: + if debug: + errormsg = '\n' + ''.join(get_traceback(sys.exc_info()[2]))\ + + str(sys.exc_info()[1]) + else: + errormsg = sys.exc_info()[1] + print 'There was a problem creating the database:', errormsg + return 1 + try: + import_songs() + new_connection.commit() + except: + new_connection.rollback() + if debug: + errormsg = '\n' + ''.join(get_traceback(sys.exc_info()[2]))\ + + str(sys.exc_info()[1]) + else: + errormsg = sys.exc_info()[1] + print 'There was a problem importing songs:', errormsg + return 1 + print 'Import complete.' + +if __name__ == u'__main__': + option_parser = OptionParser(usage='Usage: %prog [options] OLDDATABASE NEWDATABASE') + option_parser.add_option('-o', '--overwrite', dest='overwrite', default=False, + action=u'store_true', help='Overwrite database file if it already exists.') + option_parser.add_option('-v', '--verbose', dest='verbose', default=False, + action=u'store_true', help='Outputs additional progress data.') + option_parser.add_option('-d', '--debug', dest='debug', default=False, + action=u'store_true', help='Outputs raw SQL statements (overrides verbose).') + options, arguments = option_parser.parse_args() + if len(arguments) < 2: + if len(arguments) == 0: + option_parser.error('Please specify an old database and a new database.') + else: + option_parser.error('Please specify a new database.') + old_db = os.path.abspath(arguments[0]) + new_db = os.path.abspath(arguments[1]) + if not os.path.isfile(old_db): + option_parser.error('Old database file ("%s") is not a file.' % old_db) + if not os.path.exists(old_db): + option_parser.error('Old database file ("%s") does not exist.' % old_db) + if os.path.exists(new_db): + if not options.overwrite: + option_parser.error('New database file ("%s") exists. If you want to overwrite it, specify the --overwrite option.' % new_db) + else: + if not os.path.isfile(new_db): + option_parser.error('New database file ("%s") is not a file.' % new_db) + os.unlink(new_db) + verbose = options.verbose + debug = options.debug + main(old_db, new_db) diff --git a/openlp-get-strings.py b/openlp-get-strings.py new file mode 100644 index 000000000..2af5e476b --- /dev/null +++ b/openlp-get-strings.py @@ -0,0 +1,97 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 + +############################################################################### +# OpenLP - Open Source Lyrics Projection # +# --------------------------------------------------------------------------- # +# Copyright (c) 2008-2009 Raoul Snyman # +# Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley, Carsten # +# Tinggaard, Jon Tibble, Jonathan Corwin, Maikel Stuivenberg, Scott Guerrieri # +# --------------------------------------------------------------------------- # +# 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 # +############################################################################### + +import os +import re + +ts_file = u""" + + +%s + +""" +ts_context = u""" + %s +%s +""" +ts_message = u""" + + %s + + +""" +find_trUtf8 = re.compile(r"trUtf8\(u'([\w]+)'\)", re.UNICODE) +strings = {} + +def parse_file(filename): + global strings + file = open(filename, u'r') + class_name = u'' + line_number = 0 + for line in file: + line_number += 1 + if line[:5] == u'class': + class_name = line[6:line.find(u'(')] + continue + for match in find_trUtf8.finditer(line): + key = u'%s-%s' % (class_name, match.group(1)) + if not key in strings: + strings[key] = [class_name, filename, line_number, match.group(1)] + file.close() + +def write_file(filename): + global strings + translation_file = u'' + translation_contexts = [] + translation_messages = [] + class_name = strings[strings.keys()[0]][0] + current_context = u'' + for key, translation in strings.iteritems(): + if class_name != translation[0]: + current_context = ts_context % (class_name, u''.join(translation_messages)) + translation_contexts.append(current_context) + translation_messages = [] + class_name = translation[0] + translation_messages.append(ts_message % (translation[1], translation[2], translation[3])) + current_context = ts_context % (class_name, u''.join(translation_messages)) + translation_contexts.append(current_context) + translation_file = ts_file % (u''.join(translation_contexts)) + file = open(filename, u'w') + file.write(translation_file) + file.close() + +def main(): + start_dir = u'/home/raoul/Projects/openlp/i18n' + for root, dirs, files in os.walk(start_dir): + for file in files: + if file.endswith(u'.py'): + print u'Parsing "%s"' % file + parse_file(os.path.join(root, file)) + print u'Generating TS file...', + write_file(os.path.join(start_dir, u'i18n', u'openlp_en.ts')) + print u'done.' + +if __name__ == u'__main__': + main() diff --git a/openlp.pyw b/openlp.pyw index 98faf8b03..ebd449bf8 100755 --- a/openlp.pyw +++ b/openlp.pyw @@ -47,7 +47,15 @@ QMainWindow::separator QDockWidget::title { border: none; - padding-left: 2px; + padding-left: 5px; + padding-top: 3px; +} + +QToolBar +{ + border: none; + margin: 0; + padding: 0; } """ diff --git a/openlp/core/lib/__init__.py b/openlp/core/lib/__init__.py index cdbd6446a..0aac8dd16 100644 --- a/openlp/core/lib/__init__.py +++ b/openlp/core/lib/__init__.py @@ -110,12 +110,21 @@ def contextMenuAction(base, icon, text, slot): Utility method to help build context menus for plugins """ action = QtGui.QAction(text, base) - action.setIcon(buildIcon(icon)) + if icon is not None: + action.setIcon(buildIcon(icon)) QtCore.QObject.connect(action, QtCore.SIGNAL(u'triggered()'), slot) return action +def contextMenu(base, icon, text): + """ + Utility method to help build context menus for plugins + """ + action = QtGui.QMenu(text, base) + action.setIcon(buildIcon(icon)) + return action + def contextMenuSeparator(base): - action = QtGui.QAction("", base) + action = QtGui.QAction(u'', base) action.setSeparator(True) return action diff --git a/openlp/core/lib/eventreceiver.py b/openlp/core/lib/eventreceiver.py index 923e228de..c4e6b8e6f 100644 --- a/openlp/core/lib/eventreceiver.py +++ b/openlp/core/lib/eventreceiver.py @@ -86,6 +86,17 @@ class EventReceiver(QtCore.QObject): ``config_updated`` Informs components the config has changed + + ``edit_song`` + Requests the current song on the preview display be loaded for edit + + ``preview_song`` + Tells the song plugin the edit has finished and the song can be previewed + Only available if the edit was triggered by the Preview button. + + ``slidecontroller_change`` + Informs the slidecontroller that a slide change has occurred + """ global log log = logging.getLogger(u'EventReceiver') diff --git a/openlp/core/lib/mediamanageritem.py b/openlp/core/lib/mediamanageritem.py index 77b45b0c0..016bb5259 100644 --- a/openlp/core/lib/mediamanageritem.py +++ b/openlp/core/lib/mediamanageritem.py @@ -28,7 +28,7 @@ import os from PyQt4 import QtCore, QtGui from openlp.core.lib.toolbar import * -from openlp.core.lib import translate, contextMenuAction, contextMenuSeparator +from openlp.core.lib import contextMenuAction, contextMenuSeparator from serviceitem import ServiceItem class MediaManagerItem(QtGui.QWidget): @@ -36,7 +36,7 @@ class MediaManagerItem(QtGui.QWidget): MediaManagerItem is a helper widget for plugins. None of the following *need* to be used, feel free to override - them cmopletely in your plugin's implementation. Alternatively, + them completely in your plugin's implementation. Alternatively, call them from your plugin before or after you've done extra things that you need to. @@ -118,7 +118,6 @@ class MediaManagerItem(QtGui.QWidget): self.requiredIcons() self.setupUi() self.retranslateUi() - #self.initialise() def requiredIcons(self): """ @@ -205,72 +204,50 @@ class MediaManagerItem(QtGui.QWidget): ## File Button ## if self.hasFileIcon: self.addToolbarButton( - translate( - self.TranslationContext, u'Load %s' % self.PluginTextShort), - translate( - self.TranslationContext, - u'Load a new %s' % self.PluginTextShort), - u':%s_load.png' % self.IconPath, - self.onFileClick, - u'%sFileItem' %self.PluginTextShort) + u'%s %s' % (self.trUtf8(u'Load'), self.PluginTextShort), + u'%s %s' % (self.trUtf8(u'Load a new'), self.PluginTextShort), + u':%s_load.png' % self.IconPath, self.onFileClick, + u'%sFileItem' % self.PluginTextShort) ## New Button ## if self.hasNewIcon: self.addToolbarButton( - translate( - self.TranslationContext, u'New %s' % self.PluginTextShort), - translate( - self.TranslationContext, - u'Add a new %s' % self.PluginTextShort), - u':%s_new.png' % self.IconPath, - self.onNewClick, + u'%s %s' % (self.trUtf8(u'New'), self.PluginTextShort), + u'%s %s' % (self.trUtf8(u'Add a new'), self.PluginTextShort), + u':%s_new.png' % self.IconPath, self.onNewClick, u'%sNewItem' % self.PluginTextShort) ## Edit Button ## if self.hasEditIcon: self.addToolbarButton( - translate( - self.TranslationContext, u'Edit %s' % self.PluginTextShort), - translate( - self.TranslationContext, - u'Edit the selected %s' % self.PluginTextShort), - u':%s_edit.png' % self.IconPath, - self.onEditClick, + u'%s %s' % (self.trUtf8(u'Edit'), self.PluginTextShort), + u'%s %s' % (self.trUtf8(u'Edit the selected'), self.PluginTextShort), + u':%s_edit.png' % self.IconPath, self.onEditClick, u'%sEditItem' % self.PluginTextShort) ## Delete Button ## if self.hasDeleteIcon: self.addToolbarButton( - translate( - self.TranslationContext, u'Delete %s' % self.PluginTextShort), - translate(self.TranslationContext, u'Delete the selected item'), - u':%s_delete.png' % self.IconPath, - self.onDeleteClick, + u'%s %s' % (self.trUtf8(u'Delete'), self.PluginTextShort), + self.trUtf8(u'Delete the selected item'), + u':%s_delete.png' % self.IconPath, self.onDeleteClick, u'%sDeleteItem' % self.PluginTextShort) ## Separator Line ## self.addToolbarSeparator() ## Preview ## self.addToolbarButton( - translate( - self.TranslationContext, u'Preview %s' % self.PluginTextShort), - translate(self.TranslationContext, u'Preview the selected item'), - u':/system/system_preview.png', - self.onPreviewClick, + u'%s %s' % (self.trUtf8(u'Preview'), self.PluginTextShort), + self.trUtf8(u'Preview the selected item'), + u':/system/system_preview.png', self.onPreviewClick, u'PreviewItem') ## Live Button ## self.addToolbarButton( - translate(self.TranslationContext, u'Go Live'), - translate(self.TranslationContext, u'Send the selected item live'), - u':/system/system_live.png', - self.onLiveClick, + self.trUtf8(u'Go Live'), + self.trUtf8(u'Send the selected item live'), + u':/system/system_live.png', self.onLiveClick, u'LiveItem') ## Add to service Button ## self.addToolbarButton( - translate( - self.TranslationContext, - u'Add %s to Service' % self.PluginTextShort), - translate( - self.TranslationContext, - u'Add the selected item(s) to the service'), - u':/system/system_add.png', - self.onAddClick, + u'%s %s %s' % (self.trUtf8(u'Add'), self.trUtf8(u'to Service'), self.PluginTextShort), + self.trUtf8(u'Add the selected item(s) to the service'), + u':/system/system_add.png', self.onAddClick, u'%sAddServiceItem' % self.PluginTextShort) def addListViewToToolBar(self): @@ -283,33 +260,34 @@ class MediaManagerItem(QtGui.QWidget): QtGui.QAbstractItemView.ExtendedSelection) self.ListView.setAlternatingRowColors(True) self.ListView.setDragEnabled(True) - self.ListView.setObjectName(self.PluginTextShort+u'ListView') + self.ListView.setObjectName(u'%sListView' % self.PluginTextShort) #Add tp PageLayout self.PageLayout.addWidget(self.ListView) #define and add the context menu self.ListView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu) if self.hasEditIcon: - self.ListView.addAction(contextMenuAction(self.ListView, - u':' +self.IconPath+u'_new.png', - translate(self.TranslationContext, - u'&Edit ' + self.PluginTextShort), - self.onEditClick)) + self.ListView.addAction( + contextMenuAction( + self.ListView, u':%s_new.png' % self.IconPath, + u'%s %s' % (self.trUtf8(u'&Edit'), self.PluginTextShort), + self.onEditClick)) self.ListView.addAction(contextMenuSeparator(self.ListView)) - self.ListView.addAction(contextMenuAction( - self.ListView, u':/system/system_preview.png', - translate(self.TranslationContext, - u'&Preview ' + self.PluginTextShort), - self.onPreviewClick)) - self.ListView.addAction(contextMenuAction( - self.ListView, u':/system/system_live.png', - translate(self.TranslationContext, u'&Show Live'), - self.onLiveClick)) - self.ListView.addAction(contextMenuAction( - self.ListView, u':/system/system_add.png', - translate(self.TranslationContext, u'&Add to Service'), - self.onAddClick)) - QtCore.QObject.connect(self.ListView, - QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), self.onPreviewClick) + self.ListView.addAction( + contextMenuAction( + self.ListView, u':/system/system_preview.png', + u'%s %s' % (self.trUtf8(u'&Preview'), self.PluginTextShort), + self.onPreviewClick)) + self.ListView.addAction( + contextMenuAction( + self.ListView, u':/system/system_live.png', + self.trUtf8(u'&Show Live'), self.onLiveClick)) + self.ListView.addAction( + contextMenuAction( + self.ListView, u':/system/system_add.png', + self.trUtf8(u'&Add to Service'), self.onAddClick)) + QtCore.QObject.connect( + self.ListView, QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), + self.onPreviewClick) def initialise(self): """ @@ -332,10 +310,9 @@ class MediaManagerItem(QtGui.QWidget): pass def onFileClick(self): - files = QtGui.QFileDialog.getOpenFileNames(None, - translate(self.TranslationContext, self.OnNewPrompt), - self.parent.config.get_last_dir(), - self.OnNewFileMasks) + files = QtGui.QFileDialog.getOpenFileNames( + self, self.trUtf8(self.OnNewPrompt), + self.parent.config.get_last_dir(), self.OnNewFileMasks) log.info(u'New files(s)%s', unicode(files)) if len(files) > 0: self.loadList(files) @@ -354,22 +331,24 @@ class MediaManagerItem(QtGui.QWidget): return filelist def loadList(self, list): - raise NotImplementedError( - u'MediaManagerItem.loadList needs to be defined by the plugin') + raise NotImplementedError(u'MediaManagerItem.loadList needs to be ' + u'defined by the plugin') def onNewClick(self): - raise NotImplementedError( - u'MediaManagerItem.onNewClick needs to be defined by the plugin') + raise NotImplementedError(u'MediaManagerItem.onNewClick needs to be ' + u'defined by the plugin') def onEditClick(self): - raise NotImplementedError( - u'MediaManagerItem.onEditClick needs to be defined by the plugin') + raise NotImplementedError(u'MediaManagerItem.onEditClick needs to be ' + u'defined by the plugin') def onDeleteClick(self): - raise NotImplementedError(u'MediaManagerItem.onDeleteClick needs to be defined by the plugin') + raise NotImplementedError(u'MediaManagerItem.onDeleteClick needs to ' + u'be defined by the plugin') def generateSlideData(self, item): - raise NotImplementedError(u'MediaManagerItem.generateSlideData needs to be defined by the plugin') + raise NotImplementedError(u'MediaManagerItem.generateSlideData needs ' + u'to be defined by the plugin') def onPreviewClick(self): log.debug(self.PluginTextShort + u' Preview Requested') diff --git a/openlp/core/lib/renderer.py b/openlp/core/lib/renderer.py index 572d96ade..79c58f6af 100644 --- a/openlp/core/lib/renderer.py +++ b/openlp/core/lib/renderer.py @@ -169,6 +169,8 @@ class Renderer(object): page_length = int(self._rect.height() / metrics.height() - 2 ) - 1 ave_line_width = line_width / metrics.averageCharWidth() ave_line_width = int(ave_line_width + (ave_line_width * 1)) + log.debug(u'Page Length area height %s , metrics %s , lines %s' % + (int(self._rect.height()), metrics.height(), page_length )) split_pages = [] page = [] split_lines = [] @@ -195,11 +197,17 @@ class Renderer(object): else: split_text = line[:pos] split_lines.append(split_text) - line = line[pos:] + line = line[pos:].lstrip() + #if we have more text add up to 10 spaces on the front. + if len(line) > 0 and self._theme.font_main_indentation > 0: + line = u'%s%s' % \ + (u' '[:int(self._theme.font_main_indentation)], line) #Text fits in a line now - for line in split_lines: + for count, line in enumerate(split_lines): page.append(line) - if len(page) == page_length: + #last but one line and only 2 lines to go or end of page + if (len(page) == page_length - 1 and len(split_lines) - 3 == count) or \ + len(page) == page_length: split_pages.append(page) page = [] if len(page) > 0 and page != u' ': diff --git a/openlp/core/lib/rendermanager.py b/openlp/core/lib/rendermanager.py index ce43ad9c9..50abcfd07 100644 --- a/openlp/core/lib/rendermanager.py +++ b/openlp/core/lib/rendermanager.py @@ -65,6 +65,7 @@ class RenderManager(object): self.service_theme = u'' self.global_style = u'' self.override_background = None + self.themedata = None self.save_bg_frame = None self.override_background_changed = False @@ -130,7 +131,7 @@ class RenderManager(object): self.theme = self.service_theme else: self.theme = self.global_theme - if self.theme != self.renderer.theme_name: + if self.theme != self.renderer.theme_name or self.themedata is None: log.debug(u'theme is now %s', self.theme) self.themedata = self.theme_manager.getThemeData(self.theme) self.calculate_default( diff --git a/openlp/core/lib/settingstab.py b/openlp/core/lib/settingstab.py index ef46ba781..bd9f22661 100644 --- a/openlp/core/lib/settingstab.py +++ b/openlp/core/lib/settingstab.py @@ -44,7 +44,9 @@ class SettingsTab(QtGui.QWidget): to write to when the ``save`` method is called. """ QtGui.QWidget.__init__(self) - self.tabTitle = title + self.tabTitle = self.trUtf8(title) + # Use the line below when pulling the translation template file. + #self.tabTitle = title self.setupUi() self.retranslateUi() self.initialise() diff --git a/openlp/core/lib/themexmlhandler.py b/openlp/core/lib/themexmlhandler.py index 10f2d857a..7aab3bf7a 100644 --- a/openlp/core/lib/themexmlhandler.py +++ b/openlp/core/lib/themexmlhandler.py @@ -51,7 +51,8 @@ blankthemexml=\ 30 Normal False - + 0 + Arial @@ -59,7 +60,8 @@ blankthemexml=\ 12 Normal False - + 0 + True @@ -167,7 +169,7 @@ class ThemeXML(object): self.child_element(background, u'filename', filename) def add_font(self, name, color, proportion, override, fonttype=u'main', - weight=u'Normal', italics=u'False', xpos=0, ypos=0, width=0, height=0): + weight=u'Normal', italics=u'False', indentation=0, xpos=0, ypos=0, width=0, height=0): """ Add a Font. @@ -192,6 +194,9 @@ class ThemeXML(object): ``italics`` Does the font render to italics Defaults to 0 Normal + ``indentation`` + Number of characters the wrap line is indented + ``xpos`` The X position of the text block. @@ -217,6 +222,9 @@ class ThemeXML(object): self.child_element(background, u'weight', weight) #Create italics name element self.child_element(background, u'italics', italics) + #Create indentation name element + self.child_element(background, u'indentation', unicode(indentation)) + #Create Location element element = self.theme_xml.createElement(u'location') element.setAttribute(u'override',override) diff --git a/openlp/core/test/test_mediamanageritem.py b/openlp/core/test/test_mediamanageritem.py index 369b81dba..85aab943d 100644 --- a/openlp/core/test/test_mediamanageritem.py +++ b/openlp/core/test/test_mediamanageritem.py @@ -31,31 +31,31 @@ class TestMediaManager: self.main_window.resize(200, 600) self.MediaManagerDock = QtGui.QDockWidget(self.main_window) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, - QtGui.QSizePolicy.Expanding) + QtGui.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( - self.MediaManagerDock.sizePolicy().hasHeightForWidth()) + self.MediaManagerDock.sizePolicy().hasHeightForWidth()) self.MediaManagerDock.setSizePolicy(sizePolicy) icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap(u':/system/system_mediamanager.png'), - QtGui.QIcon.Normal, QtGui.QIcon.Off) + QtGui.QIcon.Normal, QtGui.QIcon.Off) self.MediaManagerDock.setWindowIcon(icon) self.MediaManagerDock.setFloating(False) self.MediaManagerContents = QtGui.QWidget() sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, - QtGui.QSizePolicy.Expanding) + QtGui.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( - self.MediaManagerContents.sizePolicy().hasHeightForWidth()) + self.MediaManagerContents.sizePolicy().hasHeightForWidth()) self.MediaManagerContents.setSizePolicy(sizePolicy) self.MediaManagerLayout = QtGui.QHBoxLayout(self.MediaManagerContents) self.MediaManagerLayout.setContentsMargins(0, 2, 0, 0) self.MediaToolBox = QtGui.QToolBox(self.MediaManagerContents) self.MediaManagerDock.setWidget(self.MediaManagerContents) self.main_window.addDockWidget(QtCore.Qt.DockWidgetArea(1), - self.MediaManagerDock) + self.MediaManagerDock) self.MediaManagerLayout.addWidget(self.MediaToolBox) def test1(self): log=logging.getLogger(u'test1') @@ -68,10 +68,10 @@ class TestMediaManager: i1.addToolbarButton(u'Test1', u'Test1', None) i2.addToolbar() i2.addToolbarButton(u'Test2', u'Test2', None) - self.MediaToolBox.setItemText(self.MediaToolBox.indexOf(i1), - translate(u'main_window', u'Item1')) - self.MediaToolBox.setItemText(self.MediaToolBox.indexOf(i2), - translate(u'main_window', u'Item2')) + self.MediaToolBox.setItemText( + self.MediaToolBox.indexOf(i1), self.trUtf8(u'Item1')) + self.MediaToolBox.setItemText( + self.MediaToolBox.indexOf(i2), self.trUtf8(u'Item2')) log.info(u'Show window') self.main_window.show() log.info(u'End') diff --git a/openlp/core/ui/about.py b/openlp/core/ui/about.py index 633e43344..c1c9006c2 100644 --- a/openlp/core/ui/about.py +++ b/openlp/core/ui/about.py @@ -24,7 +24,7 @@ from PyQt4 import QtCore, QtGui -from openlp.core.lib import translate, buildIcon +from openlp.core.lib import buildIcon class AboutForm(QtGui.QDialog): """ @@ -94,6 +94,9 @@ class AboutForm(QtGui.QDialog): self.License3Label.setWordWrap(True) self.License3Label.setObjectName(u'License3Label') self.LicenseTabLayout.addWidget(self.License3Label) + self.LicenseSpacer = QtGui.QSpacerItem(20, 40, + QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) + self.LicenseTabLayout.addItem(self.LicenseSpacer) self.AboutNotebook.addTab(self.LicenseTab, u'License') self.CreditsTab = QtGui.QWidget() self.CreditsTab.setObjectName(u'CreditsTab') @@ -138,21 +141,31 @@ class AboutForm(QtGui.QDialog): """ Set up translation """ - AboutForm.setWindowTitle(translate(u'AboutDialog', u'About openlp.org')) - self.CopyrightLabel.setText(translate(u'AboutDialog', - u'Copyright (c) 2004-2009 openlp.org Foundation')) - self.AboutAuthors.setText(translate(u'AboutDialog', - u'openlp.org is written and maintained by volunteers. If you would like to see more free Christian software being written, please consider contributing by using the button below.')) - self.License1Label.setText(translate(u'AboutDialog', - u'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; either version 2 of the License, or (at your option) any later version.')) - self.License2Label.setText(translate(u'AboutDialog', - u'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.')) - self.License3Label.setText(translate(u'AboutDialog', - u'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.')) + AboutForm.setWindowTitle(self.trUtf8(u'About openlp.org')) + self.CopyrightLabel.setText( + self.trUtf8(u'Copyright \xa9 2004-2009 openlp.org Foundation')) + self.AboutAuthors.setText(self.trUtf8( + u'openlp.org is written and maintained by volunteers. If you would ' + u'like to see more free Christian software being written, please ' + u'consider contributing by using the button below.')) + self.License1Label.setText(self.trUtf8( + u'This program is free software; you can redistribute it and/or ' + u'modify it under the terms of the GNU General Public License as ' + u'published by the Free Software Foundation; either version 2 of ' + u'the License, or (at your option) any later version.')) + self.License2Label.setText(self.trUtf8( + u'You should have received a copy of the GNU General Public ' + u'License along with this program; if not, write to the Free ' + u'Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, ' + u'MA 02111-1307 USA.')) + self.License3Label.setText(self.trUtf8( + u'This program is distributed in the hope that it will be useful, ' + u'but WITHOUT ANY WARRANTY; without even the implied warranty of ' + u'MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ' + u'General Public License for more details.')) self.AboutNotebook.setTabText( - self.AboutNotebook.indexOf(self.LicenseTab), - translate(u'AboutDialog', u'License')) - self.CreditsTextEdit.setPlainText(translate(u'AboutDialog', + self.AboutNotebook.indexOf(self.LicenseTab), self.trUtf8(u'License')) + self.CreditsTextEdit.setPlainText(self.trUtf8( u'Project Lead\n' u' Raoul \"superfly\" Snyman\n' u'\n' @@ -165,11 +178,10 @@ class AboutForm(QtGui.QDialog): u' Jon \"Meths\" Tibble\n' u' Carsten \"catini\" Tingaard')) self.AboutNotebook.setTabText( - self.AboutNotebook.indexOf(self.CreditsTab), - translate(u'AboutDialog', u'Credits')) - self.ContributeButton.setText(translate(u'AboutDialog', u'Contribute')) - self.CloseButton.setText(translate(u'AboutDialog', u'Close')) - self.extContributeItem.setText(translate(u'AboutDialog', u'&Contribute')) + self.AboutNotebook.indexOf(self.CreditsTab), self.trUtf8(u'Credits')) + self.ContributeButton.setText(self.trUtf8(u'Contribute')) + self.CloseButton.setText(self.trUtf8(u'Close')) + self.extContributeItem.setText(self.trUtf8(u'&Contribute')) def onContributeButtonClicked(self): """ @@ -178,3 +190,4 @@ class AboutForm(QtGui.QDialog): import webbrowser url = "http://www.openlp.org/en/documentation/introduction/contributing.html" webbrowser.open_new(url) + diff --git a/openlp/core/ui/alertform.py b/openlp/core/ui/alertform.py index fdc6066d1..9c069bd1c 100644 --- a/openlp/core/ui/alertform.py +++ b/openlp/core/ui/alertform.py @@ -24,7 +24,7 @@ import logging from PyQt4 import QtCore, QtGui -from openlp.core.lib import translate, buildIcon +from openlp.core.lib import buildIcon class AlertForm(QtGui.QDialog): global log @@ -92,10 +92,10 @@ class AlertForm(QtGui.QDialog): QtCore.QMetaObject.connectSlotsByName(AlertForm) def retranslateUi(self, AlertForm): - AlertForm.setWindowTitle(translate(u'AlertForm', u'Alert Message')) - self.AlertEntryLabel.setText(translate(u'AlertForm', u'Alert Text:')) - self.DisplayButton.setText(translate(u'AlertForm', u'Display')) - self.CancelButton.setText(translate(u'AlertForm', u'Cancel')) + AlertForm.setWindowTitle(self.trUtf8(u'Alert Message')) + self.AlertEntryLabel.setText(self.trUtf8(u'Alert Text:')) + self.DisplayButton.setText(self.trUtf8(u'Display')) + self.CancelButton.setText(self.trUtf8(u'Cancel')) def onDisplayClicked(self): self.parent.mainDisplay.displayAlert(self.AlertEntryEditItem.text()) diff --git a/openlp/core/ui/alertstab.py b/openlp/core/ui/alertstab.py index 251033966..e7ce0a013 100644 --- a/openlp/core/ui/alertstab.py +++ b/openlp/core/ui/alertstab.py @@ -24,17 +24,18 @@ from PyQt4 import QtCore, QtGui -from openlp.core.lib import SettingsTab, translate +from openlp.core.lib import SettingsTab class AlertsTab(SettingsTab): """ AlertsTab is the alerts settings tab in the settings dialog. """ def __init__(self): + SettingsTab.__init__(self, u'Alerts', u'Alerts') + # Use the line below when pulling the translation template file. + #SettingsTab.__init__(self, self.trUtf8(u'Alerts'), u'Alerts') self.font_color = '#ffffff' self.bg_color = '#660000' - SettingsTab.__init__( - self, translate(u'AlertsTab', u'Alerts'), u'Alerts') def setupUi(self): self.setObjectName(u'AlertsTab') @@ -147,16 +148,14 @@ class AlertsTab(SettingsTab): QtCore.SIGNAL(u'valueChanged(int)'), self.onTimeoutSpinBoxChanged) def retranslateUi(self): - self.FontGroupBox.setTitle(translate(u'AlertsTab', u'Font')) - self.FontLabel.setText(translate(u'AlertsTab', u'Font Name:')) - self.FontColorLabel.setText(translate(u'AlertsTab', u'Font Color:')) - self.BackgroundColorLabel.setText( - translate(u'AlertsTab', u'Background Color:')) - self.TimeoutLabel.setText(translate(u'AlertsTab', u'Alert timeout:')) - self.TimeoutSpinBox.setSuffix(translate(u'AlertsTab', u's')) - self.PreviewGroupBox.setTitle(translate(u'AlertsTab', u'Preview')) - self.FontPreview.setText( - translate(u'AlertsTab', u'openlp.org 2.0 rocks!')) + self.FontGroupBox.setTitle(self.trUtf8(u'Font')) + self.FontLabel.setText(self.trUtf8(u'Font Name:')) + self.FontColorLabel.setText(self.trUtf8(u'Font Color:')) + self.BackgroundColorLabel.setText(self.trUtf8(u'Background Color:')) + self.TimeoutLabel.setText(self.trUtf8(u'Alert timeout:')) + self.TimeoutSpinBox.setSuffix(self.trUtf8(u's')) + self.PreviewGroupBox.setTitle(self.trUtf8(u'Preview')) + self.FontPreview.setText(self.trUtf8(u'openlp.org 2.0 rocks!')) def onBackgroundColorButtonClicked(self): self.bg_color = QtGui.QColorDialog.getColor( diff --git a/openlp/core/ui/amendthemedialog.py b/openlp/core/ui/amendthemedialog.py index 63ffea5d8..1a59e4fc3 100644 --- a/openlp/core/ui/amendthemedialog.py +++ b/openlp/core/ui/amendthemedialog.py @@ -23,7 +23,7 @@ ############################################################################### from PyQt4 import QtCore, QtGui -from openlp.core.lib import translate, buildIcon +from openlp.core.lib import buildIcon class Ui_AmendThemeDialog(object): def setupUi(self, AmendThemeDialog): @@ -177,6 +177,16 @@ class Ui_AmendThemeDialog(object): self.FontMainWeightLabel.setObjectName("FontMainWeightLabel") self.MainFontLayout.setWidget(3, QtGui.QFormLayout.LabelRole, self.FontMainWeightLabel) self.MainLeftLayout.addWidget(self.FontMainGroupBox) + self.FontMainWrapIndentationLabel = QtGui.QLabel(self.FontMainGroupBox) + self.FontMainWrapIndentationLabel.setObjectName("FontMainWrapIndentationLabel") + self.MainFontLayout.setWidget(4, QtGui.QFormLayout.LabelRole, self.FontMainWrapIndentationLabel) + self.FontMainLineSpacingSpinBox = QtGui.QSpinBox(self.FontMainGroupBox) + self.FontMainLineSpacingSpinBox.setObjectName("FontMainLineSpacingSpinBox") + self.FontMainLineSpacingSpinBox.setMaximum(10) + self.MainFontLayout.setWidget(4, QtGui.QFormLayout.FieldRole, self.FontMainLineSpacingSpinBox) + self.FontMainLinesPageLabel = QtGui.QLabel(self.FontMainGroupBox) + self.FontMainLinesPageLabel.setObjectName("FontMainLinesPageLabel") + self.MainFontLayout.setWidget(5, QtGui.QFormLayout.LabelRole, self.FontMainLinesPageLabel) spacerItem1 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.MainLeftLayout.addItem(spacerItem1) self.FontMainLayout.addWidget(self.MainLeftWidget) @@ -528,7 +538,9 @@ class Ui_AmendThemeDialog(object): AmendThemeDialog.setTabOrder(self.GradientComboBox, self.FontMainComboBox) AmendThemeDialog.setTabOrder(self.FontMainComboBox, self.FontMainColorPushButton) AmendThemeDialog.setTabOrder(self.FontMainColorPushButton, self.FontMainSizeSpinBox) - AmendThemeDialog.setTabOrder(self.FontMainSizeSpinBox, self.FontMainDefaultCheckBox) + AmendThemeDialog.setTabOrder(self.FontMainSizeSpinBox, self.FontMainWeightComboBox) + AmendThemeDialog.setTabOrder(self.FontMainWeightComboBox, self.FontMainLineSpacingSpinBox) + AmendThemeDialog.setTabOrder(self.FontMainLineSpacingSpinBox, self.FontMainDefaultCheckBox) AmendThemeDialog.setTabOrder(self.FontMainDefaultCheckBox, self.FontMainXSpinBox) AmendThemeDialog.setTabOrder(self.FontMainXSpinBox, self.FontMainYSpinBox) AmendThemeDialog.setTabOrder(self.FontMainYSpinBox, self.FontMainWidthSpinBox) @@ -536,7 +548,8 @@ class Ui_AmendThemeDialog(object): AmendThemeDialog.setTabOrder(self.FontMainHeightSpinBox, self.FontFooterComboBox) AmendThemeDialog.setTabOrder(self.FontFooterComboBox, self.FontFooterColorPushButton) AmendThemeDialog.setTabOrder(self.FontFooterColorPushButton, self.FontFooterSizeSpinBox) - AmendThemeDialog.setTabOrder(self.FontFooterSizeSpinBox, self.FontFooterDefaultCheckBox) + AmendThemeDialog.setTabOrder(self.FontFooterSizeSpinBox, self.FontFooterWeightComboBox) + AmendThemeDialog.setTabOrder(self.FontFooterWeightComboBox, self.FontFooterDefaultCheckBox) AmendThemeDialog.setTabOrder(self.FontFooterDefaultCheckBox, self.FontFooterXSpinBox) AmendThemeDialog.setTabOrder(self.FontFooterXSpinBox, self.FontFooterYSpinBox) AmendThemeDialog.setTabOrder(self.FontFooterYSpinBox, self.FontFooterWidthSpinBox) @@ -549,78 +562,87 @@ class Ui_AmendThemeDialog(object): AmendThemeDialog.setTabOrder(self.HorizontalComboBox, self.VerticalComboBox) def retranslateUi(self, AmendThemeDialog): - AmendThemeDialog.setWindowTitle(translate(u'AmendThemeDialog', u'Theme Maintenance')) - self.ThemeNameLabel.setText(translate(u'AmendThemeDialog', u'Theme Name:')) - self.BackgroundLabel.setText(translate(u'AmendThemeDialog', u'Background:')) - self.BackgroundComboBox.setItemText(0, translate(u'AmendThemeDialog', u'Opaque')) - self.BackgroundComboBox.setItemText(1, translate(u'AmendThemeDialog', u'Transparent')) - self.BackgroundTypeLabel.setText(translate(u'AmendThemeDialog', u'Background Type:')) - self.BackgroundTypeComboBox.setItemText(0, translate(u'AmendThemeDialog', u'Solid Color')) - self.BackgroundTypeComboBox.setItemText(1, translate(u'AmendThemeDialog', u'Gradient')) - self.BackgroundTypeComboBox.setItemText(2, translate(u'AmendThemeDialog', u'Image')) - self.Color1Label.setText(translate(u'AmendThemeDialog', u'')) - self.Color2Label.setText(translate(u'AmendThemeDialog', u'')) - self.ImageLabel.setText(translate(u'AmendThemeDialog', u'Image:')) - self.GradientLabel.setText(translate(u'AmendThemeDialog', u'Gradient :')) - self.GradientComboBox.setItemText(0, translate(u'AmendThemeDialog', u'Horizontal')) - self.GradientComboBox.setItemText(1, translate(u'AmendThemeDialog', u'Vertical')) - self.GradientComboBox.setItemText(2, translate(u'AmendThemeDialog', u'Circular')) - self.ThemeTabWidget.setTabText(self.ThemeTabWidget.indexOf(self.BackgroundTab), translate(u'AmendThemeDialog', u'Background')) - self.FontMainGroupBox.setTitle(translate(u'AmendThemeDialog', u'Main Font')) - self.FontMainlabel.setText(translate(u'AmendThemeDialog', u'Font:')) - self.FontMainColorLabel.setText(translate(u'AmendThemeDialog', u'Font Color:')) - self.FontMainSize.setText(translate(u'AmendThemeDialog', u'Size:')) - self.FontMainSizeSpinBox.setSuffix(translate(u'AmendThemeDialog', u'pt')) - self.FontMainWeightComboBox.setItemText(0, translate("AmendThemeDialog", u'Normal')) - self.FontMainWeightComboBox.setItemText(1, translate("AmendThemeDialog", u'Bold')) - self.FontMainWeightComboBox.setItemText(2, translate("AmendThemeDialog", u'Italics')) - self.FontMainWeightComboBox.setItemText(3, translate("AmendThemeDialog", u'Bold/Italics')) - self.FontMainWeightLabel.setText(translate("AmendThemeDialog", u'Font Weight:')) - self.MainLocationGroupBox.setTitle(translate(u'AmendThemeDialog', u'Display Location')) - self.DefaultLocationLabel.setText(translate(u'AmendThemeDialog', u'Use Default Location:')) - self.FontMainXLabel.setText(translate(u'AmendThemeDialog', u'X Position:')) - self.FontMainYLabel.setText(translate(u'AmendThemeDialog', u'Y Position:')) - self.FontMainWidthLabel.setText(translate(u'AmendThemeDialog', u'Width:')) - self.FontMainHeightLabel.setText(translate(u'AmendThemeDialog', u'Height:')) - self.FontMainXSpinBox.setSuffix(translate(u'AmendThemeDialog', u'px')) - self.FontMainYSpinBox.setSuffix(translate(u'AmendThemeDialog', u'px')) - self.FontMainWidthSpinBox.setSuffix(translate(u'AmendThemeDialog', u'px')) - self.FontMainHeightSpinBox.setSuffix(translate(u'AmendThemeDialog', u'px')) - self.ThemeTabWidget.setTabText(self.ThemeTabWidget.indexOf(self.FontMainTab), translate(u'AmendThemeDialog', u'Font Main')) - self.FooterFontGroupBox.setTitle(translate(u'AmendThemeDialog', u'Footer Font')) - self.FontFooterLabel.setText(translate(u'AmendThemeDialog', u'Font:')) - self.FontFooterColorLabel.setText(translate(u'AmendThemeDialog', u'Font Color:')) - self.FontFooterSizeLabel.setText(translate(u'AmendThemeDialog', u'Size:')) - self.FontFooterSizeSpinBox.setSuffix(translate(u'AmendThemeDialog', u'pt')) - self.FontFooterWeightComboBox.setItemText(0, translate("AmendThemeDialog", u'Normal')) - self.FontFooterWeightComboBox.setItemText(1, translate("AmendThemeDialog", u'Bold')) - self.FontFooterWeightComboBox.setItemText(2, translate("AmendThemeDialog", u'Italics')) - self.FontFooterWeightComboBox.setItemText(3, translate("AmendThemeDialog", u'Bold/Italics')) - self.FontFooterWeightLabel.setText(translate("AmendThemeDialog", u'Font Weight:')) - self.LocationFooterGroupBox.setTitle(translate(u'AmendThemeDialog', u'Display Location')) - self.FontFooterDefaultLabel.setText(translate(u'AmendThemeDialog', u'Use Default Location:')) - self.FontFooterXLabel.setText(translate(u'AmendThemeDialog', u'X Position:')) - self.FontFooterYLabel.setText(translate(u'AmendThemeDialog', u'Y Position:')) - self.FontFooterWidthLabel.setText(translate(u'AmendThemeDialog', u'Width:')) - self.FontFooterHeightLabel.setText(translate(u'AmendThemeDialog', u'Height:')) - self.FontFooterXSpinBox.setSuffix(translate(u'AmendThemeDialog', u'px')) - self.FontFooterYSpinBox.setSuffix(translate(u'AmendThemeDialog', u'px')) - self.FontFooterWidthSpinBox.setSuffix(translate(u'AmendThemeDialog', u'px')) - self.FontFooterHeightSpinBox.setSuffix(translate(u'AmendThemeDialog', u'px')) - self.ThemeTabWidget.setTabText(self.ThemeTabWidget.indexOf(self.FontFooterTab), translate(u'AmendThemeDialog', u'Font Footer')) - self.ShadowGroupBox.setTitle(translate(u'AmendThemeDialog', u'Shadow && Outline')) - self.OutlineColorLabel.setText(translate(u'AmendThemeDialog', u'Outline Color:')) - self.OutlineEnabledLabel.setText(translate(u'AmendThemeDialog', u'Show Outline:')) - self.ShadowColorLabel.setText(translate(u'AmendThemeDialog', u'Shadow Color:')) - self.ShadowEnabledLabel.setText(translate(u'AmendThemeDialog', u'Show Shadow:')) - self.AlignmentGroupBox.setTitle(translate(u'AmendThemeDialog', u'Alignment')) - self.HorizontalLabel.setText(translate(u'AmendThemeDialog', u'Horizontal Align:')) - self.HorizontalComboBox.setItemText(0, translate(u'AmendThemeDialog', u'Left')) - self.HorizontalComboBox.setItemText(1, translate(u'AmendThemeDialog', u'Right')) - self.HorizontalComboBox.setItemText(2, translate(u'AmendThemeDialog', u'Center')) - self.VerticalLabel.setText(translate(u'AmendThemeDialog', u'Vertical Align:')) - self.VerticalComboBox.setItemText(0, translate(u'AmendThemeDialog', u'Top')) - self.VerticalComboBox.setItemText(1, translate(u'AmendThemeDialog', u'Middle')) - self.VerticalComboBox.setItemText(2, translate(u'AmendThemeDialog', u'Bottom')) - self.ThemeTabWidget.setTabText(self.ThemeTabWidget.indexOf(self.OtherOptionsTab), translate(u'AmendThemeDialog', u'Other Options')) - self.PreviewGroupBox.setTitle(translate(u'AmendThemeDialog', u'Preview')) + AmendThemeDialog.setWindowTitle(self.trUtf8(u'Theme Maintenance')) + self.ThemeNameLabel.setText(self.trUtf8(u'Theme Name:')) + self.BackgroundLabel.setText(self.trUtf8(u'Background:')) + self.BackgroundComboBox.setItemText(0, self.trUtf8(u'Opaque')) + self.BackgroundComboBox.setItemText(1, self.trUtf8(u'Transparent')) + self.BackgroundTypeLabel.setText(self.trUtf8(u'Background Type:')) + self.BackgroundTypeComboBox.setItemText(0, self.trUtf8(u'Solid Color')) + self.BackgroundTypeComboBox.setItemText(1, self.trUtf8(u'Gradient')) + self.BackgroundTypeComboBox.setItemText(2, self.trUtf8(u'Image')) + self.Color1Label.setText(self.trUtf8(u'')) + self.Color2Label.setText(self.trUtf8(u'')) + self.ImageLabel.setText(self.trUtf8(u'Image:')) + self.GradientLabel.setText(self.trUtf8(u'Gradient :')) + self.GradientComboBox.setItemText(0, self.trUtf8(u'Horizontal')) + self.GradientComboBox.setItemText(1, self.trUtf8(u'Vertical')) + self.GradientComboBox.setItemText(2, self.trUtf8(u'Circular')) + self.ThemeTabWidget.setTabText( + self.ThemeTabWidget.indexOf(self.BackgroundTab), + self.trUtf8(u'Background')) + self.FontMainGroupBox.setTitle(self.trUtf8(u'Main Font')) + self.FontMainlabel.setText(self.trUtf8(u'Font:')) + self.FontMainColorLabel.setText(self.trUtf8(u'Font Color:')) + self.FontMainSize.setText(self.trUtf8(u'Size:')) + self.FontMainSizeSpinBox.setSuffix(self.trUtf8(u'pt')) + self.FontMainWrapIndentationLabel.setText(self.trUtf8(u'Wrap Indentation')) + self.FontMainWeightComboBox.setItemText(0, self.trUtf8(u'Normal')) + self.FontMainWeightComboBox.setItemText(1, self.trUtf8(u'Bold')) + self.FontMainWeightComboBox.setItemText(2, self.trUtf8(u'Italics')) + self.FontMainWeightComboBox.setItemText(3, self.trUtf8(u'Bold/Italics')) + self.FontMainWeightLabel.setText(self.trUtf8(u'Font Weight:')) + self.MainLocationGroupBox.setTitle(self.trUtf8(u'Display Location')) + self.DefaultLocationLabel.setText(self.trUtf8(u'Use Default Location:')) + self.FontMainXLabel.setText(self.trUtf8(u'X Position:')) + self.FontMainYLabel.setText(self.trUtf8(u'Y Position:')) + self.FontMainWidthLabel.setText(self.trUtf8(u'Width:')) + self.FontMainHeightLabel.setText(self.trUtf8(u'Height:')) + self.FontMainXSpinBox.setSuffix(self.trUtf8(u'px')) + self.FontMainYSpinBox.setSuffix(self.trUtf8(u'px')) + self.FontMainWidthSpinBox.setSuffix(self.trUtf8(u'px')) + self.FontMainHeightSpinBox.setSuffix(self.trUtf8(u'px')) + self.ThemeTabWidget.setTabText( + self.ThemeTabWidget.indexOf(self.FontMainTab), + self.trUtf8(u'Font Main')) + self.FooterFontGroupBox.setTitle(self.trUtf8(u'Footer Font')) + self.FontFooterLabel.setText(self.trUtf8(u'Font:')) + self.FontFooterColorLabel.setText(self.trUtf8(u'Font Color:')) + self.FontFooterSizeLabel.setText(self.trUtf8(u'Size:')) + self.FontFooterSizeSpinBox.setSuffix(self.trUtf8(u'pt')) + self.FontFooterWeightComboBox.setItemText(0, self.trUtf8(u'Normal')) + self.FontFooterWeightComboBox.setItemText(1, self.trUtf8(u'Bold')) + self.FontFooterWeightComboBox.setItemText(2, self.trUtf8(u'Italics')) + self.FontFooterWeightComboBox.setItemText(3, self.trUtf8(u'Bold/Italics')) + self.FontFooterWeightLabel.setText(self.trUtf8(u'Font Weight:')) + self.LocationFooterGroupBox.setTitle(self.trUtf8(u'Display Location')) + self.FontFooterDefaultLabel.setText(self.trUtf8(u'Use Default Location:')) + self.FontFooterXLabel.setText(self.trUtf8(u'X Position:')) + self.FontFooterYLabel.setText(self.trUtf8(u'Y Position:')) + self.FontFooterWidthLabel.setText(self.trUtf8(u'Width:')) + self.FontFooterHeightLabel.setText(self.trUtf8(u'Height:')) + self.FontFooterXSpinBox.setSuffix(self.trUtf8(u'px')) + self.FontFooterYSpinBox.setSuffix(self.trUtf8(u'px')) + self.FontFooterWidthSpinBox.setSuffix(self.trUtf8(u'px')) + self.FontFooterHeightSpinBox.setSuffix(self.trUtf8(u'px')) + self.ThemeTabWidget.setTabText( + self.ThemeTabWidget.indexOf(self.FontFooterTab), + self.trUtf8(u'Font Footer')) + self.ShadowGroupBox.setTitle(self.trUtf8(u'Shadow && Outline')) + self.OutlineColorLabel.setText(self.trUtf8(u'Outline Color:')) + self.OutlineEnabledLabel.setText(self.trUtf8(u'Show Outline:')) + self.ShadowColorLabel.setText(self.trUtf8(u'Shadow Color:')) + self.ShadowEnabledLabel.setText(self.trUtf8(u'Show Shadow:')) + self.AlignmentGroupBox.setTitle(self.trUtf8(u'Alignment')) + self.HorizontalLabel.setText(self.trUtf8(u'Horizontal Align:')) + self.HorizontalComboBox.setItemText(0, self.trUtf8(u'Left')) + self.HorizontalComboBox.setItemText(1, self.trUtf8(u'Right')) + self.HorizontalComboBox.setItemText(2, self.trUtf8(u'Center')) + self.VerticalLabel.setText(self.trUtf8(u'Vertical Align:')) + self.VerticalComboBox.setItemText(0, self.trUtf8(u'Top')) + self.VerticalComboBox.setItemText(1, self.trUtf8(u'Middle')) + self.VerticalComboBox.setItemText(2, self.trUtf8(u'Bottom')) + self.ThemeTabWidget.setTabText( + self.ThemeTabWidget.indexOf(self.OtherOptionsTab), + self.trUtf8(u'Other Options')) + self.PreviewGroupBox.setTitle(self.trUtf8(u'Preview')) diff --git a/openlp/core/ui/amendthemeform.py b/openlp/core/ui/amendthemeform.py index 8ff978b68..3a30a0d18 100644 --- a/openlp/core/ui/amendthemeform.py +++ b/openlp/core/ui/amendthemeform.py @@ -28,7 +28,7 @@ import os.path from PyQt4 import QtCore, QtGui -from openlp.core.lib import ThemeXML, file_to_xml, translate +from openlp.core.lib import ThemeXML, file_to_xml from amendthemedialog import Ui_AmendThemeDialog log = logging.getLogger(u'AmendThemeForm') @@ -100,6 +100,9 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): QtCore.QObject.connect(self.FontMainHeightSpinBox, QtCore.SIGNAL(u'editingFinished()'), self.onFontMainHeightSpinBoxChanged) + QtCore.QObject.connect(self.FontMainLineSpacingSpinBox, + QtCore.SIGNAL(u'editingFinished()'), + self.onFontMainLineSpacingSpinBoxChanged) QtCore.QObject.connect(self.FontFooterDefaultCheckBox, QtCore.SIGNAL(u'stateChanged(int)'), self.onFontFooterDefaultCheckBoxChanged) @@ -150,6 +153,7 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): unicode(self.theme.font_main_override), u'main', unicode(self.theme.font_main_weight), unicode(self.theme.font_main_italics), + unicode(self.theme.font_main_indentation), unicode(self.theme.font_main_x), unicode(self.theme.font_main_y), unicode(self.theme.font_main_width), @@ -160,6 +164,7 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): unicode(self.theme.font_footer_override), u'footer', unicode(self.theme.font_footer_weight), unicode(self.theme.font_footer_italics), + 0, unicode(self.theme.font_footer_x), unicode(self.theme.font_footer_y), unicode(self.theme.font_footer_width), @@ -187,13 +192,15 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): self.theme.parse(xml) self.theme.extend_image_filename(self.path) self.thememanager.cleanTheme(self.theme) + # Stop the initial screen setup generating 1 preview per field! self.allowPreview = False self.paintUi(self.theme) self.allowPreview = True self.previewTheme(self.theme) def onImageToolButtonClicked(self): - filename = QtGui.QFileDialog.getOpenFileName(self, 'Open file') + filename = QtGui.QFileDialog.getOpenFileName( + self, self.trUtf8('Open file')) if filename != u'': self.ImageLineEdit.setText(filename) self.theme.background_filename = filename @@ -252,6 +259,8 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): self.FontMainWidthSpinBox.setValue(int(self.theme.font_main_width)) self.FontMainHeightSpinBox.setValue(int( \ self.theme.font_main_height)) + self.FontMainLineSpacingSpinBox.setValue(int( \ + self.theme.font_main_indentation)) self.stateChanging(self.theme) self.previewTheme(self.theme) @@ -270,6 +279,11 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): self.theme.font_main_width = self.FontMainWidthSpinBox.value() self.previewTheme(self.theme) + def onFontMainLineSpacingSpinBoxChanged(self): + if self.theme.font_main_indentation != self.FontMainLineSpacingSpinBox.value(): + self.theme.font_main_indentation = self.FontMainLineSpacingSpinBox.value() + self.previewTheme(self.theme) + def onFontMainHeightSpinBoxChanged(self): if self.theme.font_main_height != self.FontMainHeightSpinBox.value(): self.theme.font_main_height = self.FontMainHeightSpinBox.value() @@ -498,7 +512,7 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): self.FontMainWeightComboBox.setCurrentIndex(2) else: self.FontMainWeightComboBox.setCurrentIndex(3) - + self.FontMainLineSpacingSpinBox.setValue(int(self.theme.font_main_indentation)) self.FontMainXSpinBox.setValue(int(self.theme.font_main_x)) self.FontMainYSpinBox.setValue(int(self.theme.font_main_y)) self.FontMainWidthSpinBox.setValue(int(self.theme.font_main_width)) @@ -579,8 +593,7 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): if theme.background_type == u'solid': self.Color1PushButton.setStyleSheet( u'background-color: %s' % unicode(theme.background_color)) - self.Color1Label.setText(translate(u'ThemeManager', - u'Background Color:')) + self.Color1Label.setText(self.trUtf8(u'Background Color:')) self.Color1Label.setVisible(True) self.Color1PushButton.setVisible(True) self.Color2Label.setVisible(False) @@ -595,10 +608,8 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): % unicode(theme.background_startColor)) self.Color2PushButton.setStyleSheet(u'background-color: %s' \ % unicode(theme.background_endColor)) - self.Color1Label.setText(translate(u'ThemeManager', - u'First Color:')) - self.Color2Label.setText(translate(u'ThemeManager', - u'Second Color:')) + self.Color1Label.setText(self.trUtf8(u'First Color:')) + self.Color2Label.setText(self.trUtf8(u'Second Color:')) self.Color1Label.setVisible(True) self.Color1PushButton.setVisible(True) self.Color2Label.setVisible(True) @@ -653,5 +664,20 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): def previewTheme(self, theme): if self.allowPreview: + #calculate main number of rows + main_weight = 50 + if self.theme.font_main_weight == u'Bold': + main_weight = 75 + mainFont = QtGui.QFont(self.theme.font_main_name, + int(self.theme.font_main_proportion), # size + int(main_weight), # weight + self.theme.font_main_italics)# italic + mainFont.setPixelSize(int(self.theme.font_main_proportion)) + metrics = QtGui.QFontMetrics(mainFont) + page_length = (int(self.FontMainHeightSpinBox.value()) / metrics.height() - 2 ) - 1 + log.debug(u'Page Length area height %s , metrics %s , lines %s' % + (int(self.FontMainHeightSpinBox.value()), metrics.height(), page_length )) + self.FontMainLinesPageLabel.setText( + self.trUtf8((u'Slide Height is %s rows') % page_length)) frame = self.thememanager.generateImage(theme) self.ThemePreview.setPixmap(QtGui.QPixmap.fromImage(frame)) diff --git a/openlp/core/ui/generaltab.py b/openlp/core/ui/generaltab.py index 0c3af4c5d..98479af3e 100644 --- a/openlp/core/ui/generaltab.py +++ b/openlp/core/ui/generaltab.py @@ -24,7 +24,7 @@ from PyQt4 import QtCore, QtGui -from openlp.core.lib import SettingsTab, translate, str_to_bool +from openlp.core.lib import SettingsTab, str_to_bool class GeneralTab(SettingsTab): """ @@ -32,7 +32,9 @@ class GeneralTab(SettingsTab): """ def __init__(self, screen_list): self.screen_list = screen_list - SettingsTab.__init__(self, translate(u'GeneralTab', u'General'), u'General') + SettingsTab.__init__(self, u'General', u'General') + # Use this line when pulling the translation template + #SettingsTab.__init__(self, self.trUtf8(u'General'), u'General') def setupUi(self): self.setObjectName(u'GeneralTab') @@ -131,16 +133,16 @@ class GeneralTab(SettingsTab): QtCore.SIGNAL(u'editingFinished()'), self.onPasswordEditLostFocus) def retranslateUi(self): - self.MonitorGroupBox.setTitle(translate(u'GeneralTab', u'Monitors')) - self.MonitorLabel.setText(translate(u'GeneralTab', u'Select monitor for output display:')) - self.StartupGroupBox.setTitle(translate(u'GeneralTab', u'Application Startup')) - self.WarningCheckBox.setText(translate(u'GeneralTab', u'Show blank screen warning')) - self.AutoOpenCheckBox.setText(translate(u'GeneralTab', u'Automatically open the last service')) - self.ShowSplashCheckBox.setText(translate(u'GeneralTab', u'Show the splash screen')) - self.CCLIGroupBox.setTitle(translate(u'GeneralTab', u'CCLI Details')) - self.NumberLabel.setText(translate(u'GeneralTab', u'CCLI Number:')) - self.UsernameLabel.setText(translate(u'GeneralTab', u'SongSelect Username:')) - self.PasswordLabel.setText(translate(u'GeneralTab', u'SongSelect Password:')) + self.MonitorGroupBox.setTitle(self.trUtf8(u'Monitors')) + self.MonitorLabel.setText(self.trUtf8(u'Select monitor for output display:')) + self.StartupGroupBox.setTitle(self.trUtf8(u'Application Startup')) + self.WarningCheckBox.setText(self.trUtf8(u'Show blank screen warning')) + self.AutoOpenCheckBox.setText(self.trUtf8(u'Automatically open the last service')) + self.ShowSplashCheckBox.setText(self.trUtf8(u'Show the splash screen')) + self.CCLIGroupBox.setTitle(self.trUtf8(u'CCLI Details')) + self.NumberLabel.setText(self.trUtf8(u'CCLI Number:')) + self.UsernameLabel.setText(self.trUtf8(u'SongSelect Username:')) + self.PasswordLabel.setText(self.trUtf8(u'SongSelect Password:')) def onMonitorComboBoxChanged(self): self.MonitorNumber = self.MonitorComboBox.currentIndex() @@ -165,11 +167,9 @@ class GeneralTab(SettingsTab): def load(self): for screen in self.screen_list: - screen_name = translate(u'GeneralTab', u'Screen') + u' ' + \ - unicode(screen[u'number'] + 1) + screen_name = u'%s %d' % (self.trUtf8(u'Screen'), screen[u'number'] + 1) if screen[u'primary']: - screen_name = screen_name + u' (' + \ - translate(u'GeneralTab', u'primary') + u')' + screen_name = u'%s (%s)' % (self.trUtf8(u'primary'), screen_name) self.MonitorComboBox.addItem(screen_name) # Get the configs self.MonitorNumber = int(self.config.get_config(u'Monitor', u'0')) diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 601cab59a..2f58ee3c1 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -30,15 +30,14 @@ from PyQt4 import QtCore, QtGui from openlp.core.ui import AboutForm, SettingsForm, AlertForm, \ ServiceManager, ThemeManager, MainDisplay, SlideController, \ PluginForm, MediaDockManager -from openlp.core.lib import translate, RenderManager, PluginConfig, \ - OpenLPDockWidget, SettingsManager, PluginManager, Receiver, \ - buildIcon, str_to_bool +from openlp.core.lib import RenderManager, PluginConfig, buildIcon, \ + OpenLPDockWidget, SettingsManager, PluginManager, Receiver, str_to_bool from openlp.core.utils import check_latest_version media_manager_style = """ QToolBox::tab { background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, - stop: 0 palette(midlight), stop: 1.0 palette(dark)); + stop: 0 palette(midlight), stop: 1.0 palette(mid)); border-width: 1px; border-style: outset; border-color: palette(midlight); @@ -46,7 +45,7 @@ media_manager_style = """ } QToolBox::tab:selected { background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, - stop: 0 palette(light), stop: 1.0 palette(dark)); + stop: 0 palette(light), stop: 1.0 palette(mid)); border-color: palette(light); } """ @@ -307,114 +306,98 @@ class Ui_MainWindow(object): """ Set up the translation system """ - MainWindow.mainTitle = translate(u'mainWindow', u'OpenLP 2.0') - MainWindow.defaultThemeText = translate(u'mainWindow', + MainWindow.mainTitle = self.trUtf8(u'OpenLP 2.0') + MainWindow.defaultThemeText = self.trUtf8( 'Default Theme: ') MainWindow.setWindowTitle(MainWindow.mainTitle) - self.FileMenu.setTitle(translate(u'mainWindow', u'&File')) - self.FileImportMenu.setTitle(translate(u'mainWindow', u'&Import')) - self.FileExportMenu.setTitle(translate(u'mainWindow', u'&Export')) - self.OptionsMenu.setTitle(translate(u'mainWindow', u'&Options')) - self.OptionsViewMenu.setTitle(translate(u'mainWindow', u'&View')) - self.ViewModeMenu.setTitle(translate(u'mainWindow', u'M&ode')) - self.OptionsLanguageMenu.setTitle(translate(u'mainWindow', + self.FileMenu.setTitle(self.trUtf8(u'&File')) + self.FileImportMenu.setTitle(self.trUtf8(u'&Import')) + self.FileExportMenu.setTitle(self.trUtf8(u'&Export')) + self.OptionsMenu.setTitle(self.trUtf8(u'&Options')) + self.OptionsViewMenu.setTitle(self.trUtf8(u'&View')) + self.ViewModeMenu.setTitle(self.trUtf8(u'M&ode')) + self.OptionsLanguageMenu.setTitle(self.trUtf8( u'&Language')) - self.ToolsMenu.setTitle(translate(u'mainWindow', u'&Tools')) - self.HelpMenu.setTitle(translate(u'mainWindow', u'&Help')) + self.ToolsMenu.setTitle(self.trUtf8(u'&Tools')) + self.HelpMenu.setTitle(self.trUtf8(u'&Help')) self.MediaManagerDock.setWindowTitle( - translate(u'mainWindow', u'Media Manager')) + self.trUtf8(u'Media Manager')) self.ServiceManagerDock.setWindowTitle( - translate(u'mainWindow', u'Service Manager')) + self.trUtf8(u'Service Manager')) self.ThemeManagerDock.setWindowTitle( - translate(u'mainWindow', u'Theme Manager')) - self.FileNewItem.setText(translate(u'mainWindow', u'&New')) - self.FileNewItem.setToolTip(translate(u'mainWindow', u'New Service')) - self.FileNewItem.setStatusTip( - translate(u'mainWindow', u'Create a new Service')) - self.FileNewItem.setShortcut(translate(u'mainWindow', u'Ctrl+N')) - self.FileOpenItem.setText(translate(u'mainWindow', u'&Open')) - self.FileOpenItem.setToolTip(translate(u'mainWindow', u'Open Service')) - self.FileOpenItem.setStatusTip( - translate(u'mainWindow', u'Open an existing service')) - self.FileOpenItem.setShortcut(translate(u'mainWindow', u'Ctrl+O')) - self.FileSaveItem.setText(translate(u'mainWindow', u'&Save')) - self.FileSaveItem.setToolTip(translate(u'mainWindow', u'Save Service')) + self.trUtf8(u'Theme Manager')) + self.FileNewItem.setText(self.trUtf8(u'&New')) + self.FileNewItem.setToolTip(self.trUtf8(u'New Service')) + self.FileNewItem.setStatusTip(self.trUtf8(u'Create a new Service')) + self.FileNewItem.setShortcut(self.trUtf8(u'Ctrl+N')) + self.FileOpenItem.setText(self.trUtf8(u'&Open')) + self.FileOpenItem.setToolTip(self.trUtf8(u'Open Service')) + self.FileOpenItem.setStatusTip(self.trUtf8(u'Open an existing service')) + self.FileOpenItem.setShortcut(self.trUtf8(u'Ctrl+O')) + self.FileSaveItem.setText(self.trUtf8(u'&Save')) + self.FileSaveItem.setToolTip(self.trUtf8(u'Save Service')) self.FileSaveItem.setStatusTip( - translate(u'mainWindow', u'Save the current service to disk')) - self.FileSaveItem.setShortcut(translate(u'mainWindow', u'Ctrl+S')) - self.FileSaveAsItem.setText(translate(u'mainWindow', u'Save &As...')) - self.FileSaveAsItem.setToolTip( - translate(u'mainWindow', u'Save Service As')) - self.FileSaveAsItem.setStatusTip(translate(u'mainWindow', - u'Save the current service under a new name')) - self.FileSaveAsItem.setShortcut(translate(u'mainWindow', u'F12')) - self.FileExitItem.setText(translate(u'mainWindow', u'E&xit')) - self.FileExitItem.setStatusTip(translate(u'mainWindow', u'Quit OpenLP')) - self.FileExitItem.setShortcut(translate(u'mainWindow', u'Alt+F4')) - self.ImportThemeItem.setText(translate(u'mainWindow', u'&Theme')) - self.ImportLanguageItem.setText(translate(u'mainWindow', u'&Language')) - self.ExportThemeItem.setText(translate(u'mainWindow', u'&Theme')) - self.ExportLanguageItem.setText(translate(u'mainWindow', u'&Language')) - self.actionLook_Feel.setText(translate(u'mainWindow', u'Look && &Feel')) - self.OptionsSettingsItem.setText(translate(u'mainWindow', u'&Settings')) - self.ViewMediaManagerItem.setText( - translate(u'mainWindow', u'&Media Manager')) - self.ViewMediaManagerItem.setToolTip( - translate(u'mainWindow', u'Toggle Media Manager')) - self.ViewMediaManagerItem.setStatusTip(translate(u'mainWindow', - u'Toggle the visibility of the Media Manager')) - self.ViewMediaManagerItem.setShortcut(translate(u'mainWindow', u'F8')) - self.ViewThemeManagerItem.setText( - translate(u'mainWindow', u'&Theme Manager')) - self.ViewThemeManagerItem.setToolTip( - translate(u'mainWindow', u'Toggle Theme Manager')) - self.ViewThemeManagerItem.setStatusTip(translate(u'mainWindow', - u'Toggle the visibility of the Theme Manager')) - self.ViewThemeManagerItem.setShortcut(translate(u'mainWindow', u'F10')) - self.ViewServiceManagerItem.setText( - translate(u'mainWindow', u'&Service Manager')) + self.trUtf8(u'Save the current service to disk')) + self.FileSaveItem.setShortcut(self.trUtf8(u'Ctrl+S')) + self.FileSaveAsItem.setText(self.trUtf8(u'Save &As...')) + self.FileSaveAsItem.setToolTip(self.trUtf8(u'Save Service As')) + self.FileSaveAsItem.setStatusTip( + self.trUtf8(u'Save the current service under a new name')) + self.FileSaveAsItem.setShortcut(self.trUtf8(u'F12')) + self.FileExitItem.setText(self.trUtf8(u'E&xit')) + self.FileExitItem.setStatusTip(self.trUtf8(u'Quit OpenLP')) + self.FileExitItem.setShortcut(self.trUtf8(u'Alt+F4')) + self.ImportThemeItem.setText(self.trUtf8(u'&Theme')) + self.ImportLanguageItem.setText(self.trUtf8(u'&Language')) + self.ExportThemeItem.setText(self.trUtf8(u'&Theme')) + self.ExportLanguageItem.setText(self.trUtf8(u'&Language')) + self.actionLook_Feel.setText(self.trUtf8(u'Look && &Feel')) + self.OptionsSettingsItem.setText(self.trUtf8(u'&Settings')) + self.ViewMediaManagerItem.setText(self.trUtf8(u'&Media Manager')) + self.ViewMediaManagerItem.setToolTip(self.trUtf8(u'Toggle Media Manager')) + self.ViewMediaManagerItem.setStatusTip( + self.trUtf8(u'Toggle the visibility of the Media Manager')) + self.ViewMediaManagerItem.setShortcut(self.trUtf8(u'F8')) + self.ViewThemeManagerItem.setText(self.trUtf8(u'&Theme Manager')) + self.ViewThemeManagerItem.setToolTip(self.trUtf8(u'Toggle Theme Manager')) + self.ViewThemeManagerItem.setStatusTip( + self.trUtf8(u'Toggle the visibility of the Theme Manager')) + self.ViewThemeManagerItem.setShortcut(self.trUtf8(u'F10')) + self.ViewServiceManagerItem.setText(self.trUtf8(u'&Service Manager')) self.ViewServiceManagerItem.setToolTip( - translate(u'mainWindow', u'Toggle Service Manager')) - self.ViewServiceManagerItem.setStatusTip(translate(u'mainWindow', - u'Toggle the visibility of the Service Manager')) - self.ViewServiceManagerItem.setShortcut(translate(u'mainWindow', u'F9')) - self.action_Preview_Panel.setText( - translate(u'mainWindow', u'&Preview Panel')) - self.action_Preview_Panel.setToolTip( - translate(u'mainWindow', u'Toggle Preview Panel')) - self.action_Preview_Panel.setStatusTip(translate(u'mainWindow', - u'Toggle the visibility of the Preview Panel')) - self.action_Preview_Panel.setShortcut(translate(u'mainWindow', u'F11')) - self.ToolsAlertItem.setText(translate(u'mainWindow', u'&Alert')) - self.ToolsAlertItem.setStatusTip( - translate(u'mainWindow', u'Show an alert message')) - self.ToolsAlertItem.setShortcut(translate(u'mainWindow', u'F7')) - self.PluginItem.setText(translate(u'mainWindow', u'&Plugin List')) - self.PluginItem.setStatusTip( - translate(u'mainWindow', u'List the Plugins')) - self.PluginItem.setShortcut(translate(u'mainWindow', u'Alt+F7')) - self.HelpDocumentationItem.setText( - translate(u'mainWindow', u'&User Guide')) - self.HelpAboutItem.setText(translate(u'mainWindow', u'&About')) + self.trUtf8(u'Toggle Service Manager')) + self.ViewServiceManagerItem.setStatusTip( + self.trUtf8(u'Toggle the visibility of the Service Manager')) + self.ViewServiceManagerItem.setShortcut(self.trUtf8(u'F9')) + self.action_Preview_Panel.setText(self.trUtf8(u'&Preview Panel')) + self.action_Preview_Panel.setToolTip(self.trUtf8(u'Toggle Preview Panel')) + self.action_Preview_Panel.setStatusTip( + self.trUtf8(u'Toggle the visibility of the Preview Panel')) + self.action_Preview_Panel.setShortcut(self.trUtf8(u'F11')) + self.ToolsAlertItem.setText(self.trUtf8(u'&Alert')) + self.ToolsAlertItem.setStatusTip(self.trUtf8(u'Show an alert message')) + self.ToolsAlertItem.setShortcut(self.trUtf8(u'F7')) + self.PluginItem.setText(self.trUtf8(u'&Plugin List')) + self.PluginItem.setStatusTip(self.trUtf8(u'List the Plugins')) + self.PluginItem.setShortcut(self.trUtf8(u'Alt+F7')) + self.HelpDocumentationItem.setText(self.trUtf8(u'&User Guide')) + self.HelpAboutItem.setText(self.trUtf8(u'&About')) self.HelpAboutItem.setStatusTip( - translate(u'mainWindow', u'More information about OpenLP')) - self.HelpAboutItem.setShortcut(translate(u'mainWindow', u'Ctrl+F1')) - self.HelpOnlineHelpItem.setText( - translate(u'mainWindow', u'&Online Help')) - self.HelpWebSiteItem.setText(translate(u'mainWindow', u'&Web Site')) - self.LanguageTranslateItem.setText( - translate(u'mainWindow', u'&Translate')) - self.LanguageTranslateItem.setStatusTip(translate(u'mainWindow', - u'Translate the interface to your language')) - self.LanguageEnglishItem.setText(translate(u'mainWindow', u'English')) - self.LanguageEnglishItem.setStatusTip(translate(u'mainWindow', - u'Set the interface language to English')) - self.ToolsAddToolItem.setText(translate(u'mainWindow', u'&Add Tool...')) - self.ToolsAddToolItem.setStatusTip(translate(u'mainWindow', - u'Add an application to the list of tools')) - self.action_Preview_Panel.setText( - translate(u'mainWindow', u'&Preview Pane')) - self.ModeLiveItem.setText(translate(u'mainWindow', u'&Live')) + self.trUtf8(u'More information about OpenLP')) + self.HelpAboutItem.setShortcut(self.trUtf8(u'Ctrl+F1')) + self.HelpOnlineHelpItem.setText(self.trUtf8(u'&Online Help')) + self.HelpWebSiteItem.setText(self.trUtf8(u'&Web Site')) + self.LanguageTranslateItem.setText(self.trUtf8(u'&Translate')) + self.LanguageTranslateItem.setStatusTip( + self.trUtf8(u'Translate the interface to your language')) + self.LanguageEnglishItem.setText(self.trUtf8(u'English')) + self.LanguageEnglishItem.setStatusTip( + self.trUtf8(u'Set the interface language to English')) + self.ToolsAddToolItem.setText(self.trUtf8(u'&Add Tool...')) + self.ToolsAddToolItem.setStatusTip( + self.trUtf8(u'Add an application to the list of tools')) + self.action_Preview_Panel.setText(self.trUtf8(u'&Preview Pane')) + self.ModeLiveItem.setText(self.trUtf8(u'&Live')) class MainWindow(QtGui.QMainWindow, Ui_MainWindow): @@ -546,9 +529,9 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): version = check_latest_version(self.generalConfig, applicationVersion) if applicationVersion != version: QtGui.QMessageBox.question(None, - translate(u'mainWindow', u'OpenLP version Updated'), - translate(u'mainWindow', u'OpenLP version %s has been updated to version %s' - % (applicationVersion, version)), + self.trUtf8(u'OpenLP version Updated'), + self.trUtf8(u'OpenLP version %s has been updated to version %s') + % (applicationVersion, version), QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok), QtGui.QMessageBox.Ok) self.generalConfig.set_config(u'Application version', version) @@ -584,8 +567,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): if str_to_bool(self.generalConfig.get_config(u'Screen Blank', False)) \ and str_to_bool(self.generalConfig.get_config(u'Blank Warning', False)): QtGui.QMessageBox.question(None, - translate(u'mainWindow', u'OpenLP Main Display Blanked'), - translate(u'mainWindow', u'The Main Display has been blanked out'), + self.trUtf8(u'OpenLP Main Display Blanked'), + self.trUtf8(u'The Main Display has been blanked out'), QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok), QtGui.QMessageBox.Ok) self.LiveController.blackPushButton.setChecked(True) @@ -624,8 +607,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): """ if self.serviceNotSaved == True: ret = QtGui.QMessageBox.question(None, - translate(u'mainWindow', u'Save Changes to Service?'), - translate(u'mainWindow', u'Your service has changed, do you want to save those changes?'), + self.trUtf8(u'Save Changes to Service?'), + self.trUtf8(u'Your service has changed, do you want to save those changes?'), QtGui.QMessageBox.StandardButtons( QtGui.QMessageBox.Cancel | QtGui.QMessageBox.Discard | diff --git a/openlp/core/ui/plugindialog.py b/openlp/core/ui/plugindialog.py index ba7491912..f733b8e2f 100644 --- a/openlp/core/ui/plugindialog.py +++ b/openlp/core/ui/plugindialog.py @@ -23,7 +23,6 @@ ############################################################################### from PyQt4 import QtCore, QtGui -from openlp.core.lib import translate class Ui_PluginViewDialog(object): def setupUi(self, PluginViewDialog): @@ -93,25 +92,17 @@ class Ui_PluginViewDialog(object): self.PluginLayout.addWidget(self.PluginListButtonBox) self.retranslateUi(PluginViewDialog) - QtCore.QObject.connect( - self.PluginListButtonBox, - QtCore.SIGNAL(u'accepted()'), - PluginViewDialog.close) + QtCore.QObject.connect(self.PluginListButtonBox, + QtCore.SIGNAL(u'accepted()'), PluginViewDialog.close) QtCore.QMetaObject.connectSlotsByName(PluginViewDialog) def retranslateUi(self, PluginViewDialog): - PluginViewDialog.setWindowTitle( - translate(u'PluginViewDialog', u'Plugin List')) - self.PluginInfoGroupBox.setTitle( - translate(u'PluginViewDialog', u'Plugin Details')) - self.VersionLabel.setText( - translate(u'PluginViewDialog', u'Version:')) - self.VersionNumberLabel.setText( - translate(u'PluginViewDialog', u'TextLabel')) - self.AboutLabel.setText(translate(u'PluginViewDialog', u'About:')) - self.StatusLabel.setText(translate(u'PluginViewDialog', u'Status:')) - self.StatusComboBox.setItemText( - 0, translate(u'PluginViewDialog', u'Active')) - self.StatusComboBox.setItemText( - 1, translate(u'PluginViewDialog', u'Inactive')) + PluginViewDialog.setWindowTitle(self.trUtf8(u'Plugin List')) + self.PluginInfoGroupBox.setTitle(self.trUtf8(u'Plugin Details')) + self.VersionLabel.setText(self.trUtf8(u'Version:')) + self.VersionNumberLabel.setText(self.trUtf8(u'TextLabel')) + self.AboutLabel.setText(self.trUtf8(u'About:')) + self.StatusLabel.setText(self.trUtf8(u'Status:')) + self.StatusComboBox.setItemText(0, self.trUtf8(u'Active')) + self.StatusComboBox.setItemText(1, self.trUtf8(u'Inactive')) diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 2b5838b3f..68e450f4e 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -30,7 +30,7 @@ import zipfile from PyQt4 import QtCore, QtGui from openlp.core.lib import PluginConfig, OpenLPToolbar, ServiceItem, \ - translate, ServiceType, contextMenuAction, contextMenuSeparator, Receiver + ServiceType, contextMenuAction, contextMenuSeparator, Receiver, contextMenu class ServiceManagerList(QtGui.QTreeWidget): @@ -116,25 +116,22 @@ class ServiceManager(QtGui.QWidget): self.Layout.setMargin(0) # Create the top toolbar self.Toolbar = OpenLPToolbar(self) - self.Toolbar.addToolbarButton(u'New Service', - u':/services/service_new.png', - translate(u'ServiceManager', u'Create a new service'), - self.onNewService) - self.Toolbar.addToolbarButton(u'Open Service', - u':/services/service_open.png', - translate(u'ServiceManager', u'Load an existing service'), - self.onLoadService) - self.Toolbar.addToolbarButton(u'Save Service', - u':/services/service_save.png', - translate(u'ServiceManager', u'Save this service'), - self.onSaveService) + self.Toolbar.addToolbarButton( + self.trUtf8(u'New Service'), u':/services/service_new.png', + self.trUtf8(u'Create a new service'), self.onNewService) + self.Toolbar.addToolbarButton( + self.trUtf8(u'Open Service'), u':/services/service_open.png', + self.trUtf8(u'Load an existing service'), self.onLoadService) + self.Toolbar.addToolbarButton( + self.trUtf8(u'Save Service'), u':/services/service_save.png', + self.trUtf8(u'Save this service'), self.onSaveService) self.Toolbar.addSeparator() - self.ThemeLabel = QtGui.QLabel(translate(u'ServiceManager', u'Theme:'), + self.ThemeLabel = QtGui.QLabel(self.trUtf8(u'Theme:'), self) self.ThemeLabel.setMargin(3) self.Toolbar.addWidget(self.ThemeLabel) self.ThemeComboBox = QtGui.QComboBox(self.Toolbar) - self.ThemeComboBox.setToolTip(translate(u'ServiceManager', + self.ThemeComboBox.setToolTip(self.trUtf8( u'Select a theme for the service')) self.ThemeComboBox.setSizeAdjustPolicy( QtGui.QComboBox.AdjustToContents) @@ -162,37 +159,40 @@ class ServiceManager(QtGui.QWidget): QtCore.Qt.ActionsContextMenu) self.ServiceManagerList.addAction(contextMenuAction( self.ServiceManagerList, ':/system/system_preview.png', - translate(u'ServiceManager',u'&Preview Verse'), self.makePreview)) + self.trUtf8(u'&Preview Verse'), self.makePreview)) self.ServiceManagerList.addAction(contextMenuAction( self.ServiceManagerList, ':/system/system_live.png', - translate(u'ServiceManager',u'&Show Live'), self.makeLive)) + self.trUtf8(u'&Show Live'), self.makeLive)) self.ServiceManagerList.addAction(contextMenuSeparator( self.ServiceManagerList)) self.ServiceManagerList.addAction(contextMenuAction( self.ServiceManagerList, ':/services/service_delete', - translate(u'ServiceManager',u'&Remove from Service'), - self.onDeleteFromService)) + self.trUtf8(u'&Remove from Service'), self.onDeleteFromService)) + self.ServiceManagerList.addAction(contextMenuSeparator( + self.ServiceManagerList)) + self.ThemeMenu = contextMenu( + self.ServiceManagerList, '', + self.trUtf8(u'&Change Item Theme')) + self.ServiceManagerList.addAction(self.ThemeMenu.menuAction()) self.Layout.addWidget(self.ServiceManagerList) # Add the bottom toolbar self.OrderToolbar = OpenLPToolbar(self) - self.OrderToolbar.addToolbarButton(u'Move to top', - u':/services/service_top.png', - translate(u'ServiceManager', u'Move to top'), self.onServiceTop) - self.OrderToolbar.addToolbarButton(u'Move up', - u':/services/service_up.png', - translate(u'ServiceManager', u'Move up order'), self.onServiceUp) - self.OrderToolbar.addToolbarButton(u'Move down', - u':/services/service_down.png', - translate(u'ServiceManager', u'Move down order'), - self.onServiceDown) - self.OrderToolbar.addToolbarButton(u'Move to bottom', - u':/services/service_bottom.png', - translate(u'ServiceManager', u'Move to end'), self.onServiceEnd) + self.OrderToolbar.addToolbarButton( + self.trUtf8(u'Move to top'), u':/services/service_top.png', + self.trUtf8(u'Move to top'), self.onServiceTop) + self.OrderToolbar.addToolbarButton( + self.trUtf8(u'Move up'), u':/services/service_up.png', + self.trUtf8(u'Move up order'), self.onServiceUp) + self.OrderToolbar.addToolbarButton( + self.trUtf8(u'Move down'), u':/services/service_down.png', + self.trUtf8(u'Move down order'), self.onServiceDown) + self.OrderToolbar.addToolbarButton( + self.trUtf8(u'Move to bottom'), u':/services/service_bottom.png', + self.trUtf8(u'Move to end'), self.onServiceEnd) self.OrderToolbar.addSeparator() - self.OrderToolbar.addToolbarButton(u'Delete From Service', - u':/services/service_delete.png', - translate(u'ServiceManager', u'Delete From Service'), - self.onDeleteFromService) + self.OrderToolbar.addToolbarButton( + self.trUtf8(u'Delete From Service'), u':/services/service_delete.png', + self.trUtf8(u'Delete From Service'), self.onDeleteFromService) self.Layout.addWidget(self.OrderToolbar) # Connect up our signals and slots QtCore.QObject.connect(self.ThemeComboBox, @@ -429,10 +429,9 @@ class ServiceManager(QtGui.QWidget): if lastService: filename = self.config.get_last_dir() else: - filename = QtGui.QFileDialog.getOpenFileName(self, - translate(u'ThemeManager', u'Open Service'), - self.config.get_last_dir(), - u'Services (*.osz)') + filename = QtGui.QFileDialog.getOpenFileName( + self, self.trUtf8(u'Open Service'), + self.config.get_last_dir(), u'Services (*.osz)') filename = unicode(filename) name = filename.split(os.path.sep) if filename != u'': @@ -606,12 +605,17 @@ class ServiceManager(QtGui.QWidget): ``theme_list`` A list of current themes to be displayed - """ self.ThemeComboBox.clear() + self.ThemeMenu.clear() self.ThemeComboBox.addItem(u'') for theme in theme_list: self.ThemeComboBox.addItem(theme) + action = contextMenuAction( + self.ServiceManagerList, + None, + theme , self.onThemeChangeAction) + self.ThemeMenu.addAction(action) id = self.ThemeComboBox.findText(self.service_theme, QtCore.Qt.MatchExactly) # Not Found @@ -621,3 +625,9 @@ class ServiceManager(QtGui.QWidget): self.ThemeComboBox.setCurrentIndex(id) self.parent.RenderManager.set_service_theme(self.service_theme) self.regenerateServiceItems() + + def onThemeChangeAction(self): + theme = unicode(self.sender().text()) + item, count = self.findServiceItem() + self.serviceItems[item][u'data'].theme = theme + self.regenerateServiceItems() diff --git a/openlp/core/ui/settingsdialog.py b/openlp/core/ui/settingsdialog.py index bf385bb37..a936f9f2f 100644 --- a/openlp/core/ui/settingsdialog.py +++ b/openlp/core/ui/settingsdialog.py @@ -23,7 +23,6 @@ ############################################################################### from PyQt4 import QtCore, QtGui -from openlp.core.lib import translate class Ui_SettingsDialog(object): def setupUi(self, SettingsDialog): @@ -54,4 +53,4 @@ class Ui_SettingsDialog(object): QtCore.QMetaObject.connectSlotsByName(SettingsDialog) def retranslateUi(self, SettingsDialog): - SettingsDialog.setWindowTitle(translate(u'SettingsDialog', u'Settings')) + SettingsDialog.setWindowTitle(self.trUtf8(u'Settings')) diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index dc3e6099b..aab72ec75 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -26,7 +26,7 @@ import logging import time from PyQt4 import QtCore, QtGui -from openlp.core.lib import OpenLPToolbar, translate, Receiver, ServiceType +from openlp.core.lib import OpenLPToolbar, Receiver, ServiceType label_stylesheet = u""" QTableWidget::item:selected @@ -87,9 +87,18 @@ class SlideController(QtGui.QWidget): self.isLive = isLive self.parent = parent self.image_list = [ - u'Start Loop', u'Stop Loop', u'Loop Separator', u'Image SpinBox'] + u'Start Loop', + u'Stop Loop', + u'Loop Separator', + u'Image SpinBox' + ] + self.song_list = [ + u'Edit Song', + ] self.timer_id = 0 self.commandItem = None + self.songEdit = False + self.row = 0 self.Panel = QtGui.QWidget(parent.ControlSplitter) # Layout for holding panel self.PanelLayout = QtGui.QVBoxLayout(self.Panel) @@ -98,9 +107,9 @@ class SlideController(QtGui.QWidget): # Type label for the top of the slide controller self.TypeLabel = QtGui.QLabel(self.Panel) if self.isLive: - self.TypeLabel.setText(u'%s' % translate(u'SlideController', u'Live')) + self.TypeLabel.setText(u'%s' % self.trUtf8(u'Live')) else: - self.TypeLabel.setText(u'%s' % translate(u'SlideController', u'Preview')) + self.TypeLabel.setText(u'%s' % self.trUtf8(u'Preview')) self.TypeLabel.setAlignment(QtCore.Qt.AlignCenter) self.PanelLayout.addWidget(self.TypeLabel) # Splitter @@ -135,46 +144,45 @@ class SlideController(QtGui.QWidget): self.Toolbar.sizePolicy().hasHeightForWidth()) self.Toolbar.setSizePolicy(sizeToolbarPolicy) if self.isLive: - self.Toolbar.addToolbarButton(u'First Slide', - u':/slides/slide_first.png', - translate(u'SlideController', u'Move to first'), - self.onSlideSelectedFirst) - self.Toolbar.addToolbarButton(u'Previous Slide', - u':/slides/slide_previous.png', - translate(u'SlideController', u'Move to previous'), - self.onSlideSelectedPrevious) - self.Toolbar.addToolbarButton(u'Next Slide', - u':/slides/slide_next.png', - translate(u'SlideController', u'Move to next'), - self.onSlideSelectedNext) + self.Toolbar.addToolbarButton( + u'First Slide', u':/slides/slide_first.png', + self.trUtf8(u'Move to first'), self.onSlideSelectedFirst) + self.Toolbar.addToolbarButton( + u'Previous Slide', u':/slides/slide_previous.png', + self.trUtf8(u'Move to previous'), self.onSlideSelectedPrevious) + self.Toolbar.addToolbarButton( + u'Next Slide', u':/slides/slide_next.png', + self.trUtf8(u'Move to next'), self.onSlideSelectedNext) if self.isLive: - self.Toolbar.addToolbarButton(u'Last Slide', - u':/slides/slide_last.png', - translate(u'SlideController', u'Move to last'), - self.onSlideSelectedLast) + self.Toolbar.addToolbarButton( + u'Last Slide', u':/slides/slide_last.png', + self.trUtf8(u'Move to last'), self.onSlideSelectedLast) if self.isLive: self.Toolbar.addToolbarSeparator(u'Close Separator') self.blackPushButton = self.Toolbar.addPushButton( u':/slides/slide_close.png') if not self.isLive: self.Toolbar.addToolbarSeparator(u'Close Separator') - self.Toolbar.addToolbarButton(u'Go Live', - u':/system/system_live.png', - translate(u'SlideController', u'Move to live'), - self.onGoLive) + self.Toolbar.addToolbarButton( + u'Go Live', u':/system/system_live.png', + self.trUtf8(u'Move to live'), self.onGoLive) + self.Toolbar.addToolbarSeparator(u'Close Separator') + self.Toolbar.addToolbarButton( + u'Edit Song', u':songs/song_edit.png', + self.trUtf8(u'Edit and re-preview Song'), self.onEditSong) if isLive: self.Toolbar.addToolbarSeparator(u'Loop Separator') - self.Toolbar.addToolbarButton(u'Start Loop', - u':/media/media_time.png', - translate(u'SlideController', u'Start continuous loop'), - self.onStartLoop) - self.Toolbar.addToolbarButton(u'Stop Loop', - u':/media/media_stop.png', - translate(u'SlideController', u'Stop continuous loop'), - self.onStopLoop) + self.Toolbar.addToolbarButton( + u'Start Loop', u':/media/media_time.png', + self.trUtf8(u'Start continuous loop'), self.onStartLoop) + self.Toolbar.addToolbarButton( + u'Stop Loop', u':/media/media_stop.png', + self.trUtf8(u'Stop continuous loop'), self.onStopLoop) self.DelaySpinBox = QtGui.QSpinBox() - self.Toolbar.addToolbarWidget(u'Image SpinBox', self.DelaySpinBox) - self.DelaySpinBox.setSuffix(translate(u'SlideController', u's')) + self.Toolbar.addToolbarWidget( + u'Image SpinBox', self.DelaySpinBox) + self.DelaySpinBox.setSuffix(self.trUtf8(u's')) + self.DelaySpinBox.setToolTip(self.trUtf8(u'Delay between slides in seconds')) self.ControllerLayout.addWidget(self.Toolbar) # Screen preview area @@ -218,6 +226,8 @@ class SlideController(QtGui.QWidget): Receiver().send_message(u'request_spin_delay') if isLive: self.Toolbar.makeWidgetsInvisible(self.image_list) + else: + self.Toolbar.makeWidgetsInvisible(self.song_list) QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'slidecontroller_first'), self.onSlideSelectedFirst) QtCore.QObject.connect(Receiver.get_receiver(), @@ -226,6 +236,8 @@ class SlideController(QtGui.QWidget): QtCore.SIGNAL(u'slidecontroller_previous'), self.onSlideSelectedPrevious) QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'slidecontroller_last'), self.onSlideSelectedLast) + QtCore.QObject.connect(Receiver.get_receiver(), + QtCore.SIGNAL(u'slidecontroller_change'), self.onSlideChange) def receiveSpinDelay(self, value): self.DelaySpinBox.setValue(int(value)) @@ -257,7 +269,10 @@ class SlideController(QtGui.QWidget): """ Allows the Preview toolbar to be customised """ - pass + if item.name == u'Songs': + self.Toolbar.makeWidgetsVisible(self.song_list) + else: + self.Toolbar.makeWidgetsInvisible(self.song_list) def addServiceItem(self, item): """ @@ -279,7 +294,12 @@ class SlideController(QtGui.QWidget): Receiver().send_message(u'%s_start' % item.name.lower(), \ [item.shortname, item.service_item_path, item.service_frames[0][u'title']]) - self.displayServiceManagerItems(item, 0) + slideno = 0 + if self.songEdit: + slideno = self.row + self.songEdit = False + self.displayServiceManagerItems(item, slideno) + def addServiceManagerItem(self, item, slideno): """ @@ -287,7 +307,7 @@ class SlideController(QtGui.QWidget): request the correct the toolbar of the plugin Called by ServiceManager """ - log.debug(u'addServiceItem') + log.debug(u'addServiceManagerItem') #If old item was a command tell it to stop if self.commandItem is not None and \ self.commandItem.service_item_type == ServiceType.Command: @@ -353,6 +373,7 @@ class SlideController(QtGui.QWidget): if self.commandItem is not None and \ self.commandItem.service_item_type == ServiceType.Command: Receiver().send_message(u'%s_first'% self.commandItem.name.lower()) + QtCore.QTimer.singleShot(0.5, self.grabMainDisplay) else: self.PreviewListWidget.selectRow(0) self.onSlideSelected() @@ -376,11 +397,13 @@ class SlideController(QtGui.QWidget): if this is the Live Controller also display on the screen """ row = self.PreviewListWidget.currentRow() + self.row = 0 if row > -1 and row < self.PreviewListWidget.rowCount(): if self.commandItem.service_item_type == ServiceType.Command: Receiver().send_message(u'%s_slide'% self.commandItem.name.lower(), [row]) + if isLive: + QtCore.QTimer.singleShot(0.5, self.grabMainDisplay) else: - #label = self.PreviewListWidget.cellWidget(row, 0) frame = self.serviceitem.frames[row][u'image'] before = time.time() if frame is None: @@ -389,7 +412,26 @@ class SlideController(QtGui.QWidget): log.info(u'Slide Rendering took %4s' % (time.time() - before)) if self.isLive: self.parent.mainDisplay.frameView(frame) + self.row = row + def onSlideChange(self, row): + """ + The slide has been changed. Update the slidecontroller accordingly + """ + self.PreviewListWidget.selectRow(row) + QtCore.QTimer.singleShot(0.5, self.grabMainDisplay) + + def grabMainDisplay(self): + rm = self.parent.RenderManager + if not rm.screen_list[rm.current_display][u'primary']: + winid = QtGui.QApplication.desktop().winId() + rect = rm.screen_list[rm.current_display][u'size'] + winimg = QtGui.QPixmap.grabWindow(winid, rect.x(), rect.y(), rect.width(), rect.height()) + self.SlidePreview.setPixmap(winimg) + else: + label = self.PreviewListWidget.cellWidget(self.PreviewListWidget.currentRow(), 0) + self.SlidePreview.setPixmap(label.pixmap()) + def onSlideSelectedNext(self): """ Go to the next slide. @@ -397,6 +439,7 @@ class SlideController(QtGui.QWidget): if self.commandItem is not None and \ self.commandItem.service_item_type == ServiceType.Command: Receiver().send_message(u'%s_next'% self.commandItem.name.lower()) + QtCore.QTimer.singleShot(0.5, self.grabMainDisplay) else: row = self.PreviewListWidget.currentRow() + 1 if row == self.PreviewListWidget.rowCount(): @@ -412,6 +455,7 @@ class SlideController(QtGui.QWidget): self.commandItem.service_item_type == ServiceType.Command: Receiver().send_message( u'%s_previous'% self.commandItem.name.lower()) + QtCore.QTimer.singleShot(0.5, self.grabMainDisplay) else: row = self.PreviewListWidget.currentRow() - 1 if row == -1: @@ -426,6 +470,7 @@ class SlideController(QtGui.QWidget): if self.commandItem is not None and \ self.commandItem.service_item_type == ServiceType.Command: Receiver().send_message(u'%s_last'% self.commandItem.name.lower()) + QtCore.QTimer.singleShot(0.5, self.grabMainDisplay) else: self.PreviewListWidget.selectRow(self.PreviewListWidget.rowCount() - 1) self.onSlideSelected() @@ -451,6 +496,10 @@ class SlideController(QtGui.QWidget): if event.timerId() == self.timer_id: self.onSlideSelectedNext() + def onEditSong(self): + self.songEdit = True + Receiver().send_message(u'edit_song') + def onGoLive(self): """ If preview copy slide item to live diff --git a/openlp/core/ui/splashscreen.py b/openlp/core/ui/splashscreen.py index ef934ef6a..3990a8f5c 100644 --- a/openlp/core/ui/splashscreen.py +++ b/openlp/core/ui/splashscreen.py @@ -23,14 +23,14 @@ ############################################################################### from PyQt4 import QtCore, QtGui -from openlp.core.lib import translate, buildIcon +from openlp.core.lib import buildIcon class SplashScreen(object): def __init__(self, version): self.splash_screen = QtGui.QSplashScreen() self.setupUi() - starting = translate(u'SplashScreen', u'Starting') - self.message = starting + u'..... ' + version + self.message = self.splash_screen.trUtf8(u'Starting')\ + + u'..... ' + version def setupUi(self): self.splash_screen.setObjectName(u'splash_screen') @@ -57,7 +57,7 @@ class SplashScreen(object): def retranslateUi(self): self.splash_screen.setWindowTitle( - translate(u'splash_screen', u'Splash Screen')) + self.splash_screen.trUtf8(u'Splash Screen')) def show(self): self.splash_screen.show() diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py index 50e433534..3e882c812 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -32,7 +32,7 @@ from PyQt4 import QtCore, QtGui from openlp.core.ui import AmendThemeForm from openlp.core.theme import Theme -from openlp.core.lib import PluginConfig, OpenLPToolbar, ThemeXML, translate, \ +from openlp.core.lib import PluginConfig, OpenLPToolbar, ThemeXML, \ str_to_bool, file_to_xml, buildIcon, Receiver, contextMenuAction, \ contextMenuSeparator from openlp.core.utils import ConfigHelper @@ -53,25 +53,21 @@ class ThemeManager(QtGui.QWidget): self.amendThemeForm = AmendThemeForm(self) self.Toolbar = OpenLPToolbar(self) self.Toolbar.addToolbarButton( - translate(u'ThemeManager', u'New Theme'), u':/themes/theme_new.png', - translate(u'ThemeManager', u'Create a new theme'), self.onAddTheme) + self.trUtf8(u'New Theme'), u':/themes/theme_new.png', + self.trUtf8(u'Create a new theme'), self.onAddTheme) self.Toolbar.addToolbarButton( - translate(u'ThemeManager', u'Edit Theme'), - u':/themes/theme_edit.png', - translate(u'ThemeManager', u'Edit a theme'), self.onEditTheme) + self.trUtf8(u'Edit Theme'), u':/themes/theme_edit.png', + self.trUtf8(u'Edit a theme'), self.onEditTheme) self.Toolbar.addToolbarButton( - translate(u'ThemeManager', u'Delete Theme'), - u':/themes/theme_delete.png', - translate(u'ThemeManager', u'Delete a theme'), self.onDeleteTheme) + self.trUtf8(u'Delete Theme'), u':/themes/theme_delete.png', + self.trUtf8(u'Delete a theme'), self.onDeleteTheme) self.Toolbar.addSeparator() self.Toolbar.addToolbarButton( - translate(u'ThemeManager', u'Import Theme'), - u':/themes/theme_import.png', - translate(u'ThemeManager', u'Import a theme'), self.onImportTheme) + self.trUtf8(u'Import Theme'), u':/themes/theme_import.png', + self.trUtf8(u'Import a theme'), self.onImportTheme) self.Toolbar.addToolbarButton( - translate(u'ThemeManager', u'Export Theme'), - u':/themes/theme_export.png', - translate(u'ThemeManager', u'Export a theme'), self.onExportTheme) + self.trUtf8(u'Export Theme'), u':/themes/theme_export.png', + self.trUtf8(u'Export a theme'), self.onExportTheme) self.ThemeWidget = QtGui.QWidgetAction(self.Toolbar) self.Layout.addWidget(self.Toolbar) self.ThemeListWidget = QtGui.QListWidget(self) @@ -79,23 +75,19 @@ class ThemeManager(QtGui.QWidget): self.ThemeListWidget.setIconSize(QtCore.QSize(88,50)) self.Layout.addWidget(self.ThemeListWidget) self.ThemeListWidget.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu) - self.ThemeListWidget.addAction(contextMenuAction(self.ThemeListWidget, - u':/themes/theme_edit.png', - translate(u'ThemeManager', u'Edit a theme'), - self.onEditTheme)) + self.ThemeListWidget.addAction( + contextMenuAction(self.ThemeListWidget, u':/themes/theme_edit.png', + self.trUtf8(u'Edit a theme'), self.onEditTheme)) self.ThemeListWidget.addAction(contextMenuSeparator(self.ThemeListWidget)) - self.ThemeListWidget.addAction(contextMenuAction(self.ThemeListWidget, - u':/themes/theme_delete.png', - translate(u'ThemeManager', u'Delete theme'), - self.onDeleteTheme)) - self.ThemeListWidget.addAction(contextMenuAction(self.ThemeListWidget, - u':/themes/theme_export.png', - translate(u'ThemeManager', u'Make Global'), - self.changeGlobalFromScreen)) - self.ThemeListWidget.addAction(contextMenuAction(self.ThemeListWidget, - u':/themes/theme_export.png', - translate(u'ThemeManager', u'Export theme'), - self.onExportTheme)) + self.ThemeListWidget.addAction( + contextMenuAction(self.ThemeListWidget, u':/themes/theme_delete.png', + self.trUtf8(u'Delete theme'), self.onDeleteTheme)) + self.ThemeListWidget.addAction( + contextMenuAction(self.ThemeListWidget, u':/themes/theme_export.png', + self.trUtf8(u'Make Global'), self.changeGlobalFromScreen)) + self.ThemeListWidget.addAction( + contextMenuAction(self.ThemeListWidget, u':/themes/theme_export.png', + self.trUtf8(u'Export theme'), self.onExportTheme)) self.ThemeListWidget.addAction(contextMenuSeparator(self.ThemeListWidget)) #Signals QtCore.QObject.connect(self.ThemeListWidget, @@ -125,8 +117,7 @@ class ThemeManager(QtGui.QWidget): self.ThemeListWidget.item(count).setText(newName) #Set the new name if themeName == newName: - name = u'%s (%s)' % (newName, translate(u'ThemeManager', - u'default')) + name = u'%s (%s)' % (newName, self.trUtf8(u'default')) self.ThemeListWidget.item(count).setText(name) def changeGlobalFromScreen(self, index = -1): @@ -143,12 +134,11 @@ class ThemeManager(QtGui.QWidget): if count == selected_row: self.global_theme = unicode( self.ThemeListWidget.item(count).text()) - name = u'%s (%s)' % (self.global_theme, - translate(u'ThemeManager', u'default')) + name = u'%s (%s)' % (self.global_theme, self.trUtf8(u'default')) self.ThemeListWidget.item(count).setText(name) self.config.set_config(u'theme global theme', self.global_theme) - Receiver().send_message(u'update_global_theme', - self.global_theme) + Receiver().send_message( + u'update_global_theme', self.global_theme) self.pushThemes() def onAddTheme(self): @@ -172,10 +162,9 @@ class ThemeManager(QtGui.QWidget): theme = unicode(item.text()) # should be the same unless default if theme != unicode(item.data(QtCore.Qt.UserRole).toString()): - QtGui.QMessageBox.critical(self, - translate(u'ThemeManager', u'Error'), - translate(u'ThemeManager', - u'You are unable to delete the default theme!'), + QtGui.QMessageBox.critical( + self, self.trUtf8(u'Error'), + self.trUtf8(u'You are unable to delete the default theme!'), QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) else: self.themelist.remove(theme) @@ -203,15 +192,13 @@ class ThemeManager(QtGui.QWidget): """ item = self.ThemeListWidget.currentItem() if item is None: - QtGui.QMessageBox.critical(self, - translate(u'ThemeManager', u'Error'), - translate(u'ThemeManager', - u'You have not selected a theme!'), + QtGui.QMessageBox.critical(self, self.trUtf8(u'Error'), + self.trUtf8(u'You have not selected a theme!'), QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) return theme = unicode(item.data(QtCore.Qt.UserRole).toString()) path = QtGui.QFileDialog.getExistingDirectory(self, - u'Save Theme - (%s)' % theme, + unicode(self.trUtf8(u'Save Theme - (%s)')) % theme, self.config.get_last_dir(1) ) path = unicode(path) if path != u'': @@ -226,10 +213,9 @@ class ThemeManager(QtGui.QWidget): zip.close() def onImportTheme(self): - files = QtGui.QFileDialog.getOpenFileNames(self, - translate(u'ThemeManager', u'Select Theme Import File'), - self.config.get_last_dir(), - u'Theme (*.*)') + files = QtGui.QFileDialog.getOpenFileNames( + self, self.trUtf8(u'Select Theme Import File'), + self.config.get_last_dir(), u'Theme (*.*)') log.info(u'New Themes %s', unicode(files)) if len(files) > 0: for file in files: @@ -256,7 +242,7 @@ class ThemeManager(QtGui.QWidget): textName = os.path.splitext(name)[0] if textName == self.global_theme: name = u'%s (%s)' % (textName, - translate(u'ThemeManager', u'default')) + self.trUtf8(u'default')) else: name = textName item_name = QtGui.QListWidgetItem(name) @@ -281,7 +267,7 @@ class ThemeManager(QtGui.QWidget): xml = file_to_xml(xml_file) except: newtheme = ThemeXML() - newtheme.new_document(u'New Theme') + newtheme.new_document(self.trUtf8(u'New Theme')) newtheme.add_background_solid(unicode(u'#000000')) newtheme.add_font(unicode(QtGui.QFont().family()), unicode(u'#FFFFFF'), unicode(30), u'False') @@ -312,10 +298,9 @@ class ThemeManager(QtGui.QWidget): try: zip = zipfile.ZipFile(filename) except: - QtGui.QMessageBox.critical(self, - translate(u'ThemeManager', u'Error'), - translate(u'ThemeManager', - u'File is not a valid theme!'), + QtGui.QMessageBox.critical( + self, self.trUtf8(u'Error'), + self.trUtf8(u'File is not a valid theme!'), QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) return filexml = None @@ -386,7 +371,7 @@ class ThemeManager(QtGui.QWidget): newtheme.add_font(unicode(theme.FontName), unicode(theme.FontColor.name()), - unicode(theme.FontProportion * 2), u'False') + unicode(theme.FontProportion * 3), u'False') newtheme.add_font(unicode(theme.FontName), unicode(theme.FontColor.name()), unicode(12), u'False', u'footer') @@ -418,9 +403,9 @@ class ThemeManager(QtGui.QWidget): if self.saveThemeName != name: if os.path.exists(theme_file): result = QtGui.QMessageBox.question( - self, - translate(u'ThemeManager', u'Theme Exists'), - translate(u'ThemeManager', u'A theme with this name already exists, would you like to overwrite it?'), + self, self.trUtf8(u'Theme Exists'), + self.trUtf8(u'A theme with this name already exists, ' + u'would you like to overwrite it?'), (QtGui.QMessageBox.Yes | QtGui.QMessageBox.No), QtGui.QMessageBox.No) else: @@ -469,7 +454,7 @@ class ThemeManager(QtGui.QWidget): def baseTheme(self): log.debug(u'base theme created') newtheme = ThemeXML() - newtheme.new_document(u'New Theme') + newtheme.new_document(self.trUtf8(u'New Theme')) newtheme.add_background_solid(unicode(u'#000000')) newtheme.add_font(unicode(QtGui.QFont().family()), unicode(u'#FFFFFF'), unicode(30), u'False') @@ -510,6 +495,7 @@ class ThemeManager(QtGui.QWidget): theme.font_main_color = theme.font_main_color.strip() theme.font_main_height = theme.font_main_height.strip() theme.font_main_italics = str_to_bool(theme.font_main_italics) + theme.font_main_indentation = int(theme.font_main_indentation) theme.font_main_name = theme.font_main_name.strip() #theme.font_main_override theme.font_main_proportion = theme.font_main_proportion.strip() diff --git a/openlp/core/ui/themestab.py b/openlp/core/ui/themestab.py index 8dee1b90e..f50e6d227 100644 --- a/openlp/core/ui/themestab.py +++ b/openlp/core/ui/themestab.py @@ -24,7 +24,7 @@ from PyQt4 import QtCore, QtGui -from openlp.core.lib import SettingsTab, translate, Receiver +from openlp.core.lib import SettingsTab, Receiver class ThemesTab(SettingsTab): """ @@ -32,8 +32,9 @@ class ThemesTab(SettingsTab): """ def __init__(self, parent): self.parent = parent - SettingsTab.__init__( - self, translate(u'ThemesTab', u'Themes'), u'Themes') + SettingsTab.__init__(self, u'Themes', u'Themes') + # Use the line below when pulling the translation template file. + #SettingsTab.__init__(self, self.trUtf8(u'Themes'), u'Themes') def setupUi(self): self.setObjectName(u'ThemesTab') @@ -105,17 +106,21 @@ class ThemesTab(SettingsTab): QtCore.SIGNAL(u'update_themes'), self.updateThemeList) def retranslateUi(self): - self.GlobalGroupBox.setTitle(translate(u'ThemesTab', u'Global theme')) - self.LevelGroupBox.setTitle(translate(u'ThemesTab', u'Theme level')) - self.SongLevelRadioButton.setText( - translate(u'ThemesTab', u'Song level')) - self.SongLevelLabel.setText(translate(u'ThemesTab', u'Use the theme from each song in the database. If a song doesn\'t have a theme associated with it, then use the service\'s theme. If the service doesn\'t have a theme, then use the global theme.')) - self.ServiceLevelRadioButton.setText( - translate(u'ThemesTab', u'Service level')) - self.ServiceLevelLabel.setText(translate(u'ThemesTab', u'Use the theme from the service, overriding any of the individual songs\' themes. If the service doesn\'t have a theme, then use the global theme.')) - self.GlobalLevelRadioButton.setText( - translate(u'ThemesTab', u'Global level')) - self.GlobalLevelLabel.setText(translate(u'ThemesTab', u'Use the global theme, overriding any themes associated with either the service or the songs.')) + self.GlobalGroupBox.setTitle(self.trUtf8(u'Global theme')) + self.LevelGroupBox.setTitle(self.trUtf8(u'Theme level')) + self.SongLevelRadioButton.setText(self.trUtf8(u'Song level')) + self.SongLevelLabel.setText(self.trUtf8(u'Use the theme from each song ' + u'in the database. If a song doesn\'t have a theme associated with ' + u'it, then use the service\'s theme. If the service doesn\'t have ' + u'a theme, then use the global theme.')) + self.ServiceLevelRadioButton.setText(self.trUtf8(u'Service level')) + self.ServiceLevelLabel.setText(self.trUtf8(u'Use the theme from the ' + u'service, overriding any of the individual songs\' themes. If the ' + u'service doesn\'t have a theme, then use the global theme.')) + self.GlobalLevelRadioButton.setText(self.trUtf8(u'Global level')) + self.GlobalLevelLabel.setText(self.trUtf8(u'Use the global theme, ' + u'overriding any themes associated with either the service or the ' + u'songs.')) def load(self): self.global_style = self.config.get_config( @@ -137,17 +142,17 @@ class ThemesTab(SettingsTab): Receiver().send_message(u'update_global_theme', self.global_theme ) def onSongLevelButtonPressed(self): - self.global_style= u'Song' + self.global_style = u'Song' self.parent.RenderManager.set_global_theme( self.global_theme, self.global_style) def onServiceLevelButtonPressed(self): - self.global_style= u'Service' + self.global_style = u'Service' self.parent.RenderManager.set_global_theme( self.global_theme, self.global_style) def onGlobalLevelButtonPressed(self): - self.global_style= u'Global' + self.global_style = u'Global' self.parent.RenderManager.set_global_theme( self.global_theme, self.global_style) diff --git a/openlp/migration/migratesongs.py b/openlp/migration/migratesongs.py index 51695b9cb..8fced1650 100644 --- a/openlp/migration/migratesongs.py +++ b/openlp/migration/migratesongs.py @@ -170,12 +170,12 @@ class MigrateSongs(): else: author = self.session.query(Author).get(bb[0]) song.authors.append(author) - try: - self.session.add(song) - self.session.commit() - except: - self.session.rollback() - print u'Errow thrown = ', sys.exc_info()[1] + try: + self.session.add(song) + self.session.commit() + except: + self.session.rollback() + print u'Error thrown = ', sys.exc_info()[1] def _v1_9_0_cleanup(self, database): self.display.sub_output(u'Update Internal Data ' + database) diff --git a/openlp/plugins/audit/auditplugin.py b/openlp/plugins/audit/auditplugin.py index 21c0d7b98..a02146022 100644 --- a/openlp/plugins/audit/auditplugin.py +++ b/openlp/plugins/audit/auditplugin.py @@ -27,7 +27,7 @@ import logging from PyQt4 import QtCore, QtGui -from openlp.core.lib import Plugin, Receiver, translate, str_to_bool, buildIcon +from openlp.core.lib import Plugin, Receiver, str_to_bool, buildIcon from openlp.plugins.audit.lib import AuditManager from openlp.plugins.audit.forms import AuditDetailForm, AuditDeleteForm from openlp.plugins.audit.lib.models import AuditItem @@ -62,21 +62,18 @@ class AuditPlugin(Plugin): self.toolsMenu = tools_menu self.AuditMenu = QtGui.QMenu(tools_menu) self.AuditMenu.setObjectName(u'AuditMenu') - self.AuditMenu.setTitle( - translate(u'AuditPlugin', u'&Audit')) + self.AuditMenu.setTitle(tools_menu.trUtf8(u'&Audit')) #Audit Delete self.AuditDelete = QtGui.QAction(tools_menu) - self.AuditDelete.setText( - translate(u'AuditPlugin', u'Audit &Delete')) + self.AuditDelete.setText(tools_menu.trUtf8(u'Audit &Delete')) self.AuditDelete.setStatusTip( - translate(u'AuditPlugin', u'Delete all audit data to sepecified date')) + tools_menu.trUtf8(u'Delete all audit data to sepecified date')) self.AuditDelete.setObjectName(u'AuditDelete') #Audit Report self.AuditReport = QtGui.QAction(tools_menu) - self.AuditReport.setText( - translate(u'AuditPlugin', u'Au&dit &Extract')) + self.AuditReport.setText(tools_menu.trUtf8(u'Au&dit &Extract')) self.AuditReport.setStatusTip( - translate(u'AuditPlugin', u'Generate Extracts on Audit Data')) + tools_menu.trUtf8(u'Generate Extracts on Audit Data')) self.AuditReport.setObjectName(u'AuditReport') #Audit activation AuditIcon = buildIcon(u':/tools/tools_alert.png') @@ -84,10 +81,10 @@ class AuditPlugin(Plugin): self.AuditStatus.setIcon(AuditIcon) self.AuditStatus.setCheckable(True) self.AuditStatus.setChecked(False) - self.AuditStatus.setText(translate(u'AuditPlugin', u'A&udit Status')) + self.AuditStatus.setText(tools_menu.trUtf8(u'A&udit Status')) self.AuditStatus.setStatusTip( - translate(u'AuditPlugin', u'Start/Stop live song auditing')) - self.AuditStatus.setShortcut(translate(u'AuditPlugin', u'F4')) + tools_menu.trUtf8(u'Start/Stop live song auditing')) + self.AuditStatus.setShortcut(u'F4') self.AuditStatus.setObjectName(u'AuditStatus') #Add Menus together self.toolsMenu.addAction(self.AuditMenu.menuAction()) @@ -163,7 +160,10 @@ class AuditPlugin(Plugin): self.auditdeleteform.exec_() def onAuditReport(self): + self.auditdetailform.initialise() self.auditdetailform.exec_() def about(self): - return u'Audit Plugin
This plugin records the use of songs and when they have been used during a live service' + about_text = u'Audit Plugin
This plugin records the use '\ + u'of songs and when they have been used during a live service' + return about_text diff --git a/openlp/plugins/audit/forms/auditdeletedialog.py b/openlp/plugins/audit/forms/auditdeletedialog.py index dddb5c8c5..75ff8b63d 100644 --- a/openlp/plugins/audit/forms/auditdeletedialog.py +++ b/openlp/plugins/audit/forms/auditdeletedialog.py @@ -11,29 +11,35 @@ from PyQt4 import QtCore, QtGui class Ui_AuditDeleteDialog(object): def setupUi(self, AuditDeleteDialog): - AuditDeleteDialog.setObjectName("AuditDeleteDialog") + AuditDeleteDialog.setObjectName(u'AuditDeleteDialog') AuditDeleteDialog.resize(291, 243) self.layoutWidget = QtGui.QWidget(AuditDeleteDialog) self.layoutWidget.setGeometry(QtCore.QRect(20, 10, 247, 181)) - self.layoutWidget.setObjectName("layoutWidget") + self.layoutWidget.setObjectName(u'layoutWidget') self.verticalLayout = QtGui.QVBoxLayout(self.layoutWidget) - self.verticalLayout.setObjectName("verticalLayout") + self.verticalLayout.setObjectName(u'verticalLayout') self.DeleteCalendar = QtGui.QCalendarWidget(self.layoutWidget) self.DeleteCalendar.setFirstDayOfWeek(QtCore.Qt.Sunday) self.DeleteCalendar.setGridVisible(True) - self.DeleteCalendar.setVerticalHeaderFormat(QtGui.QCalendarWidget.NoVerticalHeader) - self.DeleteCalendar.setObjectName("DeleteCalendar") + self.DeleteCalendar.setVerticalHeaderFormat( + QtGui.QCalendarWidget.NoVerticalHeader) + self.DeleteCalendar.setObjectName(u'DeleteCalendar') self.verticalLayout.addWidget(self.DeleteCalendar) self.buttonBox = QtGui.QDialogButtonBox(AuditDeleteDialog) self.buttonBox.setGeometry(QtCore.QRect(30, 210, 245, 25)) - self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok) - self.buttonBox.setObjectName("buttonBox") + self.buttonBox.setStandardButtons( + QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok) + self.buttonBox.setObjectName(u'buttonBox') self.retranslateUi(AuditDeleteDialog) - QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"), AuditDeleteDialog.accept) - QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("rejected()"), AuditDeleteDialog.close) + QtCore.QObject.connect( + self.buttonBox, QtCore.SIGNAL(u'accepted()'), + AuditDeleteDialog.accept) + QtCore.QObject.connect( + self.buttonBox, QtCore.SIGNAL(u'rejected()'), + AuditDeleteDialog.close) QtCore.QMetaObject.connectSlotsByName(AuditDeleteDialog) def retranslateUi(self, AuditDeleteDialog): - AuditDeleteDialog.setWindowTitle(QtGui.QApplication.translate("AuditDeleteDialog", "Audit Delete ", None, QtGui.QApplication.UnicodeUTF8)) + AuditDeleteDialog.setWindowTitle(self.trUtf8(u'Audit Delete')) diff --git a/openlp/plugins/audit/forms/auditdeleteform.py b/openlp/plugins/audit/forms/auditdeleteform.py index fbe07d142..d2e647a44 100644 --- a/openlp/plugins/audit/forms/auditdeleteform.py +++ b/openlp/plugins/audit/forms/auditdeleteform.py @@ -27,8 +27,6 @@ from datetime import date from PyQt4 import QtGui from auditdeletedialog import Ui_AuditDeleteDialog -from openlp.core.lib import translate -#from openlp.plugins.audit.lib import AuditManager class AuditDeleteForm(QtGui.QDialog, Ui_AuditDeleteDialog): """ @@ -44,8 +42,8 @@ class AuditDeleteForm(QtGui.QDialog, Ui_AuditDeleteDialog): def accept(self): ret = QtGui.QMessageBox.question(self, - translate(u'mainWindow', u'Delete Selected Audit Events?'), - translate(u'mainWindow', u'Are you sure you want to delete selected Audit Data?'), + self.trUtf8(u'Delete Selected Audit Events?'), + self.trUtf8(u'Are you sure you want to delete selected Audit Data?'), QtGui.QMessageBox.StandardButtons( QtGui.QMessageBox.Ok | QtGui.QMessageBox.Cancel), diff --git a/openlp/plugins/audit/forms/auditdetaildialog.py b/openlp/plugins/audit/forms/auditdetaildialog.py index 6eb1ec2e5..a17181bc5 100644 --- a/openlp/plugins/audit/forms/auditdetaildialog.py +++ b/openlp/plugins/audit/forms/auditdetaildialog.py @@ -11,157 +11,171 @@ from PyQt4 import QtCore, QtGui class Ui_AuditDetailDialog(object): def setupUi(self, AuditDetailDialog): - AuditDetailDialog.setObjectName("AuditDetailDialog") + AuditDetailDialog.setObjectName(u'AuditDetailDialog') AuditDetailDialog.resize(593, 501) self.buttonBox = QtGui.QDialogButtonBox(AuditDetailDialog) self.buttonBox.setGeometry(QtCore.QRect(420, 470, 170, 25)) - self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok) - self.buttonBox.setObjectName("buttonBox") + self.buttonBox.setStandardButtons( + QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok) + self.buttonBox.setObjectName(u'buttonBox') self.FileGroupBox = QtGui.QGroupBox(AuditDetailDialog) self.FileGroupBox.setGeometry(QtCore.QRect(10, 370, 571, 70)) - self.FileGroupBox.setObjectName("FileGroupBox") + self.FileGroupBox.setObjectName(u'FileGroupBox') self.verticalLayout_4 = QtGui.QVBoxLayout(self.FileGroupBox) - self.verticalLayout_4.setObjectName("verticalLayout_4") + self.verticalLayout_4.setObjectName(u'verticalLayout_4') self.horizontalLayout = QtGui.QHBoxLayout() - self.horizontalLayout.setObjectName("horizontalLayout") + self.horizontalLayout.setObjectName(u'horizontalLayout') self.FileLineEdit = QtGui.QLineEdit(self.FileGroupBox) - self.FileLineEdit.setObjectName("FileLineEdit") + self.FileLineEdit.setObjectName(u'FileLineEdit') self.horizontalLayout.addWidget(self.FileLineEdit) self.SaveFilePushButton = QtGui.QPushButton(self.FileGroupBox) icon = QtGui.QIcon() - icon.addPixmap(QtGui.QPixmap(":/exports/export_load.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + icon.addPixmap(QtGui.QPixmap(u':/exports/export_load.png'), + QtGui.QIcon.Normal, QtGui.QIcon.Off) self.SaveFilePushButton.setIcon(icon) - self.SaveFilePushButton.setObjectName("SaveFilePushButton") + self.SaveFilePushButton.setObjectName(u'SaveFilePushButton') self.horizontalLayout.addWidget(self.SaveFilePushButton) self.verticalLayout_4.addLayout(self.horizontalLayout) self.layoutWidget = QtGui.QWidget(AuditDetailDialog) self.layoutWidget.setGeometry(QtCore.QRect(10, 10, 561, 361)) - self.layoutWidget.setObjectName("layoutWidget") + self.layoutWidget.setObjectName(u'layoutWidget') self.verticalLayout_3 = QtGui.QVBoxLayout(self.layoutWidget) - self.verticalLayout_3.setObjectName("verticalLayout_3") + self.verticalLayout_3.setObjectName(u'verticalLayout_3') self.ReportTypeGroup = QtGui.QGroupBox(self.layoutWidget) - self.ReportTypeGroup.setObjectName("ReportTypeGroup") + self.ReportTypeGroup.setObjectName(u'ReportTypeGroup') self.layoutWidget1 = QtGui.QWidget(self.ReportTypeGroup) self.layoutWidget1.setGeometry(QtCore.QRect(50, 40, 481, 23)) - self.layoutWidget1.setObjectName("layoutWidget1") + self.layoutWidget1.setObjectName(u'layoutWidget1') self.ReportHorizontalLayout = QtGui.QHBoxLayout(self.layoutWidget1) - self.ReportHorizontalLayout.setObjectName("ReportHorizontalLayout") + self.ReportHorizontalLayout.setObjectName(u'ReportHorizontalLayout') self.SummaryReport = QtGui.QRadioButton(self.layoutWidget1) - self.SummaryReport.setObjectName("SummaryReport") + self.SummaryReport.setObjectName(u'SummaryReport') self.ReportHorizontalLayout.addWidget(self.SummaryReport) self.DetailedReport = QtGui.QRadioButton(self.layoutWidget1) self.DetailedReport.setChecked(True) - self.DetailedReport.setObjectName("DetailedReport") + self.DetailedReport.setObjectName(u'DetailedReport') self.ReportHorizontalLayout.addWidget(self.DetailedReport) self.verticalLayout_3.addWidget(self.ReportTypeGroup) self.DateRangeGroupBox = QtGui.QGroupBox(self.layoutWidget) - self.DateRangeGroupBox.setObjectName("DateRangeGroupBox") + self.DateRangeGroupBox.setObjectName(u'DateRangeGroupBox') self.verticalLayout_2 = QtGui.QVBoxLayout(self.DateRangeGroupBox) - self.verticalLayout_2.setObjectName("verticalLayout_2") + self.verticalLayout_2.setObjectName(u'verticalLayout_2') self.DateHorizontalLayout = QtGui.QHBoxLayout() - self.DateHorizontalLayout.setObjectName("DateHorizontalLayout") + self.DateHorizontalLayout.setObjectName(u'DateHorizontalLayout') self.FromDateEdit = QtGui.QDateEdit(self.DateRangeGroupBox) self.FromDateEdit.setCalendarPopup(True) - self.FromDateEdit.setObjectName("FromDateEdit") + self.FromDateEdit.setObjectName(u'FromDateEdit') self.DateHorizontalLayout.addWidget(self.FromDateEdit) self.To = QtGui.QLabel(self.DateRangeGroupBox) - self.To.setObjectName("To") + self.To.setObjectName(u'To') self.DateHorizontalLayout.addWidget(self.To) self.ToDateEdit = QtGui.QDateEdit(self.DateRangeGroupBox) self.ToDateEdit.setCalendarPopup(True) - self.ToDateEdit.setObjectName("ToDateEdit") + self.ToDateEdit.setObjectName(u'ToDateEdit') self.DateHorizontalLayout.addWidget(self.ToDateEdit) self.verticalLayout_2.addLayout(self.DateHorizontalLayout) self.verticalLayout_3.addWidget(self.DateRangeGroupBox) self.TimePeriodGroupBox = QtGui.QGroupBox(self.layoutWidget) - self.TimePeriodGroupBox.setObjectName("TimePeriodGroupBox") + self.TimePeriodGroupBox.setObjectName(u'TimePeriodGroupBox') self.verticalLayout = QtGui.QVBoxLayout(self.TimePeriodGroupBox) - self.verticalLayout.setObjectName("verticalLayout") + self.verticalLayout.setObjectName(u'verticalLayout') self.FirstHorizontalLayout = QtGui.QHBoxLayout() - self.FirstHorizontalLayout.setObjectName("FirstHorizontalLayout") + self.FirstHorizontalLayout.setObjectName(u'FirstHorizontalLayout') self.FirstCheckBox = QtGui.QCheckBox(self.TimePeriodGroupBox) self.FirstCheckBox.setChecked(True) - self.FirstCheckBox.setObjectName("FirstCheckBox") + self.FirstCheckBox.setObjectName(u'FirstCheckBox') self.FirstHorizontalLayout.addWidget(self.FirstCheckBox) self.FirstFromTimeEdit = QtGui.QTimeEdit(self.TimePeriodGroupBox) self.FirstFromTimeEdit.setTime(QtCore.QTime(9, 0, 0)) - self.FirstFromTimeEdit.setObjectName("FirstFromTimeEdit") + self.FirstFromTimeEdit.setObjectName(u'FirstFromTimeEdit') self.FirstHorizontalLayout.addWidget(self.FirstFromTimeEdit) self.FirstTo = QtGui.QLabel(self.TimePeriodGroupBox) - self.FirstTo.setObjectName("FirstTo") + self.FirstTo.setObjectName(u'FirstTo') self.FirstHorizontalLayout.addWidget(self.FirstTo) self.FirstToTimeEdit = QtGui.QTimeEdit(self.TimePeriodGroupBox) self.FirstToTimeEdit.setCalendarPopup(True) self.FirstToTimeEdit.setTime(QtCore.QTime(10, 0, 0)) - self.FirstToTimeEdit.setObjectName("FirstToTimeEdit") + self.FirstToTimeEdit.setObjectName(u'FirstToTimeEdit') self.FirstHorizontalLayout.addWidget(self.FirstToTimeEdit) self.verticalLayout.addLayout(self.FirstHorizontalLayout) self.SecondHorizontalLayout = QtGui.QHBoxLayout() - self.SecondHorizontalLayout.setObjectName("SecondHorizontalLayout") + self.SecondHorizontalLayout.setObjectName(u'SecondHorizontalLayout') self.SecondCheckBox = QtGui.QCheckBox(self.TimePeriodGroupBox) self.SecondCheckBox.setChecked(True) - self.SecondCheckBox.setObjectName("SecondCheckBox") + self.SecondCheckBox.setObjectName(u'SecondCheckBox') self.SecondHorizontalLayout.addWidget(self.SecondCheckBox) self.SecondFromTimeEdit = QtGui.QTimeEdit(self.TimePeriodGroupBox) self.SecondFromTimeEdit.setTime(QtCore.QTime(10, 45, 0)) - self.SecondFromTimeEdit.setObjectName("SecondFromTimeEdit") + self.SecondFromTimeEdit.setObjectName(u'SecondFromTimeEdit') self.SecondHorizontalLayout.addWidget(self.SecondFromTimeEdit) self.SecondTo = QtGui.QLabel(self.TimePeriodGroupBox) - self.SecondTo.setObjectName("SecondTo") + self.SecondTo.setObjectName(u'SecondTo') self.SecondHorizontalLayout.addWidget(self.SecondTo) self.SecondToTimeEdit = QtGui.QTimeEdit(self.TimePeriodGroupBox) - self.SecondToTimeEdit.setObjectName("SecondToTimeEdit") + self.SecondToTimeEdit.setObjectName(u'SecondToTimeEdit') self.SecondHorizontalLayout.addWidget(self.SecondToTimeEdit) self.verticalLayout.addLayout(self.SecondHorizontalLayout) self.ThirdHorizontalLayout = QtGui.QHBoxLayout() - self.ThirdHorizontalLayout.setObjectName("ThirdHorizontalLayout") + self.ThirdHorizontalLayout.setObjectName(u'ThirdHorizontalLayout') self.ThirdCheckBox = QtGui.QCheckBox(self.TimePeriodGroupBox) self.ThirdCheckBox.setChecked(True) - self.ThirdCheckBox.setObjectName("ThirdCheckBox") + self.ThirdCheckBox.setObjectName(u'ThirdCheckBox') self.ThirdHorizontalLayout.addWidget(self.ThirdCheckBox) self.ThirdFromTimeEdit = QtGui.QTimeEdit(self.TimePeriodGroupBox) self.ThirdFromTimeEdit.setTime(QtCore.QTime(18, 30, 0)) - self.ThirdFromTimeEdit.setObjectName("ThirdFromTimeEdit") + self.ThirdFromTimeEdit.setObjectName(u'ThirdFromTimeEdit') self.ThirdHorizontalLayout.addWidget(self.ThirdFromTimeEdit) self.ThirdTo = QtGui.QLabel(self.TimePeriodGroupBox) - self.ThirdTo.setObjectName("ThirdTo") + self.ThirdTo.setObjectName(u'ThirdTo') self.ThirdHorizontalLayout.addWidget(self.ThirdTo) self.ThirdToTimeEdit = QtGui.QTimeEdit(self.TimePeriodGroupBox) self.ThirdToTimeEdit.setTime(QtCore.QTime(19, 30, 0)) - self.ThirdToTimeEdit.setObjectName("ThirdToTimeEdit") + self.ThirdToTimeEdit.setObjectName(u'ThirdToTimeEdit') self.ThirdHorizontalLayout.addWidget(self.ThirdToTimeEdit) self.verticalLayout.addLayout(self.ThirdHorizontalLayout) self.verticalLayout_3.addWidget(self.TimePeriodGroupBox) self.retranslateUi(AuditDetailDialog) - QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"), AuditDetailDialog.accept) - QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("rejected()"), AuditDetailDialog.close) - QtCore.QObject.connect(self.FirstCheckBox, QtCore.SIGNAL("stateChanged(int)"), AuditDetailDialog.changeFirstService) - QtCore.QObject.connect(self.SecondCheckBox, QtCore.SIGNAL("stateChanged(int)"), AuditDetailDialog.changeSecondService) - QtCore.QObject.connect(self.ThirdCheckBox, QtCore.SIGNAL("stateChanged(int)"), AuditDetailDialog.changeThirdService) - QtCore.QObject.connect(self.SaveFilePushButton, QtCore.SIGNAL("pressed()"), AuditDetailDialog.defineOutputLocation) + QtCore.QObject.connect( + self.buttonBox, QtCore.SIGNAL(u'accepted()'), + AuditDetailDialog.accept) + QtCore.QObject.connect( + self.buttonBox, QtCore.SIGNAL(u'rejected()'), + AuditDetailDialog.close) + QtCore.QObject.connect( + self.FirstCheckBox, QtCore.SIGNAL(u'stateChanged(int)'), + AuditDetailDialog.changeFirstService) + QtCore.QObject.connect( + self.SecondCheckBox, QtCore.SIGNAL(u'stateChanged(int)'), + AuditDetailDialog.changeSecondService) + QtCore.QObject.connect( + self.ThirdCheckBox, QtCore.SIGNAL(u'stateChanged(int)'), + AuditDetailDialog.changeThirdService) + QtCore.QObject.connect( + self.SaveFilePushButton, QtCore.SIGNAL(u'pressed()'), + AuditDetailDialog.defineOutputLocation) QtCore.QMetaObject.connectSlotsByName(AuditDetailDialog) def retranslateUi(self, AuditDetailDialog): - AuditDetailDialog.setWindowTitle(QtGui.QApplication.translate("AuditDetailDialog", "Audit Detail Extraction", None, QtGui.QApplication.UnicodeUTF8)) - self.FileGroupBox.setTitle(QtGui.QApplication.translate("AuditDetailDialog", "Report Location", None, QtGui.QApplication.UnicodeUTF8)) - self.ReportTypeGroup.setTitle(QtGui.QApplication.translate("AuditDetailDialog", "Report Type", None, QtGui.QApplication.UnicodeUTF8)) - self.SummaryReport.setText(QtGui.QApplication.translate("AuditDetailDialog", "Summary", None, QtGui.QApplication.UnicodeUTF8)) - self.DetailedReport.setText(QtGui.QApplication.translate("AuditDetailDialog", "Detailed", None, QtGui.QApplication.UnicodeUTF8)) - self.DateRangeGroupBox.setTitle(QtGui.QApplication.translate("AuditDetailDialog", "Select Date Range", None, QtGui.QApplication.UnicodeUTF8)) - self.FromDateEdit.setDisplayFormat(QtGui.QApplication.translate("AuditDetailDialog", "dd/MM/yyyy", None, QtGui.QApplication.UnicodeUTF8)) - self.To.setText(QtGui.QApplication.translate("AuditDetailDialog", "to", None, QtGui.QApplication.UnicodeUTF8)) - self.ToDateEdit.setDisplayFormat(QtGui.QApplication.translate("AuditDetailDialog", "dd/MM/yyyy", None, QtGui.QApplication.UnicodeUTF8)) - self.TimePeriodGroupBox.setTitle(QtGui.QApplication.translate("AuditDetailDialog", "Select Time Periods", None, QtGui.QApplication.UnicodeUTF8)) - self.FirstCheckBox.setText(QtGui.QApplication.translate("AuditDetailDialog", "First Service", None, QtGui.QApplication.UnicodeUTF8)) - self.FirstFromTimeEdit.setDisplayFormat(QtGui.QApplication.translate("AuditDetailDialog", "hh:mm AP", None, QtGui.QApplication.UnicodeUTF8)) - self.FirstTo.setText(QtGui.QApplication.translate("AuditDetailDialog", "to", None, QtGui.QApplication.UnicodeUTF8)) - self.FirstToTimeEdit.setDisplayFormat(QtGui.QApplication.translate("AuditDetailDialog", "hh:mm AP", None, QtGui.QApplication.UnicodeUTF8)) - self.SecondCheckBox.setText(QtGui.QApplication.translate("AuditDetailDialog", "Second Service", None, QtGui.QApplication.UnicodeUTF8)) - self.SecondFromTimeEdit.setDisplayFormat(QtGui.QApplication.translate("AuditDetailDialog", "hh:mm AP", None, QtGui.QApplication.UnicodeUTF8)) - self.SecondTo.setText(QtGui.QApplication.translate("AuditDetailDialog", "to", None, QtGui.QApplication.UnicodeUTF8)) - self.SecondToTimeEdit.setDisplayFormat(QtGui.QApplication.translate("AuditDetailDialog", "hh:mm AP", None, QtGui.QApplication.UnicodeUTF8)) - self.ThirdCheckBox.setText(QtGui.QApplication.translate("AuditDetailDialog", "Third Service", None, QtGui.QApplication.UnicodeUTF8)) - self.ThirdFromTimeEdit.setDisplayFormat(QtGui.QApplication.translate("AuditDetailDialog", "hh:mm AP", None, QtGui.QApplication.UnicodeUTF8)) - self.ThirdTo.setText(QtGui.QApplication.translate("AuditDetailDialog", "to", None, QtGui.QApplication.UnicodeUTF8)) - self.ThirdToTimeEdit.setDisplayFormat(QtGui.QApplication.translate("AuditDetailDialog", "hh:mm AP", None, QtGui.QApplication.UnicodeUTF8)) + AuditDetailDialog.setWindowTitle(self.trUtf8(u'Audit Detail Extraction')) + self.FileGroupBox.setTitle(self.trUtf8(u'Report Location')) + self.ReportTypeGroup.setTitle(self.trUtf8(u'Report Type')) + self.SummaryReport.setText(self.trUtf8(u'Summary')) + self.DetailedReport.setText(self.trUtf8(u'Detailed')) + self.DateRangeGroupBox.setTitle(self.trUtf8(u'Select Date Range')) + self.FromDateEdit.setDisplayFormat(self.trUtf8(u'dd/MM/yyyy')) + self.To.setText(self.trUtf8(u'to')) + self.ToDateEdit.setDisplayFormat(self.trUtf8(u'dd/MM/yyyy')) + self.TimePeriodGroupBox.setTitle(self.trUtf8(u'Select Time Periods')) + self.FirstCheckBox.setText(self.trUtf8(u'First Service')) + self.FirstFromTimeEdit.setDisplayFormat(self.trUtf8(u'hh:mm AP')) + self.FirstTo.setText(self.trUtf8(u'to')) + self.FirstToTimeEdit.setDisplayFormat(self.trUtf8(u'hh:mm AP')) + self.SecondCheckBox.setText(self.trUtf8(u'Second Service')) + self.SecondFromTimeEdit.setDisplayFormat(self.trUtf8(u'hh:mm AP')) + self.SecondTo.setText(self.trUtf8(u'to')) + self.SecondToTimeEdit.setDisplayFormat(self.trUtf8(u'hh:mm AP')) + self.ThirdCheckBox.setText(self.trUtf8(u'Third Service')) + self.ThirdFromTimeEdit.setDisplayFormat(self.trUtf8(u'hh:mm AP')) + self.ThirdTo.setText(self.trUtf8(u'to')) + self.ThirdToTimeEdit.setDisplayFormat(self.trUtf8(u'hh:mm AP')) diff --git a/openlp/plugins/audit/forms/auditdetailform.py b/openlp/plugins/audit/forms/auditdetailform.py index d93c07527..275de3229 100644 --- a/openlp/plugins/audit/forms/auditdetailform.py +++ b/openlp/plugins/audit/forms/auditdetailform.py @@ -37,41 +37,86 @@ class AuditDetailForm(QtGui.QDialog, Ui_AuditDetailDialog): QtGui.QDialog.__init__(self, None) self.parent = parent self.setupUi(self) - self.initialise() def initialise(self): - self.firstService = \ - int(self.parent.config.get_config(u'first service', QtCore.Qt.Checked)) - self.secondService = \ - int(self.parent.config.get_config(u'second service', QtCore.Qt.Checked)) + self.FirstCheckBox.setCheckState( + int(self.parent.config.get_config(u'first service', QtCore.Qt.Checked))) + self.SecondCheckBox.setCheckState( + int(self.parent.config.get_config(u'second service', QtCore.Qt.Checked))) + self.ThirdCheckBox.setCheckState( + int(self.parent.config.get_config(u'third service', QtCore.Qt.Checked))) + year = QtCore.QDate().currentDate().year() + if QtCore.QDate().currentDate().month() < 9: + year -= 1 + toDate = QtCore.QDate(year, 8, 31) + fromDate = QtCore.QDate(year - 1, 9, 1) + self.FromDateEdit.setDate(fromDate) + self.ToDateEdit.setDate(toDate) + self.FileLineEdit.setText(self.parent.config.get_last_dir(1)) self.resetWindow() def changeFirstService(self, value): - self.firstService = value self.parent.config.set_config(u'first service', value) self.resetWindow() def changeSecondService(self, value): - self.secondService = value self.parent.config.set_config(u'second service', value) self.resetWindow() def changeThirdService(self, value): - pass + self.parent.config.set_config(u'third service', value) + self.resetWindow() def defineOutputLocation(self): - pass + path = QtGui.QFileDialog.getExistingDirectory(self, + self.trUtf8(u'Output File Location'), + self.parent.config.get_last_dir(1) ) + path = unicode(path) + if path != u'': + self.parent.config.set_last_dir(path, 1) + self.FileLineEdit.setText(path) def resetWindow(self): - if self.firstService == QtCore.Qt.Unchecked: + if self.FirstCheckBox.checkState() == QtCore.Qt.Unchecked: self.FirstFromTimeEdit.setEnabled(False) self.FirstToTimeEdit.setEnabled(False) else: self.FirstFromTimeEdit.setEnabled(True) self.FirstToTimeEdit.setEnabled(True) - if self.secondService == QtCore.Qt.Unchecked: + if self.SecondCheckBox.checkState() == QtCore.Qt.Unchecked: self.SecondFromTimeEdit.setEnabled(False) self.SecondToTimeEdit.setEnabled(False) else: self.SecondFromTimeEdit.setEnabled(True) self.SecondToTimeEdit.setEnabled(True) + if self.ThirdCheckBox.checkState() == QtCore.Qt.Unchecked: + self.ThirdFromTimeEdit.setEnabled(False) + self.ThirdToTimeEdit.setEnabled(False) + else: + self.ThirdFromTimeEdit.setEnabled(True) + self.ThirdToTimeEdit.setEnabled(True) + + def accept(self): + print self.DetailedReport.isChecked() + print self.SummaryReport.isChecked() + print self.FromDateEdit.date() + print self.ToDateEdit.date() + if self.DetailedReport.isChecked(): + self.detailedReport() + else: + self.summaryReport() + self.close() + + def detailedReport(self): + print "detailed" + filename = u'audit_det_%s_%s.txt' % \ + (self.FromDateEdit.date().toString(u'ddMMyyyy'), + self.ToDateEdit.date().toString(u'ddMMyyyy')) + print filename + + def summaryReport(self): + print "summary" + filename = u'audit_sum_%s_%s.txt' % \ + (self.FromDateEdit.date().toString(u'ddMMyyyy'), + self.ToDateEdit.date().toString(u'ddMMyyyy')) + print filename diff --git a/openlp/plugins/bibles/bibleplugin.py b/openlp/plugins/bibles/bibleplugin.py index 944e94b18..eb1018bf2 100644 --- a/openlp/plugins/bibles/bibleplugin.py +++ b/openlp/plugins/bibles/bibleplugin.py @@ -26,7 +26,7 @@ import logging from PyQt4 import QtCore, QtGui -from openlp.core.lib import Plugin, translate, buildIcon +from openlp.core.lib import Plugin, buildIcon from openlp.plugins.bibles.lib import BibleManager, BiblesTab, BibleMediaItem class BiblePlugin(Plugin): @@ -73,7 +73,7 @@ class BiblePlugin(Plugin): self.ImportBibleItem = QtGui.QAction(import_menu) self.ImportBibleItem.setObjectName(u'ImportBibleItem') import_menu.addAction(self.ImportBibleItem) - self.ImportBibleItem.setText(translate(u'BiblePlugin', u'&Bible')) + self.ImportBibleItem.setText(import_menu.trUtf8(u'&Bible')) # Signals and slots QtCore.QObject.connect(self.ImportBibleItem, QtCore.SIGNAL(u'triggered()'), self.onBibleNewClick) @@ -83,7 +83,7 @@ class BiblePlugin(Plugin): self.ExportBibleItem = QtGui.QAction(export_menu) self.ExportBibleItem.setObjectName(u'ExportBibleItem') export_menu.addAction(self.ExportBibleItem) - self.ExportBibleItem.setText(translate(u'BiblePlugin', u'&Bible')) + self.ExportBibleItem.setText(export_menu.trUtf8(u'&Bible')) self.ExportBibleItem.setVisible(False) def onBibleNewClick(self): @@ -91,4 +91,8 @@ class BiblePlugin(Plugin): self.media_item.onNewClick() def about(self): - return u'Bible Plugin
This plugin allows bible verse from different sources to be displayed on the screen during the service.

This is a core plugin and cannot be made inactive' + about_text = u'Bible Plugin
This plugin allows '\ + u'bible verse from different sources to be displayed on the '\ + u'screen during the service.

This is a core '\ + u'plugin and cannot be made inactive' + return about_text diff --git a/openlp/plugins/bibles/forms/bibleimportdialog.py b/openlp/plugins/bibles/forms/bibleimportdialog.py index 1837a1e5e..1f275718a 100644 --- a/openlp/plugins/bibles/forms/bibleimportdialog.py +++ b/openlp/plugins/bibles/forms/bibleimportdialog.py @@ -224,31 +224,34 @@ class Ui_BibleImportDialog(object): BibleImportDialog.setTabOrder(self.CopyrightEdit, self.PermisionEdit) def retranslateUi(self, BibleImportDialog): - BibleImportDialog.setWindowTitle(QtGui.QApplication.translate(u'BibleImportDialog', u'Bible Registration', None, QtGui.QApplication.UnicodeUTF8)) - self.LicenceDetailsGroupBox.setTitle(QtGui.QApplication.translate(u'BibleImportDialog', u'Licence Details', None, QtGui.QApplication.UnicodeUTF8)) - self.VersionNameLabel.setText(QtGui.QApplication.translate(u'BibleImportDialog', u'Version Name:', None, QtGui.QApplication.UnicodeUTF8)) - self.CopyrightLabel.setText(QtGui.QApplication.translate(u'BibleImportDialog', u'Copyright:', None, QtGui.QApplication.UnicodeUTF8)) - self.PermisionLabel.setText(QtGui.QApplication.translate(u'BibleImportDialog', u'Permission:', None, QtGui.QApplication.UnicodeUTF8)) - self.ProgressGroupBox.setTitle(QtGui.QApplication.translate(u'BibleImportDialog', u'Import Progress', None, QtGui.QApplication.UnicodeUTF8)) - self.ProgressBar.setFormat(QtGui.QApplication.translate(u'BibleImportDialog', u'%p', None, QtGui.QApplication.UnicodeUTF8)) - self.ImportButton.setText(QtGui.QApplication.translate(u'BibleImportDialog', u'Import', None, QtGui.QApplication.UnicodeUTF8)) - self.CancelButton.setText(QtGui.QApplication.translate(u'BibleImportDialog', u'Cancel', None, QtGui.QApplication.UnicodeUTF8)) - self.OSISGroupBox.setTitle(QtGui.QApplication.translate(u'BibleImportDialog', u'OSIS Bible', None, QtGui.QApplication.UnicodeUTF8)) - self.BibleNameLabel.setText(QtGui.QApplication.translate(u'BibleImportDialog', u'Bible Name:', None, QtGui.QApplication.UnicodeUTF8)) - self.LocatioLabel.setText(QtGui.QApplication.translate(u'BibleImportDialog', u'File Location:', None, QtGui.QApplication.UnicodeUTF8)) - self.tabWidget.setTabText(self.tabWidget.indexOf(self.OsisTab), QtGui.QApplication.translate(u'BibleImportDialog', u'Osis (Sword) Imports', None, QtGui.QApplication.UnicodeUTF8)) - self.CVSGroupBox.setTitle(QtGui.QApplication.translate(u'BibleImportDialog', u'CVS Bible', None, QtGui.QApplication.UnicodeUTF8)) - self.BooksLocationLabel.setText(QtGui.QApplication.translate(u'BibleImportDialog', u'Books Location:', None, QtGui.QApplication.UnicodeUTF8)) - self.VerseLocationLabel.setText(QtGui.QApplication.translate(u'BibleImportDialog', u'Verse Location:', None, QtGui.QApplication.UnicodeUTF8)) - self.tabWidget.setTabText(self.tabWidget.indexOf(self.CsvTab), QtGui.QApplication.translate(u'BibleImportDialog', u'CSV File Imports', None, QtGui.QApplication.UnicodeUTF8)) - self.OptionsGroupBox.setTitle(QtGui.QApplication.translate(u'BibleImportDialog', u'Download Options', None, QtGui.QApplication.UnicodeUTF8)) - self.LocationLabel.setText(QtGui.QApplication.translate(u'BibleImportDialog', u'Location:', None, QtGui.QApplication.UnicodeUTF8)) - self.LocationComboBox.setItemText(0, QtGui.QApplication.translate(u'BibleImportDialog', u'Crosswalk', None, QtGui.QApplication.UnicodeUTF8)) - self.BibleLabel.setText(QtGui.QApplication.translate(u'BibleImportDialog', u'Bible:', None, QtGui.QApplication.UnicodeUTF8)) - self.BibleComboBox.setItemText(1, QtGui.QApplication.translate(u'BibleImportDialog', u'NIV', None, QtGui.QApplication.UnicodeUTF8)) - self.BibleComboBox.setItemText(2, QtGui.QApplication.translate(u'BibleImportDialog', u'KJV', None, QtGui.QApplication.UnicodeUTF8)) - self.ProxyGroupBox.setTitle(QtGui.QApplication.translate(u'BibleImportDialog', u'Proxy Settings (Optional)', None, QtGui.QApplication.UnicodeUTF8)) - self.AddressLabel.setText(QtGui.QApplication.translate(u'BibleImportDialog', u'Proxy Address:', None, QtGui.QApplication.UnicodeUTF8)) - self.UsernameLabel.setText(QtGui.QApplication.translate(u'BibleImportDialog', u'Username:', None, QtGui.QApplication.UnicodeUTF8)) - self.PasswordLabel.setText(QtGui.QApplication.translate(u'BibleImportDialog', u'Password:', None, QtGui.QApplication.UnicodeUTF8)) - self.tabWidget.setTabText(self.tabWidget.indexOf(self.HttpTab), QtGui.QApplication.translate(u'BibleImportDialog', u'Web Downloads', None, QtGui.QApplication.UnicodeUTF8)) + BibleImportDialog.setWindowTitle(self.trUtf8(u'Bible Registration')) + self.LicenceDetailsGroupBox.setTitle(self.trUtf8(u'Licence Details')) + self.VersionNameLabel.setText(self.trUtf8(u'Version Name:')) + self.CopyrightLabel.setText(self.trUtf8(u'Copyright:')) + self.PermisionLabel.setText(self.trUtf8(u'Permission:')) + self.ProgressGroupBox.setTitle(self.trUtf8(u'Import Progress')) + self.ProgressBar.setFormat(self.trUtf8(u'%p')) + self.ImportButton.setText(self.trUtf8(u'Import')) + self.CancelButton.setText(self.trUtf8(u'Cancel')) + self.OSISGroupBox.setTitle(self.trUtf8(u'OSIS Bible')) + self.BibleNameLabel.setText(self.trUtf8(u'Bible Name:')) + self.LocatioLabel.setText(self.trUtf8(u'File Location:')) + self.tabWidget.setTabText(self.tabWidget.indexOf(self.OsisTab), + self.trUtf8(u'Osis (Sword) Imports')) + self.CVSGroupBox.setTitle(self.trUtf8(u'CVS Bible')) + self.BooksLocationLabel.setText(self.trUtf8(u'Books Location:')) + self.VerseLocationLabel.setText(self.trUtf8(u'Verse Location:')) + self.tabWidget.setTabText(self.tabWidget.indexOf(self.CsvTab), + self.trUtf8(u'CSV File Imports')) + self.OptionsGroupBox.setTitle(self.trUtf8(u'Download Options')) + self.LocationLabel.setText(self.trUtf8(u'Location:')) + self.LocationComboBox.setItemText(0, self.trUtf8(u'Crosswalk')) + self.BibleLabel.setText(self.trUtf8(u'Bible:')) + self.BibleComboBox.setItemText(1, self.trUtf8(u'NIV')) + self.BibleComboBox.setItemText(2, self.trUtf8(u'KJV')) + self.ProxyGroupBox.setTitle(self.trUtf8(u'Proxy Settings (Optional)')) + self.AddressLabel.setText(self.trUtf8(u'Proxy Address:')) + self.UsernameLabel.setText(self.trUtf8(u'Username:')) + self.PasswordLabel.setText(self.trUtf8(u'Password:')) + self.tabWidget.setTabText(self.tabWidget.indexOf(self.HttpTab), + self.trUtf8(u'Web Downloads')) diff --git a/openlp/plugins/bibles/forms/bibleimportform.py b/openlp/plugins/bibles/forms/bibleimportform.py index 369dd8a57..9a871ec88 100644 --- a/openlp/plugins/bibles/forms/bibleimportform.py +++ b/openlp/plugins/bibles/forms/bibleimportform.py @@ -29,8 +29,7 @@ import os.path from PyQt4 import QtCore, QtGui from bibleimportdialog import Ui_BibleImportDialog -from openlp.core.lib import Receiver, translate - +from openlp.core.lib import Receiver class BibleImportForm(QtGui.QDialog, Ui_BibleImportDialog): global log @@ -57,7 +56,7 @@ class BibleImportForm(QtGui.QDialog, Ui_BibleImportDialog): filepath = os.path.split(os.path.abspath(__file__))[0] filepath = os.path.abspath(os.path.join(filepath, u'..', - u'resources',u'crosswalkbooks.csv')) + u'resources', u'crosswalkbooks.csv')) fbibles=open(filepath, 'r') self.bible_versions = {} self.BibleComboBox.clear() @@ -101,21 +100,24 @@ class BibleImportForm(QtGui.QDialog, Ui_BibleImportDialog): def onVersesFileButtonClicked(self): - filename = QtGui.QFileDialog.getOpenFileName(self, u'Open file',self.config.get_last_dir(1)) + filename = QtGui.QFileDialog.getOpenFileName( + self, self.trUtf8(u'Open file'), self.config.get_last_dir(1)) if filename != u'': self.VerseLocationEdit.setText(filename) self.config.set_last_dir(filename, 1) self.setCsv() def onBooksFileButtonClicked(self): - filename = QtGui.QFileDialog.getOpenFileName(self, u'Open file',self.config.get_last_dir(2)) + filename = QtGui.QFileDialog.getOpenFileName( + self, self.trUtf8(u'Open file'), self.config.get_last_dir(2)) if filename != u'': self.BooksLocationEdit.setText(filename) self.config.set_last_dir(filename, 2) self.setCsv() def onOsisFileButtonClicked(self): - filename = QtGui.QFileDialog.getOpenFileName(self, u'Open file',self.config.get_last_dir(3)) + filename = QtGui.QFileDialog.getOpenFileName( + self, self.trUtf8(u'Open file'), self.config.get_last_dir(3)) if filename != u'': self.OSISLocationEdit.setText(filename) self.config.set_last_dir(filename, 3) @@ -157,18 +159,18 @@ class BibleImportForm(QtGui.QDialog, Ui_BibleImportDialog): def onCancelButtonClicked(self): # tell import to stop - self.message = u'Bible import stopped' + self.message = self.trUtf8(u'Bible import stopped') Receiver().send_message(u'stop_import') # tell bibleplugin to reload the bibles Receiver().send_message(u'pre_load_bibles') self.close() def onImportButtonClicked(self): - message = u'Bible import completed' + message = self.trUtf8(u'Bible import completed') if self.biblemanager is not None: if not self.bible_type is None and \ len(self.BibleNameEdit.displayText()) > 0: - self.MessageLabel.setText(u'Import Started') + self.MessageLabel.setText(self.trUtf8(u'Import Started')) self.ProgressBar.setMinimum(0) self.setMax(65) self.ProgressBar.setValue(0) @@ -181,8 +183,7 @@ class BibleImportForm(QtGui.QDialog, Ui_BibleImportDialog): # tell bibleplugin to reload the bibles Receiver().send_message(u'pre_load_bibles') QtGui.QMessageBox.information(self, - translate(u'BibleMediaItem', u'Information'), - translate(u'BibleMediaItem', message)) + self.trUtf8(u'Information'), self.trUtf8(message)) def setMax(self, max): log.debug(u'set Max %s', max) @@ -191,8 +192,8 @@ class BibleImportForm(QtGui.QDialog, Ui_BibleImportDialog): def incrementProgressBar(self, text ): log.debug(u'IncrementBar %s', text) - self.MessageLabel.setText(u'Import processing ' + text) - self.ProgressBar.setValue(self.ProgressBar.value()+1) + self.MessageLabel.setText(self.trUtf8(u'Import processing %s') % text) + self.ProgressBar.setValue(self.ProgressBar.value() + 1) def importBible(self): log.debug(u'Import Bible') @@ -224,7 +225,7 @@ class BibleImportForm(QtGui.QDialog, Ui_BibleImportDialog): unicode(self.CopyrightEdit.displayText()), unicode(self.PermisionEdit.displayText())) else: - message = u'Bible import failed' + message = self.trUtf8(u'Bible import failed') self.bible_type = None # free the screen state restrictions self.resetScreenFieldStates() diff --git a/openlp/plugins/bibles/lib/bibleDBimpl.py b/openlp/plugins/bibles/lib/bibleDBimpl.py index eac7ccd79..756828197 100644 --- a/openlp/plugins/bibles/lib/bibleDBimpl.py +++ b/openlp/plugins/bibles/lib/bibleDBimpl.py @@ -158,6 +158,11 @@ class BibleDBImpl(BibleCommon): def get_bible_text(self, bookname, chapter, sverse, everse): log.debug(u'get_bible_text %s, %s, %s, %s', bookname, chapter, sverse, everse) + #Look up book name or abbreviation + book = self.get_bible_book(bookname) + if book is not None: + bookname = book.name + log.debug(u'bookname corrected to %s' % bookname) verses = self.session.query(Verse).join(Book).filter( Book.name == bookname).filter(Verse.chapter == chapter).filter( Verse.verse>=sverse).filter(Verse.verse<=everse).order_by( diff --git a/openlp/plugins/bibles/lib/bibleOSISimpl.py b/openlp/plugins/bibles/lib/bibleOSISimpl.py index ee372d6dc..cdcea869b 100644 --- a/openlp/plugins/bibles/lib/bibleOSISimpl.py +++ b/openlp/plugins/bibles/lib/bibleOSISimpl.py @@ -30,7 +30,7 @@ import codecs from PyQt4 import QtCore -from openlp.core.lib import translate, Receiver +from openlp.core.lib import Receiver class BibleOSISImpl(): """ @@ -149,8 +149,8 @@ class BibleOSISImpl(): testament += 1 book_ptr = p[0] book = self.bibledb.create_book( - unicode(translate(u'BibleBooks', self.booksOfBible[p[0]])), - unicode(translate(u'BibleBooks', self.abbrevOfBible[p[0]])), + unicode(self.booksOfBible[p[0]]), + unicode(self.abbrevOfBible[p[0]]), testament) dialogobject.incrementProgressBar( self.booksOfBible[p[0]]) diff --git a/openlp/plugins/bibles/lib/biblestab.py b/openlp/plugins/bibles/lib/biblestab.py index 11404e1ef..bf08acbec 100644 --- a/openlp/plugins/bibles/lib/biblestab.py +++ b/openlp/plugins/bibles/lib/biblestab.py @@ -26,7 +26,7 @@ import logging from PyQt4 import QtCore, QtGui -from openlp.core.lib import translate, str_to_bool, Receiver +from openlp.core.lib import str_to_bool, Receiver from openlp.core.lib import SettingsTab class BiblesTab(SettingsTab): @@ -41,8 +41,8 @@ class BiblesTab(SettingsTab): self.paragraph_style = True self.show_new_chapters = False self.display_style = 0 - SettingsTab.__init__( - self, translate(u'BiblesTab', u'Bibles'), u'Bibles') + SettingsTab.__init__(self, u'Bibles', u'Bibles') + #SettingsTab.__init__(self, self.trUtf8(u'Bibles'), u'Bibles') def setupUi(self): self.setObjectName(u'BiblesTab') @@ -130,52 +130,40 @@ class BiblesTab(SettingsTab): self.BibleRightLayout.setMargin(0) self.BibleLayout.addWidget(self.BibleRightWidget) # Signals and slots - QtCore.QObject.connect(self.NewChaptersCheckBox, - QtCore.SIGNAL(u'stateChanged(int)'), + QtCore.QObject.connect( + self.NewChaptersCheckBox, QtCore.SIGNAL(u'stateChanged(int)'), self.onNewChaptersCheckBoxChanged) - QtCore.QObject.connect(self.DisplayStyleComboBox, - QtCore.SIGNAL(u'activated(int)'), + QtCore.QObject.connect( + self.DisplayStyleComboBox, QtCore.SIGNAL(u'activated(int)'), self.onDisplayStyleComboBoxChanged) - QtCore.QObject.connect(self.BibleThemeComboBox, - QtCore.SIGNAL(u'activated(int)'), self.onBibleThemeComboBoxChanged) - QtCore.QObject.connect(self.LayoutStyleComboBox, - QtCore.SIGNAL(u'activated(int)'), + QtCore.QObject.connect( + self.BibleThemeComboBox, QtCore.SIGNAL(u'activated(int)'), + self.onBibleThemeComboBoxChanged) + QtCore.QObject.connect( + self.LayoutStyleComboBox, QtCore.SIGNAL(u'activated(int)'), self.onLayoutStyleComboBoxChanged) - QtCore.QObject.connect(self.BibleDualCheckBox, - QtCore.SIGNAL(u'stateChanged(int)'), + QtCore.QObject.connect( + self.BibleDualCheckBox, QtCore.SIGNAL(u'stateChanged(int)'), self.onBibleDualCheckBox) QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'update_themes'), self.updateThemeList) def retranslateUi(self): - self.VerseDisplayGroupBox.setTitle( - translate(u'SettingsForm', u'Verse Display')) - self.NewChaptersCheckBox.setText( - translate(u'SettingsForm', u'Only show new chapter numbers')) - self.LayoutStyleLabel.setText( - translate(u'SettingsForm', u'Layout Style:')) - self.DisplayStyleLabel.setText( - translate(u'SettingsForm', u'Display Style:')) - self.BibleThemeLabel.setText( - translate(u'SettingsForm', u'Bible Theme:')) - self.LayoutStyleComboBox.setItemText( - 0, translate(u'SettingsForm', u'verse per slide')) - self.LayoutStyleComboBox.setItemText( - 1, translate(u'SettingsForm', u'verse per line')) - self.LayoutStyleComboBox.setItemText( - 2, translate(u'SettingsForm', u'continuous')) - self.DisplayStyleComboBox.setItemText( - 0, translate(u'SettingsForm', u'No brackets')) - self.DisplayStyleComboBox.setItemText( - 1, translate(u'SettingsForm', u'( and )')) - self.DisplayStyleComboBox.setItemText( - 2, translate(u'SettingsForm', u'{ and }')) - self.DisplayStyleComboBox.setItemText( - 3, translate(u'SettingsForm', u'[ and ]')) - self.ChangeNoteLabel.setText(translate(u'SettingsForm', - u'Note:\nChanges don\'t affect verses already in the service')) - self.BibleDualCheckBox.setText( - translate(u'SettingsForm', u'Display Dual Bible Verses')) + self.VerseDisplayGroupBox.setTitle(self.trUtf8(u'Verse Display')) + self.NewChaptersCheckBox.setText(self.trUtf8(u'Only show new chapter numbers')) + self.LayoutStyleLabel.setText(self.trUtf8(u'Layout Style:')) + self.DisplayStyleLabel.setText(self.trUtf8(u'Display Style:')) + self.BibleThemeLabel.setText(self.trUtf8(u'Bible Theme:')) + self.LayoutStyleComboBox.setItemText(0, self.trUtf8(u'verse per slide')) + self.LayoutStyleComboBox.setItemText(1, self.trUtf8(u'verse per line')) + self.LayoutStyleComboBox.setItemText(2, self.trUtf8(u'continuous')) + self.DisplayStyleComboBox.setItemText(0, self.trUtf8(u'No brackets')) + self.DisplayStyleComboBox.setItemText(1, self.trUtf8(u'( and )')) + self.DisplayStyleComboBox.setItemText(2, self.trUtf8(u'{ and }')) + self.DisplayStyleComboBox.setItemText(3, self.trUtf8(u'[ and ]')) + self.ChangeNoteLabel.setText( + self.trUtf8(u'Note:\nChanges don\'t affect verses already in the service')) + self.BibleDualCheckBox.setText(self.trUtf8(u'Display Dual Bible Verses')) def onBibleThemeComboBoxChanged(self): self.bible_theme = self.BibleThemeComboBox.currentText() diff --git a/openlp/plugins/bibles/lib/manager.py b/openlp/plugins/bibles/lib/manager.py index c0ff932a4..a259af0c2 100644 --- a/openlp/plugins/bibles/lib/manager.py +++ b/openlp/plugins/bibles/lib/manager.py @@ -25,8 +25,6 @@ import logging import os -from openlp.core.lib import translate - from bibleOSISimpl import BibleOSISImpl from bibleCSVimpl import BibleCSVImpl from bibleDBimpl import BibleDBImpl @@ -57,7 +55,7 @@ class BibleManager(object): """ self.config = config log.debug(u'Bible Initialising') - self.web = translate(u'BibleManager', u'Web') + self.web = u'Web' # dict of bible database objects self.bible_db_cache = None # dict of bible http readers @@ -352,8 +350,8 @@ class BibleManager(object): if book is None: log.debug(u'get_verse_text : new book') for chapter in range(schapter, echapter + 1): - self.media.setQuickMessage \ - (u'Downloading %s: %s'% (bookname, chapter)) + self.media.setQuickMessage( + self.trUtf8(u'Downloading %s: %s') % (bookname, chapter)) search_results = \ self.bible_http_cache[bible].get_bible_chapter( bible, 0, bookname, chapter) @@ -381,8 +379,9 @@ class BibleManager(object): v = self.bible_db_cache[bible].get_bible_chapter( book.id, chapter) if v is None: - self.media.setQuickMessage \ - (u'%Downloading %s: %s'% (bookname, chapter)) + self.media.setQuickMessage( + self.trUtf8(u'%Downloading %s: %s')\ + % (bookname, chapter)) self.bible_db_cache[bible].create_chapter( book.id, chapter, search_results.get_verselist()) diff --git a/openlp/plugins/bibles/lib/mediaitem.py b/openlp/plugins/bibles/lib/mediaitem.py index 3dae3d87c..f78c20ca5 100644 --- a/openlp/plugins/bibles/lib/mediaitem.py +++ b/openlp/plugins/bibles/lib/mediaitem.py @@ -27,8 +27,8 @@ import time from PyQt4 import QtCore, QtGui -from openlp.core.lib import translate, MediaManagerItem, Receiver, \ - BaseListWithDnD, str_to_bool +from openlp.core.lib import MediaManagerItem, Receiver, str_to_bool, \ + BaseListWithDnD from openlp.plugins.bibles.forms import BibleImportForm from openlp.plugins.bibles.lib.manager import BibleMode @@ -77,114 +77,136 @@ class BibleMediaItem(MediaManagerItem): # Add the Quick Search tab self.QuickTab = QtGui.QWidget() self.QuickTab.setObjectName(u'QuickTab') - self.QuickVerticalLayout = QtGui.QVBoxLayout(self.QuickTab) - self.QuickVerticalLayout.setObjectName("verticalLayout") - self.QuickLayout = QtGui.QGridLayout() - self.QuickLayout.setMargin(0) + self.QuickLayout = QtGui.QGridLayout(self.QuickTab) + self.QuickLayout.setMargin(2) self.QuickLayout.setSpacing(4) + self.QuickLayout.setVerticalSpacing(4) self.QuickLayout.setObjectName(u'QuickLayout') self.QuickVersionLabel = QtGui.QLabel(self.QuickTab) self.QuickVersionLabel.setObjectName(u'QuickVersionLabel') self.QuickLayout.addWidget(self.QuickVersionLabel, 0, 0, 1, 1) self.QuickVersionComboBox = QtGui.QComboBox(self.QuickTab) + self.QuickVersionComboBox.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToMinimumContentsLength) self.QuickVersionComboBox.setObjectName(u'VersionComboBox') self.QuickLayout.addWidget(self.QuickVersionComboBox, 0, 1, 1, 2) - self.QuickSearchLabel = QtGui.QLabel(self.QuickTab) - self.QuickSearchLabel.setObjectName(u'QuickSearchLabel') - self.QuickLayout.addWidget(self.QuickSearchLabel, 1, 0, 1, 1) - self.QuickSearchComboBox = QtGui.QComboBox(self.QuickTab) - self.QuickSearchComboBox.setObjectName(u'SearchComboBox') - self.QuickLayout.addWidget(self.QuickSearchComboBox, 1, 1, 1, 2) + self.QuickSecondVersionLabel = QtGui.QLabel(self.QuickTab) + self.QuickSecondVersionLabel.setObjectName(u'QuickSecondVersionLabel') + self.QuickLayout.addWidget(self.QuickSecondVersionLabel, 1, 0, 1, 1) + self.QuickSecondBibleComboBox = QtGui.QComboBox(self.QuickTab) + self.QuickSecondBibleComboBox.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToMinimumContentsLength) + self.QuickSecondBibleComboBox.setObjectName(u'SecondBible') + self.QuickLayout.addWidget(self.QuickSecondBibleComboBox, 1, 1, 1, 2) self.QuickSearchLabel = QtGui.QLabel(self.QuickTab) self.QuickSearchLabel.setObjectName(u'QuickSearchLabel') self.QuickLayout.addWidget(self.QuickSearchLabel, 2, 0, 1, 1) + self.QuickSearchComboBox = QtGui.QComboBox(self.QuickTab) + self.QuickSearchComboBox.setObjectName(u'SearchComboBox') + self.QuickLayout.addWidget(self.QuickSearchComboBox, 2, 1, 1, 2) + self.QuickSearchLabel = QtGui.QLabel(self.QuickTab) + self.QuickSearchLabel.setObjectName(u'QuickSearchLabel') + self.QuickLayout.addWidget(self.QuickSearchLabel, 3, 0, 1, 1) self.QuickSearchEdit = QtGui.QLineEdit(self.QuickTab) self.QuickSearchEdit.setObjectName(u'QuickSearchEdit') - self.QuickLayout.addWidget(self.QuickSearchEdit, 2, 1, 1, 2) - self.QuickSearchButton = QtGui.QPushButton(self.QuickTab) - self.QuickSearchButton.setObjectName(u'QuickSearchButton') - self.QuickLayout.addWidget(self.QuickSearchButton, 3, 2, 1, 1) + self.QuickLayout.addWidget(self.QuickSearchEdit, 3, 1, 1, 2) self.QuickClearLabel = QtGui.QLabel(self.QuickTab) self.QuickClearLabel.setObjectName(u'QuickSearchLabel') - self.QuickLayout.addWidget(self.QuickClearLabel, 3, 0, 1, 1) + self.QuickLayout.addWidget(self.QuickClearLabel, 4, 0, 1, 1) self.ClearQuickSearchComboBox = QtGui.QComboBox(self.QuickTab) self.ClearQuickSearchComboBox.setObjectName(u'ClearQuickSearchComboBox') - self.QuickLayout.addWidget(self.ClearQuickSearchComboBox, 3, 1, 1, 1) - self.QuickVerticalLayout.addLayout(self.QuickLayout) - self.QuickSecondBibleComboBox = QtGui.QComboBox(self.QuickTab) - self.QuickSecondBibleComboBox.setObjectName(u'SecondBible') - self.QuickVerticalLayout.addWidget(self.QuickSecondBibleComboBox) + self.QuickLayout.addWidget(self.ClearQuickSearchComboBox, 4, 1, 1, 2) + self.QuickSearchButtonLayout = QtGui.QHBoxLayout() + self.QuickSearchButtonLayout.setMargin(0) + self.QuickSearchButtonLayout.setSpacing(0) + self.QuickSearchButtonLayout.setObjectName(u'QuickSearchButtonLayout') + self.QuickSearchButtonSpacer = QtGui.QSpacerItem(40, 20, + QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) + self.QuickSearchButtonLayout.addItem(self.QuickSearchButtonSpacer) + self.QuickSearchButton = QtGui.QPushButton(self.QuickTab) + self.QuickSearchButton.setObjectName(u'QuickSearchButton') + self.QuickSearchButtonLayout.addWidget(self.QuickSearchButton) + self.QuickLayout.addLayout(self.QuickSearchButtonLayout, 5, 0, 1, 3) self.QuickMessage = QtGui.QLabel(self.QuickTab) self.QuickMessage.setObjectName(u'QuickMessage') - self.QuickVerticalLayout.addWidget(self.QuickMessage) - self.SearchTabWidget.addTab(self.QuickTab, 'Quick') + self.QuickLayout.addWidget(self.QuickMessage, 6, 0, 1, 3) + self.SearchTabWidget.addTab(self.QuickTab, self.trUtf8(u'Quick')) QuickSpacerItem = QtGui.QSpacerItem(20, 35, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) - self.QuickLayout.addItem(QuickSpacerItem, 4, 2, 1, 1) + self.QuickLayout.addItem(QuickSpacerItem, 6, 2, 1, 1) # Add the Advanced Search tab self.AdvancedTab = QtGui.QWidget() self.AdvancedTab.setObjectName(u'AdvancedTab') - self.AdvancedVerticalLayout = QtGui.QVBoxLayout(self.AdvancedTab) - self.AdvancedVerticalLayout.setObjectName("verticalLayout") - self.AdvancedLayout = QtGui.QGridLayout() - self.AdvancedLayout.setMargin(0) + self.AdvancedLayout = QtGui.QGridLayout(self.AdvancedTab) + self.AdvancedLayout.setMargin(2) self.AdvancedLayout.setSpacing(4) + self.AdvancedLayout.setVerticalSpacing(4) self.AdvancedLayout.setObjectName(u'AdvancedLayout') self.AdvancedVersionLabel = QtGui.QLabel(self.AdvancedTab) self.AdvancedVersionLabel.setObjectName(u'AdvancedVersionLabel') self.AdvancedLayout.addWidget(self.AdvancedVersionLabel, 0, 0, 1, 1) self.AdvancedVersionComboBox = QtGui.QComboBox(self.AdvancedTab) + self.AdvancedVersionComboBox.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToMinimumContentsLength) self.AdvancedVersionComboBox.setObjectName(u'AdvancedVersionComboBox') - self.AdvancedLayout.addWidget(self.AdvancedVersionComboBox, 0, 2, 1, 2) + self.AdvancedLayout.addWidget(self.AdvancedVersionComboBox, 0, 1, 1, 2) + self.AdvancedSecondBibleLabel = QtGui.QLabel(self.AdvancedTab) + self.AdvancedSecondBibleLabel.setObjectName(u'AdvancedSecondBibleLabel') + self.AdvancedLayout.addWidget(self.AdvancedSecondBibleLabel, 1, 0, 1, 1) + self.AdvancedSecondBibleComboBox = QtGui.QComboBox(self.AdvancedTab) + self.AdvancedSecondBibleComboBox.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToMinimumContentsLength) + self.AdvancedSecondBibleComboBox.setObjectName(u'AdvancedSecondBibleComboBox') + self.AdvancedLayout.addWidget(self.AdvancedSecondBibleComboBox, 1, 1, 1, 2) self.AdvancedBookLabel = QtGui.QLabel(self.AdvancedTab) self.AdvancedBookLabel.setObjectName(u'AdvancedBookLabel') - self.AdvancedLayout.addWidget(self.AdvancedBookLabel, 1, 0, 1, 1) + self.AdvancedLayout.addWidget(self.AdvancedBookLabel, 2, 0, 1, 1) self.AdvancedBookComboBox = QtGui.QComboBox(self.AdvancedTab) self.AdvancedBookComboBox.setObjectName(u'AdvancedBookComboBox') - self.AdvancedLayout.addWidget(self.AdvancedBookComboBox, 1, 2, 1, 2) + self.AdvancedLayout.addWidget(self.AdvancedBookComboBox, 2, 1, 1, 2) self.AdvancedChapterLabel = QtGui.QLabel(self.AdvancedTab) self.AdvancedChapterLabel.setObjectName(u'AdvancedChapterLabel') - self.AdvancedLayout.addWidget(self.AdvancedChapterLabel, 2, 2, 1, 1) + self.AdvancedLayout.addWidget(self.AdvancedChapterLabel, 3, 1, 1, 1) self.AdvancedVerseLabel = QtGui.QLabel(self.AdvancedTab) self.AdvancedVerseLabel.setObjectName(u'AdvancedVerseLabel') - self.AdvancedLayout.addWidget(self.AdvancedVerseLabel, 2, 3, 1, 1) + self.AdvancedLayout.addWidget(self.AdvancedVerseLabel, 3, 2, 1, 1) self.AdvancedFromLabel = QtGui.QLabel(self.AdvancedTab) self.AdvancedFromLabel.setObjectName(u'AdvancedFromLabel') - self.AdvancedLayout.addWidget(self.AdvancedFromLabel, 3, 0, 1, 1) - self.AdvancedToLabel = QtGui.QLabel(self.AdvancedTab) - self.AdvancedToLabel.setObjectName(u'AdvancedToLabel') - self.AdvancedLayout.addWidget(self.AdvancedToLabel, 4, 0, 1, 1) + self.AdvancedLayout.addWidget(self.AdvancedFromLabel, 4, 0, 1, 1) self.AdvancedFromChapter = QtGui.QComboBox(self.AdvancedTab) self.AdvancedFromChapter.setObjectName(u'AdvancedFromChapter') - self.AdvancedLayout.addWidget(self.AdvancedFromChapter, 3, 2, 1, 1) + self.AdvancedLayout.addWidget(self.AdvancedFromChapter, 4, 1, 1, 1) self.AdvancedFromVerse = QtGui.QComboBox(self.AdvancedTab) self.AdvancedFromVerse.setObjectName(u'AdvancedFromVerse') - self.AdvancedLayout.addWidget(self.AdvancedFromVerse, 3, 3, 1, 1) + self.AdvancedLayout.addWidget(self.AdvancedFromVerse, 4, 2, 1, 1) + self.AdvancedToLabel = QtGui.QLabel(self.AdvancedTab) + self.AdvancedToLabel.setObjectName(u'AdvancedToLabel') + self.AdvancedLayout.addWidget(self.AdvancedToLabel, 5, 0, 1, 1) self.AdvancedToChapter = QtGui.QComboBox(self.AdvancedTab) self.AdvancedToChapter.setObjectName(u'AdvancedToChapter') - self.AdvancedLayout.addWidget(self.AdvancedToChapter, 4, 2, 1, 1) + self.AdvancedLayout.addWidget(self.AdvancedToChapter, 5, 1, 1, 1) self.AdvancedToVerse = QtGui.QComboBox(self.AdvancedTab) self.AdvancedToVerse.setObjectName(u'AdvancedToVerse') - self.AdvancedLayout.addWidget(self.AdvancedToVerse, 4, 3, 1, 1) + self.AdvancedLayout.addWidget(self.AdvancedToVerse, 5, 2, 1, 1) self.AdvancedClearLabel = QtGui.QLabel(self.QuickTab) self.AdvancedClearLabel.setObjectName(u'QuickSearchLabel') - self.AdvancedLayout.addWidget(self.AdvancedClearLabel, 5, 0, 1, 1) + self.AdvancedLayout.addWidget(self.AdvancedClearLabel, 6, 0, 1, 1) self.ClearAdvancedSearchComboBox = QtGui.QComboBox(self.QuickTab) self.ClearAdvancedSearchComboBox.setObjectName( u'ClearAdvancedSearchComboBox') self.AdvancedLayout.addWidget( - self.ClearAdvancedSearchComboBox, 5, 2, 1, 2) + self.ClearAdvancedSearchComboBox, 6, 1, 1, 2) + self.AdvancedSearchButtonLayout = QtGui.QHBoxLayout() + self.AdvancedSearchButtonLayout.setMargin(0) + self.AdvancedSearchButtonLayout.setSpacing(0) + self.AdvancedSearchButtonLayout.setObjectName(u'AdvancedSearchButtonLayout') + self.AdvancedSearchButtonSpacer = QtGui.QSpacerItem(40, 20, + QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) + self.AdvancedSearchButtonLayout.addItem(self.AdvancedSearchButtonSpacer) self.AdvancedSearchButton = QtGui.QPushButton(self.AdvancedTab) self.AdvancedSearchButton.setObjectName(u'AdvancedSearchButton') - self.AdvancedLayout.addWidget(self.AdvancedSearchButton, 6, 3, 1, 1) - self.AdvancedVerticalLayout.addLayout(self.AdvancedLayout) - self.AdvancedSecondBibleComboBox = QtGui.QComboBox(self.AdvancedTab) - self.AdvancedSecondBibleComboBox.setObjectName(u'SecondBible') - self.AdvancedVerticalLayout.addWidget(self.AdvancedSecondBibleComboBox) - self.AdvancedMessage = QtGui.QLabel(self.QuickTab) + self.AdvancedSearchButtonLayout.addWidget(self.AdvancedSearchButton) + self.AdvancedLayout.addLayout(self.AdvancedSearchButtonLayout, 7, 0, 1, 3) + self.AdvancedMessage = QtGui.QLabel(self.AdvancedTab) self.AdvancedMessage.setObjectName(u'AdvancedMessage') - self.AdvancedVerticalLayout.addWidget(self.AdvancedMessage) - self.SearchTabWidget.addTab(self.AdvancedTab, u'Advanced') + self.AdvancedLayout.addWidget(self.AdvancedMessage, 8, 0, 1, 3) + self.SearchTabWidget.addTab(self.AdvancedTab, self.trUtf8(u'Advanced')) # Add the search tab widget to the page layout self.PageLayout.addWidget(self.SearchTabWidget) # Combo Boxes @@ -209,45 +231,39 @@ class BibleMediaItem(MediaManagerItem): def configUpdated(self): if str_to_bool( self.parent.config.get_config(u'dual bibles', u'False')): + self.AdvancedSecondBibleLabel.setVisible(True) self.AdvancedSecondBibleComboBox.setVisible(True) + self.QuickSecondVersionLabel.setVisible(True) self.QuickSecondBibleComboBox.setVisible(True) else: + self.AdvancedSecondBibleLabel.setVisible(False) self.AdvancedSecondBibleComboBox.setVisible(False) + self.QuickSecondVersionLabel.setVisible(False) self.QuickSecondBibleComboBox.setVisible(False) def retranslateUi(self): log.debug(u'retranslateUi') - self.QuickVersionLabel.setText( - translate(u'BibleMediaItem', u'Version:')) - self.QuickSearchLabel.setText( - translate(u'BibleMediaItem', u'Search Type:')) - self.QuickSearchLabel.setText(translate(u'BibleMediaItem', u'Find:')) - self.QuickSearchButton.setText(translate(u'BibleMediaItem', u'Search')) - self.QuickClearLabel.setText(translate(u'BibleMediaItem', u'Results:')) - self.AdvancedVersionLabel.setText( - translate(u'BibleMediaItem', u'Version:')) - self.AdvancedBookLabel.setText(translate(u'BibleMediaItem', u'Book:')) - self.AdvancedChapterLabel.setText( - translate(u'BibleMediaItem', u'Chapter:')) - self.AdvancedVerseLabel.setText(translate(u'BibleMediaItem', u'Verse:')) - self.AdvancedFromLabel.setText(translate(u'BibleMediaItem', u'From:')) - self.AdvancedToLabel.setText(translate(u'BibleMediaItem', u'To:')) - self.AdvancedClearLabel.setText( - translate(u'BibleMediaItem', u'Results:')) - self.AdvancedSearchButton.setText( - translate(u'BibleMediaItem', u'Search')) - self.QuickSearchComboBox.addItem( - translate(u'BibleMediaItem', u'Verse Search')) - self.QuickSearchComboBox.addItem( - translate(u'BibleMediaItem', u'Text Search')) - self.ClearQuickSearchComboBox.addItem( - translate(u'BibleMediaItem', u'Clear')) - self.ClearQuickSearchComboBox.addItem( - translate(u'BibleMediaItem', u'Keep')) - self.ClearAdvancedSearchComboBox.addItem( - translate(u'BibleMediaItem', u'Clear')) - self.ClearAdvancedSearchComboBox.addItem( - translate(u'BibleMediaItem', u'Keep')) + self.QuickVersionLabel.setText(self.trUtf8(u'Version:')) + self.QuickSecondVersionLabel.setText(self.trUtf8(u'Dual:')) + self.QuickSearchLabel.setText(self.trUtf8(u'Search Type:')) + self.QuickSearchLabel.setText(self.trUtf8(u'Find:')) + self.QuickSearchButton.setText(self.trUtf8(u'Search')) + self.QuickClearLabel.setText(self.trUtf8(u'Results:')) + self.AdvancedVersionLabel.setText(self.trUtf8(u'Version:')) + self.AdvancedSecondBibleLabel.setText(self.trUtf8(u'Dual:')) + self.AdvancedBookLabel.setText(self.trUtf8(u'Book:')) + self.AdvancedChapterLabel.setText(self.trUtf8(u'Chapter:')) + self.AdvancedVerseLabel.setText(self.trUtf8(u'Verse:')) + self.AdvancedFromLabel.setText(self.trUtf8(u'From:')) + self.AdvancedToLabel.setText(self.trUtf8(u'To:')) + self.AdvancedClearLabel.setText(self.trUtf8(u'Results:')) + self.AdvancedSearchButton.setText(self.trUtf8(u'Search')) + self.QuickSearchComboBox.addItem(self.trUtf8(u'Verse Search')) + self.QuickSearchComboBox.addItem(self.trUtf8(u'Text Search')) + self.ClearQuickSearchComboBox.addItem(self.trUtf8(u'Clear')) + self.ClearQuickSearchComboBox.addItem(self.trUtf8(u'Keep')) + self.ClearAdvancedSearchComboBox.addItem(self.trUtf8(u'Clear')) + self.ClearAdvancedSearchComboBox.addItem(self.trUtf8(u'Keep')) def initialise(self): log.debug(u'bible manager initialise') @@ -257,8 +273,8 @@ class BibleMediaItem(MediaManagerItem): log.debug(u'bible manager initialise complete') def setQuickMessage(self, text): - self.QuickMessage.setText(translate(u'BibleMediaItem', unicode(text))) - self.AdvancedMessage.setText(translate(u'BibleMediaItem', unicode(text))) + self.QuickMessage.setText(text) + self.AdvancedMessage.setText(text) Receiver().send_message(u'process_events') #minor delay to get the events processed time.sleep(0.1) @@ -468,8 +484,7 @@ class BibleMediaItem(MediaManagerItem): book, 1) if self.verses == 0: self.AdvancedSearchButton.setEnabled(False) - self.AdvancedMessage.setText( - translate(u'BibleMediaItem', u'Bible not fully loaded')) + self.AdvancedMessage.setText(self.trUtf8(u'Bible not fully loaded')) else: self.AdvancedSearchButton.setEnabled(True) self.AdvancedMessage.setText(u'') @@ -562,7 +577,7 @@ class BibleMediaItem(MediaManagerItem): if end_verse == u'': end_verse = 99 if start_chapter == u'': - message = u'No chapter found for search criteria' + message = self.trUtf8(u'No chapter found for search criteria') log.debug(u'results = %s @ %s : %s @ %s : %s'% \ (unicode(book), unicode(start_chapter), unicode(end_chapter), unicode(start_verse), unicode(end_verse))) @@ -578,6 +593,5 @@ class BibleMediaItem(MediaManagerItem): self.version = unicode(self.parent.biblemanager.get_meta_data( bible, u'Version').value) else: - QtGui.QMessageBox.information(self, - translate(u'BibleMediaItem', u'Information'), - translate(u'BibleMediaItem', message)) + QtGui.QMessageBox.information( + self, self.trUtf8(u'Information'), message) diff --git a/openlp/plugins/custom/forms/editcustomdialog.py b/openlp/plugins/custom/forms/editcustomdialog.py index 40cbf0069..528f2d154 100644 --- a/openlp/plugins/custom/forms/editcustomdialog.py +++ b/openlp/plugins/custom/forms/editcustomdialog.py @@ -22,7 +22,7 @@ ############################################################################### from PyQt4 import QtCore, QtGui -from openlp.core.lib import translate, buildIcon +from openlp.core.lib import buildIcon class Ui_customEditDialog(object): def setupUi(self, customEditDialog): @@ -78,7 +78,6 @@ class Ui_customEditDialog(object): self.verticalLayout_2.setObjectName(u'verticalLayout_2') self.AddButton = QtGui.QPushButton(self.ButtonWidge) self.AddButton.setObjectName(u'AddButton') - self.AddButton.setToolTip(translate(u'customEditDialog', u'Add new slide at bottom')) self.verticalLayout_2.addWidget(self.AddButton) self.EditButton = QtGui.QPushButton(self.ButtonWidge) self.EditButton.setObjectName(u'EditButton') @@ -138,22 +137,22 @@ class Ui_customEditDialog(object): customEditDialog.setTabOrder(self.ThemeComboBox, self.buttonBox) def retranslateUi(self, customEditDialog): - self.UpButton.setToolTip(translate(u'customEditDialog', u'Move slide Up 1')) - self.DownButton.setToolTip(translate(u'customEditDialog', u'Move slide down 1')) - customEditDialog.setWindowTitle(translate(u'customEditDialog', 'Edit Custom Slides')) - self.TitleLabel.setText(translate(u'customEditDialog', 'Title:')) - self.AddButton.setText(translate(u'customEditDialog', 'Add New')) - self.AddButton.setToolTip(translate(u'customEditDialog', u'Add new slide at bottom')) - self.EditButton.setText(translate(u'customEditDialog', 'Edit')) - self.EditButton.setToolTip(translate(u'customEditDialog', u'Edit selected slide')) - self.EditAllButton.setText(translate(u'customEditDialog', 'Edit All')) - self.EditAllButton.setToolTip(translate(u'customEditDialog', u'Edit all slides')) - self.SaveButton.setText(translate(u'customEditDialog', 'Save')) - self.SaveButton.setToolTip(translate(u'customEditDialog', u'Replace edited slide')) - self.DeleteButton.setText(translate(u'customEditDialog', 'Delete')) - self.DeleteButton.setToolTip(translate(u'customEditDialog', u'Delete selected slide')) - self.ClearButton.setText(translate(u'customEditDialog', 'Clear')) - self.ClearButton.setToolTip(translate(u'customEditDialog', u'Clear edit area')) - self.ThemeLabel.setText(translate(u'customEditDialog', 'Theme:')) - self.ThemeComboBox.setToolTip(translate(u'customEditDialog', u'Set Theme for Slides')) - self.CreditLabel.setText(translate(u'customEditDialog', 'Credits:')) + self.UpButton.setToolTip(self.trUtf8(u'Move slide Up 1')) + self.DownButton.setToolTip(self.trUtf8(u'Move slide down 1')) + customEditDialog.setWindowTitle(self.trUtf8(u'Edit Custom Slides')) + self.TitleLabel.setText(self.trUtf8(u'Title:')) + self.AddButton.setText(self.trUtf8(u'Add New')) + self.AddButton.setToolTip(self.trUtf8(u'Add new slide at bottom')) + self.EditButton.setText(self.trUtf8(u'Edit')) + self.EditButton.setToolTip(self.trUtf8(u'Edit selected slide')) + self.EditAllButton.setText(self.trUtf8(u'Edit All')) + self.EditAllButton.setToolTip(self.trUtf8(u'Edit all slides')) + self.SaveButton.setText(self.trUtf8(u'Save')) + self.SaveButton.setToolTip(self.trUtf8(u'Replace edited slide')) + self.DeleteButton.setText(self.trUtf8(u'Delete')) + self.DeleteButton.setToolTip(self.trUtf8(u'Delete selected slide')) + self.ClearButton.setText(self.trUtf8(u'Clear')) + self.ClearButton.setToolTip(self.trUtf8(u'Clear edit area')) + self.ThemeLabel.setText(self.trUtf8(u'Theme:')) + self.ThemeComboBox.setToolTip(self.trUtf8(u'Set Theme for Slides')) + self.CreditLabel.setText(self.trUtf8(u'Credits:')) diff --git a/openlp/plugins/custom/forms/editcustomform.py b/openlp/plugins/custom/forms/editcustomform.py index 748e1ec21..01afe1b48 100644 --- a/openlp/plugins/custom/forms/editcustomform.py +++ b/openlp/plugins/custom/forms/editcustomform.py @@ -25,7 +25,7 @@ from PyQt4 import QtCore, QtGui from editcustomdialog import Ui_customEditDialog -from openlp.core.lib import SongXMLBuilder, SongXMLParser, Receiver, translate +from openlp.core.lib import SongXMLBuilder, SongXMLParser, Receiver from openlp.plugins.custom.lib.models import CustomSlide class EditCustomForm(QtGui.QDialog, Ui_customEditDialog): @@ -60,7 +60,6 @@ class EditCustomForm(QtGui.QDialog, Ui_customEditDialog): QtCore.SIGNAL(u'pressed()'), self.onUpButtonPressed) QtCore.QObject.connect(self.DownButton, QtCore.SIGNAL(u'pressed()'), self.onDownButtonPressed) - QtCore.QObject.connect(self.VerseListView, QtCore.SIGNAL(u'itemDoubleClicked(QListWidgetItem*)'), self.onVerseListViewSelected) @@ -117,17 +116,15 @@ class EditCustomForm(QtGui.QDialog, Ui_customEditDialog): def accept(self): valid, message = self._validate() if not valid: - QtGui.QMessageBox.critical(self, - translate(u'customEditDialog', u'Error'), message, - QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) + QtGui.QMessageBox.critical(self, self.trUtf8(u'Error'), message, + QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) return sxml = SongXMLBuilder() sxml.new_document() sxml.add_lyrics_to_song() count = 1 for i in range (0, self.VerseListView.count()): - sxml.add_verse_to_lyrics( - u'custom', unicode(count), + sxml.add_verse_to_lyrics(u'custom', unicode(count), unicode(self.VerseListView.item(i).text())) count += 1 self.customSlide.title = unicode(self.TitleEdit.displayText()) @@ -229,11 +226,9 @@ class EditCustomForm(QtGui.QDialog, Ui_customEditDialog): def _validate(self): if len(self.TitleEdit.displayText()) == 0: self.TitleEdit.setFocus() - return False, translate( - u'customEditDialog', u'You need to enter a title \n') + return False, self.trUtf8(u'You need to enter a title \n') # must have 1 slide if self.VerseListView.count() == 0: self.VerseTextEdit.setFocus() - return False, translate( - u'customEditDialog', u'You need to enter a slide \n') + return False, self.trUtf8(u'You need to enter a slide \n') return True, u'' diff --git a/openlp/plugins/images/lib/imagetab.py b/openlp/plugins/images/lib/imagetab.py index 5c00d826d..f5472b02c 100644 --- a/openlp/plugins/images/lib/imagetab.py +++ b/openlp/plugins/images/lib/imagetab.py @@ -24,14 +24,15 @@ from PyQt4 import QtCore, QtGui -from openlp.core.lib import SettingsTab, translate, Receiver +from openlp.core.lib import SettingsTab, Receiver class ImageTab(SettingsTab): """ ImageTab is the Image settings tab in the settings dialog. """ def __init__(self): - SettingsTab.__init__(self, translate(u'ImageTab', u'Images'), u'Image') + #SettingsTab.__init__(self, self.trUtf8(u'Images'), u'Images') + SettingsTab.__init__(self, u'Images', u'Images') def setupUi(self): self.setObjectName(u'ImageTab') @@ -60,9 +61,9 @@ class ImageTab(SettingsTab): QtCore.SIGNAL(u'valueChanged(int)'), self.onTimeoutSpinBoxChanged) def retranslateUi(self): - self.ImageSettingsGroupBox.setTitle(translate(u'ImageTab', u'Image Settings')) - self.TimeoutLabel.setText(translate(u'ImageTab', u'Slide Loop Delay:')) - self.TimeoutSpinBox.setSuffix(translate(u'ImageTab', u's')) + self.ImageSettingsGroupBox.setTitle(self.trUtf8(u'Image Settings')) + self.TimeoutLabel.setText(self.trUtf8(u'Slide Loop Delay:')) + self.TimeoutSpinBox.setSuffix(self.trUtf8(u'sec')) def onTimeoutSpinBoxChanged(self): self.loop_delay = self.TimeoutSpinBox.value() @@ -73,7 +74,7 @@ class ImageTab(SettingsTab): def save(self): self.config.set_config(u'loop delay', self.loop_delay) - Receiver().send_message(u'update_spin_delay', self.loop_delay ) + Receiver().send_message(u'update_spin_delay', self.loop_delay) def postSetUp(self): - Receiver().send_message(u'update_spin_delay', self.loop_delay ) + Receiver().send_message(u'update_spin_delay', self.loop_delay) diff --git a/openlp/plugins/images/lib/mediaitem.py b/openlp/plugins/images/lib/mediaitem.py index 1c97c16d1..fb947cc0d 100644 --- a/openlp/plugins/images/lib/mediaitem.py +++ b/openlp/plugins/images/lib/mediaitem.py @@ -26,7 +26,7 @@ import logging import os from PyQt4 import QtCore, QtGui -from openlp.core.lib import MediaManagerItem, BaseListWithDnD, buildIcon, translate +from openlp.core.lib import MediaManagerItem, BaseListWithDnD, buildIcon # We have to explicitly create separate classes for each plugin # in order for DnD to the Service manager to work correctly. @@ -48,8 +48,6 @@ class ImageMediaItem(MediaManagerItem): self.PluginTextShort = u'Image' self.ConfigSection = u'images' self.IconPath = u'images/image' - self.OnNewPrompt = u'Select Image(s)' - self.OnNewFileMasks = u'Images (*.jpg *jpeg *.gif *.png *.bmp)' # this next is a class, not an instance of a class - it will # be instanced by the base MediaManagerItem self.ListViewWithDnD_class = ImageListView @@ -58,6 +56,11 @@ class ImageMediaItem(MediaManagerItem): MediaManagerItem.__init__(self, parent, icon, title) self.overrideActive = False + def retranslateUi(self): + self.OnNewPrompt = self.trUtf8(u'Select Image(s)') + self.OnNewFileMasks = \ + self.trUtf8(u'Images (*.jpg *jpeg *.gif *.png *.bmp)') + def requiredIcons(self): MediaManagerItem.requiredIcons(self) self.hasFileIcon = True @@ -94,9 +97,9 @@ class ImageMediaItem(MediaManagerItem): self.OverrideCheckBox.setObjectName(u'OverrideCheckBox') self.OverrideCheckBox.setCheckable(True) self.OverrideCheckBox.setChecked(False) - self.OverrideCheckBox.setText(translate(u'ImagePlugin', u'Override background')) + self.OverrideCheckBox.setText(self.trUtf8(u'Override background')) self.OverrideCheckBox.setStatusTip( - translate(u'ImageMedia', u'Allow background of live slide to be overridden')) + self.trUtf8(u'Allow background of live slide to be overridden')) self.OverrideLayout.addWidget(self.OverrideCheckBox) self.OverrideLabel = QtGui.QLabel(self.ImageWidget) self.OverrideLabel.setObjectName(u'OverrideLabel') @@ -139,7 +142,7 @@ class ImageMediaItem(MediaManagerItem): items = self.ListView.selectedIndexes() if len(items) == 0: return False - service_item.title = u'Image(s)' + service_item.title = self.trUtf8(u'Image(s)') for item in items: bitem = self.ListView.item(item.row()) filename = unicode((bitem.data(QtCore.Qt.UserRole)).toString()) diff --git a/openlp/plugins/media/lib/mediatab.py b/openlp/plugins/media/lib/mediatab.py index b24bac094..69440faa8 100644 --- a/openlp/plugins/media/lib/mediatab.py +++ b/openlp/plugins/media/lib/mediatab.py @@ -24,14 +24,15 @@ from PyQt4 import QtCore, QtGui -from openlp.core.lib import SettingsTab, str_to_bool, translate +from openlp.core.lib import SettingsTab, str_to_bool class MediaTab(SettingsTab): """ mediaTab is the media settings tab in the settings dialog. """ def __init__(self): - SettingsTab.__init__(self, translate(u'MediaTab', u'Media'), u'Media') + SettingsTab.__init__(self, u'Media', u'Media') + #SettingsTab.__init__(self, self.trUtf8(u'Media'), u'Media') def setupUi(self): self.setObjectName(u'MediaTab') @@ -57,14 +58,10 @@ class MediaTab(SettingsTab): QtCore.SIGNAL(u'stateChanged(int)'), self.onVMRCheckBoxChanged) def retranslateUi(self): - self.MediaModeGroupBox.setTitle(translate(u'MediaTab', u'Media Mode')) - self.UseVMRCheckBox.setText( - translate(u'MediaTab', u'Use Video Mode Rendering')) - self.UseVMRLabel.setText(translate(u'MediaTab', u'\n' - u'\n' - u'

No video preview available with VMR enabled

')) + self.MediaModeGroupBox.setTitle(self.trUtf8(u'Media Mode')) + self.UseVMRCheckBox.setText(self.trUtf8(u'Use Video Mode Rendering')) + self.UseVMRLabel.setText( + self.trUtf8(u'No video preview available with VMR enabled')) def onVMRCheckBoxChanged(self): use_vmr_mode = self.UseVMRCheckBox.checkState() diff --git a/openlp/plugins/presentations/lib/impresscontroller.py b/openlp/plugins/presentations/lib/impresscontroller.py index 219e8cec1..a971f8342 100644 --- a/openlp/plugins/presentations/lib/impresscontroller.py +++ b/openlp/plugins/presentations/lib/impresscontroller.py @@ -28,6 +28,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA import logging import os +import time if os.name == u'nt': from win32com.client import Dispatch @@ -85,7 +86,7 @@ class ImpressController(PresentationController): self.manager._FlagAsMethod(u'Bridge_GetValueObject') else: # -headless - cmd = u'openoffice.org -nologo -norestore -minimized -invisible ' + u'"' + u'-accept=socket,host=localhost,port=2002;urp;'+ u'"' + cmd = u'openoffice.org -nologo -norestore -minimized -invisible -nofirststartwizard -accept="socket,host=localhost,port=2002;urp;"' self.process = QtCore.QProcess() self.process.startDetached(cmd) self.process.waitForStarted() @@ -96,6 +97,12 @@ class ImpressController(PresentationController): """ log.debug(u'Kill') self.close_presentation() + if os.name != u'nt': + desktop = self.get_uno_desktop() + try: + desktop.terminate() + except: + pass def load_presentation(self, presentation): """ @@ -121,18 +128,19 @@ class ImpressController(PresentationController): url = uno.systemPathToFileUrl(presentation) if desktop is None: return + self.desktop = desktop + properties = [] + properties.append(self.create_property(u'Minimized', True)) + properties = tuple(properties) try: - self.desktop = desktop - properties = [] - properties = tuple(properties) self.document = desktop.loadComponentFromURL(url, u'_blank', 0, properties) - self.presentation = self.document.getPresentation() - self.presentation.Display = self.plugin.render_manager.current_display + 1 - self.controller = None except: log.exception(u'Failed to load presentation') return + self.presentation = self.document.getPresentation() + self.presentation.Display = self.plugin.render_manager.current_display + 1 + self.controller = None self.create_thumbnails() def create_thumbnails(self): @@ -148,13 +156,7 @@ class ImpressController(PresentationController): else: thumbdir = uno.systemPathToFileUrl(self.thumbnailpath) props = [] - if os.name == u'nt': - prop = self.manager.Bridge_GetStruct(u'com.sun.star.beans.PropertyValue') - else: - prop = PropertyValue() - prop.Name = u'FilterName' - prop.Value = u'impress_png_Export' - props.append(prop) + props.append(self.create_property(u'FilterName', u'impress_png_Export')) props = tuple(props) doc = self.document pages = doc.getDrawPages() @@ -164,6 +166,15 @@ class ImpressController(PresentationController): doc.storeToURL(thumbdir + u'/' + self.thumbnailprefix + unicode(idx+1) + u'.png', props) + def create_property(self, name, value): + if os.name == u'nt': + prop = self.manager.Bridge_GetStruct(u'com.sun.star.beans.PropertyValue') + else: + prop = PropertyValue() + prop.Name = name + prop.Value = value + return prop + def get_uno_desktop(self): log.debug(u'getUNODesktop') ctx = None @@ -245,6 +256,11 @@ class ImpressController(PresentationController): def start_presentation(self): if self.controller is None or not self.controller.isRunning(): self.presentation.start() + # start() returns before the getCurrentComponent is ready. Try for 5 seconds + i = 1 + while self.desktop.getCurrentComponent() is None and i < 50: + time.sleep(0.1) + i = i + 1 self.controller = self.desktop.getCurrentComponent().Presentation.getController() else: self.controller.activate() diff --git a/openlp/plugins/presentations/lib/mediaitem.py b/openlp/plugins/presentations/lib/mediaitem.py index edb66f98d..abbf83ac2 100644 --- a/openlp/plugins/presentations/lib/mediaitem.py +++ b/openlp/plugins/presentations/lib/mediaitem.py @@ -27,7 +27,7 @@ import os from PyQt4 import QtCore, QtGui -from openlp.core.lib import MediaManagerItem, translate, BaseListWithDnD +from openlp.core.lib import MediaManagerItem, BaseListWithDnD from openlp.plugins.presentations.lib import MessageListener # We have to explicitly create separate classes for each plugin @@ -84,8 +84,7 @@ class PresentationMediaItem(MediaManagerItem): self.DisplayTypeLabel = QtGui.QLabel(self.PresentationWidget) self.DisplayTypeLabel.setObjectName(u'SearchTypeLabel') self.DisplayLayout.addWidget(self.DisplayTypeLabel, 0, 0, 1, 1) - self.DisplayTypeLabel.setText( - translate(u'PresentationMediaItem', u'Present using:')) + self.DisplayTypeLabel.setText(self.trUtf8(u'Present using:')) # Add the Presentation widget to the page layout self.PageLayout.addWidget(self.PresentationWidget) @@ -107,8 +106,9 @@ class PresentationMediaItem(MediaManagerItem): continue (path, filename) = os.path.split(unicode(file)) if titles.count(filename) > 0: - QtGui.QMessageBox.critical(self, u'File exists', - u'A presentation with that filename already exists.', + QtGui.QMessageBox.critical( + self, self.trUtf8(u'File exists'), + self.trUtf8(u'A presentation with that filename already exists.'), QtGui.QMessageBox.Ok) else: item_name = QtGui.QListWidgetItem(filename) diff --git a/openlp/plugins/presentations/lib/messagelistener.py b/openlp/plugins/presentations/lib/messagelistener.py index 882ec2fd2..ca30b5564 100644 --- a/openlp/plugins/presentations/lib/messagelistener.py +++ b/openlp/plugins/presentations/lib/messagelistener.py @@ -68,14 +68,14 @@ class MessageListener(object): self.controller.load_presentation(file) self.controller.start_presentation() self.controller.slidenumber = 0 + self.controller.timer.start() def activate(self): if self.controller.is_active(): return if not self.controller.is_loaded(): self.controller.load_presentation(self.controller.filepath) - else: - self.controller.start_presentation() + self.controller.start_presentation() if self.controller.slidenumber > 1: self.controller.goto_slide(self.controller.slidenumber) @@ -83,7 +83,7 @@ class MessageListener(object): self.activate() if message is not None: self.controller.goto_slide(message[0]+1) - self.controller.slidenumber = self.controller.get_slide_number() + self.controller.poll_slidenumber() def first(self, message): """ @@ -91,7 +91,7 @@ class MessageListener(object): """ self.activate() self.controller.start_presentation() - self.controller.slidenumber = self.controller.get_slide_number() + self.controller.poll_slidenumber() def last(self, message): """ @@ -99,7 +99,7 @@ class MessageListener(object): """ self.activate() self.controller.goto_slide(self.controller.get_slide_count()) - self.controller.slidenumber = self.controller.get_slide_number() + self.controller.poll_slidenumber() def next(self, message): """ @@ -107,7 +107,7 @@ class MessageListener(object): """ self.activate() self.controller.next_step() - self.controller.slidenumber = self.controller.get_slide_number() + self.controller.poll_slidenumber() def previous(self, message): """ @@ -115,7 +115,7 @@ class MessageListener(object): """ self.activate() self.controller.previous_step() - self.controller.slidenumber = self.controller.get_slide_number() + self.controller.poll_slidenumber() def shutdown(self, message): """ @@ -123,6 +123,7 @@ class MessageListener(object): """ self.controller.close_presentation() self.controller.slidenumber = 0 + self.controller.timer.shutdown() def blank(self): if not self.controller.is_loaded(): diff --git a/openlp/plugins/presentations/lib/presentationcontroller.py b/openlp/plugins/presentations/lib/presentationcontroller.py index 977c9c264..bb26da442 100644 --- a/openlp/plugins/presentations/lib/presentationcontroller.py +++ b/openlp/plugins/presentations/lib/presentationcontroller.py @@ -24,6 +24,8 @@ import shutil from PyQt4 import QtCore +from openlp.core.lib import Receiver + class PresentationController(object): """ Base class for presentation controllers to inherit from @@ -143,6 +145,9 @@ class PresentationController(object): self.thumbnailprefix = u'slide' if not os.path.isdir(self.thumbnailroot): os.makedirs(self.thumbnailroot) + self.timer = QtCore.QTimer() + self.timer.setInterval(500) + QtCore.QObject.connect(self.timer, QtCore.SIGNAL("timeout()"), self.poll_slidenumber) def check_available(self): """ @@ -198,6 +203,8 @@ class PresentationController(object): recent than the powerpoint """ lastimage = self.get_slide_preview_file(self.get_slide_count()) + if lastimage is None: + return False if not os.path.isfile(lastimage): return False imgdate = os.stat(lastimage).st_mtime @@ -289,3 +296,16 @@ class PresentationController(object): The slide an image is required for, starting at 1 """ return None + + def poll_slidenumber(self): + """ + Check the current slide number + """ + if not self.is_active(): + return + current = self.get_slide_number() + if current == self.slidenumber: + return + self.slidenumber = current + Receiver().send_message(u'slidecontroller_change', self.slidenumber - 1) + \ No newline at end of file diff --git a/openlp/plugins/presentations/lib/presentationtab.py b/openlp/plugins/presentations/lib/presentationtab.py index 307cb8c76..410e3cde9 100644 --- a/openlp/plugins/presentations/lib/presentationtab.py +++ b/openlp/plugins/presentations/lib/presentationtab.py @@ -24,7 +24,7 @@ from PyQt4 import QtGui -from openlp.core.lib import SettingsTab, translate +from openlp.core.lib import SettingsTab class PresentationTab(SettingsTab): """ @@ -32,8 +32,7 @@ class PresentationTab(SettingsTab): """ def __init__(self, controllers): self.controllers = controllers - SettingsTab.__init__(self, - translate(u'PresentationTab', u'Presentation'), u'Presentations') + SettingsTab.__init__(self, u'Presentation', u'Presentations') def setupUi(self): self.setObjectName(u'PresentationTab') @@ -98,8 +97,8 @@ class PresentationTab(SettingsTab): for key in self.controllers: controller = self.controllers[key] checkbox = self.PresenterCheckboxes[controller.name] - checkbox.setText(translate(u'PresentationTab', - controller.name + u' available:')) + checkbox.setText( + u'%s %s:' % (controller.name, self.trUtf8(u'available'))) def load(self): for key in self.controllers: diff --git a/openlp/plugins/remotes/lib/remotetab.py b/openlp/plugins/remotes/lib/remotetab.py index 5a6acf214..a1f473c7c 100644 --- a/openlp/plugins/remotes/lib/remotetab.py +++ b/openlp/plugins/remotes/lib/remotetab.py @@ -20,15 +20,14 @@ Place, Suite 330, Boston, MA 02111-1307 USA from PyQt4 import QtGui -from openlp.core.lib import SettingsTab, translate +from openlp.core.lib import SettingsTab class RemoteTab(SettingsTab): """ RemoteTab is the Remotes settings tab in the settings dialog. """ def __init__(self): - SettingsTab.__init__( - self, translate(u'RemoteTab', u'Remotes'), u'Remotes') + SettingsTab.__init__(self, u'Remotes', u'Remotes') def setupUi(self): self.setObjectName(u'RemoteTab') @@ -48,8 +47,7 @@ class RemoteTab(SettingsTab): 0, QtGui.QFormLayout.LabelRole, self.RemoteModeGroupBox) def retranslateUi(self): - self.RemoteModeGroupBox.setTitle( - translate(u'RemoteTab', u'Remotes Receiver Port')) + self.RemoteModeGroupBox.setTitle(self.trUtf8(u'Remotes Receiver Port')) def load(self): self.RemotePortSpinBox.setValue( diff --git a/openlp/plugins/songs/forms/authorsdialog.py b/openlp/plugins/songs/forms/authorsdialog.py index 63761b196..f42de7b1b 100644 --- a/openlp/plugins/songs/forms/authorsdialog.py +++ b/openlp/plugins/songs/forms/authorsdialog.py @@ -23,7 +23,6 @@ ############################################################################### from PyQt4 import QtCore, QtGui -from openlp.core.lib import translate class Ui_AuthorsDialog(object): def setupUi(self, AuthorsDialog): @@ -73,11 +72,7 @@ class Ui_AuthorsDialog(object): QtCore.QMetaObject.connectSlotsByName(AuthorsDialog) def retranslateUi(self, AuthorsDialog): - AuthorsDialog.setWindowTitle( - translate(u'AuthorsDialog', u'Author Maintenance')) - self.DisplayLabel.setText( - translate(u'AuthorsDialog', u'Display name:')) - self.FirstNameLabel.setText( - translate(u'AuthorsDialog', u'First name:')) - self.LastNameLabel.setText( - translate(u'AuthorsDialog', u'Last name:')) + AuthorsDialog.setWindowTitle(self.trUtf8(u'Author Maintenance')) + self.DisplayLabel.setText(self.trUtf8(u'Display name:')) + self.FirstNameLabel.setText(self.trUtf8(u'First name:')) + self.LastNameLabel.setText(self.trUtf8(u'Last name:')) diff --git a/openlp/plugins/songs/forms/authorsform.py b/openlp/plugins/songs/forms/authorsform.py index c85b38000..be5999f7b 100644 --- a/openlp/plugins/songs/forms/authorsform.py +++ b/openlp/plugins/songs/forms/authorsform.py @@ -23,7 +23,7 @@ ############################################################################### from PyQt4 import QtGui, QtCore -from openlp.core.lib import translate + from openlp.plugins.songs.forms.authorsdialog import Ui_AuthorsDialog class AuthorsForm(QtGui.QDialog, Ui_AuthorsDialog): @@ -74,23 +74,25 @@ class AuthorsForm(QtGui.QDialog, Ui_AuthorsDialog): def accept(self): if not self.FirstNameEdit.text(): - QtGui.QMessageBox.critical(self, - translate(u'AuthorsDialog', u'Error'), - translate(u'AuthorsDialog', u'You need to type in the first name of the author.'), + QtGui.QMessageBox.critical( + self, self.trUtf8(u'Error'), + self.trUtf8(u'You need to type in the first name of the author.'), QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) self.FirstNameEdit.setFocus() return False elif not self.LastNameEdit.text(): - QtGui.QMessageBox.critical(self, - translate(u'AuthorsDialog', u'Error'), - translate(u'AuthorsDialog', u'You need to type in the last name of the author.'), + QtGui.QMessageBox.critical( + self, self.trUtf8(u'Error'), + self.trUtf8(u'You need to type in the last name of the author.'), QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) self.LastNameEdit.setFocus() return False elif not self.DisplayEdit.text(): - if QtGui.QMessageBox.critical(self, - translate(u'AuthorsDialog', u'Error'), - translate(u'AuthorsDialog', u'You haven\'t set a display name for the author, would you like me to combine the first and last names for you?'), + if QtGui.QMessageBox.critical( + self, self.trUtf8(u'Error'), + self.trUtf8(u'You haven\'t set a display name for the ' + u'author, would you like me to combine the first and ' + u'last names for you?'), QtGui.QMessageBox.StandardButtons( QtGui.QMessageBox.Yes | QtGui.QMessageBox.No) ) == QtGui.QMessageBox.Yes: diff --git a/openlp/plugins/songs/forms/editsongdialog.py b/openlp/plugins/songs/forms/editsongdialog.py index 007bb6e89..392bce81d 100644 --- a/openlp/plugins/songs/forms/editsongdialog.py +++ b/openlp/plugins/songs/forms/editsongdialog.py @@ -24,7 +24,7 @@ from PyQt4 import QtCore, QtGui -from openlp.core.lib import translate, buildIcon +from openlp.core.lib import buildIcon class Ui_EditSongDialog(object): def setupUi(self, EditSongDialog): @@ -414,33 +414,36 @@ class Ui_EditSongDialog(object): EditSongDialog.setTabOrder(self.CommentsEdit, self.ButtonBox) def retranslateUi(self, EditSongDialog): - EditSongDialog.setWindowTitle(translate(u'EditSongDialog', u'Song Editor')) - self.TitleLabel.setText(translate(u'EditSongDialog', u'Title:')) - self.AlternativeTitleLabel.setText(translate(u'EditSongDialog', u'Alternative Title:')) - self.LyricsLabel.setText(translate(u'EditSongDialog', u'Lyrics:')) - self.VerseOrderLabel.setText(translate(u'EditSongDialog', u'Verse Order:')) - self.VerseAddButton.setText(translate(u'EditSongDialog', u'Add')) - self.VerseEditButton.setText(translate(u'EditSongDialog', u'Edit')) - self.VerseEditAllButton.setText(translate(u'EditSongDialog', u'Edit All')) - self.VerseDeleteButton.setText(translate(u'EditSongDialog', u'Delete')) - self.SongTabWidget.setTabText(self.SongTabWidget.indexOf(self.LyricsTab), - translate(u'EditSongDialog', u'Title && Lyrics')) - self.AuthorsGroupBox.setTitle(translate(u'EditSongDialog', u'Authors')) - self.AuthorAddButton.setText(translate(u'EditSongDialog', u'&Add to Song')) - self.AuthorRemoveButton.setText(translate(u'EditSongDialog', u'&Remove')) - self.MaintenanceButton.setText(translate(u'EditSongDialog', u'&Manage Authors, Topics, Books')) - self.TopicGroupBox.setTitle(translate(u'EditSongDialog', u'Topic')) - self.TopicAddButton.setText(translate(u'EditSongDialog', u'A&dd to Song')) - self.TopicRemoveButton.setText(translate(u'EditSongDialog', u'R&emove')) - self.SongBookGroup.setTitle(translate(u'EditSongDialog', u'Song Book')) - self.SongTabWidget.setTabText(self.SongTabWidget.indexOf(self.AuthorsTab), - translate(u'EditSongDialog', u'Authors, Topics && Book')) - self.ThemeGroupBox.setTitle(translate(u'EditSongDialog', u'Theme')) - self.ThemeAddButton.setText(translate(u'EditSongDialog', u'Add a Theme')) - self.CopyrightGroupBox.setTitle(translate(u'EditSongDialog', u'Copyright Information')) - self.CopyrightInsertButton.setText(translate(u'EditSongDialog', '©')) - self.CCLILabel.setText(translate(u'EditSongDialog', u'CCLI Number:')) - self.CommentsGroupBox.setTitle(translate(u'EditSongDialog', u'Comments')) - self.SongTabWidget.setTabText(self.SongTabWidget.indexOf(self.ThemeTab), - translate(u'EditSongDialog', u'Theme, Copyright Info && Comments')) - + EditSongDialog.setWindowTitle(self.trUtf8(u'Song Editor')) + self.TitleLabel.setText(self.trUtf8(u'Title:')) + self.AlternativeTitleLabel.setText(self.trUtf8(u'Alternative Title:')) + self.LyricsLabel.setText(self.trUtf8(u'Lyrics:')) + self.VerseOrderLabel.setText(self.trUtf8(u'Verse Order:')) + self.VerseAddButton.setText(self.trUtf8(u'Add')) + self.VerseEditButton.setText(self.trUtf8(u'Edit')) + self.VerseEditAllButton.setText(self.trUtf8(u'Edit All')) + self.VerseDeleteButton.setText(self.trUtf8(u'Delete')) + self.SongTabWidget.setTabText( + self.SongTabWidget.indexOf(self.LyricsTab), + self.trUtf8(u'Title && Lyrics')) + self.AuthorsGroupBox.setTitle(self.trUtf8(u'Authors')) + self.AuthorAddButton.setText(self.trUtf8(u'&Add to Song')) + self.AuthorRemoveButton.setText(self.trUtf8(u'&Remove')) + self.MaintenanceButton.setText( + self.trUtf8(u'&Manage Authors, Topics, Books')) + self.TopicGroupBox.setTitle(self.trUtf8(u'Topic')) + self.TopicAddButton.setText(self.trUtf8(u'A&dd to Song')) + self.TopicRemoveButton.setText(self.trUtf8(u'R&emove')) + self.SongBookGroup.setTitle(self.trUtf8(u'Song Book')) + self.SongTabWidget.setTabText( + self.SongTabWidget.indexOf(self.AuthorsTab), + self.trUtf8(u'Authors, Topics && Book')) + self.ThemeGroupBox.setTitle(self.trUtf8(u'Theme')) + self.ThemeAddButton.setText(self.trUtf8(u'Add a Theme')) + self.CopyrightGroupBox.setTitle(self.trUtf8(u'Copyright Information')) + self.CopyrightInsertButton.setText(self.trUtf8(u'\xa9')) + self.CCLILabel.setText(self.trUtf8(u'CCLI Number:')) + self.CommentsGroupBox.setTitle(self.trUtf8(u'Comments')) + self.SongTabWidget.setTabText( + self.SongTabWidget.indexOf(self.ThemeTab), + self.trUtf8(u'Theme, Copyright Info && Comments')) diff --git a/openlp/plugins/songs/forms/editsongform.py b/openlp/plugins/songs/forms/editsongform.py index 1541c9311..1144d2df9 100644 --- a/openlp/plugins/songs/forms/editsongform.py +++ b/openlp/plugins/songs/forms/editsongform.py @@ -26,7 +26,7 @@ import logging from PyQt4 import QtCore, QtGui -from openlp.core.lib import SongXMLBuilder, SongXMLParser, Receiver, translate +from openlp.core.lib import SongXMLBuilder, SongXMLParser, Receiver from openlp.plugins.songs.forms import EditVerseForm from openlp.plugins.songs.lib.models import Song from editsongdialog import Ui_EditSongDialog @@ -93,6 +93,11 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): QtCore.SIGNAL(u'lostFocus()'), self.onCommentsEditLostFocus) QtCore.QObject.connect(self.VerseOrderEdit, QtCore.SIGNAL(u'lostFocus()'), self.onVerseOrderEditLostFocus) + previewButton = QtGui.QPushButton() + previewButton.setText(self.trUtf8(u'Save & Preview')) + self.ButtonBox.addButton(previewButton, QtGui.QDialogButtonBox.ActionRole) + QtCore.QObject.connect(self.ButtonBox, + QtCore.SIGNAL(u'clicked(QAbstractButton*)'), self.onPreview) # Create other objects and forms self.songmanager = songmanager self.verse_form = EditVerseForm() @@ -353,18 +358,15 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): if len(self.TitleEditItem.displayText()) == 0: self.SongTabWidget.setCurrentIndex(0) self.TitleEditItem.setFocus() - return False, translate( - u'SongFormDialog', u'You need to enter a song title.') + return False, self.trUtf8(u'You need to enter a song title.') if self.VerseListWidget.count() == 0: self.SongTabWidget.setCurrentIndex(0) self.VerseListWidget.setFocus() - return False, translate( - u'SongFormDialog', u'You need to enter some verses.') + return False, self.trUtf8(u'You need to enter some verses.') if self.AuthorsListView.count() == 0: self.SongTabWidget.setCurrentIndex(2) self.AuthorsListView.setFocus() - return False, translate( - u'SongFormDialog', u'You need to provide at least one author.') + return False, self.trUtf8(u'You need to provide at least one author.') return True, u'' def onTitleEditItemLostFocus(self): @@ -394,14 +396,26 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): self.loadBooks() self.loadTopics() + def onPreview(self, button): + log.debug(u'onPreview') + if button.text() == self.trUtf8(u'Save & Preview') and self.saveSong(): + Receiver().send_message(u'preview_song') + def accept(self): log.debug(u'accept') + if self.saveSong(): + if self.title_change: + Receiver().send_message(u'load_song_list') + Receiver().send_message(u'preview_song') + self.close() + + def saveSong(self): valid, message = self._validate_song() if not valid: - QtGui.QMessageBox.critical(self, - translate(u'SongFormDialog', u'Error'), message, - QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) - return + QtGui.QMessageBox.critical( + self, self.trUtf8(u'Error'), message, + QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) + return False self.song.title = unicode(self.TitleEditItem.displayText()) self.song.copyright = unicode(self.CopyrightEditItem.displayText()) self.song.search_title = unicode(self.TitleEditItem.displayText()) + \ @@ -411,9 +425,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): self.processLyrics() self.processTitle() self.songmanager.save_song(self.song) - if self.title_change: - Receiver().send_message(u'load_song_list') - self.close() + return True def processLyrics(self): log.debug(u'processLyrics') diff --git a/openlp/plugins/songs/forms/editversedialog.py b/openlp/plugins/songs/forms/editversedialog.py index d08a13809..f69a2fe6f 100644 --- a/openlp/plugins/songs/forms/editversedialog.py +++ b/openlp/plugins/songs/forms/editversedialog.py @@ -23,7 +23,6 @@ ############################################################################### from PyQt4 import QtCore, QtGui -from openlp.core.lib import translate class Ui_EditVerseDialog(object): def setupUi(self, EditVerseDialog): @@ -50,4 +49,4 @@ class Ui_EditVerseDialog(object): self.VerseTextEdit.setFocus(QtCore.Qt.OtherFocusReason) def retranslateUi(self, EditVerseDialog): - EditVerseDialog.setWindowTitle(translate(u'EditVerseDialog', u'Song Verse Edit Dialog')) + EditVerseDialog.setWindowTitle(self.trUtf8(u'Edit Verse')) diff --git a/openlp/plugins/songs/forms/openlpexportdialog.py b/openlp/plugins/songs/forms/openlpexportdialog.py new file mode 100644 index 000000000..8f8ca589a --- /dev/null +++ b/openlp/plugins/songs/forms/openlpexportdialog.py @@ -0,0 +1,305 @@ +# -*- coding: utf-8 -*- +# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 + +############################################################################### +# OpenLP - Open Source Lyrics Projection # +# --------------------------------------------------------------------------- # +# Copyright (c) 2008-2009 Raoul Snyman # +# Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley, Carsten # +# Tinggaard, Jon Tibble, Jonathan Corwin, Maikel Stuivenberg, Scott Guerrieri # +# --------------------------------------------------------------------------- # +# 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 # +############################################################################### + +from PyQt4 import QtCore, QtGui + +class Ui_OpenLPExportDialog(object): + def setupUi(self, OpenLPExportDialog): + OpenLPExportDialog.setObjectName(u'OpenLPExportDialog') + OpenLPExportDialog.resize(473, 459) + icon = QtGui.QIcon() + icon.addPixmap(QtGui.QPixmap(u':/icon/openlp.org-icon-32.bmp'), QtGui.QIcon.Normal, QtGui.QIcon.Off) + OpenLPExportDialog.setWindowIcon(icon) + self.verticalLayout_5 = QtGui.QVBoxLayout(OpenLPExportDialog) + self.verticalLayout_5.setMargin(8) + self.verticalLayout_5.setObjectName(u'verticalLayout_5') + self.ExportFileWidget = QtGui.QWidget(OpenLPExportDialog) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.ExportFileWidget.sizePolicy().hasHeightForWidth()) + self.ExportFileWidget.setSizePolicy(sizePolicy) + self.ExportFileWidget.setObjectName(u'ExportFileWidget') + self.horizontalLayout = QtGui.QHBoxLayout(self.ExportFileWidget) + self.horizontalLayout.setSpacing(3) + self.horizontalLayout.setMargin(0) + self.horizontalLayout.setObjectName(u'horizontalLayout') + self.ExportFileLabel = QtGui.QLabel(self.ExportFileWidget) + self.ExportFileLabel.setObjectName(u'ExportFileLabel') + self.horizontalLayout.addWidget(self.ExportFileLabel) + self.ExportFileLineEdit = QtGui.QLineEdit(self.ExportFileWidget) + self.ExportFileLineEdit.setObjectName(u'ExportFileLineEdit') + self.horizontalLayout.addWidget(self.ExportFileLineEdit) + self.ExportFileSelectPushButton = QtGui.QPushButton(self.ExportFileWidget) + icon1 = QtGui.QIcon() + icon1.addPixmap(QtGui.QPixmap(u':/exports/export_load.png'), QtGui.QIcon.Normal, QtGui.QIcon.Off) + self.ExportFileSelectPushButton.setIcon(icon1) + self.ExportFileSelectPushButton.setObjectName(u'ExportFileSelectPushButton') + self.horizontalLayout.addWidget(self.ExportFileSelectPushButton) + self.verticalLayout_5.addWidget(self.ExportFileWidget) + self.SongListFrame = QtGui.QFrame(OpenLPExportDialog) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.SongListFrame.sizePolicy().hasHeightForWidth()) + self.SongListFrame.setSizePolicy(sizePolicy) + self.SongListFrame.setFrameShape(QtGui.QFrame.Box) + self.SongListFrame.setFrameShadow(QtGui.QFrame.Raised) + self.SongListFrame.setObjectName(u'SongListFrame') + self.horizontalLayout_6 = QtGui.QHBoxLayout(self.SongListFrame) + self.horizontalLayout_6.setSpacing(8) + self.horizontalLayout_6.setMargin(8) + self.horizontalLayout_6.setObjectName(u'horizontalLayout_6') + self.ExportFileSongListWidget = QtGui.QWidget(self.SongListFrame) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Expanding) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.ExportFileSongListWidget.sizePolicy().hasHeightForWidth()) + self.ExportFileSongListWidget.setSizePolicy(sizePolicy) + self.ExportFileSongListWidget.setObjectName(u'ExportFileSongListWidget') + self.verticalLayout = QtGui.QVBoxLayout(self.ExportFileSongListWidget) + self.verticalLayout.setSpacing(6) + self.verticalLayout.setMargin(0) + self.verticalLayout.setObjectName(u'verticalLayout') + self.ExportListLabel = QtGui.QLabel(self.ExportFileSongListWidget) + self.ExportListLabel.setObjectName(u'ExportListLabel') + self.verticalLayout.addWidget(self.ExportListLabel) + self.ExportListTable = QtGui.QTableWidget(self.ExportFileSongListWidget) + self.ExportListTable.setSelectionMode(QtGui.QAbstractItemView.MultiSelection) + self.ExportListTable.setShowGrid(False) + self.ExportListTable.setWordWrap(False) + self.ExportListTable.setCornerButtonEnabled(False) + self.ExportListTable.setObjectName(u'ExportListTable') + self.ExportListTable.setColumnCount(2) + self.ExportListTable.setRowCount(0) + item = QtGui.QTableWidgetItem() + self.ExportListTable.setHorizontalHeaderItem(0, item) + item = QtGui.QTableWidgetItem() + self.ExportListTable.setHorizontalHeaderItem(1, item) + self.verticalLayout.addWidget(self.ExportListTable) + self.ExportSelectAllWidget = QtGui.QWidget(self.ExportFileSongListWidget) + self.ExportSelectAllWidget.setObjectName(u'ExportSelectAllWidget') + self.horizontalLayout_2 = QtGui.QHBoxLayout(self.ExportSelectAllWidget) + self.horizontalLayout_2.setSpacing(6) + self.horizontalLayout_2.setMargin(0) + self.horizontalLayout_2.setObjectName(u'horizontalLayout_2') + self.ExportSelectAllPushButton = QtGui.QPushButton(self.ExportSelectAllWidget) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.ExportSelectAllPushButton.sizePolicy().hasHeightForWidth()) + self.ExportSelectAllPushButton.setSizePolicy(sizePolicy) + self.ExportSelectAllPushButton.setMinimumSize(QtCore.QSize(100, 0)) + icon2 = QtGui.QIcon() + icon2.addPixmap(QtGui.QPixmap(u':/exports/export_selectall.png'), QtGui.QIcon.Normal, QtGui.QIcon.Off) + self.ExportSelectAllPushButton.setIcon(icon2) + self.ExportSelectAllPushButton.setObjectName(u'ExportSelectAllPushButton') + self.horizontalLayout_2.addWidget(self.ExportSelectAllPushButton) + spacerItem = QtGui.QSpacerItem(89, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) + self.horizontalLayout_2.addItem(spacerItem) + self.verticalLayout.addWidget(self.ExportSelectAllWidget) + self.exportFilterWidget = QtGui.QWidget(self.ExportFileSongListWidget) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.exportFilterWidget.sizePolicy().hasHeightForWidth()) + self.exportFilterWidget.setSizePolicy(sizePolicy) + self.exportFilterWidget.setMinimumSize(QtCore.QSize(0, 0)) + self.exportFilterWidget.setObjectName(u'exportFilterWidget') + self.horizontalLayout_3 = QtGui.QHBoxLayout(self.exportFilterWidget) + self.horizontalLayout_3.setMargin(0) + self.horizontalLayout_3.setObjectName(u'horizontalLayout_3') + self.ExportFilterComboBox = QtGui.QComboBox(self.exportFilterWidget) + self.ExportFilterComboBox.setMinimumSize(QtCore.QSize(70, 0)) + self.ExportFilterComboBox.setObjectName(u'ExportFilterComboBox') + self.ExportFilterComboBox.addItem(QtCore.QString()) + self.ExportFilterComboBox.addItem(QtCore.QString()) + self.ExportFilterComboBox.addItem(QtCore.QString()) + self.horizontalLayout_3.addWidget(self.ExportFilterComboBox) + self.ExportFilterLineEdit = QtGui.QLineEdit(self.exportFilterWidget) + self.ExportFilterLineEdit.setObjectName(u'ExportFilterLineEdit') + self.horizontalLayout_3.addWidget(self.ExportFilterLineEdit) + self.verticalLayout.addWidget(self.exportFilterWidget) + self.horizontalLayout_6.addWidget(self.ExportFileSongListWidget) + self.AddSelectedWidget = QtGui.QWidget(self.SongListFrame) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Expanding) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.AddSelectedWidget.sizePolicy().hasHeightForWidth()) + self.AddSelectedWidget.setSizePolicy(sizePolicy) + self.AddSelectedWidget.setObjectName(u'AddSelectedWidget') + self.verticalLayout_3 = QtGui.QVBoxLayout(self.AddSelectedWidget) + self.verticalLayout_3.setMargin(0) + self.verticalLayout_3.setObjectName(u'verticalLayout_3') + spacerItem1 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) + self.verticalLayout_3.addItem(spacerItem1) + self.AddSelectedPushButton = QtGui.QPushButton(self.AddSelectedWidget) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.AddSelectedPushButton.sizePolicy().hasHeightForWidth()) + self.AddSelectedPushButton.setSizePolicy(sizePolicy) + self.AddSelectedPushButton.setMinimumSize(QtCore.QSize(25, 25)) + icon3 = QtGui.QIcon() + icon3.addPixmap(QtGui.QPixmap(u':/exports/export_move_to_list.png'), QtGui.QIcon.Normal, QtGui.QIcon.Off) + self.AddSelectedPushButton.setIcon(icon3) + self.AddSelectedPushButton.setObjectName(u'AddSelectedPushButton') + self.verticalLayout_3.addWidget(self.AddSelectedPushButton) + spacerItem2 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) + self.verticalLayout_3.addItem(spacerItem2) + self.horizontalLayout_6.addWidget(self.AddSelectedWidget) + self.SelectedFileListWidget = QtGui.QWidget(self.SongListFrame) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Expanding) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.SelectedFileListWidget.sizePolicy().hasHeightForWidth()) + self.SelectedFileListWidget.setSizePolicy(sizePolicy) + self.SelectedFileListWidget.setObjectName(u'SelectedFileListWidget') + self.verticalLayout_2 = QtGui.QVBoxLayout(self.SelectedFileListWidget) + self.verticalLayout_2.setMargin(0) + self.verticalLayout_2.setObjectName(u'verticalLayout_2') + self.SelectedListLabel = QtGui.QLabel(self.SelectedFileListWidget) + self.SelectedListLabel.setObjectName(u'SelectedListLabel') + self.verticalLayout_2.addWidget(self.SelectedListLabel) + self.SelectedListTable = QtGui.QTableWidget(self.SelectedFileListWidget) + self.SelectedListTable.setSelectionMode(QtGui.QAbstractItemView.MultiSelection) + self.SelectedListTable.setShowGrid(False) + self.SelectedListTable.setWordWrap(False) + self.SelectedListTable.setCornerButtonEnabled(False) + self.SelectedListTable.setObjectName(u'SelectedListTable') + self.SelectedListTable.setColumnCount(2) + self.SelectedListTable.setRowCount(0) + item = QtGui.QTableWidgetItem() + self.SelectedListTable.setHorizontalHeaderItem(0, item) + item = QtGui.QTableWidgetItem() + self.SelectedListTable.setHorizontalHeaderItem(1, item) + self.verticalLayout_2.addWidget(self.SelectedListTable) + self.SelectedSelectAllWidget = QtGui.QWidget(self.SelectedFileListWidget) + self.SelectedSelectAllWidget.setObjectName(u'SelectedSelectAllWidget') + self.horizontalLayout_4 = QtGui.QHBoxLayout(self.SelectedSelectAllWidget) + self.horizontalLayout_4.setSpacing(6) + self.horizontalLayout_4.setMargin(0) + self.horizontalLayout_4.setObjectName(u'horizontalLayout_4') + self.SelectedSelectAllPushButton = QtGui.QPushButton(self.SelectedSelectAllWidget) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.SelectedSelectAllPushButton.sizePolicy().hasHeightForWidth()) + self.SelectedSelectAllPushButton.setSizePolicy(sizePolicy) + self.SelectedSelectAllPushButton.setMinimumSize(QtCore.QSize(100, 0)) + self.SelectedSelectAllPushButton.setIcon(icon2) + self.SelectedSelectAllPushButton.setObjectName(u'SelectedSelectAllPushButton') + self.horizontalLayout_4.addWidget(self.SelectedSelectAllPushButton) + spacerItem3 = QtGui.QSpacerItem(92, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) + self.horizontalLayout_4.addItem(spacerItem3) + self.verticalLayout_2.addWidget(self.SelectedSelectAllWidget) + self.SelectedRemoveSelectedWidget = QtGui.QWidget(self.SelectedFileListWidget) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.SelectedRemoveSelectedWidget.sizePolicy().hasHeightForWidth()) + self.SelectedRemoveSelectedWidget.setSizePolicy(sizePolicy) + self.SelectedRemoveSelectedWidget.setObjectName(u'SelectedRemoveSelectedWidget') + self.horizontalLayout_5 = QtGui.QHBoxLayout(self.SelectedRemoveSelectedWidget) + self.horizontalLayout_5.setMargin(0) + self.horizontalLayout_5.setObjectName(u'horizontalLayout_5') + self.SelectedRemoveSelectedButton = QtGui.QPushButton(self.SelectedRemoveSelectedWidget) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.SelectedRemoveSelectedButton.sizePolicy().hasHeightForWidth()) + self.SelectedRemoveSelectedButton.setSizePolicy(sizePolicy) + self.SelectedRemoveSelectedButton.setMinimumSize(QtCore.QSize(140, 0)) + icon4 = QtGui.QIcon() + icon4.addPixmap(QtGui.QPixmap(u':/exports/export_remove.png'), QtGui.QIcon.Normal, QtGui.QIcon.Off) + self.SelectedRemoveSelectedButton.setIcon(icon4) + self.SelectedRemoveSelectedButton.setObjectName(u'SelectedRemoveSelectedButton') + self.horizontalLayout_5.addWidget(self.SelectedRemoveSelectedButton) + spacerItem4 = QtGui.QSpacerItem(49, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) + self.horizontalLayout_5.addItem(spacerItem4) + self.verticalLayout_2.addWidget(self.SelectedRemoveSelectedWidget) + self.horizontalLayout_6.addWidget(self.SelectedFileListWidget) + self.verticalLayout_5.addWidget(self.SongListFrame) + self.ProgressGroupBox = QtGui.QGroupBox(OpenLPExportDialog) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.ProgressGroupBox.sizePolicy().hasHeightForWidth()) + self.ProgressGroupBox.setSizePolicy(sizePolicy) + self.ProgressGroupBox.setObjectName(u'ProgressGroupBox') + self.verticalLayout_4 = QtGui.QVBoxLayout(self.ProgressGroupBox) + self.verticalLayout_4.setSpacing(8) + self.verticalLayout_4.setContentsMargins(8, 0, 8, 8) + self.verticalLayout_4.setObjectName(u'verticalLayout_4') + self.ProgressLabel = QtGui.QLabel(self.ProgressGroupBox) + self.ProgressLabel.setObjectName(u'ProgressLabel') + self.verticalLayout_4.addWidget(self.ProgressLabel) + self.ProgressBar = QtGui.QProgressBar(self.ProgressGroupBox) + self.ProgressBar.setProperty(u'value', QtCore.QVariant(24)) + self.ProgressBar.setObjectName(u'ProgressBar') + self.verticalLayout_4.addWidget(self.ProgressBar) + self.verticalLayout_5.addWidget(self.ProgressGroupBox) + self.ButtonBarWidget = QtGui.QWidget(OpenLPExportDialog) + self.ButtonBarWidget.setObjectName(u'ButtonBarWidget') + self.horizontalLayout_7 = QtGui.QHBoxLayout(self.ButtonBarWidget) + self.horizontalLayout_7.setSpacing(8) + self.horizontalLayout_7.setMargin(0) + self.horizontalLayout_7.setObjectName(u'horizontalLayout_7') + spacerItem5 = QtGui.QSpacerItem(288, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) + self.horizontalLayout_7.addItem(spacerItem5) + self.ExportPushButton = QtGui.QPushButton(self.ButtonBarWidget) + self.ExportPushButton.setObjectName(u'ExportPushButton') + self.horizontalLayout_7.addWidget(self.ExportPushButton) + self.ClosePushButton = QtGui.QPushButton(self.ButtonBarWidget) + self.ClosePushButton.setObjectName(u'ClosePushButton') + self.horizontalLayout_7.addWidget(self.ClosePushButton) + self.verticalLayout_5.addWidget(self.ButtonBarWidget) + + self.retranslateUi(OpenLPExportDialog) + QtCore.QObject.connect(self.ClosePushButton, QtCore.SIGNAL(u'clicked()'), OpenLPExportDialog.close) + QtCore.QObject.connect(self.ExportSelectAllPushButton, QtCore.SIGNAL(u'clicked()'), self.ExportListTable.selectAll) + QtCore.QObject.connect(self.SelectedSelectAllPushButton, QtCore.SIGNAL(u'clicked()'), self.SelectedListTable.selectAll) + QtCore.QObject.connect(self.SelectedRemoveSelectedButton, QtCore.SIGNAL(u'clicked()'), self.SelectedListTable.clear) + QtCore.QMetaObject.connectSlotsByName(OpenLPExportDialog) + + def retranslateUi(self, OpenLPExportDialog): + OpenLPExportDialog.setWindowTitle(self.trUtf8(u'openlp.org Song Exporter')) + self.ExportFileLabel.setText(self.trUtf8(u'Select openlp.org export filename:')) + self.ExportListLabel.setText(self.trUtf8(u'Full Song List')) + self.ExportListTable.horizontalHeaderItem(0).setText(self.trUtf8(u'Song Title')) + self.ExportListTable.horizontalHeaderItem(1).setText(self.trUtf8(u'Author')) + self.ExportSelectAllPushButton.setText(self.trUtf8(u'Select All')) + self.ExportFilterComboBox.setItemText(0, self.trUtf8(u'Lyrics')) + self.ExportFilterComboBox.setItemText(1, self.trUtf8(u'Title')) + self.ExportFilterComboBox.setItemText(2, self.trUtf8(u'Author')) + self.SelectedListLabel.setText(self.trUtf8(u'Song Export List')) + self.SelectedListTable.horizontalHeaderItem(0).setText(self.trUtf8(u'Song Title')) + self.SelectedListTable.horizontalHeaderItem(1).setText(self.trUtf8(u'Author')) + self.SelectedSelectAllPushButton.setText(self.trUtf8(u'Select All')) + self.SelectedRemoveSelectedButton.setText(self.trUtf8(u'Remove Selected')) + self.ProgressGroupBox.setTitle(self.trUtf8(u'Progress:')) + self.ProgressLabel.setText(self.trUtf8(u'Ready to export')) + self.ExportPushButton.setText(self.trUtf8(u'Export')) + self.ClosePushButton.setText(self.trUtf8(u'Close')) + diff --git a/openlp/plugins/songs/forms/openlpexportform.py b/openlp/plugins/songs/forms/openlpexportform.py index b69ed3995..a4bcffe2a 100644 --- a/openlp/plugins/songs/forms/openlpexportform.py +++ b/openlp/plugins/songs/forms/openlpexportform.py @@ -22,287 +22,13 @@ # Temple Place, Suite 330, Boston, MA 02111-1307 USA # ############################################################################### -from PyQt4 import QtCore, QtGui -from openlp.core.lib import translate, buildIcon +from PyQt4 import QtGui -class OpenLPExportForm(object): +from openlp.plugins.songs.forms.openlpexportdialog import Ui_OpenLPExportDialog - def __init__(self): - self.OpenLPExportForm = QtGui.QWidget() - self.setupUi() +class OpenLPExportForm(QtGui.QDialog, Ui_OpenLPExportDialog): - def setupUi(self): - self.OpenLPExportForm.setObjectName(u'OpenLPExportForm') - self.OpenLPExportForm.resize(473, 459) - icon = buildIcon(u':/icon/openlp-logo-16x16.png') - self.OpenLPExportForm.setWindowIcon(icon) - self.verticalLayout_5 = QtGui.QVBoxLayout(self.OpenLPExportForm) - self.verticalLayout_5.setMargin(8) - self.verticalLayout_5.setObjectName(u'verticalLayout_5') - self.ExportFileWidget = QtGui.QWidget(self.OpenLPExportForm) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.ExportFileWidget.sizePolicy().hasHeightForWidth()) - self.ExportFileWidget.setSizePolicy(sizePolicy) - self.ExportFileWidget.setObjectName(u'ExportFileWidget') - self.horizontalLayout = QtGui.QHBoxLayout(self.ExportFileWidget) - self.horizontalLayout.setSpacing(3) - self.horizontalLayout.setMargin(0) - self.horizontalLayout.setObjectName(u'horizontalLayout') - self.ExportFileLabel = QtGui.QLabel(self.ExportFileWidget) - self.ExportFileLabel.setObjectName(u'ExportFileLabel') - self.horizontalLayout.addWidget(self.ExportFileLabel) - self.ExportFileLineEdit = QtGui.QLineEdit(self.ExportFileWidget) - self.ExportFileLineEdit.setObjectName(u'ExportFileLineEdit') - self.horizontalLayout.addWidget(self.ExportFileLineEdit) - self.ExportFileSelectPushButton = QtGui.QPushButton(self.ExportFileWidget) - icon1 = buildIcon(u':/exports/export_load.png') - self.ExportFileSelectPushButton.setIcon(icon1) - self.ExportFileSelectPushButton.setObjectName(u'ExportFileSelectPushButton') - self.horizontalLayout.addWidget(self.ExportFileSelectPushButton) - self.verticalLayout_5.addWidget(self.ExportFileWidget) - self.SongListFrame = QtGui.QFrame(self.OpenLPExportForm) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.SongListFrame.sizePolicy().hasHeightForWidth()) - self.SongListFrame.setSizePolicy(sizePolicy) - self.SongListFrame.setFrameShape(QtGui.QFrame.Box) - self.SongListFrame.setFrameShadow(QtGui.QFrame.Raised) - self.SongListFrame.setObjectName(u'SongListFrame') - self.horizontalLayout_6 = QtGui.QHBoxLayout(self.SongListFrame) - self.horizontalLayout_6.setSpacing(8) - self.horizontalLayout_6.setMargin(8) - self.horizontalLayout_6.setObjectName(u'horizontalLayout_6') - self.ExportFileSongListWidget = QtGui.QWidget(self.SongListFrame) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Expanding) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.ExportFileSongListWidget.sizePolicy().hasHeightForWidth()) - self.ExportFileSongListWidget.setSizePolicy(sizePolicy) - self.ExportFileSongListWidget.setObjectName(u'ExportFileSongListWidget') - self.verticalLayout = QtGui.QVBoxLayout(self.ExportFileSongListWidget) - self.verticalLayout.setSpacing(6) - self.verticalLayout.setMargin(0) - self.verticalLayout.setObjectName(u'verticalLayout') - self.ExportListLabel = QtGui.QLabel(self.ExportFileSongListWidget) - self.ExportListLabel.setObjectName(u'ExportListLabel') - self.verticalLayout.addWidget(self.ExportListLabel) - self.ExportListTable = QtGui.QTableWidget(self.ExportFileSongListWidget) - self.ExportListTable.setSelectionMode(QtGui.QAbstractItemView.MultiSelection) - self.ExportListTable.setShowGrid(False) - self.ExportListTable.setWordWrap(False) - self.ExportListTable.setCornerButtonEnabled(False) - self.ExportListTable.setObjectName(u'ExportListTable') - self.ExportListTable.setColumnCount(2) - self.ExportListTable.setRowCount(0) - item = QtGui.QTableWidgetItem() - self.ExportListTable.setHorizontalHeaderItem(0, item) - item = QtGui.QTableWidgetItem() - self.ExportListTable.setHorizontalHeaderItem(1, item) - self.verticalLayout.addWidget(self.ExportListTable) - self.ExportSelectAllWidget = QtGui.QWidget(self.ExportFileSongListWidget) - self.ExportSelectAllWidget.setObjectName(u'ExportSelectAllWidget') - self.horizontalLayout_2 = QtGui.QHBoxLayout(self.ExportSelectAllWidget) - self.horizontalLayout_2.setSpacing(6) - self.horizontalLayout_2.setMargin(0) - self.horizontalLayout_2.setObjectName(u'horizontalLayout_2') - self.ExportSelectAllPushButton = QtGui.QPushButton(self.ExportSelectAllWidget) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.ExportSelectAllPushButton.sizePolicy().hasHeightForWidth()) - self.ExportSelectAllPushButton.setSizePolicy(sizePolicy) - self.ExportSelectAllPushButton.setMinimumSize(QtCore.QSize(100, 0)) - icon2 = buildIcon(u':/exports/export_selectall.png') - self.ExportSelectAllPushButton.setIcon(icon2) - self.ExportSelectAllPushButton.setObjectName(u'ExportSelectAllPushButton') - self.horizontalLayout_2.addWidget(self.ExportSelectAllPushButton) - spacerItem = QtGui.QSpacerItem(89, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) - self.horizontalLayout_2.addItem(spacerItem) - self.verticalLayout.addWidget(self.ExportSelectAllWidget) - self.exportFilterWidget = QtGui.QWidget(self.ExportFileSongListWidget) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.exportFilterWidget.sizePolicy().hasHeightForWidth()) - self.exportFilterWidget.setSizePolicy(sizePolicy) - self.exportFilterWidget.setMinimumSize(QtCore.QSize(0, 0)) - self.exportFilterWidget.setObjectName(u'exportFilterWidget') - self.horizontalLayout_3 = QtGui.QHBoxLayout(self.exportFilterWidget) - self.horizontalLayout_3.setMargin(0) - self.horizontalLayout_3.setObjectName(u'horizontalLayout_3') - self.ExportFilterComboBox = QtGui.QComboBox(self.exportFilterWidget) - self.ExportFilterComboBox.setMinimumSize(QtCore.QSize(70, 0)) - self.ExportFilterComboBox.setObjectName(u'ExportFilterComboBox') - self.ExportFilterComboBox.addItem(QtCore.QString()) - self.ExportFilterComboBox.addItem(QtCore.QString()) - self.ExportFilterComboBox.addItem(QtCore.QString()) - self.horizontalLayout_3.addWidget(self.ExportFilterComboBox) - self.ExportFilterLineEdit = QtGui.QLineEdit(self.exportFilterWidget) - self.ExportFilterLineEdit.setObjectName(u'ExportFilterLineEdit') - self.horizontalLayout_3.addWidget(self.ExportFilterLineEdit) - self.verticalLayout.addWidget(self.exportFilterWidget) - self.horizontalLayout_6.addWidget(self.ExportFileSongListWidget) - self.AddSelectedWidget = QtGui.QWidget(self.SongListFrame) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Expanding) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.AddSelectedWidget.sizePolicy().hasHeightForWidth()) - self.AddSelectedWidget.setSizePolicy(sizePolicy) - self.AddSelectedWidget.setObjectName(u'AddSelectedWidget') - self.verticalLayout_3 = QtGui.QVBoxLayout(self.AddSelectedWidget) - self.verticalLayout_3.setMargin(0) - self.verticalLayout_3.setObjectName(u'verticalLayout_3') - spacerItem1 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) - self.verticalLayout_3.addItem(spacerItem1) - self.AddSelectedPushButton = QtGui.QPushButton(self.AddSelectedWidget) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.AddSelectedPushButton.sizePolicy().hasHeightForWidth()) - self.AddSelectedPushButton.setSizePolicy(sizePolicy) - self.AddSelectedPushButton.setMinimumSize(QtCore.QSize(25, 25)) - icon3 = buildIcon(u':/exports/export_move_to_list.png') - self.AddSelectedPushButton.setIcon(icon3) - self.AddSelectedPushButton.setObjectName(u'AddSelectedPushButton') - self.verticalLayout_3.addWidget(self.AddSelectedPushButton) - spacerItem2 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) - self.verticalLayout_3.addItem(spacerItem2) - self.horizontalLayout_6.addWidget(self.AddSelectedWidget) - self.SelectedFileListWidget = QtGui.QWidget(self.SongListFrame) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Expanding) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.SelectedFileListWidget.sizePolicy().hasHeightForWidth()) - self.SelectedFileListWidget.setSizePolicy(sizePolicy) - self.SelectedFileListWidget.setObjectName(u'SelectedFileListWidget') - self.verticalLayout_2 = QtGui.QVBoxLayout(self.SelectedFileListWidget) - self.verticalLayout_2.setMargin(0) - self.verticalLayout_2.setObjectName(u'verticalLayout_2') - self.SelectedListLabel = QtGui.QLabel(self.SelectedFileListWidget) - self.SelectedListLabel.setObjectName(u'SelectedListLabel') - self.verticalLayout_2.addWidget(self.SelectedListLabel) - self.SelectedListTable = QtGui.QTableWidget(self.SelectedFileListWidget) - self.SelectedListTable.setSelectionMode(QtGui.QAbstractItemView.MultiSelection) - self.SelectedListTable.setShowGrid(False) - self.SelectedListTable.setWordWrap(False) - self.SelectedListTable.setCornerButtonEnabled(False) - self.SelectedListTable.setObjectName(u'SelectedListTable') - self.SelectedListTable.setColumnCount(2) - self.SelectedListTable.setRowCount(0) - item = QtGui.QTableWidgetItem() - self.SelectedListTable.setHorizontalHeaderItem(0, item) - item = QtGui.QTableWidgetItem() - self.SelectedListTable.setHorizontalHeaderItem(1, item) - self.verticalLayout_2.addWidget(self.SelectedListTable) - self.SelectedSelectAllWidget = QtGui.QWidget(self.SelectedFileListWidget) - self.SelectedSelectAllWidget.setObjectName(u'SelectedSelectAllWidget') - self.horizontalLayout_4 = QtGui.QHBoxLayout(self.SelectedSelectAllWidget) - self.horizontalLayout_4.setSpacing(6) - self.horizontalLayout_4.setMargin(0) - self.horizontalLayout_4.setObjectName(u'horizontalLayout_4') - self.SelectedSelectAllPushButton = QtGui.QPushButton(self.SelectedSelectAllWidget) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.SelectedSelectAllPushButton.sizePolicy().hasHeightForWidth()) - self.SelectedSelectAllPushButton.setSizePolicy(sizePolicy) - self.SelectedSelectAllPushButton.setMinimumSize(QtCore.QSize(100, 0)) - self.SelectedSelectAllPushButton.setIcon(icon2) - self.SelectedSelectAllPushButton.setObjectName(u'SelectedSelectAllPushButton') - self.horizontalLayout_4.addWidget(self.SelectedSelectAllPushButton) - spacerItem3 = QtGui.QSpacerItem(92, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) - self.horizontalLayout_4.addItem(spacerItem3) - self.verticalLayout_2.addWidget(self.SelectedSelectAllWidget) - self.SelectedRemoveSelectedWidget = QtGui.QWidget(self.SelectedFileListWidget) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.SelectedRemoveSelectedWidget.sizePolicy().hasHeightForWidth()) - self.SelectedRemoveSelectedWidget.setSizePolicy(sizePolicy) - self.SelectedRemoveSelectedWidget.setObjectName(u'SelectedRemoveSelectedWidget') - self.horizontalLayout_5 = QtGui.QHBoxLayout(self.SelectedRemoveSelectedWidget) - self.horizontalLayout_5.setMargin(0) - self.horizontalLayout_5.setObjectName(u'horizontalLayout_5') - self.SelectedRemoveSelectedButton = QtGui.QPushButton(self.SelectedRemoveSelectedWidget) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.SelectedRemoveSelectedButton.sizePolicy().hasHeightForWidth()) - self.SelectedRemoveSelectedButton.setSizePolicy(sizePolicy) - self.SelectedRemoveSelectedButton.setMinimumSize(QtCore.QSize(140, 0)) - icon4 = buildIcon(u':/exports/export_remove.png') - self.SelectedRemoveSelectedButton.setIcon(icon4) - self.SelectedRemoveSelectedButton.setObjectName(u'SelectedRemoveSelectedButton') - self.horizontalLayout_5.addWidget(self.SelectedRemoveSelectedButton) - spacerItem4 = QtGui.QSpacerItem(49, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) - self.horizontalLayout_5.addItem(spacerItem4) - self.verticalLayout_2.addWidget(self.SelectedRemoveSelectedWidget) - self.horizontalLayout_6.addWidget(self.SelectedFileListWidget) - self.verticalLayout_5.addWidget(self.SongListFrame) - self.ProgressGroupBox = QtGui.QGroupBox(self.OpenLPExportForm) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.ProgressGroupBox.sizePolicy().hasHeightForWidth()) - self.ProgressGroupBox.setSizePolicy(sizePolicy) - self.ProgressGroupBox.setObjectName(u'ProgressGroupBox') - self.verticalLayout_4 = QtGui.QVBoxLayout(self.ProgressGroupBox) - self.verticalLayout_4.setSpacing(8) - self.verticalLayout_4.setContentsMargins(8, 0, 8, 8) - self.verticalLayout_4.setObjectName(u'verticalLayout_4') - self.ProgressLabel = QtGui.QLabel(self.ProgressGroupBox) - self.ProgressLabel.setObjectName(u'ProgressLabel') - self.verticalLayout_4.addWidget(self.ProgressLabel) - self.ProgressBar = QtGui.QProgressBar(self.ProgressGroupBox) - self.ProgressBar.setProperty(u'value', QtCore.QVariant(24)) - self.ProgressBar.setObjectName(u'ProgressBar') - self.verticalLayout_4.addWidget(self.ProgressBar) - self.verticalLayout_5.addWidget(self.ProgressGroupBox) - self.ButtonBarWidget = QtGui.QWidget(self.OpenLPExportForm) - self.ButtonBarWidget.setObjectName(u'ButtonBarWidget') - self.horizontalLayout_7 = QtGui.QHBoxLayout(self.ButtonBarWidget) - self.horizontalLayout_7.setSpacing(8) - self.horizontalLayout_7.setMargin(0) - self.horizontalLayout_7.setObjectName(u'horizontalLayout_7') - spacerItem5 = QtGui.QSpacerItem(288, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) - self.horizontalLayout_7.addItem(spacerItem5) - self.ExportPushButton = QtGui.QPushButton(self.ButtonBarWidget) - self.ExportPushButton.setObjectName(u'ExportPushButton') - self.horizontalLayout_7.addWidget(self.ExportPushButton) - self.ClosePushButton = QtGui.QPushButton(self.ButtonBarWidget) - self.ClosePushButton.setObjectName(u'ClosePushButton') - self.horizontalLayout_7.addWidget(self.ClosePushButton) - self.verticalLayout_5.addWidget(self.ButtonBarWidget) + def __init__(self, parent=None): + QtGui.QDialog.__init__(self, parent) + self.setupUi(self) - self.retranslateUi() - QtCore.QObject.connect(self.ClosePushButton, QtCore.SIGNAL(u'clicked()'), self.OpenLPExportForm.close) - QtCore.QObject.connect(self.ExportSelectAllPushButton, QtCore.SIGNAL(u'clicked()'), self.ExportListTable.selectAll) - QtCore.QObject.connect(self.SelectedSelectAllPushButton, QtCore.SIGNAL(u'clicked()'), self.SelectedListTable.selectAll) - QtCore.QObject.connect(self.SelectedRemoveSelectedButton, QtCore.SIGNAL(u'clicked()'), self.SelectedListTable.clear) - QtCore.QMetaObject.connectSlotsByName(self.OpenLPExportForm) - - def retranslateUi(self): - self.OpenLPExportForm.setWindowTitle(translate(u'OpenLPExportForm', u'openlp.org Song Exporter')) - self.ExportFileLabel.setText(translate(u'OpenLPExportForm', u'Select openlp.org export filename:')) - self.ExportListLabel.setText(translate(u'OpenLPExportForm', u'Full Song List')) - self.ExportListTable.horizontalHeaderItem(0).setText(translate(u'OpenLPExportForm', u'Song Title')) - self.ExportListTable.horizontalHeaderItem(1).setText(translate(u'OpenLPExportForm', u'Author')) - self.ExportSelectAllPushButton.setText(translate(u'OpenLPExportForm', u'Select All')) - self.ExportFilterComboBox.setItemText(0, translate(u'OpenLPExportForm', u'Lyrics')) - self.ExportFilterComboBox.setItemText(1, translate(u'OpenLPExportForm', u'Title')) - self.ExportFilterComboBox.setItemText(2, translate(u'OpenLPExportForm', u'Author')) - self.SelectedListLabel.setText(translate(u'OpenLPExportForm', u'Song Export List')) - self.SelectedListTable.horizontalHeaderItem(0).setText(translate(u'OpenLPExportForm', u'Song Title')) - self.SelectedListTable.horizontalHeaderItem(1).setText(translate(u'OpenLPExportForm', u'Author')) - self.SelectedSelectAllPushButton.setText(translate(u'OpenLPExportForm', u'Select All')) - self.SelectedRemoveSelectedButton.setText(translate(u'OpenLPExportForm', u'Remove Selected')) - self.ProgressGroupBox.setTitle(translate(u'OpenLPExportForm', u'Progress:')) - self.ProgressLabel.setText(translate(u'OpenLPExportForm', u'Ready to export')) - self.ExportPushButton.setText(translate(u'OpenLPExportForm', u'Export')) - self.ClosePushButton.setText(translate(u'OpenLPExportForm', u'Close')) - - def show(self): - self.OpenLPExportForm.show() diff --git a/openlp/plugins/songs/forms/openlpimportdialog.py b/openlp/plugins/songs/forms/openlpimportdialog.py new file mode 100644 index 000000000..fc3867c69 --- /dev/null +++ b/openlp/plugins/songs/forms/openlpimportdialog.py @@ -0,0 +1,305 @@ +# -*- coding: utf-8 -*- +# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 + +############################################################################### +# OpenLP - Open Source Lyrics Projection # +# --------------------------------------------------------------------------- # +# Copyright (c) 2008-2009 Raoul Snyman # +# Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley, Carsten # +# Tinggaard, Jon Tibble, Jonathan Corwin, Maikel Stuivenberg, Scott Guerrieri # +# --------------------------------------------------------------------------- # +# 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 # +############################################################################### + +from PyQt4 import QtCore, QtGui + +class Ui_OpenLPImportDialog(object): + def setupUi(self, OpenLPImportDialog): + OpenLPImportDialog.setObjectName(u'OpenLPImportDialog') + OpenLPImportDialog.resize(473, 459) + icon = QtGui.QIcon() + icon.addPixmap(QtGui.QPixmap(u':/icon/openlp.org-icon-32.bmp'), QtGui.QIcon.Normal, QtGui.QIcon.Off) + OpenLPImportDialog.setWindowIcon(icon) + self.verticalLayout_5 = QtGui.QVBoxLayout(OpenLPImportDialog) + self.verticalLayout_5.setMargin(8) + self.verticalLayout_5.setObjectName(u'verticalLayout_5') + self.ImportFileWidget = QtGui.QWidget(OpenLPImportDialog) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.ImportFileWidget.sizePolicy().hasHeightForWidth()) + self.ImportFileWidget.setSizePolicy(sizePolicy) + self.ImportFileWidget.setObjectName(u'ImportFileWidget') + self.horizontalLayout = QtGui.QHBoxLayout(self.ImportFileWidget) + self.horizontalLayout.setSpacing(3) + self.horizontalLayout.setMargin(0) + self.horizontalLayout.setObjectName(u'horizontalLayout') + self.ImportFileLabel = QtGui.QLabel(self.ImportFileWidget) + self.ImportFileLabel.setObjectName(u'ImportFileLabel') + self.horizontalLayout.addWidget(self.ImportFileLabel) + self.ImportFileLineEdit = QtGui.QLineEdit(self.ImportFileWidget) + self.ImportFileLineEdit.setObjectName(u'ImportFileLineEdit') + self.horizontalLayout.addWidget(self.ImportFileLineEdit) + self.ImportFileSelectPushButton = QtGui.QPushButton(self.ImportFileWidget) + icon1 = QtGui.QIcon() + icon1.addPixmap(QtGui.QPixmap(u':/imports/import_load.png'), QtGui.QIcon.Normal, QtGui.QIcon.Off) + self.ImportFileSelectPushButton.setIcon(icon1) + self.ImportFileSelectPushButton.setObjectName(u'ImportFileSelectPushButton') + self.horizontalLayout.addWidget(self.ImportFileSelectPushButton) + self.verticalLayout_5.addWidget(self.ImportFileWidget) + self.SongListFrame = QtGui.QFrame(OpenLPImportDialog) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.SongListFrame.sizePolicy().hasHeightForWidth()) + self.SongListFrame.setSizePolicy(sizePolicy) + self.SongListFrame.setFrameShape(QtGui.QFrame.Box) + self.SongListFrame.setFrameShadow(QtGui.QFrame.Raised) + self.SongListFrame.setObjectName(u'SongListFrame') + self.horizontalLayout_6 = QtGui.QHBoxLayout(self.SongListFrame) + self.horizontalLayout_6.setSpacing(8) + self.horizontalLayout_6.setMargin(8) + self.horizontalLayout_6.setObjectName(u'horizontalLayout_6') + self.ImportFileSongListWidget = QtGui.QWidget(self.SongListFrame) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Expanding) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.ImportFileSongListWidget.sizePolicy().hasHeightForWidth()) + self.ImportFileSongListWidget.setSizePolicy(sizePolicy) + self.ImportFileSongListWidget.setObjectName(u'ImportFileSongListWidget') + self.verticalLayout = QtGui.QVBoxLayout(self.ImportFileSongListWidget) + self.verticalLayout.setSpacing(6) + self.verticalLayout.setMargin(0) + self.verticalLayout.setObjectName(u'verticalLayout') + self.ImportListLabel = QtGui.QLabel(self.ImportFileSongListWidget) + self.ImportListLabel.setObjectName(u'ImportListLabel') + self.verticalLayout.addWidget(self.ImportListLabel) + self.ImportListTable = QtGui.QTableWidget(self.ImportFileSongListWidget) + self.ImportListTable.setSelectionMode(QtGui.QAbstractItemView.MultiSelection) + self.ImportListTable.setShowGrid(False) + self.ImportListTable.setWordWrap(False) + self.ImportListTable.setCornerButtonEnabled(False) + self.ImportListTable.setObjectName(u'ImportListTable') + self.ImportListTable.setColumnCount(2) + self.ImportListTable.setRowCount(0) + item = QtGui.QTableWidgetItem() + self.ImportListTable.setHorizontalHeaderItem(0, item) + item = QtGui.QTableWidgetItem() + self.ImportListTable.setHorizontalHeaderItem(1, item) + self.verticalLayout.addWidget(self.ImportListTable) + self.ImportSelectAllWidget = QtGui.QWidget(self.ImportFileSongListWidget) + self.ImportSelectAllWidget.setObjectName(u'ImportSelectAllWidget') + self.horizontalLayout_2 = QtGui.QHBoxLayout(self.ImportSelectAllWidget) + self.horizontalLayout_2.setSpacing(6) + self.horizontalLayout_2.setMargin(0) + self.horizontalLayout_2.setObjectName(u'horizontalLayout_2') + self.ImportSelectAllPushButton = QtGui.QPushButton(self.ImportSelectAllWidget) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.ImportSelectAllPushButton.sizePolicy().hasHeightForWidth()) + self.ImportSelectAllPushButton.setSizePolicy(sizePolicy) + self.ImportSelectAllPushButton.setMinimumSize(QtCore.QSize(100, 0)) + icon2 = QtGui.QIcon() + icon2.addPixmap(QtGui.QPixmap(u':/imports/import_selectall.png'), QtGui.QIcon.Normal, QtGui.QIcon.Off) + self.ImportSelectAllPushButton.setIcon(icon2) + self.ImportSelectAllPushButton.setObjectName(u'ImportSelectAllPushButton') + self.horizontalLayout_2.addWidget(self.ImportSelectAllPushButton) + spacerItem = QtGui.QSpacerItem(89, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) + self.horizontalLayout_2.addItem(spacerItem) + self.verticalLayout.addWidget(self.ImportSelectAllWidget) + self.importFilterWidget = QtGui.QWidget(self.ImportFileSongListWidget) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.importFilterWidget.sizePolicy().hasHeightForWidth()) + self.importFilterWidget.setSizePolicy(sizePolicy) + self.importFilterWidget.setMinimumSize(QtCore.QSize(0, 0)) + self.importFilterWidget.setObjectName(u'importFilterWidget') + self.horizontalLayout_3 = QtGui.QHBoxLayout(self.importFilterWidget) + self.horizontalLayout_3.setMargin(0) + self.horizontalLayout_3.setObjectName(u'horizontalLayout_3') + self.ImportFilterComboBox = QtGui.QComboBox(self.importFilterWidget) + self.ImportFilterComboBox.setMinimumSize(QtCore.QSize(70, 0)) + self.ImportFilterComboBox.setObjectName(u'ImportFilterComboBox') + self.ImportFilterComboBox.addItem(QtCore.QString()) + self.ImportFilterComboBox.addItem(QtCore.QString()) + self.ImportFilterComboBox.addItem(QtCore.QString()) + self.horizontalLayout_3.addWidget(self.ImportFilterComboBox) + self.importFilterLineEdit = QtGui.QLineEdit(self.importFilterWidget) + self.importFilterLineEdit.setObjectName(u'importFilterLineEdit') + self.horizontalLayout_3.addWidget(self.importFilterLineEdit) + self.verticalLayout.addWidget(self.importFilterWidget) + self.horizontalLayout_6.addWidget(self.ImportFileSongListWidget) + self.AddSelectedWidget = QtGui.QWidget(self.SongListFrame) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Expanding) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.AddSelectedWidget.sizePolicy().hasHeightForWidth()) + self.AddSelectedWidget.setSizePolicy(sizePolicy) + self.AddSelectedWidget.setObjectName(u'AddSelectedWidget') + self.verticalLayout_3 = QtGui.QVBoxLayout(self.AddSelectedWidget) + self.verticalLayout_3.setMargin(0) + self.verticalLayout_3.setObjectName(u'verticalLayout_3') + spacerItem1 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) + self.verticalLayout_3.addItem(spacerItem1) + self.AddSelectedPushButton = QtGui.QPushButton(self.AddSelectedWidget) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.AddSelectedPushButton.sizePolicy().hasHeightForWidth()) + self.AddSelectedPushButton.setSizePolicy(sizePolicy) + self.AddSelectedPushButton.setMinimumSize(QtCore.QSize(25, 25)) + icon3 = QtGui.QIcon() + icon3.addPixmap(QtGui.QPixmap(u':/imports/import_move_to_list.png'), QtGui.QIcon.Normal, QtGui.QIcon.Off) + self.AddSelectedPushButton.setIcon(icon3) + self.AddSelectedPushButton.setObjectName(u'AddSelectedPushButton') + self.verticalLayout_3.addWidget(self.AddSelectedPushButton) + spacerItem2 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) + self.verticalLayout_3.addItem(spacerItem2) + self.horizontalLayout_6.addWidget(self.AddSelectedWidget) + self.SelectedFileListWidget = QtGui.QWidget(self.SongListFrame) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Expanding) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.SelectedFileListWidget.sizePolicy().hasHeightForWidth()) + self.SelectedFileListWidget.setSizePolicy(sizePolicy) + self.SelectedFileListWidget.setObjectName(u'SelectedFileListWidget') + self.verticalLayout_2 = QtGui.QVBoxLayout(self.SelectedFileListWidget) + self.verticalLayout_2.setMargin(0) + self.verticalLayout_2.setObjectName(u'verticalLayout_2') + self.SelectedListLabel = QtGui.QLabel(self.SelectedFileListWidget) + self.SelectedListLabel.setObjectName(u'SelectedListLabel') + self.verticalLayout_2.addWidget(self.SelectedListLabel) + self.SelectedListTable = QtGui.QTableWidget(self.SelectedFileListWidget) + self.SelectedListTable.setSelectionMode(QtGui.QAbstractItemView.MultiSelection) + self.SelectedListTable.setShowGrid(False) + self.SelectedListTable.setWordWrap(False) + self.SelectedListTable.setCornerButtonEnabled(False) + self.SelectedListTable.setObjectName(u'SelectedListTable') + self.SelectedListTable.setColumnCount(2) + self.SelectedListTable.setRowCount(0) + item = QtGui.QTableWidgetItem() + self.SelectedListTable.setHorizontalHeaderItem(0, item) + item = QtGui.QTableWidgetItem() + self.SelectedListTable.setHorizontalHeaderItem(1, item) + self.verticalLayout_2.addWidget(self.SelectedListTable) + self.SelectedSelectAllWidget = QtGui.QWidget(self.SelectedFileListWidget) + self.SelectedSelectAllWidget.setObjectName(u'SelectedSelectAllWidget') + self.horizontalLayout_4 = QtGui.QHBoxLayout(self.SelectedSelectAllWidget) + self.horizontalLayout_4.setSpacing(6) + self.horizontalLayout_4.setMargin(0) + self.horizontalLayout_4.setObjectName(u'horizontalLayout_4') + self.SelectedSelectAllPushButton = QtGui.QPushButton(self.SelectedSelectAllWidget) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.SelectedSelectAllPushButton.sizePolicy().hasHeightForWidth()) + self.SelectedSelectAllPushButton.setSizePolicy(sizePolicy) + self.SelectedSelectAllPushButton.setMinimumSize(QtCore.QSize(100, 0)) + self.SelectedSelectAllPushButton.setIcon(icon2) + self.SelectedSelectAllPushButton.setObjectName(u'SelectedSelectAllPushButton') + self.horizontalLayout_4.addWidget(self.SelectedSelectAllPushButton) + spacerItem3 = QtGui.QSpacerItem(92, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) + self.horizontalLayout_4.addItem(spacerItem3) + self.verticalLayout_2.addWidget(self.SelectedSelectAllWidget) + self.SelectedRemoveSelectedWidget = QtGui.QWidget(self.SelectedFileListWidget) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.SelectedRemoveSelectedWidget.sizePolicy().hasHeightForWidth()) + self.SelectedRemoveSelectedWidget.setSizePolicy(sizePolicy) + self.SelectedRemoveSelectedWidget.setObjectName(u'SelectedRemoveSelectedWidget') + self.horizontalLayout_5 = QtGui.QHBoxLayout(self.SelectedRemoveSelectedWidget) + self.horizontalLayout_5.setMargin(0) + self.horizontalLayout_5.setObjectName(u'horizontalLayout_5') + self.SelectedRemoveSelectedButton = QtGui.QPushButton(self.SelectedRemoveSelectedWidget) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.SelectedRemoveSelectedButton.sizePolicy().hasHeightForWidth()) + self.SelectedRemoveSelectedButton.setSizePolicy(sizePolicy) + self.SelectedRemoveSelectedButton.setMinimumSize(QtCore.QSize(140, 0)) + icon4 = QtGui.QIcon() + icon4.addPixmap(QtGui.QPixmap(u':/imports/import_remove.png'), QtGui.QIcon.Normal, QtGui.QIcon.Off) + self.SelectedRemoveSelectedButton.setIcon(icon4) + self.SelectedRemoveSelectedButton.setObjectName(u'SelectedRemoveSelectedButton') + self.horizontalLayout_5.addWidget(self.SelectedRemoveSelectedButton) + spacerItem4 = QtGui.QSpacerItem(49, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) + self.horizontalLayout_5.addItem(spacerItem4) + self.verticalLayout_2.addWidget(self.SelectedRemoveSelectedWidget) + self.horizontalLayout_6.addWidget(self.SelectedFileListWidget) + self.verticalLayout_5.addWidget(self.SongListFrame) + self.ProgressGroupBox = QtGui.QGroupBox(OpenLPImportDialog) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.ProgressGroupBox.sizePolicy().hasHeightForWidth()) + self.ProgressGroupBox.setSizePolicy(sizePolicy) + self.ProgressGroupBox.setObjectName(u'ProgressGroupBox') + self.verticalLayout_4 = QtGui.QVBoxLayout(self.ProgressGroupBox) + self.verticalLayout_4.setSpacing(8) + self.verticalLayout_4.setContentsMargins(8, 0, 8, 8) + self.verticalLayout_4.setObjectName(u'verticalLayout_4') + self.ProgressLabel = QtGui.QLabel(self.ProgressGroupBox) + self.ProgressLabel.setObjectName(u'ProgressLabel') + self.verticalLayout_4.addWidget(self.ProgressLabel) + self.ProgressBar = QtGui.QProgressBar(self.ProgressGroupBox) + self.ProgressBar.setProperty(u'value', QtCore.QVariant(24)) + self.ProgressBar.setObjectName(u'ProgressBar') + self.verticalLayout_4.addWidget(self.ProgressBar) + self.verticalLayout_5.addWidget(self.ProgressGroupBox) + self.ButtonBarWidget = QtGui.QWidget(OpenLPImportDialog) + self.ButtonBarWidget.setObjectName(u'ButtonBarWidget') + self.horizontalLayout_7 = QtGui.QHBoxLayout(self.ButtonBarWidget) + self.horizontalLayout_7.setSpacing(8) + self.horizontalLayout_7.setMargin(0) + self.horizontalLayout_7.setObjectName(u'horizontalLayout_7') + spacerItem5 = QtGui.QSpacerItem(288, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) + self.horizontalLayout_7.addItem(spacerItem5) + self.ImportPushButton = QtGui.QPushButton(self.ButtonBarWidget) + self.ImportPushButton.setObjectName(u'ImportPushButton') + self.horizontalLayout_7.addWidget(self.ImportPushButton) + self.ClosePushButton = QtGui.QPushButton(self.ButtonBarWidget) + self.ClosePushButton.setObjectName(u'ClosePushButton') + self.horizontalLayout_7.addWidget(self.ClosePushButton) + self.verticalLayout_5.addWidget(self.ButtonBarWidget) + + self.retranslateUi(OpenLPImportDialog) + QtCore.QObject.connect(self.ClosePushButton, QtCore.SIGNAL(u'clicked()'), OpenLPImportDialog.close) + QtCore.QObject.connect(self.ImportSelectAllPushButton, QtCore.SIGNAL(u'clicked()'), self.ImportListTable.selectAll) + QtCore.QObject.connect(self.SelectedSelectAllPushButton, QtCore.SIGNAL(u'clicked()'), self.SelectedListTable.selectAll) + QtCore.QObject.connect(self.SelectedRemoveSelectedButton, QtCore.SIGNAL(u'clicked()'), self.SelectedListTable.clear) + QtCore.QMetaObject.connectSlotsByName(OpenLPImportDialog) + + def retranslateUi(self, OpenLPImportDialog): + OpenLPImportDialog.setWindowTitle(self.trUtf8(u'openlp.org Song Importer')) + self.ImportFileLabel.setText(self.trUtf8(u'Select openlp.org songfile to import:')) + self.ImportListLabel.setText(self.trUtf8(u'Import File Song List')) + self.ImportListTable.horizontalHeaderItem(0).setText(self.trUtf8(u'Song Title')) + self.ImportListTable.horizontalHeaderItem(1).setText(self.trUtf8(u'Author')) + self.ImportSelectAllPushButton.setText(self.trUtf8(u'Select All')) + self.ImportFilterComboBox.setItemText(0, self.trUtf8(u'Lyrics')) + self.ImportFilterComboBox.setItemText(1, self.trUtf8(u'Title')) + self.ImportFilterComboBox.setItemText(2, self.trUtf8(u'Author')) + self.SelectedListLabel.setText(self.trUtf8(u'Song Import List')) + self.SelectedListTable.horizontalHeaderItem(0).setText(self.trUtf8(u'Song Title')) + self.SelectedListTable.horizontalHeaderItem(1).setText(self.trUtf8(u'Author')) + self.SelectedSelectAllPushButton.setText(self.trUtf8(u'Select All')) + self.SelectedRemoveSelectedButton.setText(self.trUtf8(u'Remove Selected')) + self.ProgressGroupBox.setTitle(self.trUtf8(u'Progress:')) + self.ProgressLabel.setText(self.trUtf8(u'Ready to import')) + self.ImportPushButton.setText(self.trUtf8(u'Import')) + self.ClosePushButton.setText(self.trUtf8(u'Close')) + diff --git a/openlp/plugins/songs/forms/openlpimportform.py b/openlp/plugins/songs/forms/openlpimportform.py index 2e60982f9..e8cc92818 100644 --- a/openlp/plugins/songs/forms/openlpimportform.py +++ b/openlp/plugins/songs/forms/openlpimportform.py @@ -22,287 +22,11 @@ # Temple Place, Suite 330, Boston, MA 02111-1307 USA # ############################################################################### -from PyQt4 import QtCore, QtGui -from openlp.core.lib import translate, buildIcon +from PyQt4 import QtGui +from openlp.plugins.songs.forms.openlpimportdialog import Ui_OpenLPImportDialog -class OpenLPImportForm(object): +class OpenLPImportForm(QtGui.QDialog, Ui_OpenLPImportDialog): - def __init__(self): - self.OpenLPImportForm = QtGui.QWidget() - self.setupUi() - - def setupUi(self): - self.OpenLPImportForm.setObjectName(u'OpenLPImportForm') - self.OpenLPImportForm.resize(473, 459) - icon = buildIcon(u':/icon/openlp-logo-16x16.png') - self.OpenLPImportForm.setWindowIcon(icon) - self.verticalLayout_5 = QtGui.QVBoxLayout(self.OpenLPImportForm) - self.verticalLayout_5.setMargin(8) - self.verticalLayout_5.setObjectName(u'verticalLayout_5') - self.ImportFileWidget = QtGui.QWidget(self.OpenLPImportForm) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.ImportFileWidget.sizePolicy().hasHeightForWidth()) - self.ImportFileWidget.setSizePolicy(sizePolicy) - self.ImportFileWidget.setObjectName(u'ImportFileWidget') - self.horizontalLayout = QtGui.QHBoxLayout(self.ImportFileWidget) - self.horizontalLayout.setSpacing(3) - self.horizontalLayout.setMargin(0) - self.horizontalLayout.setObjectName(u'horizontalLayout') - self.ImportFileLabel = QtGui.QLabel(self.ImportFileWidget) - self.ImportFileLabel.setObjectName(u'ImportFileLabel') - self.horizontalLayout.addWidget(self.ImportFileLabel) - self.ImportFileLineEdit = QtGui.QLineEdit(self.ImportFileWidget) - self.ImportFileLineEdit.setObjectName(u'ImportFileLineEdit') - self.horizontalLayout.addWidget(self.ImportFileLineEdit) - self.ImportFileSelectPushButton = QtGui.QPushButton(self.ImportFileWidget) - icon1 = buildIcon(u':/imports/import_load.png') - self.ImportFileSelectPushButton.setIcon(icon1) - self.ImportFileSelectPushButton.setObjectName(u'ImportFileSelectPushButton') - self.horizontalLayout.addWidget(self.ImportFileSelectPushButton) - self.verticalLayout_5.addWidget(self.ImportFileWidget) - self.SongListFrame = QtGui.QFrame(self.OpenLPImportForm) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.SongListFrame.sizePolicy().hasHeightForWidth()) - self.SongListFrame.setSizePolicy(sizePolicy) - self.SongListFrame.setFrameShape(QtGui.QFrame.Box) - self.SongListFrame.setFrameShadow(QtGui.QFrame.Raised) - self.SongListFrame.setObjectName(u'SongListFrame') - self.horizontalLayout_6 = QtGui.QHBoxLayout(self.SongListFrame) - self.horizontalLayout_6.setSpacing(8) - self.horizontalLayout_6.setMargin(8) - self.horizontalLayout_6.setObjectName(u'horizontalLayout_6') - self.ImportFileSongListWidget = QtGui.QWidget(self.SongListFrame) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Expanding) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.ImportFileSongListWidget.sizePolicy().hasHeightForWidth()) - self.ImportFileSongListWidget.setSizePolicy(sizePolicy) - self.ImportFileSongListWidget.setObjectName(u'ImportFileSongListWidget') - self.verticalLayout = QtGui.QVBoxLayout(self.ImportFileSongListWidget) - self.verticalLayout.setSpacing(6) - self.verticalLayout.setMargin(0) - self.verticalLayout.setObjectName(u'verticalLayout') - self.ImportListLabel = QtGui.QLabel(self.ImportFileSongListWidget) - self.ImportListLabel.setObjectName(u'ImportListLabel') - self.verticalLayout.addWidget(self.ImportListLabel) - self.ImportListTable = QtGui.QTableWidget(self.ImportFileSongListWidget) - self.ImportListTable.setSelectionMode(QtGui.QAbstractItemView.MultiSelection) - self.ImportListTable.setShowGrid(False) - self.ImportListTable.setWordWrap(False) - self.ImportListTable.setCornerButtonEnabled(False) - self.ImportListTable.setObjectName(u'ImportListTable') - self.ImportListTable.setColumnCount(2) - self.ImportListTable.setRowCount(0) - item = QtGui.QTableWidgetItem() - self.ImportListTable.setHorizontalHeaderItem(0, item) - item = QtGui.QTableWidgetItem() - self.ImportListTable.setHorizontalHeaderItem(1, item) - self.verticalLayout.addWidget(self.ImportListTable) - self.ImportSelectAllWidget = QtGui.QWidget(self.ImportFileSongListWidget) - self.ImportSelectAllWidget.setObjectName(u'ImportSelectAllWidget') - self.horizontalLayout_2 = QtGui.QHBoxLayout(self.ImportSelectAllWidget) - self.horizontalLayout_2.setSpacing(6) - self.horizontalLayout_2.setMargin(0) - self.horizontalLayout_2.setObjectName(u'horizontalLayout_2') - self.ImportSelectAllPushButton = QtGui.QPushButton(self.ImportSelectAllWidget) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.ImportSelectAllPushButton.sizePolicy().hasHeightForWidth()) - self.ImportSelectAllPushButton.setSizePolicy(sizePolicy) - self.ImportSelectAllPushButton.setMinimumSize(QtCore.QSize(100, 0)) - icon2 = buildIcon(u':/imports/import_selectall.png') - self.ImportSelectAllPushButton.setIcon(icon2) - self.ImportSelectAllPushButton.setObjectName(u'ImportSelectAllPushButton') - self.horizontalLayout_2.addWidget(self.ImportSelectAllPushButton) - spacerItem = QtGui.QSpacerItem(89, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) - self.horizontalLayout_2.addItem(spacerItem) - self.verticalLayout.addWidget(self.ImportSelectAllWidget) - self.importFilterWidget = QtGui.QWidget(self.ImportFileSongListWidget) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.importFilterWidget.sizePolicy().hasHeightForWidth()) - self.importFilterWidget.setSizePolicy(sizePolicy) - self.importFilterWidget.setMinimumSize(QtCore.QSize(0, 0)) - self.importFilterWidget.setObjectName(u'importFilterWidget') - self.horizontalLayout_3 = QtGui.QHBoxLayout(self.importFilterWidget) - self.horizontalLayout_3.setMargin(0) - self.horizontalLayout_3.setObjectName(u'horizontalLayout_3') - self.ImportFilterComboBox = QtGui.QComboBox(self.importFilterWidget) - self.ImportFilterComboBox.setMinimumSize(QtCore.QSize(70, 0)) - self.ImportFilterComboBox.setObjectName(u'ImportFilterComboBox') - self.ImportFilterComboBox.addItem(QtCore.QString()) - self.ImportFilterComboBox.addItem(QtCore.QString()) - self.ImportFilterComboBox.addItem(QtCore.QString()) - self.horizontalLayout_3.addWidget(self.ImportFilterComboBox) - self.importFilterLineEdit = QtGui.QLineEdit(self.importFilterWidget) - self.importFilterLineEdit.setObjectName(u'importFilterLineEdit') - self.horizontalLayout_3.addWidget(self.importFilterLineEdit) - self.verticalLayout.addWidget(self.importFilterWidget) - self.horizontalLayout_6.addWidget(self.ImportFileSongListWidget) - self.AddSelectedWidget = QtGui.QWidget(self.SongListFrame) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Expanding) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.AddSelectedWidget.sizePolicy().hasHeightForWidth()) - self.AddSelectedWidget.setSizePolicy(sizePolicy) - self.AddSelectedWidget.setObjectName(u'AddSelectedWidget') - self.verticalLayout_3 = QtGui.QVBoxLayout(self.AddSelectedWidget) - self.verticalLayout_3.setMargin(0) - self.verticalLayout_3.setObjectName(u'verticalLayout_3') - spacerItem1 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) - self.verticalLayout_3.addItem(spacerItem1) - self.AddSelectedPushButton = QtGui.QPushButton(self.AddSelectedWidget) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.AddSelectedPushButton.sizePolicy().hasHeightForWidth()) - self.AddSelectedPushButton.setSizePolicy(sizePolicy) - self.AddSelectedPushButton.setMinimumSize(QtCore.QSize(25, 25)) - icon3 = buildIcon(u':/imports/import_move_to_list.png') - self.AddSelectedPushButton.setIcon(icon3) - self.AddSelectedPushButton.setObjectName(u'AddSelectedPushButton') - self.verticalLayout_3.addWidget(self.AddSelectedPushButton) - spacerItem2 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) - self.verticalLayout_3.addItem(spacerItem2) - self.horizontalLayout_6.addWidget(self.AddSelectedWidget) - self.SelectedFileListWidget = QtGui.QWidget(self.SongListFrame) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Expanding) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.SelectedFileListWidget.sizePolicy().hasHeightForWidth()) - self.SelectedFileListWidget.setSizePolicy(sizePolicy) - self.SelectedFileListWidget.setObjectName(u'SelectedFileListWidget') - self.verticalLayout_2 = QtGui.QVBoxLayout(self.SelectedFileListWidget) - self.verticalLayout_2.setMargin(0) - self.verticalLayout_2.setObjectName(u'verticalLayout_2') - self.SelectedListLabel = QtGui.QLabel(self.SelectedFileListWidget) - self.SelectedListLabel.setObjectName(u'SelectedListLabel') - self.verticalLayout_2.addWidget(self.SelectedListLabel) - self.SelectedListTable = QtGui.QTableWidget(self.SelectedFileListWidget) - self.SelectedListTable.setSelectionMode(QtGui.QAbstractItemView.MultiSelection) - self.SelectedListTable.setShowGrid(False) - self.SelectedListTable.setWordWrap(False) - self.SelectedListTable.setCornerButtonEnabled(False) - self.SelectedListTable.setObjectName(u'SelectedListTable') - self.SelectedListTable.setColumnCount(2) - self.SelectedListTable.setRowCount(0) - item = QtGui.QTableWidgetItem() - self.SelectedListTable.setHorizontalHeaderItem(0, item) - item = QtGui.QTableWidgetItem() - self.SelectedListTable.setHorizontalHeaderItem(1, item) - self.verticalLayout_2.addWidget(self.SelectedListTable) - self.SelectedSelectAllWidget = QtGui.QWidget(self.SelectedFileListWidget) - self.SelectedSelectAllWidget.setObjectName(u'SelectedSelectAllWidget') - self.horizontalLayout_4 = QtGui.QHBoxLayout(self.SelectedSelectAllWidget) - self.horizontalLayout_4.setSpacing(6) - self.horizontalLayout_4.setMargin(0) - self.horizontalLayout_4.setObjectName(u'horizontalLayout_4') - self.SelectedSelectAllPushButton = QtGui.QPushButton(self.SelectedSelectAllWidget) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.SelectedSelectAllPushButton.sizePolicy().hasHeightForWidth()) - self.SelectedSelectAllPushButton.setSizePolicy(sizePolicy) - self.SelectedSelectAllPushButton.setMinimumSize(QtCore.QSize(100, 0)) - self.SelectedSelectAllPushButton.setIcon(icon2) - self.SelectedSelectAllPushButton.setObjectName(u'SelectedSelectAllPushButton') - self.horizontalLayout_4.addWidget(self.SelectedSelectAllPushButton) - spacerItem3 = QtGui.QSpacerItem(92, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) - self.horizontalLayout_4.addItem(spacerItem3) - self.verticalLayout_2.addWidget(self.SelectedSelectAllWidget) - self.SelectedRemoveSelectedWidget = QtGui.QWidget(self.SelectedFileListWidget) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.SelectedRemoveSelectedWidget.sizePolicy().hasHeightForWidth()) - self.SelectedRemoveSelectedWidget.setSizePolicy(sizePolicy) - self.SelectedRemoveSelectedWidget.setObjectName(u'SelectedRemoveSelectedWidget') - self.horizontalLayout_5 = QtGui.QHBoxLayout(self.SelectedRemoveSelectedWidget) - self.horizontalLayout_5.setMargin(0) - self.horizontalLayout_5.setObjectName(u'horizontalLayout_5') - self.SelectedRemoveSelectedButton = QtGui.QPushButton(self.SelectedRemoveSelectedWidget) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.SelectedRemoveSelectedButton.sizePolicy().hasHeightForWidth()) - self.SelectedRemoveSelectedButton.setSizePolicy(sizePolicy) - self.SelectedRemoveSelectedButton.setMinimumSize(QtCore.QSize(140, 0)) - icon4 = buildIcon(u':/imports/import_remove.png') - self.SelectedRemoveSelectedButton.setIcon(icon4) - self.SelectedRemoveSelectedButton.setObjectName(u'SelectedRemoveSelectedButton') - self.horizontalLayout_5.addWidget(self.SelectedRemoveSelectedButton) - spacerItem4 = QtGui.QSpacerItem(49, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) - self.horizontalLayout_5.addItem(spacerItem4) - self.verticalLayout_2.addWidget(self.SelectedRemoveSelectedWidget) - self.horizontalLayout_6.addWidget(self.SelectedFileListWidget) - self.verticalLayout_5.addWidget(self.SongListFrame) - self.ProgressGroupBox = QtGui.QGroupBox(self.OpenLPImportForm) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.ProgressGroupBox.sizePolicy().hasHeightForWidth()) - self.ProgressGroupBox.setSizePolicy(sizePolicy) - self.ProgressGroupBox.setObjectName(u'ProgressGroupBox') - self.verticalLayout_4 = QtGui.QVBoxLayout(self.ProgressGroupBox) - self.verticalLayout_4.setSpacing(8) - self.verticalLayout_4.setContentsMargins(8, 0, 8, 8) - self.verticalLayout_4.setObjectName(u'verticalLayout_4') - self.ProgressLabel = QtGui.QLabel(self.ProgressGroupBox) - self.ProgressLabel.setObjectName(u'ProgressLabel') - self.verticalLayout_4.addWidget(self.ProgressLabel) - self.ProgressBar = QtGui.QProgressBar(self.ProgressGroupBox) - self.ProgressBar.setProperty(u'value', QtCore.QVariant(0)) - self.ProgressBar.setObjectName(u'ProgressBar') - self.verticalLayout_4.addWidget(self.ProgressBar) - self.verticalLayout_5.addWidget(self.ProgressGroupBox) - self.ButtonBarWidget = QtGui.QWidget(self.OpenLPImportForm) - self.ButtonBarWidget.setObjectName(u'ButtonBarWidget') - self.horizontalLayout_7 = QtGui.QHBoxLayout(self.ButtonBarWidget) - self.horizontalLayout_7.setSpacing(8) - self.horizontalLayout_7.setMargin(0) - self.horizontalLayout_7.setObjectName(u'horizontalLayout_7') - spacerItem5 = QtGui.QSpacerItem(288, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) - self.horizontalLayout_7.addItem(spacerItem5) - self.ImportPushButton = QtGui.QPushButton(self.ButtonBarWidget) - self.ImportPushButton.setObjectName(u'ImportPushButton') - self.horizontalLayout_7.addWidget(self.ImportPushButton) - self.ClosePushButton = QtGui.QPushButton(self.ButtonBarWidget) - self.ClosePushButton.setObjectName(u'ClosePushButton') - self.horizontalLayout_7.addWidget(self.ClosePushButton) - self.verticalLayout_5.addWidget(self.ButtonBarWidget) - - self.retranslateUi() - QtCore.QObject.connect(self.ClosePushButton, QtCore.SIGNAL(u'clicked()'), self.OpenLPImportForm.close) - QtCore.QObject.connect(self.ImportSelectAllPushButton, QtCore.SIGNAL(u'clicked()'), self.ImportListTable.selectAll) - QtCore.QObject.connect(self.SelectedSelectAllPushButton, QtCore.SIGNAL(u'clicked()'), self.SelectedListTable.selectAll) - QtCore.QObject.connect(self.SelectedRemoveSelectedButton, QtCore.SIGNAL(u'clicked()'), self.SelectedListTable.clear) - QtCore.QMetaObject.connectSlotsByName(self.OpenLPImportForm) - - def retranslateUi(self): - self.OpenLPImportForm.setWindowTitle(translate(u'OpenLPImportForm', u'openlp.org Song Importer')) - self.ImportFileLabel.setText(translate(u'OpenLPImportForm', u'Select openlp.org songfile to import:')) - self.ImportListLabel.setText(translate(u'OpenLPImportForm', u'Import File Song List')) - self.ImportListTable.horizontalHeaderItem(0).setText(translate(u'OpenLPImportForm', u'Song Title')) - self.ImportListTable.horizontalHeaderItem(1).setText(translate(u'OpenLPImportForm', u'Author')) - self.ImportSelectAllPushButton.setText(translate(u'OpenLPImportForm', u'Select All')) - self.ImportFilterComboBox.setItemText(0, translate(u'OpenLPImportForm', u'Lyrics')) - self.ImportFilterComboBox.setItemText(1, translate(u'OpenLPImportForm', u'Title')) - self.ImportFilterComboBox.setItemText(2, translate(u'OpenLPImportForm', u'Author')) - self.SelectedListLabel.setText(translate(u'OpenLPImportForm', u'Song Import List')) - self.SelectedListTable.horizontalHeaderItem(0).setText(translate(u'OpenLPImportForm', u'Song Title')) - self.SelectedListTable.horizontalHeaderItem(1).setText(translate(u'OpenLPImportForm', u'Author')) - self.SelectedSelectAllPushButton.setText(translate(u'OpenLPImportForm', u'Select All')) - self.SelectedRemoveSelectedButton.setText(translate(u'OpenLPImportForm', u'Remove Selected')) - self.ProgressGroupBox.setTitle(translate(u'OpenLPImportForm', u'Progress:')) - self.ProgressLabel.setText(translate(u'OpenLPImportForm', u'Ready to import')) - self.ImportPushButton.setText(translate(u'OpenLPImportForm', u'Import')) - self.ClosePushButton.setText(translate(u'OpenLPImportForm', u'Close')) - - def show(self): - self.OpenLPImportForm.show() + def __init__(self, parent=None): + QtGui.QDialog.__init__(self, parent) + self.setupUi(self) diff --git a/openlp/plugins/songs/forms/opensongexportdialog.py b/openlp/plugins/songs/forms/opensongexportdialog.py new file mode 100644 index 000000000..bfe775416 --- /dev/null +++ b/openlp/plugins/songs/forms/opensongexportdialog.py @@ -0,0 +1,305 @@ +# -*- coding: utf-8 -*- +# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 + +############################################################################### +# OpenLP - Open Source Lyrics Projection # +# --------------------------------------------------------------------------- # +# Copyright (c) 2008-2009 Raoul Snyman # +# Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley, Carsten # +# Tinggaard, Jon Tibble, Jonathan Corwin, Maikel Stuivenberg, Scott Guerrieri # +# --------------------------------------------------------------------------- # +# 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 # +############################################################################### + +from PyQt4 import QtCore, QtGui + +class Ui_OpenSongExportDialog(object): + def setupUi(self, OpenSongExportDialog): + OpenSongExportDialog.setObjectName(u'OpenSongExportDialog') + OpenSongExportDialog.resize(473, 459) + icon = QtGui.QIcon() + icon.addPixmap(QtGui.QPixmap(u':/icon/openlp.org-icon-32.bmp'), QtGui.QIcon.Normal, QtGui.QIcon.Off) + OpenSongExportDialog.setWindowIcon(icon) + self.verticalLayout_5 = QtGui.QVBoxLayout(OpenSongExportDialog) + self.verticalLayout_5.setMargin(8) + self.verticalLayout_5.setObjectName(u'verticalLayout_5') + self.ExportFileWidget = QtGui.QWidget(OpenSongExportDialog) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.ExportFileWidget.sizePolicy().hasHeightForWidth()) + self.ExportFileWidget.setSizePolicy(sizePolicy) + self.ExportFileWidget.setObjectName(u'ExportFileWidget') + self.horizontalLayout = QtGui.QHBoxLayout(self.ExportFileWidget) + self.horizontalLayout.setSpacing(3) + self.horizontalLayout.setMargin(0) + self.horizontalLayout.setObjectName(u'horizontalLayout') + self.ExportFileLabel = QtGui.QLabel(self.ExportFileWidget) + self.ExportFileLabel.setObjectName(u'ExportFileLabel') + self.horizontalLayout.addWidget(self.ExportFileLabel) + self.ExportFileLineEdit = QtGui.QLineEdit(self.ExportFileWidget) + self.ExportFileLineEdit.setObjectName(u'ExportFileLineEdit') + self.horizontalLayout.addWidget(self.ExportFileLineEdit) + self.ExportFileSelectPushButton = QtGui.QPushButton(self.ExportFileWidget) + icon1 = QtGui.QIcon() + icon1.addPixmap(QtGui.QPixmap(u':/exports/export_load.png'), QtGui.QIcon.Normal, QtGui.QIcon.Off) + self.ExportFileSelectPushButton.setIcon(icon1) + self.ExportFileSelectPushButton.setObjectName(u'ExportFileSelectPushButton') + self.horizontalLayout.addWidget(self.ExportFileSelectPushButton) + self.verticalLayout_5.addWidget(self.ExportFileWidget) + self.SongListFrame = QtGui.QFrame(OpenSongExportDialog) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.SongListFrame.sizePolicy().hasHeightForWidth()) + self.SongListFrame.setSizePolicy(sizePolicy) + self.SongListFrame.setFrameShape(QtGui.QFrame.Box) + self.SongListFrame.setFrameShadow(QtGui.QFrame.Raised) + self.SongListFrame.setObjectName(u'SongListFrame') + self.horizontalLayout_6 = QtGui.QHBoxLayout(self.SongListFrame) + self.horizontalLayout_6.setSpacing(8) + self.horizontalLayout_6.setMargin(8) + self.horizontalLayout_6.setObjectName(u'horizontalLayout_6') + self.ExportFileSongListWidget = QtGui.QWidget(self.SongListFrame) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Expanding) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.ExportFileSongListWidget.sizePolicy().hasHeightForWidth()) + self.ExportFileSongListWidget.setSizePolicy(sizePolicy) + self.ExportFileSongListWidget.setObjectName(u'ExportFileSongListWidget') + self.verticalLayout = QtGui.QVBoxLayout(self.ExportFileSongListWidget) + self.verticalLayout.setSpacing(6) + self.verticalLayout.setMargin(0) + self.verticalLayout.setObjectName(u'verticalLayout') + self.ExportListLabel = QtGui.QLabel(self.ExportFileSongListWidget) + self.ExportListLabel.setObjectName(u'ExportListLabel') + self.verticalLayout.addWidget(self.ExportListLabel) + self.ExportListTable = QtGui.QTableWidget(self.ExportFileSongListWidget) + self.ExportListTable.setSelectionMode(QtGui.QAbstractItemView.MultiSelection) + self.ExportListTable.setShowGrid(False) + self.ExportListTable.setWordWrap(False) + self.ExportListTable.setCornerButtonEnabled(False) + self.ExportListTable.setObjectName(u'ExportListTable') + self.ExportListTable.setColumnCount(2) + self.ExportListTable.setRowCount(0) + item = QtGui.QTableWidgetItem() + self.ExportListTable.setHorizontalHeaderItem(0, item) + item = QtGui.QTableWidgetItem() + self.ExportListTable.setHorizontalHeaderItem(1, item) + self.verticalLayout.addWidget(self.ExportListTable) + self.ExportSelectAllWidget = QtGui.QWidget(self.ExportFileSongListWidget) + self.ExportSelectAllWidget.setObjectName(u'ExportSelectAllWidget') + self.horizontalLayout_2 = QtGui.QHBoxLayout(self.ExportSelectAllWidget) + self.horizontalLayout_2.setSpacing(6) + self.horizontalLayout_2.setMargin(0) + self.horizontalLayout_2.setObjectName(u'horizontalLayout_2') + self.ExportSelectAllPushButton = QtGui.QPushButton(self.ExportSelectAllWidget) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.ExportSelectAllPushButton.sizePolicy().hasHeightForWidth()) + self.ExportSelectAllPushButton.setSizePolicy(sizePolicy) + self.ExportSelectAllPushButton.setMinimumSize(QtCore.QSize(100, 0)) + icon2 = QtGui.QIcon() + icon2.addPixmap(QtGui.QPixmap(u':/exports/export_selectall.png'), QtGui.QIcon.Normal, QtGui.QIcon.Off) + self.ExportSelectAllPushButton.setIcon(icon2) + self.ExportSelectAllPushButton.setObjectName(u'ExportSelectAllPushButton') + self.horizontalLayout_2.addWidget(self.ExportSelectAllPushButton) + spacerItem = QtGui.QSpacerItem(89, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) + self.horizontalLayout_2.addItem(spacerItem) + self.verticalLayout.addWidget(self.ExportSelectAllWidget) + self.exportFilterWidget = QtGui.QWidget(self.ExportFileSongListWidget) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.exportFilterWidget.sizePolicy().hasHeightForWidth()) + self.exportFilterWidget.setSizePolicy(sizePolicy) + self.exportFilterWidget.setMinimumSize(QtCore.QSize(0, 0)) + self.exportFilterWidget.setObjectName(u'exportFilterWidget') + self.horizontalLayout_3 = QtGui.QHBoxLayout(self.exportFilterWidget) + self.horizontalLayout_3.setMargin(0) + self.horizontalLayout_3.setObjectName(u'horizontalLayout_3') + self.ExportFilterComboBox = QtGui.QComboBox(self.exportFilterWidget) + self.ExportFilterComboBox.setMinimumSize(QtCore.QSize(70, 0)) + self.ExportFilterComboBox.setObjectName(u'ExportFilterComboBox') + self.ExportFilterComboBox.addItem(QtCore.QString()) + self.ExportFilterComboBox.addItem(QtCore.QString()) + self.ExportFilterComboBox.addItem(QtCore.QString()) + self.horizontalLayout_3.addWidget(self.ExportFilterComboBox) + self.ExportFilterLineEdit = QtGui.QLineEdit(self.exportFilterWidget) + self.ExportFilterLineEdit.setObjectName(u'ExportFilterLineEdit') + self.horizontalLayout_3.addWidget(self.ExportFilterLineEdit) + self.verticalLayout.addWidget(self.exportFilterWidget) + self.horizontalLayout_6.addWidget(self.ExportFileSongListWidget) + self.AddSelectedWidget = QtGui.QWidget(self.SongListFrame) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Expanding) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.AddSelectedWidget.sizePolicy().hasHeightForWidth()) + self.AddSelectedWidget.setSizePolicy(sizePolicy) + self.AddSelectedWidget.setObjectName(u'AddSelectedWidget') + self.verticalLayout_3 = QtGui.QVBoxLayout(self.AddSelectedWidget) + self.verticalLayout_3.setMargin(0) + self.verticalLayout_3.setObjectName(u'verticalLayout_3') + spacerItem1 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) + self.verticalLayout_3.addItem(spacerItem1) + self.AddSelectedPushButton = QtGui.QPushButton(self.AddSelectedWidget) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.AddSelectedPushButton.sizePolicy().hasHeightForWidth()) + self.AddSelectedPushButton.setSizePolicy(sizePolicy) + self.AddSelectedPushButton.setMinimumSize(QtCore.QSize(25, 25)) + icon3 = QtGui.QIcon() + icon3.addPixmap(QtGui.QPixmap(u':/exports/export_move_to_list.png'), QtGui.QIcon.Normal, QtGui.QIcon.Off) + self.AddSelectedPushButton.setIcon(icon3) + self.AddSelectedPushButton.setObjectName(u'AddSelectedPushButton') + self.verticalLayout_3.addWidget(self.AddSelectedPushButton) + spacerItem2 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) + self.verticalLayout_3.addItem(spacerItem2) + self.horizontalLayout_6.addWidget(self.AddSelectedWidget) + self.SelectedFileListWidget = QtGui.QWidget(self.SongListFrame) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Expanding) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.SelectedFileListWidget.sizePolicy().hasHeightForWidth()) + self.SelectedFileListWidget.setSizePolicy(sizePolicy) + self.SelectedFileListWidget.setObjectName(u'SelectedFileListWidget') + self.verticalLayout_2 = QtGui.QVBoxLayout(self.SelectedFileListWidget) + self.verticalLayout_2.setMargin(0) + self.verticalLayout_2.setObjectName(u'verticalLayout_2') + self.SelectedListLabel = QtGui.QLabel(self.SelectedFileListWidget) + self.SelectedListLabel.setObjectName(u'SelectedListLabel') + self.verticalLayout_2.addWidget(self.SelectedListLabel) + self.SelectedListTable = QtGui.QTableWidget(self.SelectedFileListWidget) + self.SelectedListTable.setSelectionMode(QtGui.QAbstractItemView.MultiSelection) + self.SelectedListTable.setShowGrid(False) + self.SelectedListTable.setWordWrap(False) + self.SelectedListTable.setCornerButtonEnabled(False) + self.SelectedListTable.setObjectName(u'SelectedListTable') + self.SelectedListTable.setColumnCount(2) + self.SelectedListTable.setRowCount(0) + item = QtGui.QTableWidgetItem() + self.SelectedListTable.setHorizontalHeaderItem(0, item) + item = QtGui.QTableWidgetItem() + self.SelectedListTable.setHorizontalHeaderItem(1, item) + self.verticalLayout_2.addWidget(self.SelectedListTable) + self.SelectedSelectAllWidget = QtGui.QWidget(self.SelectedFileListWidget) + self.SelectedSelectAllWidget.setObjectName(u'SelectedSelectAllWidget') + self.horizontalLayout_4 = QtGui.QHBoxLayout(self.SelectedSelectAllWidget) + self.horizontalLayout_4.setSpacing(6) + self.horizontalLayout_4.setMargin(0) + self.horizontalLayout_4.setObjectName(u'horizontalLayout_4') + self.SelectedSelectAllPushButton = QtGui.QPushButton(self.SelectedSelectAllWidget) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.SelectedSelectAllPushButton.sizePolicy().hasHeightForWidth()) + self.SelectedSelectAllPushButton.setSizePolicy(sizePolicy) + self.SelectedSelectAllPushButton.setMinimumSize(QtCore.QSize(100, 0)) + self.SelectedSelectAllPushButton.setIcon(icon2) + self.SelectedSelectAllPushButton.setObjectName(u'SelectedSelectAllPushButton') + self.horizontalLayout_4.addWidget(self.SelectedSelectAllPushButton) + spacerItem3 = QtGui.QSpacerItem(92, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) + self.horizontalLayout_4.addItem(spacerItem3) + self.verticalLayout_2.addWidget(self.SelectedSelectAllWidget) + self.SelectedRemoveSelectedWidget = QtGui.QWidget(self.SelectedFileListWidget) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.SelectedRemoveSelectedWidget.sizePolicy().hasHeightForWidth()) + self.SelectedRemoveSelectedWidget.setSizePolicy(sizePolicy) + self.SelectedRemoveSelectedWidget.setObjectName(u'SelectedRemoveSelectedWidget') + self.horizontalLayout_5 = QtGui.QHBoxLayout(self.SelectedRemoveSelectedWidget) + self.horizontalLayout_5.setMargin(0) + self.horizontalLayout_5.setObjectName(u'horizontalLayout_5') + self.SelectedRemoveSelectedButton = QtGui.QPushButton(self.SelectedRemoveSelectedWidget) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.SelectedRemoveSelectedButton.sizePolicy().hasHeightForWidth()) + self.SelectedRemoveSelectedButton.setSizePolicy(sizePolicy) + self.SelectedRemoveSelectedButton.setMinimumSize(QtCore.QSize(140, 0)) + icon4 = QtGui.QIcon() + icon4.addPixmap(QtGui.QPixmap(u':/exports/export_remove.png'), QtGui.QIcon.Normal, QtGui.QIcon.Off) + self.SelectedRemoveSelectedButton.setIcon(icon4) + self.SelectedRemoveSelectedButton.setObjectName(u'SelectedRemoveSelectedButton') + self.horizontalLayout_5.addWidget(self.SelectedRemoveSelectedButton) + spacerItem4 = QtGui.QSpacerItem(49, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) + self.horizontalLayout_5.addItem(spacerItem4) + self.verticalLayout_2.addWidget(self.SelectedRemoveSelectedWidget) + self.horizontalLayout_6.addWidget(self.SelectedFileListWidget) + self.verticalLayout_5.addWidget(self.SongListFrame) + self.ProgressGroupBox = QtGui.QGroupBox(OpenSongExportDialog) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.ProgressGroupBox.sizePolicy().hasHeightForWidth()) + self.ProgressGroupBox.setSizePolicy(sizePolicy) + self.ProgressGroupBox.setObjectName(u'ProgressGroupBox') + self.verticalLayout_4 = QtGui.QVBoxLayout(self.ProgressGroupBox) + self.verticalLayout_4.setSpacing(8) + self.verticalLayout_4.setContentsMargins(8, 0, 8, 8) + self.verticalLayout_4.setObjectName(u'verticalLayout_4') + self.ProgressLabel = QtGui.QLabel(self.ProgressGroupBox) + self.ProgressLabel.setObjectName(u'ProgressLabel') + self.verticalLayout_4.addWidget(self.ProgressLabel) + self.ProgressBar = QtGui.QProgressBar(self.ProgressGroupBox) + self.ProgressBar.setProperty(u'value', QtCore.QVariant(24)) + self.ProgressBar.setObjectName(u'ProgressBar') + self.verticalLayout_4.addWidget(self.ProgressBar) + self.verticalLayout_5.addWidget(self.ProgressGroupBox) + self.ButtonBarWidget = QtGui.QWidget(OpenSongExportDialog) + self.ButtonBarWidget.setObjectName(u'ButtonBarWidget') + self.horizontalLayout_7 = QtGui.QHBoxLayout(self.ButtonBarWidget) + self.horizontalLayout_7.setSpacing(8) + self.horizontalLayout_7.setMargin(0) + self.horizontalLayout_7.setObjectName(u'horizontalLayout_7') + spacerItem5 = QtGui.QSpacerItem(288, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) + self.horizontalLayout_7.addItem(spacerItem5) + self.ExportPushButton = QtGui.QPushButton(self.ButtonBarWidget) + self.ExportPushButton.setObjectName(u'ExportPushButton') + self.horizontalLayout_7.addWidget(self.ExportPushButton) + self.ClosePushButton = QtGui.QPushButton(self.ButtonBarWidget) + self.ClosePushButton.setObjectName(u'ClosePushButton') + self.horizontalLayout_7.addWidget(self.ClosePushButton) + self.verticalLayout_5.addWidget(self.ButtonBarWidget) + + self.retranslateUi(OpenSongExportDialog) + QtCore.QObject.connect(self.ClosePushButton, QtCore.SIGNAL(u'clicked()'), OpenSongExportDialog.close) + QtCore.QObject.connect(self.ExportSelectAllPushButton, QtCore.SIGNAL(u'clicked()'), self.ExportListTable.selectAll) + QtCore.QObject.connect(self.SelectedSelectAllPushButton, QtCore.SIGNAL(u'clicked()'), self.SelectedListTable.selectAll) + QtCore.QObject.connect(self.SelectedRemoveSelectedButton, QtCore.SIGNAL(u'clicked()'), self.SelectedListTable.clear) + QtCore.QMetaObject.connectSlotsByName(OpenSongExportDialog) + + def retranslateUi(self, OpenSongExportDialog): + OpenSongExportDialog.setWindowTitle(self.trUtf8(u'OpenSong Song Exporter')) + self.ExportFileLabel.setText(self.trUtf8(u'Select OpenSong song folder:')) + self.ExportListLabel.setText(self.trUtf8(u'Full Song List')) + self.ExportListTable.horizontalHeaderItem(0).setText(self.trUtf8(u'Song Title')) + self.ExportListTable.horizontalHeaderItem(1).setText(self.trUtf8(u'Author')) + self.ExportSelectAllPushButton.setText(self.trUtf8(u'Select All')) + self.ExportFilterComboBox.setItemText(0, self.trUtf8(u'Lyrics')) + self.ExportFilterComboBox.setItemText(1, self.trUtf8(u'Title')) + self.ExportFilterComboBox.setItemText(2, self.trUtf8(u'Author')) + self.SelectedListLabel.setText(self.trUtf8(u'Song Export List')) + self.SelectedListTable.horizontalHeaderItem(0).setText(self.trUtf8(u'Song Title')) + self.SelectedListTable.horizontalHeaderItem(1).setText(self.trUtf8(u'Author')) + self.SelectedSelectAllPushButton.setText(self.trUtf8(u'Select All')) + self.SelectedRemoveSelectedButton.setText(self.trUtf8(u'Remove Selected')) + self.ProgressGroupBox.setTitle(self.trUtf8(u'Progress:')) + self.ProgressLabel.setText(self.trUtf8(u'Ready to export')) + self.ExportPushButton.setText(self.trUtf8(u'Export')) + self.ClosePushButton.setText(self.trUtf8(u'Close')) + diff --git a/openlp/plugins/songs/forms/opensongexportform.py b/openlp/plugins/songs/forms/opensongexportform.py index 894764c32..b5246cf74 100644 --- a/openlp/plugins/songs/forms/opensongexportform.py +++ b/openlp/plugins/songs/forms/opensongexportform.py @@ -22,287 +22,12 @@ # Temple Place, Suite 330, Boston, MA 02111-1307 USA # ############################################################################### -from PyQt4 import QtCore, QtGui -from openlp.core.lib import translate, buildIcon +from PyQt4 import QtGui +from openlp.plugins.songs.forms.opensongexportdialog import Ui_OpenSongExportDialog -class OpenSongExportForm(object): +class OpenSongExportForm(QtGui.QDialog, Ui_OpenSongExportDialog): - def __init__(self): - self.OpenSongExportForm = QtGui.QWidget() - self.setupUi() + def __init__(self, parent=None): + QtGui.QDialog.__init__(self, parent) + self.setupUi(self) - def setupUi(self): - self.OpenSongExportForm.setObjectName(u'OpenSongExportForm') - self.OpenSongExportForm.resize(473, 459) - icon = buildIcon(u':/icon/openlp-logo-16x16.png') - self.OpenSongExportForm.setWindowIcon(icon) - self.verticalLayout_5 = QtGui.QVBoxLayout(self.OpenSongExportForm) - self.verticalLayout_5.setMargin(8) - self.verticalLayout_5.setObjectName(u'verticalLayout_5') - self.ExportFileWidget = QtGui.QWidget(self.OpenSongExportForm) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.ExportFileWidget.sizePolicy().hasHeightForWidth()) - self.ExportFileWidget.setSizePolicy(sizePolicy) - self.ExportFileWidget.setObjectName(u'ExportFileWidget') - self.horizontalLayout = QtGui.QHBoxLayout(self.ExportFileWidget) - self.horizontalLayout.setSpacing(3) - self.horizontalLayout.setMargin(0) - self.horizontalLayout.setObjectName(u'horizontalLayout') - self.ExportFileLabel = QtGui.QLabel(self.ExportFileWidget) - self.ExportFileLabel.setObjectName(u'ExportFileLabel') - self.horizontalLayout.addWidget(self.ExportFileLabel) - self.ExportFileLineEdit = QtGui.QLineEdit(self.ExportFileWidget) - self.ExportFileLineEdit.setObjectName(u'ExportFileLineEdit') - self.horizontalLayout.addWidget(self.ExportFileLineEdit) - self.ExportFileSelectPushButton = QtGui.QPushButton(self.ExportFileWidget) - icon1 = buildIcon(u':/exports/export_load.png') - self.ExportFileSelectPushButton.setIcon(icon1) - self.ExportFileSelectPushButton.setObjectName(u'ExportFileSelectPushButton') - self.horizontalLayout.addWidget(self.ExportFileSelectPushButton) - self.verticalLayout_5.addWidget(self.ExportFileWidget) - self.SongListFrame = QtGui.QFrame(self.OpenSongExportForm) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.SongListFrame.sizePolicy().hasHeightForWidth()) - self.SongListFrame.setSizePolicy(sizePolicy) - self.SongListFrame.setFrameShape(QtGui.QFrame.Box) - self.SongListFrame.setFrameShadow(QtGui.QFrame.Raised) - self.SongListFrame.setObjectName(u'SongListFrame') - self.horizontalLayout_6 = QtGui.QHBoxLayout(self.SongListFrame) - self.horizontalLayout_6.setSpacing(8) - self.horizontalLayout_6.setMargin(8) - self.horizontalLayout_6.setObjectName(u'horizontalLayout_6') - self.ExportFileSongListWidget = QtGui.QWidget(self.SongListFrame) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Expanding) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.ExportFileSongListWidget.sizePolicy().hasHeightForWidth()) - self.ExportFileSongListWidget.setSizePolicy(sizePolicy) - self.ExportFileSongListWidget.setObjectName(u'ExportFileSongListWidget') - self.verticalLayout = QtGui.QVBoxLayout(self.ExportFileSongListWidget) - self.verticalLayout.setSpacing(6) - self.verticalLayout.setMargin(0) - self.verticalLayout.setObjectName(u'verticalLayout') - self.ExportListLabel = QtGui.QLabel(self.ExportFileSongListWidget) - self.ExportListLabel.setObjectName(u'ExportListLabel') - self.verticalLayout.addWidget(self.ExportListLabel) - self.ExportListTable = QtGui.QTableWidget(self.ExportFileSongListWidget) - self.ExportListTable.setSelectionMode(QtGui.QAbstractItemView.MultiSelection) - self.ExportListTable.setShowGrid(False) - self.ExportListTable.setWordWrap(False) - self.ExportListTable.setCornerButtonEnabled(False) - self.ExportListTable.setObjectName(u'ExportListTable') - self.ExportListTable.setColumnCount(2) - self.ExportListTable.setRowCount(0) - item = QtGui.QTableWidgetItem() - self.ExportListTable.setHorizontalHeaderItem(0, item) - item = QtGui.QTableWidgetItem() - self.ExportListTable.setHorizontalHeaderItem(1, item) - self.verticalLayout.addWidget(self.ExportListTable) - self.ExportSelectAllWidget = QtGui.QWidget(self.ExportFileSongListWidget) - self.ExportSelectAllWidget.setObjectName(u'ExportSelectAllWidget') - self.horizontalLayout_2 = QtGui.QHBoxLayout(self.ExportSelectAllWidget) - self.horizontalLayout_2.setSpacing(6) - self.horizontalLayout_2.setMargin(0) - self.horizontalLayout_2.setObjectName(u'horizontalLayout_2') - self.ExportSelectAllPushButton = QtGui.QPushButton(self.ExportSelectAllWidget) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.ExportSelectAllPushButton.sizePolicy().hasHeightForWidth()) - self.ExportSelectAllPushButton.setSizePolicy(sizePolicy) - self.ExportSelectAllPushButton.setMinimumSize(QtCore.QSize(100, 0)) - icon2 = buildIcon(u':/exports/export_selectall.png') - self.ExportSelectAllPushButton.setIcon(icon2) - self.ExportSelectAllPushButton.setObjectName(u'ExportSelectAllPushButton') - self.horizontalLayout_2.addWidget(self.ExportSelectAllPushButton) - spacerItem = QtGui.QSpacerItem(89, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) - self.horizontalLayout_2.addItem(spacerItem) - self.verticalLayout.addWidget(self.ExportSelectAllWidget) - self.exportFilterWidget = QtGui.QWidget(self.ExportFileSongListWidget) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.exportFilterWidget.sizePolicy().hasHeightForWidth()) - self.exportFilterWidget.setSizePolicy(sizePolicy) - self.exportFilterWidget.setMinimumSize(QtCore.QSize(0, 0)) - self.exportFilterWidget.setObjectName(u'exportFilterWidget') - self.horizontalLayout_3 = QtGui.QHBoxLayout(self.exportFilterWidget) - self.horizontalLayout_3.setMargin(0) - self.horizontalLayout_3.setObjectName(u'horizontalLayout_3') - self.ExportFilterComboBox = QtGui.QComboBox(self.exportFilterWidget) - self.ExportFilterComboBox.setMinimumSize(QtCore.QSize(70, 0)) - self.ExportFilterComboBox.setObjectName(u'ExportFilterComboBox') - self.ExportFilterComboBox.addItem(QtCore.QString()) - self.ExportFilterComboBox.addItem(QtCore.QString()) - self.ExportFilterComboBox.addItem(QtCore.QString()) - self.horizontalLayout_3.addWidget(self.ExportFilterComboBox) - self.ExportFilterLineEdit = QtGui.QLineEdit(self.exportFilterWidget) - self.ExportFilterLineEdit.setObjectName(u'ExportFilterLineEdit') - self.horizontalLayout_3.addWidget(self.ExportFilterLineEdit) - self.verticalLayout.addWidget(self.exportFilterWidget) - self.horizontalLayout_6.addWidget(self.ExportFileSongListWidget) - self.AddSelectedWidget = QtGui.QWidget(self.SongListFrame) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Expanding) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.AddSelectedWidget.sizePolicy().hasHeightForWidth()) - self.AddSelectedWidget.setSizePolicy(sizePolicy) - self.AddSelectedWidget.setObjectName(u'AddSelectedWidget') - self.verticalLayout_3 = QtGui.QVBoxLayout(self.AddSelectedWidget) - self.verticalLayout_3.setMargin(0) - self.verticalLayout_3.setObjectName(u'verticalLayout_3') - spacerItem1 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) - self.verticalLayout_3.addItem(spacerItem1) - self.AddSelectedPushButton = QtGui.QPushButton(self.AddSelectedWidget) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.AddSelectedPushButton.sizePolicy().hasHeightForWidth()) - self.AddSelectedPushButton.setSizePolicy(sizePolicy) - self.AddSelectedPushButton.setMinimumSize(QtCore.QSize(25, 25)) - icon3 = buildIcon(u':/exports/export_move_to_list.png') - self.AddSelectedPushButton.setIcon(icon3) - self.AddSelectedPushButton.setObjectName(u'AddSelectedPushButton') - self.verticalLayout_3.addWidget(self.AddSelectedPushButton) - spacerItem2 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) - self.verticalLayout_3.addItem(spacerItem2) - self.horizontalLayout_6.addWidget(self.AddSelectedWidget) - self.SelectedFileListWidget = QtGui.QWidget(self.SongListFrame) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Expanding) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.SelectedFileListWidget.sizePolicy().hasHeightForWidth()) - self.SelectedFileListWidget.setSizePolicy(sizePolicy) - self.SelectedFileListWidget.setObjectName(u'SelectedFileListWidget') - self.verticalLayout_2 = QtGui.QVBoxLayout(self.SelectedFileListWidget) - self.verticalLayout_2.setMargin(0) - self.verticalLayout_2.setObjectName(u'verticalLayout_2') - self.SelectedListLabel = QtGui.QLabel(self.SelectedFileListWidget) - self.SelectedListLabel.setObjectName(u'SelectedListLabel') - self.verticalLayout_2.addWidget(self.SelectedListLabel) - self.SelectedListTable = QtGui.QTableWidget(self.SelectedFileListWidget) - self.SelectedListTable.setSelectionMode(QtGui.QAbstractItemView.MultiSelection) - self.SelectedListTable.setShowGrid(False) - self.SelectedListTable.setWordWrap(False) - self.SelectedListTable.setCornerButtonEnabled(False) - self.SelectedListTable.setObjectName(u'SelectedListTable') - self.SelectedListTable.setColumnCount(2) - self.SelectedListTable.setRowCount(0) - item = QtGui.QTableWidgetItem() - self.SelectedListTable.setHorizontalHeaderItem(0, item) - item = QtGui.QTableWidgetItem() - self.SelectedListTable.setHorizontalHeaderItem(1, item) - self.verticalLayout_2.addWidget(self.SelectedListTable) - self.SelectedSelectAllWidget = QtGui.QWidget(self.SelectedFileListWidget) - self.SelectedSelectAllWidget.setObjectName(u'SelectedSelectAllWidget') - self.horizontalLayout_4 = QtGui.QHBoxLayout(self.SelectedSelectAllWidget) - self.horizontalLayout_4.setSpacing(6) - self.horizontalLayout_4.setMargin(0) - self.horizontalLayout_4.setObjectName(u'horizontalLayout_4') - self.SelectedSelectAllPushButton = QtGui.QPushButton(self.SelectedSelectAllWidget) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.SelectedSelectAllPushButton.sizePolicy().hasHeightForWidth()) - self.SelectedSelectAllPushButton.setSizePolicy(sizePolicy) - self.SelectedSelectAllPushButton.setMinimumSize(QtCore.QSize(100, 0)) - self.SelectedSelectAllPushButton.setIcon(icon2) - self.SelectedSelectAllPushButton.setObjectName(u'SelectedSelectAllPushButton') - self.horizontalLayout_4.addWidget(self.SelectedSelectAllPushButton) - spacerItem3 = QtGui.QSpacerItem(92, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) - self.horizontalLayout_4.addItem(spacerItem3) - self.verticalLayout_2.addWidget(self.SelectedSelectAllWidget) - self.SelectedRemoveSelectedWidget = QtGui.QWidget(self.SelectedFileListWidget) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.SelectedRemoveSelectedWidget.sizePolicy().hasHeightForWidth()) - self.SelectedRemoveSelectedWidget.setSizePolicy(sizePolicy) - self.SelectedRemoveSelectedWidget.setObjectName(u'SelectedRemoveSelectedWidget') - self.horizontalLayout_5 = QtGui.QHBoxLayout(self.SelectedRemoveSelectedWidget) - self.horizontalLayout_5.setMargin(0) - self.horizontalLayout_5.setObjectName(u'horizontalLayout_5') - self.SelectedRemoveSelectedButton = QtGui.QPushButton(self.SelectedRemoveSelectedWidget) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.SelectedRemoveSelectedButton.sizePolicy().hasHeightForWidth()) - self.SelectedRemoveSelectedButton.setSizePolicy(sizePolicy) - self.SelectedRemoveSelectedButton.setMinimumSize(QtCore.QSize(140, 0)) - icon4 = buildIcon(u':/exports/export_remove.png') - self.SelectedRemoveSelectedButton.setIcon(icon4) - self.SelectedRemoveSelectedButton.setObjectName(u'SelectedRemoveSelectedButton') - self.horizontalLayout_5.addWidget(self.SelectedRemoveSelectedButton) - spacerItem4 = QtGui.QSpacerItem(49, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) - self.horizontalLayout_5.addItem(spacerItem4) - self.verticalLayout_2.addWidget(self.SelectedRemoveSelectedWidget) - self.horizontalLayout_6.addWidget(self.SelectedFileListWidget) - self.verticalLayout_5.addWidget(self.SongListFrame) - self.ProgressGroupBox = QtGui.QGroupBox(self.OpenSongExportForm) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.ProgressGroupBox.sizePolicy().hasHeightForWidth()) - self.ProgressGroupBox.setSizePolicy(sizePolicy) - self.ProgressGroupBox.setObjectName(u'ProgressGroupBox') - self.verticalLayout_4 = QtGui.QVBoxLayout(self.ProgressGroupBox) - self.verticalLayout_4.setSpacing(8) - self.verticalLayout_4.setContentsMargins(8, 0, 8, 8) - self.verticalLayout_4.setObjectName(u'verticalLayout_4') - self.ProgressLabel = QtGui.QLabel(self.ProgressGroupBox) - self.ProgressLabel.setObjectName(u'ProgressLabel') - self.verticalLayout_4.addWidget(self.ProgressLabel) - self.ProgressBar = QtGui.QProgressBar(self.ProgressGroupBox) - self.ProgressBar.setProperty(u'value', QtCore.QVariant(24)) - self.ProgressBar.setObjectName(u'ProgressBar') - self.verticalLayout_4.addWidget(self.ProgressBar) - self.verticalLayout_5.addWidget(self.ProgressGroupBox) - self.ButtonBarWidget = QtGui.QWidget(self.OpenSongExportForm) - self.ButtonBarWidget.setObjectName(u'ButtonBarWidget') - self.horizontalLayout_7 = QtGui.QHBoxLayout(self.ButtonBarWidget) - self.horizontalLayout_7.setSpacing(8) - self.horizontalLayout_7.setMargin(0) - self.horizontalLayout_7.setObjectName(u'horizontalLayout_7') - spacerItem5 = QtGui.QSpacerItem(288, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) - self.horizontalLayout_7.addItem(spacerItem5) - self.ExportPushButton = QtGui.QPushButton(self.ButtonBarWidget) - self.ExportPushButton.setObjectName(u'ExportPushButton') - self.horizontalLayout_7.addWidget(self.ExportPushButton) - self.ClosePushButton = QtGui.QPushButton(self.ButtonBarWidget) - self.ClosePushButton.setObjectName(u'ClosePushButton') - self.horizontalLayout_7.addWidget(self.ClosePushButton) - self.verticalLayout_5.addWidget(self.ButtonBarWidget) - - self.retranslateUi() - QtCore.QObject.connect(self.ClosePushButton, QtCore.SIGNAL(u'clicked()'), self.OpenSongExportForm.close) - QtCore.QObject.connect(self.ExportSelectAllPushButton, QtCore.SIGNAL(u'clicked()'), self.ExportListTable.selectAll) - QtCore.QObject.connect(self.SelectedSelectAllPushButton, QtCore.SIGNAL(u'clicked()'), self.SelectedListTable.selectAll) - QtCore.QObject.connect(self.SelectedRemoveSelectedButton, QtCore.SIGNAL(u'clicked()'), self.SelectedListTable.clear) - QtCore.QMetaObject.connectSlotsByName(self.OpenSongExportForm) - - def retranslateUi(self): - self.OpenSongExportForm.setWindowTitle(translate(u'OpenSongExportForm', u'OpenSong Song Exporter')) - self.ExportFileLabel.setText(translate(u'OpenSongExportForm', u'Select OpenSong song folder:')) - self.ExportListLabel.setText(translate(u'OpenSongExportForm', u'Full Song List')) - self.ExportListTable.horizontalHeaderItem(0).setText(translate(u'OpenSongExportForm', u'Song Title')) - self.ExportListTable.horizontalHeaderItem(1).setText(translate(u'OpenSongExportForm', u'Author')) - self.ExportSelectAllPushButton.setText(translate(u'OpenSongExportForm', u'Select All')) - self.ExportFilterComboBox.setItemText(0, translate(u'OpenSongExportForm', u'Lyrics')) - self.ExportFilterComboBox.setItemText(1, translate(u'OpenSongExportForm', u'Title')) - self.ExportFilterComboBox.setItemText(2, translate(u'OpenSongExportForm', u'Author')) - self.SelectedListLabel.setText(translate(u'OpenSongExportForm', u'Song Export List')) - self.SelectedListTable.horizontalHeaderItem(0).setText(translate(u'OpenSongExportForm', u'Song Title')) - self.SelectedListTable.horizontalHeaderItem(1).setText(translate(u'OpenSongExportForm', u'Author')) - self.SelectedSelectAllPushButton.setText(translate(u'OpenSongExportForm', u'Select All')) - self.SelectedRemoveSelectedButton.setText(translate(u'OpenSongExportForm', u'Remove Selected')) - self.ProgressGroupBox.setTitle(translate(u'OpenSongExportForm', u'Progress:')) - self.ProgressLabel.setText(translate(u'OpenSongExportForm', u'Ready to export')) - self.ExportPushButton.setText(translate(u'OpenSongExportForm', u'Export')) - self.ClosePushButton.setText(translate(u'OpenSongExportForm', u'Close')) - - def show(self): - self.OpenSongExportForm.show() diff --git a/openlp/plugins/songs/forms/opensongimportdialog.py b/openlp/plugins/songs/forms/opensongimportdialog.py new file mode 100644 index 000000000..f4ceb488c --- /dev/null +++ b/openlp/plugins/songs/forms/opensongimportdialog.py @@ -0,0 +1,108 @@ +# -*- coding: utf-8 -*- +# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 + +############################################################################### +# OpenLP - Open Source Lyrics Projection # +# --------------------------------------------------------------------------- # +# Copyright (c) 2008-2009 Raoul Snyman # +# Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley, Carsten # +# Tinggaard, Jon Tibble, Jonathan Corwin, Maikel Stuivenberg, Scott Guerrieri # +# --------------------------------------------------------------------------- # +# 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 # +############################################################################### + +from PyQt4 import QtCore, QtGui + +class Ui_OpenSongImportDialog(object): + def setupUi(self, OpenSongImportDialog): + OpenSongImportDialog.setObjectName(u'OpenSongImportDialog') + OpenSongImportDialog.resize(481, 172) + icon = QtGui.QIcon() + icon.addPixmap(QtGui.QPixmap(u':/icon/openlp.org-icon-32.bmp'), QtGui.QIcon.Normal, QtGui.QIcon.Off) + OpenSongImportDialog.setWindowIcon(icon) + self.verticalLayout = QtGui.QVBoxLayout(OpenSongImportDialog) + self.verticalLayout.setSpacing(6) + self.verticalLayout.setMargin(8) + self.verticalLayout.setObjectName(u'verticalLayout') + self.ImportFileWidget = QtGui.QWidget(OpenSongImportDialog) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.ImportFileWidget.sizePolicy().hasHeightForWidth()) + self.ImportFileWidget.setSizePolicy(sizePolicy) + self.ImportFileWidget.setObjectName(u'ImportFileWidget') + self.horizontalLayout = QtGui.QHBoxLayout(self.ImportFileWidget) + self.horizontalLayout.setSpacing(6) + self.horizontalLayout.setMargin(0) + self.horizontalLayout.setObjectName(u'horizontalLayout') + self.ImportFileLabel = QtGui.QLabel(self.ImportFileWidget) + self.ImportFileLabel.setObjectName(u'ImportFileLabel') + self.horizontalLayout.addWidget(self.ImportFileLabel) + self.ImportFileLineEdit = QtGui.QLineEdit(self.ImportFileWidget) + self.ImportFileLineEdit.setObjectName(u'ImportFileLineEdit') + self.horizontalLayout.addWidget(self.ImportFileLineEdit) + self.ImportFileSelectPushButton = QtGui.QPushButton(self.ImportFileWidget) + icon1 = QtGui.QIcon() + icon1.addPixmap(QtGui.QPixmap(u':/imports/import_load.png'), QtGui.QIcon.Normal, QtGui.QIcon.Off) + self.ImportFileSelectPushButton.setIcon(icon1) + self.ImportFileSelectPushButton.setObjectName(u'ImportFileSelectPushButton') + self.horizontalLayout.addWidget(self.ImportFileSelectPushButton) + self.verticalLayout.addWidget(self.ImportFileWidget) + self.ProgressGroupBox = QtGui.QGroupBox(OpenSongImportDialog) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.ProgressGroupBox.sizePolicy().hasHeightForWidth()) + self.ProgressGroupBox.setSizePolicy(sizePolicy) + self.ProgressGroupBox.setObjectName(u'ProgressGroupBox') + self.verticalLayout_4 = QtGui.QVBoxLayout(self.ProgressGroupBox) + self.verticalLayout_4.setSpacing(6) + self.verticalLayout_4.setContentsMargins(6, 0, 8, 8) + self.verticalLayout_4.setObjectName(u'verticalLayout_4') + self.ProgressLabel = QtGui.QLabel(self.ProgressGroupBox) + self.ProgressLabel.setObjectName(u'ProgressLabel') + self.verticalLayout_4.addWidget(self.ProgressLabel) + self.ProgressBar = QtGui.QProgressBar(self.ProgressGroupBox) + self.ProgressBar.setProperty(u'value', QtCore.QVariant(24)) + self.ProgressBar.setObjectName(u'ProgressBar') + self.verticalLayout_4.addWidget(self.ProgressBar) + self.verticalLayout.addWidget(self.ProgressGroupBox) + self.ButtonBarWidget = QtGui.QWidget(OpenSongImportDialog) + self.ButtonBarWidget.setObjectName(u'ButtonBarWidget') + self.horizontalLayout_7 = QtGui.QHBoxLayout(self.ButtonBarWidget) + self.horizontalLayout_7.setSpacing(8) + self.horizontalLayout_7.setMargin(0) + self.horizontalLayout_7.setObjectName(u'horizontalLayout_7') + spacerItem = QtGui.QSpacerItem(288, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) + self.horizontalLayout_7.addItem(spacerItem) + self.ImportPushButton = QtGui.QPushButton(self.ButtonBarWidget) + self.ImportPushButton.setObjectName(u'ImportPushButton') + self.horizontalLayout_7.addWidget(self.ImportPushButton) + self.ClosePushButton = QtGui.QPushButton(self.ButtonBarWidget) + self.ClosePushButton.setObjectName(u'ClosePushButton') + self.horizontalLayout_7.addWidget(self.ClosePushButton) + self.verticalLayout.addWidget(self.ButtonBarWidget) + + self.retranslateUi(OpenSongImportDialog) + QtCore.QObject.connect(self.ClosePushButton, QtCore.SIGNAL(u'clicked()'), OpenSongImportDialog.close) + QtCore.QMetaObject.connectSlotsByName(OpenSongImportDialog) + + def retranslateUi(self, OpenSongImportDialog): + OpenSongImportDialog.setWindowTitle(self.trUtf8(u'OpenSong Song Importer')) + self.ImportFileLabel.setText(self.trUtf8(u'OpenSong Folder:')) + self.ProgressGroupBox.setTitle(self.trUtf8(u'Progress:')) + self.ProgressLabel.setText(self.trUtf8(u'Ready to import')) + self.ImportPushButton.setText(self.trUtf8(u'Import')) + self.ClosePushButton.setText(self.trUtf8(u'Close')) + diff --git a/openlp/plugins/songs/forms/opensongimportform.py b/openlp/plugins/songs/forms/opensongimportform.py index 6411a7d21..ed617626a 100644 --- a/openlp/plugins/songs/forms/opensongimportform.py +++ b/openlp/plugins/songs/forms/opensongimportform.py @@ -22,93 +22,12 @@ # Temple Place, Suite 330, Boston, MA 02111-1307 USA # ############################################################################### -from PyQt4 import QtCore, QtGui -from openlp.core.lib import translate, buildIcon +from PyQt4 import QtGui +from openlp.plugins.songs.forms.opensongimportdialog import Ui_OpenSongImportDialog -class OpenSongImportForm(object): +class OpenSongImportForm(QtGui.QDialog, Ui_OpenSongImportDialog): - def __init__(self): - self.OpenSongImportForm = QtGui.QWidget() - self.setupUi() + def __init__(self, parent=None): + QtGui.QDialog.__init__(self, parent) + self.setupUi(self) - def setupUi(self): - self.OpenSongImportForm.setObjectName(u'OpenSongImportForm') - self.OpenSongImportForm.resize(481, 153) - icon = buildIcon(u':/icon/openlp-logo-16x16.png') - self.OpenSongImportForm.setWindowIcon(icon) - self.verticalLayout = QtGui.QVBoxLayout(self.OpenSongImportForm) - self.verticalLayout.setSpacing(6) - self.verticalLayout.setMargin(8) - self.verticalLayout.setObjectName(u'verticalLayout') - self.ImportFileWidget = QtGui.QWidget(self.OpenSongImportForm) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.ImportFileWidget.sizePolicy().hasHeightForWidth()) - self.ImportFileWidget.setSizePolicy(sizePolicy) - self.ImportFileWidget.setObjectName(u'ImportFileWidget') - self.horizontalLayout = QtGui.QHBoxLayout(self.ImportFileWidget) - self.horizontalLayout.setSpacing(6) - self.horizontalLayout.setMargin(0) - self.horizontalLayout.setObjectName(u'horizontalLayout') - self.ImportFileLabel = QtGui.QLabel(self.ImportFileWidget) - self.ImportFileLabel.setObjectName(u'ImportFileLabel') - self.horizontalLayout.addWidget(self.ImportFileLabel) - self.ImportFileLineEdit = QtGui.QLineEdit(self.ImportFileWidget) - self.ImportFileLineEdit.setObjectName(u'ImportFileLineEdit') - self.horizontalLayout.addWidget(self.ImportFileLineEdit) - self.ImportFileSelectPushButton = QtGui.QPushButton(self.ImportFileWidget) - icon1 = buildIcon(u':/imports/import_load.png') - self.ImportFileSelectPushButton.setIcon(icon1) - self.ImportFileSelectPushButton.setObjectName(u'ImportFileSelectPushButton') - self.horizontalLayout.addWidget(self.ImportFileSelectPushButton) - self.verticalLayout.addWidget(self.ImportFileWidget) - self.ProgressGroupBox = QtGui.QGroupBox(self.OpenSongImportForm) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.ProgressGroupBox.sizePolicy().hasHeightForWidth()) - self.ProgressGroupBox.setSizePolicy(sizePolicy) - self.ProgressGroupBox.setObjectName(u'ProgressGroupBox') - self.verticalLayout_4 = QtGui.QVBoxLayout(self.ProgressGroupBox) - self.verticalLayout_4.setSpacing(6) - self.verticalLayout_4.setContentsMargins(6, 0, 8, 8) - self.verticalLayout_4.setObjectName(u'verticalLayout_4') - self.ProgressLabel = QtGui.QLabel(self.ProgressGroupBox) - self.ProgressLabel.setObjectName(u'ProgressLabel') - self.verticalLayout_4.addWidget(self.ProgressLabel) - self.ProgressBar = QtGui.QProgressBar(self.ProgressGroupBox) - self.ProgressBar.setProperty(u'value', QtCore.QVariant(24)) - self.ProgressBar.setObjectName(u'ProgressBar') - self.verticalLayout_4.addWidget(self.ProgressBar) - self.verticalLayout.addWidget(self.ProgressGroupBox) - self.ButtonBarWidget = QtGui.QWidget(self.OpenSongImportForm) - self.ButtonBarWidget.setObjectName(u'ButtonBarWidget') - self.horizontalLayout_7 = QtGui.QHBoxLayout(self.ButtonBarWidget) - self.horizontalLayout_7.setSpacing(8) - self.horizontalLayout_7.setMargin(0) - self.horizontalLayout_7.setObjectName(u'horizontalLayout_7') - spacerItem = QtGui.QSpacerItem(288, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) - self.horizontalLayout_7.addItem(spacerItem) - self.ImportPushButton = QtGui.QPushButton(self.ButtonBarWidget) - self.ImportPushButton.setObjectName(u'ImportPushButton') - self.horizontalLayout_7.addWidget(self.ImportPushButton) - self.ClosePushButton = QtGui.QPushButton(self.ButtonBarWidget) - self.ClosePushButton.setObjectName(u'ClosePushButton') - self.horizontalLayout_7.addWidget(self.ClosePushButton) - self.verticalLayout.addWidget(self.ButtonBarWidget) - - self.retranslateUi() - QtCore.QObject.connect(self.ClosePushButton, QtCore.SIGNAL(u'clicked()'), self.OpenSongImportForm.close) - QtCore.QMetaObject.connectSlotsByName(self.OpenSongImportForm) - - def retranslateUi(self): - self.OpenSongImportForm.setWindowTitle(translate(u'OpenSongImportForm', u'OpenSong Song Importer')) - self.ImportFileLabel.setText(translate(u'OpenSongImportForm', u'OpenSong Folder:')) - self.ProgressGroupBox.setTitle(translate(u'OpenSongImportForm', u'Progress:')) - self.ProgressLabel.setText(translate(u'OpenSongImportForm', u'Ready to import')) - self.ImportPushButton.setText(translate(u'OpenSongImportForm', u'Import')) - self.ClosePushButton.setText(translate(u'OpenSongImportForm', u'Close')) - - def show(self): - self.OpenSongImportForm.show() diff --git a/openlp/plugins/songs/forms/songbookdialog.py b/openlp/plugins/songs/forms/songbookdialog.py index f9ace28a5..786a019b9 100644 --- a/openlp/plugins/songs/forms/songbookdialog.py +++ b/openlp/plugins/songs/forms/songbookdialog.py @@ -23,7 +23,6 @@ ############################################################################### from PyQt4 import QtCore, QtGui -from openlp.core.lib import translate class Ui_SongBookDialog(object): def setupUi(self, SongBookDialog): @@ -65,9 +64,6 @@ class Ui_SongBookDialog(object): QtCore.QMetaObject.connectSlotsByName(SongBookDialog) def retranslateUi(self, SongBookDialog): - SongBookDialog.setWindowTitle( - translate(u'SongBookDialog', u'Edit Book')) - self.NameLabel.setText( - translate(u'SongBookDialog', u'Name:')) - self.PublisherLabel.setText( - translate(u'SongBookDialog', u'Publisher:')) + SongBookDialog.setWindowTitle(self.trUtf8(u'Edit Book')) + self.NameLabel.setText(self.trUtf8(u'Name:')) + self.PublisherLabel.setText(self.trUtf8(u'Publisher:')) diff --git a/openlp/plugins/songs/forms/songbookform.py b/openlp/plugins/songs/forms/songbookform.py index bcc72d65a..4482e6d3a 100644 --- a/openlp/plugins/songs/forms/songbookform.py +++ b/openlp/plugins/songs/forms/songbookform.py @@ -24,7 +24,6 @@ from PyQt4 import QtGui -from openlp.core.lib import translate from openlp.plugins.songs.forms.songbookdialog import Ui_SongBookDialog class SongBookForm(QtGui.QDialog, Ui_SongBookDialog): @@ -47,9 +46,9 @@ class SongBookForm(QtGui.QDialog, Ui_SongBookDialog): def accept(self): if not self.NameEdit.text(): - QtGui.QMessageBox.critical(self, - translate(u'SongBookDialog', u'Error'), - translate(u'SongBookDialog', u'You need to type in a book name!'), + QtGui.QMessageBox.critical( + self, self.trUtf8(u'Error'), + self.trUtf8(u'You need to type in a book name!'), QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) self.NameEdit.setFocus() return False diff --git a/openlp/plugins/songs/forms/songmaintenancedialog.py b/openlp/plugins/songs/forms/songmaintenancedialog.py index 73921943d..f3ba1fce0 100644 --- a/openlp/plugins/songs/forms/songmaintenancedialog.py +++ b/openlp/plugins/songs/forms/songmaintenancedialog.py @@ -24,7 +24,7 @@ from PyQt4 import QtCore, QtGui -from openlp.core.lib import translate, buildIcon +from openlp.core.lib import buildIcon class Ui_SongMaintenanceDialog(object): def setupUi(self, SongMaintenanceDialog): @@ -207,30 +207,17 @@ class Ui_SongMaintenanceDialog(object): QtCore.QMetaObject.connectSlotsByName(SongMaintenanceDialog) def retranslateUi(self, SongMaintenanceDialog): - SongMaintenanceDialog.setWindowTitle( - translate(u'SongMaintenanceDialog', u'Song Maintenance')) - self.TypeListWidget.item(0).setText( - translate(u'SongMaintenanceDialog', u'Authors')) - self.TypeListWidget.item(1).setText( - translate(u'SongMaintenanceDialog', u'Topics')) - self.TypeListWidget.item(2).setText( - translate(u'SongMaintenanceDialog', u'Books/Hymnals')) - self.AuthorAddButton.setText( - translate(u'SongMaintenanceDialog', u'Add')) - self.AuthorEditButton.setText( - translate(u'SongMaintenanceDialog', u'Edit')) - self.AuthorDeleteButton.setText( - translate(u'SongMaintenanceDialog', u'Delete')) - self.TopicAddButton.setText( - translate(u'SongMaintenanceDialog', u'Add')) - self.TopicEditButton.setText( - translate(u'SongMaintenanceDialog', u'Edit')) - self.TopicDeleteButton.setText( - translate(u'SongMaintenanceDialog', u'Delete')) - self.BookAddButton.setText( - translate(u'SongMaintenanceDialog', u'Add')) - self.BookEditButton.setText( - translate(u'SongMaintenanceDialog', u'Edit')) - self.BookDeleteButton.setText( - translate(u'SongMaintenanceDialog', u'Delete')) + SongMaintenanceDialog.setWindowTitle(self.trUtf8(u'Song Maintenance')) + self.TypeListWidget.item(0).setText(self.trUtf8(u'Authors')) + self.TypeListWidget.item(1).setText(self.trUtf8(u'Topics')) + self.TypeListWidget.item(2).setText(self.trUtf8(u'Books/Hymnals')) + self.AuthorAddButton.setText(self.trUtf8(u'Add')) + self.AuthorEditButton.setText(self.trUtf8(u'Edit')) + self.AuthorDeleteButton.setText(self.trUtf8(u'Delete')) + self.TopicAddButton.setText(self.trUtf8(u'Add')) + self.TopicEditButton.setText(self.trUtf8(u'Edit')) + self.TopicDeleteButton.setText(self.trUtf8(u'Delete')) + self.BookAddButton.setText(self.trUtf8(u'Add')) + self.BookEditButton.setText(self.trUtf8(u'Edit')) + self.BookDeleteButton.setText(self.trUtf8(u'Delete')) diff --git a/openlp/plugins/songs/forms/songmaintenanceform.py b/openlp/plugins/songs/forms/songmaintenanceform.py index a319358cd..4c83b41e5 100644 --- a/openlp/plugins/songs/forms/songmaintenanceform.py +++ b/openlp/plugins/songs/forms/songmaintenanceform.py @@ -18,7 +18,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA """ from PyQt4 import QtGui, QtCore -from openlp.core.lib import translate + from openlp.plugins.songs.lib.classes import Author, Book, Topic from songmaintenancedialog import Ui_SongMaintenanceDialog from authorsform import AuthorsForm @@ -130,9 +130,9 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog): if self.songmanager.save_author(author): self.resetAuthors() else: - QtGui.QMessageBox.critical(self, - translate(u'SongMaintenanceForm', u'Error'), - translate(u'SongMaintenanceForm', u'Couldn\'t add your author!'), + QtGui.QMessageBox.critical( + self, self.trUtf8(u'Error'), + self.trUtf8(u'Couldn\'t add your author!'), QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) def onTopicAddButtonClick(self): @@ -141,9 +141,9 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog): if self.songmanager.save_topic(topic): self.resetTopics() else: - QtGui.QMessageBox.critical(self, - translate(u'SongMaintenanceForm', u'Error'), - translate(u'SongMaintenanceForm', u'Couldn\'t add your topic!'), + QtGui.QMessageBox.critical( + self, self.trUtf8(u'Error'), + self.trUtf8(u'Couldn\'t add your topic!'), QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) def onBookAddButtonClick(self): @@ -153,9 +153,9 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog): if self.songmanager.save_book(book): self.resetBooks() else: - QtGui.QMessageBox.critical(self, - translate(u'SongMaintenanceForm', u'Error'), - translate(u'SongMaintenanceForm', u'Couldn\'t add your book!'), + QtGui.QMessageBox.critical( + self, self.trUtf8(u'Error'), + self.trUtf8(u'Couldn\'t add your book!'), QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) def onAuthorEditButtonClick(self): @@ -173,9 +173,9 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog): if self.songmanager.save_author(author): self.resetAuthors() else: - QtGui.QMessageBox.critical(self, - translate(u'SongMaintenanceForm', u'Error'), - translate(u'SongMaintenanceForm', u'Couldn\'t save your author!'), + QtGui.QMessageBox.critical( + self, self.trUtf8(u'Error'), + self.trUtf8(u'Couldn\'t save your author!'), QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) def onTopicEditButtonClick(self): @@ -188,9 +188,9 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog): if self.songmanager.save_topic(topic): self.resetTopics() else: - QtGui.QMessageBox.critical(self, - translate(u'SongMaintenanceForm', u'Error'), - translate(u'SongMaintenanceForm', u'Couldn\'t save your topic!'), + QtGui.QMessageBox.critical( + self, self.trUtf8(u'Error'), + self.trUtf8(u'Couldn\'t save your topic!'), QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) def onBookEditButtonClick(self): @@ -205,40 +205,46 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog): if self.songmanager.save_book(book): self.resetBooks() else: - QtGui.QMessageBox.critical(self, - translate(u'SongMaintenanceForm', u'Error'), - translate(u'SongMaintenanceForm', u'Couldn\'t save your book!'), + QtGui.QMessageBox.critical( + self, self.trUtf8(u'Error'), + self.trUtf8(u'Couldn\'t save your book!'), QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) def onAuthorDeleteButtonClick(self): """ Delete the author if the author is not attached to any songs """ - self._deleteItem(self.AuthorsListWidget, self.songmanager.get_author, + self._deleteItem( + self.AuthorsListWidget, self.songmanager.get_author, self.songmanager.delete_author, self.resetAuthors, - translate(u'SongMaintenanceForm', u'Delete Author'), - translate(u'SongMaintenanceForm', u'Are you sure you want to delete the selected author?'), - translate(u'SongMaintenanceForm', u'This author can\'t be deleted, they are currently assigned to at least one song!'), - translate(u'SongMaintenanceForm', u'No author selected!')) + self.trUtf8(u'Delete Author'), + self.trUtf8(u'Are you sure you want to delete the selected author?'), + self.trUtf8(u'This author can\'t be deleted, they are currently ' + u'assigned to at least one song!'), + self.trUtf8(u'No author selected!')) def onTopicDeleteButtonClick(self): """ Delete the Book is the Book is not attached to any songs """ - self._deleteItem(self.TopicsListWidget, self.songmanager.get_topic, + self._deleteItem( + self.TopicsListWidget, self.songmanager.get_topic, self.songmanager.delete_topic, self.resetTopics, - translate(u'SongMaintenanceForm', u'Delete Topic'), - translate(u'SongMaintenanceForm', u'Are you sure you want to delete the selected topic?'), - translate(u'SongMaintenanceForm', u'This topic can\'t be deleted, it is currently assigned to at least one song!'), - translate(u'SongMaintenanceForm', u'No topic selected!')) + self.trUtf8(u'Delete Topic'), + self.trUtf8(u'Are you sure you want to delete the selected topic?'), + self.trUtf8(u'This topic can\'t be deleted, it is currently ' + u'assigned to at least one song!'), + self.trUtf8(u'No topic selected!')) def onBookDeleteButtonClick(self): """ Delete the Book is the Book is not attached to any songs """ - self._deleteItem(self.BooksListWidget, self.songmanager.get_book, + self._deleteItem( + self.BooksListWidget, self.songmanager.get_book, self.songmanager.delete_book, self.resetBooks, - translate(u'SongMaintenanceForm', u'Delete Book'), - translate(u'SongMaintenanceForm', u'Are you sure you want to delete the selected book?'), - translate(u'SongMaintenanceForm', u'This book can\'t be deleted, it is currently assigned to at least one song!'), - translate(u'SongMaintenanceForm', u'No book selected!')) + self.trUtf8(u'Delete Book'), + self.trUtf8(u'Are you sure you want to delete the selected book?'), + self.trUtf8(u'This book can\'t be deleted, it is currently ' + u'assigned to at least one song!'), + self.trUtf8(u'No book selected!')) diff --git a/openlp/plugins/songs/forms/topicsdialog.py b/openlp/plugins/songs/forms/topicsdialog.py index 5ada21dd4..9f4546b04 100644 --- a/openlp/plugins/songs/forms/topicsdialog.py +++ b/openlp/plugins/songs/forms/topicsdialog.py @@ -23,7 +23,6 @@ ############################################################################### from PyQt4 import QtCore, QtGui -from openlp.core.lib import translate class Ui_TopicsDialog(object): def setupUi(self, TopicsDialog): @@ -59,8 +58,6 @@ class Ui_TopicsDialog(object): QtCore.QMetaObject.connectSlotsByName(TopicsDialog) def retranslateUi(self, TopicsDialog): - TopicsDialog.setWindowTitle( - translate(u'TopicsDialog', u'Topic Maintenance')) - self.NameLabel.setText( - translate(u'TopicsDialog', u'Topic name:')) + TopicsDialog.setWindowTitle(self.trUtf8(u'Topic Maintenance')) + self.NameLabel.setText(self.trUtf8(u'Topic name:')) diff --git a/openlp/plugins/songs/forms/topicsform.py b/openlp/plugins/songs/forms/topicsform.py index 6598219bf..afa67c2db 100644 --- a/openlp/plugins/songs/forms/topicsform.py +++ b/openlp/plugins/songs/forms/topicsform.py @@ -24,7 +24,6 @@ from PyQt4 import QtGui -from openlp.core.lib import translate from openlp.plugins.songs.forms.topicsdialog import Ui_TopicsDialog class TopicsForm(QtGui.QDialog, Ui_TopicsDialog): @@ -46,9 +45,9 @@ class TopicsForm(QtGui.QDialog, Ui_TopicsDialog): def accept(self): if not self.NameEdit.text(): - QtGui.QMessageBox.critical(self, - translate(u'SongBookDialog', u'Error'), - translate(u'SongBookDialog', u'You need to type in a topic name!'), + QtGui.QMessageBox.critical( + self, self.trUtf8(u'Error'), + self.trUtf8(u'You need to type in a topic name!'), QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) self.NameEdit.setFocus() return False diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py index d30d36df4..575968f31 100644 --- a/openlp/plugins/songs/lib/mediaitem.py +++ b/openlp/plugins/songs/lib/mediaitem.py @@ -26,7 +26,7 @@ import logging from PyQt4 import QtCore, QtGui -from openlp.core.lib import MediaManagerItem, translate, SongXMLParser, \ +from openlp.core.lib import MediaManagerItem, SongXMLParser, \ BaseListWithDnD, Receiver, str_to_bool from openlp.plugins.songs.forms import EditSongForm, SongMaintenanceForm @@ -55,6 +55,7 @@ class SongMediaItem(MediaManagerItem): self.edit_song_form = EditSongForm(self.parent.songmanager, self) self.song_maintenance_form = SongMaintenanceForm( self.parent.songmanager, self) + self.fromPreview = None def requiredIcons(self): MediaManagerItem.requiredIcons(self) @@ -63,11 +64,11 @@ class SongMediaItem(MediaManagerItem): def addEndHeaderBar(self): self.addToolbarSeparator() ## Song Maintenance Button ## - self.addToolbarButton(translate(u'SongMediaItem', u'Song Maintenance'), - translate(u'SongMediaItem', - u'Maintain the lists of authors, topics and books'), + self.addToolbarButton(self.trUtf8(u'Song Maintenance'), + self.trUtf8(u'Maintain the lists of authors, topics and books'), ':/songs/song_maintenance.png', self.onSongMaintenanceClick, 'SongMaintenanceItem') + self.PageLayout.setSpacing(4) self.SearchLayout = QtGui.QFormLayout() self.SearchLayout.setMargin(0) self.SearchLayout.setSpacing(4) @@ -121,21 +122,25 @@ class SongMediaItem(MediaManagerItem): QtCore.SIGNAL(u'load_song_list'), self.onSearchTextButtonClick) QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'config_updated'), self.configUpdated) + QtCore.QObject.connect(Receiver.get_receiver(), + QtCore.SIGNAL(u'edit_song'), self.onEventEditSong) + QtCore.QObject.connect(Receiver.get_receiver(), + QtCore.SIGNAL(u'preview_song'), self.onPreviewClick) def configUpdated(self): self.searchAsYouType = str_to_bool( self.parent.config.get_config(u'search as type', u'False')) def retranslateUi(self): - self.SearchTextLabel.setText(translate(u'SongMediaItem', u'Search:')) - self.SearchTypeLabel.setText(translate(u'SongMediaItem', u'Type:')) - self.ClearTextButton.setText(translate(u'SongMediaItem', u'Clear')) - self.SearchTextButton.setText(translate(u'SongMediaItem', u'Search')) + self.SearchTextLabel.setText(self.trUtf8(u'Search:')) + self.SearchTypeLabel.setText(self.trUtf8(u'Type:')) + self.ClearTextButton.setText(self.trUtf8(u'Clear')) + self.SearchTextButton.setText(self.trUtf8(u'Search')) def initialise(self): - self.SearchTypeComboBox.addItem(translate(u'SongMediaItem', u'Titles')) - self.SearchTypeComboBox.addItem(translate(u'SongMediaItem', u'Lyrics')) - self.SearchTypeComboBox.addItem(translate(u'SongMediaItem', u'Authors')) + self.SearchTypeComboBox.addItem(self.trUtf8(u'Titles')) + self.SearchTypeComboBox.addItem(self.trUtf8(u'Lyrics')) + self.SearchTypeComboBox.addItem(self.trUtf8(u'Authors')) self.configUpdated() def onSearchTextButtonClick(self): @@ -168,19 +173,22 @@ class SongMediaItem(MediaManagerItem): if author_list != u'': author_list = author_list + u', ' author_list = author_list + author.display_name - song_detail = unicode(u'%s (%s)' % \ - (unicode(song.title), unicode(author_list))) + song_detail = unicode(self.trUtf8(u'%s (%s)' % \ + (unicode(song.title), unicode(author_list)))) song_name = QtGui.QListWidgetItem(song_detail) song_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(song.id)) self.ListView.addItem(song_name) + if song.id == self.fromPreview: + self.fromPreview = 0 + self.ListView.setCurrentItem(song_name) def displayResultsAuthor(self, searchresults): log.debug(u'display results Author') self.ListView.clear() for author in searchresults: for song in author.songs: - song_detail = unicode(u'%s (%s)' % \ - (unicode(author.display_name), unicode(song.title))) + song_detail = unicode(self.trUtf8(u'%s (%s)' % \ + (unicode(author.display_name), unicode(song.title)))) song_name = QtGui.QListWidgetItem(song_detail) song_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(song.id)) self.ListView.addItem(song_name) @@ -218,13 +226,19 @@ class SongMediaItem(MediaManagerItem): def onSongMaintenanceClick(self): self.song_maintenance_form.exec_() - def onEditClick(self): + def onEditClick(self, preview=False): item = self.ListView.currentItem() if item is not None: item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0] + self.fromPreview = 0 + if preview: + self.fromPreview = item_id self.edit_song_form.loadSong(item_id) self.edit_song_form.exec_() + def onEventEditSong (self): + self.onEditClick(True) + def onDeleteClick(self): item = self.ListView.currentItem() if item is not None: @@ -269,7 +283,7 @@ class SongMediaItem(MediaManagerItem): raw_footer.append(author_list) raw_footer.append(song.copyright ) raw_footer.append(unicode( - translate(u'SongMediaItem', u'CCL Licence: ') + ccl)) + self.trUtf8(u'CCL Licence: ') + ccl)) service_item.raw_footer = raw_footer service_item.audit = [song.title, author_audit, song.copyright, song.ccli_number] return True diff --git a/openlp/plugins/songs/lib/songstab.py b/openlp/plugins/songs/lib/songstab.py index 09ef75fab..d221e987d 100644 --- a/openlp/plugins/songs/lib/songstab.py +++ b/openlp/plugins/songs/lib/songstab.py @@ -24,14 +24,14 @@ from PyQt4 import QtCore, QtGui -from openlp.core.lib import SettingsTab, str_to_bool, translate +from openlp.core.lib import SettingsTab, str_to_bool class SongsTab(SettingsTab): """ SongsTab is the Songs settings tab in the settings dialog. """ def __init__(self): - SettingsTab.__init__(self, translate(u'SongsTab', u'Songs'), u'Songs') + SettingsTab.__init__(self, u'Songs', u'Songs') def setupUi(self): self.setObjectName(u'SongsTab') @@ -53,9 +53,8 @@ class SongsTab(SettingsTab): self.onSearchAsTypeCheckBoxChanged) def retranslateUi(self): - self.SongsModeGroupBox.setTitle(translate(u'SongsTab', u'Songs Mode')) - self.SearchAsTypeCheckBox.setText( - translate(u'SongsTab', u'Enable search as you type:')) + self.SongsModeGroupBox.setTitle(self.trUtf8(u'Songs Mode')) + self.SearchAsTypeCheckBox.setText(self.trUtf8(u'Enable search as you type:')) def onSearchAsTypeCheckBoxChanged(self, check_state): self.bible_search = False diff --git a/openlp/plugins/songs/songsplugin.py b/openlp/plugins/songs/songsplugin.py index 0e7848162..6b19b0276 100644 --- a/openlp/plugins/songs/songsplugin.py +++ b/openlp/plugins/songs/songsplugin.py @@ -26,7 +26,7 @@ import logging from PyQt4 import QtCore, QtGui -from openlp.core.lib import Plugin, translate, buildIcon +from openlp.core.lib import Plugin, buildIcon from openlp.plugins.songs.lib import SongManager, SongMediaItem, SongsTab from openlp.plugins.songs.forms import OpenLPImportForm, OpenSongExportForm, \ OpenSongImportForm, OpenLPExportForm @@ -112,19 +112,18 @@ class SongsPlugin(Plugin): self.ImportSongMenu.addAction(self.ImportOpenSongItem) import_menu.addAction(self.ImportSongMenu.menuAction()) # Translations... - self.ImportSongMenu.setTitle(translate(u'main_window', u'&Song')) - self.ImportOpenSongItem.setText(translate(u'main_window', u'OpenSong')) - self.ImportOpenlp1Item.setText( - translate(u'main_window', u'openlp.org 1.0')) + self.ImportSongMenu.setTitle(import_menu.trUtf8(u'&Song')) + self.ImportOpenSongItem.setText(import_menu.trUtf8(u'OpenSong')) + self.ImportOpenlp1Item.setText(import_menu.trUtf8(u'openlp.org 1.0')) self.ImportOpenlp1Item.setToolTip( - translate(u'main_window', u'Export songs in openlp.org 1.0 format')) + import_menu.trUtf8(u'Export songs in openlp.org 1.0 format')) self.ImportOpenlp1Item.setStatusTip( - translate(u'main_window', u'Export songs in openlp.org 1.0 format')) - self.ImportOpenlp2Item.setText(translate(u'main_window', u'OpenLP 2.0')) + import_menu.trUtf8(u'Export songs in openlp.org 1.0 format')) + self.ImportOpenlp2Item.setText(import_menu.trUtf8(u'OpenLP 2.0')) self.ImportOpenlp2Item.setToolTip( - translate(u'main_window', u'Export songs in OpenLP 2.0 format')) + import_menu.trUtf8(u'Export songs in OpenLP 2.0 format')) self.ImportOpenlp2Item.setStatusTip( - translate(u'main_window', u'Export songs in OpenLP 2.0 format')) + import_menu.trUtf8(u'Export songs in OpenLP 2.0 format')) # Signals and slots QtCore.QObject.connect(self.ImportOpenlp1Item, QtCore.SIGNAL(u'triggered()'), self.onImportOpenlp1ItemClick) @@ -157,11 +156,10 @@ class SongsPlugin(Plugin): self.ExportSongMenu.addAction(self.ExportOpenSongItem) export_menu.addAction(self.ExportSongMenu.menuAction()) # Translations... - self.ExportSongMenu.setTitle(translate(u'main_window', u'&Song')) - self.ExportOpenSongItem.setText(translate(u'main_window', u'OpenSong')) - self.ExportOpenlp1Item.setText( - translate(u'main_window', u'openlp.org 1.0')) - self.ExportOpenlp2Item.setText(translate(u'main_window', u'OpenLP 2.0')) + self.ExportSongMenu.setTitle(export_menu.trUtf8(u'&Song')) + self.ExportOpenSongItem.setText(export_menu.trUtf8(u'OpenSong')) + self.ExportOpenlp1Item.setText(export_menu.trUtf8(u'openlp.org 1.0')) + self.ExportOpenlp2Item.setText(export_menu.trUtf8(u'OpenLP 2.0')) # Signals and slots QtCore.QObject.connect(self.ExportOpenlp1Item, QtCore.SIGNAL(u'triggered()'), self.onExportOpenlp1ItemClicked) diff --git a/openlpcnv.pyw b/openlpcnv.pyw index 98e391f81..5dfe87061 100755 --- a/openlpcnv.pyw +++ b/openlpcnv.pyw @@ -26,17 +26,30 @@ import os import logging import time +import subprocess +import codecs + +if os.name == u'nt': + import win32api + import win32con + from win32com.client import Dispatch from openlp.migration.display import * from openlp.migration.migratefiles import * from openlp.migration.migratebibles import * from openlp.migration.migratesongs import * +############################################################################### +# For Windows, requires SQLite ODBC Driver to be installed +# (uses sqlite.exe and sqlite3.exe) +# http://www.ch-werner.de/sqliteodbc/ +############################################################################### + logging.basicConfig(level=logging.DEBUG, - format='%(asctime)s %(name)-12s %(levelname)-8s %(message)s', - datefmt='%m-%d %H:%M', - filename='openlp-migration.log', - filemode='w') + format=u'%(asctime)s %(name)-12s %(levelname)-8s %(message)s', + datefmt=u'%m-%d %H:%M', + filename=u'openlp-migration.log', + filemode=u'w') class Migration(object): """ @@ -62,15 +75,75 @@ class Migration(object): """ Move the log file to a new location. """ - fname = 'openlp-migration.log' + fname = u'openlp-migration.log' c = os.path.splitext(fname) b = (c[0]+'-'+ unicode(self.stime) + c[1]) - self.display.output(u'Logfile " +b + " generated') + self.display.output(u'Logfile ' + b + u' generated') self.display.output(u'Migration Utility Finished ') os.rename(fname, b) + def convert_file(self, inname, outname): + """ + Convert a file from another encoding into UTF-8. -if __name__ == '__main__': + ``inname`` + The name of the file to be opened and converted. + + ``outname`` + The output file name. + """ + infile = codecs.open(inname, u'r', encoding=u'CP1252') + writefile = codecs.open(outname, u'w', encoding=u'utf-8') + for line in infile: + writefile.write(line) + infile.close() + writefile.close() + + def convert_sqlite2_to_3(self, olddb, newdb): + if os.name == u'nt': + # we can't make this a raw unicode string as the \U within it causes much confusion + hKey = win32api.RegOpenKey(win32con.HKEY_LOCAL_MACHINE, u'SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\SQLite ODBC Driver') + value, type = win32api.RegQueryValueEx (hKey, u'UninstallString') + sqlitepath, temp = os.path.split(value) + sqliteexe = os.path.join(sqlitepath, u'sqlite.exe') + else: + sqliteexe = u'sqlite' + cmd = u'%s "%s" .dump' % (sqliteexe, olddb) + if os.name == u'nt': + subprocess.call(cmd, stdout=open(u'sqlite.dmp', u'w')) + else: + subprocess.call(cmd, stdout=open(u'sqlite.dmp', u'w'), shell=True) + self.convert_file(u'sqlite.dmp', u'sqlite3.dmp') + if os.name == u'nt': + sqlite3exe = os.path.join(sqlitepath, u'sqlite3.exe') + else: + sqlite3exe = u'sqlite3' + if os.path.isfile(newdb): + saveddb = newdb + self.stime + os.rename(newdb, saveddb) + cmd = '%s "%s"' % (sqlite3exe, newdb) + if os.name == u'nt': + subprocess.call(cmd, stdin=open(u'sqlite3.dmp', u'r')) + else: + subprocess.call(cmd, stdin=open(u'sqlite3.dmp', u'r'), shell=True) + os.remove(u'sqlite.dmp') + os.remove(u'sqlite3.dmp') + +if __name__ == u'__main__': mig = Migration() + config = PluginConfig(u'Songs') + newpath = config.get_data_path() + if os.name == u'nt': + if not os.path.isdir(newpath): + os.makedirs(newpath) + ALL_USERS_APPLICATION_DATA = 35 + shell = Dispatch(u'Shell.Application') + folder = shell.Namespace(ALL_USERS_APPLICATION_DATA) + folderitem = folder.Self + olddb = os.path.join(folderitem.path, u'openlp.org', u'Data', u'songs.olp') + else: + olddb = os.path.join(newpath, u'songs.olp') + newdb = os.path.join(newpath, u'songs.sqlite') + mig.convert_sqlite2_to_3(olddb, newdb) mig.process() #mig.move_log_file() diff --git a/resources/forms/about.ui b/resources/forms/about.ui index e632da5b3..a7d25750d 100644 --- a/resources/forms/about.ui +++ b/resources/forms/about.ui @@ -1,7 +1,8 @@ - + + AboutDialog - - + + 0 0 @@ -9,152 +10,165 @@ 481 - + About openlp.org - + :/icon/openlp.org-icon-32.bmp:/icon/openlp.org-icon-32.bmp - - + + 8 - + 8 - - + + false - - background-color: rgb(255, 255, 255); + + background-color: rgb(255, 255, 255); - + QFrame::StyledPanel - + 1 - + - - :/graphics/about-new.bmp + + :/graphics/about-new.bmp - + false - + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - + + 0 - - + + License - - + + 8 - + 8 - - + + Copyright © 2004-2008 openlp.org Foundation - - + + openlp.org is written and maintained by volunteers. If you would like to see more free Christian software being written, please consider contributing by using the button below. - + Qt::AlignJustify|Qt::AlignVCenter - + true - - + + 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; either version 2 of the License, or (at your option) any later version. - + Qt::AlignJustify|Qt::AlignVCenter - + true - - + + 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. - + Qt::AlignJustify|Qt::AlignVCenter - + true - - + + 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. - + Qt::AlignJustify|Qt::AlignVCenter - + true + + + + Qt::Vertical + + + + 20 + 40 + + + + - - + + Credits - - + + 0 - + 8 - - + + true - + Project Lead - Raoul "superfly" Snyman + Raoul "superfly" Snyman Developers - Tim "TRB143" Bentley - Jonathan "gushie" Corwin - Scott "sguerrieri" Guerrieri - Raoul "superfly" Snyman - Martin "mijiti" Thompson - Carsten "catini" Tingaard + Tim "TRB143" Bentley + Jonathan "gushie" Corwin + Scott "sguerrieri" Guerrieri + Raoul "superfly" Snyman + Martin "mijiti" Thompson + Carsten "catini" Tingaard @@ -163,20 +177,20 @@ Developers - - - + + + 8 - + 0 - - + + Qt::Horizontal - + 275 20 @@ -185,15 +199,15 @@ Developers - - + + Contribute - - + + Close @@ -202,8 +216,8 @@ Developers - - + + &Contribute @@ -212,7 +226,7 @@ Developers ContributeButton - + @@ -221,11 +235,11 @@ Developers AboutDialog close() - + 348 361 - + 196 189 @@ -233,19 +247,19 @@ Developers - + 10 - + 10 - + true - + true - + true diff --git a/resources/forms/amendthemedialog.ui b/resources/forms/amendthemedialog.ui index 84fa8b7bd..90ed34cc5 100644 --- a/resources/forms/amendthemedialog.ui +++ b/resources/forms/amendthemedialog.ui @@ -17,7 +17,7 @@ Theme Maintance - + :/icon/openlp.org-icon-32.bmp:/icon/openlp.org-icon-32.bmp @@ -64,7 +64,7 @@ - 0 + 2 @@ -312,15 +312,32 @@ 0 - - 16 - pt 999 + + 16 + + + + + + + Wrap Indentation + + + + + + + + + + TextLabel + @@ -425,15 +442,15 @@ 0 - - 0 - px 9999 + + 0 + @@ -609,15 +626,15 @@ 0 - - 10 - pt 999 + + 10 + @@ -728,15 +745,15 @@ 0 - - 0 - px 9999 + + 0 + @@ -753,15 +770,15 @@ 0 - - 0 - px 9999 + + 0 + diff --git a/resources/forms/openlpexportform.ui b/resources/forms/openlpexportform.ui index 4dc81d21c..2ccb86a0d 100644 --- a/resources/forms/openlpexportform.ui +++ b/resources/forms/openlpexportform.ui @@ -1,7 +1,8 @@ - - OpenLPExportForm - - + + + OpenLPExportDialog + + 0 0 @@ -9,49 +10,49 @@ 459 - + openlp.org Song Exporter - - + + :/icon/openlp.org-icon-32.bmp:/icon/openlp.org-icon-32.bmp - - + + 8 - - - + + + 0 0 - - + + 3 - + 0 - - + + Select openlp.org export filename: - + - - + + - - + + :/exports/export_load.png:/exports/export_load.png @@ -60,115 +61,115 @@ - - - + + + 0 0 - + QFrame::Box - + QFrame::Raised - - + + 8 - + 8 - - - + + + 0 0 - - + + 6 - + 0 - - + + Full Song List - - + + QAbstractItemView::MultiSelection - + false - + false - + false - + Song Title - + Author - - - + + + 6 - + 0 - - - + + + 0 0 - + 100 0 - + Select All - - + + :/exports/export_selectall.png:/exports/export_selectall.png - - + + Qt::Horizontal - + QSizePolicy::Expanding - + 89 20 @@ -180,50 +181,50 @@ - - - + + + 0 0 - + 0 0 - - + + 0 - - + + 70 0 - + Lyrics - + Title - + Author - + @@ -236,23 +237,23 @@ - - - + + + 0 0 - - + + 0 - - + + Qt::Vertical - + 20 40 @@ -261,34 +262,34 @@ - - - + + + 0 0 - + 25 25 - + - - + + :/exports/export_move_to_list.png:/exports/export_move_to_list.png - - + + Qt::Vertical - + 20 40 @@ -300,91 +301,91 @@ - - - + + + 0 0 - - + + 0 - - + + Song Export List - - + + QAbstractItemView::MultiSelection - + false - + false - + false - + Song Title - + Author - - - + + + 6 - + 0 - - - + + + 0 0 - + 100 0 - + Select All - - + + :/exports/export_selectall.png:/exports/export_selectall.png - - + + Qt::Horizontal - + QSizePolicy::Expanding - + 92 20 @@ -396,46 +397,46 @@ - - - + + + 0 0 - - + + 0 - - - + + + 0 0 - + 140 0 - + Remove Selected - - + + :/exports/export_remove.png:/exports/export_remove.png - - + + Qt::Horizontal - + 49 20 @@ -456,42 +457,42 @@ - - - + + + 0 0 - + Progress: - - + + 8 - + 8 - + 0 - + 8 - + 8 - - + + Ready to export - - + + 24 @@ -500,20 +501,20 @@ - - - + + + 8 - + 0 - - + + Qt::Horizontal - + 288 20 @@ -522,15 +523,15 @@ - - + + Export - - + + Close @@ -541,20 +542,20 @@ - + ClosePushButton clicked() - OpenLPExportForm + OpenLPExportDialog close() - + 436 436 - + 462 455 @@ -566,11 +567,11 @@ ExportListTable selectAll() - + 75 281 - + 88 176 @@ -582,11 +583,11 @@ SelectedListTable selectAll() - + 311 277 - + 339 190 @@ -598,11 +599,11 @@ SelectedListTable clear() - + 379 308 - + 389 188 diff --git a/resources/forms/openlpimportform.ui b/resources/forms/openlpimportform.ui index f033ad7a6..5d21b141c 100644 --- a/resources/forms/openlpimportform.ui +++ b/resources/forms/openlpimportform.ui @@ -1,7 +1,8 @@ - - OpenLPImportForm - - + + + OpenLPImportDialog + + 0 0 @@ -9,49 +10,49 @@ 459 - + openlp.org Song Importer - - + + :/icon/openlp.org-icon-32.bmp:/icon/openlp.org-icon-32.bmp - - + + 8 - - - + + + 0 0 - - + + 3 - + 0 - - + + Select openlp.org songfile to import: - + - - + + - - + + :/imports/import_load.png:/imports/import_load.png @@ -60,115 +61,115 @@ - - - + + + 0 0 - + QFrame::Box - + QFrame::Raised - - + + 8 - + 8 - - - + + + 0 0 - - + + 6 - + 0 - - + + Import File Song List - - + + QAbstractItemView::MultiSelection - + false - + false - + false - + Song Title - + Author - - - + + + 6 - + 0 - - - + + + 0 0 - + 100 0 - + Select All - - + + :/imports/import_selectall.png:/imports/import_selectall.png - - + + Qt::Horizontal - + QSizePolicy::Expanding - + 89 20 @@ -180,50 +181,50 @@ - - - + + + 0 0 - + 0 0 - - + + 0 - - + + 70 0 - + Lyrics - + Title - + Author - + @@ -236,23 +237,23 @@ - - - + + + 0 0 - - + + 0 - - + + Qt::Vertical - + 20 40 @@ -261,34 +262,34 @@ - - - + + + 0 0 - + 25 25 - + - - + + :/imports/import_move_to_list.png:/imports/import_move_to_list.png - - + + Qt::Vertical - + 20 40 @@ -300,91 +301,91 @@ - - - + + + 0 0 - - + + 0 - - + + Song Import List - - + + QAbstractItemView::MultiSelection - + false - + false - + false - + Song Title - + Author - - - + + + 6 - + 0 - - - + + + 0 0 - + 100 0 - + Select All - - + + :/imports/import_selectall.png:/imports/import_selectall.png - - + + Qt::Horizontal - + QSizePolicy::Expanding - + 92 20 @@ -396,46 +397,46 @@ - - - + + + 0 0 - - + + 0 - - - + + + 0 0 - + 140 0 - + Remove Selected - - + + :/imports/import_remove.png:/imports/import_remove.png - - + + Qt::Horizontal - + 49 20 @@ -456,42 +457,42 @@ - - - + + + 0 0 - + Progress: - - + + 8 - + 8 - + 0 - + 8 - + 8 - - + + Ready to import - - + + 24 @@ -500,20 +501,20 @@ - - - + + + 8 - + 0 - - + + Qt::Horizontal - + 288 20 @@ -522,15 +523,15 @@ - - + + Import - - + + Close @@ -541,20 +542,20 @@ - + ClosePushButton clicked() - OpenLPImportForm + OpenLPImportDialog close() - + 436 436 - + 462 455 @@ -566,11 +567,11 @@ ImportListTable selectAll() - + 75 281 - + 88 176 @@ -582,11 +583,11 @@ SelectedListTable selectAll() - + 311 277 - + 339 190 @@ -598,11 +599,11 @@ SelectedListTable clear() - + 379 308 - + 389 188 diff --git a/resources/forms/opensongexportform.ui b/resources/forms/opensongexportform.ui index 4263877ca..54f6bd9cd 100644 --- a/resources/forms/opensongexportform.ui +++ b/resources/forms/opensongexportform.ui @@ -1,7 +1,8 @@ - - OpenSongExportForm - - + + + OpenSongExportDialog + + 0 0 @@ -9,49 +10,49 @@ 459 - + OpenSong Song Exporter - - + + :/icon/openlp.org-icon-32.bmp:/icon/openlp.org-icon-32.bmp - - + + 8 - - - + + + 0 0 - - + + 3 - + 0 - - + + Select OpenSong song folder: - + - - + + - - + + :/exports/export_load.png:/exports/export_load.png @@ -60,115 +61,115 @@ - - - + + + 0 0 - + QFrame::Box - + QFrame::Raised - - + + 8 - + 8 - - - + + + 0 0 - - + + 6 - + 0 - - + + Full Song List - - + + QAbstractItemView::MultiSelection - + false - + false - + false - + Song Title - + Author - - - + + + 6 - + 0 - - - + + + 0 0 - + 100 0 - + Select All - - + + :/exports/export_selectall.png:/exports/export_selectall.png - - + + Qt::Horizontal - + QSizePolicy::Expanding - + 89 20 @@ -180,50 +181,50 @@ - - - + + + 0 0 - + 0 0 - - + + 0 - - + + 70 0 - + Lyrics - + Title - + Author - + @@ -236,23 +237,23 @@ - - - + + + 0 0 - - + + 0 - - + + Qt::Vertical - + 20 40 @@ -261,34 +262,34 @@ - - - + + + 0 0 - + 25 25 - + - - + + :/exports/export_move_to_list.png:/exports/export_move_to_list.png - - + + Qt::Vertical - + 20 40 @@ -300,91 +301,91 @@ - - - + + + 0 0 - - + + 0 - - + + Song Export List - - + + QAbstractItemView::MultiSelection - + false - + false - + false - + Song Title - + Author - - - + + + 6 - + 0 - - - + + + 0 0 - + 100 0 - + Select All - - + + :/exports/export_selectall.png:/exports/export_selectall.png - - + + Qt::Horizontal - + QSizePolicy::Expanding - + 92 20 @@ -396,46 +397,46 @@ - - - + + + 0 0 - - + + 0 - - - + + + 0 0 - + 140 0 - + Remove Selected - - + + :/exports/export_remove.png:/exports/export_remove.png - - + + Qt::Horizontal - + 49 20 @@ -456,42 +457,42 @@ - - - + + + 0 0 - + Progress: - - + + 8 - + 8 - + 0 - + 8 - + 8 - - + + Ready to export - - + + 24 @@ -500,20 +501,20 @@ - - - + + + 8 - + 0 - - + + Qt::Horizontal - + 288 20 @@ -522,15 +523,15 @@ - - + + Export - - + + Close @@ -541,20 +542,20 @@ - + ClosePushButton clicked() - OpenSongExportForm + OpenSongExportDialog close() - + 436 436 - + 462 455 @@ -566,11 +567,11 @@ ExportListTable selectAll() - + 75 281 - + 88 176 @@ -582,11 +583,11 @@ SelectedListTable selectAll() - + 311 277 - + 339 190 @@ -598,11 +599,11 @@ SelectedListTable clear() - + 379 308 - + 389 188 diff --git a/resources/forms/opensongimportform.ui b/resources/forms/opensongimportform.ui index b16d02ede..5e8a20fd6 100644 --- a/resources/forms/opensongimportform.ui +++ b/resources/forms/opensongimportform.ui @@ -1,60 +1,61 @@ - - OpenSongImportForm - - + + + OpenSongImportDialog + + 0 0 481 - 153 + 172 - + OpenSong Song Importer - - + + :/icon/openlp.org-icon-32.bmp:/icon/openlp.org-icon-32.bmp - - + + 6 - + 8 - - - + + + 0 0 - - + + 6 - + 0 - - + + OpenSong Folder: - + - - + + - - + + :/imports/import_load.png:/imports/import_load.png @@ -63,42 +64,42 @@ - - - + + + 0 0 - + Progress: - - + + 6 - + 6 - + 0 - + 8 - + 8 - - + + Ready to import - - + + 24 @@ -107,20 +108,20 @@ - - - + + + 8 - + 0 - - + + Qt::Horizontal - + 288 20 @@ -129,15 +130,15 @@ - - + + Import - - + + Close @@ -148,20 +149,20 @@ - + ClosePushButton clicked() - OpenSongImportForm + OpenSongImportDialog close() - + 424 132 - + 288 -25 diff --git a/songcnv.sh b/songcnv.sh deleted file mode 100755 index b7ef2a173..000000000 --- a/songcnv.sh +++ /dev/null @@ -1,5 +0,0 @@ -/usr/bin/sqlite ~/.local/share/openlp/songs/songs.olp .dump > ~/.local/share/openlp/songs/songs.dmp -./cnvdb.py ~/.local/share/openlp/songs/songs.dmp ~/.local/share/openlp/songs/songs.dmp2 -rm ~/.local/share/openlp/songs/songs.sqlite -sqlite3 ~/.local/share/openlp/songs/songs.sqlite < ~/.local/share/openlp/songs/songs.dmp2 -./openlpcnv.pyw