This commit is contained in:
Tim Bentley 2010-10-13 20:40:39 +01:00
commit 5e485a0673
11 changed files with 152 additions and 102 deletions

View File

@ -1,7 +1,7 @@
.. _plugins-bibles: .. _plugins-bibles:
:mod:`bibles` Plugin Bibles Plugin
==================== =============
.. automodule:: openlp.plugins.bibles .. automodule:: openlp.plugins.bibles
:members: :members:
@ -60,8 +60,8 @@
.. autoclass:: openlp.plugins.bibles.lib.http.HTTPBible .. autoclass:: openlp.plugins.bibles.lib.http.HTTPBible
:members: :members:
:mod:`bibleOSISimpl` :mod:`osis`
^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^
.. automodule:: openlp.plugins.bibles.lib.osis .. automodule:: openlp.plugins.bibles.lib.osis
:members: :members:
@ -69,18 +69,21 @@
.. autoclass:: openlp.plugins.bibles.lib.osis.OSISBible .. autoclass:: openlp.plugins.bibles.lib.osis.OSISBible
:members: :members:
:mod:`opensong`
^^^^^^^^^^^^^^^
.. automodule:: openlp.plugins.bibles.lib.opensong
:members:
.. autoclass:: openlp.plugins.bibles.lib.opensong.OpenSongBible
:members:
:mod:`biblestab` :mod:`biblestab`
^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^
.. automodule:: openlp.plugins.bibles.lib.biblestab .. automodule:: openlp.plugins.bibles.lib.biblestab
:members: :members:
:mod:`common`
^^^^^^^^^^^^^
.. automodule:: openlp.plugins.bibles.lib.common
:members:
:mod:`manager` :mod:`manager`
^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^

View File

@ -0,0 +1,8 @@
.. _plugins-images:
Images Plugin
=============
.. automodule:: openlp.plugins.images
:members:

View File

@ -11,24 +11,9 @@
songs songs
bibles bibles
presentations
:mod:`presentations` Plugin media
--------------------------- images
.. automodule:: openlp.plugins.presentations
:members:
:mod:`media` Plugin
-------------------
.. automodule:: openlp.plugins.media
:members:
:mod:`images` Plugin
--------------------
.. automodule:: openlp.plugins.images
:members:
:mod:`custom` Plugin :mod:`custom` Plugin
-------------------- --------------------

View File

@ -0,0 +1,8 @@
.. _plugins-media:
Media Plugin
============
.. automodule:: openlp.plugins.media
:members:

View File

@ -0,0 +1,40 @@
.. _plugins-presentations:
Presentations Plugin
====================
Plugin Class
------------
.. autoclass:: openlp.plugins.presentations.presentationplugin.PresentationPlugin
:members:
Helper Classes & Functions
--------------------------
.. automodule:: openlp.plugins.presentations.lib
:members:
.. automodule:: openlp.plugins.presentations.lib.mediaitem
:members:
.. automodule:: openlp.plugins.presentations.lib.presentationtab
:members:
.. automodule:: openlp.plugins.presentations.lib.messagelistener
:members:
.. automodule:: openlp.plugins.presentations.lib.presentationcontroller
:members:
Presentation Application Controllers
------------------------------------
.. automodule:: openlp.plugins.presentations.lib.impresscontroller
:members:
.. automodule:: openlp.plugins.presentations.lib.pptviewcontroller
:members:
.. automodule:: openlp.plugins.presentations.lib.powerpointcontroller
:members:

View File

@ -1,7 +1,7 @@
.. _plugins-songs: .. _plugins-songs:
:mod:`songs` Plugin Songs Plugin
=================== ============
.. automodule:: openlp.plugins.songs .. automodule:: openlp.plugins.songs
:members: :members:

View File

@ -24,6 +24,6 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA # # Temple Place, Suite 330, Boston, MA 02111-1307 USA #
############################################################################### ###############################################################################
""" """
The :mod:`bibles' module provides the Bible plugin to enable OpenLP to display The :mod:`bibles` module provides the Bible plugin to enable OpenLP to display
scripture. scripture.
""" """

View File

@ -60,22 +60,32 @@ def parse_reference(reference):
and converts it to a reference list, a list of references to be queried and converts it to a reference list, a list of references to be queried
from the Bible database files. from the Bible database files.
BIBLE_REFERENCE regular expression produces the following match groups: The ``BIBLE_REFERENCE`` constant regular expression produces the following
0 This is a special group consisting of the whole string that matched. match groups:
1 [\w ]+ The book the reference is from.
2 [0-9]+ The first (or only) chapter in the reference. 0. (match string)
3 None|[0-9]+ None or the only verse or the first verse in a This is a special group consisting of the whole string that matched.
verse range or the start verse in a chapter range. 1. ``[\w ]+``
4 None|[0-9]+|end None or the end verse of the first verse range or The book the reference is from.
the end chapter of a chapter range. 2. ``[0-9]+``
5 None|[0-9]+ None or the second chapter in multiple The first (or only) chapter in the reference.
(non-ranged) chapters. 3. ``None`` or ``[0-9]+``
6 None|[0-9]+|end None, the start of the second verse range or the ``None``, or the only verse, or the first verse in a verse range or,
end of a chapter range. the start verse in a chapter range.
7 None|[0-9]+|end None or the end of the second verse range. 4. ``None`` or ``[0-9]+`` or ``end``
``None``, or the end verse of the first verse range, or the end chapter
of a chapter range.
5. ``None`` or ``[0-9]+``
``None``, or the second chapter in multiple (non-ranged) chapters.
6. ``None`` or ``[0-9]+`` or ``end``
``None``, the start of the second verse range. or the end of a chapter
range.
7. ``None`` or ``[0-9]+`` or ``end``
``None``, or the end of the second verse range.
The reference list is a list of tuples, with each tuple structured like The reference list is a list of tuples, with each tuple structured like
this:: this::
(book, chapter, start_verse, end_verse) (book, chapter, start_verse, end_verse)
``reference`` ``reference``
@ -154,7 +164,7 @@ def parse_reference(reference):
class SearchResults(object): class SearchResults(object):
""" """
Encapsulate a set of search results. This is Bible-type independant. Encapsulate a set of search results. This is Bible-type independent.
""" """
def __init__(self, book, chapter, verselist): def __init__(self, book, chapter, verselist):
""" """

View File

@ -110,10 +110,10 @@ class PowerpointDocument(PresentationDocument):
""" """
Class which holds information and controls a single presentation Class which holds information and controls a single presentation
""" """
def __init__(self, controller, presentation): def __init__(self, controller, presentation):
""" """
Constructor, store information about the file and initialise Constructor, store information about the file and initialise
""" """
log.debug(u'Init Presentation Powerpoint') log.debug(u'Init Presentation Powerpoint')
PresentationDocument.__init__(self, controller, presentation) PresentationDocument.__init__(self, controller, presentation)
@ -125,13 +125,13 @@ class PowerpointDocument(PresentationDocument):
Opens the PowerPoint file using the process created earlier Opens the PowerPoint file using the process created earlier
``presentation`` ``presentation``
The file name of the presentations to run. The file name of the presentations to run.
""" """
log.debug(u'LoadPresentation') log.debug(u'LoadPresentation')
if not self.controller.process or not self.controller.process.Visible: if not self.controller.process or not self.controller.process.Visible:
self.controller.start_process() self.controller.start_process()
try: try:
self.controller.process.Presentations.Open(self.filepath, False, self.controller.process.Presentations.Open(self.filepath, False,
False, True) False, True)
except pywintypes.com_error: except pywintypes.com_error:
return False return False
@ -143,22 +143,24 @@ class PowerpointDocument(PresentationDocument):
def create_thumbnails(self): def create_thumbnails(self):
""" """
Create the thumbnail images for the current presentation. Create the thumbnail images for the current presentation.
Note an alternative and quicker method would be do
Note an alternative and quicker method would be do::
self.presentation.Slides[n].Copy() self.presentation.Slides[n].Copy()
thumbnail = QApplication.clipboard.image() thumbnail = QApplication.clipboard.image()
But for now we want a physical file since it makes
life easier elsewhere However, for the moment, we want a physical file since it makes life
easier elsewhere.
""" """
if self.check_thumbnails(): if self.check_thumbnails():
return return
self.presentation.Export(os.path.join(self.get_thumbnail_folder(), ''), self.presentation.Export(os.path.join(self.get_thumbnail_folder(), ''),
'png', 320, 240) 'png', 320, 240)
def close_presentation(self): def close_presentation(self):
""" """
Close presentation and clean up objects Close presentation and clean up objects. This is triggered by a new
Triggerent by new object being added to SlideController orOpenLP object being added to SlideController or OpenLP being shut down.
being shut down
""" """
log.debug(u'ClosePresentation') log.debug(u'ClosePresentation')
if self.presentation: if self.presentation:
@ -171,7 +173,7 @@ class PowerpointDocument(PresentationDocument):
def is_loaded(self): def is_loaded(self):
""" """
Returns true if a presentation is loaded Returns ``True`` if a presentation is loaded.
""" """
try: try:
if not self.controller.process.Visible: if not self.controller.process.Visible:
@ -187,7 +189,7 @@ class PowerpointDocument(PresentationDocument):
def is_active(self): def is_active(self):
""" """
Returns true if a presentation is currently active Returns ``True`` if a presentation is currently active.
""" """
if not self.is_loaded(): if not self.is_loaded():
return False return False
@ -202,7 +204,7 @@ class PowerpointDocument(PresentationDocument):
def unblank_screen(self): def unblank_screen(self):
""" """
Unblanks (restores) the presentationn Unblanks (restores) the presentation.
""" """
self.presentation.SlideShowSettings.Run() self.presentation.SlideShowSettings.Run()
self.presentation.SlideShowWindow.View.State = 1 self.presentation.SlideShowWindow.View.State = 1
@ -210,13 +212,13 @@ class PowerpointDocument(PresentationDocument):
def blank_screen(self): def blank_screen(self):
""" """
Blanks the screen Blanks the screen.
""" """
self.presentation.SlideShowWindow.View.State = 3 self.presentation.SlideShowWindow.View.State = 3
def is_blank(self): def is_blank(self):
""" """
Returns true if screen is blank Returns ``True`` if screen is blank.
""" """
if self.is_active(): if self.is_active():
return self.presentation.SlideShowWindow.View.State == 3 return self.presentation.SlideShowWindow.View.State == 3
@ -225,14 +227,14 @@ class PowerpointDocument(PresentationDocument):
def stop_presentation(self): def stop_presentation(self):
""" """
Stops the current presentation and hides the output Stops the current presentation and hides the output.
""" """
self.presentation.SlideShowWindow.View.Exit() self.presentation.SlideShowWindow.View.Exit()
if os.name == u'nt': if os.name == u'nt':
def start_presentation(self): def start_presentation(self):
""" """
Starts a presentation from the beginning Starts a presentation from the beginning.
""" """
#SlideShowWindow measures its size/position by points, not pixels #SlideShowWindow measures its size/position by points, not pixels
try: try:
@ -254,40 +256,40 @@ class PowerpointDocument(PresentationDocument):
def get_slide_number(self): def get_slide_number(self):
""" """
Returns the current slide number Returns the current slide number.
""" """
return self.presentation.SlideShowWindow.View.CurrentShowPosition return self.presentation.SlideShowWindow.View.CurrentShowPosition
def get_slide_count(self): def get_slide_count(self):
""" """
Returns total number of slides Returns total number of slides.
""" """
return self.presentation.Slides.Count return self.presentation.Slides.Count
def goto_slide(self, slideno): def goto_slide(self, slideno):
""" """
Moves to a specific slide in the presentation Moves to a specific slide in the presentation.
""" """
self.presentation.SlideShowWindow.View.GotoSlide(slideno) self.presentation.SlideShowWindow.View.GotoSlide(slideno)
def next_step(self): def next_step(self):
""" """
Triggers the next effect of slide on the running presentation Triggers the next effect of slide on the running presentation.
""" """
self.presentation.SlideShowWindow.View.Next() self.presentation.SlideShowWindow.View.Next()
def previous_step(self): def previous_step(self):
""" """
Triggers the previous slide on the running presentation Triggers the previous slide on the running presentation.
""" """
self.presentation.SlideShowWindow.View.Previous() self.presentation.SlideShowWindow.View.Previous()
def get_slide_text(self, slide_no): def get_slide_text(self, slide_no):
""" """
Returns the text on the slide Returns the text on the slide.
``slide_no`` ``slide_no``
The slide the text is required for, starting at 1 The slide the text is required for, starting at 1.
""" """
text = '' text = ''
shapes = self.presentation.Slides(slide_no).Shapes shapes = self.presentation.Slides(slide_no).Shapes
@ -299,10 +301,10 @@ class PowerpointDocument(PresentationDocument):
def get_slide_notes(self, slide_no): def get_slide_notes(self, slide_no):
""" """
Returns the text on the slide Returns the text on the slide.
``slide_no`` ``slide_no``
The slide the notes are required for, starting at 1 The slide the notes are required for, starting at 1.
""" """
text = '' text = ''
shapes = self.presentation.Slides(slide_no).NotesPage.Shapes shapes = self.presentation.Slides(slide_no).NotesPage.Shapes

View File

@ -37,16 +37,21 @@ log = logging.getLogger(__name__)
class PresentationController(object): class PresentationController(object):
""" """
Base class for presentation controllers to inherit from This class is used to control interactions with presentation applications
Class to control interactions with presentations. by creating a runtime environment. This is a base class for presentation
It creates the runtime environment controllers to inherit from.
To create a new controller, take a copy of this file and name it
so it ends in controller.py, i.e. foobarcontroller.py To create a new controller, take a copy of this file and name it so it ends
Make sure it inherits PresentationController with ``controller.py``, i.e. ``foobarcontroller.py``. Make sure it inherits
Then fill in the blanks. If possible try and make sure it loads :class:`~openlp.plugins.presentations.lib.presentationcontroller.PresentationController`,
on all platforms, using for example os.name checks, although and then fill in the blanks. If possible try to make sure it loads on all
__init__, check_available and presentation_deleted should always work. platforms, usually by using :mod:``os.name`` checks, although
See impresscontroller, powerpointcontroller or pptviewcontroller ``__init__``, ``check_available`` and ``presentation_deleted`` should
always be implemented.
See :class:`~openlp.plugins.presentations.lib.impresscontroller.ImpressController`,
:class:`~openlp.plugins.presentations.lib.powerpointcontroller.PowerpointController` or
:class:`~openlp.plugins.presentations.lib.pptviewcontroller.PptviewController`
for examples. for examples.
**Basic Attributes** **Basic Attributes**
@ -70,7 +75,7 @@ class PresentationController(object):
``alsosupports`` ``alsosupports``
Other file types the application can import, although not necessarily Other file types the application can import, although not necessarily
the first choice due to potential incompatibilities the first choice due to potential incompatibilities
**Hook Functions** **Hook Functions**
``kill()`` ``kill()``
@ -246,7 +251,7 @@ class PresentationDocument(object):
``presentation`` ``presentation``
The file name of the presentations to the run. The file name of the presentations to the run.
Returns False if the file could not be opened Returns False if the file could not be opened
""" """
return False return False
@ -387,7 +392,7 @@ class PresentationDocument(object):
if os.path.isfile(file): if os.path.isfile(file):
img = resize_image(file, 320, 240) img = resize_image(file, 320, 240)
img.save(self.get_thumbnail_path(idx, False)) img.save(self.get_thumbnail_path(idx, False))
def get_thumbnail_path(self, slide_no, check_exists): def get_thumbnail_path(self, slide_no, check_exists):
""" """
Returns an image path containing a preview for the requested slide Returns an image path containing a preview for the requested slide

View File

@ -66,27 +66,16 @@ class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog):
self.verseTextEdit.setFocus() self.verseTextEdit.setFocus()
def onInsertButtonClicked(self): def onInsertButtonClicked(self):
if self.verseTextEdit.textCursor().columnNumber() != 0:
self.verseTextEdit.insertPlainText(u'\n')
verse_type = self.verseTypeComboBox.currentIndex() verse_type = self.verseTypeComboBox.currentIndex()
if verse_type == VerseType.Verse: if VerseType.to_string(verse_type) is not None:
self.insertVerse(VerseType.to_string(VerseType.Verse), self.insertVerse(VerseType.to_string(verse_type),
self.verseNumberBox.value()) self.verseNumberBox.value())
elif verse_type == VerseType.Chorus:
self.insertVerse(VerseType.to_string(VerseType.Chorus),
self.verseNumberBox.value())
elif verse_type == VerseType.Bridge:
self.insertVerse(VerseType.to_string(VerseType.Bridge))
elif verse_type == VerseType.PreChorus:
self.insertVerse(VerseType.to_string(VerseType.PreChorus))
elif verse_type == VerseType.Intro:
self.insertVerse(VerseType.to_string(VerseType.Intro))
elif verse_type == VerseType.Ending:
self.insertVerse(VerseType.to_string(VerseType.Ending))
elif verse_type == VerseType.Other:
self.insertVerse(VerseType.to_string(VerseType.Other))
def onCursorPositionChanged(self): def onCursorPositionChanged(self):
"""
Determines the previous verse type and number in regard to the cursor's
position and adjusts the ComboBox and SpinBox to these values.
"""
position = self.verseTextEdit.textCursor().position() position = self.verseTextEdit.textCursor().position()
text = unicode(self.verseTextEdit.toPlainText()) text = unicode(self.verseTextEdit.toPlainText())
if not text: if not text: