forked from openlp/openlp
Head
This commit is contained in:
commit
8a83cb6e25
@ -159,6 +159,22 @@ def resize_image(image, width, height):
|
||||
painter.drawImage((width - realw) / 2, (height - realh) / 2, preview)
|
||||
return new_image
|
||||
|
||||
def check_item_selected(list_widget, message):
|
||||
"""
|
||||
Check if a list item is selected so an action may be performed on it
|
||||
|
||||
``list_widget``
|
||||
The list to check for selected items
|
||||
|
||||
``message``
|
||||
The message to give the user if no item is selected
|
||||
"""
|
||||
if not list_widget.selectedIndexes():
|
||||
QtGui.QMessageBox.information(list_widget.parent(),
|
||||
translate('MediaManagerItem', 'No Items Selected'), message)
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
class ThemeLevel(object):
|
||||
"""
|
||||
|
@ -32,7 +32,6 @@ class BaseListWithDnD(QtGui.QListWidget):
|
||||
|
||||
def __init__(self, parent=None):
|
||||
QtGui.QListWidget.__init__(self, parent)
|
||||
self.parent = parent
|
||||
# this must be set by the class which is inheriting
|
||||
assert(self.PluginName)
|
||||
|
||||
|
@ -343,19 +343,6 @@ class MediaManagerItem(QtGui.QWidget):
|
||||
"""
|
||||
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('MediaManagerItem', 'No Items Selected'), message)
|
||||
return False
|
||||
return True
|
||||
|
||||
def onFileClick(self):
|
||||
files = QtGui.QFileDialog.getOpenFileNames(
|
||||
self, self.OnNewPrompt,
|
||||
|
@ -50,6 +50,7 @@ class Ui_AmendThemeDialog(object):
|
||||
self.ThemeNameLayout.addWidget(self.ThemeNameLabel)
|
||||
self.ThemeNameEdit = QtGui.QLineEdit(self.ThemeNameWidget)
|
||||
self.ThemeNameEdit.setObjectName(u'ThemeNameEdit')
|
||||
self.ThemeNameLabel.setBuddy(self.ThemeNameEdit)
|
||||
self.ThemeNameLayout.addWidget(self.ThemeNameEdit)
|
||||
self.AmendThemeLayout.addWidget(self.ThemeNameWidget)
|
||||
self.ContentWidget = QtGui.QWidget(AmendThemeDialog)
|
||||
@ -72,6 +73,7 @@ class Ui_AmendThemeDialog(object):
|
||||
self.BackgroundLabel)
|
||||
self.BackgroundComboBox = QtGui.QComboBox(self.BackgroundTab)
|
||||
self.BackgroundComboBox.setObjectName(u'BackgroundComboBox')
|
||||
self.BackgroundLabel.setBuddy(self.BackgroundComboBox)
|
||||
self.BackgroundComboBox.addItem(QtCore.QString())
|
||||
self.BackgroundComboBox.addItem(QtCore.QString())
|
||||
self.BackgroundLayout.setWidget(0, QtGui.QFormLayout.FieldRole,
|
||||
@ -752,9 +754,9 @@ class Ui_AmendThemeDialog(object):
|
||||
AmendThemeDialog.setWindowTitle(
|
||||
translate('AmendThemeForm', 'Theme Maintenance'))
|
||||
self.ThemeNameLabel.setText(
|
||||
translate('AmendThemeForm', 'Theme Name:'))
|
||||
translate('AmendThemeForm', 'Theme &Name:'))
|
||||
self.BackgroundLabel.setText(
|
||||
translate('AmendThemeForm', 'Visibility:'))
|
||||
translate('AmendThemeForm', '&Visibility:'))
|
||||
self.BackgroundComboBox.setItemText(0,
|
||||
translate('AmendThemeForm', 'Opaque'))
|
||||
self.BackgroundComboBox.setItemText(1,
|
||||
|
@ -35,7 +35,7 @@ from openlp.core.ui import AmendThemeForm
|
||||
from openlp.core.theme import Theme
|
||||
from openlp.core.lib import OpenLPToolbar, context_menu_action, \
|
||||
ThemeXML, str_to_bool, get_text_file_string, build_icon, Receiver, \
|
||||
context_menu_separator, SettingsManager, translate
|
||||
context_menu_separator, SettingsManager, translate, check_item_selected
|
||||
from openlp.core.utils import AppLocation, get_filesystem_encoding
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
@ -182,8 +182,9 @@ class ThemeManager(QtGui.QWidget):
|
||||
Loads the settings for the theme that is to be edited and launches the
|
||||
theme editing form so the user can make their changes.
|
||||
"""
|
||||
item = self.ThemeListWidget.currentItem()
|
||||
if item:
|
||||
if check_item_selected(self.ThemeListWidget, translate('ThemeManager',
|
||||
'You must select a theme to edit.')):
|
||||
item = self.ThemeListWidget.currentItem()
|
||||
theme = self.getThemeData(
|
||||
unicode(item.data(QtCore.Qt.UserRole).toString()))
|
||||
self.amendThemeForm.loadTheme(theme)
|
||||
@ -198,8 +199,9 @@ class ThemeManager(QtGui.QWidget):
|
||||
self.global_theme = unicode(QtCore.QSettings().value(
|
||||
self.settingsSection + u'/global theme',
|
||||
QtCore.QVariant(u'')).toString())
|
||||
item = self.ThemeListWidget.currentItem()
|
||||
if item:
|
||||
if check_item_selected(self.ThemeListWidget, translate('ThemeManager',
|
||||
'You must select a theme to delete.')):
|
||||
item = self.ThemeListWidget.currentItem()
|
||||
theme = unicode(item.text())
|
||||
# should be the same unless default
|
||||
if theme != unicode(item.data(QtCore.Qt.UserRole).toString()):
|
||||
|
@ -43,7 +43,8 @@ class BibleListView(BaseListWithDnD):
|
||||
BaseListWithDnD.__init__(self, parent)
|
||||
|
||||
def resizeEvent(self, event):
|
||||
self.parent.onListViewResize(event.size().width(), event.size().width())
|
||||
self.parent().onListViewResize(event.size().width(),
|
||||
event.size().width())
|
||||
|
||||
|
||||
class BibleMediaItem(MediaManagerItem):
|
||||
|
@ -62,10 +62,13 @@ class OSISBible(BibleDB):
|
||||
self.fi_regex = re.compile(r'<FI>(.*?)<Fi>')
|
||||
self.rf_regex = re.compile(r'<RF>(.*?)<Rf>')
|
||||
self.lb_regex = re.compile(r'<lb(.*?)>')
|
||||
self.lg_regex = re.compile(r'<lg(.*?)>')
|
||||
self.l_regex = re.compile(r'<l (.*?)>')
|
||||
self.w_regex = re.compile(r'<w (.*?)>')
|
||||
self.q_regex = re.compile(r'<q (.*?)>')
|
||||
self.q1_regex = re.compile(r'<q(.*?)level="1"(.*?)>')
|
||||
self.q2_regex = re.compile(r'<q(.*?)level="2"(.*?)>')
|
||||
self.trans_regex = re.compile(r'<transChange(.*?)>(.*?)</transChange>')
|
||||
self.divineName_regex = re.compile(r'<divineName(.*?)>(.*?)</divineName>')
|
||||
self.spaces_regex = re.compile(r'([ ]{2,})')
|
||||
self.books = {}
|
||||
filepath = os.path.join(
|
||||
@ -96,7 +99,7 @@ class OSISBible(BibleDB):
|
||||
detect_file = None
|
||||
try:
|
||||
detect_file = open(self.filename, u'r')
|
||||
details = chardet.detect(detect_file.read())
|
||||
details = chardet.detect(detect_file.read(1048576))
|
||||
except IOError:
|
||||
log.exception(u'Failed to detect OSIS file encoding')
|
||||
return
|
||||
@ -150,11 +153,14 @@ class OSISBible(BibleDB):
|
||||
verse_text = self.milestone_regex.sub(u'', verse_text)
|
||||
verse_text = self.fi_regex.sub(u'', verse_text)
|
||||
verse_text = self.rf_regex.sub(u'', verse_text)
|
||||
verse_text = self.lb_regex.sub(u'', verse_text)
|
||||
verse_text = self.lb_regex.sub(u' ', verse_text)
|
||||
verse_text = self.lg_regex.sub(u'', verse_text)
|
||||
verse_text = self.l_regex.sub(u'', verse_text)
|
||||
verse_text = self.w_regex.sub(u'', verse_text)
|
||||
verse_text = self.q_regex.sub(u'', verse_text)
|
||||
verse_text = self.q1_regex.sub(u'"', verse_text)
|
||||
verse_text = self.q2_regex.sub(u'\'', verse_text)
|
||||
verse_text = self.trans_regex.sub(u'', verse_text)
|
||||
verse_text = self.divineName_regex.sub(u'', verse_text)
|
||||
verse_text = verse_text.replace(u'</lb>', u'')\
|
||||
.replace(u'</l>', u'').replace(u'<lg>', u'')\
|
||||
.replace(u'</lg>', u'').replace(u'</q>', u'')\
|
||||
|
@ -43,6 +43,7 @@ class Ui_customEditDialog(object):
|
||||
self.TitleLabel.setObjectName(u'TitleLabel')
|
||||
self.horizontalLayout.addWidget(self.TitleLabel)
|
||||
self.TitleEdit = QtGui.QLineEdit(customEditDialog)
|
||||
self.TitleLabel.setBuddy(self.TitleEdit)
|
||||
self.TitleEdit.setObjectName(u'TitleEdit')
|
||||
self.horizontalLayout.addWidget(self.TitleEdit)
|
||||
self.gridLayout.addLayout(self.horizontalLayout, 0, 0, 1, 1)
|
||||
@ -118,6 +119,7 @@ class Ui_customEditDialog(object):
|
||||
self.ThemeLabel.setObjectName(u'ThemeLabel')
|
||||
self.horizontalLayout_3.addWidget(self.ThemeLabel)
|
||||
self.ThemeComboBox = QtGui.QComboBox(customEditDialog)
|
||||
self.ThemeLabel.setBuddy(self.ThemeComboBox)
|
||||
self.ThemeComboBox.setObjectName(u'ThemeComboBox')
|
||||
self.horizontalLayout_3.addWidget(self.ThemeComboBox)
|
||||
self.gridLayout.addLayout(self.horizontalLayout_3, 3, 0, 1, 1)
|
||||
@ -127,6 +129,7 @@ class Ui_customEditDialog(object):
|
||||
self.CreditLabel.setObjectName(u'CreditLabel')
|
||||
self.horizontalLayout_2.addWidget(self.CreditLabel)
|
||||
self.CreditEdit = QtGui.QLineEdit(customEditDialog)
|
||||
self.CreditLabel.setBuddy(self.CreditEdit)
|
||||
self.CreditEdit.setObjectName(u'CreditEdit')
|
||||
self.horizontalLayout_2.addWidget(self.CreditEdit)
|
||||
self.gridLayout.addLayout(self.horizontalLayout_2, 4, 0, 1, 1)
|
||||
@ -162,7 +165,7 @@ class Ui_customEditDialog(object):
|
||||
self.DownButton.setToolTip(
|
||||
translate('CustomPlugin.EditCustomForm', 'Move slide down 1'))
|
||||
self.TitleLabel.setText(
|
||||
translate('CustomPlugin.EditCustomForm', 'Title:'))
|
||||
translate('CustomPlugin.EditCustomForm', '&Title:'))
|
||||
self.AddButton.setText(
|
||||
translate('CustomPlugin.EditCustomForm', 'Add New'))
|
||||
self.AddButton.setToolTip(
|
||||
@ -192,7 +195,7 @@ class Ui_customEditDialog(object):
|
||||
self.SplitButton.setToolTip(
|
||||
translate('CustomPlugin.EditCustomForm', 'Add slide split'))
|
||||
self.ThemeLabel.setText(
|
||||
translate('CustomPlugin.EditCustomForm', 'Theme:'))
|
||||
translate('CustomPlugin.EditCustomForm', 'The&me:'))
|
||||
self.CreditLabel.setText(
|
||||
translate('CustomPlugin.EditCustomForm', 'Credits:'))
|
||||
translate('CustomPlugin.EditCustomForm', '&Credits:'))
|
||||
|
||||
|
@ -28,7 +28,7 @@ import logging
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import MediaManagerItem, SongXMLParser, BaseListWithDnD, \
|
||||
Receiver, ItemCapabilities, translate
|
||||
Receiver, ItemCapabilities, translate, check_item_selected
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
@ -118,7 +118,8 @@ class CustomMediaItem(MediaManagerItem):
|
||||
"""
|
||||
Edit a custom item
|
||||
"""
|
||||
if self.checkItemSelected(translate('CustomPlugin.MediaItem',
|
||||
if check_item_selected(self.ListView,
|
||||
translate('CustomPlugin.MediaItem',
|
||||
'You must select an item to edit.')):
|
||||
item = self.ListView.currentItem()
|
||||
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
|
||||
@ -130,7 +131,8 @@ class CustomMediaItem(MediaManagerItem):
|
||||
"""
|
||||
Remove a custom item from the list and database
|
||||
"""
|
||||
if self.checkItemSelected(translate('CustomPlugin.MediaItem',
|
||||
if check_item_selected(self.ListView,
|
||||
translate('CustomPlugin.MediaItem',
|
||||
'You must select an item to delete.')):
|
||||
item = self.ListView.currentItem()
|
||||
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
|
||||
|
@ -29,7 +29,8 @@ import os
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon, \
|
||||
context_menu_action, ItemCapabilities, SettingsManager, translate
|
||||
context_menu_action, ItemCapabilities, SettingsManager, translate, \
|
||||
check_item_selected
|
||||
from openlp.core.utils import AppLocation, get_images_filter
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
@ -116,7 +117,7 @@ class ImageMediaItem(MediaManagerItem):
|
||||
"""
|
||||
Remove an image item from the list
|
||||
"""
|
||||
if self.checkItemSelected(translate('ImagePlugin.MediaItem',
|
||||
if check_item_selected(self.ListView, translate('ImagePlugin.MediaItem',
|
||||
'You must select an item to delete.')):
|
||||
items = self.ListView.selectedIndexes()
|
||||
for item in items:
|
||||
|
@ -29,7 +29,7 @@ import os
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon, \
|
||||
ItemCapabilities, SettingsManager, translate
|
||||
ItemCapabilities, SettingsManager, translate, check_item_selected
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
@ -141,7 +141,7 @@ class MediaMediaItem(MediaManagerItem):
|
||||
"""
|
||||
Remove a media item from the list
|
||||
"""
|
||||
if self.checkItemSelected(translate('MediaPlugin.MediaItem',
|
||||
if check_item_selected(self.ListView, translate('MediaPlugin.MediaItem',
|
||||
'You must select an item to delete.')):
|
||||
item = self.ListView.currentItem()
|
||||
row = self.ListView.row(item)
|
||||
|
@ -331,7 +331,10 @@ class ImpressDocument(PresentationDocument):
|
||||
|
||||
def stop_presentation(self):
|
||||
log.debug(u'stop presentation OpenOffice')
|
||||
self.control.deactivate()
|
||||
# deactivate should hide the screen according to docs, but doesn't
|
||||
#self.control.deactivate()
|
||||
self.presentation.end()
|
||||
self.control = None
|
||||
|
||||
def start_presentation(self):
|
||||
log.debug(u'start presentation OpenOffice')
|
||||
|
@ -29,7 +29,7 @@ import os
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon, \
|
||||
SettingsManager, translate
|
||||
SettingsManager, translate, check_item_selected
|
||||
from openlp.core.utils import AppLocation
|
||||
from openlp.plugins.presentations.lib import MessageListener
|
||||
|
||||
@ -177,7 +177,8 @@ class PresentationMediaItem(MediaManagerItem):
|
||||
"""
|
||||
Remove a presentation item from the list
|
||||
"""
|
||||
if self.checkItemSelected(translate('PresentationPlugin.MediaItem',
|
||||
if check_item_selected(self.ListView,
|
||||
translate('PresentationPlugin.MediaItem',
|
||||
'You must select an item to delete.')):
|
||||
item = self.ListView.currentItem()
|
||||
row = self.ListView.row(item)
|
||||
|
@ -41,31 +41,31 @@ class Controller(object):
|
||||
log.info(u'Controller loaded')
|
||||
|
||||
def __init__(self, live):
|
||||
self.isLive = live
|
||||
self.is_live = live
|
||||
self.doc = None
|
||||
log.info(u'%s controller loaded' % live)
|
||||
|
||||
def addHandler(self, controller, file, isBlank):
|
||||
log.debug(u'Live = %s, addHandler %s' % (self.isLive, file))
|
||||
def add_handler(self, controller, file, is_blank):
|
||||
log.debug(u'Live = %s, add_handler %s' % (self.is_live, file))
|
||||
self.controller = controller
|
||||
if self.doc is not None:
|
||||
self.shutdown()
|
||||
self.doc = self.controller.add_doc(file)
|
||||
self.doc.load_presentation()
|
||||
if self.isLive:
|
||||
if self.is_live:
|
||||
self.doc.start_presentation()
|
||||
if isBlank:
|
||||
if is_blank:
|
||||
self.blank()
|
||||
Receiver.send_message(u'maindisplay_hide', HideMode.Screen)
|
||||
self.doc.slidenumber = 0
|
||||
|
||||
def activate(self):
|
||||
log.debug(u'Live = %s, activate' % self.isLive)
|
||||
log.debug(u'Live = %s, activate' % self.is_live)
|
||||
if self.doc.is_active():
|
||||
return
|
||||
if not self.doc.is_loaded():
|
||||
self.doc.load_presentation()
|
||||
if self.isLive:
|
||||
if self.is_live:
|
||||
self.doc.start_presentation()
|
||||
if self.doc.slidenumber > 1:
|
||||
self.doc.goto_slide(self.doc.slidenumber)
|
||||
@ -85,36 +85,36 @@ class Controller(object):
|
||||
"""
|
||||
Based on the handler passed at startup triggers the first slide
|
||||
"""
|
||||
log.debug(u'Live = %s, first' % self.isLive)
|
||||
if not self.isLive:
|
||||
log.debug(u'Live = %s, first' % self.is_live)
|
||||
if not self.is_live:
|
||||
return
|
||||
if self.doc.is_blank():
|
||||
self.doc.slidenumber = 1
|
||||
return
|
||||
self.activate()
|
||||
self.doc.start_presentation()
|
||||
self.doc.poll_slidenumber(self.isLive)
|
||||
self.doc.poll_slidenumber(self.is_live)
|
||||
|
||||
def last(self):
|
||||
"""
|
||||
Based on the handler passed at startup triggers the first slide
|
||||
"""
|
||||
log.debug(u'Live = %s, last' % self.isLive)
|
||||
if not self.isLive:
|
||||
log.debug(u'Live = %s, last' % self.is_live)
|
||||
if not self.is_live:
|
||||
return
|
||||
if self.doc.is_blank():
|
||||
self.doc.slidenumber = self.doc.get_slide_count()
|
||||
return
|
||||
self.activate()
|
||||
self.doc.goto_slide(self.doc.get_slide_count())
|
||||
self.doc.poll_slidenumber(self.isLive)
|
||||
self.doc.poll_slidenumber(self.is_live)
|
||||
|
||||
def next(self):
|
||||
"""
|
||||
Based on the handler passed at startup triggers the next slide event
|
||||
"""
|
||||
log.debug(u'Live = %s, next' % self.isLive)
|
||||
if not self.isLive:
|
||||
log.debug(u'Live = %s, next' % self.is_live)
|
||||
if not self.is_live:
|
||||
return
|
||||
if self.doc.is_blank():
|
||||
if self.doc.slidenumber < self.doc.get_slide_count():
|
||||
@ -122,14 +122,14 @@ class Controller(object):
|
||||
return
|
||||
self.activate()
|
||||
self.doc.next_step()
|
||||
self.doc.poll_slidenumber(self.isLive)
|
||||
self.doc.poll_slidenumber(self.is_live)
|
||||
|
||||
def previous(self):
|
||||
"""
|
||||
Based on the handler passed at startup triggers the previous slide event
|
||||
"""
|
||||
log.debug(u'Live = %s, previous' % self.isLive)
|
||||
if not self.isLive:
|
||||
log.debug(u'Live = %s, previous' % self.is_live)
|
||||
if not self.is_live:
|
||||
return
|
||||
if self.doc.is_blank():
|
||||
if self.doc.slidenumber > 1:
|
||||
@ -137,14 +137,14 @@ class Controller(object):
|
||||
return
|
||||
self.activate()
|
||||
self.doc.previous_step()
|
||||
self.doc.poll_slidenumber(self.isLive)
|
||||
self.doc.poll_slidenumber(self.is_live)
|
||||
|
||||
def shutdown(self):
|
||||
"""
|
||||
Based on the handler passed at startup triggers slide show to shut down
|
||||
"""
|
||||
log.debug(u'Live = %s, shutdown' % self.isLive)
|
||||
if self.isLive:
|
||||
log.debug(u'Live = %s, shutdown' % self.is_live)
|
||||
if self.is_live:
|
||||
Receiver.send_message(u'maindisplay_show')
|
||||
self.doc.close_presentation()
|
||||
self.doc = None
|
||||
@ -152,8 +152,8 @@ class Controller(object):
|
||||
#self.timer.stop()
|
||||
|
||||
def blank(self):
|
||||
log.debug(u'Live = %s, blank' % self.isLive)
|
||||
if not self.isLive:
|
||||
log.debug(u'Live = %s, blank' % self.is_live)
|
||||
if not self.is_live:
|
||||
return
|
||||
if not self.doc.is_loaded():
|
||||
return
|
||||
@ -162,8 +162,8 @@ class Controller(object):
|
||||
self.doc.blank_screen()
|
||||
|
||||
def stop(self):
|
||||
log.debug(u'Live = %s, stop' % self.isLive)
|
||||
if not self.isLive:
|
||||
log.debug(u'Live = %s, stop' % self.is_live)
|
||||
if not self.is_live:
|
||||
return
|
||||
if not self.doc.is_loaded():
|
||||
return
|
||||
@ -172,8 +172,8 @@ class Controller(object):
|
||||
self.doc.stop_presentation()
|
||||
|
||||
def unblank(self):
|
||||
log.debug(u'Live = %s, unblank' % self.isLive)
|
||||
if not self.isLive:
|
||||
log.debug(u'Live = %s, unblank' % self.is_live)
|
||||
if not self.is_live:
|
||||
return
|
||||
self.activate()
|
||||
if self.doc.slidenumber and \
|
||||
@ -183,7 +183,7 @@ class Controller(object):
|
||||
Receiver.send_message(u'maindisplay_hide', HideMode.Screen)
|
||||
|
||||
def poll(self):
|
||||
self.doc.poll_slidenumber(self.isLive)
|
||||
self.doc.poll_slidenumber(self.is_live)
|
||||
|
||||
class MessageListener(object):
|
||||
"""
|
||||
@ -195,8 +195,8 @@ class MessageListener(object):
|
||||
def __init__(self, mediaitem):
|
||||
self.controllers = mediaitem.controllers
|
||||
self.mediaitem = mediaitem
|
||||
self.previewHandler = Controller(False)
|
||||
self.liveHandler = Controller(True)
|
||||
self.preview_handler = Controller(False)
|
||||
self.live_handler = Controller(True)
|
||||
# messages are sent from core.ui.slidecontroller
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'presentations_start'), self.startup)
|
||||
@ -228,9 +228,10 @@ class MessageListener(object):
|
||||
Start of new presentation
|
||||
Save the handler as any new presentations start here
|
||||
"""
|
||||
isLive, item = self.decode_message(message)
|
||||
is_live = message[1]
|
||||
item = message[0]
|
||||
log.debug(u'Startup called with message %s' % message)
|
||||
isBlank = message[2]
|
||||
is_blank = message[2]
|
||||
file = os.path.join(item.get_frame_path(),
|
||||
item.get_frame_title())
|
||||
self.handler = item.title
|
||||
@ -238,75 +239,71 @@ class MessageListener(object):
|
||||
self.handler = self.mediaitem.findControllerByType(file)
|
||||
if not self.handler:
|
||||
return
|
||||
if isLive:
|
||||
controller = self.liveHandler
|
||||
if is_live:
|
||||
controller = self.live_handler
|
||||
else:
|
||||
controller = self.previewHandler
|
||||
controller.addHandler(self.controllers[self.handler], file, isBlank)
|
||||
|
||||
def decode_message(self, message):
|
||||
if len(message) == 3:
|
||||
return message[1], message[0], message[2]
|
||||
else:
|
||||
return message[1], message[0]
|
||||
controller = self.preview_handler
|
||||
controller.add_handler(self.controllers[self.handler], file, is_blank)
|
||||
|
||||
def slide(self, message):
|
||||
isLive, item, slide = self.decode_message(message)
|
||||
if isLive:
|
||||
self.liveHandler.slide(slide, isLive)
|
||||
is_live = message[1]
|
||||
slide = message[2]
|
||||
item = message[0]
|
||||
if is_live:
|
||||
self.live_handler.slide(slide, item)
|
||||
else:
|
||||
self.previewHandler.slide(slide, isLive)
|
||||
self.preview_handler.slide(slide, item)
|
||||
|
||||
def first(self, message):
|
||||
isLive = self.decode_message(message)[0]
|
||||
if isLive:
|
||||
self.liveHandler.first()
|
||||
is_live = message[1]
|
||||
if is_live:
|
||||
self.live_handler.first()
|
||||
else:
|
||||
self.previewHandler.first()
|
||||
self.preview_handler.first()
|
||||
|
||||
def last(self, message):
|
||||
isLive = self.decode_message(message)[0]
|
||||
if isLive:
|
||||
self.liveHandler.last()
|
||||
is_live = message[1]
|
||||
if is_live:
|
||||
self.live_handler.last()
|
||||
else:
|
||||
self.previewHandler.last()
|
||||
self.preview_handler.last()
|
||||
|
||||
def next(self, message):
|
||||
isLive = self.decode_message(message)[0]
|
||||
if isLive:
|
||||
self.liveHandler.next()
|
||||
is_live = message[1]
|
||||
if is_live:
|
||||
self.live_handler.next()
|
||||
else:
|
||||
self.previewHandler.next()
|
||||
self.preview_handler.next()
|
||||
|
||||
def previous(self, message):
|
||||
isLive = self.decode_message(message)[0]
|
||||
if isLive:
|
||||
self.liveHandler.previous()
|
||||
is_live = message[1]
|
||||
if is_live:
|
||||
self.live_handler.previous()
|
||||
else:
|
||||
self.previewHandler.previous()
|
||||
self.preview_handler.previous()
|
||||
|
||||
def shutdown(self, message):
|
||||
isLive = self.decode_message(message)[0]
|
||||
if isLive:
|
||||
is_live = message[1]
|
||||
if is_live:
|
||||
Receiver.send_message(u'maindisplay_show')
|
||||
self.liveHandler.shutdown()
|
||||
self.live_handler.shutdown()
|
||||
else:
|
||||
self.previewHandler.shutdown()
|
||||
self.preview_handler.shutdown()
|
||||
|
||||
def hide(self, message):
|
||||
isLive = self.decode_message(message)[0]
|
||||
if isLive:
|
||||
self.liveHandler.stop()
|
||||
is_live = message[1]
|
||||
if is_live:
|
||||
self.live_handler.stop()
|
||||
|
||||
def blank(self, message):
|
||||
isLive = self.decode_message(message)[0]
|
||||
if isLive:
|
||||
self.liveHandler.blank()
|
||||
is_live = message[1]
|
||||
if is_live:
|
||||
self.live_handler.blank()
|
||||
|
||||
def unblank(self, message):
|
||||
isLive = self.decode_message(message)[0]
|
||||
if isLive:
|
||||
self.liveHandler.unblank()
|
||||
is_live = message[1]
|
||||
if is_live:
|
||||
self.live_handler.unblank()
|
||||
|
||||
def timeout(self):
|
||||
self.liveHandler.poll()
|
||||
self.live_handler.poll()
|
||||
|
@ -30,6 +30,7 @@ if os.name == u'nt':
|
||||
from win32com.client import Dispatch
|
||||
import _winreg
|
||||
import win32ui
|
||||
import pywintypes
|
||||
|
||||
from presentationcontroller import PresentationController, PresentationDocument
|
||||
|
||||
@ -65,7 +66,7 @@ class PowerpointController(PresentationController):
|
||||
_winreg.OpenKey(_winreg.HKEY_CLASSES_ROOT,
|
||||
u'PowerPoint.Application').Close()
|
||||
return True
|
||||
except:
|
||||
except WindowsError:
|
||||
pass
|
||||
return False
|
||||
|
||||
@ -91,7 +92,7 @@ class PowerpointController(PresentationController):
|
||||
return
|
||||
try:
|
||||
self.process.Quit()
|
||||
except:
|
||||
except pywintypes.com_error:
|
||||
pass
|
||||
self.process = None
|
||||
|
||||
@ -121,11 +122,8 @@ class PowerpointDocument(PresentationDocument):
|
||||
log.debug(u'LoadPresentation')
|
||||
if not self.controller.process.Visible:
|
||||
self.controller.start_process()
|
||||
#try:
|
||||
self.controller.process.Presentations.Open(self.filepath, False, False,
|
||||
True)
|
||||
#except:
|
||||
# return
|
||||
self.presentation = self.controller.process.Presentations(
|
||||
self.controller.process.Presentations.Count)
|
||||
self.create_thumbnails()
|
||||
@ -154,7 +152,7 @@ class PowerpointDocument(PresentationDocument):
|
||||
if self.presentation:
|
||||
try:
|
||||
self.presentation.Close()
|
||||
except:
|
||||
except pywintypes.com_error:
|
||||
pass
|
||||
self.presentation = None
|
||||
self.controller.remove_doc(self)
|
||||
@ -170,7 +168,7 @@ class PowerpointDocument(PresentationDocument):
|
||||
return False
|
||||
if self.controller.process.Presentations.Count == 0:
|
||||
return False
|
||||
except:
|
||||
except (AttributeError, pywintypes.com_error):
|
||||
return False
|
||||
return True
|
||||
|
||||
@ -186,7 +184,7 @@ class PowerpointDocument(PresentationDocument):
|
||||
return False
|
||||
if self.presentation.SlideShowWindow.View is None:
|
||||
return False
|
||||
except:
|
||||
except (AttributeError, pywintypes.com_error):
|
||||
return False
|
||||
return True
|
||||
|
||||
@ -208,7 +206,10 @@ class PowerpointDocument(PresentationDocument):
|
||||
"""
|
||||
Returns true if screen is blank
|
||||
"""
|
||||
return self.presentation.SlideShowWindow.View.State == 3
|
||||
if self.is_active():
|
||||
return self.presentation.SlideShowWindow.View.State == 3
|
||||
else:
|
||||
return False
|
||||
|
||||
def stop_presentation(self):
|
||||
"""
|
||||
@ -224,11 +225,11 @@ class PowerpointDocument(PresentationDocument):
|
||||
#SlideShowWindow measures its size/position by points, not pixels
|
||||
try:
|
||||
dpi = win32ui.GetActiveWindow().GetDC().GetDeviceCaps(88)
|
||||
except:
|
||||
except win32ui.error:
|
||||
try:
|
||||
dpi = \
|
||||
win32ui.GetForegroundWindow().GetDC().GetDeviceCaps(88)
|
||||
except:
|
||||
except win32ui.error:
|
||||
dpi = 96
|
||||
self.presentation.SlideShowSettings.Run()
|
||||
self.presentation.SlideShowWindow.View.GotoSlide(1)
|
||||
|
@ -58,10 +58,7 @@ class PptviewController(PresentationController):
|
||||
log.debug(u'check_available')
|
||||
if os.name != u'nt':
|
||||
return False
|
||||
try:
|
||||
return self.check_installed()
|
||||
except:
|
||||
return False
|
||||
return self.check_installed()
|
||||
|
||||
if os.name == u'nt':
|
||||
def check_installed(self):
|
||||
@ -72,7 +69,7 @@ class PptviewController(PresentationController):
|
||||
try:
|
||||
self.start_process()
|
||||
return self.process.CheckInstalled()
|
||||
except:
|
||||
except WindowsError:
|
||||
return False
|
||||
|
||||
def start_process(self):
|
||||
@ -84,6 +81,7 @@ class PptviewController(PresentationController):
|
||||
log.debug(u'start PPTView')
|
||||
self.process = cdll.LoadLibrary(
|
||||
r'openlp\plugins\presentations\lib\pptviewlib\pptviewlib.dll')
|
||||
#self.process.SetDebug(1)
|
||||
|
||||
def kill(self):
|
||||
"""
|
||||
@ -106,6 +104,7 @@ class PptviewDocument(PresentationDocument):
|
||||
self.presentation = None
|
||||
self.pptid = None
|
||||
self.blanked = False
|
||||
self.hidden = False
|
||||
|
||||
def load_presentation(self):
|
||||
"""
|
||||
@ -123,13 +122,11 @@ class PptviewDocument(PresentationDocument):
|
||||
rect = rendermanager.screens.current[u'size']
|
||||
rect = RECT(rect.x(), rect.y(), rect.right(), rect.bottom())
|
||||
filepath = str(self.filepath.replace(u'/', u'\\'))
|
||||
try:
|
||||
self.pptid = self.controller.process.OpenPPT(filepath, None, rect,
|
||||
str(os.path.join(self.thumbnailpath,
|
||||
self.controller.thumbnailprefix)))
|
||||
self.pptid = self.controller.process.OpenPPT(filepath, None, rect,
|
||||
str(os.path.join(self.thumbnailpath,
|
||||
self.controller.thumbnailprefix)))
|
||||
if self.pptid:
|
||||
self.stop_presentation()
|
||||
except:
|
||||
log.exception(u'Failed to load presentation')
|
||||
|
||||
def close_presentation(self):
|
||||
"""
|
||||
@ -156,7 +153,7 @@ class PptviewDocument(PresentationDocument):
|
||||
"""
|
||||
Returns true if a presentation is currently active
|
||||
"""
|
||||
return self.is_loaded()
|
||||
return self.is_loaded() and not self.hidden
|
||||
|
||||
def blank_screen(self):
|
||||
"""
|
||||
@ -183,13 +180,18 @@ class PptviewDocument(PresentationDocument):
|
||||
"""
|
||||
Stops the current presentation and hides the output
|
||||
"""
|
||||
self.hidden = True
|
||||
self.controller.process.Stop(self.pptid)
|
||||
|
||||
def start_presentation(self):
|
||||
"""
|
||||
Starts a presentation from the beginning
|
||||
"""
|
||||
self.controller.process.RestartShow(self.pptid)
|
||||
if self.hidden:
|
||||
self.hidden = False
|
||||
self.controller.process.Resume(self.pptid)
|
||||
else:
|
||||
self.controller.process.RestartShow(self.pptid)
|
||||
|
||||
def get_slide_number(self):
|
||||
"""
|
||||
|
@ -23,6 +23,8 @@ This README.TXT must be distributed with the pptviewlib.dll
|
||||
|
||||
This library has a limit of 50 PowerPoints which can be opened simultaneously.
|
||||
|
||||
This project can be built with the free Microsoft Visual C++ 2008 Express Edition.
|
||||
|
||||
USAGE
|
||||
-----
|
||||
BOOL CheckInstalled(void);
|
||||
|
@ -150,7 +150,7 @@ DllExport int OpenPPT(char *filename, HWND hParentWnd, RECT rect, char *previewp
|
||||
pptviewobj[id].rect.bottom = rect.bottom;
|
||||
pptviewobj[id].rect.right = rect.right;
|
||||
}
|
||||
strcat_s(cmdline, MAX_PATH * 2, "/S \"");
|
||||
strcat_s(cmdline, MAX_PATH * 2, "/F /S \"");
|
||||
strcat_s(cmdline, MAX_PATH * 2, filename);
|
||||
strcat_s(cmdline, MAX_PATH * 2, "\"");
|
||||
memset(&si, 0, sizeof(si));
|
||||
@ -211,7 +211,7 @@ DllExport int OpenPPT(char *filename, HWND hParentWnd, RECT rect, char *previewp
|
||||
}
|
||||
DEBUG("OpenPPT: Steps %d, first slide steps %d\n",pptviewobj[id].steps,pptviewobj[id].firstSlideSteps);
|
||||
SavePPTInfo(id);
|
||||
if(pptviewobj[id].state==PPT_CLOSING){
|
||||
if(pptviewobj[id].state==PPT_CLOSING||pptviewobj[id].slideCount<=0){
|
||||
ClosePPT(id);
|
||||
id=-1;
|
||||
}
|
||||
|
Binary file not shown.
@ -50,6 +50,7 @@ class Ui_EditSongDialog(object):
|
||||
self.TitleLabel.setObjectName(u'TitleLabel')
|
||||
self.LyricsTabLayout.addWidget(self.TitleLabel, 0, 0, 1, 1)
|
||||
self.TitleEditItem = QtGui.QLineEdit(self.LyricsTab)
|
||||
self.TitleLabel.setBuddy(self.TitleEditItem)
|
||||
sizePolicy = QtGui.QSizePolicy(
|
||||
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
@ -63,6 +64,7 @@ class Ui_EditSongDialog(object):
|
||||
self.AlternativeTitleLabel.setObjectName(u'AlternativeTitleLabel')
|
||||
self.LyricsTabLayout.addWidget(self.AlternativeTitleLabel, 1, 0, 1, 1)
|
||||
self.AlternativeEdit = QtGui.QLineEdit(self.LyricsTab)
|
||||
self.AlternativeTitleLabel.setBuddy(self.AlternativeEdit)
|
||||
self.AlternativeEdit.setObjectName(u'AlternativeEdit')
|
||||
self.LyricsTabLayout.addWidget(self.AlternativeEdit, 1, 1, 1, 2)
|
||||
self.LyricsLabel = QtGui.QLabel(self.LyricsTab)
|
||||
@ -71,6 +73,7 @@ class Ui_EditSongDialog(object):
|
||||
self.LyricsLabel.setObjectName(u'LyricsLabel')
|
||||
self.LyricsTabLayout.addWidget(self.LyricsLabel, 2, 0, 1, 1)
|
||||
self.VerseListWidget = QtGui.QTableWidget(self.LyricsTab)
|
||||
self.LyricsLabel.setBuddy(self.VerseListWidget)
|
||||
self.VerseListWidget.setColumnCount(1)
|
||||
self.VerseListWidget.horizontalHeader().setVisible(False)
|
||||
self.VerseListWidget.setSelectionBehavior(1)
|
||||
@ -83,6 +86,7 @@ class Ui_EditSongDialog(object):
|
||||
self.VerseOrderLabel.setObjectName(u'VerseOrderLabel')
|
||||
self.LyricsTabLayout.addWidget(self.VerseOrderLabel, 4, 0, 1, 1)
|
||||
self.VerseOrderEdit = QtGui.QLineEdit(self.LyricsTab)
|
||||
self.VerseOrderLabel.setBuddy(self.VerseOrderEdit)
|
||||
self.VerseOrderEdit.setObjectName(u'VerseOrderEdit')
|
||||
self.LyricsTabLayout.addWidget(self.VerseOrderEdit, 4, 1, 1, 2)
|
||||
self.VerseButtonWidget = QtGui.QWidget(self.LyricsTab)
|
||||
|
@ -28,7 +28,7 @@ import logging
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import MediaManagerItem, SongXMLParser, \
|
||||
BaseListWithDnD, Receiver, ItemCapabilities, translate
|
||||
BaseListWithDnD, Receiver, ItemCapabilities, translate, check_item_selected
|
||||
from openlp.plugins.songs.forms import EditSongForm, SongMaintenanceForm, \
|
||||
ImportWizardForm
|
||||
|
||||
@ -279,7 +279,7 @@ class SongMediaItem(MediaManagerItem):
|
||||
"""
|
||||
Edit a song
|
||||
"""
|
||||
if self.checkItemSelected(translate('SongsPlugin.MediaItem',
|
||||
if check_item_selected(self.ListView, translate('SongsPlugin.MediaItem',
|
||||
'You must select an item to edit.')):
|
||||
item = self.ListView.currentItem()
|
||||
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
|
||||
@ -290,7 +290,7 @@ class SongMediaItem(MediaManagerItem):
|
||||
"""
|
||||
Remove a song from the list and database
|
||||
"""
|
||||
if self.checkItemSelected(translate('SongsPlugin.MediaItem',
|
||||
if check_item_selected(self.ListView, translate('SongsPlugin.MediaItem',
|
||||
'You must select an item to delete.')):
|
||||
items = self.ListView.selectedIndexes()
|
||||
if len(items) == 1:
|
||||
|
4254
resources/i18n/openlp_af.ts
Normal file
4254
resources/i18n/openlp_af.ts
Normal file
File diff suppressed because one or more lines are too long
4259
resources/i18n/openlp_de.ts
Normal file
4259
resources/i18n/openlp_de.ts
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
4287
resources/i18n/openlp_en_GB.ts
Normal file
4287
resources/i18n/openlp_en_GB.ts
Normal file
File diff suppressed because it is too large
Load Diff
4457
resources/i18n/openlp_en_ZA.ts
Normal file
4457
resources/i18n/openlp_en_ZA.ts
Normal file
File diff suppressed because one or more lines are too long
4253
resources/i18n/openlp_es.ts
Normal file
4253
resources/i18n/openlp_es.ts
Normal file
File diff suppressed because it is too large
Load Diff
3904
resources/i18n/openlp_hu.ts
Normal file
3904
resources/i18n/openlp_hu.ts
Normal file
File diff suppressed because it is too large
Load Diff
4960
resources/i18n/openlp_ko.ts
Normal file
4960
resources/i18n/openlp_ko.ts
Normal file
File diff suppressed because it is too large
Load Diff
4491
resources/i18n/openlp_nb.ts
Normal file
4491
resources/i18n/openlp_nb.ts
Normal file
File diff suppressed because it is too large
Load Diff
4254
resources/i18n/openlp_pt_BR.ts
Normal file
4254
resources/i18n/openlp_pt_BR.ts
Normal file
File diff suppressed because it is too large
Load Diff
4262
resources/i18n/openlp_sv.ts
Normal file
4262
resources/i18n/openlp_sv.ts
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user