forked from openlp/openlp
r1657
This commit is contained in:
commit
71b1a9dcda
@ -29,6 +29,7 @@ import re
|
|||||||
try:
|
try:
|
||||||
import enchant
|
import enchant
|
||||||
from enchant import DictNotFoundError
|
from enchant import DictNotFoundError
|
||||||
|
from enchant.errors import Error
|
||||||
ENCHANT_AVAILABLE = True
|
ENCHANT_AVAILABLE = True
|
||||||
except ImportError:
|
except ImportError:
|
||||||
ENCHANT_AVAILABLE = False
|
ENCHANT_AVAILABLE = False
|
||||||
@ -56,7 +57,7 @@ class SpellTextEdit(QtGui.QPlainTextEdit):
|
|||||||
self.dictionary = enchant.Dict()
|
self.dictionary = enchant.Dict()
|
||||||
self.highlighter = Highlighter(self.document())
|
self.highlighter = Highlighter(self.document())
|
||||||
self.highlighter.spellingDictionary = self.dictionary
|
self.highlighter.spellingDictionary = self.dictionary
|
||||||
except DictNotFoundError:
|
except Error, DictNotFoundError:
|
||||||
ENCHANT_AVAILABLE = False
|
ENCHANT_AVAILABLE = False
|
||||||
log.debug(u'Could not load default dictionary')
|
log.debug(u'Could not load default dictionary')
|
||||||
|
|
||||||
|
@ -49,7 +49,10 @@ class MainDisplay(QtGui.QGraphicsView):
|
|||||||
This is the display screen.
|
This is the display screen.
|
||||||
"""
|
"""
|
||||||
def __init__(self, parent, image_manager, live):
|
def __init__(self, parent, image_manager, live):
|
||||||
QtGui.QGraphicsView.__init__(self, parent)
|
if live:
|
||||||
|
QtGui.QGraphicsView.__init__(self)
|
||||||
|
else:
|
||||||
|
QtGui.QGraphicsView.__init__(self, parent)
|
||||||
self.isLive = live
|
self.isLive = live
|
||||||
self.image_manager = image_manager
|
self.image_manager = image_manager
|
||||||
self.screens = ScreenList.get_instance()
|
self.screens = ScreenList.get_instance()
|
||||||
|
@ -98,6 +98,9 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
|
|||||||
if event.modifiers() & QtCore.Qt.ShiftModifier == \
|
if event.modifiers() & QtCore.Qt.ShiftModifier == \
|
||||||
QtCore.Qt.ShiftModifier:
|
QtCore.Qt.ShiftModifier:
|
||||||
key_string = u'Shift+' + key_string
|
key_string = u'Shift+' + key_string
|
||||||
|
if event.modifiers() & QtCore.Qt.MetaModifier == \
|
||||||
|
QtCore.Qt.MetaModifier:
|
||||||
|
key_string = u'Meta+' + key_string
|
||||||
key_sequence = QtGui.QKeySequence(key_string)
|
key_sequence = QtGui.QKeySequence(key_string)
|
||||||
if self._validiate_shortcut(self._currentItemAction(), key_sequence):
|
if self._validiate_shortcut(self._currentItemAction(), key_sequence):
|
||||||
if self.primaryPushButton.isChecked():
|
if self.primaryPushButton.isChecked():
|
||||||
|
@ -500,7 +500,9 @@ class SlideController(QtGui.QWidget):
|
|||||||
"""
|
"""
|
||||||
Allows the live toolbar to be customised
|
Allows the live toolbar to be customised
|
||||||
"""
|
"""
|
||||||
self.toolbar.setVisible(True)
|
# Work-around for OS X, hide and then show the toolbar
|
||||||
|
# See bug #791050
|
||||||
|
self.toolbar.hide()
|
||||||
self.mediabar.setVisible(False)
|
self.mediabar.setVisible(False)
|
||||||
self.toolbar.makeWidgetsInvisible([u'Song Menu'])
|
self.toolbar.makeWidgetsInvisible([u'Song Menu'])
|
||||||
self.toolbar.makeWidgetsInvisible(self.loopList)
|
self.toolbar.makeWidgetsInvisible(self.loopList)
|
||||||
@ -515,12 +517,18 @@ class SlideController(QtGui.QWidget):
|
|||||||
if item.is_media():
|
if item.is_media():
|
||||||
self.toolbar.setVisible(False)
|
self.toolbar.setVisible(False)
|
||||||
self.mediabar.setVisible(True)
|
self.mediabar.setVisible(True)
|
||||||
|
else:
|
||||||
|
# Work-around for OS X, hide and then show the toolbar
|
||||||
|
# See bug #791050
|
||||||
|
self.toolbar.show()
|
||||||
|
|
||||||
def enablePreviewToolBar(self, item):
|
def enablePreviewToolBar(self, item):
|
||||||
"""
|
"""
|
||||||
Allows the Preview toolbar to be customised
|
Allows the Preview toolbar to be customised
|
||||||
"""
|
"""
|
||||||
self.toolbar.setVisible(True)
|
# Work-around for OS X, hide and then show the toolbar
|
||||||
|
# See bug #791050
|
||||||
|
self.toolbar.hide()
|
||||||
self.mediabar.setVisible(False)
|
self.mediabar.setVisible(False)
|
||||||
self.toolbar.makeWidgetsInvisible(self.songEditList)
|
self.toolbar.makeWidgetsInvisible(self.songEditList)
|
||||||
if item.is_capable(ItemCapabilities.AllowsEdit) and item.from_plugin:
|
if item.is_capable(ItemCapabilities.AllowsEdit) and item.from_plugin:
|
||||||
@ -529,6 +537,10 @@ class SlideController(QtGui.QWidget):
|
|||||||
self.toolbar.setVisible(False)
|
self.toolbar.setVisible(False)
|
||||||
self.mediabar.setVisible(True)
|
self.mediabar.setVisible(True)
|
||||||
self.volumeSlider.setAudioOutput(self.audio)
|
self.volumeSlider.setAudioOutput(self.audio)
|
||||||
|
if not item.is_media():
|
||||||
|
# Work-around for OS X, hide and then show the toolbar
|
||||||
|
# See bug #791050
|
||||||
|
self.toolbar.show()
|
||||||
|
|
||||||
def refreshServiceItem(self):
|
def refreshServiceItem(self):
|
||||||
"""
|
"""
|
||||||
|
@ -190,6 +190,14 @@ class OpenLPWizard(QtGui.QWizard):
|
|||||||
self.preWizard()
|
self.preWizard()
|
||||||
self.performWizard()
|
self.performWizard()
|
||||||
self.postWizard()
|
self.postWizard()
|
||||||
|
else:
|
||||||
|
self.customPageChanged(pageId)
|
||||||
|
|
||||||
|
def customPageChanged(self, pageId):
|
||||||
|
"""
|
||||||
|
Called when changing to a page other than the progress page
|
||||||
|
"""
|
||||||
|
pass
|
||||||
|
|
||||||
def onErrorCopyToButtonClicked(self):
|
def onErrorCopyToButtonClicked(self):
|
||||||
"""
|
"""
|
||||||
|
@ -68,6 +68,8 @@ class Ui_EditSongDialog(object):
|
|||||||
QtCore.Qt.AlignTop)
|
QtCore.Qt.AlignTop)
|
||||||
self.verseListWidget = QtGui.QTableWidget(self.lyricsTab)
|
self.verseListWidget = QtGui.QTableWidget(self.lyricsTab)
|
||||||
self.verseListWidget.horizontalHeader().setVisible(False)
|
self.verseListWidget.horizontalHeader().setVisible(False)
|
||||||
|
self.verseListWidget.horizontalHeader().setStretchLastSection(True)
|
||||||
|
self.verseListWidget.horizontalHeader().setMinimumSectionSize(16)
|
||||||
self.verseListWidget.setAlternatingRowColors(True)
|
self.verseListWidget.setAlternatingRowColors(True)
|
||||||
self.verseListWidget.setColumnCount(1)
|
self.verseListWidget.setColumnCount(1)
|
||||||
self.verseListWidget.setSelectionBehavior(
|
self.verseListWidget.setSelectionBehavior(
|
||||||
|
@ -233,7 +233,6 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
# lazy xml migration for now
|
# lazy xml migration for now
|
||||||
self.verseListWidget.clear()
|
self.verseListWidget.clear()
|
||||||
self.verseListWidget.setRowCount(0)
|
self.verseListWidget.setRowCount(0)
|
||||||
self.verseListWidget.setColumnWidth(0, self.width)
|
|
||||||
# This is just because occasionally the lyrics come back as a "buffer"
|
# This is just because occasionally the lyrics come back as a "buffer"
|
||||||
if isinstance(self.song.lyrics, buffer):
|
if isinstance(self.song.lyrics, buffer):
|
||||||
self.song.lyrics = unicode(self.song.lyrics)
|
self.song.lyrics = unicode(self.song.lyrics)
|
||||||
|
@ -343,6 +343,13 @@ class SongImportForm(OpenLPWizard):
|
|||||||
self.formatSpacer.changeSize(width, 0, QtGui.QSizePolicy.Fixed,
|
self.formatSpacer.changeSize(width, 0, QtGui.QSizePolicy.Fixed,
|
||||||
QtGui.QSizePolicy.Fixed)
|
QtGui.QSizePolicy.Fixed)
|
||||||
|
|
||||||
|
def customPageChanged(self, pageId):
|
||||||
|
"""
|
||||||
|
Called when changing to a page other than the progress page
|
||||||
|
"""
|
||||||
|
if self.page(pageId) == self.sourcePage:
|
||||||
|
self.onCurrentIndexChanged(self.formatStack.currentIndex())
|
||||||
|
|
||||||
def validateCurrentPage(self):
|
def validateCurrentPage(self):
|
||||||
"""
|
"""
|
||||||
Validate the current page before moving on to the next page.
|
Validate the current page before moving on to the next page.
|
||||||
|
@ -73,15 +73,21 @@ class EasiSlidesImport(SongImport):
|
|||||||
def _parse_song(self, song):
|
def _parse_song(self, song):
|
||||||
self._success = True
|
self._success = True
|
||||||
self._add_unicode_attribute(u'title', song.Title1, True)
|
self._add_unicode_attribute(u'title', song.Title1, True)
|
||||||
self._add_unicode_attribute(u'alternate_title', song.Title2)
|
if hasattr(song, u'Title2'):
|
||||||
self._add_unicode_attribute(u'song_number', song.SongNumber)
|
self._add_unicode_attribute(u'alternate_title', song.Title2)
|
||||||
|
if hasattr(song, u'SongNumber'):
|
||||||
|
self._add_unicode_attribute(u'song_number', song.SongNumber)
|
||||||
if self.song_number == u'0':
|
if self.song_number == u'0':
|
||||||
self.song_number = u''
|
self.song_number = u''
|
||||||
self._add_authors(song)
|
self._add_authors(song)
|
||||||
self._add_copyright(song.Copyright)
|
if hasattr(song, u'Copyright'):
|
||||||
self._add_copyright(song.LicenceAdmin1)
|
self._add_copyright(song.Copyright)
|
||||||
self._add_copyright(song.LicenceAdmin2)
|
if hasattr(song, u'LicenceAdmin1'):
|
||||||
self._add_unicode_attribute(u'song_book_name', song.BookReference)
|
self._add_copyright(song.LicenceAdmin1)
|
||||||
|
if hasattr(song, u'LicenceAdmin2'):
|
||||||
|
self._add_copyright(song.LicenceAdmin2)
|
||||||
|
if hasattr(song, u'BookReference'):
|
||||||
|
self._add_unicode_attribute(u'song_book_name', song.BookReference)
|
||||||
self._parse_and_add_lyrics(song)
|
self._parse_and_add_lyrics(song)
|
||||||
if self._success:
|
if self._success:
|
||||||
if not self.finish():
|
if not self.finish():
|
||||||
|
@ -467,23 +467,20 @@ class SongMediaItem(MediaManagerItem):
|
|||||||
search_results = self.plugin.manager.get_all_objects(Song,
|
search_results = self.plugin.manager.get_all_objects(Song,
|
||||||
Song.search_title == item.data_string[u'title'],
|
Song.search_title == item.data_string[u'title'],
|
||||||
Song.search_title.asc())
|
Song.search_title.asc())
|
||||||
author_list = item.data_string[u'authors'].split(u', ')
|
|
||||||
editId = 0
|
editId = 0
|
||||||
add_song = True
|
add_song = True
|
||||||
if search_results:
|
if search_results:
|
||||||
for song in search_results:
|
for song in search_results:
|
||||||
|
author_list = item.data_string[u'authors']
|
||||||
same_authors = True
|
same_authors = True
|
||||||
# If the author counts are different, we do not have to do any
|
for author in song.authors:
|
||||||
# further checking.
|
if author.display_name in author_list:
|
||||||
if len(song.authors) == len(author_list):
|
author_list = author_list.replace(author.display_name,
|
||||||
for author in song.authors:
|
u'', 1)
|
||||||
if author.display_name not in author_list:
|
else:
|
||||||
same_authors = False
|
same_authors = False
|
||||||
else:
|
break
|
||||||
same_authors = False
|
if same_authors and author_list.strip(u', ') == u'':
|
||||||
# All authors are the same, so we can stop here and the song
|
|
||||||
# does not have to be saved.
|
|
||||||
if same_authors:
|
|
||||||
add_song = False
|
add_song = False
|
||||||
editId = song.id
|
editId = song.id
|
||||||
break
|
break
|
||||||
|
@ -37,14 +37,16 @@ log = logging.getLogger(__name__)
|
|||||||
|
|
||||||
if os.name == u'nt':
|
if os.name == u'nt':
|
||||||
from win32com.client import Dispatch
|
from win32com.client import Dispatch
|
||||||
PAGE_BEFORE = 4
|
|
||||||
PAGE_AFTER = 5
|
|
||||||
PAGE_BOTH = 6
|
|
||||||
NoConnectException = Exception
|
NoConnectException = Exception
|
||||||
else:
|
else:
|
||||||
import uno
|
import uno
|
||||||
from com.sun.star.connection import NoConnectException
|
from com.sun.star.connection import NoConnectException
|
||||||
|
try:
|
||||||
from com.sun.star.style.BreakType import PAGE_BEFORE, PAGE_AFTER, PAGE_BOTH
|
from com.sun.star.style.BreakType import PAGE_BEFORE, PAGE_AFTER, PAGE_BOTH
|
||||||
|
except ImportError:
|
||||||
|
PAGE_BEFORE = 4
|
||||||
|
PAGE_AFTER = 5
|
||||||
|
PAGE_BOTH = 6
|
||||||
|
|
||||||
class OooImport(SongImport):
|
class OooImport(SongImport):
|
||||||
"""
|
"""
|
||||||
|
@ -70,10 +70,12 @@ class OpenLyricsExport(object):
|
|||||||
song.title)
|
song.title)
|
||||||
xml = openLyrics.song_to_xml(song)
|
xml = openLyrics.song_to_xml(song)
|
||||||
tree = etree.ElementTree(etree.fromstring(xml))
|
tree = etree.ElementTree(etree.fromstring(xml))
|
||||||
filename = u'%s (%s).xml' % (song.title,
|
filename = u'%s (%s)' % (song.title,
|
||||||
u', '.join([author.display_name for author in song.authors]))
|
u', '.join([author.display_name for author in song.authors]))
|
||||||
filename = re.sub(
|
filename = re.sub(
|
||||||
r'[/\\?*|<>\[\]":<>+%]+', u'_', filename).strip(u'_')
|
r'[/\\?*|<>\[\]":<>+%]+', u'_', filename).strip(u'_')
|
||||||
|
# Ensure the filename isn't too long for some filesystems
|
||||||
|
filename = u'%s.xml' % filename[0:250 - len(self.save_path)]
|
||||||
# Pass a file object, because lxml does not cope with some special
|
# Pass a file object, because lxml does not cope with some special
|
||||||
# characters in the path (see lp:757673 and lp:744337).
|
# characters in the path (see lp:757673 and lp:744337).
|
||||||
tree.write(open(os.path.join(self.save_path, filename), u'w'),
|
tree.write(open(os.path.join(self.save_path, filename), u'w'),
|
||||||
|
@ -41,20 +41,23 @@ from oooimport import OooImport
|
|||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
if os.name == u'nt':
|
if os.name == u'nt':
|
||||||
BOLD = 150.0
|
|
||||||
ITALIC = 2
|
|
||||||
from oooimport import PAGE_BEFORE, PAGE_AFTER, PAGE_BOTH
|
from oooimport import PAGE_BEFORE, PAGE_AFTER, PAGE_BOTH
|
||||||
RuntimeException = Exception
|
RuntimeException = Exception
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
from com.sun.star.awt.FontWeight import BOLD
|
|
||||||
from com.sun.star.awt.FontSlant import ITALIC
|
|
||||||
from com.sun.star.style.BreakType import PAGE_BEFORE, PAGE_AFTER, \
|
from com.sun.star.style.BreakType import PAGE_BEFORE, PAGE_AFTER, \
|
||||||
PAGE_BOTH
|
PAGE_BOTH
|
||||||
from com.sun.star.uno import RuntimeException
|
from com.sun.star.uno import RuntimeException
|
||||||
except ImportError:
|
except ImportError:
|
||||||
pass
|
pass
|
||||||
|
try:
|
||||||
|
from com.sun.star.awt.FontWeight import BOLD
|
||||||
|
except ImportError:
|
||||||
|
BOLD = 150.0
|
||||||
|
try:
|
||||||
|
from com.sun.star.awt.FontSlant import ITALIC
|
||||||
|
except ImportError:
|
||||||
|
ITALIC = 2
|
||||||
|
|
||||||
class SofImport(OooImport):
|
class SofImport(OooImport):
|
||||||
"""
|
"""
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 151 KiB After Width: | Height: | Size: 199 KiB |
Binary file not shown.
Before Width: | Height: | Size: 9.1 KiB After Width: | Height: | Size: 12 KiB |
Loading…
Reference in New Issue
Block a user