forked from openlp/openlp
Bible search fix
Edit and Delete feedback for Media Manager Items Fix Bible Import Wizard setField errors Fix addToServiceItem locations Remove unused scripts/get-strings.py bzr-revno: 850
This commit is contained in:
commit
1af5f700e2
@ -110,7 +110,6 @@ class MediaManagerItem(QtGui.QWidget):
|
|||||||
self.remoteTriggered = None
|
self.remoteTriggered = None
|
||||||
self.ServiceItemIconName = None
|
self.ServiceItemIconName = None
|
||||||
self.singleServiceItem = True
|
self.singleServiceItem = True
|
||||||
self.addToServiceItem = False
|
|
||||||
self.PageLayout = QtGui.QVBoxLayout(self)
|
self.PageLayout = QtGui.QVBoxLayout(self)
|
||||||
self.PageLayout.setSpacing(0)
|
self.PageLayout.setSpacing(0)
|
||||||
self.PageLayout.setContentsMargins(4, 0, 4, 0)
|
self.PageLayout.setContentsMargins(4, 0, 4, 0)
|
||||||
@ -133,6 +132,7 @@ class MediaManagerItem(QtGui.QWidget):
|
|||||||
self.hasEditIcon = True
|
self.hasEditIcon = True
|
||||||
self.hasFileIcon = False
|
self.hasFileIcon = False
|
||||||
self.hasDeleteIcon = True
|
self.hasDeleteIcon = True
|
||||||
|
self.addToServiceItem = False
|
||||||
|
|
||||||
def retranslateUi(self):
|
def retranslateUi(self):
|
||||||
"""
|
"""
|
||||||
@ -306,7 +306,8 @@ class MediaManagerItem(QtGui.QWidget):
|
|||||||
self.ListView.addAction(
|
self.ListView.addAction(
|
||||||
context_menu_action(
|
context_menu_action(
|
||||||
self.ListView, u':/general/general_live.png',
|
self.ListView, u':/general/general_live.png',
|
||||||
translate(u'MediaManagerItem', u'&Show Live'), self.onLiveClick))
|
translate(u'MediaManagerItem', u'&Show Live'),
|
||||||
|
self.onLiveClick))
|
||||||
self.ListView.addAction(
|
self.ListView.addAction(
|
||||||
context_menu_action(
|
context_menu_action(
|
||||||
self.ListView, u':/general/general_add.png',
|
self.ListView, u':/general/general_add.png',
|
||||||
@ -342,6 +343,19 @@ class MediaManagerItem(QtGui.QWidget):
|
|||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def checkItemSelected(self, message):
|
||||||
|
"""
|
||||||
|
Check if a list item is selected so an action may be performed on it
|
||||||
|
|
||||||
|
``message``
|
||||||
|
The message to give the user if no item is selected
|
||||||
|
"""
|
||||||
|
if not self.ListView.selectedIndexes():
|
||||||
|
QtGui.QMessageBox.information(self,
|
||||||
|
translate(u'MediaManagerItem', u'No Items Selected'), message)
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
def onFileClick(self):
|
def onFileClick(self):
|
||||||
files = QtGui.QFileDialog.getOpenFileNames(
|
files = QtGui.QFileDialog.getOpenFileNames(
|
||||||
self, self.OnNewPrompt,
|
self, self.OnNewPrompt,
|
||||||
@ -410,7 +424,7 @@ class MediaManagerItem(QtGui.QWidget):
|
|||||||
QtGui.QMessageBox.information(self,
|
QtGui.QMessageBox.information(self,
|
||||||
translate(u'MediaManagerItem', u'No Items Selected'),
|
translate(u'MediaManagerItem', u'No Items Selected'),
|
||||||
translate(u'MediaManagerItem',
|
translate(u'MediaManagerItem',
|
||||||
u'You must select one or more items.'))
|
u'You must select one or more items to preview.'))
|
||||||
else:
|
else:
|
||||||
log.debug(self.PluginNameShort + u' Preview requested')
|
log.debug(self.PluginNameShort + u' Preview requested')
|
||||||
service_item = self.buildServiceItem()
|
service_item = self.buildServiceItem()
|
||||||
@ -423,7 +437,7 @@ class MediaManagerItem(QtGui.QWidget):
|
|||||||
QtGui.QMessageBox.information(self,
|
QtGui.QMessageBox.information(self,
|
||||||
translate(u'MediaManagerItem', u'No Items Selected'),
|
translate(u'MediaManagerItem', u'No Items Selected'),
|
||||||
translate(u'MediaManagerItem',
|
translate(u'MediaManagerItem',
|
||||||
u'You must select one or more items.'))
|
u'You must select one or more items to send live.'))
|
||||||
else:
|
else:
|
||||||
log.debug(self.PluginNameShort + u' Live requested')
|
log.debug(self.PluginNameShort + u' Live requested')
|
||||||
service_item = self.buildServiceItem()
|
service_item = self.buildServiceItem()
|
||||||
|
@ -231,7 +231,8 @@ class Plugin(QtCore.QObject):
|
|||||||
Show a dialog when the user clicks on the 'About' button in the plugin
|
Show a dialog when the user clicks on the 'About' button in the plugin
|
||||||
manager.
|
manager.
|
||||||
"""
|
"""
|
||||||
pass
|
raise NotImplementedError(
|
||||||
|
u'Plugin.about needs to be defined by the plugin')
|
||||||
|
|
||||||
def initialise(self):
|
def initialise(self):
|
||||||
"""
|
"""
|
||||||
|
@ -303,17 +303,20 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard):
|
|||||||
self.setField(u'csv_versefile', QtCore.QVariant(''))
|
self.setField(u'csv_versefile', QtCore.QVariant(''))
|
||||||
self.setField(u'opensong_file', QtCore.QVariant(''))
|
self.setField(u'opensong_file', QtCore.QVariant(''))
|
||||||
self.setField(u'web_location', QtCore.QVariant(WebDownload.Crosswalk))
|
self.setField(u'web_location', QtCore.QVariant(WebDownload.Crosswalk))
|
||||||
self.setField(u'web_biblename', QtCore.QVariant(self.BibleComboBox))
|
self.setField(u'web_biblename',
|
||||||
|
QtCore.QVariant(self.BibleComboBox.currentIndex()))
|
||||||
self.setField(u'proxy_server',
|
self.setField(u'proxy_server',
|
||||||
settings.value(u'proxy address', QtCore.QVariant(u'')))
|
settings.value(u'proxy address', QtCore.QVariant(u'')))
|
||||||
self.setField(u'proxy_username',
|
self.setField(u'proxy_username',
|
||||||
settings.value(u'proxy username', QtCore.QVariant(u'')))
|
settings.value(u'proxy username', QtCore.QVariant(u'')))
|
||||||
self.setField(u'proxy_password',
|
self.setField(u'proxy_password',
|
||||||
settings.value(u'proxy password', QtCore.QVariant(u'')))
|
settings.value(u'proxy password', QtCore.QVariant(u'')))
|
||||||
self.setField(u'license_version', QtCore.QVariant(self.VersionNameEdit))
|
self.setField(u'license_version',
|
||||||
self.setField(u'license_copyright', QtCore.QVariant(self.CopyrightEdit))
|
QtCore.QVariant(self.VersionNameEdit.text()))
|
||||||
|
self.setField(u'license_copyright',
|
||||||
|
QtCore.QVariant(self.CopyrightEdit.text()))
|
||||||
self.setField(u'license_permission',
|
self.setField(u'license_permission',
|
||||||
QtCore.QVariant(self.PermissionEdit))
|
QtCore.QVariant(self.PermissionEdit.text()))
|
||||||
self.onLocationComboBoxChanged(WebDownload.Crosswalk)
|
self.onLocationComboBoxChanged(WebDownload.Crosswalk)
|
||||||
settings.endGroup()
|
settings.endGroup()
|
||||||
|
|
||||||
|
@ -29,8 +29,9 @@ import chardet
|
|||||||
import re
|
import re
|
||||||
|
|
||||||
from sqlalchemy import or_
|
from sqlalchemy import or_
|
||||||
from PyQt4 import QtCore
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
|
from openlp.core.lib import translate
|
||||||
from openlp.plugins.bibles.lib.models import *
|
from openlp.plugins.bibles.lib.models import *
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
@ -312,6 +313,14 @@ class BibleDB(QtCore.QObject):
|
|||||||
.order_by(Verse.verse)\
|
.order_by(Verse.verse)\
|
||||||
.all()
|
.all()
|
||||||
verse_list.extend(verses)
|
verse_list.extend(verses)
|
||||||
|
else:
|
||||||
|
log.debug(u'OpenLP failed to find book %s', book)
|
||||||
|
QtGui.QMessageBox.information(self.bible_plugin.media_item,
|
||||||
|
translate(u'BibleDB', u'Book not found'),
|
||||||
|
translate(u'BibleDB', u'The book you requested could not '
|
||||||
|
u'be found in this bible. Please check your spelling '
|
||||||
|
u'and that this is a complete bible not just one '
|
||||||
|
u'testament.'))
|
||||||
return verse_list
|
return verse_list
|
||||||
|
|
||||||
def verse_search(self, text):
|
def verse_search(self, text):
|
||||||
@ -383,4 +392,3 @@ class BibleDB(QtCore.QObject):
|
|||||||
log.debug(u'...............................Verses ')
|
log.debug(u'...............................Verses ')
|
||||||
verses = self.session.query(Verse).all()
|
verses = self.session.query(Verse).all()
|
||||||
log.debug(verses)
|
log.debug(verses)
|
||||||
|
|
||||||
|
@ -57,7 +57,6 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
self.IconPath = u'songs/song'
|
self.IconPath = u'songs/song'
|
||||||
self.ListViewWithDnD_class = BibleListView
|
self.ListViewWithDnD_class = BibleListView
|
||||||
self.lastReference = []
|
self.lastReference = []
|
||||||
self.addToServiceItem = True
|
|
||||||
MediaManagerItem.__init__(self, parent, icon, title)
|
MediaManagerItem.__init__(self, parent, icon, title)
|
||||||
# place to store the search results
|
# place to store the search results
|
||||||
self.search_results = {}
|
self.search_results = {}
|
||||||
|
@ -115,16 +115,24 @@ class CustomMediaItem(MediaManagerItem):
|
|||||||
self.parent.edit_custom_form.exec_()
|
self.parent.edit_custom_form.exec_()
|
||||||
|
|
||||||
def onEditClick(self):
|
def onEditClick(self):
|
||||||
|
"""
|
||||||
|
Edit a custom item
|
||||||
|
"""
|
||||||
|
if self.checkItemSelected(translate(u'CustomPlugin.MediaItem',
|
||||||
|
u'You must select an item to edit.')):
|
||||||
item = self.ListView.currentItem()
|
item = self.ListView.currentItem()
|
||||||
if item:
|
|
||||||
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
|
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
|
||||||
self.parent.edit_custom_form.loadCustom(item_id, False)
|
self.parent.edit_custom_form.loadCustom(item_id, False)
|
||||||
self.parent.edit_custom_form.exec_()
|
self.parent.edit_custom_form.exec_()
|
||||||
self.initialise()
|
self.initialise()
|
||||||
|
|
||||||
def onDeleteClick(self):
|
def onDeleteClick(self):
|
||||||
|
"""
|
||||||
|
Remove a custom item from the list and database
|
||||||
|
"""
|
||||||
|
if self.checkItemSelected(translate(u'CustomPlugin.MediaItem',
|
||||||
|
u'You must select an item to delete.')):
|
||||||
item = self.ListView.currentItem()
|
item = self.ListView.currentItem()
|
||||||
if item:
|
|
||||||
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
|
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
|
||||||
self.parent.custommanager.delete_custom(item_id)
|
self.parent.custommanager.delete_custom(item_id)
|
||||||
row = self.ListView.row(item)
|
row = self.ListView.row(item)
|
||||||
|
@ -54,7 +54,6 @@ class ImageMediaItem(MediaManagerItem):
|
|||||||
# be instanced by the base MediaManagerItem
|
# be instanced by the base MediaManagerItem
|
||||||
self.ListViewWithDnD_class = ImageListView
|
self.ListViewWithDnD_class = ImageListView
|
||||||
MediaManagerItem.__init__(self, parent, icon, title)
|
MediaManagerItem.__init__(self, parent, icon, title)
|
||||||
self.addToServiceItem = True
|
|
||||||
|
|
||||||
def initPluginNameVisible(self):
|
def initPluginNameVisible(self):
|
||||||
self.PluginNameVisible = translate(u'ImagePlugin.MediaItem', u'Image')
|
self.PluginNameVisible = translate(u'ImagePlugin.MediaItem', u'Image')
|
||||||
@ -74,6 +73,7 @@ class ImageMediaItem(MediaManagerItem):
|
|||||||
self.hasFileIcon = True
|
self.hasFileIcon = True
|
||||||
self.hasNewIcon = False
|
self.hasNewIcon = False
|
||||||
self.hasEditIcon = False
|
self.hasEditIcon = False
|
||||||
|
self.addToServiceItem = True
|
||||||
|
|
||||||
def initialise(self):
|
def initialise(self):
|
||||||
log.debug(u'initialise')
|
log.debug(u'initialise')
|
||||||
@ -116,14 +116,18 @@ class ImageMediaItem(MediaManagerItem):
|
|||||||
self.PageLayout.addWidget(self.ImageWidget)
|
self.PageLayout.addWidget(self.ImageWidget)
|
||||||
|
|
||||||
def onDeleteClick(self):
|
def onDeleteClick(self):
|
||||||
|
"""
|
||||||
|
Remove an image item from the list
|
||||||
|
"""
|
||||||
|
if self.checkItemSelected(translate(u'ImagePlugin.MediaItem',
|
||||||
|
u'You must select an item to delete.')):
|
||||||
items = self.ListView.selectedIndexes()
|
items = self.ListView.selectedIndexes()
|
||||||
if items:
|
|
||||||
for item in items:
|
for item in items:
|
||||||
text = self.ListView.item(item.row())
|
text = self.ListView.item(item.row())
|
||||||
if text:
|
if text:
|
||||||
try:
|
try:
|
||||||
os.remove(
|
os.remove(os.path.join(self.servicePath,
|
||||||
os.path.join(self.servicePath, unicode(text.text())))
|
unicode(text.text())))
|
||||||
except OSError:
|
except OSError:
|
||||||
#if not present do not worry
|
#if not present do not worry
|
||||||
pass
|
pass
|
||||||
|
@ -137,8 +137,12 @@ class MediaMediaItem(MediaManagerItem):
|
|||||||
self.settingsSection))
|
self.settingsSection))
|
||||||
|
|
||||||
def onDeleteClick(self):
|
def onDeleteClick(self):
|
||||||
|
"""
|
||||||
|
Remove a media item from the list
|
||||||
|
"""
|
||||||
|
if self.checkItemSelected(translate(u'MediaPlugin.MediaItem',
|
||||||
|
u'You must select an item to delete.')):
|
||||||
item = self.ListView.currentItem()
|
item = self.ListView.currentItem()
|
||||||
if item:
|
|
||||||
row = self.ListView.row(item)
|
row = self.ListView.row(item)
|
||||||
self.ListView.takeItem(row)
|
self.ListView.takeItem(row)
|
||||||
SettingsManager.set_list(self.settingsSection,
|
SettingsManager.set_list(self.settingsSection,
|
||||||
@ -152,4 +156,3 @@ class MediaMediaItem(MediaManagerItem):
|
|||||||
item_name.setIcon(build_icon(img))
|
item_name.setIcon(build_icon(img))
|
||||||
item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(file))
|
item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(file))
|
||||||
self.ListView.addItem(item_name)
|
self.ListView.addItem(item_name)
|
||||||
|
|
||||||
|
@ -174,8 +174,12 @@ class PresentationMediaItem(MediaManagerItem):
|
|||||||
self.ListView.addItem(item_name)
|
self.ListView.addItem(item_name)
|
||||||
|
|
||||||
def onDeleteClick(self):
|
def onDeleteClick(self):
|
||||||
|
"""
|
||||||
|
Remove a presentation item from the list
|
||||||
|
"""
|
||||||
|
if self.checkItemSelected(translate(u'PresentationPlugin.MediaItem',
|
||||||
|
u'You must select an item to delete.')):
|
||||||
item = self.ListView.currentItem()
|
item = self.ListView.currentItem()
|
||||||
if item:
|
|
||||||
row = self.ListView.row(item)
|
row = self.ListView.row(item)
|
||||||
self.ListView.takeItem(row)
|
self.ListView.takeItem(row)
|
||||||
SettingsManager.set_list(self.settingsSection,
|
SettingsManager.set_list(self.settingsSection,
|
||||||
|
@ -275,15 +275,23 @@ class SongMediaItem(MediaManagerItem):
|
|||||||
self.edit_song_form.exec_()
|
self.edit_song_form.exec_()
|
||||||
|
|
||||||
def onEditClick(self):
|
def onEditClick(self):
|
||||||
|
"""
|
||||||
|
Edit a song
|
||||||
|
"""
|
||||||
|
if self.checkItemSelected(translate(u'SongsPlugin.MediaItem',
|
||||||
|
u'You must select an item to edit.')):
|
||||||
item = self.ListView.currentItem()
|
item = self.ListView.currentItem()
|
||||||
if item:
|
|
||||||
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
|
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
|
||||||
self.edit_song_form.loadSong(item_id, False)
|
self.edit_song_form.loadSong(item_id, False)
|
||||||
self.edit_song_form.exec_()
|
self.edit_song_form.exec_()
|
||||||
|
|
||||||
def onDeleteClick(self):
|
def onDeleteClick(self):
|
||||||
|
"""
|
||||||
|
Remove a song from the list and database
|
||||||
|
"""
|
||||||
|
if self.checkItemSelected(translate(u'SongsPlugin.MediaItem',
|
||||||
|
u'You must select an item to delete.')):
|
||||||
items = self.ListView.selectedIndexes()
|
items = self.ListView.selectedIndexes()
|
||||||
if items:
|
|
||||||
if len(items) == 1:
|
if len(items) == 1:
|
||||||
del_message = translate(u'SongsPlugin.MediaItem',
|
del_message = translate(u'SongsPlugin.MediaItem',
|
||||||
u'Delete song?')
|
u'Delete song?')
|
||||||
@ -371,4 +379,3 @@ class SongMediaItem(MediaManagerItem):
|
|||||||
song.title, author_audit, song.copyright, song.ccli_number
|
song.title, author_audit, song.copyright, song.ccli_number
|
||||||
]
|
]
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@ -1,116 +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-2010 Raoul Snyman #
|
|
||||||
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
|
|
||||||
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
|
|
||||||
# Thompson, Jon Tibble, Carsten Tinggaard #
|
|
||||||
# --------------------------------------------------------------------------- #
|
|
||||||
# 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
|
|
||||||
from cgi import escape
|
|
||||||
from ast import parse, NodeVisitor, Str
|
|
||||||
|
|
||||||
ts_file = u"""<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!DOCTYPE TS>
|
|
||||||
<TS version="1.1">
|
|
||||||
%s
|
|
||||||
</TS>
|
|
||||||
"""
|
|
||||||
ts_context = u""" <context>
|
|
||||||
<name>%s</name>
|
|
||||||
%s </context>
|
|
||||||
"""
|
|
||||||
ts_message = u""" <message>
|
|
||||||
<location filename="%s" line="%d"/>
|
|
||||||
<source>%s</source>
|
|
||||||
<translation type="unfinished"></translation>
|
|
||||||
</message>
|
|
||||||
"""
|
|
||||||
|
|
||||||
class StringExtractor(NodeVisitor):
|
|
||||||
|
|
||||||
def __init__(self, strings, filename, base_path):
|
|
||||||
self.base_path = base_path
|
|
||||||
self.filename = filename
|
|
||||||
self.strings = strings
|
|
||||||
self.classname = 'unknown'
|
|
||||||
|
|
||||||
def visit_ClassDef(self, node):
|
|
||||||
self.classname = node.name
|
|
||||||
self.generic_visit(node)
|
|
||||||
|
|
||||||
def visit_Call(self, node):
|
|
||||||
if hasattr(node.func, 'attr') and node.func.attr == 'trUtf8' and isinstance(node.args[0], Str):
|
|
||||||
string = node.args[0].s
|
|
||||||
key = '%s-%s' % (self.classname, string)
|
|
||||||
self.strings[key] = [self.classname, self.filename[len(self.base_path) + 1:], node.lineno, escape(string)]
|
|
||||||
self.generic_visit(node)
|
|
||||||
|
|
||||||
def parse_file(base_path, filename, strings):
|
|
||||||
file = open(filename, u'r')
|
|
||||||
try:
|
|
||||||
ast = parse(file.read())
|
|
||||||
except SyntaxError, e:
|
|
||||||
print "Unable to parse %s: %s" % (filename, e)
|
|
||||||
return
|
|
||||||
file.close()
|
|
||||||
|
|
||||||
StringExtractor(strings, filename, base_path).visit(ast)
|
|
||||||
|
|
||||||
def write_file(filename, 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.encode('utf8'))
|
|
||||||
file.close()
|
|
||||||
|
|
||||||
def main():
|
|
||||||
strings = {}
|
|
||||||
start_dir = os.path.abspath(u'..')
|
|
||||||
for root, dirs, files in os.walk(start_dir):
|
|
||||||
for file in files:
|
|
||||||
if file.startswith(u'hook-') or file.startswith(u'test_'):
|
|
||||||
continue
|
|
||||||
if file.endswith(u'.py'):
|
|
||||||
print u'Parsing "%s"' % file
|
|
||||||
parse_file(start_dir, os.path.join(root, file), strings)
|
|
||||||
print u'Generating TS file...',
|
|
||||||
write_file(os.path.join(start_dir, u'resources', u'i18n', u'openlp_en.ts'), strings)
|
|
||||||
print u'done.'
|
|
||||||
|
|
||||||
if __name__ == u'__main__':
|
|
||||||
if os.path.split(os.path.abspath(u'.'))[1] != u'scripts':
|
|
||||||
print u'You need to run this script from the scripts directory.'
|
|
||||||
else:
|
|
||||||
main()
|
|
Loading…
Reference in New Issue
Block a user