This commit is contained in:
Andreas Preikschat 2011-01-27 17:01:19 +01:00
commit f27d90ea9e
23 changed files with 181 additions and 166 deletions

View File

@ -194,7 +194,10 @@ class OpenLP(QtGui.QApplication):
# now kill the splashscreen
self.splash.finish(self.mainWindow)
self.mainWindow.repaint()
VersionThread(self.mainWindow, app_version).start()
update_check = QtCore.QSettings().value(
u'general/update check', QtCore.QVariant(True)).toBool()
if update_check:
VersionThread(self.mainWindow, app_version).start()
return self.exec_()
def hookException(self, exctype, value, traceback):
@ -280,4 +283,4 @@ if __name__ == u'__main__':
"""
Instantiate and run the application.
"""
main()
main()

View File

@ -314,7 +314,7 @@ body {
</html>
"""
def build_html(item, screen, alert, islive):
def build_html(item, screen, alert, islive, background):
"""
Build the full web paged structure for display
@ -332,7 +332,9 @@ def build_html(item, screen, alert, islive):
theme = item.themedata
webkitvers = webkit_version()
# Image generated and poked in
if item.bg_image_bytes:
if background:
image = u'src="data:image/png;base64,%s"' % background
elif item.bg_image_bytes:
image = u'src="data:image/png;base64,%s"' % item.bg_image_bytes
else:
image = u'style="display:none;"'

View File

@ -98,13 +98,9 @@ class MediaManagerItem(QtGui.QWidget):
visible_title = self.plugin.getString(StringContent.VisibleName)
self.title = unicode(visible_title[u'title'])
self.settingsSection = self.plugin.name.lower()
if isinstance(icon, QtGui.QIcon):
self.icon = icon
elif isinstance(icon, basestring):
self.icon.addPixmap(QtGui.QPixmap.fromImage(QtGui.QImage(icon)),
QtGui.QIcon.Normal, QtGui.QIcon.Off)
else:
self.icon = None
self.icon = None
if icon:
self.icon = build_icon(icon)
self.toolbar = None
self.remoteTriggered = None
self.serviceItemIconName = None

View File

@ -47,13 +47,16 @@ class SpellTextEdit(QtGui.QPlainTextEdit):
# Default dictionary based on the current locale.
if ENCHANT_AVAILABLE:
try:
self.dict = enchant.Dict()
self.dictionary = enchant.Dict()
except DictNotFoundError:
self.dict = enchant.Dict(u'en_US')
self.dictionary = enchant.Dict(u'en_US')
self.highlighter = Highlighter(self.document())
self.highlighter.setDict(self.dict)
self.highlighter.spellingDictionary = self.dictionary
def mousePressEvent(self, event):
"""
Handle mouse clicks within the text edit region.
"""
if event.button() == QtCore.Qt.RightButton:
# Rewrite the mouse event to a left button event so the cursor is
# moved to the location of the pointer.
@ -63,6 +66,9 @@ class SpellTextEdit(QtGui.QPlainTextEdit):
QtGui.QPlainTextEdit.mousePressEvent(self, event)
def contextMenuEvent(self, event):
"""
Provide the context menu for the text edit region.
"""
popupMenu = self.createStandardContextMenu()
# Select the word under the cursor.
cursor = self.textCursor()
@ -74,10 +80,10 @@ class SpellTextEdit(QtGui.QPlainTextEdit):
# suggestions if it is.
if ENCHANT_AVAILABLE and self.textCursor().hasSelection():
text = unicode(self.textCursor().selectedText())
if not self.dict.check(text):
if not self.dictionary.check(text):
spell_menu = QtGui.QMenu(translate('OpenLP.SpellTextEdit',
'Spelling Suggestions'))
for word in self.dict.suggest(text):
for word in self.dictionary.suggest(text):
action = SpellAction(word, spell_menu)
action.correct.connect(self.correctWord)
spell_menu.addAction(action)
@ -126,28 +132,32 @@ class SpellTextEdit(QtGui.QPlainTextEdit):
cursor.insertText(html[u'start tag'])
cursor.insertText(html[u'end tag'])
class Highlighter(QtGui.QSyntaxHighlighter):
class Highlighter(QtGui.QSyntaxHighlighter):
"""
Provides a text highlighter for pointing out spelling errors in text.
"""
WORDS = u'(?iu)[\w\']+'
def __init__(self, *args):
QtGui.QSyntaxHighlighter.__init__(self, *args)
self.dict = None
def setDict(self, dict):
self.dict = dict
self.spellingDictionary = None
def highlightBlock(self, text):
if not self.dict:
"""
Highlight misspelt words in a block of text
"""
if not self.spellingDictionary:
return
text = unicode(text)
format = QtGui.QTextCharFormat()
format.setUnderlineColor(QtCore.Qt.red)
format.setUnderlineStyle(QtGui.QTextCharFormat.SpellCheckUnderline)
charFormat = QtGui.QTextCharFormat()
charFormat.setUnderlineColor(QtCore.Qt.red)
charFormat.setUnderlineStyle(QtGui.QTextCharFormat.SpellCheckUnderline)
for word_object in re.finditer(self.WORDS, text):
if not self.dict.check(word_object.group()):
if not self.spellingDictionary.check(word_object.group()):
self.setFormat(word_object.start(),
word_object.end() - word_object.start(), format)
word_object.end() - word_object.start(), charFormat)
class SpellAction(QtGui.QAction):
"""

View File

@ -113,6 +113,9 @@ class GeneralTab(SettingsTab):
self.showSplashCheckBox = QtGui.QCheckBox(self.startupGroupBox)
self.showSplashCheckBox.setObjectName(u'showSplashCheckBox')
self.startupLayout.addWidget(self.showSplashCheckBox)
self.checkForUpdatesCheckBox = QtGui.QCheckBox(self.startupGroupBox)
self.checkForUpdatesCheckBox.setObjectName(u'checkForUpdatesCheckBox')
self.startupLayout.addWidget(self.checkForUpdatesCheckBox)
self.leftLayout.addWidget(self.startupGroupBox)
self.settingsGroupBox = QtGui.QGroupBox(self.leftColumn)
self.settingsGroupBox.setObjectName(u'settingsGroupBox')
@ -249,6 +252,8 @@ class GeneralTab(SettingsTab):
'Automatically open the last service'))
self.showSplashCheckBox.setText(
translate('OpenLP.GeneralTab', 'Show the splash screen'))
self.checkForUpdatesCheckBox.setText(
translate('OpenLP.GeneralTab', 'Check for updates to OpenLP'))
self.settingsGroupBox.setTitle(
translate('OpenLP.GeneralTab', 'Application Settings'))
self.saveCheckServiceCheckBox.setText(translate('OpenLP.GeneralTab',
@ -317,6 +322,8 @@ class GeneralTab(SettingsTab):
QtCore.QVariant(False)).toBool())
self.showSplashCheckBox.setChecked(settings.value(u'show splash',
QtCore.QVariant(True)).toBool())
self.checkForUpdatesCheckBox.setChecked(settings.value(u'update check',
QtCore.QVariant(True)).toBool())
self.autoPreviewCheckBox.setChecked(settings.value(u'auto preview',
QtCore.QVariant(False)).toBool())
self.timeoutSpinBox.setValue(settings.value(u'loop delay',
@ -363,6 +370,8 @@ class GeneralTab(SettingsTab):
QtCore.QVariant(self.autoOpenCheckBox.isChecked()))
settings.setValue(u'show splash',
QtCore.QVariant(self.showSplashCheckBox.isChecked()))
settings.setValue(u'update check',
QtCore.QVariant(self.checkForUpdatesCheckBox.isChecked()))
settings.setValue(u'save prompt',
QtCore.QVariant(self.saveCheckServiceCheckBox.isChecked()))
settings.setValue(u'auto preview',

View File

@ -67,6 +67,7 @@ class MainDisplay(DisplayWidget):
self.isLive = live
self.alertTab = None
self.hideMode = None
self.override = {}
mainIcon = build_icon(u':/icon/openlp-logo-16x16.png')
self.setWindowIcon(mainIcon)
self.retranslateUi()
@ -111,7 +112,7 @@ class MainDisplay(DisplayWidget):
self.page = self.webView.page()
self.frame = self.page.mainFrame()
QtCore.QObject.connect(self.webView,
QtCore.SIGNAL(u'loadFinished(bool)'), self.isLoaded)
QtCore.SIGNAL(u'loadFinished(bool)'), self.isWebLoaded)
self.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
self.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
self.frame.setScrollBarPolicy(QtCore.Qt.Vertical,
@ -137,14 +138,14 @@ class MainDisplay(DisplayWidget):
painter_image.begin(initialFrame)
painter_image.fillRect(initialFrame.rect(), QtCore.Qt.white)
painter_image.drawImage(
(self.screens.current[u'size'].width() -
(self.screens.current[u'size'].width() -
splash_image.width()) / 2,
(self.screens.current[u'size'].height()
- splash_image.height()) / 2, splash_image)
serviceItem = ServiceItem()
serviceItem.bg_image_bytes = image_to_byte(initialFrame)
self.webView.setHtml(build_html(serviceItem, self.screen,
self.parent.alertTab, self.isLive))
self.parent.alertTab, self.isLive, None))
self.initialFrame = True
# To display or not to display?
if not self.screen[u'primary']:
@ -162,7 +163,7 @@ class MainDisplay(DisplayWidget):
"""
log.debug(u'text to display')
# Wait for the webview to update before displaying text.
while not self.loaded:
while not self.webLoaded:
Receiver.send_message(u'openlp_process_events')
self.frame.evaluateJavaScript(u'show_text("%s")' % \
slide.replace(u'\\', u'\\\\').replace(u'\"', u'\\\"'))
@ -204,14 +205,17 @@ class MainDisplay(DisplayWidget):
"""
self.imageManager.add_image(name, path)
self.image(name)
if hasattr(self, u'serviceItem'):
self.override[u'image'] = name
self.override[u'theme'] = self.serviceItem.themedata.theme_name
def image(self, name):
"""
Add an image as the background. The image is converted to a bytestream
on route.
Add an image as the background. The image has already been added
to the cache.
`Image`
The Image to be displayed can be QImage or QPixmap
The name of the image to be displayed
"""
log.debug(u'image to display')
image = self.imageManager.get_image_bytes(name)
@ -244,6 +248,7 @@ class MainDisplay(DisplayWidget):
self.displayImage(self.serviceItem.bg_image_bytes)
else:
self.displayImage(None)
self.override = {}
# Update the preview frame.
Receiver.send_message(u'maindisplay_active')
@ -260,6 +265,7 @@ class MainDisplay(DisplayWidget):
self.phononActive = False
else:
self.frame.evaluateJavaScript(u'show_video("close");')
self.override = {}
# Update the preview frame.
Receiver.send_message(u'maindisplay_active')
@ -313,7 +319,10 @@ class MainDisplay(DisplayWidget):
Loads and starts a video to run with the option of sound
"""
log.debug(u'video')
self.loaded = True
self.webLoaded = True
# We are running a background theme
self.override[u'theme'] = u''
self.override[u'video'] = True
vol = float(volume)/float(10)
if isBackground or not self.usePhonon:
js = u'show_video("init", "%s", %s, true); show_video("play");' % \
@ -333,12 +342,12 @@ class MainDisplay(DisplayWidget):
Receiver.send_message(u'maindisplay_active')
return self.preview()
def isLoaded(self):
def isWebLoaded(self):
"""
Called by webView event to show display is fully loaded
"""
log.debug(u'loaded')
self.loaded = True
log.debug(u'Webloaded')
self.webLoaded = True
def preview(self):
"""
@ -357,7 +366,7 @@ class MainDisplay(DisplayWidget):
Receiver.send_message(u'openlp_process_events')
# Wait for the webview to update before geting the preview.
# Important otherwise first preview will miss the background !
while not self.loaded:
while not self.webLoaded:
Receiver.send_message(u'openlp_process_events')
# if was hidden keep it hidden
if self.isLive:
@ -379,18 +388,32 @@ class MainDisplay(DisplayWidget):
HTML to the display
"""
log.debug(u'buildHtml')
self.loaded = False
self.webLoaded = False
self.initialFrame = False
self.serviceItem = serviceItem
background = None
# We have an image override so keep the image till the theme changes
if self.override:
# We have an video override so allow it to be stopped
if u'video' in self.override:
Receiver.send_message(u'video_background_replaced')
self.override = {}
elif self.override[u'theme'] != \
serviceItem.themedata.theme_name:
Receiver.send_message(u'live_theme_changed')
self.override = {}
else:
background = self.imageManager. \
get_image_bytes(self.override[u'image'])
if self.serviceItem.themedata.background_filename:
self.serviceItem.bg_image_bytes = self.imageManager. \
get_image_bytes(self.serviceItem.themedata.theme_name)
html = build_html(self.serviceItem, self.screen, self.parent.alertTab,
self.isLive)
self.isLive, background)
log.debug(u'buildHtml - pre setHtml')
self.webView.setHtml(html)
log.debug(u'buildHtml - post setHtml')
if serviceItem.foot_text and serviceItem.foot_text:
if serviceItem.foot_text:
self.footer(serviceItem.foot_text)
# if was hidden keep it hidden
if self.hideMode and self.isLive:

View File

@ -563,10 +563,10 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
self.ServiceManagerContents.onLoadServiceClicked)
QtCore.QObject.connect(self.FileSaveItem,
QtCore.SIGNAL(u'triggered()'),
self.ServiceManagerContents.onSaveServiceClicked)
self.ServiceManagerContents.saveFile)
QtCore.QObject.connect(self.FileSaveAsItem,
QtCore.SIGNAL(u'triggered()'),
self.ServiceManagerContents.onSaveServiceAsClicked)
self.ServiceManagerContents.saveFileAs)
# i18n set signals for languages
QtCore.QObject.connect(self.AutoLanguageItem,
QtCore.SIGNAL(u'toggled(bool)'), self.setAutoLanguage)
@ -807,15 +807,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
Hook to close the main window and display windows on exit
"""
if self.ServiceManagerContents.isModified():
ret = QtGui.QMessageBox.question(self,
translate('OpenLP.MainWindow', 'Save Changes to Service?'),
translate('OpenLP.MainWindow', 'Your service has changed. '
'Do you want to save those changes?'),
QtGui.QMessageBox.StandardButtons(
QtGui.QMessageBox.Cancel |
QtGui.QMessageBox.Discard |
QtGui.QMessageBox.Save),
QtGui.QMessageBox.Save)
ret = self.ServiceManagerContents.saveModifiedService()
if ret == QtGui.QMessageBox.Save:
if self.ServiceManagerContents.saveFile():
self.cleanUp()
@ -847,7 +839,6 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
self.cleanUp()
event.accept()
def cleanUp(self):
"""
Runs all the cleanup code before OpenLP shuts down

View File

@ -108,7 +108,7 @@ class ServiceManager(QtGui.QWidget):
translate('OpenLP.ServiceManager', 'Save Service'),
u':/general/general_save.png',
translate('OpenLP.ServiceManager', 'Save this service'),
self.onSaveServiceClicked)
self.saveFile)
self.toolbar.addSeparator()
self.themeLabel = QtGui.QLabel(translate('OpenLP.ServiceManager',
'Theme:'), self)
@ -361,12 +361,7 @@ class ServiceManager(QtGui.QWidget):
Create a new service.
"""
if self.isModified():
result = QtGui.QMessageBox.question(self.mainwindow,
translate('OpenLP.ServiceManager', 'Save Changes'),
translate('OpenLP.ServiceManager', 'The current service has '
'been modified, would you like to save it?'),
QtGui.QMessageBox.Save | QtGui.QMessageBox.Discard |
QtGui.QMessageBox.Cancel, QtGui.QMessageBox.Save)
result = self.saveModifiedService()
if result == QtGui.QMessageBox.Cancel:
return False
elif result == QtGui.QMessageBox.Save:
@ -376,12 +371,7 @@ class ServiceManager(QtGui.QWidget):
def onLoadServiceClicked(self):
if self.isModified():
result = QtGui.QMessageBox.question(self.mainwindow,
translate('OpenLP.ServiceManager', 'Save Changes'),
translate('OpenLP.ServiceManager', 'The current service has '
'been modified, would you like to save it?'),
QtGui.QMessageBox.Save | QtGui.QMessageBox.Discard |
QtGui.QMessageBox.Cancel, QtGui.QMessageBox.Save)
result = self.saveModifiedService()
if result == QtGui.QMessageBox.Cancel:
return False
elif result == QtGui.QMessageBox.Save:
@ -397,11 +387,13 @@ class ServiceManager(QtGui.QWidget):
split_filename(fileName)[0])
self.loadFile(fileName)
def onSaveServiceClicked(self):
self.saveFile()
def onSaveServiceAsClicked(self):
self.saveFileAs()
def saveModifiedService(self):
return QtGui.QMessageBox.question(self.mainwindow,
translate('OpenLP.ServiceManager', 'Modified Service'),
translate('OpenLP.ServiceManager', 'The current service has '
'been modified. Would you like to save this service?'),
QtGui.QMessageBox.Save | QtGui.QMessageBox.Discard |
QtGui.QMessageBox.Cancel, QtGui.QMessageBox.Save)
def onRecentServiceClicked(self):
sender = self.sender()

View File

@ -55,7 +55,6 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
self.thememanager = parent
self.setupUi(self)
self.registerFields()
self.accepted = False
self.updateThemeAllowed = True
QtCore.QObject.connect(self.backgroundComboBox,
QtCore.SIGNAL(u'currentIndexChanged(int)'),
@ -120,14 +119,12 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
QtCore.QObject.connect(self.mainFontComboBox,
QtCore.SIGNAL(u'activated(int)'),
self.calculateLines)
QtCore.QObject.connect(self, QtCore.SIGNAL(u'accepted()'), self.accept)
def setDefaults(self):
"""
Set up display at start of theme edit.
"""
self.restart()
self.accepted = False
self.setBackgroundPageValues()
self.setMainAreaPageValues()
self.setFooterAreaPageValues()
@ -250,25 +247,27 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
"""
Change state as Outline check box changed
"""
if state == QtCore.Qt.Checked:
self.theme.font_main_outline = True
else:
self.theme.font_main_outline = False
self.outlineColorButton.setEnabled(self.theme.font_main_outline)
self.outlineSizeSpinBox.setEnabled(self.theme.font_main_outline)
self.calculateLines()
if self.updateThemeAllowed:
if state == QtCore.Qt.Checked:
self.theme.font_main_outline = True
else:
self.theme.font_main_outline = False
self.outlineColorButton.setEnabled(self.theme.font_main_outline)
self.outlineSizeSpinBox.setEnabled(self.theme.font_main_outline)
self.calculateLines()
def onShadowCheckCheckBoxStateChanged(self, state):
"""
Change state as Shadow check box changed
"""
if state == QtCore.Qt.Checked:
self.theme.font_main_shadow = True
else:
self.theme.font_main_shadow = False
self.shadowColorButton.setEnabled(self.theme.font_main_shadow)
self.shadowSizeSpinBox.setEnabled(self.theme.font_main_shadow)
self.calculateLines()
if self.updateThemeAllowed:
if state == QtCore.Qt.Checked:
self.theme.font_main_shadow = True
else:
self.theme.font_main_shadow = False
self.shadowColorButton.setEnabled(self.theme.font_main_shadow)
self.shadowSizeSpinBox.setEnabled(self.theme.font_main_shadow)
self.calculateLines()
def onMainPositionCheckBoxStateChanged(self, value):
"""
@ -446,9 +445,10 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
"""
Background gradient Combo box has changed.
"""
self.theme.background_direction = \
BackgroundGradientType.to_string(index)
self.setBackgroundPageValues()
if self.updateThemeAllowed:
self.theme.background_direction = \
BackgroundGradientType.to_string(index)
self.setBackgroundPageValues()
def onColorButtonClicked(self):
"""
@ -560,13 +560,8 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
"""
Lets save the them as Finish has been pressed
"""
# Some reason getting double submission.
# Hack to stop it for now.
if self.accepted:
return
# Save the theme name
self.theme.theme_name = \
unicode(self.field(u'name').toString())
self.theme.theme_name = unicode(self.field(u'name').toString())
if not self.theme.theme_name:
criticalErrorMessageBox(
translate('OpenLP.ThemeForm', 'Theme Name Missing'),
@ -590,7 +585,6 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
if not self.edit_mode and \
not self.thememanager.checkIfThemeExists(self.theme.theme_name):
return
self.accepted = True
self.thememanager.saveTheme(self.theme, saveFrom, saveTo)
return QtGui.QDialog.accept(self)

View File

@ -137,10 +137,7 @@ class AppLocation(object):
os.path.split(openlp.__file__)[0])
return os.path.join(app_path, u'i18n')
else:
return _get_os_dir_path(u'openlp',
os.path.join(os.getenv(u'HOME'), u'Library',
u'Application Support', u'openlp'),
None, os.path.join(os.getenv(u'HOME'), u'.openlp'), dir_type)
return _get_os_dir_path(dir_type)
@staticmethod
def get_data_path():
@ -163,17 +160,18 @@ class AppLocation(object):
os.makedirs(path)
return path
def _get_os_dir_path(win_option, darwin_option, base_dir_option,
non_base_dir_option, dir_type=1):
def _get_os_dir_path(dir_type):
"""
Return a path based on which OS and environment we are running in.
"""
if sys.platform == u'win32':
return os.path.join(os.getenv(u'APPDATA'), win_option)
return os.path.join(os.getenv(u'APPDATA'), u'openlp')
elif sys.platform == u'darwin':
if dir_type == AppLocation.DataDir:
return os.path.join(darwin_option, u'Data')
return darwin_option
return os.path.join(os.getenv(u'HOME'), u'Library',
u'Application Support', u'openlp', u'Data')
return os.path.join(os.getenv(u'HOME'), u'Library',
u'Application Support', u'openlp')
else:
if XDG_BASE_AVAILABLE:
if dir_type == AppLocation.ConfigDir:
@ -183,7 +181,7 @@ def _get_os_dir_path(win_option, darwin_option, base_dir_option,
elif dir_type == AppLocation.CacheDir:
return os.path.join(BaseDirectory.xdg_cache_home, u'openlp')
else:
return non_base_dir_option
return os.path.join(os.getenv(u'HOME'), u'.openlp')
def _get_frozen_path(frozen_option, non_frozen_option):
"""

View File

@ -45,15 +45,14 @@ class AlertsPlugin(Plugin):
self.icon = build_icon(u':/plugins/plugin_alerts.png')
self.alertsmanager = AlertsManager(self)
self.manager = Manager(u'alerts', init_schema)
visible_name = self.getString(StringContent.VisibleName)
self.alertForm = AlertForm(self, visible_name[u'title'])
self.visible_name = self.getString(StringContent.VisibleName)
self.alertForm = AlertForm(self)
def getSettingsTab(self):
"""
Return the settings tab for the Alerts plugin
"""
visible_name = self.getString(StringContent.VisibleName)
self.alertsTab = AlertsTab(self, visible_name[u'title'])
self.alertsTab = AlertsTab(self, self.visible_name[u'title'])
return self.alertsTab
def addToolsMenuItem(self, tools_menu):

View File

@ -35,7 +35,7 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
"""
Provide UI for the alert system
"""
def __init__(self, plugin, visible_title):
def __init__(self, plugin):
"""
Initialise the alert form
"""

View File

@ -92,7 +92,7 @@ class BibleFormat(object):
return None
@staticmethod
def list():
def get_formats_list():
"""
Return a list of the supported Bible formats.
"""

View File

@ -19,7 +19,7 @@ IBS-fordítás (Új Károli), KAR
King James Version, KJV
Luther 1984, LUT
Septuaginta, LXX
Neue Genfer Übersetzung, NGÜ
Neue Genfer Übersetzung, NGU
New International Readers Version, NIRV
New International Version, NIV
Neues Leben, NL

1 عربي ARA
19 King James Version KJV
20 Luther 1984 LUT
21 Septuaginta LXX
22 Neue Genfer Übersetzung NGÜ NGU
23 New International Readers Version NIRV
24 New International Version NIV
25 Neues Leben NL

View File

@ -68,9 +68,6 @@ class CustomMediaItem(MediaManagerItem):
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'custom_preview'), self.onPreviewClick)
def requiredIcons(self):
MediaManagerItem.requiredIcons(self)
def initialise(self):
self.loadCustomListView(self.manager.get_all_objects(
CustomSlide, order_by_ref=CustomSlide.title))
@ -182,4 +179,4 @@ class CustomMediaItem(MediaManagerItem):
else:
raw_footer.append(u'')
service_item.raw_footer = raw_footer
return True
return True

View File

@ -31,7 +31,7 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon, \
ItemCapabilities, SettingsManager, translate, check_item_selected, \
check_directory_exists
check_directory_exists, Receiver
from openlp.core.ui import criticalErrorMessageBox
from openlp.core.utils import AppLocation, delete_file, get_images_filter
@ -44,7 +44,6 @@ class ImageListView(BaseListWithDnD):
self.PluginName = u'Images'
BaseListWithDnD.__init__(self, parent)
class ImageMediaItem(MediaManagerItem):
"""
This is the custom media manager item for images.
@ -57,6 +56,8 @@ class ImageMediaItem(MediaManagerItem):
# be instanced by the base MediaManagerItem.
self.ListViewWithDnD_class = ImageListView
MediaManagerItem.__init__(self, parent, self, icon)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'live_theme_changed'), self.liveThemeChanged)
def retranslateUi(self):
self.OnNewPrompt = translate('ImagePlugin.MediaItem',
@ -193,6 +194,12 @@ class ImageMediaItem(MediaManagerItem):
self.resetAction.setVisible(False)
self.parent.liveController.display.resetImage()
def liveThemeChanged(self):
"""
Triggered by the change of theme in the slide controller
"""
self.resetAction.setVisible(False)
def onReplaceClick(self):
"""
Called to replace Live backgound with the image selected.
@ -213,6 +220,3 @@ class ImageMediaItem(MediaManagerItem):
unicode(translate('ImagePlugin.MediaItem',
'There was a problem replacing your background, '
'the image file "%s" no longer exists.')) % filename)
def onPreviewClick(self):
MediaManagerItem.onPreviewClick(self)

View File

@ -30,7 +30,7 @@ import os
from PyQt4 import QtCore, QtGui
from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon, \
ItemCapabilities, SettingsManager, translate, check_item_selected
ItemCapabilities, SettingsManager, translate, check_item_selected, Receiver
from openlp.core.ui import criticalErrorMessageBox
log = logging.getLogger(__name__)
@ -58,6 +58,9 @@ class MediaMediaItem(MediaManagerItem):
MediaManagerItem.__init__(self, parent, self, icon)
self.singleServiceItem = False
self.serviceItemIconName = u':/media/image_clapperboard.png'
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'video_background_replaced'),
self.videobackgroundReplaced)
def retranslateUi(self):
self.OnNewPrompt = translate('MediaPlugin.MediaItem', 'Select Media')
@ -99,6 +102,12 @@ class MediaMediaItem(MediaManagerItem):
self.resetAction.setVisible(False)
self.parent.liveController.display.resetVideo()
def videobackgroundReplaced(self):
"""
Triggered by main display on change of serviceitem
"""
self.resetAction.setVisible(False)
def onReplaceClick(self):
"""
Called to replace Live backgound with the media selected.

View File

@ -171,11 +171,11 @@ class ImpressController(PresentationController):
desktop = self.get_com_desktop()
#Sometimes we get a failure and desktop is None
if not desktop:
log.exception(u'Failed to terminate OpenOffice')
log.exception(u'Failed to find an OpenOffice desktop to terminate')
return
docs = desktop.getComponents()
if docs.hasElements():
log.debug(u'OpenOffice not terminated')
log.debug(u'OpenOffice not terminated as docs are still open')
else:
try:
desktop.terminate()

View File

@ -314,11 +314,11 @@ class EasiSlidesImport(SongImport):
pass
def _listHas(self, lst, subitems):
for i in subitems:
if type(lst) == type({}) and lst.has_key(i):
lst = lst[i]
elif type(lst) == type([]) and i in lst:
lst = lst[i]
for subitem in subitems:
if isinstance(lst, dict) and lst.has_key(subitem):
lst = lst[subitem]
elif isinstance(lst, list) and subitem in lst:
lst = lst[subitem]
else:
return False
return True

View File

@ -105,7 +105,7 @@ class SongFormat(object):
return None
@staticmethod
def list():
def get_formats_list():
"""
Return a list of the supported song formats.
"""

View File

@ -68,9 +68,6 @@ class SongMediaItem(MediaManagerItem):
self.editItem = None
self.whitespace = re.compile(r'\W+', re.UNICODE)
def requiredIcons(self):
MediaManagerItem.requiredIcons(self)
def addEndHeaderBar(self):
self.addToolbarSeparator()
## Song Maintenance Button ##

View File

@ -66,31 +66,34 @@ class OooImport(SongImport):
QtCore.SIGNAL(u'openlp_stop_wizard'), self.stop_import)
def do_import(self):
self.abort = False
self.stop_import_flag = False
self.import_wizard.progressBar.setMaximum(0)
self.start_ooo()
for filename in self.filenames:
if self.abort:
if self.stop_import_flag:
self.import_wizard.incrementProgressBar(u'Import cancelled', 0)
return
filename = unicode(filename)
if os.path.isfile(filename):
self.open_ooo_file(filename)
if self.document:
if self.document.supportsService(
"com.sun.star.presentation.PresentationDocument"):
self.process_pres()
if self.document.supportsService(
"com.sun.star.text.TextDocument"):
self.process_doc()
self.process_ooo_document()
self.close_ooo_file()
self.close_ooo()
self.import_wizard.progressBar.setMaximum(1)
self.import_wizard.incrementProgressBar(u'', 1)
return True
def stop_import(self):
self.abort = True
def process_ooo_document(self):
"""
Handle the import process for OpenOffice files. This method facilitates
allowing subclasses to handle specific types of OpenOffice files.
"""
if self.document.supportsService(
"com.sun.star.presentation.PresentationDocument"):
self.process_pres()
if self.document.supportsService("com.sun.star.text.TextDocument"):
self.process_doc()
def start_ooo(self):
"""
@ -180,7 +183,7 @@ class OooImport(SongImport):
slides = doc.getDrawPages()
text = u''
for slide_no in range(slides.getCount()):
if self.abort:
if self.stop_import_flag:
self.import_wizard.incrementProgressBar(u'Import cancelled', 0)
return
slide = slides.getByIndex(slide_no)

View File

@ -75,23 +75,11 @@ class SofImport(OooImport):
"""
OooImport.__init__(self, master_manager, **kwargs)
def do_import(self):
self.abort = False
self.start_ooo()
for filename in self.filenames:
if self.abort:
self.import_wizard.incrementProgressBar(u'Import cancelled', 0)
return
filename = unicode(filename)
if os.path.isfile(filename):
self.open_ooo_file(filename)
if self.document:
self.process_sof_file()
self.close_ooo_file()
self.close_ooo()
self.import_wizard.progressBar.setMaximum(1)
self.import_wizard.incrementProgressBar(u'', 1)
return True
def process_ooo_document(self):
"""
Handle the import process for SoF files.
"""
self.process_sof_file()
def process_sof_file(self):
"""
@ -101,7 +89,7 @@ class SofImport(OooImport):
self.new_song()
paragraphs = self.document.getText().createEnumeration()
while paragraphs.hasMoreElements():
if self.abort:
if self.stop_import_flag:
self.import_wizard.incrementProgressBar(u'Import cancelled', 0)
return
paragraph = paragraphs.nextElement()