forked from openlp/openlp
Head1075
This commit is contained in:
commit
1e096fc4fe
@ -96,7 +96,7 @@ class MediaManagerItem(QtGui.QWidget):
|
|||||||
#TODO: plugin should not be the parent in future
|
#TODO: plugin should not be the parent in future
|
||||||
self.plugin = parent # plugin
|
self.plugin = parent # plugin
|
||||||
visible_title = self.plugin.getString(StringContent.VisibleName)
|
visible_title = self.plugin.getString(StringContent.VisibleName)
|
||||||
self.title = visible_title[u'title']
|
self.title = unicode(visible_title[u'title'])
|
||||||
self.settingsSection = self.plugin.name.lower()
|
self.settingsSection = self.plugin.name.lower()
|
||||||
if isinstance(icon, QtGui.QIcon):
|
if isinstance(icon, QtGui.QIcon):
|
||||||
self.icon = icon
|
self.icon = icon
|
||||||
|
@ -303,7 +303,7 @@ class Plugin(QtCore.QObject):
|
|||||||
The new name the plugin should now use.
|
The new name the plugin should now use.
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def getString(self, name):
|
def getString(self, name):
|
||||||
"""
|
"""
|
||||||
encapsulate access of plugins translated text strings
|
encapsulate access of plugins translated text strings
|
||||||
@ -314,4 +314,4 @@ class Plugin(QtCore.QObject):
|
|||||||
"""
|
"""
|
||||||
Called to define all translatable texts of the plugin
|
Called to define all translatable texts of the plugin
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
@ -101,9 +101,9 @@ class ServiceItem(object):
|
|||||||
self.main = None
|
self.main = None
|
||||||
self.footer = None
|
self.footer = None
|
||||||
self.bg_image_bytes = None
|
self.bg_image_bytes = None
|
||||||
self._new_item()
|
|
||||||
self.search_string = u''
|
self.search_string = u''
|
||||||
self.data_string = u''
|
self.data_string = u''
|
||||||
|
self._new_item()
|
||||||
|
|
||||||
def _new_item(self):
|
def _new_item(self):
|
||||||
"""
|
"""
|
||||||
|
@ -85,6 +85,9 @@ class AdvancedTab(SettingsTab):
|
|||||||
self.expandServiceItemCheckBox.setObjectName(u'expandServiceItemCheckBox')
|
self.expandServiceItemCheckBox.setObjectName(u'expandServiceItemCheckBox')
|
||||||
self.uiLayout.addWidget(self.expandServiceItemCheckBox)
|
self.uiLayout.addWidget(self.expandServiceItemCheckBox)
|
||||||
self.leftLayout.addWidget(self.uiGroupBox)
|
self.leftLayout.addWidget(self.uiGroupBox)
|
||||||
|
self.expandServiceItemCheckBox = QtGui.QCheckBox(self.uiGroupBox)
|
||||||
|
self.expandServiceItemCheckBox.setObjectName(u'expandServiceItemCheckBox')
|
||||||
|
self.uiLayout.addWidget(self.expandServiceItemCheckBox)
|
||||||
# self.sharedDirGroupBox = QtGui.QGroupBox(self.leftWidget)
|
# self.sharedDirGroupBox = QtGui.QGroupBox(self.leftWidget)
|
||||||
# self.sharedDirGroupBox.setObjectName(u'sharedDirGroupBox')
|
# self.sharedDirGroupBox.setObjectName(u'sharedDirGroupBox')
|
||||||
# self.sharedDirGroupBox.setGeometry(QtCore.QRect(0, 65, 500, 85))
|
# self.sharedDirGroupBox.setGeometry(QtCore.QRect(0, 65, 500, 85))
|
||||||
|
@ -107,6 +107,7 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
self.serviceName = u''
|
self.serviceName = u''
|
||||||
self.suffixes = []
|
self.suffixes = []
|
||||||
self.droppos = 0
|
self.droppos = 0
|
||||||
|
self.expandTabs = False
|
||||||
#is a new service and has not been saved
|
#is a new service and has not been saved
|
||||||
self.isNew = True
|
self.isNew = True
|
||||||
self.serviceNoteForm = ServiceNoteForm(self.parent)
|
self.serviceNoteForm = ServiceNoteForm(self.parent)
|
||||||
@ -643,6 +644,7 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
zip = None
|
zip = None
|
||||||
file = None
|
file = None
|
||||||
try:
|
try:
|
||||||
|
write_list = []
|
||||||
zip = zipfile.ZipFile(unicode(filename), 'w')
|
zip = zipfile.ZipFile(unicode(filename), 'w')
|
||||||
for item in self.serviceItems:
|
for item in self.serviceItems:
|
||||||
service.append({u'serviceitem':item[u'service_item']
|
service.append({u'serviceitem':item[u'service_item']
|
||||||
@ -652,7 +654,10 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
path_from = unicode(os.path.join(
|
path_from = unicode(os.path.join(
|
||||||
frame[u'path'],
|
frame[u'path'],
|
||||||
frame[u'title']))
|
frame[u'title']))
|
||||||
zip.write(path_from.encode(u'utf-8'))
|
# On write a file once
|
||||||
|
if not path_from in write_list:
|
||||||
|
write_list.append(path_from)
|
||||||
|
zip.write(path_from.encode(u'utf-8'))
|
||||||
file = open(servicefile, u'wb')
|
file = open(servicefile, u'wb')
|
||||||
cPickle.dump(service, file)
|
cPickle.dump(service, file)
|
||||||
file.close()
|
file.close()
|
||||||
@ -884,6 +889,8 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
if expand == None:
|
if expand == None:
|
||||||
expand = self.expandTabs
|
expand = self.expandTabs
|
||||||
log.debug(u'addServiceItem')
|
log.debug(u'addServiceItem')
|
||||||
|
if expand == None:
|
||||||
|
expand = self.expandTabs
|
||||||
sitem = self.findServiceItem()[0]
|
sitem = self.findServiceItem()[0]
|
||||||
item.render()
|
item.render()
|
||||||
if replace:
|
if replace:
|
||||||
|
@ -248,18 +248,24 @@ class ImportWizardForm(QtGui.QWizard, Ui_SongImportWizard):
|
|||||||
# Progress page
|
# Progress page
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def getFileName(self, title, editbox):
|
def getFileName(self, title, editbox,
|
||||||
|
filters = '%s (*)' % translate('SongsPlugin.ImportWizardForm',
|
||||||
|
'All Files')):
|
||||||
filename = QtGui.QFileDialog.getOpenFileName(self, title,
|
filename = QtGui.QFileDialog.getOpenFileName(self, title,
|
||||||
SettingsManager.get_last_dir(self.plugin.settingsSection, 1))
|
SettingsManager.get_last_dir(self.plugin.settingsSection, 1),
|
||||||
|
filters)
|
||||||
if filename:
|
if filename:
|
||||||
editbox.setText(filename)
|
editbox.setText(filename)
|
||||||
SettingsManager.set_last_dir(
|
SettingsManager.set_last_dir(
|
||||||
self.plugin.settingsSection,
|
self.plugin.settingsSection,
|
||||||
os.path.split(unicode(filename))[0], 1)
|
os.path.split(unicode(filename))[0], 1)
|
||||||
|
|
||||||
def getFiles(self, title, listbox):
|
def getFiles(self, title, listbox,
|
||||||
|
filters = u'%s (*)' % translate('SongsPlugin.ImportWizardForm',
|
||||||
|
'All Files')):
|
||||||
filenames = QtGui.QFileDialog.getOpenFileNames(self, title,
|
filenames = QtGui.QFileDialog.getOpenFileNames(self, title,
|
||||||
SettingsManager.get_last_dir(self.plugin.settingsSection, 1))
|
SettingsManager.get_last_dir(self.plugin.settingsSection, 1),
|
||||||
|
filters)
|
||||||
if filenames:
|
if filenames:
|
||||||
listbox.addItems(filenames)
|
listbox.addItems(filenames)
|
||||||
SettingsManager.set_last_dir(
|
SettingsManager.set_last_dir(
|
||||||
@ -281,14 +287,24 @@ class ImportWizardForm(QtGui.QWizard, Ui_SongImportWizard):
|
|||||||
self.getFileName(
|
self.getFileName(
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
translate('SongsPlugin.ImportWizardForm',
|
||||||
'Select OpenLP 2.0 Database File'),
|
'Select OpenLP 2.0 Database File'),
|
||||||
self.openLP2FilenameEdit
|
self.openLP2FilenameEdit,
|
||||||
|
u'%s (*.sqlite);;%s (*)'
|
||||||
|
% (translate('SongsPlugin.ImportWizardForm',
|
||||||
|
'OpenLP 2.0 Databases'),
|
||||||
|
translate('SongsPlugin.ImportWizardForm',
|
||||||
|
'All Files'))
|
||||||
)
|
)
|
||||||
|
|
||||||
def onOpenLP1BrowseButtonClicked(self):
|
def onOpenLP1BrowseButtonClicked(self):
|
||||||
self.getFileName(
|
self.getFileName(
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
translate('SongsPlugin.ImportWizardForm',
|
||||||
'Select openlp.org 1.x Database File'),
|
'Select openlp.org 1.x Database File'),
|
||||||
self.openLP1FilenameEdit
|
self.openLP1FilenameEdit,
|
||||||
|
u'%s (*.olp);;%s (*)'
|
||||||
|
% (translate('SongsPlugin.ImportWizardForm',
|
||||||
|
'openlp.org v1.x Databases'),
|
||||||
|
translate('SongsPlugin.ImportWizardForm',
|
||||||
|
'All Files'))
|
||||||
)
|
)
|
||||||
|
|
||||||
#def onOpenLyricsAddButtonClicked(self):
|
#def onOpenLyricsAddButtonClicked(self):
|
||||||
@ -315,7 +331,12 @@ class ImportWizardForm(QtGui.QWizard, Ui_SongImportWizard):
|
|||||||
self.getFiles(
|
self.getFiles(
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
translate('SongsPlugin.ImportWizardForm',
|
||||||
'Select Words of Worship Files'),
|
'Select Words of Worship Files'),
|
||||||
self.wordsOfWorshipFileListWidget
|
self.wordsOfWorshipFileListWidget,
|
||||||
|
u'%s (*.wsg *.wow-song);;%s (*)'
|
||||||
|
% (translate('SongsPlugin.ImportWizardForm',
|
||||||
|
'Words Of Worship Song Files'),
|
||||||
|
translate('SongsPlugin.ImportWizardForm',
|
||||||
|
'All Files'))
|
||||||
)
|
)
|
||||||
|
|
||||||
def onWordsOfWorshipRemoveButtonClicked(self):
|
def onWordsOfWorshipRemoveButtonClicked(self):
|
||||||
@ -335,7 +356,12 @@ class ImportWizardForm(QtGui.QWizard, Ui_SongImportWizard):
|
|||||||
self.getFiles(
|
self.getFiles(
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
translate('SongsPlugin.ImportWizardForm',
|
||||||
'Select Songs of Fellowship Files'),
|
'Select Songs of Fellowship Files'),
|
||||||
self.songsOfFellowshipFileListWidget
|
self.songsOfFellowshipFileListWidget,
|
||||||
|
u'%s (*.rtf);;%s (*)'
|
||||||
|
% (translate('SongsPlugin.ImportWizardForm',
|
||||||
|
'Songs Of Felloship Song Files'),
|
||||||
|
translate('SongsPlugin.ImportWizardForm',
|
||||||
|
'All Files'))
|
||||||
)
|
)
|
||||||
|
|
||||||
def onSongsOfFellowshipRemoveButtonClicked(self):
|
def onSongsOfFellowshipRemoveButtonClicked(self):
|
||||||
|
@ -116,16 +116,16 @@ class WowImport(SongImport):
|
|||||||
self.import_wizard.importProgressBar.setMaximum(
|
self.import_wizard.importProgressBar.setMaximum(
|
||||||
len(self.import_source))
|
len(self.import_source))
|
||||||
for file in self.import_source:
|
for file in self.import_source:
|
||||||
# TODO: check that it is a valid words of worship file (could
|
|
||||||
# check header for WoW File Song Word)
|
|
||||||
self.author = u''
|
self.author = u''
|
||||||
self.copyright = u''
|
self.copyright = u''
|
||||||
# Get the song title
|
|
||||||
self.file_name = os.path.split(file)[1]
|
self.file_name = os.path.split(file)[1]
|
||||||
self.import_wizard.incrementProgressBar(
|
self.import_wizard.incrementProgressBar(
|
||||||
"Importing %s" % (self.file_name), 0)
|
"Importing %s" % (self.file_name), 0)
|
||||||
|
# Get the song title
|
||||||
self.title = self.file_name.rpartition(u'.')[0]
|
self.title = self.file_name.rpartition(u'.')[0]
|
||||||
self.songData = open(file, 'rb')
|
self.songData = open(file, 'rb')
|
||||||
|
if self.songData.read(19) != u'WoW File\nSong Words':
|
||||||
|
continue
|
||||||
# Seek to byte which stores number of blocks in the song
|
# Seek to byte which stores number of blocks in the song
|
||||||
self.songData.seek(56)
|
self.songData.seek(56)
|
||||||
self.no_of_blocks = ord(self.songData.read(1))
|
self.no_of_blocks = ord(self.songData.read(1))
|
||||||
|
Loading…
Reference in New Issue
Block a user