trunk r1122
|
@ -17,7 +17,7 @@ import sys
|
|||
# If extensions (or modules to document with autodoc) are in another directory,
|
||||
# add these directories to sys.path here. If the directory is relative to the
|
||||
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
||||
sys.path.insert(0, os.path.abspath(os.path.join('..', '..')))
|
||||
sys.path.insert(0, os.path.abspath(os.path.join('..', '..', '..')))
|
||||
|
||||
# -- General configuration -----------------------------------------------------
|
||||
|
||||
|
@ -39,7 +39,7 @@ master_doc = 'index'
|
|||
|
||||
# General information about the project.
|
||||
project = u'OpenLP'
|
||||
copyright = u'2009, Raoul Snyman'
|
||||
copyright = u'2004-2010, Raoul Snyman'
|
||||
|
||||
# The version info for the project you're documenting, acts as replacement for
|
||||
# |version| and |release|, also used in various other places throughout the
|
||||
|
@ -48,7 +48,7 @@ copyright = u'2009, Raoul Snyman'
|
|||
# The short X.Y version.
|
||||
version = '2.0'
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = '2.0.pre'
|
||||
release = '1.9.3'
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
|
@ -111,7 +111,7 @@ html_theme_options = {
|
|||
|
||||
# The name for this set of Sphinx documents. If None, it defaults to
|
||||
# "<project> v<release> documentation".
|
||||
#html_title = None
|
||||
html_title = 'OpenLP 2.0 Developer API'
|
||||
|
||||
# A shorter title for the navigation bar. Default is the same as html_title.
|
||||
#html_short_title = None
|
||||
|
@ -166,7 +166,7 @@ html_static_path = ['_static']
|
|||
#html_file_suffix = ''
|
||||
|
||||
# Output file base name for HTML help builder.
|
||||
htmlhelp_basename = 'OpenLPdoc'
|
||||
htmlhelp_basename = 'OpenLP-2.0-api'
|
||||
|
||||
|
||||
# -- Options for LaTeX output --------------------------------------------------
|
||||
|
@ -180,7 +180,7 @@ htmlhelp_basename = 'OpenLPdoc'
|
|||
# Grouping the document tree into LaTeX files. List of tuples
|
||||
# (source start file, target name, title, author, documentclass [howto/manual]).
|
||||
latex_documents = [
|
||||
('index', 'OpenLP.tex', u'OpenLP Documentation',
|
||||
('index', 'OpenLP.tex', u'OpenLP 2.0 Developer API',
|
||||
u'Raoul Snyman', 'manual'),
|
||||
]
|
||||
|
|
@ -3,9 +3,13 @@
|
|||
:mod:`core` Module
|
||||
==================
|
||||
|
||||
.. automodule:: openlp.core
|
||||
:members:
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
lib
|
||||
theme
|
||||
|
||||
ui
|
||||
utils
|
|
@ -1,7 +1,7 @@
|
|||
.. _core-lib:
|
||||
|
||||
:mod:`lib` Module
|
||||
=================
|
||||
Object Library
|
||||
==============
|
||||
|
||||
.. automodule:: openlp.core.lib
|
||||
:members:
|
|
@ -0,0 +1,27 @@
|
|||
.. _core-ui:
|
||||
|
||||
User Interface
|
||||
==============
|
||||
|
||||
.. automodule:: openlp.core.ui
|
||||
|
||||
Main Windows
|
||||
------------
|
||||
|
||||
.. autoclass:: openlp.core.ui.mainwindow.MainWindow
|
||||
:members:
|
||||
|
||||
.. autoclass:: openlp.core.ui.maindisplay.MainDisplay
|
||||
:members:
|
||||
|
||||
Managers
|
||||
--------
|
||||
|
||||
.. autoclass:: openlp.core.ui.servicemanager.ServiceManager
|
||||
:members:
|
||||
|
||||
.. autoclass:: openlp.core.ui.mediadockmanager.MediaDockManager
|
||||
:members:
|
||||
|
||||
.. autoclass:: openlp.core.ui.thememanager.ThemeManager
|
||||
:members:
|
|
@ -0,0 +1,7 @@
|
|||
.. _core-utils:
|
||||
|
||||
Utilities
|
||||
=========
|
||||
|
||||
.. automodule:: openlp.core.utils
|
||||
:members:
|
|
@ -15,7 +15,6 @@ Contents:
|
|||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
openlp
|
||||
core/index
|
||||
plugins/index
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
.. _plugins-alerts:
|
||||
|
||||
Alerts Plugin
|
||||
=============
|
||||
|
||||
.. automodule:: openlp.plugins.alerts
|
||||
:members:
|
||||
|
||||
Plugin Class
|
||||
------------
|
||||
|
||||
.. autoclass:: openlp.plugins.alerts.alertsplugin.AlertsPlugin
|
||||
:members:
|
||||
|
||||
Forms
|
||||
-----
|
||||
|
||||
.. automodule:: openlp.plugins.alerts.forms
|
||||
:members:
|
||||
|
||||
.. autoclass:: openlp.plugins.alerts.forms.alertform.AlertForm
|
||||
:members:
|
||||
|
||||
Helper Classes & Functions
|
||||
--------------------------
|
||||
|
||||
.. automodule:: openlp.plugins.alerts.lib
|
||||
:members:
|
||||
|
||||
.. automodule:: openlp.plugins.alerts.lib.db
|
||||
:members:
|
|
@ -0,0 +1,55 @@
|
|||
.. _plugins-bibles:
|
||||
|
||||
Bibles Plugin
|
||||
=============
|
||||
|
||||
.. automodule:: openlp.plugins.bibles
|
||||
:members:
|
||||
|
||||
Plugin Class
|
||||
------------
|
||||
|
||||
.. autoclass:: openlp.plugins.bibles.bibleplugin.BiblePlugin
|
||||
:members:
|
||||
|
||||
Forms
|
||||
-----
|
||||
|
||||
.. automodule:: openlp.plugins.bibles.forms
|
||||
:members:
|
||||
|
||||
.. autoclass:: openlp.plugins.bibles.forms.importwizardform.ImportWizardForm
|
||||
:members:
|
||||
|
||||
Helper Classes & Functions
|
||||
--------------------------
|
||||
|
||||
.. automodule:: openlp.plugins.bibles.lib
|
||||
:members:
|
||||
|
||||
.. automodule:: openlp.plugins.bibles.lib.db
|
||||
:members:
|
||||
|
||||
.. automodule:: openlp.plugins.bibles.lib.biblestab
|
||||
:members:
|
||||
|
||||
.. automodule:: openlp.plugins.bibles.lib.manager
|
||||
:members:
|
||||
|
||||
.. automodule:: openlp.plugins.bibles.lib.mediaitem
|
||||
:members:
|
||||
|
||||
Bible Importers
|
||||
---------------
|
||||
|
||||
.. automodule:: openlp.plugins.bibles.lib.csvbible
|
||||
:members:
|
||||
|
||||
.. automodule:: openlp.plugins.bibles.lib.http
|
||||
:members:
|
||||
|
||||
.. automodule:: openlp.plugins.bibles.lib.osis
|
||||
:members:
|
||||
|
||||
.. automodule:: openlp.plugins.bibles.lib.opensong
|
||||
:members:
|
|
@ -0,0 +1,34 @@
|
|||
.. _plugins-custom:
|
||||
|
||||
Custom Slides Plugin
|
||||
====================
|
||||
|
||||
.. automodule:: openlp.plugins.custom
|
||||
:members:
|
||||
|
||||
Plugin Class
|
||||
------------
|
||||
|
||||
.. autoclass:: openlp.plugins.custom.customplugin.CustomPlugin
|
||||
:members:
|
||||
|
||||
Forms
|
||||
-----
|
||||
|
||||
.. automodule:: openlp.plugins.custom.forms
|
||||
:members:
|
||||
|
||||
.. autoclass:: openlp.plugins.custom.forms.editcustomform.EditCustomForm
|
||||
:members:
|
||||
|
||||
.. autoclass:: openlp.plugins.custom.forms.editcustomslideform.EditCustomSlideForm
|
||||
:members:
|
||||
|
||||
Helper Classes & Functions
|
||||
--------------------------
|
||||
|
||||
.. automodule:: openlp.plugins.custom.lib
|
||||
:members:
|
||||
|
||||
.. automodule:: openlp.plugins.custom.lib.mediaitem
|
||||
:members:
|
|
@ -0,0 +1,22 @@
|
|||
.. _plugins-images:
|
||||
|
||||
Images Plugin
|
||||
=============
|
||||
|
||||
.. automodule:: openlp.plugins.images
|
||||
:members:
|
||||
|
||||
Plugin Class
|
||||
------------
|
||||
|
||||
.. autoclass:: openlp.plugins.images.imageplugin.ImagePlugin
|
||||
:members:
|
||||
|
||||
Helper Classes & Functions
|
||||
--------------------------
|
||||
|
||||
.. automodule:: openlp.plugins.images.lib
|
||||
:members:
|
||||
|
||||
.. automodule:: openlp.plugins.images.lib.mediaitem
|
||||
:members:
|
|
@ -0,0 +1,20 @@
|
|||
.. _plugins-index:
|
||||
|
||||
Plugins
|
||||
=======
|
||||
|
||||
.. automodule:: openlp.plugins
|
||||
:members:
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
songs
|
||||
bibles
|
||||
presentations
|
||||
media
|
||||
images
|
||||
custom
|
||||
remotes
|
||||
songusage
|
||||
alerts
|
|
@ -0,0 +1,22 @@
|
|||
.. _plugins-media:
|
||||
|
||||
Media Plugin
|
||||
============
|
||||
|
||||
.. automodule:: openlp.plugins.media
|
||||
:members:
|
||||
|
||||
Plugin Class
|
||||
------------
|
||||
|
||||
.. autoclass:: openlp.plugins.media.mediaplugin.MediaPlugin
|
||||
:members:
|
||||
|
||||
Helper Classes & Functions
|
||||
--------------------------
|
||||
|
||||
.. automodule:: openlp.plugins.media.lib
|
||||
:members:
|
||||
|
||||
.. automodule:: openlp.plugins.media.lib.mediaitem
|
||||
:members:
|
|
@ -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:
|
|
@ -0,0 +1,19 @@
|
|||
.. _plugins-remotes:
|
||||
|
||||
Remotes Plugin
|
||||
==============
|
||||
|
||||
.. automodule:: openlp.plugins.remotes
|
||||
:members:
|
||||
|
||||
Plugin Class
|
||||
------------
|
||||
|
||||
.. autoclass:: openlp.plugins.remotes.remoteplugin.RemotesPlugin
|
||||
:members:
|
||||
|
||||
Helper Classes & Functions
|
||||
--------------------------
|
||||
|
||||
.. automodule:: openlp.plugins.remotes.lib
|
||||
:members:
|
|
@ -0,0 +1,103 @@
|
|||
.. _plugins-songs:
|
||||
|
||||
Songs Plugin
|
||||
============
|
||||
|
||||
.. automodule:: openlp.plugins.songs
|
||||
:members:
|
||||
|
||||
Plugin Class
|
||||
------------
|
||||
|
||||
.. autoclass:: openlp.plugins.songs.songsplugin.SongsPlugin
|
||||
:members:
|
||||
|
||||
Forms
|
||||
-----
|
||||
|
||||
.. automodule:: openlp.plugins.songs.forms
|
||||
:members:
|
||||
|
||||
.. autoclass:: openlp.plugins.songs.forms.authorsform.AuthorsForm
|
||||
:members:
|
||||
|
||||
.. autoclass:: openlp.plugins.songs.forms.editsongform.EditSongForm
|
||||
:members:
|
||||
|
||||
.. autoclass:: openlp.plugins.songs.forms.editverseform.EditVerseForm
|
||||
:members:
|
||||
|
||||
.. autoclass:: openlp.plugins.songs.forms.songbookform.SongBookForm
|
||||
:members:
|
||||
|
||||
.. autoclass:: openlp.plugins.songs.forms.songimportform.SongImportForm
|
||||
:members:
|
||||
|
||||
.. autoclass:: openlp.plugins.songs.forms.songmaintenanceform.SongMaintenanceForm
|
||||
:members:
|
||||
|
||||
.. autoclass:: openlp.plugins.songs.forms.topicsform.TopicsForm
|
||||
:members:
|
||||
|
||||
Helper Classes & Functions
|
||||
--------------------------
|
||||
|
||||
.. automodule:: openlp.plugins.songs.lib
|
||||
:members:
|
||||
|
||||
.. automodule:: openlp.plugins.songs.lib.db
|
||||
:members:
|
||||
|
||||
.. automodule:: openlp.plugins.songs.lib.importer
|
||||
:members:
|
||||
|
||||
.. automodule:: openlp.plugins.songs.lib.mediaitem
|
||||
:members:
|
||||
|
||||
.. autoclass:: openlp.plugins.songs.lib.mediaitem.SongListView
|
||||
:members:
|
||||
|
||||
.. automodule:: openlp.plugins.songs.lib.songimport
|
||||
:members:
|
||||
|
||||
.. automodule:: openlp.plugins.songs.lib.songstab
|
||||
:members:
|
||||
|
||||
.. automodule:: openlp.plugins.songs.lib.xml
|
||||
:members:
|
||||
|
||||
Song Importers
|
||||
--------------
|
||||
|
||||
.. automodule:: openlp.plugins.songs.lib.cclifileimport
|
||||
:members:
|
||||
|
||||
.. autoclass:: openlp.plugins.songs.lib.cclifileimport.CCLIFileImportError
|
||||
:members:
|
||||
|
||||
.. automodule:: openlp.plugins.songs.lib.ewimport
|
||||
:members:
|
||||
|
||||
.. autoclass:: openlp.plugins.songs.lib.ewimport.FieldDescEntry
|
||||
:members:
|
||||
|
||||
.. automodule:: openlp.plugins.songs.lib.olp1import
|
||||
:members:
|
||||
|
||||
.. automodule:: openlp.plugins.songs.lib.olpimport
|
||||
:members:
|
||||
|
||||
.. automodule:: openlp.plugins.songs.lib.oooimport
|
||||
:members:
|
||||
|
||||
.. automodule:: openlp.plugins.songs.lib.opensongimport
|
||||
:members:
|
||||
|
||||
.. automodule:: openlp.plugins.songs.lib.sofimport
|
||||
:members:
|
||||
|
||||
.. automodule:: openlp.plugins.songs.lib.songbeamerimport
|
||||
:members:
|
||||
|
||||
.. automodule:: openlp.plugins.songs.lib.wowimport
|
||||
:members:
|
|
@ -0,0 +1,34 @@
|
|||
.. _plugins-songusage:
|
||||
|
||||
Song Usage Plugin
|
||||
=================
|
||||
|
||||
.. automodule:: openlp.plugins.songusage
|
||||
:members:
|
||||
|
||||
Plugin Class
|
||||
------------
|
||||
|
||||
.. autoclass:: openlp.plugins.songusage.songusageplugin.SongUsagePlugin
|
||||
:members:
|
||||
|
||||
Forms
|
||||
-----
|
||||
|
||||
.. automodule:: openlp.plugins.songusage.forms
|
||||
:members:
|
||||
|
||||
.. autoclass:: openlp.plugins.songusage.forms.songusagedeleteform.SongUsageDeleteForm
|
||||
:members:
|
||||
|
||||
.. autoclass:: openlp.plugins.songusage.forms.songusagedetailform.SongUsageDetailForm
|
||||
:members:
|
||||
|
||||
Helper Classes & Functions
|
||||
--------------------------
|
||||
|
||||
.. automodule:: openlp.plugins.songusage.lib
|
||||
:members:
|
||||
|
||||
.. automodule:: openlp.plugins.songusage.lib.db
|
||||
:members:
|
|
@ -0,0 +1,88 @@
|
|||
# Makefile for Sphinx documentation
|
||||
#
|
||||
|
||||
# You can set these variables from the command line.
|
||||
SPHINXOPTS =
|
||||
SPHINXBUILD = sphinx-build
|
||||
PAPER =
|
||||
|
||||
# Internal variables.
|
||||
PAPEROPT_a4 = -D latex_paper_size=a4
|
||||
PAPEROPT_letter = -D latex_paper_size=letter
|
||||
ALLSPHINXOPTS = -d build/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
|
||||
|
||||
.PHONY: help clean html dirhtml pickle json htmlhelp qthelp latex changes linkcheck doctest
|
||||
|
||||
help:
|
||||
@echo "Please use \`make <target>' where <target> is one of"
|
||||
@echo " html to make standalone HTML files"
|
||||
@echo " dirhtml to make HTML files named index.html in directories"
|
||||
@echo " pickle to make pickle files"
|
||||
@echo " json to make JSON files"
|
||||
@echo " htmlhelp to make HTML files and a HTML help project"
|
||||
@echo " qthelp to make HTML files and a qthelp project"
|
||||
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
|
||||
@echo " changes to make an overview of all changed/added/deprecated items"
|
||||
@echo " linkcheck to check all external links for integrity"
|
||||
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
|
||||
|
||||
clean:
|
||||
-rm -rf build/*
|
||||
|
||||
html:
|
||||
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) build/html
|
||||
@echo
|
||||
@echo "Build finished. The HTML pages are in build/html."
|
||||
|
||||
dirhtml:
|
||||
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) build/dirhtml
|
||||
@echo
|
||||
@echo "Build finished. The HTML pages are in build/dirhtml."
|
||||
|
||||
pickle:
|
||||
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) build/pickle
|
||||
@echo
|
||||
@echo "Build finished; now you can process the pickle files."
|
||||
|
||||
json:
|
||||
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) build/json
|
||||
@echo
|
||||
@echo "Build finished; now you can process the JSON files."
|
||||
|
||||
htmlhelp:
|
||||
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) build/htmlhelp
|
||||
@echo
|
||||
@echo "Build finished; now you can run HTML Help Workshop with the" \
|
||||
".hhp project file in build/htmlhelp."
|
||||
|
||||
qthelp:
|
||||
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) build/qthelp
|
||||
@echo
|
||||
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
|
||||
".qhcp project file in build/qthelp, like this:"
|
||||
@echo "# qcollectiongenerator build/qthelp/OpenLP.qhcp"
|
||||
@echo "To view the help file:"
|
||||
@echo "# assistant -collectionFile build/qthelp/OpenLP.qhc"
|
||||
|
||||
latex:
|
||||
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) build/latex
|
||||
@echo
|
||||
@echo "Build finished; the LaTeX files are in build/latex."
|
||||
@echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \
|
||||
"run these through (pdf)latex."
|
||||
|
||||
changes:
|
||||
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) build/changes
|
||||
@echo
|
||||
@echo "The overview file is in build/changes."
|
||||
|
||||
linkcheck:
|
||||
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) build/linkcheck
|
||||
@echo
|
||||
@echo "Link check complete; look for any errors in the above output " \
|
||||
"or in build/linkcheck/output.txt."
|
||||
|
||||
doctest:
|
||||
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) build/doctest
|
||||
@echo "Testing of doctests in the sources finished, look at the " \
|
||||
"results in build/doctest/output.txt."
|
|
@ -0,0 +1,112 @@
|
|||
@ECHO OFF
|
||||
|
||||
REM Command file for Sphinx documentation
|
||||
|
||||
set SPHINXBUILD=sphinx-build
|
||||
set ALLSPHINXOPTS=-d build/doctrees %SPHINXOPTS% source
|
||||
if NOT "%PAPER%" == "" (
|
||||
set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
|
||||
)
|
||||
|
||||
if "%1" == "" goto help
|
||||
|
||||
if "%1" == "help" (
|
||||
:help
|
||||
echo.Please use `make ^<target^>` where ^<target^> is one of
|
||||
echo. html to make standalone HTML files
|
||||
echo. dirhtml to make HTML files named index.html in directories
|
||||
echo. pickle to make pickle files
|
||||
echo. json to make JSON files
|
||||
echo. htmlhelp to make HTML files and a HTML help project
|
||||
echo. qthelp to make HTML files and a qthelp project
|
||||
echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter
|
||||
echo. changes to make an overview over all changed/added/deprecated items
|
||||
echo. linkcheck to check all external links for integrity
|
||||
echo. doctest to run all doctests embedded in the documentation if enabled
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "clean" (
|
||||
for /d %%i in (build\*) do rmdir /q /s %%i
|
||||
del /q /s build\*
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "html" (
|
||||
%SPHINXBUILD% -b html %ALLSPHINXOPTS% build/html
|
||||
echo.
|
||||
echo.Build finished. The HTML pages are in build/html.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "dirhtml" (
|
||||
%SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% build/dirhtml
|
||||
echo.
|
||||
echo.Build finished. The HTML pages are in build/dirhtml.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "pickle" (
|
||||
%SPHINXBUILD% -b pickle %ALLSPHINXOPTS% build/pickle
|
||||
echo.
|
||||
echo.Build finished; now you can process the pickle files.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "json" (
|
||||
%SPHINXBUILD% -b json %ALLSPHINXOPTS% build/json
|
||||
echo.
|
||||
echo.Build finished; now you can process the JSON files.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "htmlhelp" (
|
||||
%SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% build/htmlhelp
|
||||
echo.
|
||||
echo.Build finished; now you can run HTML Help Workshop with the ^
|
||||
.hhp project file in build/htmlhelp.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "qthelp" (
|
||||
%SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% build/qthelp
|
||||
echo.
|
||||
echo.Build finished; now you can run "qcollectiongenerator" with the ^
|
||||
.qhcp project file in build/qthelp, like this:
|
||||
echo.^> qcollectiongenerator build\qthelp\OpenLP.qhcp
|
||||
echo.To view the help file:
|
||||
echo.^> assistant -collectionFile build\qthelp\OpenLP.ghc
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "latex" (
|
||||
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% build/latex
|
||||
echo.
|
||||
echo.Build finished; the LaTeX files are in build/latex.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "changes" (
|
||||
%SPHINXBUILD% -b changes %ALLSPHINXOPTS% build/changes
|
||||
echo.
|
||||
echo.The overview file is in build/changes.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "linkcheck" (
|
||||
%SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% build/linkcheck
|
||||
echo.
|
||||
echo.Link check complete; look for any errors in the above output ^
|
||||
or in build/linkcheck/output.txt.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "doctest" (
|
||||
%SPHINXBUILD% -b doctest %ALLSPHINXOPTS% build/doctest
|
||||
echo.
|
||||
echo.Testing of doctests in the sources finished, look at the ^
|
||||
results in build/doctest/output.txt.
|
||||
goto end
|
||||
)
|
||||
|
||||
:end
|
|
@ -0,0 +1,208 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# OpenLP documentation build configuration file, created by
|
||||
# sphinx-quickstart on Fri Jul 10 17:20:40 2009.
|
||||
#
|
||||
# This file is execfile()d with the current directory set to its containing dir.
|
||||
#
|
||||
# Note that not all possible configuration values are present in this
|
||||
# autogenerated file.
|
||||
#
|
||||
# All configuration values have a default; values that are commented out
|
||||
# serve to show the default.
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
# If extensions (or modules to document with autodoc) are in another directory,
|
||||
# add these directories to sys.path here. If the directory is relative to the
|
||||
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
||||
#sys.path.insert(0, os.path.abspath(os.path.join('..', '..')))
|
||||
|
||||
# -- General configuration -----------------------------------------------------
|
||||
|
||||
# Add any Sphinx extension module names here, as strings. They can be extensions
|
||||
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
|
||||
#extensions = ['sphinx.ext.autodoc']
|
||||
|
||||
# Add any paths that contain templates here, relative to this directory.
|
||||
templates_path = ['_templates']
|
||||
|
||||
# The suffix of source filenames.
|
||||
source_suffix = '.rst'
|
||||
|
||||
# The encoding of source files.
|
||||
source_encoding = 'utf-8'
|
||||
|
||||
# The master toctree document.
|
||||
master_doc = 'index'
|
||||
|
||||
# General information about the project.
|
||||
project = u'OpenLP'
|
||||
copyright = u'2004-2010 Raoul Snyman'
|
||||
|
||||
# The version info for the project you're documenting, acts as replacement for
|
||||
# |version| and |release|, also used in various other places throughout the
|
||||
# built documents.
|
||||
#
|
||||
# The short X.Y version.
|
||||
version = '2.0'
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = '1.9.3'
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
#language = None
|
||||
|
||||
# There are two options for replacing |today|: either, you set today to some
|
||||
# non-false value, then it is used:
|
||||
#today = ''
|
||||
# Else, today_fmt is used as the format for a strftime call.
|
||||
#today_fmt = '%B %d, %Y'
|
||||
|
||||
# List of documents that shouldn't be included in the build.
|
||||
#unused_docs = []
|
||||
|
||||
# List of directories, relative to source directory, that shouldn't be searched
|
||||
# for source files.
|
||||
exclude_trees = []
|
||||
|
||||
# The reST default role (used for this markup: `text`) to use for all documents.
|
||||
#default_role = None
|
||||
|
||||
# If true, '()' will be appended to :func: etc. cross-reference text.
|
||||
#add_function_parentheses = True
|
||||
|
||||
# If true, the current module name will be prepended to all description
|
||||
# unit titles (such as .. function::).
|
||||
add_module_names = False
|
||||
|
||||
# If true, sectionauthor and moduleauthor directives will be shown in the
|
||||
# output. They are ignored by default.
|
||||
#show_authors = False
|
||||
|
||||
# The name of the Pygments (syntax highlighting) style to use.
|
||||
pygments_style = 'sphinx'
|
||||
|
||||
# A list of ignored prefixes for module index sorting.
|
||||
#modindex_common_prefix = []
|
||||
|
||||
|
||||
# -- Options for HTML output ---------------------------------------------------
|
||||
|
||||
# The theme to use for HTML and HTML Help pages. Major themes that come with
|
||||
# Sphinx are currently 'default' and 'sphinxdoc'.
|
||||
html_theme = 'default'
|
||||
|
||||
# Theme options are theme-specific and customize the look and feel of a theme
|
||||
# further. For a list of options available for each theme, see the
|
||||
# documentation.
|
||||
html_theme_options = {
|
||||
'sidebarbgcolor': '#3a60a9',
|
||||
'relbarbgcolor': '#203b6f',
|
||||
'footerbgcolor': '#26437c',
|
||||
'headtextcolor': '#203b6f',
|
||||
'linkcolor': '#26437c',
|
||||
'sidebarlinkcolor': '#ceceff'
|
||||
}
|
||||
|
||||
# Add any paths that contain custom themes here, relative to this directory.
|
||||
#html_theme_path = []
|
||||
|
||||
# The name for this set of Sphinx documents. If None, it defaults to
|
||||
# "<project> v<release> documentation".
|
||||
html_title = u'OpenLP 2.0 User Manual'
|
||||
|
||||
# A shorter title for the navigation bar. Default is the same as html_title.
|
||||
#html_short_title = None
|
||||
|
||||
# The name of an image file (relative to this directory) to place at the top
|
||||
# of the sidebar.
|
||||
#html_logo = None
|
||||
|
||||
# The name of an image file (within the static path) to use as favicon of the
|
||||
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
|
||||
# pixels large.
|
||||
#html_favicon = None
|
||||
|
||||
# Add any paths that contain custom static files (such as style sheets) here,
|
||||
# relative to this directory. They are copied after the builtin static files,
|
||||
# so a file named "default.css" will overwrite the builtin "default.css".
|
||||
html_static_path = ['_static']
|
||||
|
||||
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
|
||||
# using the given strftime format.
|
||||
#html_last_updated_fmt = '%b %d, %Y'
|
||||
|
||||
# If true, SmartyPants will be used to convert quotes and dashes to
|
||||
# typographically correct entities.
|
||||
#html_use_smartypants = True
|
||||
|
||||
# Custom sidebar templates, maps document names to template names.
|
||||
#html_sidebars = {}
|
||||
|
||||
# Additional templates that should be rendered to pages, maps page names to
|
||||
# template names.
|
||||
#html_additional_pages = {}
|
||||
|
||||
# If false, no module index is generated.
|
||||
#html_use_modindex = True
|
||||
|
||||
# If false, no index is generated.
|
||||
#html_use_index = True
|
||||
|
||||
# If true, the index is split into individual pages for each letter.
|
||||
#html_split_index = False
|
||||
|
||||
# If true, links to the reST sources are added to the pages.
|
||||
#html_show_sourcelink = True
|
||||
|
||||
# If true, an OpenSearch description file will be output, and all pages will
|
||||
# contain a <link> tag referring to it. The value of this option must be the
|
||||
# base URL from which the finished HTML is served.
|
||||
#html_use_opensearch = ''
|
||||
|
||||
# If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml").
|
||||
#html_file_suffix = ''
|
||||
|
||||
# Output file base name for HTML help builder.
|
||||
htmlhelp_basename = 'OpenLP-2.0-manual'
|
||||
|
||||
|
||||
# -- Options for LaTeX output --------------------------------------------------
|
||||
|
||||
# The paper size ('letter' or 'a4').
|
||||
#latex_paper_size = 'letter'
|
||||
|
||||
# The font size ('10pt', '11pt' or '12pt').
|
||||
#latex_font_size = '10pt'
|
||||
|
||||
# Grouping the document tree into LaTeX files. List of tuples
|
||||
# (source start file, target name, title, author, documentclass [howto/manual]).
|
||||
latex_documents = [
|
||||
('index', 'OpenLP.tex', u'OpenLP 2.0 User Manual',
|
||||
u'Raoul Snyman', 'manual'),
|
||||
]
|
||||
|
||||
# The name of an image file (relative to this directory) to place at the top of
|
||||
# the title page.
|
||||
#latex_logo = None
|
||||
|
||||
# For "manual" documents, if this is true, then toplevel headings are parts,
|
||||
# not chapters.
|
||||
#latex_use_parts = False
|
||||
|
||||
# Additional stuff for the LaTeX preamble.
|
||||
#latex_preamble = ''
|
||||
|
||||
# Documents to append as an appendix to all manuals.
|
||||
#latex_appendices = []
|
||||
|
||||
# If false, no module index is generated.
|
||||
#latex_use_modindex = True
|
||||
|
||||
# A dictionary that contains LaTeX snippets that override those Sphinx usually
|
||||
# puts into the generated .tex files.
|
||||
latex_elements = {
|
||||
'fontpkg': '\\usepackage{helvet}'
|
||||
}
|
|
@ -0,0 +1,180 @@
|
|||
==================
|
||||
Dual Monitor Setup
|
||||
==================
|
||||
|
||||
The first step in getting OpenLP working on your system is to setup your
|
||||
computer properly for dual monitors. This is not very difficult, but the steps
|
||||
do vary depending on operating system.
|
||||
|
||||
Most modern computers do have the ability for dual monitors. To be certain
|
||||
check your computer's documentation. A typical desktop computer capable of dual
|
||||
monitors will have two of, or a combination of the two connectors below.
|
||||
|
||||
**VGA**
|
||||
|
||||
.. image:: pics/vga.png
|
||||
|
||||
**DVI**
|
||||
|
||||
.. image:: pics/dvi.png
|
||||
|
||||
A laptop computer setup only varies slightly, generally you will need only one
|
||||
of outputs pictured above since your laptops screen serves as one of the
|
||||
monitors. Sometimes with older laptops a key stroke generally involving the
|
||||
:kbd:`Fn` key and another key is required to enable the second monitor on
|
||||
laptops.
|
||||
|
||||
Some computers also incorporate the use of :abbr:`S-Video (Separate Video)` or
|
||||
:abbr:`HDMI (High-Definition Multimedia Interface)` connections.
|
||||
|
||||
A typical OpenLP set up consist of your normal single monitor setup, with your
|
||||
projector setup as the second monitor. With the option of extending your
|
||||
desktop across the second monitor, or your operating system's equivalent.
|
||||
|
||||
Microsoft Windows
|
||||
-----------------
|
||||
|
||||
Dual monitor setup is similar among all the currently supported Windows
|
||||
releases (XP, Vista, Windows 7), but does vary slightly from one release to the
|
||||
next.
|
||||
|
||||
Windows 7
|
||||
^^^^^^^^^
|
||||
|
||||
Windows 7 has using a projector in mind. Simply connect your projector and
|
||||
press :kbd:`Windows+P`.
|
||||
|
||||
The more traditional way is also fairly straight forward. Go to
|
||||
:guilabel:`Control Panel` and click on :guilabel:`Display`. This will open up
|
||||
the :guilabel:`Display` dialog. You can also bypass this step by right click on
|
||||
a blank area on your desktop and selecting :guilabel:`Resolution`.
|
||||
|
||||
.. image:: pics/winsevendisplay.png
|
||||
|
||||
Then click on the :guilabel:`Adjust resolution` link in the left pane. Enable
|
||||
your projector and make sure that the selected value for :guilabel:`Multiple
|
||||
displays` is :guilabel:`Extend these displays`.
|
||||
|
||||
.. image:: pics/winsevenresolution.png
|
||||
|
||||
Windows Vista
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
From :guilabel:`Control Panel` click on :guilabel:`Personalize`, or right click
|
||||
a blank place on the desktop and click :guilabel:`Personalization`.
|
||||
|
||||
.. image:: pics/vistapersonalize.png
|
||||
|
||||
From the :guilabel:`Personalization` window click on :guilabel:`Display
|
||||
Settings`. Then enable the montior that represents your projector and make sure
|
||||
you have checked :guilabel:`Extend the desktop onto this monitor`.
|
||||
|
||||
.. image:: pics/vistadisplaysettings.png
|
||||
|
||||
Windows XP
|
||||
^^^^^^^^^^
|
||||
|
||||
From :guilabel:`Control Panel` select :guilabel:`Display`, or right click on a
|
||||
blank area of the desktop and select :guilabel:`Properties`. From the
|
||||
:guilabel:`Display Properties` window click on the :guilabel:`Settings` tab.
|
||||
Then click on the monitor that represents your projector and make sure you have
|
||||
checked :guilabel:`Extend my Windows desktop onto this monitor`.
|
||||
|
||||
.. image:: pics/xpdisplaysettings.png
|
||||
|
||||
Linux
|
||||
-----
|
||||
|
||||
Due to the vast varieties of hardware, distributions, desktops, and drivers
|
||||
this is not an exhaustive guide to dual monitor setup on Linux. This guide
|
||||
assumes that you have properly set up any proprietary drivers if needed. You
|
||||
should seek out your distributions documentation if this general guide does not
|
||||
work.
|
||||
|
||||
GNOME
|
||||
^^^^^
|
||||
|
||||
This guide is for users of the GNOME desktop who do not use proprietary drivers.
|
||||
From most distros go to :menuselection:`System --> Preferences --> Display
|
||||
Settings (Monitors)`. Set up your projector with the correct resolution and make
|
||||
sure that :guilabel:`Same image on all monitors` is **unchecked**.
|
||||
|
||||
.. image:: pics/gnome.png
|
||||
|
||||
KDE
|
||||
^^^
|
||||
|
||||
This guide is for users of the KDE desktop who do not use proprietary drivers.
|
||||
From most distros click the Kick Off menu and navigate to
|
||||
:guilabel:`System Settings`
|
||||
|
||||
.. image:: pics/kdesystemsettings.png
|
||||
|
||||
Click on the display and monitor icon.
|
||||
|
||||
.. image:: pics/kdedisplay.png
|
||||
|
||||
From here you will need to set up your projector with the appropriate
|
||||
resolution, and position. OpenLP works best projecting to the monitor on the
|
||||
right.
|
||||
|
||||
Linux Systems Using nVidia Drivers
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
This guide is for users of the proprietary nVidia driver on Linux Distributions.
|
||||
It is assumed that you have properly setup your drivers according to your
|
||||
distribution's documentation, and you have a working ``xorg.conf`` file in place.
|
||||
|
||||
If you wish to make the changes permanent in setting up your system for dual
|
||||
monitors it will be necessary to modify your ``xorg.conf`` file. It is always a
|
||||
good idea to make a backup of any critical file before making changes::
|
||||
|
||||
user@linux:~ $ sudo cp /etc/X11/xorg.conf /etc/X11/xorg.conf.old
|
||||
|
||||
Or for those using systems that use the root user instead of sudo, change to
|
||||
root and enter::
|
||||
|
||||
root@linux: # cp /etc/X11/xorg.conf /etc/X11/xorg.conf.old
|
||||
|
||||
The exact location of the ``xorg.conf`` file can vary so check your
|
||||
distribution's documentation.
|
||||
|
||||
If you want to make your changes permanent run nVidia settings from the
|
||||
terminal::
|
||||
|
||||
user@linux:~ $ sudo nvidia-settings
|
||||
|
||||
Or, as root::
|
||||
|
||||
root@linux: # nividia-settings
|
||||
|
||||
If you do not want to write the changes to your ``xorg.conf`` file simply run
|
||||
the nVidia Settings program (``nvidia-settings``) from your desktop's menu,
|
||||
usually in an administration or system menu, or from the terminal as a normal
|
||||
user run::
|
||||
|
||||
user@linux:~ $ nvidia-settings
|
||||
|
||||
Once you have opened nVidia Settings, click on
|
||||
:guilabel:`X Server Display Configuration`. Then select the monitor you are
|
||||
wanting to use as your second monitor and click :guilabel:`Configure`.
|
||||
|
||||
.. image:: pics/nvlinux1.png
|
||||
|
||||
After clicking :guilabel:`Configure`, select :guilabel:`TwinView`. Then click
|
||||
:guilabel:`OK`.
|
||||
|
||||
.. image:: pics/twinview.png
|
||||
|
||||
Then click :guilabel:`Apply` and if you are happy with the way things look click
|
||||
:guilabel:`Keep` to keep your new settings. Don't worry if all goes wrong the
|
||||
settings will return back to the previous settings in 15 seconds without any
|
||||
action. nVidia Settings should take care of selecting your optimum resolution
|
||||
etc, but that can be changed as needed. When you are happy with everything click
|
||||
on :guilabel:`Save to X Configuration File`.
|
||||
|
||||
.. image:: pics/xorgwrite.png
|
||||
|
||||
Then click :guilabel:`Save` and you should be set. You may want to restart X or
|
||||
your machine just to make sure all the settings carry over the next time you log
|
||||
in.
|
|
@ -0,0 +1,70 @@
|
|||
========
|
||||
Glossary
|
||||
========
|
||||
|
||||
The developers of OpenLP have strived to make it a straightforward and easy to
|
||||
use application. However, it is good to be familiar with a few terms that will
|
||||
be used throughout this documentation, and when seeking support.
|
||||
|
||||
Main Window
|
||||
-----------
|
||||
|
||||
The Main Window is what you will see when you first open OpenLP
|
||||
|
||||
.. image:: pics/mainwindow.png
|
||||
|
||||
The Main Window contains all the tools and plugins that make OpenLP function
|
||||
|
||||
Media Manager
|
||||
-------------
|
||||
|
||||
The Media Manager contains a number of tabs that plugins supply to OpenLP.
|
||||
Each tab in the Media Manager is called a **Media Item**
|
||||
|
||||
.. image:: pics/mediamanager.png
|
||||
|
||||
From the Media Manager you can send Media Items to the Preview or Live screens.
|
||||
|
||||
Preview
|
||||
-------
|
||||
|
||||
The preview pane is a section to preview your media items before you go live
|
||||
with them.
|
||||
|
||||
.. image:: pics/preview.png
|
||||
|
||||
Service File
|
||||
------------
|
||||
|
||||
A service file, is the file that is created when you save your work on OpenLP.
|
||||
The service file consist of **Service Items**
|
||||
|
||||
Service Item
|
||||
------------
|
||||
|
||||
A service item are the **media items** that are in the **service manager**
|
||||
|
||||
Service Manger
|
||||
--------------
|
||||
|
||||
The service manager contains the media items in your service file. This is the
|
||||
area from wich your media items go live, and you can also save, open, and edit
|
||||
services files.
|
||||
|
||||
.. image:: pics/servicemanager.png
|
||||
|
||||
Slide Controller
|
||||
----------------
|
||||
|
||||
The Slide Controller controls which slide from a **Service Item** is currently
|
||||
being displayed, and moving between the various slides.
|
||||
|
||||
.. image:: pics/slidecontroller.png
|
||||
|
||||
Theme Manager
|
||||
-------------
|
||||
|
||||
The theme manager is where themes are created and edited. Themes are the text
|
||||
styles backgrounds that you use to personalize your services.
|
||||
|
||||
.. image:: pics/thememanager.png
|
|
@ -3,8 +3,8 @@
|
|||
You can adapt this file completely to your liking, but it should at least
|
||||
contain the root `toctree` directive.
|
||||
|
||||
Welcome to OpenLP's documentation
|
||||
==================================
|
||||
Welcome to the OpenLP 2.0 User Manual
|
||||
=====================================
|
||||
|
||||
Contents:
|
||||
|
||||
|
@ -12,6 +12,8 @@ Contents:
|
|||
:maxdepth: 2
|
||||
|
||||
introduction
|
||||
glossary
|
||||
dualmonitors
|
||||
|
||||
Indices and tables
|
||||
==================
|
After Width: | Height: | Size: 19 KiB |
After Width: | Height: | Size: 33 KiB |
After Width: | Height: | Size: 64 KiB |
After Width: | Height: | Size: 112 KiB |
After Width: | Height: | Size: 123 KiB |
After Width: | Height: | Size: 104 KiB |
After Width: | Height: | Size: 140 KiB |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 90 KiB |
After Width: | Height: | Size: 31 KiB |
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 7.2 KiB |
After Width: | Height: | Size: 51 KiB |
After Width: | Height: | Size: 139 KiB |
After Width: | Height: | Size: 155 KiB |
After Width: | Height: | Size: 141 KiB |
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 35 KiB |
|
@ -1,95 +0,0 @@
|
|||
.. _plugins-bibles:
|
||||
|
||||
:mod:`bibles` Plugin
|
||||
====================
|
||||
|
||||
.. automodule:: openlp.plugins.bibles
|
||||
:members:
|
||||
|
||||
:mod:`BiblePlugin` Class
|
||||
-------------------------
|
||||
|
||||
.. autoclass:: openlp.plugins.bibles.bibleplugin.BiblePlugin
|
||||
:members:
|
||||
|
||||
:mod:`forms` Submodule
|
||||
----------------------
|
||||
|
||||
.. automodule:: openlp.plugins.bibles.forms
|
||||
:members:
|
||||
|
||||
:mod:`BibleImportWizard`
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. autoclass:: openlp.plugins.bibles.forms.bibleimportwizard.Ui_BibleImportWizard
|
||||
:members:
|
||||
|
||||
.. autoclass:: openlp.plugins.bibles.forms.importwizardform.ImportWizardForm
|
||||
:members:
|
||||
|
||||
:mod:`lib` Submodule
|
||||
--------------------
|
||||
|
||||
.. automodule:: openlp.plugins.bibles.lib
|
||||
:members:
|
||||
|
||||
:mod:`db`
|
||||
^^^^^^^^^
|
||||
|
||||
.. automodule:: openlp.plugins.bibles.lib.db
|
||||
:members:
|
||||
|
||||
.. autoclass:: openlp.plugins.bibles.lib.db.BibleDB
|
||||
:members:
|
||||
|
||||
:mod:`csv`
|
||||
^^^^^^^^^^
|
||||
|
||||
.. automodule:: openlp.plugins.bibles.lib.csvbible
|
||||
:members:
|
||||
|
||||
.. autoclass:: openlp.plugins.bibles.lib.csvbible.CSVBible
|
||||
:members:
|
||||
|
||||
:mod:`http`
|
||||
^^^^^^^^^^^
|
||||
|
||||
.. automodule:: openlp.plugins.bibles.lib.http
|
||||
:members:
|
||||
|
||||
.. autoclass:: openlp.plugins.bibles.lib.http.HTTPBible
|
||||
:members:
|
||||
|
||||
:mod:`bibleOSISimpl`
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. automodule:: openlp.plugins.bibles.lib.osis
|
||||
:members:
|
||||
|
||||
.. autoclass:: openlp.plugins.bibles.lib.osis.OSISBible
|
||||
:members:
|
||||
|
||||
:mod:`biblestab`
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
.. automodule:: openlp.plugins.bibles.lib.biblestab
|
||||
:members:
|
||||
|
||||
:mod:`common`
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
.. automodule:: openlp.plugins.bibles.lib.common
|
||||
:members:
|
||||
|
||||
:mod:`manager`
|
||||
^^^^^^^^^^^^^^
|
||||
|
||||
.. automodule:: openlp.plugins.bibles.lib.manager
|
||||
:members:
|
||||
|
||||
:mod:`mediaitem`
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
.. automodule:: openlp.plugins.bibles.lib.mediaitem
|
||||
:members:
|
||||
|
|
@ -1,43 +0,0 @@
|
|||
.. _plugins-index:
|
||||
|
||||
:mod:`plugins` Module
|
||||
=====================
|
||||
|
||||
.. automodule:: openlp.plugins
|
||||
:members:
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
songs
|
||||
bibles
|
||||
|
||||
:mod:`presentations` Plugin
|
||||
---------------------------
|
||||
|
||||
.. automodule:: openlp.plugins.presentations
|
||||
:members:
|
||||
|
||||
:mod:`media` Plugin
|
||||
-------------------
|
||||
|
||||
.. automodule:: openlp.plugins.media
|
||||
:members:
|
||||
|
||||
:mod:`images` Plugin
|
||||
--------------------
|
||||
|
||||
.. automodule:: openlp.plugins.images
|
||||
:members:
|
||||
|
||||
:mod:`custom` Plugin
|
||||
--------------------
|
||||
|
||||
.. automodule:: openlp.plugins.custom
|
||||
:members:
|
||||
|
||||
:mod:`songusage` Plugin
|
||||
-----------------------
|
||||
|
||||
.. automodule:: openlp.plugins.songusage
|
||||
:members:
|
|
@ -1,193 +0,0 @@
|
|||
.. _plugins-songs:
|
||||
|
||||
:mod:`songs` Plugin
|
||||
===================
|
||||
|
||||
.. automodule:: openlp.plugins.songs
|
||||
:members:
|
||||
|
||||
:class:`SongsPlugin` Class
|
||||
--------------------------
|
||||
|
||||
.. autoclass:: openlp.plugins.songs.songsplugin.SongsPlugin
|
||||
:members:
|
||||
|
||||
:mod:`forms` Submodule
|
||||
----------------------
|
||||
|
||||
.. automodule:: openlp.plugins.songs.forms
|
||||
:members:
|
||||
|
||||
:class:`AuthorsForm`
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. autoclass:: openlp.plugins.songs.forms.authorsdialog.Ui_AuthorsDialog
|
||||
:members:
|
||||
|
||||
.. autoclass:: openlp.plugins.songs.forms.authorsform.AuthorsForm
|
||||
:members:
|
||||
|
||||
:class:`EditSongForm`
|
||||
^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. autoclass:: openlp.plugins.songs.forms.editsongdialog.Ui_EditSongDialog
|
||||
:members:
|
||||
|
||||
.. autoclass:: openlp.plugins.songs.forms.editsongform.EditSongForm
|
||||
:members:
|
||||
|
||||
:class:`EditVerseForm`
|
||||
^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. autoclass:: openlp.plugins.songs.forms.editversedialog.Ui_EditVerseDialog
|
||||
:members:
|
||||
|
||||
.. autoclass:: openlp.plugins.songs.forms.editverseform.EditVerseForm
|
||||
:members:
|
||||
|
||||
:class:`SongBookForm`
|
||||
^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. autoclass:: openlp.plugins.songs.forms.songbookdialog.Ui_SongBookDialog
|
||||
:members:
|
||||
|
||||
.. autoclass:: openlp.plugins.songs.forms.songbookform.SongBookForm
|
||||
:members:
|
||||
|
||||
:class:`SongImportForm`
|
||||
^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. autoclass:: openlp.plugins.songs.forms.songimportwizard.Ui_SongImportWizard
|
||||
:members:
|
||||
|
||||
.. autoclass:: openlp.plugins.songs.forms.songimportform.ImportWizardForm
|
||||
:members:
|
||||
|
||||
:class:`SongMaintenanceForm`
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. autoclass:: openlp.plugins.songs.forms.songmaintenancedialog.Ui_SongMaintenanceDialog
|
||||
:members:
|
||||
|
||||
.. autoclass:: openlp.plugins.songs.forms.songmaintenanceform.SongMaintenanceForm
|
||||
:members:
|
||||
|
||||
:class:`TopicsForm`
|
||||
^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. autoclass:: openlp.plugins.songs.forms.topicsdialog.Ui_TopicsDialog
|
||||
:members:
|
||||
|
||||
.. autoclass:: openlp.plugins.songs.forms.topicsform.TopicsForm
|
||||
:members:
|
||||
|
||||
:mod:`lib` Submodule
|
||||
--------------------
|
||||
|
||||
.. automodule:: openlp.plugins.songs.lib
|
||||
:members:
|
||||
|
||||
:mod:`cclifileimport` Submodule
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. automodule:: openlp.plugins.songs.lib.cclifileimport
|
||||
:members:
|
||||
|
||||
.. autoclass:: openlp.plugins.songs.lib.cclifileimport.CCLIFileImportError
|
||||
:members:
|
||||
|
||||
:mod:`db` Submodule
|
||||
^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. automodule:: openlp.plugins.songs.lib.db
|
||||
:members:
|
||||
|
||||
:mod:`ewimport` Submodule
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. automodule:: openlp.plugins.songs.lib.ewimport
|
||||
:members:
|
||||
|
||||
.. autoclass:: openlp.plugins.songs.lib.ewimport.FieldDescEntry
|
||||
:members:
|
||||
|
||||
:mod:`importer` Submodule
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. automodule:: openlp.plugins.songs.lib.importer
|
||||
:members:
|
||||
|
||||
:mod:`mediaitem` Submodule
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. automodule:: openlp.plugins.songs.lib.mediaitem
|
||||
:members:
|
||||
|
||||
.. autoclass:: openlp.plugins.songs.lib.mediaitem.SongListView
|
||||
:members:
|
||||
|
||||
:mod:`olp1import` Submodule
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. automodule:: openlp.plugins.songs.lib.olp1import
|
||||
:members:
|
||||
|
||||
:mod:`olpimport` Submodule
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. automodule:: openlp.plugins.songs.lib.olpimport
|
||||
:members:
|
||||
|
||||
:mod:`oooimport` Submodule
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. automodule:: openlp.plugins.songs.lib.oooimport
|
||||
:members:
|
||||
|
||||
:mod:`opensongimport` Submodule
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. automodule:: openlp.plugins.songs.lib.opensongimport
|
||||
:members:
|
||||
|
||||
:mod:`sofimport` Submodule
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. automodule:: openlp.plugins.songs.lib.sofimport
|
||||
:members:
|
||||
|
||||
:mod:`songbeamerimport` Submodule
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. automodule:: openlp.plugins.songs.lib.songbeamerimport
|
||||
:members:
|
||||
|
||||
:mod:`songimport` Submodule
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. automodule:: openlp.plugins.songs.lib.songimport
|
||||
:members:
|
||||
|
||||
:mod:`songstab` Submodule
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. automodule:: openlp.plugins.songs.lib.songstab
|
||||
:members:
|
||||
|
||||
:mod:`wowimport` Submodule
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. automodule:: openlp.plugins.songs.lib.wowimport
|
||||
:members:
|
||||
|
||||
:mod:`songxml` Submodule
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. automodule:: openlp.plugins.songs.lib.songxml
|
||||
:members:
|
||||
|
||||
:mod:`xml` Submodule
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. automodule:: openlp.plugins.songs.lib.xml
|
||||
:members:
|
|
@ -81,9 +81,6 @@ html_expands.append({u'desc':u'Italics', u'start tag':u'{it}',
|
|||
u'start html':u'<em>', u'end tag':u'{/it}', u'end html':u'</em>',
|
||||
u'protected':True})
|
||||
|
||||
# Image image_cache to stop regualar image resizing
|
||||
image_cache = {}
|
||||
|
||||
def translate(context, text, comment=None):
|
||||
"""
|
||||
A special shortcut method to wrap around the Qt4 translation functions.
|
||||
|
@ -223,16 +220,13 @@ def image_to_byte(image):
|
|||
``image``
|
||||
The image to converted.
|
||||
"""
|
||||
log.debug(u'image_to_byte')
|
||||
log.debug(u'image_to_byte - start')
|
||||
byte_array = QtCore.QByteArray()
|
||||
# use buffer to store pixmap into byteArray
|
||||
buffie = QtCore.QBuffer(byte_array)
|
||||
buffie.open(QtCore.QIODevice.WriteOnly)
|
||||
if isinstance(image, QtGui.QImage):
|
||||
pixmap = QtGui.QPixmap.fromImage(image)
|
||||
else:
|
||||
pixmap = QtGui.QPixmap(image)
|
||||
pixmap.save(buffie, "PNG")
|
||||
image.save(buffie, "PNG")
|
||||
log.debug(u'image_to_byte - end')
|
||||
# convert to base64 encoding so does not get missed!
|
||||
return byte_array.toBase64()
|
||||
|
||||
|
@ -253,26 +247,25 @@ def resize_image(image, width, height, background=QtCore.Qt.black):
|
|||
The background colour defaults to black.
|
||||
|
||||
"""
|
||||
log.debug(u'resize_image')
|
||||
preview = QtGui.QImage(image)
|
||||
log.debug(u'resize_image - start')
|
||||
if isinstance(image, QtGui.QImage):
|
||||
preview = image
|
||||
else:
|
||||
preview = QtGui.QImage(image)
|
||||
if not preview.isNull():
|
||||
# Only resize if different size
|
||||
if preview.width() == width and preview.height == height:
|
||||
return preview
|
||||
preview = preview.scaled(width, height, QtCore.Qt.KeepAspectRatio,
|
||||
QtCore.Qt.SmoothTransformation)
|
||||
image_cache_key = u'%s%s%s' % (image, unicode(width), unicode(height))
|
||||
if image_cache_key in image_cache:
|
||||
return image_cache[image_cache_key]
|
||||
realw = preview.width()
|
||||
realh = preview.height()
|
||||
# and move it to the centre of the preview space
|
||||
new_image = QtGui.QImage(width, height,
|
||||
QtGui.QImage.Format_ARGB32_Premultiplied)
|
||||
new_image.fill(background)
|
||||
painter = QtGui.QPainter(new_image)
|
||||
painter.fillRect(new_image.rect(), background)
|
||||
painter.drawImage((width - realw) / 2, (height - realh) / 2, preview)
|
||||
image_cache[image_cache_key] = new_image
|
||||
return new_image
|
||||
|
||||
def check_item_selected(list_widget, message):
|
||||
|
@ -310,8 +303,11 @@ def expand_tags(text):
|
|||
text = text.replace(tag[u'end tag'], tag[u'end html'])
|
||||
return text
|
||||
|
||||
from theme import ThemeLevel, ThemeXML, BackgroundGradientType, BackgroundType, \
|
||||
HorizontalType, VerticalType
|
||||
from spelltextedit import SpellTextEdit
|
||||
from eventreceiver import Receiver
|
||||
from imagemanager import ImageManager
|
||||
from settingsmanager import SettingsManager
|
||||
from plugin import PluginStatus, StringContent, Plugin
|
||||
from pluginmanager import PluginManager
|
||||
|
@ -323,7 +319,6 @@ from htmlbuilder import build_html, build_lyrics_format_css, \
|
|||
build_lyrics_outline_css
|
||||
from toolbar import OpenLPToolbar
|
||||
from dockwidget import OpenLPDockWidget
|
||||
from theme import ThemeLevel, ThemeXML
|
||||
from renderer import Renderer
|
||||
from rendermanager import RenderManager
|
||||
from mediamanageritem import MediaManagerItem
|
||||
|
|
|
@ -117,6 +117,7 @@ class Manager(object):
|
|||
settings = QtCore.QSettings()
|
||||
settings.beginGroup(plugin_name)
|
||||
self.db_url = u''
|
||||
self.is_dirty = False
|
||||
db_type = unicode(
|
||||
settings.value(u'db type', QtCore.QVariant(u'sqlite')).toString())
|
||||
if db_type == u'sqlite':
|
||||
|
@ -150,12 +151,34 @@ class Manager(object):
|
|||
self.session.add(object_instance)
|
||||
if commit:
|
||||
self.session.commit()
|
||||
self.is_dirty = True
|
||||
return True
|
||||
except InvalidRequestError:
|
||||
self.session.rollback()
|
||||
log.exception(u'Object save failed')
|
||||
return False
|
||||
|
||||
def save_objects(self, object_list, commit=True):
|
||||
"""
|
||||
Save a list of objects to the database
|
||||
|
||||
``object_list``
|
||||
The list of objects to save
|
||||
|
||||
``commit``
|
||||
Commit the session with this object
|
||||
"""
|
||||
try:
|
||||
self.session.add_all(object_list)
|
||||
if commit:
|
||||
self.session.commit()
|
||||
self.is_dirty = True
|
||||
return True
|
||||
except InvalidRequestError:
|
||||
self.session.rollback()
|
||||
log.exception(u'Object list save failed')
|
||||
return False
|
||||
|
||||
def get_object(self, object_class, key=None):
|
||||
"""
|
||||
Return the details of an object
|
||||
|
@ -205,6 +228,22 @@ class Manager(object):
|
|||
return query.order_by(order_by_ref).all()
|
||||
return query.all()
|
||||
|
||||
def get_object_count(self, object_class, filter_clause=None):
|
||||
"""
|
||||
Returns a count of the number of objects in the database.
|
||||
|
||||
``object_class``
|
||||
The type of objects to return.
|
||||
|
||||
``filter_clause``
|
||||
The filter governing selection of objects to return. Defaults to
|
||||
None.
|
||||
"""
|
||||
query = self.session.query(object_class)
|
||||
if filter_clause is not None:
|
||||
query = query.filter(filter_clause)
|
||||
return query.count()
|
||||
|
||||
def delete_object(self, object_class, key):
|
||||
"""
|
||||
Delete an object from the database
|
||||
|
@ -220,6 +259,7 @@ class Manager(object):
|
|||
try:
|
||||
self.session.delete(object_instance)
|
||||
self.session.commit()
|
||||
self.is_dirty = True
|
||||
return True
|
||||
except InvalidRequestError:
|
||||
self.session.rollback()
|
||||
|
@ -241,8 +281,17 @@ class Manager(object):
|
|||
query = query.filter(filter_clause)
|
||||
query.delete(synchronize_session=False)
|
||||
self.session.commit()
|
||||
self.is_dirty = True
|
||||
return True
|
||||
except InvalidRequestError:
|
||||
self.session.rollback()
|
||||
log.exception(u'Failed to delete %s records', object_class.__name__)
|
||||
return False
|
||||
|
||||
def finalise(self):
|
||||
"""
|
||||
VACUUM the database on exit.
|
||||
"""
|
||||
if self.is_dirty:
|
||||
engine = create_engine(self.db_url)
|
||||
engine.execute("vacuum")
|
||||
|
|
|
@ -25,8 +25,11 @@
|
|||
###############################################################################
|
||||
|
||||
import logging
|
||||
|
||||
from PyQt4 import QtWebKit
|
||||
|
||||
from openlp.core.lib import BackgroundType, BackgroundGradientType
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
HTMLSRC = u"""
|
||||
|
@ -90,16 +93,16 @@ body {
|
|||
var transition = %s;
|
||||
|
||||
function show_video(state, path, volume, loop){
|
||||
// Note, the preferred method for looping would be to use the
|
||||
// Note, the preferred method for looping would be to use the
|
||||
// video tag loop attribute.
|
||||
// But QtWebKit doesn't support this. Neither does it support the
|
||||
// onended event, hence the setInterval()
|
||||
// In addition, setting the currentTime attribute to zero to restart
|
||||
// the video raises an INDEX_SIZE_ERROR: DOM Exception 1
|
||||
// To complicate it further, sometimes vid.currentTime stops
|
||||
// To complicate it further, sometimes vid.currentTime stops
|
||||
// slightly short of vid.duration and vid.ended is intermittent!
|
||||
//
|
||||
// Note, currently the background may go black between loops. Not
|
||||
// Note, currently the background may go black between loops. Not
|
||||
// desirable. Need to investigate using two <video>'s, and hiding/
|
||||
// preloading one, and toggle between the two when looping.
|
||||
|
||||
|
@ -132,8 +135,8 @@ body {
|
|||
vid.style.visibility = 'visible';
|
||||
if(vid.looping){
|
||||
video_timer = setInterval(
|
||||
function() {
|
||||
show_video('poll');
|
||||
function() {
|
||||
show_video('poll');
|
||||
}, 200);
|
||||
}
|
||||
break;
|
||||
|
@ -328,6 +331,7 @@ def build_html(item, screen, alert, islive):
|
|||
height = screen[u'size'].height()
|
||||
theme = item.themedata
|
||||
webkitvers = webkit_version()
|
||||
# Image generated and poked in
|
||||
if item.bg_image_bytes:
|
||||
image = u'src="data:image/png;base64,%s"' % item.bg_image_bytes
|
||||
else:
|
||||
|
@ -367,16 +371,32 @@ def build_background_css(item, width, height):
|
|||
theme = item.themedata
|
||||
background = u'background-color: black'
|
||||
if theme:
|
||||
if theme.background_type == u'solid':
|
||||
if theme.background_type == BackgroundType.to_string(BackgroundType.Solid):
|
||||
background = u'background-color: %s' % theme.background_color
|
||||
else:
|
||||
if theme.background_direction == u'horizontal':
|
||||
if theme.background_direction == BackgroundGradientType.to_string \
|
||||
(BackgroundGradientType.Horizontal):
|
||||
background = \
|
||||
u'background: ' \
|
||||
u'-webkit-gradient(linear, left top, left bottom, ' \
|
||||
'from(%s), to(%s))' % (theme.background_start_color,
|
||||
theme.background_end_color)
|
||||
elif theme.background_direction == u'vertical':
|
||||
elif theme.background_direction == BackgroundGradientType.to_string \
|
||||
(BackgroundGradientType.LeftTop):
|
||||
background = \
|
||||
u'background: ' \
|
||||
u'-webkit-gradient(linear, left top, right bottom, ' \
|
||||
'from(%s), to(%s))' % (theme.background_start_color,
|
||||
theme.background_end_color)
|
||||
elif theme.background_direction == BackgroundGradientType.to_string \
|
||||
(BackgroundGradientType.LeftBottom):
|
||||
background = \
|
||||
u'background: ' \
|
||||
u'-webkit-gradient(linear, left bottom, right top, ' \
|
||||
'from(%s), to(%s))' % (theme.background_start_color,
|
||||
theme.background_end_color)
|
||||
elif theme.background_direction == BackgroundGradientType.to_string \
|
||||
(BackgroundGradientType.Vertical):
|
||||
background = \
|
||||
u'background: -webkit-gradient(linear, left top, ' \
|
||||
u'right top, from(%s), to(%s))' % \
|
||||
|
@ -451,17 +471,17 @@ def build_lyrics_css(item, webkitvers):
|
|||
lyricsmain += build_lyrics_outline_css(theme)
|
||||
else:
|
||||
outline = build_lyrics_outline_css(theme)
|
||||
if theme.display_shadow:
|
||||
if theme.display_outline and webkitvers < 534.3:
|
||||
if theme.font_main_shadow:
|
||||
if theme.font_main_outline and webkitvers < 534.3:
|
||||
shadow = u'padding-left: %spx; padding-top: %spx;' % \
|
||||
(int(theme.display_shadow_size) +
|
||||
(int(theme.display_outline_size) * 2),
|
||||
theme.display_shadow_size)
|
||||
(int(theme.font_main_shadow_size) +
|
||||
(int(theme.font_main_outline_size) * 2),
|
||||
theme.font_main_shadow_size)
|
||||
shadow += build_lyrics_outline_css(theme, True)
|
||||
else:
|
||||
lyricsmain += u' text-shadow: %s %spx %spx;' % \
|
||||
(theme.display_shadow_color, theme.display_shadow_size,
|
||||
theme.display_shadow_size)
|
||||
(theme.font_main_shadow_color, theme.font_main_shadow_size,
|
||||
theme.font_main_shadow_size)
|
||||
lyrics_css = style % (lyricstable, lyrics, lyricsmain, outline, shadow)
|
||||
return lyrics_css
|
||||
|
||||
|
@ -476,14 +496,14 @@ def build_lyrics_outline_css(theme, is_shadow=False):
|
|||
`is_shadow`
|
||||
If true, use the shadow colors instead
|
||||
"""
|
||||
if theme.display_outline:
|
||||
size = float(theme.display_outline_size) / 16
|
||||
if theme.font_main_outline:
|
||||
size = float(theme.font_main_outline_size) / 16
|
||||
if is_shadow:
|
||||
fill_color = theme.display_shadow_color
|
||||
outline_color = theme.display_shadow_color
|
||||
fill_color = theme.font_main_shadow_color
|
||||
outline_color = theme.font_main_shadow_color
|
||||
else:
|
||||
fill_color = theme.font_main_color
|
||||
outline_color = theme.display_outline_color
|
||||
outline_color = theme.font_main_outline_color
|
||||
return u' -webkit-text-stroke: %sem %s; ' \
|
||||
u'-webkit-text-fill-color: %s; ' % (size, outline_color, fill_color)
|
||||
else:
|
||||
|
@ -516,23 +536,23 @@ def build_lyrics_format_css(theme, width, height):
|
|||
valign = u'middle'
|
||||
else:
|
||||
valign = u'top'
|
||||
if theme.display_outline:
|
||||
left_margin = int(theme.display_outline_size) * 2
|
||||
if theme.font_main_outline:
|
||||
left_margin = int(theme.font_main_outline_size) * 2
|
||||
else:
|
||||
left_margin = 0
|
||||
lyrics = u'white-space:pre-wrap; word-wrap: break-word; ' \
|
||||
'text-align: %s; vertical-align: %s; font-family: %s; ' \
|
||||
'font-size: %spt; color: %s; line-height: %d%%; margin:0;' \
|
||||
'padding:0; padding-left:%spx; width: %spx; height: %spx; ' % \
|
||||
(align, valign, theme.font_main_name, theme.font_main_proportion,
|
||||
(align, valign, theme.font_main_name, theme.font_main_size,
|
||||
theme.font_main_color, 100 + int(theme.font_main_line_adjustment),
|
||||
left_margin, width, height)
|
||||
if theme.display_outline:
|
||||
if theme.font_main_outline:
|
||||
if webkit_version() < 534.3:
|
||||
lyrics += u' letter-spacing: 1px;'
|
||||
if theme.font_main_italics:
|
||||
lyrics += u' font-style:italic; '
|
||||
if theme.font_main_weight == u'Bold':
|
||||
if theme.font_main_bold:
|
||||
lyrics += u' font-weight:bold; '
|
||||
return lyrics
|
||||
|
||||
|
@ -552,7 +572,7 @@ def build_lyrics_html(item, webkitvers):
|
|||
# display:table/display:table-cell are required for each lyric block.
|
||||
lyrics = u''
|
||||
theme = item.themedata
|
||||
if webkitvers < 534.4 and theme and theme.display_outline:
|
||||
if webkitvers < 534.4 and theme and theme.font_main_outline:
|
||||
lyrics += u'<div class="lyricstable">' \
|
||||
u'<div id="lyricsshadow" style="opacity:1" ' \
|
||||
u'class="lyricscell lyricsshadow"></div></div>'
|
||||
|
@ -588,7 +608,7 @@ def build_footer_css(item, height):
|
|||
bottom = height - int(item.footer.y()) - int(item.footer.height())
|
||||
lyrics_html = style % (item.footer.x(), bottom,
|
||||
item.footer.width(), theme.font_footer_name,
|
||||
theme.font_footer_proportion, theme.font_footer_color)
|
||||
theme.font_footer_size, theme.font_footer_color)
|
||||
return lyrics_html
|
||||
|
||||
def build_alert_css(alertTab, width):
|
||||
|
|
|
@ -0,0 +1,158 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
# --------------------------------------------------------------------------- #
|
||||
# Copyright (c) 2008-2010 Raoul Snyman #
|
||||
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
|
||||
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
|
||||
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
|
||||
# Carsten Tinggaard, Frode Woldsund #
|
||||
# --------------------------------------------------------------------------- #
|
||||
# This program is free software; you can redistribute it and/or modify it #
|
||||
# under the terms of the GNU General Public License as published by the Free #
|
||||
# Software Foundation; version 2 of the License. #
|
||||
# #
|
||||
# This program is distributed in the hope that it will be useful, but WITHOUT #
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
|
||||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
|
||||
# more details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU General Public License along #
|
||||
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
|
||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||
###############################################################################
|
||||
"""
|
||||
Provides the store and management for Images automatically caching them and
|
||||
resizing them when needed. Only one copy of each image is needed in the system.
|
||||
A Thread is used to convert the image to a byte array so the user does not need
|
||||
to wait for the conversion to happen.
|
||||
"""
|
||||
import logging
|
||||
import os
|
||||
import time
|
||||
|
||||
from PyQt4 import QtCore
|
||||
|
||||
from openlp.core.lib import resize_image, image_to_byte
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
class ImageThread(QtCore.QThread):
|
||||
"""
|
||||
A special Qt thread class to speed up the display of text based frames.
|
||||
This is threaded so it loads the frames in background
|
||||
"""
|
||||
def __init__(self, manager):
|
||||
QtCore.QThread.__init__(self, None)
|
||||
self.image_mamager = manager
|
||||
|
||||
def run(self):
|
||||
"""
|
||||
Run the thread.
|
||||
"""
|
||||
self.image_mamager.process()
|
||||
|
||||
|
||||
class Image(object):
|
||||
name = ''
|
||||
path = ''
|
||||
dirty = True
|
||||
image = None
|
||||
image_bytes = None
|
||||
|
||||
class ImageManager(QtCore.QObject):
|
||||
"""
|
||||
Image Manager handles the conversion and sizing of images.
|
||||
|
||||
"""
|
||||
log.info(u'Image Manager loaded')
|
||||
|
||||
def __init__(self):
|
||||
self._cache = {}
|
||||
self._thread_running = False
|
||||
self._cache_dirty = False
|
||||
self.image_thread = ImageThread(self)
|
||||
|
||||
def update_display(self, width, height):
|
||||
"""
|
||||
Screen has changed size so rebuild the cache to new size
|
||||
"""
|
||||
log.debug(u'update_display')
|
||||
self.width = width
|
||||
self.height = height
|
||||
# mark the images as dirty for a rebuild
|
||||
for key in self._cache.keys():
|
||||
image = self._cache[key]
|
||||
image.dirty = True
|
||||
fullpath = os.path.join(image.path, image.name)
|
||||
image.image = resize_image(fullpath,
|
||||
self.width, self.height)
|
||||
self._cache_dirty = True
|
||||
# only one thread please
|
||||
if not self._thread_running:
|
||||
self.image_thread.start()
|
||||
|
||||
def get_image(self, name):
|
||||
"""
|
||||
Return the Qimage from the cache
|
||||
"""
|
||||
log.debug(u'get_image %s' % name)
|
||||
return self._cache[name].image
|
||||
|
||||
def get_image_bytes(self, name):
|
||||
"""
|
||||
Returns the byte string for an image
|
||||
If not present wait for the background thread to process it.
|
||||
"""
|
||||
log.debug(u'get_image_bytes %s' % name)
|
||||
if not self._cache[name].image_bytes:
|
||||
while self._cache[name].dirty:
|
||||
log.debug(u'get_image_bytes - waiting')
|
||||
time.sleep(0.1)
|
||||
return self._cache[name].image_bytes
|
||||
|
||||
def add_image(self, name, path):
|
||||
"""
|
||||
Add image to cache if it is not already there
|
||||
"""
|
||||
log.debug(u'add_image %s:%s' % (name, path))
|
||||
if not name in self._cache:
|
||||
image = Image()
|
||||
image.name = name
|
||||
image.path = path
|
||||
image.image = resize_image(path,
|
||||
self.width, self.height)
|
||||
self._cache[name] = image
|
||||
self._cache_dirty = True
|
||||
# only one thread please
|
||||
if not self._thread_running:
|
||||
self.image_thread.start()
|
||||
|
||||
def process(self):
|
||||
"""
|
||||
Controls the processing called from a QThread
|
||||
"""
|
||||
log.debug(u'process - started')
|
||||
self._thread_running = True
|
||||
self.clean_cache()
|
||||
# data loaded since we started ?
|
||||
while self._cache_dirty:
|
||||
log.debug(u'process - recycle')
|
||||
self.clean_cache()
|
||||
self._thread_running = False
|
||||
log.debug(u'process - ended')
|
||||
|
||||
def clean_cache(self):
|
||||
"""
|
||||
Actually does the work.
|
||||
"""
|
||||
log.debug(u'clean_cache')
|
||||
# we will clean the cache now
|
||||
self._cache_dirty = False
|
||||
for key in self._cache.keys():
|
||||
image = self._cache[key]
|
||||
if image.dirty:
|
||||
image.image_bytes = image_to_byte(image.image)
|
||||
image.dirty = False
|
|
@ -514,7 +514,7 @@ class MediaManagerItem(QtGui.QWidget):
|
|||
self.parent.serviceManager.addServiceItem(service_item,
|
||||
replace=True)
|
||||
else:
|
||||
#Turn off the remote edit update message indicator
|
||||
# Turn off the remote edit update message indicator
|
||||
QtGui.QMessageBox.information(self,
|
||||
translate('OpenLP.MediaManagerItem',
|
||||
'Invalid Service Item'),
|
||||
|
@ -541,4 +541,3 @@ class MediaManagerItem(QtGui.QWidget):
|
|||
individual service items need to be processed by the plugins
|
||||
"""
|
||||
pass
|
||||
|
||||
|
|
|
@ -156,9 +156,11 @@ class PluginManager(object):
|
|||
if plugin.settings_tab:
|
||||
log.debug(u'Inserting settings tab item from %s' %
|
||||
visible_title[u'title'])
|
||||
settingsform.addTab(visible_title[u'title'], plugin.settings_tab)
|
||||
settingsform.addTab(visible_title[u'title'],
|
||||
plugin.settings_tab)
|
||||
else:
|
||||
log.debug(u'No tab settings in %s' % visible_title[u'title'])
|
||||
log.debug(
|
||||
u'No tab settings in %s' % visible_title[u'title'])
|
||||
|
||||
def hook_import_menu(self, import_menu):
|
||||
"""
|
||||
|
|
|
@ -29,11 +29,10 @@ format it for the output display.
|
|||
"""
|
||||
import logging
|
||||
|
||||
from PyQt4 import QtGui, QtCore, QtWebKit
|
||||
|
||||
from openlp.core.lib import resize_image, expand_tags, \
|
||||
build_lyrics_format_css, build_lyrics_outline_css, image_to_byte
|
||||
from PyQt4 import QtWebKit
|
||||
|
||||
from openlp.core.lib import expand_tags, build_lyrics_format_css, \
|
||||
build_lyrics_outline_css
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
@ -51,11 +50,6 @@ class Renderer(object):
|
|||
self._rect = None
|
||||
self.theme_name = None
|
||||
self._theme = None
|
||||
self._bg_image_filename = None
|
||||
self.frame = None
|
||||
self.bg_frame = None
|
||||
self.bg_image = None
|
||||
self.bg_image_bytes = None
|
||||
|
||||
def set_theme(self, theme):
|
||||
"""
|
||||
|
@ -66,14 +60,7 @@ class Renderer(object):
|
|||
"""
|
||||
log.debug(u'set theme')
|
||||
self._theme = theme
|
||||
self.bg_frame = None
|
||||
self.bg_image = None
|
||||
self.bg_image_bytes = None
|
||||
self._bg_image_filename = None
|
||||
self.theme_name = theme.theme_name
|
||||
if theme.background_type == u'image':
|
||||
if theme.background_filename:
|
||||
self._bg_image_filename = unicode(theme.background_filename)
|
||||
|
||||
def set_text_rectangle(self, rect_main, rect_footer):
|
||||
"""
|
||||
|
@ -90,9 +77,9 @@ class Renderer(object):
|
|||
self._rect_footer = rect_footer
|
||||
self.page_width = self._rect.width()
|
||||
self.page_height = self._rect.height()
|
||||
if self._theme.display_shadow:
|
||||
self.page_width -= int(self._theme.display_shadow_size)
|
||||
self.page_height -= int(self._theme.display_shadow_size)
|
||||
if self._theme.font_main_shadow:
|
||||
self.page_width -= int(self._theme.font_main_shadow_size)
|
||||
self.page_height -= int(self._theme.font_main_shadow_size)
|
||||
self.web = QtWebKit.QWebView()
|
||||
self.web.setVisible(False)
|
||||
self.web.resize(self.page_width, self.page_height)
|
||||
|
@ -105,39 +92,6 @@ class Renderer(object):
|
|||
(build_lyrics_format_css(self._theme, self.page_width,
|
||||
self.page_height), build_lyrics_outline_css(self._theme))
|
||||
|
||||
def set_frame_dest(self, frame_width, frame_height):
|
||||
"""
|
||||
Set the size of the slide.
|
||||
|
||||
``frame_width``
|
||||
The width of the slide.
|
||||
|
||||
``frame_height``
|
||||
The height of the slide.
|
||||
|
||||
"""
|
||||
log.debug(u'set frame dest (frame) w %d h %d', frame_width,
|
||||
frame_height)
|
||||
self.frame = QtGui.QImage(frame_width, frame_height,
|
||||
QtGui.QImage.Format_ARGB32_Premultiplied)
|
||||
if self._bg_image_filename and not self.bg_image:
|
||||
self.bg_image = resize_image(self._bg_image_filename,
|
||||
self.frame.width(), self.frame.height())
|
||||
if self._theme.background_type == u'image':
|
||||
self.bg_frame = QtGui.QImage(self.frame.width(),
|
||||
self.frame.height(),
|
||||
QtGui.QImage.Format_ARGB32_Premultiplied)
|
||||
painter = QtGui.QPainter()
|
||||
painter.begin(self.bg_frame)
|
||||
painter.fillRect(self.frame.rect(), QtCore.Qt.black)
|
||||
if self.bg_image:
|
||||
painter.drawImage(0, 0, self.bg_image)
|
||||
painter.end()
|
||||
self.bg_image_bytes = image_to_byte(self.bg_frame)
|
||||
else:
|
||||
self.bg_frame = None
|
||||
self.bg_image_bytes = None
|
||||
|
||||
def format_slide(self, words, line_break):
|
||||
"""
|
||||
Figure out how much text can appear on a slide, using the current
|
||||
|
@ -161,18 +115,19 @@ class Renderer(object):
|
|||
html_text = u''
|
||||
styled_text = u''
|
||||
for line in text:
|
||||
styled_line = expand_tags(line)
|
||||
if styled_text:
|
||||
styled_text += line_end + styled_line
|
||||
styled_line = expand_tags(line) + line_end
|
||||
styled_text += styled_line
|
||||
html = self.page_shell + styled_text + u'</div></body></html>'
|
||||
self.web.setHtml(html)
|
||||
# Text too long so go to next page
|
||||
if self.web_frame.contentsSize().height() > self.page_height:
|
||||
if html_text.endswith(u'<br>'):
|
||||
html_text = html_text[:len(html_text)-4]
|
||||
formatted.append(html_text)
|
||||
html_text = u''
|
||||
styled_text = styled_line
|
||||
html_text += line + line_end
|
||||
if line_break:
|
||||
if html_text.endswith(u'<br>'):
|
||||
html_text = html_text[:len(html_text)-4]
|
||||
formatted.append(html_text)
|
||||
log.debug(u'format_slide - End')
|
||||
|
|
|
@ -28,7 +28,7 @@ import logging
|
|||
|
||||
from PyQt4 import QtCore
|
||||
|
||||
from openlp.core.lib import Renderer, ThemeLevel, ServiceItem
|
||||
from openlp.core.lib import Renderer, ThemeLevel, ServiceItem, ImageManager
|
||||
from openlp.core.ui import MainDisplay
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
@ -56,7 +56,9 @@ class RenderManager(object):
|
|||
"""
|
||||
log.debug(u'Initilisation started')
|
||||
self.screens = screens
|
||||
self.image_manager = ImageManager()
|
||||
self.display = MainDisplay(self, screens, False)
|
||||
self.display.imageManager = self.image_manager
|
||||
self.display.setup()
|
||||
self.theme_manager = theme_manager
|
||||
self.renderer = Renderer()
|
||||
|
@ -75,9 +77,11 @@ class RenderManager(object):
|
|||
log.debug(u'Update Display')
|
||||
self.calculate_default(self.screens.current[u'size'])
|
||||
self.display = MainDisplay(self, self.screens, False)
|
||||
self.display.imageManager = self.image_manager
|
||||
self.display.setup()
|
||||
self.renderer.bg_frame = None
|
||||
self.themedata = None
|
||||
self.image_manager.update_display(self.width, self.height)
|
||||
|
||||
def set_global_theme(self, global_theme, theme_level=ThemeLevel.Global):
|
||||
"""
|
||||
|
@ -153,7 +157,8 @@ class RenderManager(object):
|
|||
self.calculate_default(self.screens.current[u'size'])
|
||||
self.renderer.set_theme(self.themedata)
|
||||
self.build_text_rectangle(self.themedata)
|
||||
self.renderer.set_frame_dest(self.width, self.height)
|
||||
self.image_manager.add_image(self.themedata.theme_name,
|
||||
self.themedata.background_filename)
|
||||
return self.renderer._rect, self.renderer._rect_footer
|
||||
|
||||
def build_text_rectangle(self, theme):
|
||||
|
@ -211,7 +216,7 @@ class RenderManager(object):
|
|||
serviceItem.raw_footer = footer
|
||||
serviceItem.render(True)
|
||||
self.display.buildHtml(serviceItem)
|
||||
raw_html = serviceItem.get_rendered_frame(0)[1]
|
||||
raw_html = serviceItem.get_rendered_frame(0)
|
||||
preview = self.display.text(raw_html)
|
||||
# Reset the real screen size for subsequent render requests
|
||||
self.calculate_default(self.screens.current[u'size'])
|
||||
|
|
|
@ -30,12 +30,9 @@ type and capability of an item.
|
|||
|
||||
import logging
|
||||
import os
|
||||
import time
|
||||
import uuid
|
||||
|
||||
from PyQt4 import QtGui
|
||||
|
||||
from openlp.core.lib import build_icon, resize_image, clean_tags, expand_tags
|
||||
from openlp.core.lib import build_icon, clean_tags, expand_tags
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
@ -103,6 +100,7 @@ class ServiceItem(object):
|
|||
self.bg_image_bytes = None
|
||||
self.search_string = u''
|
||||
self.data_string = u''
|
||||
self.edit_id = None
|
||||
self._new_item()
|
||||
|
||||
def _new_item(self):
|
||||
|
@ -160,12 +158,10 @@ class ServiceItem(object):
|
|||
theme = self.theme
|
||||
self.main, self.footer = \
|
||||
self.render_manager.set_override_theme(theme, useOverride)
|
||||
self.bg_image_bytes = self.render_manager.renderer.bg_image_bytes
|
||||
self.themedata = self.render_manager.renderer._theme
|
||||
if self.service_item_type == ServiceItemType.Text:
|
||||
log.debug(u'Formatting slides')
|
||||
for slide in self._raw_frames:
|
||||
before = time.time()
|
||||
formatted = self.render_manager \
|
||||
.format_slide(slide[u'raw_slide'], line_break)
|
||||
for page in formatted:
|
||||
|
@ -174,12 +170,8 @@ class ServiceItem(object):
|
|||
u'text': clean_tags(page.rstrip()),
|
||||
u'html': expand_tags(page.rstrip()),
|
||||
u'verseTag': slide[u'verseTag'] })
|
||||
log.log(15, u'Formatting took %4s' % (time.time() - before))
|
||||
elif self.service_item_type == ServiceItemType.Image:
|
||||
for slide in self._raw_frames:
|
||||
slide[u'image'] = resize_image(slide[u'image'],
|
||||
self.render_manager.width, self.render_manager.height)
|
||||
elif self.service_item_type == ServiceItemType.Command:
|
||||
elif self.service_item_type == ServiceItemType.Image or \
|
||||
self.service_item_type == ServiceItemType.Command:
|
||||
pass
|
||||
else:
|
||||
log.error(u'Invalid value renderer :%s' % self.service_item_type)
|
||||
|
@ -192,7 +184,7 @@ class ServiceItem(object):
|
|||
else:
|
||||
self.foot_text = u'%s<br>%s' % (self.foot_text, foot)
|
||||
|
||||
def add_from_image(self, path, title, image):
|
||||
def add_from_image(self, path, title):
|
||||
"""
|
||||
Add an image slide to the service item.
|
||||
|
||||
|
@ -201,13 +193,11 @@ class ServiceItem(object):
|
|||
|
||||
``title``
|
||||
A title for the slide in the service item.
|
||||
|
||||
``image``
|
||||
The actual image file name.
|
||||
"""
|
||||
self.service_item_type = ServiceItemType.Image
|
||||
self._raw_frames.append(
|
||||
{u'title': title, u'image': image, u'path': path})
|
||||
{u'title': title, u'path': path})
|
||||
self.render_manager.image_manager.add_image(title, path)
|
||||
self._new_item()
|
||||
|
||||
def add_from_text(self, title, raw_slide, verse_tag=None):
|
||||
|
@ -223,7 +213,7 @@ class ServiceItem(object):
|
|||
self.service_item_type = ServiceItemType.Text
|
||||
title = title.split(u'\n')[0]
|
||||
self._raw_frames.append(
|
||||
{u'title': title, u'raw_slide': raw_slide, u'verseTag':verse_tag})
|
||||
{u'title': title, u'raw_slide': raw_slide, u'verseTag': verse_tag})
|
||||
self._new_item()
|
||||
|
||||
def add_from_command(self, path, file_name, image):
|
||||
|
@ -252,17 +242,17 @@ class ServiceItem(object):
|
|||
service_header = {
|
||||
u'name': self.name.lower(),
|
||||
u'plugin': self.name,
|
||||
u'theme':self.theme,
|
||||
u'title':self.title,
|
||||
u'icon':self.icon,
|
||||
u'footer':self.raw_footer,
|
||||
u'type':self.service_item_type,
|
||||
u'audit':self.audit,
|
||||
u'notes':self.notes,
|
||||
u'from_plugin':self.from_plugin,
|
||||
u'capabilities':self.capabilities,
|
||||
u'search':self.search_string,
|
||||
u'data':self.data_string
|
||||
u'theme': self.theme,
|
||||
u'title': self.title,
|
||||
u'icon': self.icon,
|
||||
u'footer': self.raw_footer,
|
||||
u'type': self.service_item_type,
|
||||
u'audit': self.audit,
|
||||
u'notes': self.notes,
|
||||
u'from_plugin': self.from_plugin,
|
||||
u'capabilities': self.capabilities,
|
||||
u'search': self.search_string,
|
||||
u'data': self.data_string
|
||||
}
|
||||
service_data = []
|
||||
if self.service_item_type == ServiceItemType.Text:
|
||||
|
@ -274,7 +264,7 @@ class ServiceItem(object):
|
|||
elif self.service_item_type == ServiceItemType.Command:
|
||||
for slide in self._raw_frames:
|
||||
service_data.append(
|
||||
{u'title':slide[u'title'], u'image':slide[u'image']})
|
||||
{u'title': slide[u'title'], u'image': slide[u'image']})
|
||||
return {u'header': service_header, u'data': service_data}
|
||||
|
||||
def set_from_service(self, serviceitem, path=None):
|
||||
|
@ -310,8 +300,7 @@ class ServiceItem(object):
|
|||
elif self.service_item_type == ServiceItemType.Image:
|
||||
for text_image in serviceitem[u'serviceitem'][u'data']:
|
||||
filename = os.path.join(path, text_image)
|
||||
real_image = QtGui.QImage(unicode(filename))
|
||||
self.add_from_image(path, text_image, real_image)
|
||||
self.add_from_image(filename, text_image)
|
||||
elif self.service_item_type == ServiceItemType.Command:
|
||||
for text_image in serviceitem[u'serviceitem'][u'data']:
|
||||
filename = os.path.join(path, text_image[u'title'])
|
||||
|
@ -387,9 +376,11 @@ class ServiceItem(object):
|
|||
renders it if required.
|
||||
"""
|
||||
if self.service_item_type == ServiceItemType.Text:
|
||||
return None, self._display_frames[row][u'html'].split(u'\n')[0]
|
||||
return self._display_frames[row][u'html'].split(u'\n')[0]
|
||||
elif self.service_item_type == ServiceItemType.Image:
|
||||
return self._raw_frames[row][u'title']
|
||||
else:
|
||||
return self._raw_frames[row][u'image'], u''
|
||||
return self._raw_frames[row][u'image']
|
||||
|
||||
def get_frame_title(self, row=0):
|
||||
"""
|
||||
|
@ -399,6 +390,6 @@ class ServiceItem(object):
|
|||
|
||||
def get_frame_path(self, row=0):
|
||||
"""
|
||||
Returns the title of the raw frame
|
||||
Returns the path of the raw frame
|
||||
"""
|
||||
return self._raw_frames[row][u'path']
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
###############################################################################
|
||||
|
||||
import re
|
||||
import sys
|
||||
try:
|
||||
import enchant
|
||||
from enchant import DictNotFoundError
|
||||
|
@ -37,7 +36,7 @@ except ImportError:
|
|||
# http://john.nachtimwald.com/2009/08/22/qplaintextedit-with-in-line-spell-check/
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
from openlp.core.lib import html_expands, translate, context_menu_action
|
||||
from openlp.core.lib import html_expands, translate
|
||||
|
||||
class SpellTextEdit(QtGui.QPlainTextEdit):
|
||||
def __init__(self, *args):
|
||||
|
|
|
@ -28,52 +28,56 @@ Provide the theme XML and handling functions for OpenLP v2 themes.
|
|||
"""
|
||||
import os
|
||||
import re
|
||||
import logging
|
||||
|
||||
from xml.dom.minidom import Document
|
||||
from xml.etree.ElementTree import ElementTree, XML
|
||||
from lxml import etree, objectify
|
||||
|
||||
from openlp.core.lib import str_to_bool
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
BLANK_THEME_XML = \
|
||||
'''<?xml version="1.0" encoding="utf-8"?>
|
||||
<theme version="1.0">
|
||||
<name>BlankStyle</name>
|
||||
<background mode="transparent"/>
|
||||
<background type="solid" mode="opaque">
|
||||
<color>#000000</color>
|
||||
<name> </name>
|
||||
<background type="image">
|
||||
<filename></filename>
|
||||
</background>
|
||||
<background type="gradient" mode="opaque">
|
||||
<background type="gradient">
|
||||
<startColor>#000000</startColor>
|
||||
<endColor>#000000</endColor>
|
||||
<direction>vertical</direction>
|
||||
</background>
|
||||
<background type="image" mode="opaque">
|
||||
<filename></filename>
|
||||
<background type="solid">
|
||||
<color>#000000</color>
|
||||
</background>
|
||||
<font type="main">
|
||||
<name>Arial</name>
|
||||
<color>#000000</color>
|
||||
<proportion>30</proportion>
|
||||
<weight>Normal</weight>
|
||||
<color>#FFFFFF</color>
|
||||
<size>30</size>
|
||||
<bold>False</bold>
|
||||
<italics>False</italics>
|
||||
<line_adjustment>0</line_adjustment>
|
||||
<shadow shadowColor="#000000" shadowSize="5">True</shadow>
|
||||
<outline outlineColor="#000000" outlineSize="2">False</outline>
|
||||
<location override="False" x="10" y="10" width="1004" height="690"/>
|
||||
</font>
|
||||
<font type="footer">
|
||||
<name>Arial</name>
|
||||
<color>#000000</color>
|
||||
<proportion>12</proportion>
|
||||
<weight>Normal</weight>
|
||||
<color>#FFFFFF</color>
|
||||
<size>12</size>
|
||||
<bold>False</bold>
|
||||
<italics>False</italics>
|
||||
<line_adjustment>0</line_adjustment>
|
||||
<shadow shadowColor="#000000" shadowSize="5">True</shadow>
|
||||
<outline outlineColor="#000000" outlineSize="2">False</outline>
|
||||
<location override="False" x="10" y="690" width="1004" height="78"/>
|
||||
</font>
|
||||
<display>
|
||||
<shadow color="#000000" size="5">True</shadow>
|
||||
<outline color="#000000" size="2">False</outline>
|
||||
<horizontalAlign>0</horizontalAlign>
|
||||
<verticalAlign>0</verticalAlign>
|
||||
<wrapStyle>0</wrapStyle>
|
||||
<slideTransition>False</slideTransition>
|
||||
</display>
|
||||
</theme>
|
||||
|
@ -87,12 +91,78 @@ class ThemeLevel(object):
|
|||
Service = 2
|
||||
Song = 3
|
||||
|
||||
boolean_list = [u'italics', u'override', u'outline', u'shadow', \
|
||||
u'slide_transition']
|
||||
class BackgroundType(object):
|
||||
Solid = 0
|
||||
Gradient = 1
|
||||
Image = 2
|
||||
|
||||
integer_list =[u'proportion', u'line_adjustment', u'x', u'height', u'y', \
|
||||
u'width', u'shadow_size', u'outline_size', u'horizontal_align', \
|
||||
u'vertical_align', u'wrap_style' ]
|
||||
@staticmethod
|
||||
def to_string(type):
|
||||
if type == BackgroundType.Solid:
|
||||
return u'solid'
|
||||
elif type == BackgroundType.Gradient:
|
||||
return u'gradient'
|
||||
elif type == BackgroundType.Image:
|
||||
return u'image'
|
||||
|
||||
@staticmethod
|
||||
def from_string(type_string):
|
||||
if type_string == u'solid':
|
||||
return BackgroundType.Solid
|
||||
elif type_string == u'gradient':
|
||||
return BackgroundType.Gradient
|
||||
elif type_string == u'image':
|
||||
return BackgroundType.Image
|
||||
|
||||
class BackgroundGradientType(object):
|
||||
Horizontal = 0
|
||||
Vertical = 1
|
||||
Circular = 2
|
||||
LeftTop = 3
|
||||
LeftBottom = 4
|
||||
|
||||
@staticmethod
|
||||
def to_string(type):
|
||||
if type == BackgroundGradientType.Horizontal:
|
||||
return u'horizontal'
|
||||
elif type == BackgroundGradientType.Vertical:
|
||||
return u'vertical'
|
||||
elif type == BackgroundGradientType.Circular:
|
||||
return u'circular'
|
||||
elif type == BackgroundGradientType.LeftTop:
|
||||
return u'leftTop'
|
||||
elif type == BackgroundGradientType.LeftBottom:
|
||||
return u'leftBottom'
|
||||
|
||||
@staticmethod
|
||||
def from_string(type_string):
|
||||
if type_string == u'horizontal':
|
||||
return BackgroundGradientType.Horizontal
|
||||
elif type_string == u'vertical':
|
||||
return BackgroundGradientType.Vertical
|
||||
elif type_string == u'circular':
|
||||
return BackgroundGradientType.Circular
|
||||
elif type_string == u'leftTop':
|
||||
return BackgroundGradientType.LeftTop
|
||||
elif type_string == u'leftBottom':
|
||||
return BackgroundGradientType.LeftBottom
|
||||
|
||||
class HorizontalType(object):
|
||||
Left = 0
|
||||
Center = 1
|
||||
Right = 2
|
||||
|
||||
class VerticalType(object):
|
||||
Top = 0
|
||||
Middle = 1
|
||||
Bottom = 2
|
||||
|
||||
boolean_list = [u'italics', u'override', u'outline', u'shadow',
|
||||
u'slide_transition']
|
||||
|
||||
integer_list = [u'size', u'line_adjustment', u'x', u'height', u'y',
|
||||
u'width', u'shadow_size', u'outline_size', u'horizontal_align',
|
||||
u'vertical_align', u'wrap_style']
|
||||
|
||||
class ThemeXML(object):
|
||||
"""
|
||||
|
@ -104,6 +174,7 @@ class ThemeXML(object):
|
|||
"""
|
||||
# Create the minidom document
|
||||
self.theme_xml = Document()
|
||||
self.parse_xml(BLANK_THEME_XML)
|
||||
|
||||
def extend_image_filename(self, path):
|
||||
"""
|
||||
|
@ -112,19 +183,21 @@ class ThemeXML(object):
|
|||
``path``
|
||||
The path name to be added.
|
||||
"""
|
||||
if self.background_filename and path:
|
||||
self.theme_name = self.theme_name.strip()
|
||||
self.background_filename = self.background_filename.strip()
|
||||
self.background_filename = os.path.join(path, self.theme_name,
|
||||
self.background_filename)
|
||||
if self.background_type == u'image':
|
||||
if self.background_filename and path:
|
||||
self.theme_name = self.theme_name.strip()
|
||||
self.background_filename = self.background_filename.strip()
|
||||
self.background_filename = os.path.join(path, self.theme_name,
|
||||
self.background_filename)
|
||||
|
||||
def new_document(self, name):
|
||||
def _new_document(self, name):
|
||||
"""
|
||||
Create a new theme XML document.
|
||||
"""
|
||||
self.theme_xml = Document()
|
||||
self.theme = self.theme_xml.createElement(u'theme')
|
||||
self.theme_xml.appendChild(self.theme)
|
||||
self.theme.setAttribute(u'version', u'1.0')
|
||||
self.theme.setAttribute(u'version', u'2.0')
|
||||
self.name = self.theme_xml.createElement(u'name')
|
||||
text_node = self.theme_xml.createTextNode(name)
|
||||
self.name.appendChild(text_node)
|
||||
|
@ -146,10 +219,9 @@ class ThemeXML(object):
|
|||
The color of the background.
|
||||
"""
|
||||
background = self.theme_xml.createElement(u'background')
|
||||
background.setAttribute(u'mode', u'opaque')
|
||||
background.setAttribute(u'type', u'solid')
|
||||
self.theme.appendChild(background)
|
||||
self.child_element(background, u'color', bkcolor)
|
||||
self.child_element(background, u'color', unicode(bkcolor))
|
||||
|
||||
def add_background_gradient(self, startcolor, endcolor, direction):
|
||||
"""
|
||||
|
@ -165,15 +237,14 @@ class ThemeXML(object):
|
|||
The direction of the gradient.
|
||||
"""
|
||||
background = self.theme_xml.createElement(u'background')
|
||||
background.setAttribute(u'mode', u'opaque')
|
||||
background.setAttribute(u'type', u'gradient')
|
||||
self.theme.appendChild(background)
|
||||
# Create startColor element
|
||||
self.child_element(background, u'startColor', startcolor)
|
||||
self.child_element(background, u'startColor', unicode(startcolor))
|
||||
# Create endColor element
|
||||
self.child_element(background, u'endColor', endcolor)
|
||||
self.child_element(background, u'endColor', unicode(endcolor))
|
||||
# Create direction element
|
||||
self.child_element(background, u'direction', direction)
|
||||
self.child_element(background, u'direction', unicode(direction))
|
||||
|
||||
def add_background_image(self, filename):
|
||||
"""
|
||||
|
@ -183,15 +254,15 @@ class ThemeXML(object):
|
|||
The file name of the image.
|
||||
"""
|
||||
background = self.theme_xml.createElement(u'background')
|
||||
background.setAttribute(u'mode', u'opaque')
|
||||
background.setAttribute(u'type', u'image')
|
||||
self.theme.appendChild(background)
|
||||
#Create Filename element
|
||||
# Create Filename element
|
||||
self.child_element(background, u'filename', filename)
|
||||
|
||||
def add_font(self, name, color, proportion, override, fonttype=u'main',
|
||||
weight=u'Normal', italics=u'False', line_adjustment=0,
|
||||
xpos=0, ypos=0, width=0, height=0):
|
||||
def add_font(self, name, color, size, override, fonttype=u'main',
|
||||
bold=u'False', italics=u'False', line_adjustment=0,
|
||||
xpos=0, ypos=0, width=0, height=0 , outline=u'False', outline_color=u'#ffffff',
|
||||
outline_pixel=2, shadow=u'False', shadow_color=u'#ffffff', shadow_pixel=5):
|
||||
"""
|
||||
Add a Font.
|
||||
|
||||
|
@ -201,7 +272,7 @@ class ThemeXML(object):
|
|||
``color``
|
||||
The colour of the font.
|
||||
|
||||
``proportion``
|
||||
``size``
|
||||
The size of the font.
|
||||
|
||||
``override``
|
||||
|
@ -227,45 +298,6 @@ class ThemeXML(object):
|
|||
|
||||
``height``
|
||||
The height of the text block.
|
||||
"""
|
||||
background = self.theme_xml.createElement(u'font')
|
||||
background.setAttribute(u'type', fonttype)
|
||||
self.theme.appendChild(background)
|
||||
#Create Font name element
|
||||
self.child_element(background, u'name', name)
|
||||
#Create Font color element
|
||||
self.child_element(background, u'color', color)
|
||||
#Create Proportion name element
|
||||
self.child_element(background, u'proportion', proportion)
|
||||
#Create weight name element
|
||||
self.child_element(background, u'weight', weight)
|
||||
#Create italics name element
|
||||
self.child_element(background, u'italics', italics)
|
||||
#Create indentation name element
|
||||
self.child_element(
|
||||
background, u'line_adjustment', unicode(line_adjustment))
|
||||
|
||||
#Create Location element
|
||||
element = self.theme_xml.createElement(u'location')
|
||||
element.setAttribute(u'override', override)
|
||||
if override == u'True':
|
||||
element.setAttribute(u'x', xpos)
|
||||
element.setAttribute(u'y', ypos)
|
||||
element.setAttribute(u'width', width)
|
||||
element.setAttribute(u'height', height)
|
||||
background.appendChild(element)
|
||||
|
||||
def add_display(self, shadow, shadow_color, outline, outline_color,
|
||||
horizontal, vertical, wrap, transition, shadow_pixel=5,
|
||||
outline_pixel=2):
|
||||
"""
|
||||
Add a Display options.
|
||||
|
||||
``shadow``
|
||||
Whether or not to show a shadow.
|
||||
|
||||
``shadow_color``
|
||||
The colour of the shadow.
|
||||
|
||||
``outline``
|
||||
Whether or not to show an outline.
|
||||
|
@ -273,53 +305,88 @@ class ThemeXML(object):
|
|||
``outline_color``
|
||||
The colour of the outline.
|
||||
|
||||
``outline_size``
|
||||
How big the Shadow is
|
||||
|
||||
``shadow``
|
||||
Whether or not to show a shadow.
|
||||
|
||||
``shadow_color``
|
||||
The colour of the shadow.
|
||||
|
||||
``shadow_size``
|
||||
How big the Shadow is
|
||||
|
||||
|
||||
"""
|
||||
background = self.theme_xml.createElement(u'font')
|
||||
background.setAttribute(u'type', fonttype)
|
||||
self.theme.appendChild(background)
|
||||
# Create Font name element
|
||||
self.child_element(background, u'name', name)
|
||||
# Create Font color element
|
||||
self.child_element(background, u'color', color)
|
||||
# Create Proportion name element
|
||||
self.child_element(background, u'size', unicode(size))
|
||||
# Create weight name element
|
||||
self.child_element(background, u'bold', unicode(bold))
|
||||
# Create italics name element
|
||||
self.child_element(background, u'italics', unicode(italics))
|
||||
# Create indentation name element
|
||||
self.child_element(
|
||||
background, u'line_adjustment', unicode(line_adjustment))
|
||||
# Create Location element
|
||||
element = self.theme_xml.createElement(u'location')
|
||||
element.setAttribute(u'override', unicode(override))
|
||||
element.setAttribute(u'x', unicode(xpos))
|
||||
element.setAttribute(u'y', unicode(ypos))
|
||||
element.setAttribute(u'width', unicode(width))
|
||||
element.setAttribute(u'height', unicode(height))
|
||||
background.appendChild(element)
|
||||
# Shadow
|
||||
element = self.theme_xml.createElement(u'shadow')
|
||||
element.setAttribute(u'shadowColor', unicode(shadow_color))
|
||||
element.setAttribute(u'shadowSize', unicode(shadow_pixel))
|
||||
value = self.theme_xml.createTextNode(unicode(shadow))
|
||||
element.appendChild(value)
|
||||
background.appendChild(element)
|
||||
# Outline
|
||||
element = self.theme_xml.createElement(u'outline')
|
||||
element.setAttribute(u'outlineColor', unicode(outline_color))
|
||||
element.setAttribute(u'outlineSize', unicode(outline_pixel))
|
||||
value = self.theme_xml.createTextNode(unicode(outline))
|
||||
element.appendChild(value)
|
||||
background.appendChild(element)
|
||||
|
||||
def add_display(self, horizontal, vertical, transition):
|
||||
"""
|
||||
Add a Display options.
|
||||
|
||||
``horizontal``
|
||||
The horizontal alignment of the text.
|
||||
|
||||
``vertical``
|
||||
The vertical alignment of the text.
|
||||
|
||||
``wrap``
|
||||
Wrap style.
|
||||
|
||||
``transition``
|
||||
Whether the slide transition is active.
|
||||
|
||||
"""
|
||||
background = self.theme_xml.createElement(u'display')
|
||||
self.theme.appendChild(background)
|
||||
# Shadow
|
||||
element = self.theme_xml.createElement(u'shadow')
|
||||
element.setAttribute(u'color', shadow_color)
|
||||
element.setAttribute(u'size', unicode(shadow_pixel))
|
||||
value = self.theme_xml.createTextNode(shadow)
|
||||
element.appendChild(value)
|
||||
background.appendChild(element)
|
||||
# Outline
|
||||
element = self.theme_xml.createElement(u'outline')
|
||||
element.setAttribute(u'color', outline_color)
|
||||
element.setAttribute(u'size', unicode(outline_pixel))
|
||||
value = self.theme_xml.createTextNode(outline)
|
||||
element.appendChild(value)
|
||||
background.appendChild(element)
|
||||
# Horizontal alignment
|
||||
element = self.theme_xml.createElement(u'horizontalAlign')
|
||||
value = self.theme_xml.createTextNode(horizontal)
|
||||
value = self.theme_xml.createTextNode(unicode(horizontal))
|
||||
element.appendChild(value)
|
||||
background.appendChild(element)
|
||||
# Vertical alignment
|
||||
element = self.theme_xml.createElement(u'verticalAlign')
|
||||
value = self.theme_xml.createTextNode(vertical)
|
||||
element.appendChild(value)
|
||||
background.appendChild(element)
|
||||
# Wrap style
|
||||
element = self.theme_xml.createElement(u'wrapStyle')
|
||||
value = self.theme_xml.createTextNode(wrap)
|
||||
value = self.theme_xml.createTextNode(unicode(vertical))
|
||||
element.appendChild(value)
|
||||
background.appendChild(element)
|
||||
# Slide Transition
|
||||
element = self.theme_xml.createElement(u'slideTransition')
|
||||
value = self.theme_xml.createTextNode(transition)
|
||||
value = self.theme_xml.createTextNode(unicode(transition))
|
||||
element.appendChild(value)
|
||||
background.appendChild(element)
|
||||
|
||||
|
@ -342,12 +409,14 @@ class ThemeXML(object):
|
|||
"""
|
||||
Print out the XML string.
|
||||
"""
|
||||
self._build_xml_from_attrs()
|
||||
return self.theme_xml.toxml(u'utf-8').decode(u'utf-8')
|
||||
|
||||
def extract_formatted_xml(self):
|
||||
"""
|
||||
Pull out the XML string formatted for human consumption
|
||||
"""
|
||||
self._build_xml_from_attrs()
|
||||
return self.theme_xml.toprettyxml(indent=u' ', newl=u'\n',
|
||||
encoding=u'utf-8')
|
||||
|
||||
|
@ -358,8 +427,7 @@ class ThemeXML(object):
|
|||
``xml``
|
||||
The XML string to parse.
|
||||
"""
|
||||
self.parse_xml(BLANK_THEME_XML)
|
||||
self.parse_xml(xml)
|
||||
self.parse_xml(unicode(xml))
|
||||
|
||||
def parse_xml(self, xml):
|
||||
"""
|
||||
|
@ -368,47 +436,95 @@ class ThemeXML(object):
|
|||
``xml``
|
||||
The XML string to parse.
|
||||
"""
|
||||
theme_xml = ElementTree(element=XML(xml.encode(u'ascii',
|
||||
u'xmlcharrefreplace')))
|
||||
# remove encoding string
|
||||
line = xml.find(u'?>')
|
||||
if line:
|
||||
xml = xml[line + 2:]
|
||||
try:
|
||||
theme_xml = objectify.fromstring(xml)
|
||||
except etree.XMLSyntaxError:
|
||||
log.exception(u'Invalid xml %s', xml)
|
||||
return
|
||||
xml_iter = theme_xml.getiterator()
|
||||
master = u''
|
||||
for element in xml_iter:
|
||||
if not isinstance(element.text, unicode):
|
||||
element.text = unicode(str(element.text), u'utf-8')
|
||||
if element.getchildren():
|
||||
master = element.tag + u'_'
|
||||
parent = element.getparent()
|
||||
master = u''
|
||||
if parent is not None:
|
||||
if element.getparent().tag == u'font':
|
||||
master = element.getparent().tag + u'_' + \
|
||||
element.getparent().attrib[u'type']
|
||||
# set up Outline and Shadow Tags and move to font_main
|
||||
if element.getparent().tag == u'display':
|
||||
if element.tag.startswith(u'shadow') or \
|
||||
element.tag.startswith(u'outline'):
|
||||
self._create_attr(u'font_main', element.tag, element.text)
|
||||
master = element.getparent().tag
|
||||
if element.getparent().tag == u'background':
|
||||
master = element.getparent().tag
|
||||
if element.getparent().attrib:
|
||||
for attr in element.getparent().attrib:
|
||||
self._create_attr(master, attr, \
|
||||
element.getparent().attrib[attr])
|
||||
if master:
|
||||
self._create_attr(master, element.tag, element.text)
|
||||
if element.attrib:
|
||||
for attr in element.attrib:
|
||||
base_element = attr
|
||||
# correction for the shadow and outline tags
|
||||
if element.tag == u'shadow' or element.tag == u'outline':
|
||||
if not attr.startswith(element.tag):
|
||||
base_element = element.tag + u'_' + attr
|
||||
self._create_attr(master, base_element,
|
||||
element.attrib[attr])
|
||||
else:
|
||||
# background transparent tags have no children so special case
|
||||
if element.tag == u'background':
|
||||
for e in element.attrib.iteritems():
|
||||
self._create_attr(element.tag , e[0], e[1])
|
||||
if element.attrib:
|
||||
for e in element.attrib.iteritems():
|
||||
if master == u'font_' and e[0] == u'type':
|
||||
master += e[1] + u'_'
|
||||
elif master == u'display_' and (element.tag == u'shadow' \
|
||||
or element.tag == u'outline' ):
|
||||
self._create_attr(master, element.tag, element.text)
|
||||
self._create_attr(master, element.tag + u'_'+ e[0], e[1])
|
||||
else:
|
||||
field = master + e[0]
|
||||
self._create_attr(master, e[0], e[1])
|
||||
if element.tag == u'name':
|
||||
self._create_attr(u'theme', element.tag, element.text)
|
||||
|
||||
def _translate_tags(self, master, element, value):
|
||||
"""
|
||||
Clean up XML removing and redefining tags
|
||||
"""
|
||||
master = master.strip().lstrip()
|
||||
element = element.strip().lstrip()
|
||||
value = unicode(value).strip().lstrip()
|
||||
if master == u'display':
|
||||
if element == u'wrapStyle':
|
||||
return True, None, None, None
|
||||
if element.startswith(u'shadow') or element.startswith(u'outline'):
|
||||
master = u'font_main'
|
||||
# fix bold font
|
||||
if element == u'weight':
|
||||
element = u'bold'
|
||||
if value == u'Normal':
|
||||
value = False
|
||||
else:
|
||||
if element.tag:
|
||||
element.text = element.text.strip().lstrip()
|
||||
self._create_attr(master , element.tag, element.text)
|
||||
value = True
|
||||
if element == u'proportion':
|
||||
element = u'size'
|
||||
return False, master, element, value
|
||||
|
||||
def _create_attr(self, master , element, value):
|
||||
"""
|
||||
Create the attributes with the correct data types and name format
|
||||
"""
|
||||
reject, master, element, value = \
|
||||
self._translate_tags(master, element, value)
|
||||
if reject:
|
||||
return
|
||||
field = self._de_hump(element)
|
||||
tag = master + u'_' + field
|
||||
if field in boolean_list:
|
||||
setattr(self, master + field, str_to_bool(value))
|
||||
setattr(self, tag, str_to_bool(value))
|
||||
elif field in integer_list:
|
||||
setattr(self, master + field, int(value))
|
||||
setattr(self, tag, int(value))
|
||||
else:
|
||||
setattr(self, master + field, unicode(value))
|
||||
# make string value unicode
|
||||
if not isinstance(value, unicode):
|
||||
value = unicode(str(value), u'utf-8')
|
||||
# None means an empty string so lets have one.
|
||||
if value == u'None':
|
||||
value = u''
|
||||
setattr(self, tag, unicode(value).strip().lstrip())
|
||||
|
||||
def __str__(self):
|
||||
"""
|
||||
|
@ -427,3 +543,58 @@ class ThemeXML(object):
|
|||
s1 = re.sub(u'(.)([A-Z][a-z]+)', r'\1_\2', name)
|
||||
return re.sub(u'([a-z0-9])([A-Z])', r'\1_\2', s1).lower()
|
||||
|
||||
def _build_xml_from_attrs(self):
|
||||
"""
|
||||
Build the XML from the varables in the object
|
||||
"""
|
||||
self._new_document(self.theme_name)
|
||||
if self.background_type == \
|
||||
BackgroundType.to_string(BackgroundType.Solid):
|
||||
self.add_background_solid(self.background_color)
|
||||
elif self.background_type == \
|
||||
BackgroundType.to_string(BackgroundType.Gradient):
|
||||
self.add_background_gradient(
|
||||
self.background_start_color,
|
||||
self.background_end_color,
|
||||
self.background_direction)
|
||||
else:
|
||||
filename = \
|
||||
os.path.split(self.background_filename)[1]
|
||||
self.add_background_image(filename)
|
||||
self.add_font(self.font_main_name,
|
||||
self.font_main_color,
|
||||
self.font_main_size,
|
||||
self.font_main_override, u'main',
|
||||
self.font_main_bold,
|
||||
self.font_main_italics,
|
||||
self.font_main_line_adjustment,
|
||||
self.font_main_x,
|
||||
self.font_main_y,
|
||||
self.font_main_width,
|
||||
self.font_main_height,
|
||||
self.font_main_outline,
|
||||
self.font_main_outline_color,
|
||||
self.font_main_outline_size,
|
||||
self.font_main_shadow,
|
||||
self.font_main_shadow_color,
|
||||
self.font_main_shadow_size)
|
||||
self.add_font(self.font_footer_name,
|
||||
self.font_footer_color,
|
||||
self.font_footer_size,
|
||||
self.font_footer_override, u'footer',
|
||||
self.font_footer_bold,
|
||||
self.font_footer_italics,
|
||||
0, # line adjustment
|
||||
self.font_footer_x,
|
||||
self.font_footer_y,
|
||||
self.font_footer_width,
|
||||
self.font_footer_height,
|
||||
self.font_footer_outline,
|
||||
self.font_footer_outline_color,
|
||||
self.font_footer_outline_size,
|
||||
self.font_footer_shadow,
|
||||
self.font_footer_shadow_color,
|
||||
self.font_footer_shadow_size)
|
||||
self.add_display(self.display_horizontal_align,
|
||||
self.display_vertical_align,
|
||||
self.display_slide_transition)
|
||||
|
|
|
@ -37,13 +37,12 @@ class HideMode(object):
|
|||
Theme = 2
|
||||
Screen = 3
|
||||
|
||||
from themeform import ThemeForm
|
||||
from filerenameform import FileRenameForm
|
||||
from maindisplay import MainDisplay
|
||||
from slidecontroller import HideMode
|
||||
from servicenoteform import ServiceNoteForm
|
||||
from serviceitemeditform import ServiceItemEditForm
|
||||
from screen import ScreenList
|
||||
from amendthemeform import AmendThemeForm
|
||||
from slidecontroller import SlideController
|
||||
from splashscreen import SplashScreen
|
||||
from generaltab import GeneralTab
|
||||
|
@ -52,10 +51,11 @@ from advancedtab import AdvancedTab
|
|||
from aboutform import AboutForm
|
||||
from pluginform import PluginForm
|
||||
from settingsform import SettingsForm
|
||||
from shortcutlistform import ShortcutListForm
|
||||
from mediadockmanager import MediaDockManager
|
||||
from servicemanager import ServiceManager
|
||||
from thememanager import ThemeManager
|
||||
|
||||
__all__ = ['SplashScreen', 'AboutForm', 'SettingsForm',
|
||||
'MainDisplay', 'SlideController', 'ServiceManager', 'ThemeManager',
|
||||
'AmendThemeForm', 'MediaDockManager', 'ServiceItemEditForm']
|
||||
'MediaDockManager', 'ServiceItemEditForm']
|
||||
|
|
|
@ -81,9 +81,13 @@ class AdvancedTab(SettingsTab):
|
|||
self.doubleClickLiveCheckBox = QtGui.QCheckBox(self.uiGroupBox)
|
||||
self.doubleClickLiveCheckBox.setObjectName(u'doubleClickLiveCheckBox')
|
||||
self.uiLayout.addWidget(self.doubleClickLiveCheckBox)
|
||||
# self.expandServiceItemCheckBox = QtGui.QCheckBox(self.uiGroupBox)
|
||||
# self.expandServiceItemCheckBox.setObjectName(u'expandServiceItemCheckBox')
|
||||
# self.uiLayout.addWidget(self.expandServiceItemCheckBox)
|
||||
self.leftLayout.addWidget(self.uiGroupBox)
|
||||
self.expandServiceItemCheckBox = QtGui.QCheckBox(self.uiGroupBox)
|
||||
self.expandServiceItemCheckBox.setObjectName(u'expandServiceItemCheckBox')
|
||||
self.expandServiceItemCheckBox.setObjectName(
|
||||
u'expandServiceItemCheckBox')
|
||||
self.uiLayout.addWidget(self.expandServiceItemCheckBox)
|
||||
# self.sharedDirGroupBox = QtGui.QGroupBox(self.leftWidget)
|
||||
# self.sharedDirGroupBox.setObjectName(u'sharedDirGroupBox')
|
||||
|
|
|
@ -90,6 +90,16 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
|
|||
QtCore.QObject.connect(self.fontMainSizeSpinBox,
|
||||
QtCore.SIGNAL(u'editingFinished()'),
|
||||
self.onFontMainSizeSpinBoxChanged)
|
||||
QtCore.QObject.connect(self.fontMainLineAdjustmentSpinBox,
|
||||
QtCore.SIGNAL(u'editingFinished()'),
|
||||
self.onFontMainLineAdjustmentSpinBoxChanged)
|
||||
QtCore.QObject.connect(self.shadowSpinBox,
|
||||
QtCore.SIGNAL(u'editingFinished()'),
|
||||
self.onShadowSpinBoxChanged)
|
||||
QtCore.QObject.connect(self.outlineSpinBox,
|
||||
QtCore.SIGNAL(u'editingFinished()'),
|
||||
self.onOutlineSpinBoxChanged)
|
||||
|
||||
QtCore.QObject.connect(self.fontFooterSizeSpinBox,
|
||||
QtCore.SIGNAL(u'editingFinished()'),
|
||||
self.onFontFooterSizeSpinBoxChanged)
|
||||
|
@ -118,12 +128,7 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
|
|||
QtCore.QObject.connect(self.fontFooterHeightSpinBox,
|
||||
QtCore.SIGNAL(u'editingFinished()'),
|
||||
self.onFontFooterHeightSpinBoxChanged)
|
||||
QtCore.QObject.connect(self.shadowSpinBox,
|
||||
QtCore.SIGNAL(u'editingFinished()'),
|
||||
self.onShadowSpinBoxChanged)
|
||||
QtCore.QObject.connect(self.outlineSpinBox,
|
||||
QtCore.SIGNAL(u'editingFinished()'),
|
||||
self.onOutlineSpinBoxChanged)
|
||||
|
||||
# CheckBoxes
|
||||
QtCore.QObject.connect(self.fontMainDefaultCheckBox,
|
||||
QtCore.SIGNAL(u'stateChanged(int)'),
|
||||
|
@ -525,7 +530,7 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
|
|||
else:
|
||||
self.gradientComboBox.setCurrentIndex(2)
|
||||
# Font Main Tab
|
||||
self.fontMainComboBox.setCurrentFont(
|
||||
self.mainFontComboBox.setCurrentFont(
|
||||
QtGui.QFont(self.theme.font_main_name))
|
||||
self.fontMainSizeSpinBox.setValue(self.theme.font_main_proportion)
|
||||
if not self.theme.font_main_italics and \
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||
###############################################################################
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
from PyQt4 import QtGui
|
||||
|
||||
from exceptiondialog import Ui_ExceptionDialog
|
||||
|
||||
|
|
|
@ -34,7 +34,8 @@ class Ui_FileRenameDialog(object):
|
|||
FileRenameDialog.resize(400, 87)
|
||||
self.buttonBox = QtGui.QDialogButtonBox(FileRenameDialog)
|
||||
self.buttonBox.setGeometry(QtCore.QRect(210, 50, 171, 25))
|
||||
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
|
||||
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel |
|
||||
QtGui.QDialogButtonBox.Ok)
|
||||
self.buttonBox.setObjectName("buttonBox")
|
||||
self.widget = QtGui.QWidget(FileRenameDialog)
|
||||
self.widget.setGeometry(QtCore.QRect(10, 10, 381, 35))
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from filerenamedialog import Ui_FileRenameDialog
|
||||
from openlp.core.lib import translate
|
||||
|
||||
class FileRenameForm(QtGui.QDialog, Ui_FileRenameDialog):
|
||||
"""
|
||||
|
|
|
@ -30,13 +30,13 @@ import os
|
|||
from PyQt4 import QtCore, QtGui, QtWebKit
|
||||
from PyQt4.phonon import Phonon
|
||||
|
||||
from openlp.core.lib import Receiver, resize_image, build_html, ServiceItem, \
|
||||
image_to_byte
|
||||
from openlp.core.lib import Receiver, build_html, ServiceItem, image_to_byte
|
||||
from openlp.core.ui import HideMode
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
#http://www.steveheffernan.com/html5-video-player/demo-video-player.html
|
||||
#http://html5demos.com/two-videos
|
||||
|
||||
class DisplayWidget(QtGui.QGraphicsView):
|
||||
"""
|
||||
|
@ -90,6 +90,9 @@ class DisplayWidget(QtGui.QGraphicsView):
|
|||
event.ignore()
|
||||
|
||||
class MainDisplay(DisplayWidget):
|
||||
"""
|
||||
This is the display screen.
|
||||
"""
|
||||
|
||||
def __init__(self, parent, screens, live):
|
||||
DisplayWidget.__init__(self, live, parent=None)
|
||||
|
@ -184,7 +187,7 @@ class MainDisplay(DisplayWidget):
|
|||
`slide`
|
||||
The slide text to be displayed
|
||||
"""
|
||||
log.debug(u'text')
|
||||
log.debug(u'text to display')
|
||||
# Wait for the webview to update before displayiong text.
|
||||
while not self.loaded:
|
||||
Receiver.send_message(u'openlp_process_events')
|
||||
|
@ -199,7 +202,7 @@ class MainDisplay(DisplayWidget):
|
|||
`slide`
|
||||
The slide text to be displayed
|
||||
"""
|
||||
log.debug(u'alert')
|
||||
log.debug(u'alert to display')
|
||||
if self.height() != self.screen[u'size'].height() \
|
||||
or not self.isVisible() or self.videoWidget.isVisible():
|
||||
shrink = True
|
||||
|
@ -219,10 +222,17 @@ class MainDisplay(DisplayWidget):
|
|||
shrinkItem.setVisible(True)
|
||||
else:
|
||||
shrinkItem.setVisible(False)
|
||||
shrinkItem.resize(self.screen[u'size'].width(),
|
||||
shrinkItem.resize(self.screen[u'size'].width(),
|
||||
self.screen[u'size'].height())
|
||||
|
||||
def image(self, image):
|
||||
def directImage(self, name, path):
|
||||
"""
|
||||
API for replacement backgrounds so Images are added directly to cache
|
||||
"""
|
||||
image = self.imageManager.add_image(name, path)
|
||||
self.image(name)
|
||||
|
||||
def image(self, name):
|
||||
"""
|
||||
Add an image as the background. The image is converted to a
|
||||
bytestream on route.
|
||||
|
@ -230,25 +240,21 @@ class MainDisplay(DisplayWidget):
|
|||
`Image`
|
||||
The Image to be displayed can be QImage or QPixmap
|
||||
"""
|
||||
log.debug(u'image')
|
||||
image = resize_image(image, self.screen[u'size'].width(),
|
||||
self.screen[u'size'].height())
|
||||
log.debug(u'image to display')
|
||||
image = self.imageManager.get_image_bytes(name)
|
||||
self.resetVideo()
|
||||
self.displayImage(image)
|
||||
# show screen
|
||||
if self.isLive:
|
||||
self.setVisible(True)
|
||||
return self.preview()
|
||||
|
||||
def displayImage(self, image):
|
||||
"""
|
||||
Display an image, as is.
|
||||
"""
|
||||
if image:
|
||||
if isinstance(image, QtGui.QImage):
|
||||
js = u'show_image("data:image/png;base64,%s");' % \
|
||||
image_to_byte(image)
|
||||
else:
|
||||
js = u'show_image("data:image/png;base64,%s");' % image
|
||||
js = u'show_image("data:image/png;base64,%s");' % image
|
||||
else:
|
||||
js = u'show_image("");'
|
||||
self.frame.evaluateJavaScript(js)
|
||||
|
@ -395,6 +401,9 @@ class MainDisplay(DisplayWidget):
|
|||
self.loaded = False
|
||||
self.initialFrame = False
|
||||
self.serviceItem = serviceItem
|
||||
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)
|
||||
log.debug(u'buildHtml - pre setHtml')
|
||||
|
|
|
@ -29,10 +29,12 @@ import logging
|
|||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.ui import AboutForm, SettingsForm, ServiceManager, \
|
||||
ThemeManager, SlideController, PluginForm, MediaDockManager
|
||||
ThemeManager, SlideController, PluginForm, MediaDockManager, \
|
||||
ShortcutListForm
|
||||
from openlp.core.lib import RenderManager, build_icon, OpenLPDockWidget, \
|
||||
SettingsManager, PluginManager, Receiver, translate
|
||||
from openlp.core.utils import AppLocation, add_actions, LanguageManager
|
||||
from openlp.core.utils import AppLocation, add_actions, LanguageManager, \
|
||||
ActionList
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
@ -73,6 +75,7 @@ class Ui_MainWindow(object):
|
|||
MainWindow.setSizePolicy(sizePolicy)
|
||||
MainIcon = build_icon(u':/icon/openlp-logo-16x16.png')
|
||||
MainWindow.setWindowIcon(MainIcon)
|
||||
self.setDockNestingEnabled(True)
|
||||
# Set up the main container, which contains all the other form widgets
|
||||
self.MainContent = QtGui.QWidget(MainWindow)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding,
|
||||
|
@ -98,6 +101,12 @@ class Ui_MainWindow(object):
|
|||
self.screens)
|
||||
self.LiveController = SlideController(self, self.settingsmanager,
|
||||
self.screens, True)
|
||||
previewVisible = QtCore.QSettings().value(
|
||||
u'user interface/preview panel', QtCore.QVariant(True)).toBool()
|
||||
self.PreviewController.Panel.setVisible(previewVisible)
|
||||
liveVisible = QtCore.QSettings().value(u'user interface/live panel',
|
||||
QtCore.QVariant(True)).toBool()
|
||||
self.LiveController.Panel.setVisible(liveVisible)
|
||||
# Create menu
|
||||
self.MenuBar = QtGui.QMenuBar(MainWindow)
|
||||
self.MenuBar.setGeometry(QtCore.QRect(0, 0, 1087, 27))
|
||||
|
@ -177,29 +186,34 @@ class Ui_MainWindow(object):
|
|||
self.FileNewItem = QtGui.QAction(MainWindow)
|
||||
self.FileNewItem.setIcon(build_icon(u':/general/general_new.png'))
|
||||
self.FileNewItem.setObjectName(u'FileNewItem')
|
||||
MainWindow.actionList.add_action(self.FileNewItem, u'File')
|
||||
self.FileOpenItem = QtGui.QAction(MainWindow)
|
||||
self.FileOpenItem.setIcon(build_icon(u':/general/general_open.png'))
|
||||
self.FileOpenItem.setObjectName(u'FileOpenItem')
|
||||
MainWindow.actionList.add_action(self.FileOpenItem, u'File')
|
||||
self.FileSaveItem = QtGui.QAction(MainWindow)
|
||||
self.FileSaveItem.setIcon(build_icon(u':/general/general_save.png'))
|
||||
self.FileSaveItem.setObjectName(u'FileSaveItem')
|
||||
MainWindow.actionList.add_action(self.FileSaveItem, u'File')
|
||||
self.FileSaveAsItem = QtGui.QAction(MainWindow)
|
||||
self.FileSaveAsItem.setObjectName(u'FileSaveAsItem')
|
||||
MainWindow.actionList.add_action(self.FileSaveAsItem, u'File')
|
||||
self.FileExitItem = QtGui.QAction(MainWindow)
|
||||
self.FileExitItem.setIcon(build_icon(u':/system/system_exit.png'))
|
||||
self.FileExitItem.setObjectName(u'FileExitItem')
|
||||
MainWindow.actionList.add_action(self.FileExitItem, u'File')
|
||||
self.ImportThemeItem = QtGui.QAction(MainWindow)
|
||||
self.ImportThemeItem.setObjectName(u'ImportThemeItem')
|
||||
MainWindow.actionList.add_action(self.ImportThemeItem, u'Import')
|
||||
self.ImportLanguageItem = QtGui.QAction(MainWindow)
|
||||
self.ImportLanguageItem.setObjectName(u'ImportLanguageItem')
|
||||
MainWindow.actionList.add_action(self.ImportLanguageItem, u'Import')
|
||||
self.ExportThemeItem = QtGui.QAction(MainWindow)
|
||||
self.ExportThemeItem.setObjectName(u'ExportThemeItem')
|
||||
MainWindow.actionList.add_action(self.ExportThemeItem, u'Export')
|
||||
self.ExportLanguageItem = QtGui.QAction(MainWindow)
|
||||
self.ExportLanguageItem.setObjectName(u'ExportLanguageItem')
|
||||
self.SettingsConfigureItem = QtGui.QAction(MainWindow)
|
||||
self.SettingsConfigureItem.setIcon(
|
||||
build_icon(u':/system/system_settings.png'))
|
||||
self.SettingsConfigureItem.setObjectName(u'SettingsConfigureItem')
|
||||
MainWindow.actionList.add_action(self.ExportLanguageItem, u'Export')
|
||||
self.ViewMediaManagerItem = QtGui.QAction(MainWindow)
|
||||
self.ViewMediaManagerItem.setCheckable(True)
|
||||
self.ViewMediaManagerItem.setChecked(self.MediaManagerDock.isVisible())
|
||||
|
@ -212,6 +226,7 @@ class Ui_MainWindow(object):
|
|||
self.ViewThemeManagerItem.setIcon(
|
||||
build_icon(u':/system/system_thememanager.png'))
|
||||
self.ViewThemeManagerItem.setObjectName(u'ViewThemeManagerItem')
|
||||
MainWindow.actionList.add_action(self.ViewMediaManagerItem, u'View')
|
||||
self.ViewServiceManagerItem = QtGui.QAction(MainWindow)
|
||||
self.ViewServiceManagerItem.setCheckable(True)
|
||||
self.ViewServiceManagerItem.setChecked(
|
||||
|
@ -219,28 +234,49 @@ class Ui_MainWindow(object):
|
|||
self.ViewServiceManagerItem.setIcon(
|
||||
build_icon(u':/system/system_servicemanager.png'))
|
||||
self.ViewServiceManagerItem.setObjectName(u'ViewServiceManagerItem')
|
||||
MainWindow.actionList.add_action(self.ViewServiceManagerItem, u'View')
|
||||
self.ViewPreviewPanel = QtGui.QAction(MainWindow)
|
||||
self.ViewPreviewPanel.setCheckable(True)
|
||||
self.ViewPreviewPanel.setChecked(previewVisible)
|
||||
self.ViewPreviewPanel.setObjectName(u'ViewPreviewPanel')
|
||||
MainWindow.actionList.add_action(self.ViewPreviewPanel, u'View')
|
||||
self.ViewLivePanel = QtGui.QAction(MainWindow)
|
||||
self.ViewLivePanel.setCheckable(True)
|
||||
self.ViewLivePanel.setChecked(liveVisible)
|
||||
self.ViewLivePanel.setObjectName(u'ViewLivePanel')
|
||||
MainWindow.actionList.add_action(self.ViewLivePanel, u'View')
|
||||
self.ModeDefaultItem = QtGui.QAction(MainWindow)
|
||||
self.ModeDefaultItem.setCheckable(True)
|
||||
self.ModeDefaultItem.setObjectName(u'ModeDefaultItem')
|
||||
MainWindow.actionList.add_action(self.ModeDefaultItem, u'View Mode')
|
||||
self.ModeSetupItem = QtGui.QAction(MainWindow)
|
||||
self.ModeSetupItem.setCheckable(True)
|
||||
self.ModeSetupItem.setObjectName(u'ModeLiveItem')
|
||||
MainWindow.actionList.add_action(self.ModeSetupItem, u'View Mode')
|
||||
self.ModeLiveItem = QtGui.QAction(MainWindow)
|
||||
self.ModeLiveItem.setCheckable(True)
|
||||
self.ModeLiveItem.setObjectName(u'ModeLiveItem')
|
||||
MainWindow.actionList.add_action(self.ModeLiveItem, u'View Mode')
|
||||
self.ModeGroup = QtGui.QActionGroup(MainWindow)
|
||||
self.ModeGroup.addAction(self.ModeDefaultItem)
|
||||
self.ModeGroup.addAction(self.ModeSetupItem)
|
||||
self.ModeGroup.addAction(self.ModeLiveItem)
|
||||
self.ModeDefaultItem.setChecked(True)
|
||||
self.ToolsAddToolItem = QtGui.QAction(MainWindow)
|
||||
self.ToolsAddToolItem.setIcon(build_icon(u':/tools/tools_add.png'))
|
||||
self.ToolsAddToolItem.setObjectName(u'ToolsAddToolItem')
|
||||
MainWindow.actionList.add_action(self.ToolsAddToolItem, u'Tools')
|
||||
self.SettingsPluginListItem = QtGui.QAction(MainWindow)
|
||||
self.SettingsPluginListItem.setIcon(
|
||||
build_icon(u':/system/settings_plugin_list.png'))
|
||||
self.SettingsPluginListItem.setObjectName(u'SettingsPluginListItem')
|
||||
self.HelpDocumentationItem = QtGui.QAction(MainWindow)
|
||||
self.HelpDocumentationItem.setIcon(
|
||||
build_icon(u':/system/system_help_contents.png'))
|
||||
self.HelpDocumentationItem.setObjectName(u'HelpDocumentationItem')
|
||||
self.HelpDocumentationItem.setEnabled(False)
|
||||
self.HelpAboutItem = QtGui.QAction(MainWindow)
|
||||
self.HelpAboutItem.setIcon(
|
||||
build_icon(u':/system/system_about.png'))
|
||||
self.HelpAboutItem.setObjectName(u'HelpAboutItem')
|
||||
self.HelpOnlineHelpItem = QtGui.QAction(MainWindow)
|
||||
self.HelpOnlineHelpItem.setObjectName(u'HelpOnlineHelpItem')
|
||||
self.HelpOnlineHelpItem.setEnabled(False)
|
||||
self.HelpWebSiteItem = QtGui.QAction(MainWindow)
|
||||
self.HelpWebSiteItem.setObjectName(u'HelpWebSiteItem')
|
||||
MainWindow.actionList.add_action(self.SettingsPluginListItem,
|
||||
u'Settings')
|
||||
#i18n Language Items
|
||||
self.AutoLanguageItem = QtGui.QAction(MainWindow)
|
||||
self.AutoLanguageItem.setObjectName(u'AutoLanguageItem')
|
||||
self.AutoLanguageItem.setCheckable(True)
|
||||
MainWindow.actionList.add_action(self.AutoLanguageItem, u'Settings')
|
||||
self.LanguageGroup = QtGui.QActionGroup(MainWindow)
|
||||
qmList = LanguageManager.get_qm_list()
|
||||
savedLanguage = LanguageManager.get_language()
|
||||
|
@ -253,37 +289,34 @@ class Ui_MainWindow(object):
|
|||
languageItem.setChecked(True)
|
||||
add_actions(self.LanguageGroup, [languageItem])
|
||||
self.LanguageGroup.setDisabled(LanguageManager.auto_language)
|
||||
self.ToolsAddToolItem = QtGui.QAction(MainWindow)
|
||||
self.ToolsAddToolItem.setIcon(build_icon(u':/tools/tools_add.png'))
|
||||
self.ToolsAddToolItem.setObjectName(u'ToolsAddToolItem')
|
||||
self.ViewPreviewPanel = QtGui.QAction(MainWindow)
|
||||
self.ViewPreviewPanel.setCheckable(True)
|
||||
previewVisible = QtCore.QSettings().value(
|
||||
u'user interface/preview panel', QtCore.QVariant(True)).toBool()
|
||||
self.ViewPreviewPanel.setChecked(previewVisible)
|
||||
self.ViewPreviewPanel.setObjectName(u'ViewPreviewPanel')
|
||||
self.PreviewController.Panel.setVisible(previewVisible)
|
||||
self.ViewLivePanel = QtGui.QAction(MainWindow)
|
||||
self.ViewLivePanel.setCheckable(True)
|
||||
liveVisible = QtCore.QSettings().value(u'user interface/live panel',
|
||||
QtCore.QVariant(True)).toBool()
|
||||
self.ViewLivePanel.setChecked(liveVisible)
|
||||
self.ViewLivePanel.setObjectName(u'ViewLivePanel')
|
||||
self.LiveController.Panel.setVisible(liveVisible)
|
||||
self.ModeDefaultItem = QtGui.QAction(MainWindow)
|
||||
self.ModeDefaultItem.setCheckable(True)
|
||||
self.ModeDefaultItem.setObjectName(u'ModeDefaultItem')
|
||||
self.ModeSetupItem = QtGui.QAction(MainWindow)
|
||||
self.ModeSetupItem.setCheckable(True)
|
||||
self.ModeSetupItem.setObjectName(u'ModeLiveItem')
|
||||
self.ModeLiveItem = QtGui.QAction(MainWindow)
|
||||
self.ModeLiveItem.setCheckable(True)
|
||||
self.ModeLiveItem.setObjectName(u'ModeLiveItem')
|
||||
self.ModeGroup = QtGui.QActionGroup(MainWindow)
|
||||
self.ModeGroup.addAction(self.ModeDefaultItem)
|
||||
self.ModeGroup.addAction(self.ModeSetupItem)
|
||||
self.ModeGroup.addAction(self.ModeLiveItem)
|
||||
self.ModeDefaultItem.setChecked(True)
|
||||
self.SettingsShortcutsItem = QtGui.QAction(MainWindow)
|
||||
self.SettingsShortcutsItem.setIcon(
|
||||
build_icon(u':/system/system_configure_shortcuts.png'))
|
||||
self.SettingsShortcutsItem.setObjectName(u'SettingsShortcutsItem')
|
||||
self.SettingsConfigureItem = QtGui.QAction(MainWindow)
|
||||
self.SettingsConfigureItem.setIcon(
|
||||
build_icon(u':/system/system_settings.png'))
|
||||
self.SettingsConfigureItem.setObjectName(u'SettingsConfigureItem')
|
||||
MainWindow.actionList.add_action(self.SettingsShortcutsItem,
|
||||
u'Settings')
|
||||
self.HelpDocumentationItem = QtGui.QAction(MainWindow)
|
||||
self.HelpDocumentationItem.setIcon(
|
||||
build_icon(u':/system/system_help_contents.png'))
|
||||
self.HelpDocumentationItem.setObjectName(u'HelpDocumentationItem')
|
||||
self.HelpDocumentationItem.setEnabled(False)
|
||||
MainWindow.actionList.add_action(self.HelpDocumentationItem, u'Help')
|
||||
self.HelpAboutItem = QtGui.QAction(MainWindow)
|
||||
self.HelpAboutItem.setIcon(
|
||||
build_icon(u':/system/system_about.png'))
|
||||
self.HelpAboutItem.setObjectName(u'HelpAboutItem')
|
||||
MainWindow.actionList.add_action(self.HelpAboutItem, u'Help')
|
||||
self.HelpOnlineHelpItem = QtGui.QAction(MainWindow)
|
||||
self.HelpOnlineHelpItem.setObjectName(u'HelpOnlineHelpItem')
|
||||
self.HelpOnlineHelpItem.setEnabled(False)
|
||||
MainWindow.actionList.add_action(self.HelpOnlineHelpItem, u'Help')
|
||||
self.HelpWebSiteItem = QtGui.QAction(MainWindow)
|
||||
self.HelpWebSiteItem.setObjectName(u'HelpWebSiteItem')
|
||||
MainWindow.actionList.add_action(self.HelpWebSiteItem, u'Help')
|
||||
add_actions(self.FileImportMenu,
|
||||
(self.ImportThemeItem, self.ImportLanguageItem))
|
||||
add_actions(self.FileExportMenu,
|
||||
|
@ -303,7 +336,7 @@ class Ui_MainWindow(object):
|
|||
add_actions(self.SettingsLanguageMenu, self.LanguageGroup.actions())
|
||||
add_actions(self.SettingsMenu, (self.SettingsPluginListItem,
|
||||
self.SettingsLanguageMenu.menuAction(), None,
|
||||
self.SettingsConfigureItem))
|
||||
self.SettingsShortcutsItem, self.SettingsConfigureItem))
|
||||
add_actions(self.ToolsMenu,
|
||||
(self.ToolsAddToolItem, None))
|
||||
add_actions(self.HelpMenu,
|
||||
|
@ -394,6 +427,8 @@ class Ui_MainWindow(object):
|
|||
translate('OpenLP.MainWindow', '&Theme'))
|
||||
self.ExportLanguageItem.setText(
|
||||
translate('OpenLP.MainWindow', '&Language'))
|
||||
self.SettingsShortcutsItem.setText(
|
||||
translate('OpenLP.MainWindow', 'Configure &Shortcuts...'))
|
||||
self.SettingsConfigureItem.setText(
|
||||
translate('OpenLP.MainWindow', '&Configure OpenLP...'))
|
||||
self.ViewMediaManagerItem.setText(
|
||||
|
@ -488,6 +523,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
|||
"""
|
||||
log.info(u'MainWindow loaded')
|
||||
|
||||
actionList = ActionList()
|
||||
|
||||
def __init__(self, screens, applicationVersion):
|
||||
"""
|
||||
This constructor sets up the interface, the various managers, and the
|
||||
|
@ -495,6 +532,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
|||
"""
|
||||
QtGui.QMainWindow.__init__(self)
|
||||
self.screens = screens
|
||||
self.actionList = ActionList()
|
||||
self.applicationVersion = applicationVersion
|
||||
# Set up settings sections for the main application
|
||||
# (not for use by plugins)
|
||||
|
@ -506,6 +544,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
|||
self.settingsmanager = SettingsManager(screens)
|
||||
self.aboutForm = AboutForm(self, applicationVersion)
|
||||
self.settingsForm = SettingsForm(self.screens, self, self)
|
||||
self.shortcutForm = ShortcutListForm(self)
|
||||
self.recentFiles = QtCore.QStringList()
|
||||
# Set up the path with plugins
|
||||
pluginpath = AppLocation.get_directory(AppLocation.PluginsDir)
|
||||
|
@ -551,7 +590,9 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
|||
QtCore.QObject.connect(self.SettingsPluginListItem,
|
||||
QtCore.SIGNAL(u'triggered()'), self.onPluginItemClicked)
|
||||
QtCore.QObject.connect(self.SettingsConfigureItem,
|
||||
QtCore.SIGNAL(u'triggered()'), self.onOptionsSettingsItemClicked)
|
||||
QtCore.SIGNAL(u'triggered()'), self.onSettingsConfigureItemClicked)
|
||||
QtCore.QObject.connect(self.SettingsShortcutsItem,
|
||||
QtCore.SIGNAL(u'triggered()'), self.onSettingsShortcutsItemClicked)
|
||||
QtCore.QObject.connect(self.FileNewItem, QtCore.SIGNAL(u'triggered()'),
|
||||
self.ServiceManagerContents.onNewService)
|
||||
QtCore.QObject.connect(self.FileOpenItem,
|
||||
|
@ -563,7 +604,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
|||
QtCore.QObject.connect(self.FileSaveAsItem,
|
||||
QtCore.SIGNAL(u'triggered()'),
|
||||
self.ServiceManagerContents.onSaveService)
|
||||
#i18n set signals for languages
|
||||
# i18n set signals for languages
|
||||
QtCore.QObject.connect(self.AutoLanguageItem,
|
||||
QtCore.SIGNAL(u'toggled(bool)'), self.setAutoLanguage)
|
||||
self.LanguageGroup.triggered.connect(LanguageManager.set_language)
|
||||
|
@ -583,15 +624,15 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
|||
QtCore.SIGNAL(u'config_screen_changed'), self.screenChanged)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'maindisplay_status_text'), self.showStatusMessage)
|
||||
#warning cyclic dependency
|
||||
#RenderManager needs to call ThemeManager and
|
||||
#ThemeManager needs to call RenderManager
|
||||
# warning cyclic dependency
|
||||
# RenderManager needs to call ThemeManager and
|
||||
# ThemeManager needs to call RenderManager
|
||||
self.RenderManager = RenderManager(
|
||||
self.ThemeManagerContents, self.screens)
|
||||
#Define the media Dock Manager
|
||||
# Define the media Dock Manager
|
||||
self.mediaDockManager = MediaDockManager(self.MediaToolBox)
|
||||
log.info(u'Load Plugins')
|
||||
#make the controllers available to the plugins
|
||||
# make the controllers available to the plugins
|
||||
self.plugin_helpers[u'preview'] = self.PreviewController
|
||||
self.plugin_helpers[u'live'] = self.LiveController
|
||||
self.plugin_helpers[u'render'] = self.RenderManager
|
||||
|
@ -712,12 +753,18 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
|||
self.pluginForm.load()
|
||||
self.pluginForm.exec_()
|
||||
|
||||
def onOptionsSettingsItemClicked(self):
|
||||
def onSettingsConfigureItemClicked(self):
|
||||
"""
|
||||
Show the Settings dialog
|
||||
"""
|
||||
self.settingsForm.exec_()
|
||||
|
||||
def onSettingsShortcutsItemClicked(self):
|
||||
"""
|
||||
Show the shortcuts dialog
|
||||
"""
|
||||
self.shortcutForm.exec_(self.actionList)
|
||||
|
||||
def onModeDefaultItemClicked(self):
|
||||
"""
|
||||
Put OpenLP into "Default" view mode.
|
||||
|
@ -781,7 +828,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
|||
QtGui.QMessageBox.Save),
|
||||
QtGui.QMessageBox.Save)
|
||||
if ret == QtGui.QMessageBox.Save:
|
||||
self.ServiceManagerContents.onSaveService()
|
||||
self.ServiceManagerContents.onSaveService(True)
|
||||
self.cleanUp()
|
||||
event.accept()
|
||||
elif ret == QtGui.QMessageBox.Discard:
|
||||
|
@ -808,7 +855,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
|||
self.plugin_manager.finalise_plugins()
|
||||
# Save settings
|
||||
self.saveSettings()
|
||||
#Close down the display
|
||||
# Close down the display
|
||||
self.LiveController.display.close()
|
||||
|
||||
def serviceChanged(self, reset=False, serviceName=None):
|
||||
|
|
|
@ -107,7 +107,8 @@ class PluginForm(QtGui.QDialog, Ui_PluginViewDialog):
|
|||
if self.pluginListWidget.currentItem() is None:
|
||||
self._clearDetails()
|
||||
return
|
||||
plugin_name_plural = self.pluginListWidget.currentItem().text().split(u' ')[0]
|
||||
plugin_name_plural = \
|
||||
self.pluginListWidget.currentItem().text().split(u' ')[0]
|
||||
self.activePlugin = None
|
||||
for plugin in self.parent.plugin_manager.plugins:
|
||||
name_string = plugin.getString(StringContent.Name)
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
###############################################################################
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import translate
|
||||
|
||||
class Ui_ServiceItemEditDialog(object):
|
||||
|
@ -44,16 +45,26 @@ class Ui_ServiceItemEditDialog(object):
|
|||
self.topLayout.addWidget(self.listWidget)
|
||||
self.buttonLayout = QtGui.QVBoxLayout()
|
||||
self.buttonLayout.setObjectName(u'buttonLayout')
|
||||
self.upButton = QtGui.QPushButton(self.layoutWidget)
|
||||
self.upButton.setObjectName(u'upButton')
|
||||
self.buttonLayout.addWidget(self.upButton)
|
||||
spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum,
|
||||
QtGui.QSizePolicy.Expanding)
|
||||
self.buttonLayout.addItem(spacerItem)
|
||||
self.deleteButton = QtGui.QPushButton(self.layoutWidget)
|
||||
self.deleteButton.setObjectName(u'deleteButton')
|
||||
self.buttonLayout.addWidget(self.deleteButton)
|
||||
spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum,
|
||||
QtGui.QSizePolicy.Expanding)
|
||||
self.buttonLayout.addItem(spacerItem)
|
||||
self.upButton = QtGui.QPushButton(self.layoutWidget)
|
||||
self.upButton.setText(u'')
|
||||
icon = QtGui.QIcon()
|
||||
icon.addPixmap(QtGui.QPixmap(u':/services/service_up.png'),
|
||||
QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
self.upButton.setIcon(icon)
|
||||
self.upButton.setObjectName(u'upButton')
|
||||
self.buttonLayout.addWidget(self.upButton)
|
||||
self.downButton = QtGui.QPushButton(self.layoutWidget)
|
||||
self.downButton.setText(u'')
|
||||
icon = QtGui.QIcon()
|
||||
icon.addPixmap(QtGui.QPixmap(u':/services/service_down.png'),
|
||||
QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
self.downButton.setIcon(icon)
|
||||
self.downButton.setObjectName(u'downButton')
|
||||
self.buttonLayout.addWidget(self.downButton)
|
||||
self.topLayout.addLayout(self.buttonLayout)
|
||||
|
@ -70,7 +81,5 @@ class Ui_ServiceItemEditDialog(object):
|
|||
def retranslateUi(self, serviceItemEditDialog):
|
||||
serviceItemEditDialog.setWindowTitle(
|
||||
translate('OpenLP.ServiceItemEditForm', 'Reorder Service Item'))
|
||||
self.upButton.setText(translate('OpenLP.ServiceItemEditForm', 'Up'))
|
||||
self.deleteButton.setText(translate('OpenLP.ServiceItemEditForm',
|
||||
'Delete'))
|
||||
self.downButton.setText(translate('OpenLP.ServiceItemEditForm', 'Down'))
|
||||
|
|
|
@ -116,6 +116,7 @@ class ServiceManager(QtGui.QWidget):
|
|||
self.layout = QtGui.QVBoxLayout(self)
|
||||
self.layout.setSpacing(0)
|
||||
self.layout.setMargin(0)
|
||||
self.expandTabs = False
|
||||
# Create the top toolbar
|
||||
self.toolbar = OpenLPToolbar(self)
|
||||
self.toolbar.addToolbarButton(
|
||||
|
@ -203,13 +204,13 @@ class ServiceManager(QtGui.QWidget):
|
|||
self.orderToolbar.addSeparator()
|
||||
self.orderToolbar.addToolbarButton(
|
||||
translate('OpenLP.ServiceManager', '&Expand all'),
|
||||
u':/services/service_top.png',
|
||||
u':/services/service_expand_all.png',
|
||||
translate('OpenLP.ServiceManager',
|
||||
'Expand all the service items.'),
|
||||
self.onExpandAll)
|
||||
self.orderToolbar.addToolbarButton(
|
||||
translate('OpenLP.ServiceManager', '&Collapse all'),
|
||||
u':/services/service_bottom.png',
|
||||
u':/services/service_collapse_all.png',
|
||||
translate('OpenLP.ServiceManager',
|
||||
'Collapse all the service items.'),
|
||||
self.onCollapseAll)
|
||||
|
@ -306,8 +307,8 @@ class ServiceManager(QtGui.QWidget):
|
|||
self.editAction.setVisible(False)
|
||||
self.maintainAction.setVisible(False)
|
||||
self.notesAction.setVisible(False)
|
||||
if serviceItem[u'service_item'].is_capable(ItemCapabilities.AllowsEdit) \
|
||||
and hasattr(serviceItem[u'service_item'], u'editId'):
|
||||
if serviceItem[u'service_item'].is_capable(ItemCapabilities.AllowsEdit)\
|
||||
and serviceItem[u'service_item'].edit_id:
|
||||
self.editAction.setVisible(True)
|
||||
if serviceItem[u'service_item']\
|
||||
.is_capable(ItemCapabilities.AllowsMaintain):
|
||||
|
@ -346,7 +347,7 @@ class ServiceManager(QtGui.QWidget):
|
|||
self.serviceItems[item][u'service_item'])
|
||||
if self.serviceItemEditForm.exec_():
|
||||
self.addServiceItem(self.serviceItemEditForm.getServiceItem(),
|
||||
replace=True, expand=self.serviceItems[item][u'expand'])
|
||||
replace=True, expand=self.serviceItems[item][u'expanded'])
|
||||
|
||||
def nextItem(self):
|
||||
"""
|
||||
|
@ -441,7 +442,8 @@ class ServiceManager(QtGui.QWidget):
|
|||
if setSelected:
|
||||
setSelected = False
|
||||
serviceIterator.value().setSelected(True)
|
||||
elif serviceIterator.value() and serviceIterator.value().isSelected():
|
||||
elif serviceIterator.value() and \
|
||||
serviceIterator.value().isSelected():
|
||||
serviceIterator.value().setSelected(False)
|
||||
setSelected = True
|
||||
serviceIterator += 1
|
||||
|
@ -650,9 +652,12 @@ class ServiceManager(QtGui.QWidget):
|
|||
.get_service_repr()})
|
||||
if item[u'service_item'].uses_file():
|
||||
for frame in item[u'service_item'].get_frames():
|
||||
path_from = unicode(os.path.join(
|
||||
frame[u'path'],
|
||||
frame[u'title']))
|
||||
if item[u'service_item'].is_image():
|
||||
path_from = frame[u'path']
|
||||
else:
|
||||
path_from = unicode(os.path.join(
|
||||
frame[u'path'],
|
||||
frame[u'title']))
|
||||
# On write a file once
|
||||
if not path_from in write_list:
|
||||
write_list.append(path_from)
|
||||
|
@ -758,7 +763,8 @@ class ServiceManager(QtGui.QWidget):
|
|||
serviceitem.set_from_service(item, self.servicePath)
|
||||
self.validateItem(serviceitem)
|
||||
self.addServiceItem(serviceitem)
|
||||
if serviceitem.is_capable(ItemCapabilities.OnLoadUpdate):
|
||||
if serviceitem.is_capable(
|
||||
ItemCapabilities.OnLoadUpdate):
|
||||
Receiver.send_message(u'%s_service_load' %
|
||||
serviceitem.name.lower(), serviceitem)
|
||||
try:
|
||||
|
@ -858,7 +864,7 @@ class ServiceManager(QtGui.QWidget):
|
|||
editId, uuid = message.split(u':')
|
||||
for item in self.serviceItems:
|
||||
if item[u'service_item']._uuid == uuid:
|
||||
item[u'service_item'].editId = editId
|
||||
item[u'service_item'].edit_id = editId
|
||||
|
||||
def replaceServiceItem(self, newItem):
|
||||
"""
|
||||
|
@ -867,7 +873,7 @@ class ServiceManager(QtGui.QWidget):
|
|||
"""
|
||||
newItem.render()
|
||||
for itemcount, item in enumerate(self.serviceItems):
|
||||
if item[u'service_item'].editId == newItem.editId and \
|
||||
if item[u'service_item'].edit_id == newItem.edit_id and \
|
||||
item[u'service_item'].name == newItem.name:
|
||||
newItem.merge(item[u'service_item'])
|
||||
item[u'service_item'] = newItem
|
||||
|
@ -885,8 +891,8 @@ class ServiceManager(QtGui.QWidget):
|
|||
``expand``
|
||||
Override the default expand settings. (Tristate)
|
||||
"""
|
||||
log.debug(u'addServiceItem')
|
||||
if expand == None:
|
||||
# if not passed set to config value
|
||||
if expand is None:
|
||||
expand = self.expandTabs
|
||||
sitem = self.findServiceItem()[0]
|
||||
item.render()
|
||||
|
@ -977,7 +983,7 @@ class ServiceManager(QtGui.QWidget):
|
|||
.is_capable(ItemCapabilities.AllowsEdit):
|
||||
Receiver.send_message(u'%s_edit' %
|
||||
self.serviceItems[item][u'service_item'].name.lower(), u'L:%s' %
|
||||
self.serviceItems[item][u'service_item'].editId )
|
||||
self.serviceItems[item][u'service_item'].edit_id )
|
||||
|
||||
def findServiceItem(self):
|
||||
"""
|
||||
|
|
|
@ -0,0 +1,114 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
# --------------------------------------------------------------------------- #
|
||||
# Copyright (c) 2008-2010 Raoul Snyman #
|
||||
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
|
||||
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
|
||||
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
|
||||
# Carsten Tinggaard, Frode Woldsund #
|
||||
# --------------------------------------------------------------------------- #
|
||||
# This program is free software; you can redistribute it and/or modify it #
|
||||
# under the terms of the GNU General Public License as published by the Free #
|
||||
# Software Foundation; version 2 of the License. #
|
||||
# #
|
||||
# This program is distributed in the hope that it will be useful, but WITHOUT #
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
|
||||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
|
||||
# more details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU General Public License along #
|
||||
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
|
||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||
###############################################################################
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import translate, build_icon
|
||||
|
||||
class Ui_ShortcutListDialog(object):
|
||||
def setupUi(self, shortcutListDialog):
|
||||
shortcutListDialog.setObjectName(u'shortcutListDialog')
|
||||
shortcutListDialog.resize(500, 438)
|
||||
self.shortcutListLayout = QtGui.QVBoxLayout(shortcutListDialog)
|
||||
self.shortcutListLayout.setSpacing(8)
|
||||
self.shortcutListLayout.setMargin(8)
|
||||
self.shortcutListLayout.setObjectName(u'shortcutListLayout')
|
||||
self.shortcutListTreeWidget = QtGui.QTreeWidget(shortcutListDialog)
|
||||
self.shortcutListTreeWidget.setAlternatingRowColors(True)
|
||||
self.shortcutListTreeWidget.setObjectName(u'shortcutListTreeWidget')
|
||||
self.shortcutListTreeWidget.setColumnCount(2)
|
||||
self.shortcutListTreeWidget.setSelectionBehavior(
|
||||
QtGui.QAbstractItemView.SelectRows)
|
||||
self.shortcutListLayout.addWidget(self.shortcutListTreeWidget)
|
||||
self.shortcutLayout = QtGui.QVBoxLayout()
|
||||
self.shortcutLayout.setSpacing(8)
|
||||
self.shortcutLayout.setContentsMargins(0, -1, -1, -1)
|
||||
self.shortcutLayout.setObjectName(u'shortcutLayout')
|
||||
self.defaultRadioButton = QtGui.QRadioButton(shortcutListDialog)
|
||||
self.defaultRadioButton.setChecked(True)
|
||||
self.defaultRadioButton.setObjectName(u'defaultRadioButton')
|
||||
self.shortcutLayout.addWidget(self.defaultRadioButton)
|
||||
self.customShortcutLayout = QtGui.QHBoxLayout()
|
||||
self.customShortcutLayout.setSpacing(8)
|
||||
self.customShortcutLayout.setObjectName(u'customShortcutLayout')
|
||||
self.customRadioButton = QtGui.QRadioButton(shortcutListDialog)
|
||||
self.customRadioButton.setObjectName(u'customRadioButton')
|
||||
self.customShortcutLayout.addWidget(self.customRadioButton)
|
||||
self.shortcutPushButton = QtGui.QPushButton(shortcutListDialog)
|
||||
self.shortcutPushButton.setMinimumSize(QtCore.QSize(84, 0))
|
||||
self.shortcutPushButton.setIcon(
|
||||
build_icon(u':/system/system_configure_shortcuts.png'))
|
||||
self.shortcutPushButton.setCheckable(True)
|
||||
self.shortcutPushButton.setChecked(False)
|
||||
self.shortcutPushButton.setObjectName(u'shortcutPushButton')
|
||||
self.customShortcutLayout.addWidget(self.shortcutPushButton)
|
||||
self.clearShortcutToolButton = QtGui.QToolButton(shortcutListDialog)
|
||||
self.clearShortcutToolButton.setMinimumSize(QtCore.QSize(0, 16))
|
||||
self.clearShortcutToolButton.setText(u'')
|
||||
self.clearShortcutToolButton.setIcon(
|
||||
build_icon(u':/system/clear_shortcut.png'))
|
||||
self.clearShortcutToolButton.setObjectName(u'clearShortcutToolButton')
|
||||
self.customShortcutLayout.addWidget(self.clearShortcutToolButton)
|
||||
self.customShortcutSpacer = QtGui.QSpacerItem(40, 20,
|
||||
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
||||
self.customShortcutLayout.addItem(self.customShortcutSpacer)
|
||||
self.shortcutLayout.addLayout(self.customShortcutLayout)
|
||||
self.shortcutListLayout.addLayout(self.shortcutLayout)
|
||||
self.shortcutListButtonBox = QtGui.QDialogButtonBox(shortcutListDialog)
|
||||
self.shortcutListButtonBox.setOrientation(QtCore.Qt.Horizontal)
|
||||
self.shortcutListButtonBox.setStandardButtons(
|
||||
QtGui.QDialogButtonBox.Cancel | QtGui.QDialogButtonBox.Ok |
|
||||
QtGui.QDialogButtonBox.Reset)
|
||||
self.shortcutListButtonBox.setObjectName(u'shortcutListButtonBox')
|
||||
self.shortcutListLayout.addWidget(self.shortcutListButtonBox)
|
||||
|
||||
self.retranslateUi(shortcutListDialog)
|
||||
QtCore.QObject.connect(
|
||||
self.shortcutListButtonBox,
|
||||
QtCore.SIGNAL(u'accepted()'),
|
||||
shortcutListDialog.accept
|
||||
)
|
||||
QtCore.QObject.connect(
|
||||
self.shortcutListButtonBox,
|
||||
QtCore.SIGNAL(u'rejected()'),
|
||||
shortcutListDialog.reject
|
||||
)
|
||||
QtCore.QMetaObject.connectSlotsByName(shortcutListDialog)
|
||||
|
||||
def retranslateUi(self, shortcutListDialog):
|
||||
shortcutListDialog.setWindowTitle(
|
||||
translate('OpenLP.ShortcutListDialog', 'Customize Shortcuts'))
|
||||
self.shortcutListTreeWidget.setHeaderLabels([
|
||||
translate('OpenLP.ShortcutListDialog', 'Action'),
|
||||
translate('OpenLP.ShortcutListDialog', 'Shortcut')
|
||||
])
|
||||
self.defaultRadioButton.setText(
|
||||
translate('OpenLP.ShortcutListDialog', 'Default: %s'))
|
||||
self.customRadioButton.setText(
|
||||
translate('OpenLP.ShortcutListDialog', 'Custom:'))
|
||||
self.shortcutPushButton.setText(
|
||||
translate('OpenLP.ShortcutListDialog', 'None'))
|
||||
|
|
@ -0,0 +1,110 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
# --------------------------------------------------------------------------- #
|
||||
# Copyright (c) 2008-2010 Raoul Snyman #
|
||||
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
|
||||
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
|
||||
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
|
||||
# Carsten Tinggaard, Frode Woldsund #
|
||||
# --------------------------------------------------------------------------- #
|
||||
# This program is free software; you can redistribute it and/or modify it #
|
||||
# under the terms of the GNU General Public License as published by the Free #
|
||||
# Software Foundation; version 2 of the License. #
|
||||
# #
|
||||
# This program is distributed in the hope that it will be useful, but WITHOUT #
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
|
||||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
|
||||
# more details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU General Public License along #
|
||||
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
|
||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||
###############################################################################
|
||||
|
||||
import logging
|
||||
import re
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.utils import translate
|
||||
from shortcutlistdialog import Ui_ShortcutListDialog
|
||||
|
||||
REMOVE_AMPERSAND = re.compile(r'&{1}')
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
|
||||
"""
|
||||
The shortcut list dialog
|
||||
"""
|
||||
|
||||
def __init__(self, parent):
|
||||
"""
|
||||
Do some initialisation stuff
|
||||
"""
|
||||
QtGui.QDialog.__init__(self, parent)
|
||||
self.setupUi(self)
|
||||
self.actionList = None
|
||||
self.captureShortcut = False
|
||||
QtCore.QObject.connect(
|
||||
self.shortcutPushButton,
|
||||
QtCore.SIGNAL(u'toggled(bool)'),
|
||||
self.onShortcutPushButtonClicked
|
||||
)
|
||||
|
||||
def keyReleaseEvent(self, event):
|
||||
Qt = QtCore.Qt
|
||||
if not self.captureShortcut:
|
||||
return
|
||||
key = event.key()
|
||||
if key == Qt.Key_Shift or key == Qt.Key_Control or \
|
||||
key == Qt.Key_Meta or key == Qt.Key_Alt:
|
||||
return
|
||||
key_string = QtGui.QKeySequence(key).toString()
|
||||
if event.modifiers() & Qt.ControlModifier == Qt.ControlModifier:
|
||||
key_string = u'Ctrl+' + key_string
|
||||
if event.modifiers() & Qt.AltModifier == Qt.AltModifier:
|
||||
key_string = u'Alt+' + key_string
|
||||
if event.modifiers() & Qt.ShiftModifier == Qt.ShiftModifier:
|
||||
key_string = u'Shift+' + key_string
|
||||
key_sequence = QtGui.QKeySequence(key_string)
|
||||
existing_key = QtGui.QKeySequence("Ctrl+Shift+F8")
|
||||
if key_sequence == existing_key:
|
||||
QtGui.QMessageBox.warning(
|
||||
self,
|
||||
translate('OpenLP.ShortcutListDialog', 'Duplicate Shortcut'),
|
||||
unicode(translate('OpenLP.ShortcutListDialog', 'The shortcut '
|
||||
'"%s" is already assigned to another action, please '
|
||||
'use a different shortcut.')) % key_sequence.toString(),
|
||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok),
|
||||
QtGui.QMessageBox.Ok
|
||||
)
|
||||
else:
|
||||
self.shortcutPushButton.setText(key_sequence.toString())
|
||||
self.shortcutPushButton.setChecked(False)
|
||||
self.captureShortcut = False
|
||||
|
||||
def exec_(self, actionList):
|
||||
self.actionList = actionList
|
||||
self.refreshActions()
|
||||
return QtGui.QDialog.exec_(self)
|
||||
|
||||
def refreshActions(self):
|
||||
self.shortcutListTreeWidget.clear()
|
||||
for category in self.actionList.categories:
|
||||
item = QtGui.QTreeWidgetItem([category.name])
|
||||
for action in category.actions:
|
||||
actionText = REMOVE_AMPERSAND.sub('', unicode(action.text()))
|
||||
shortcutText = action.shortcut().toString()
|
||||
actionItem = QtGui.QTreeWidgetItem([actionText, shortcutText])
|
||||
actionItem.setIcon(0, action.icon())
|
||||
item.addChild(actionItem)
|
||||
item.setExpanded(True)
|
||||
self.shortcutListTreeWidget.addTopLevelItem(item)
|
||||
|
||||
def onShortcutPushButtonClicked(self, toggled):
|
||||
self.captureShortcut = toggled
|
||||
|
|
@ -179,23 +179,23 @@ class SlideController(QtGui.QWidget):
|
|||
self.HideMenu.setMenu(QtGui.QMenu(
|
||||
translate('OpenLP.SlideController', 'Hide'), self.Toolbar))
|
||||
self.BlankScreen = QtGui.QAction(QtGui.QIcon(
|
||||
u':/slides/slide_blank.png'),
|
||||
translate('OpenLP.SlideController',
|
||||
u':/slides/slide_blank.png'),
|
||||
translate('OpenLP.SlideController',
|
||||
'Blank Screen'), self.HideMenu)
|
||||
self.BlankScreen.setCheckable(True)
|
||||
QtCore.QObject.connect(self.BlankScreen,
|
||||
QtCore.SIGNAL("triggered(bool)"), self.onBlankDisplay)
|
||||
self.ThemeScreen = QtGui.QAction(QtGui.QIcon(
|
||||
u':/slides/slide_theme.png'),
|
||||
translate('OpenLP.SlideController',
|
||||
u':/slides/slide_theme.png'),
|
||||
translate('OpenLP.SlideController',
|
||||
'Blank to Theme'), self.HideMenu)
|
||||
self.ThemeScreen.setCheckable(True)
|
||||
QtCore.QObject.connect(self.ThemeScreen,
|
||||
QtCore.SIGNAL("triggered(bool)"), self.onThemeDisplay)
|
||||
if self.screens.display_count > 1:
|
||||
self.DesktopScreen = QtGui.QAction(QtGui.QIcon(
|
||||
u':/slides/slide_desktop.png'),
|
||||
translate('OpenLP.SlideController',
|
||||
u':/slides/slide_desktop.png'),
|
||||
translate('OpenLP.SlideController',
|
||||
'Show Desktop'), self.HideMenu)
|
||||
self.DesktopScreen.setCheckable(True)
|
||||
QtCore.QObject.connect(self.DesktopScreen,
|
||||
|
@ -214,7 +214,7 @@ class SlideController(QtGui.QWidget):
|
|||
self.Toolbar.addToolbarSeparator(u'Close Separator')
|
||||
self.Toolbar.addToolbarButton(
|
||||
u'Edit Song', u':/general/general_edit.png',
|
||||
translate('OpenLP.SlideController',
|
||||
translate('OpenLP.SlideController',
|
||||
'Edit and reload song preview'),
|
||||
self.onEditSong)
|
||||
if isLive:
|
||||
|
@ -400,6 +400,7 @@ class SlideController(QtGui.QWidget):
|
|||
log.debug(u'screenSizeChanged live = %s' % self.isLive)
|
||||
# rebuild display as screen size changed
|
||||
self.display = MainDisplay(self, self.screens, self.isLive)
|
||||
self.display.imageManager = self.parent.RenderManager.image_manager
|
||||
self.display.alertTab = self.alertTab
|
||||
self.ratio = float(self.screens.current[u'size'].width()) / \
|
||||
float(self.screens.current[u'size'].height())
|
||||
|
@ -432,8 +433,12 @@ class SlideController(QtGui.QWidget):
|
|||
request = unicode(self.sender().text())
|
||||
slideno = self.slideList[request]
|
||||
if slideno > self.PreviewListWidget.rowCount():
|
||||
self.PreviewListWidget.selectRow(self.PreviewListWidget.rowCount())
|
||||
self.PreviewListWidget.selectRow(
|
||||
self.PreviewListWidget.rowCount() - 1)
|
||||
else:
|
||||
if slideno + 1 < self.PreviewListWidget.rowCount():
|
||||
self.PreviewListWidget.scrollToItem(
|
||||
self.PreviewListWidget.item(slideno + 1, 0))
|
||||
self.PreviewListWidget.selectRow(slideno)
|
||||
self.onSlideSelected()
|
||||
|
||||
|
@ -525,6 +530,9 @@ class SlideController(QtGui.QWidget):
|
|||
log.debug(u'addServiceManagerItem live = %s' % self.isLive)
|
||||
# If service item is the same as the current on only change slide
|
||||
if item.__eq__(self.serviceItem):
|
||||
if slideno + 1 < self.PreviewListWidget.rowCount():
|
||||
self.PreviewListWidget.scrollToItem(
|
||||
self.PreviewListWidget.item(slideno + 1, 0))
|
||||
self.PreviewListWidget.selectRow(slideno)
|
||||
self.onSlideSelected()
|
||||
return
|
||||
|
@ -584,11 +592,15 @@ class SlideController(QtGui.QWidget):
|
|||
else:
|
||||
label = QtGui.QLabel()
|
||||
label.setMargin(4)
|
||||
pixmap = resize_image(frame[u'image'],
|
||||
self.parent.RenderManager.width,
|
||||
self.parent.RenderManager.height)
|
||||
label.setScaledContents(True)
|
||||
label.setPixmap(QtGui.QPixmap.fromImage(pixmap))
|
||||
if self.serviceItem.is_command():
|
||||
image = resize_image(frame[u'image'],
|
||||
self.parent.RenderManager.width,
|
||||
self.parent.RenderManager.height)
|
||||
else:
|
||||
image = self.parent.RenderManager.image_manager. \
|
||||
get_image(frame[u'title'])
|
||||
label.setPixmap(QtGui.QPixmap.fromImage(image))
|
||||
self.PreviewListWidget.setCellWidget(framenumber, 0, label)
|
||||
slideHeight = width * self.parent.RenderManager.screen_ratio
|
||||
row += 1
|
||||
|
@ -602,8 +614,12 @@ class SlideController(QtGui.QWidget):
|
|||
self.PreviewListWidget.setColumnWidth(0,
|
||||
self.PreviewListWidget.viewport().size().width())
|
||||
if slideno > self.PreviewListWidget.rowCount():
|
||||
self.PreviewListWidget.selectRow(self.PreviewListWidget.rowCount())
|
||||
self.PreviewListWidget.selectRow(
|
||||
self.PreviewListWidget.rowCount() - 1)
|
||||
else:
|
||||
if slideno + 1 < self.PreviewListWidget.rowCount():
|
||||
self.PreviewListWidget.scrollToItem(
|
||||
self.PreviewListWidget.item(slideno + 1, 0))
|
||||
self.PreviewListWidget.selectRow(slideno)
|
||||
self.enableToolBar(serviceItem)
|
||||
# Pass to display for viewing
|
||||
|
@ -662,6 +678,9 @@ class SlideController(QtGui.QWidget):
|
|||
[self.serviceItem, self.isLive, index])
|
||||
self.updatePreview()
|
||||
else:
|
||||
if index + 1 < self.PreviewListWidget.rowCount():
|
||||
self.PreviewListWidget.scrollToItem(
|
||||
self.PreviewListWidget.item(index + 1, 0))
|
||||
self.PreviewListWidget.selectRow(index)
|
||||
self.onSlideSelected()
|
||||
|
||||
|
@ -774,20 +793,19 @@ class SlideController(QtGui.QWidget):
|
|||
row = self.PreviewListWidget.currentRow()
|
||||
self.selectedRow = 0
|
||||
if row > -1 and row < self.PreviewListWidget.rowCount():
|
||||
if self.serviceItem.is_command() and self.isLive:
|
||||
Receiver.send_message(u'%s_slide' % self.serviceItem.name.lower(),
|
||||
[self.serviceItem, self.isLive, row])
|
||||
if self.serviceItem.is_command():
|
||||
if self.isLive:
|
||||
Receiver.send_message(
|
||||
u'%s_slide' % self.serviceItem.name.lower(),
|
||||
[self.serviceItem, self.isLive, row])
|
||||
self.updatePreview()
|
||||
else:
|
||||
frame, raw_html = self.serviceItem.get_rendered_frame(row)
|
||||
toDisplay = self.serviceItem.get_rendered_frame(row)
|
||||
if self.serviceItem.is_text():
|
||||
frame = self.display.text(raw_html)
|
||||
frame = self.display.text(toDisplay)
|
||||
else:
|
||||
self.display.image(frame)
|
||||
if isinstance(frame, QtGui.QImage):
|
||||
self.SlidePreview.setPixmap(QtGui.QPixmap.fromImage(frame))
|
||||
else:
|
||||
self.SlidePreview.setPixmap(QtGui.QPixmap(frame))
|
||||
frame = self.display.image(toDisplay)
|
||||
self.SlidePreview.setPixmap(QtGui.QPixmap.fromImage(frame))
|
||||
self.selectedRow = row
|
||||
Receiver.send_message(u'slidecontroller_%s_changed' % self.typePrefix,
|
||||
row)
|
||||
|
@ -796,6 +814,9 @@ class SlideController(QtGui.QWidget):
|
|||
"""
|
||||
The slide has been changed. Update the slidecontroller accordingly
|
||||
"""
|
||||
if row + 1 < self.PreviewListWidget.rowCount():
|
||||
self.PreviewListWidget.scrollToItem(
|
||||
self.PreviewListWidget.item(row + 1, 0))
|
||||
self.PreviewListWidget.selectRow(row)
|
||||
self.updatePreview()
|
||||
Receiver.send_message(u'slidecontroller_%s_changed' % self.typePrefix,
|
||||
|
@ -841,6 +862,9 @@ class SlideController(QtGui.QWidget):
|
|||
else:
|
||||
Receiver.send_message('servicemanager_next_item')
|
||||
return
|
||||
if row + 1 < self.PreviewListWidget.rowCount():
|
||||
self.PreviewListWidget.scrollToItem(
|
||||
self.PreviewListWidget.item(row + 1, 0))
|
||||
self.PreviewListWidget.selectRow(row)
|
||||
self.onSlideSelected()
|
||||
|
||||
|
@ -864,6 +888,9 @@ class SlideController(QtGui.QWidget):
|
|||
row = self.PreviewListWidget.rowCount() - 1
|
||||
else:
|
||||
row = 0
|
||||
if row + 1 < self.PreviewListWidget.rowCount():
|
||||
self.PreviewListWidget.scrollToItem(
|
||||
self.PreviewListWidget.item(row + 1, 0))
|
||||
self.PreviewListWidget.selectRow(row)
|
||||
self.onSlideSelected()
|
||||
|
||||
|
@ -915,7 +942,7 @@ class SlideController(QtGui.QWidget):
|
|||
"""
|
||||
self.songEdit = True
|
||||
Receiver.send_message(u'%s_edit' % self.serviceItem.name.lower(),
|
||||
u'P:%s' % self.serviceItem.editId)
|
||||
u'P:%s' % self.serviceItem.edit_id)
|
||||
|
||||
def onGoLive(self):
|
||||
"""
|
||||
|
@ -985,7 +1012,7 @@ class SlideController(QtGui.QWidget):
|
|||
self.video.hide()
|
||||
self.SlidePreview.clear()
|
||||
self.SlidePreview.show()
|
||||
|
||||
|
||||
def onMediaClose(self):
|
||||
"""
|
||||
Respond to a request to close the Video
|
||||
|
@ -999,4 +1026,3 @@ class SlideController(QtGui.QWidget):
|
|||
self.video.hide()
|
||||
self.SlidePreview.clear()
|
||||
self.SlidePreview.show()
|
||||
|
||||
|
|
|
@ -0,0 +1,600 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
# --------------------------------------------------------------------------- #
|
||||
# Copyright (c) 2008-2010 Raoul Snyman #
|
||||
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
|
||||
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
|
||||
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
|
||||
# Carsten Tinggaard, Frode Woldsund #
|
||||
# --------------------------------------------------------------------------- #
|
||||
# This program is free software; you can redistribute it and/or modify it #
|
||||
# under the terms of the GNU General Public License as published by the Free #
|
||||
# Software Foundation; version 2 of the License. #
|
||||
# #
|
||||
# This program is distributed in the hope that it will be useful, but WITHOUT #
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
|
||||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
|
||||
# more details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU General Public License along #
|
||||
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
|
||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||
###############################################################################
|
||||
|
||||
import logging
|
||||
import os
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import translate, BackgroundType, BackgroundGradientType
|
||||
from openlp.core.utils import get_images_filter
|
||||
from themewizard import Ui_ThemeWizard
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
|
||||
"""
|
||||
This is the Bible Import Wizard, which allows easy importing of Bibles
|
||||
into OpenLP from other formats like OSIS, CSV and OpenSong.
|
||||
"""
|
||||
log.info(u'ThemeWizardForm loaded')
|
||||
|
||||
def __init__(self, parent):
|
||||
"""
|
||||
Instantiate the wizard, and run any extra setup we need to.
|
||||
|
||||
``parent``
|
||||
The QWidget-derived parent of the wizard.
|
||||
"""
|
||||
QtGui.QWizard.__init__(self, parent)
|
||||
self.thememanager = parent
|
||||
self.setupUi(self)
|
||||
self.registerFields()
|
||||
self.accepted = False
|
||||
QtCore.QObject.connect(self.backgroundTypeComboBox,
|
||||
QtCore.SIGNAL(u'currentIndexChanged(int)'),
|
||||
self.onBackgroundComboBox)
|
||||
QtCore.QObject.connect(self.gradientComboBox,
|
||||
QtCore.SIGNAL(u'currentIndexChanged(int)'),
|
||||
self.onGradientComboBox)
|
||||
QtCore.QObject.connect(self.color1PushButton,
|
||||
QtCore.SIGNAL(u'pressed()'),
|
||||
self.onColor1PushButtonClicked)
|
||||
QtCore.QObject.connect(self.color2PushButton,
|
||||
QtCore.SIGNAL(u'pressed()'),
|
||||
self.onColor2PushButtonClicked)
|
||||
QtCore.QObject.connect(self.imageBrowseButton,
|
||||
QtCore.SIGNAL(u'pressed()'),
|
||||
self.onImageBrowseButtonClicked)
|
||||
QtCore.QObject.connect(self.mainColorPushButton,
|
||||
QtCore.SIGNAL(u'pressed()'),
|
||||
self.onMainColourPushButtonClicked)
|
||||
QtCore.QObject.connect(self.outlineColorPushButton,
|
||||
QtCore.SIGNAL(u'pressed()'),
|
||||
self.onOutlineColourPushButtonClicked)
|
||||
QtCore.QObject.connect(self.shadowColorPushButton,
|
||||
QtCore.SIGNAL(u'pressed()'),
|
||||
self.onShadowColourPushButtonClicked)
|
||||
QtCore.QObject.connect(self.outlineCheckBox,
|
||||
QtCore.SIGNAL(u'stateChanged(int)'),
|
||||
self.onOutlineCheckCheckBoxChanged)
|
||||
QtCore.QObject.connect(self.shadowCheckBox,
|
||||
QtCore.SIGNAL(u'stateChanged(int)'),
|
||||
self.onShadowCheckCheckBoxChanged)
|
||||
QtCore.QObject.connect(self.footerColorPushButton,
|
||||
QtCore.SIGNAL(u'pressed()'),
|
||||
self.onFooterColourPushButtonClicked)
|
||||
QtCore.QObject.connect(self.mainDefaultPositionCheckBox,
|
||||
QtCore.SIGNAL(u'stateChanged(int)'),
|
||||
self.onMainDefaultPositionCheckBox)
|
||||
QtCore.QObject.connect(self.footerDefaultPositionCheckBox,
|
||||
QtCore.SIGNAL(u'stateChanged(int)'),
|
||||
self.onFooterDefaultPositionCheckBox)
|
||||
QtCore.QObject.connect(self,
|
||||
QtCore.SIGNAL(u'currentIdChanged(int)'),
|
||||
self.pageChanged)
|
||||
|
||||
def pageChanged(self, pageId):
|
||||
"""
|
||||
Detects Page changes and updates.
|
||||
"""
|
||||
if pageId == 6:
|
||||
self.updateTheme()
|
||||
frame = self.thememanager.generateImage(self.theme)
|
||||
self.previewBoxLabel.setPixmap(QtGui.QPixmap.fromImage(frame))
|
||||
|
||||
def setDefaults(self):
|
||||
"""
|
||||
Set up display at start of theme edit.
|
||||
"""
|
||||
self.restart()
|
||||
self.accepted = False
|
||||
self.setBackgroundTabValues()
|
||||
self.setMainAreaTabValues()
|
||||
self.setFooterAreaTabValues()
|
||||
self.setAlignmentTabValues()
|
||||
self.setPositionTabValues()
|
||||
self.setPreviewTabValues()
|
||||
|
||||
def registerFields(self):
|
||||
"""
|
||||
Map field names to screen names,
|
||||
"""
|
||||
self.backgroundPage.registerField(
|
||||
u'background_type', self.backgroundTypeComboBox)
|
||||
self.backgroundPage.registerField(
|
||||
u'color_1', self.color1PushButton)
|
||||
self.backgroundPage.registerField(
|
||||
u'color_2', self.color2PushButton)
|
||||
self.backgroundPage.registerField(
|
||||
u'background_image', self.imageLineEdit)
|
||||
self.backgroundPage.registerField(
|
||||
u'gradient', self.gradientComboBox)
|
||||
self.mainAreaPage.registerField(
|
||||
u'mainFontComboBox', self.mainFontComboBox)
|
||||
self.mainAreaPage.registerField(
|
||||
u'mainColorPushButton', self.mainColorPushButton)
|
||||
self.mainAreaPage.registerField(
|
||||
u'mainSizeSpinBox', self.mainSizeSpinBox)
|
||||
self.mainAreaPage.registerField(
|
||||
u'lineSpacingSpinBox', self.lineSpacingSpinBox)
|
||||
self.mainAreaPage.registerField(
|
||||
u'outlineCheckBox', self.outlineCheckBox)
|
||||
self.mainAreaPage.registerField(
|
||||
u'outlineColorPushButton', self.outlineColorPushButton)
|
||||
self.mainAreaPage.registerField(
|
||||
u'outlineSizeSpinBox', self.outlineSizeSpinBox)
|
||||
self.mainAreaPage.registerField(
|
||||
u'shadowCheckBox', self.shadowCheckBox)
|
||||
self.mainAreaPage.registerField(
|
||||
u'boldCheckBox', self.boldCheckBox)
|
||||
self.mainAreaPage.registerField(
|
||||
u'italicsCheckBox', self.italicsCheckBox)
|
||||
self.mainAreaPage.registerField(
|
||||
u'shadowColorPushButton', self.shadowColorPushButton)
|
||||
self.mainAreaPage.registerField(
|
||||
u'shadowSizeSpinBox', self.shadowSizeSpinBox)
|
||||
self.mainAreaPage.registerField(
|
||||
u'footerSizeSpinBox', self.footerSizeSpinBox)
|
||||
self.areaPositionPage.registerField(
|
||||
u'mainPositionX', self.mainXSpinBox)
|
||||
self.areaPositionPage.registerField(
|
||||
u'mainPositionY', self.mainYSpinBox)
|
||||
self.areaPositionPage.registerField(
|
||||
u'mainPositionWidth', self.mainWidthSpinBox)
|
||||
self.areaPositionPage.registerField(
|
||||
u'mainPositionHeight', self.mainHeightSpinBox)
|
||||
self.areaPositionPage.registerField(
|
||||
u'footerPositionX', self.footerXSpinBox)
|
||||
self.areaPositionPage.registerField(
|
||||
u'footerPositionY', self.footerYSpinBox)
|
||||
self.areaPositionPage.registerField(
|
||||
u'footerPositionWidth', self.footerWidthSpinBox)
|
||||
self.areaPositionPage.registerField(
|
||||
u'footerPositionHeight', self.footerHeightSpinBox)
|
||||
self.backgroundPage.registerField(
|
||||
u'horizontal', self.horizontalComboBox)
|
||||
self.backgroundPage.registerField(
|
||||
u'vertical', self.verticalComboBox)
|
||||
self.backgroundPage.registerField(
|
||||
u'slideTransition', self.transitionsCheckBox)
|
||||
self.backgroundPage.registerField(
|
||||
u'name', self.themeNameEdit)
|
||||
|
||||
def onOutlineCheckCheckBoxChanged(self, state):
|
||||
"""
|
||||
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.outlineColorPushButton.setEnabled(self.theme.font_main_outline)
|
||||
self.outlineSizeSpinBox.setEnabled(self.theme.font_main_outline)
|
||||
|
||||
def onShadowCheckCheckBoxChanged(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.shadowColorPushButton.setEnabled(self.theme.font_main_shadow)
|
||||
self.shadowSizeSpinBox.setEnabled(self.theme.font_main_shadow)
|
||||
|
||||
def onMainDefaultPositionCheckBox(self, value):
|
||||
"""
|
||||
Change state as Main Area Position check box changed
|
||||
"""
|
||||
if value == QtCore.Qt.Checked:
|
||||
self.theme.font_main_override = False
|
||||
else:
|
||||
self.theme.font_main_override = True
|
||||
self.mainXSpinBox.setEnabled(self.theme.font_main_override)
|
||||
self.mainYSpinBox.setEnabled(self.theme.font_main_override)
|
||||
self.mainHeightSpinBox.setEnabled(self.theme.font_main_override)
|
||||
self.mainWidthSpinBox.setEnabled(self.theme.font_main_override)
|
||||
|
||||
def onFooterDefaultPositionCheckBox(self, value):
|
||||
"""
|
||||
Change state as Footer Area Position check box changed
|
||||
"""
|
||||
if value == QtCore.Qt.Checked:
|
||||
self.theme.font_footer_override = False
|
||||
else:
|
||||
self.theme.font_footer_override = True
|
||||
self.footerXSpinBox.setEnabled(self.theme.font_footer_override)
|
||||
self.footerYSpinBox.setEnabled(self.theme.font_footer_override)
|
||||
self.footerHeightSpinBox.setEnabled(self.theme.font_footer_override)
|
||||
self.footerWidthSpinBox.setEnabled(self.theme.font_footer_override)
|
||||
|
||||
def exec_(self):
|
||||
"""
|
||||
Run the wizard.
|
||||
"""
|
||||
self.setDefaults()
|
||||
return QtGui.QWizard.exec_(self)
|
||||
|
||||
def initializePage(self, id):
|
||||
"""
|
||||
Set up the pages for Initial run through dialog
|
||||
"""
|
||||
log.debug(u'initializePage %s' % id)
|
||||
if id == 1:
|
||||
self.setBackgroundTabValues()
|
||||
elif id == 2:
|
||||
self.setMainAreaTabValues()
|
||||
elif id == 3:
|
||||
self.setFooterAreaTabValues()
|
||||
elif id == 4:
|
||||
self.setAlignmentTabValues()
|
||||
elif id == 5:
|
||||
self.setPositionTabValues()
|
||||
|
||||
def setBackgroundTabValues(self):
|
||||
"""
|
||||
Handle the display and State of the background display tab.
|
||||
"""
|
||||
if self.theme.background_type == \
|
||||
BackgroundType.to_string(BackgroundType.Solid):
|
||||
self.setField(u'background_type', QtCore.QVariant(0))
|
||||
self.color1PushButton.setVisible(True)
|
||||
self.color1Label.setVisible(True)
|
||||
self.color1PushButton.setStyleSheet(u'background-color: %s' %
|
||||
self.theme.background_color)
|
||||
self.color1Label.setText(
|
||||
translate('OpenLP.ThemeForm', 'Color:'))
|
||||
self.color2PushButton.setVisible(False)
|
||||
self.color2Label.setVisible(False)
|
||||
self.gradientLabel.setVisible(False)
|
||||
self.gradientComboBox.setVisible(False)
|
||||
self.imageLabel.setVisible(False)
|
||||
self.imageLineEdit.setVisible(False)
|
||||
self.imageBrowseButton.setVisible(False)
|
||||
self.imageLineEdit.setText(u'')
|
||||
elif self.theme.background_type == \
|
||||
BackgroundType.to_string(BackgroundType.Gradient):
|
||||
self.setField(u'background_type', QtCore.QVariant(1))
|
||||
self.color1PushButton.setVisible(True)
|
||||
self.color1Label.setVisible(True)
|
||||
self.color1PushButton.setStyleSheet(u'background-color: %s' %
|
||||
self.theme.background_start_color)
|
||||
self.color1Label.setText(
|
||||
translate('OpenLP.ThemeForm', 'First color:'))
|
||||
self.color2PushButton.setVisible(True)
|
||||
self.color2Label.setVisible(True)
|
||||
self.color2PushButton.setStyleSheet(u'background-color: %s' %
|
||||
self.theme.background_end_color)
|
||||
self.color2Label.setText(
|
||||
translate('OpenLP.ThemeForm', 'Second color:'))
|
||||
self.gradientLabel.setVisible(True)
|
||||
self.gradientComboBox.setVisible(True)
|
||||
self.imageLabel.setVisible(False)
|
||||
self.imageLineEdit.setVisible(False)
|
||||
self.imageBrowseButton.setVisible(False)
|
||||
self.imageLineEdit.setText(u'')
|
||||
else:
|
||||
self.setField(u'background_type', QtCore.QVariant(2))
|
||||
self.color1PushButton.setVisible(False)
|
||||
self.color1Label.setVisible(False)
|
||||
self.color2PushButton.setVisible(False)
|
||||
self.color2Label.setVisible(False)
|
||||
self.gradientLabel.setVisible(False)
|
||||
self.gradientComboBox.setVisible(False)
|
||||
self.imageLineEdit.setVisible(True)
|
||||
self.imageLabel.setVisible(True)
|
||||
self.imageBrowseButton.setVisible(True)
|
||||
self.imageLineEdit.setText(self.theme.background_filename)
|
||||
if self.theme.background_direction == \
|
||||
BackgroundGradientType.to_string(BackgroundGradientType.Horizontal):
|
||||
self.setField(u'gradient', QtCore.QVariant(0))
|
||||
elif self.theme.background_direction == \
|
||||
BackgroundGradientType.to_string(BackgroundGradientType.Vertical):
|
||||
self.setField(u'gradient', QtCore.QVariant(1))
|
||||
elif self.theme.background_direction == \
|
||||
BackgroundGradientType.to_string(BackgroundGradientType.Circular):
|
||||
self.setField(u'gradient', QtCore.QVariant(2))
|
||||
elif self.theme.background_direction == \
|
||||
BackgroundGradientType.to_string(BackgroundGradientType.LeftTop):
|
||||
self.setField(u'gradient', QtCore.QVariant(3))
|
||||
else:
|
||||
self.setField(u'gradient', QtCore.QVariant(4))
|
||||
|
||||
def setMainAreaTabValues(self):
|
||||
"""
|
||||
Handle the display and State of the Main Area tab.
|
||||
"""
|
||||
self.mainFontComboBox.setCurrentFont(
|
||||
QtGui.QFont(self.theme.font_main_name))
|
||||
self.mainColorPushButton.setStyleSheet(u'background-color: %s' %
|
||||
self.theme.font_main_color)
|
||||
self.setField(u'mainSizeSpinBox', \
|
||||
QtCore.QVariant(self.theme.font_main_size))
|
||||
self.setField(u'lineSpacingSpinBox', \
|
||||
QtCore.QVariant(self.theme.font_main_line_adjustment))
|
||||
self.setField(u'outlineCheckBox', \
|
||||
QtCore.QVariant(self.theme.font_main_outline))
|
||||
self.outlineColorPushButton.setStyleSheet(u'background-color: %s' %
|
||||
self.theme.font_main_outline_color)
|
||||
self.setField(u'outlineSizeSpinBox', \
|
||||
QtCore.QVariant(self.theme.font_main_outline_size))
|
||||
self.setField(u'shadowCheckBox', \
|
||||
QtCore.QVariant(self.theme.font_main_shadow))
|
||||
self.shadowColorPushButton.setStyleSheet(u'background-color: %s' %
|
||||
self.theme.font_main_shadow_color)
|
||||
self.setField(u'shadowSizeSpinBox', \
|
||||
QtCore.QVariant(self.theme.font_main_shadow_size))
|
||||
self.setField(u'boldCheckBox', \
|
||||
QtCore.QVariant(self.theme.font_main_bold))
|
||||
self.setField(u'italicsCheckBox', \
|
||||
QtCore.QVariant(self.theme.font_main_italics))
|
||||
# Set up field states
|
||||
if self.theme.font_main_outline:
|
||||
self.setField(u'outlineCheckBox', QtCore.QVariant(False))
|
||||
else:
|
||||
self.setField(u'outlineCheckBox', QtCore.QVariant(True))
|
||||
self.outlineColorPushButton.setEnabled(self.theme.font_main_outline)
|
||||
self.outlineSizeSpinBox.setEnabled(self.theme.font_main_outline)
|
||||
if self.theme.font_main_shadow:
|
||||
self.setField(u'shadowCheckBox', QtCore.QVariant(False))
|
||||
else:
|
||||
self.setField(u'shadowCheckBox', QtCore.QVariant(True))
|
||||
self.shadowColorPushButton.setEnabled(self.theme.font_main_shadow)
|
||||
self.shadowSizeSpinBox.setEnabled(self.theme.font_main_shadow)
|
||||
|
||||
def setFooterAreaTabValues(self):
|
||||
"""
|
||||
Handle the display and State of the Footer Area tab.
|
||||
"""
|
||||
self.footerFontComboBox.setCurrentFont(
|
||||
QtGui.QFont(self.theme.font_main_name))
|
||||
self.footerColorPushButton.setStyleSheet(u'background-color: %s' %
|
||||
self.theme.font_footer_color)
|
||||
self.setField(u'footerSizeSpinBox', \
|
||||
QtCore.QVariant(self.theme.font_footer_size))
|
||||
|
||||
def setPositionTabValues(self):
|
||||
"""
|
||||
Handle the display and State of the Position tab.
|
||||
"""
|
||||
# Main Area
|
||||
if self.theme.font_main_override:
|
||||
self.mainDefaultPositionCheckBox.setChecked(False)
|
||||
else:
|
||||
self.mainDefaultPositionCheckBox.setChecked(True)
|
||||
self.setField(u'mainPositionX', \
|
||||
QtCore.QVariant(self.theme.font_main_x))
|
||||
self.setField(u'mainPositionY', \
|
||||
QtCore.QVariant(self.theme.font_main_y))
|
||||
self.setField(u'mainPositionHeight', \
|
||||
QtCore.QVariant(self.theme.font_main_height))
|
||||
self.setField(u'mainPositionWidth', \
|
||||
QtCore.QVariant(self.theme.font_main_width))
|
||||
# Footer
|
||||
if self.theme.font_footer_override:
|
||||
self.footerDefaultPositionCheckBox.setChecked(False)
|
||||
else:
|
||||
self.footerDefaultPositionCheckBox.setChecked(True)
|
||||
self.setField(u'footerPositionX', \
|
||||
QtCore.QVariant(self.theme.font_footer_x))
|
||||
self.setField(u'footerPositionY', \
|
||||
QtCore.QVariant(self.theme.font_footer_y))
|
||||
self.setField(u'footerPositionHeight', \
|
||||
QtCore.QVariant(self.theme.font_footer_height))
|
||||
self.setField(u'footerPositionWidth', \
|
||||
QtCore.QVariant(self.theme.font_footer_width))
|
||||
|
||||
def setAlignmentTabValues(self):
|
||||
"""
|
||||
Define the Tab Alignments Page
|
||||
"""
|
||||
self.setField(u'horizontal', \
|
||||
QtCore.QVariant(self.theme.display_horizontal_align))
|
||||
self.setField(u'vertical', \
|
||||
QtCore.QVariant(self.theme.display_vertical_align))
|
||||
self.setField(u'slideTransition', \
|
||||
QtCore.QVariant(self.theme.display_slide_transition))
|
||||
|
||||
def setPreviewTabValues(self):
|
||||
self.setField(u'name', QtCore.QVariant(self.theme.theme_name))
|
||||
if len(self.theme.theme_name) > 1:
|
||||
self.themeNameEdit.setEnabled(False)
|
||||
else:
|
||||
self.themeNameEdit.setEnabled(True)
|
||||
|
||||
def onBackgroundComboBox(self, index):
|
||||
"""
|
||||
Background style Combo box has changed.
|
||||
"""
|
||||
self.theme.background_type = BackgroundType.to_string(index)
|
||||
self.setBackgroundTabValues()
|
||||
|
||||
def onGradientComboBox(self, index):
|
||||
"""
|
||||
Background gradient Combo box has changed.
|
||||
"""
|
||||
self.theme.background_direction = \
|
||||
BackgroundGradientType.to_string(index)
|
||||
self.setBackgroundTabValues()
|
||||
|
||||
def onColor1PushButtonClicked(self):
|
||||
"""
|
||||
Background / Gradient 1 Color button pushed.
|
||||
"""
|
||||
if self.theme.background_type == \
|
||||
BackgroundType.to_string(BackgroundType.Solid):
|
||||
self.theme.background_color = \
|
||||
self._colorButton(self.theme.background_color)
|
||||
else:
|
||||
self.theme.background_start_color = \
|
||||
self._colorButton(self.theme.background_start_color)
|
||||
self.setBackgroundTabValues()
|
||||
|
||||
def onColor2PushButtonClicked(self):
|
||||
"""
|
||||
Gradient 2 Color button pushed.
|
||||
"""
|
||||
self.theme.background_end_color = \
|
||||
self._colorButton(self.theme.background_end_color)
|
||||
self.setBackgroundTabValues()
|
||||
|
||||
def onImageBrowseButtonClicked(self):
|
||||
"""
|
||||
Background Image button pushed.
|
||||
"""
|
||||
images_filter = get_images_filter()
|
||||
images_filter = '%s;;%s (*.*) (*)' % (images_filter,
|
||||
translate('OpenLP.ThemeForm', 'All Files'))
|
||||
filename = QtGui.QFileDialog.getOpenFileName(self,
|
||||
translate('OpenLP.ThemeForm', 'Select Image'), u'',
|
||||
images_filter)
|
||||
if filename:
|
||||
self.theme.background_filename = unicode(filename)
|
||||
self.setBackgroundTabValues()
|
||||
|
||||
def onMainFontComboBox(self):
|
||||
"""
|
||||
Main Font Combo box changed
|
||||
"""
|
||||
self.theme.font_main_name = self.mainFontComboBox.currentFont().family()
|
||||
|
||||
def onMainColourPushButtonClicked(self):
|
||||
self.theme.font_main_color = \
|
||||
self._colorButton(self.theme.font_main_color)
|
||||
self.setMainAreaTabValues()
|
||||
|
||||
def onOutlineColourPushButtonClicked(self):
|
||||
self.theme.font_main_outline_color = \
|
||||
self._colorButton(self.theme.font_main_outline_color)
|
||||
self.setMainAreaTabValues()
|
||||
|
||||
def onShadowColourPushButtonClicked(self):
|
||||
self.theme.font_main_shadow_color = \
|
||||
self._colorButton(self.theme.font_main_shadow_color)
|
||||
self.setMainAreaTabValues()
|
||||
|
||||
def onFooterColourPushButtonClicked(self):
|
||||
self.theme.font_footer_color = \
|
||||
self._colorButton(self.theme.font_footer_color)
|
||||
self.setFooterAreaTabValues()
|
||||
|
||||
def updateTheme(self):
|
||||
"""
|
||||
Update the theme object from the UI for fields not already updated
|
||||
when the are changed.
|
||||
"""
|
||||
log.debug(u'updateTheme')
|
||||
# main page
|
||||
self.theme.font_main_name = \
|
||||
unicode(self.mainFontComboBox.currentFont().family())
|
||||
self.theme.font_main_size = \
|
||||
self.field(u'mainSizeSpinBox').toInt()[0]
|
||||
self.theme.font_main_line_adjustment = \
|
||||
self.field(u'lineSpacingSpinBox').toInt()[0]
|
||||
self.theme.font_main_outline_size = \
|
||||
self.field(u'outlineSizeSpinBox').toInt()[0]
|
||||
self.theme.font_main_shadow_size = \
|
||||
self.field(u'shadowSizeSpinBox').toInt()[0]
|
||||
self.theme.font_main_bold = \
|
||||
self.field(u'boldCheckBox').toBool()
|
||||
self.theme.font_main_italics = \
|
||||
self.field(u'italicsCheckBox').toBool()
|
||||
# footer page
|
||||
self.theme.font_footer_name = \
|
||||
unicode(self.footerFontComboBox.currentFont().family())
|
||||
self.theme.font_footer_size = \
|
||||
self.field(u'footerSizeSpinBox').toInt()[0]
|
||||
# position page
|
||||
self.theme.font_main_x = self.field(u'mainPositionX').toInt()[0]
|
||||
self.theme.font_main_y = self.field(u'mainPositionY').toInt()[0]
|
||||
self.theme.font_main_height = \
|
||||
self.field(u'mainPositionHeight').toInt()[0]
|
||||
self.theme.font_main_width = self.field(u'mainPositionWidth').toInt()[0]
|
||||
self.theme.font_footer_x = self.field(u'footerPositionX').toInt()[0]
|
||||
self.theme.font_footer_y = self.field(u'footerPositionY').toInt()[0]
|
||||
self.theme.font_footer_height = \
|
||||
self.field(u'footerPositionHeight').toInt()[0]
|
||||
self.theme.font_footer_width = \
|
||||
self.field(u'footerPositionWidth').toInt()[0]
|
||||
# position page
|
||||
self.theme.display_horizontal_align = \
|
||||
self.horizontalComboBox.currentIndex()
|
||||
self.theme.display_vertical_align = \
|
||||
self.verticalComboBox.currentIndex()
|
||||
self.theme.display_slide_transition = \
|
||||
self.field(u'slideTransition').toBool()
|
||||
|
||||
def accept(self):
|
||||
"""
|
||||
Lets save the them as Finish has been pressed
|
||||
"""
|
||||
# Some reason getting double submission.
|
||||
# Hack to stop it for now.
|
||||
if self.accepted:
|
||||
return
|
||||
self.accepted = True
|
||||
# Save the theme name
|
||||
self.theme.theme_name = \
|
||||
unicode(self.field(u'name').toString())
|
||||
if not self.theme.theme_name:
|
||||
QtGui.QMessageBox.critical(self,
|
||||
translate('OpenLP.ThemeForm', 'Theme Name Missing'),
|
||||
translate('OpenLP.ThemeForm',
|
||||
'There is no name for this theme. '
|
||||
'Please enter one.'),
|
||||
(QtGui.QMessageBox.Ok),
|
||||
QtGui.QMessageBox.Ok)
|
||||
return
|
||||
if self.theme.theme_name == u'-1' or self.theme.theme_name == u'None':
|
||||
QtGui.QMessageBox.critical(self,
|
||||
translate('OpenLP.ThemeForm', 'Theme Name Invalid'),
|
||||
translate('OpenLP.ThemeForm',
|
||||
'Invalid theme name. '
|
||||
'Please enter one.'),
|
||||
(QtGui.QMessageBox.Ok),
|
||||
QtGui.QMessageBox.Ok)
|
||||
return
|
||||
save_from = None
|
||||
save_to = None
|
||||
if self.theme.background_type == \
|
||||
BackgroundType.to_string(BackgroundType.Image):
|
||||
filename = \
|
||||
os.path.split(unicode(self.theme.background_filename))[1]
|
||||
save_to = os.path.join(self.path, self.theme.theme_name, filename)
|
||||
save_from = self.theme.background_filename
|
||||
if self.thememanager.saveTheme(self.theme, save_from, save_to):
|
||||
return QtGui.QDialog.accept(self)
|
||||
|
||||
def _colorButton(self, field):
|
||||
"""
|
||||
Handle Color buttons
|
||||
"""
|
||||
new_color = QtGui.QColorDialog.getColor(
|
||||
QtGui.QColor(field), self)
|
||||
if new_color.isValid():
|
||||
field = new_color.name()
|
||||
return field
|
|
@ -32,11 +32,11 @@ import logging
|
|||
from xml.etree.ElementTree import ElementTree, XML
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.ui import AmendThemeForm, FileRenameForm
|
||||
from openlp.core.ui import FileRenameForm, ThemeForm
|
||||
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, check_item_selected
|
||||
from openlp.core.lib import OpenLPToolbar, ThemeXML, get_text_file_string, \
|
||||
build_icon, Receiver, SettingsManager, translate, check_item_selected, \
|
||||
BackgroundType, BackgroundGradientType
|
||||
from openlp.core.utils import AppLocation, get_filesystem_encoding
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
@ -53,7 +53,7 @@ class ThemeManager(QtGui.QWidget):
|
|||
self.layout = QtGui.QVBoxLayout(self)
|
||||
self.layout.setSpacing(0)
|
||||
self.layout.setMargin(0)
|
||||
self.amendThemeForm = AmendThemeForm(self)
|
||||
self.themeForm = ThemeForm(self)
|
||||
self.fileRenameForm = FileRenameForm(self)
|
||||
self.toolbar = OpenLPToolbar(self)
|
||||
self.toolbar.addToolbarButton(
|
||||
|
@ -126,7 +126,7 @@ class ThemeManager(QtGui.QWidget):
|
|||
self.checkThemesExists(self.path)
|
||||
self.thumbPath = os.path.join(self.path, u'thumbnails')
|
||||
self.checkThemesExists(self.thumbPath)
|
||||
self.amendThemeForm.path = self.path
|
||||
self.themeForm.path = self.path
|
||||
self.oldBackgroundImage = None
|
||||
self.editingDefault = False
|
||||
# Last little bits of setting up
|
||||
|
@ -214,10 +214,10 @@ class ThemeManager(QtGui.QWidget):
|
|||
Loads a new theme with the default settings and then launches the theme
|
||||
editing form for the user to make their customisations.
|
||||
"""
|
||||
theme = self.createThemeFromXml(self.baseTheme(), self.path)
|
||||
self.amendThemeForm.loadTheme(theme)
|
||||
theme = ThemeXML()
|
||||
self.saveThemeName = u''
|
||||
self.amendThemeForm.exec_()
|
||||
self.themeForm.theme = theme
|
||||
self.themeForm.exec_()
|
||||
|
||||
def onRenameTheme(self):
|
||||
"""
|
||||
|
@ -243,66 +243,25 @@ class ThemeManager(QtGui.QWidget):
|
|||
self.saveThemeName = u''
|
||||
if self.fileRenameForm.exec_():
|
||||
newThemeName = unicode(self.fileRenameForm.FileNameEdit.text())
|
||||
oldThemeData = self.getThemeData(oldThemeName)
|
||||
self.cloneThemeData(oldThemeData, newThemeName)
|
||||
themeData = self.getThemeData(oldThemeName)
|
||||
self.cloneThemeData(themeData, newThemeName)
|
||||
self.loadThemes()
|
||||
|
||||
def cloneThemeData(self, oldThemeData, newThemeName):
|
||||
def cloneThemeData(self, themeData, newThemeName):
|
||||
"""
|
||||
Takes a theme and makes a new copy of it as well as saving it.
|
||||
"""
|
||||
log.debug(u'cloneThemeData')
|
||||
new_theme = ThemeXML()
|
||||
new_theme.new_document(newThemeName)
|
||||
save_from = None
|
||||
themeData.new_document(newThemeName)
|
||||
themeData.build_xml_from_attrs()
|
||||
save_to = None
|
||||
if oldThemeData.background_type == u'solid':
|
||||
new_theme.add_background_solid(
|
||||
unicode(oldThemeData.background_color))
|
||||
elif oldThemeData.background_type == u'gradient':
|
||||
new_theme.add_background_gradient(
|
||||
unicode(oldThemeData.background_start_color),
|
||||
unicode(oldThemeData.background_end_color),
|
||||
oldThemeData.background_direction)
|
||||
else:
|
||||
filename = \
|
||||
os.path.split(unicode(oldThemeData.background_filename))[1]
|
||||
new_theme.add_background_image(filename)
|
||||
save_to = os.path.join(self.path, theme_name, filename)
|
||||
save_from = oldThemeData.background_filename
|
||||
new_theme.add_font(unicode(oldThemeData.font_main_name),
|
||||
unicode(oldThemeData.font_main_color),
|
||||
unicode(oldThemeData.font_main_proportion),
|
||||
unicode(oldThemeData.font_main_override), u'main',
|
||||
unicode(oldThemeData.font_main_weight),
|
||||
unicode(oldThemeData.font_main_italics),
|
||||
unicode(oldThemeData.font_main_line_adjustment),
|
||||
unicode(oldThemeData.font_main_x),
|
||||
unicode(oldThemeData.font_main_y),
|
||||
unicode(oldThemeData.font_main_width),
|
||||
unicode(oldThemeData.font_main_height))
|
||||
new_theme.add_font(unicode(oldThemeData.font_footer_name),
|
||||
unicode(oldThemeData.font_footer_color),
|
||||
unicode(oldThemeData.font_footer_proportion),
|
||||
unicode(oldThemeData.font_footer_override), u'footer',
|
||||
unicode(oldThemeData.font_footer_weight),
|
||||
unicode(oldThemeData.font_footer_italics),
|
||||
0, # line adjustment
|
||||
unicode(oldThemeData.font_footer_x),
|
||||
unicode(oldThemeData.font_footer_y),
|
||||
unicode(oldThemeData.font_footer_width),
|
||||
unicode(oldThemeData.font_footer_height))
|
||||
new_theme.add_display(unicode(oldThemeData.display_shadow),
|
||||
unicode(oldThemeData.display_shadow_color),
|
||||
unicode(oldThemeData.display_outline),
|
||||
unicode(oldThemeData.display_outline_color),
|
||||
unicode(oldThemeData.display_horizontal_align),
|
||||
unicode(oldThemeData.display_vertical_align),
|
||||
unicode(oldThemeData.display_wrap_style),
|
||||
unicode(oldThemeData.display_slide_transition),
|
||||
unicode(oldThemeData.display_shadow_size),
|
||||
unicode(oldThemeData.display_outline_size))
|
||||
theme = new_theme.extract_xml()
|
||||
pretty_theme = new_theme.extract_formatted_xml()
|
||||
save_from = None
|
||||
if themeData.background_type == u'image':
|
||||
save_to = os.path.join(self.path, newThemeName,
|
||||
os.path.split(unicode(themeData.background_filename))[1])
|
||||
save_from = themeData.background_filename
|
||||
theme = themeData.extract_xml()
|
||||
pretty_theme = themeData.extract_formatted_xml()
|
||||
self.saveTheme(newThemeName, theme, pretty_theme, save_from, save_to)
|
||||
|
||||
def onEditTheme(self):
|
||||
|
@ -321,10 +280,10 @@ class ThemeManager(QtGui.QWidget):
|
|||
unicode(item.data(QtCore.Qt.UserRole).toString()))
|
||||
if theme.background_type == u'image':
|
||||
self.oldBackgroundImage = theme.background_filename
|
||||
self.amendThemeForm.loadTheme(theme)
|
||||
self.saveThemeName = unicode(
|
||||
item.data(QtCore.Qt.UserRole).toString())
|
||||
self.amendThemeForm.exec_()
|
||||
self.themeForm.theme = theme
|
||||
self.themeForm.exec_()
|
||||
|
||||
def onDeleteTheme(self):
|
||||
"""
|
||||
|
@ -341,7 +300,8 @@ class ThemeManager(QtGui.QWidget):
|
|||
# confirm deletion
|
||||
answer = QtGui.QMessageBox.question(self,
|
||||
translate('OpenLP.ThemeManager', 'Delete Confirmation'),
|
||||
translate('OpenLP.ThemeManager', 'Delete theme?'),
|
||||
unicode(translate('OpenLP.ThemeManager', 'Delete %s theme?'))
|
||||
% theme,
|
||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes |
|
||||
QtGui.QMessageBox.No), QtGui.QMessageBox.No)
|
||||
if answer == QtGui.QMessageBox.No:
|
||||
|
@ -463,6 +423,7 @@ class ThemeManager(QtGui.QWidget):
|
|||
self.themelist = []
|
||||
self.themeListWidget.clear()
|
||||
dirList = os.listdir(self.path)
|
||||
dirList.sort()
|
||||
for name in dirList:
|
||||
if name.endswith(u'.png'):
|
||||
# check to see file is in theme root directory
|
||||
|
@ -513,8 +474,9 @@ class ThemeManager(QtGui.QWidget):
|
|||
unicode(themename) + u'.xml')
|
||||
xml = get_text_file_string(xml_file)
|
||||
if not xml:
|
||||
xml = self.baseTheme()
|
||||
return self.createThemeFromXml(xml, self.path)
|
||||
return self.baseTheme()
|
||||
else:
|
||||
return self.createThemeFromXml(xml, self.path)
|
||||
|
||||
def checkThemesExists(self, dir):
|
||||
"""
|
||||
|
@ -585,7 +547,8 @@ class ThemeManager(QtGui.QWidget):
|
|||
outfile = open(fullpath, u'wb')
|
||||
outfile.write(zip.read(file))
|
||||
if filexml:
|
||||
self.generateAndSaveImage(dir, themename, filexml)
|
||||
theme = self.createThemeFromXml(filexml, self.path)
|
||||
self.generateAndSaveImage(dir, themename, theme)
|
||||
else:
|
||||
QtGui.QMessageBox.critical(self,
|
||||
translate('OpenLP.ThemeManager', 'Error'),
|
||||
|
@ -632,50 +595,59 @@ class ThemeManager(QtGui.QWidget):
|
|||
"""
|
||||
theme = Theme(xml_data)
|
||||
newtheme = ThemeXML()
|
||||
newtheme.new_document(theme.Name)
|
||||
newtheme.theme_name = theme.Name
|
||||
if theme.BackgroundType == 0:
|
||||
newtheme.add_background_solid(unicode(
|
||||
theme.BackgroundParameter1.name()))
|
||||
newtheme.background_type = \
|
||||
BackgroundType.to_string(BackgroundType.Solid)
|
||||
newtheme.background_color = \
|
||||
unicode(theme.BackgroundParameter1.name())
|
||||
elif theme.BackgroundType == 1:
|
||||
direction = u'vertical'
|
||||
newtheme.background_type = \
|
||||
BackgroundType.to_string(BackgroundType.Gradient)
|
||||
newtheme.background_direction = \
|
||||
BackgroundGradientType. \
|
||||
to_string(BackgroundGradientType.Horizontal)
|
||||
if theme.BackgroundParameter3.name() == 1:
|
||||
direction = u'horizontal'
|
||||
newtheme.add_background_gradient(
|
||||
unicode(theme.BackgroundParameter1.name()),
|
||||
unicode(theme.BackgroundParameter2.name()), direction)
|
||||
newtheme.background_direction = \
|
||||
BackgroundGradientType. \
|
||||
to_string(BackgroundGradientType.Horizontal)
|
||||
newtheme.background_start_color = \
|
||||
unicode(theme.BackgroundParameter1.name())
|
||||
newtheme.background_end_color = \
|
||||
unicode(theme.BackgroundParameter2.name())
|
||||
else:
|
||||
newtheme.add_background_image(unicode(theme.BackgroundParameter1))
|
||||
newtheme.add_font(unicode(theme.FontName),
|
||||
unicode(theme.FontColor.name()),
|
||||
unicode(theme.FontProportion * 3), u'False')
|
||||
newtheme.add_font(unicode(theme.FontName),
|
||||
unicode(theme.FontColor.name()),
|
||||
unicode(12), u'False', u'footer')
|
||||
outline = False
|
||||
shadow = False
|
||||
newtheme.background_type = \
|
||||
BackgroundType.to_string(BackgroundType.Image)
|
||||
newtheme.background_filename = unicode(theme.BackgroundParameter1)
|
||||
newtheme.font_main_name = theme.FontName
|
||||
newtheme.font_main_color = unicode(theme.FontColor.name())
|
||||
newtheme.font_main_size = theme.FontProportion * 3
|
||||
newtheme.font_footer_name = theme.FontName
|
||||
newtheme.font_footer_color = unicode(theme.FontColor.name())
|
||||
newtheme.font_main_shadow = False
|
||||
if theme.Shadow == 1:
|
||||
shadow = True
|
||||
newtheme.font_main_shadow = True
|
||||
newtheme.font_main_shadow_color = unicode(theme.ShadowColor.name())
|
||||
if theme.Outline == 1:
|
||||
outline = True
|
||||
newtheme.font_main_outline = True
|
||||
newtheme.font_main_outline_color = unicode(theme.OutlineColor.name())
|
||||
vAlignCorrection = 0
|
||||
if theme.VerticalAlign == 2:
|
||||
vAlignCorrection = 1
|
||||
elif theme.VerticalAlign == 1:
|
||||
vAlignCorrection = 2
|
||||
newtheme.add_display(unicode(shadow),
|
||||
unicode(theme.ShadowColor.name()),
|
||||
unicode(outline), unicode(theme.OutlineColor.name()),
|
||||
unicode(theme.HorizontalAlign), unicode(vAlignCorrection),
|
||||
unicode(theme.WrapStyle), unicode(0))
|
||||
newtheme.display_horizontal_align = theme.HorizontalAlign
|
||||
newtheme.display_vertical_align = vAlignCorrection
|
||||
return newtheme.extract_xml()
|
||||
|
||||
def saveTheme(self, name, theme_xml, theme_pretty_xml, image_from,
|
||||
image_to):
|
||||
def saveTheme(self, theme, image_from, image_to):
|
||||
"""
|
||||
Called by thememaintenance Dialog to save the theme
|
||||
and to trigger the reload of the theme list
|
||||
"""
|
||||
log.debug(u'saveTheme %s %s', name, theme_xml)
|
||||
name = theme.theme_name
|
||||
theme_pretty_xml = theme.extract_formatted_xml()
|
||||
log.debug(u'saveTheme %s %s', name, theme_pretty_xml)
|
||||
theme_dir = os.path.join(self.path, name)
|
||||
if not os.path.exists(theme_dir):
|
||||
os.mkdir(os.path.join(self.path, name))
|
||||
|
@ -724,7 +696,7 @@ class ThemeManager(QtGui.QWidget):
|
|||
unicode(image_to).encode(encoding))
|
||||
except IOError:
|
||||
log.exception(u'Failed to save theme image')
|
||||
self.generateAndSaveImage(self.path, name, theme_xml)
|
||||
self.generateAndSaveImage(self.path, name, theme)
|
||||
self.loadThemes()
|
||||
# Check if we need to set a new service theme
|
||||
if editedServiceTheme:
|
||||
|
@ -749,14 +721,16 @@ class ThemeManager(QtGui.QWidget):
|
|||
self.global_theme)
|
||||
self.editingDefault = False
|
||||
self.pushThemes()
|
||||
return True
|
||||
else:
|
||||
# Don't close the dialog - allow the user to change the name of
|
||||
# the theme or to cancel the theme dialog completely.
|
||||
return False
|
||||
|
||||
def generateAndSaveImage(self, dir, name, theme_xml):
|
||||
log.debug(u'generateAndSaveImage %s %s %s', dir, name, theme_xml)
|
||||
theme = self.createThemeFromXml(theme_xml, dir)
|
||||
def generateAndSaveImage(self, dir, name, theme):
|
||||
log.debug(u'generateAndSaveImage %s %s', dir, name)
|
||||
#theme = self.createThemeFromXml(theme_xml, dir)
|
||||
theme_xml = theme.extract_xml()
|
||||
frame = self.generateImage(theme)
|
||||
samplepathname = os.path.join(self.path, name + u'.png')
|
||||
if os.path.exists(samplepathname):
|
||||
|
@ -792,16 +766,7 @@ class ThemeManager(QtGui.QWidget):
|
|||
"""
|
||||
log.debug(u'base theme created')
|
||||
newtheme = ThemeXML()
|
||||
newtheme.new_document(
|
||||
unicode(translate('OpenLP.ThemeManager', 'New Theme')))
|
||||
newtheme.add_background_solid(u'#000000')
|
||||
newtheme.add_font(unicode(QtGui.QFont().family()), u'#FFFFFF',
|
||||
u'30', u'False')
|
||||
newtheme.add_font(unicode(QtGui.QFont().family()), u'#FFFFFF',
|
||||
u'12', u'False', u'footer')
|
||||
newtheme.add_display(u'False', u'#FFFFFF', u'False',
|
||||
unicode(u'#FFFFFF'), u'0', u'0', u'0', u'False')
|
||||
return newtheme.extract_xml()
|
||||
return newtheme
|
||||
|
||||
def createThemeFromXml(self, theme_xml, path):
|
||||
"""
|
||||
|
|
|
@ -0,0 +1,547 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
# --------------------------------------------------------------------------- #
|
||||
# Copyright (c) 2008-2010 Raoul Snyman #
|
||||
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
|
||||
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
|
||||
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
|
||||
# Carsten Tinggaard, Frode Woldsund #
|
||||
# --------------------------------------------------------------------------- #
|
||||
# This program is free software; you can redistribute it and/or modify it #
|
||||
# under the terms of the GNU General Public License as published by the Free #
|
||||
# Software Foundation; version 2 of the License. #
|
||||
# #
|
||||
# This program is distributed in the hope that it will be useful, but WITHOUT #
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
|
||||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
|
||||
# more details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU General Public License along #
|
||||
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
|
||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||
###############################################################################
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import translate, build_icon
|
||||
|
||||
class Ui_ThemeWizard(object):
|
||||
def setupUi(self, ThemeWizard):
|
||||
ThemeWizard.setObjectName(u'ThemeWizard')
|
||||
ThemeWizard.resize(550, 386)
|
||||
ThemeWizard.setModal(True)
|
||||
ThemeWizard.setWizardStyle(QtGui.QWizard.ModernStyle)
|
||||
ThemeWizard.setOptions(QtGui.QWizard.IndependentPages|QtGui.QWizard.NoBackButtonOnStartPage)
|
||||
self.welcomePage = QtGui.QWizardPage()
|
||||
self.welcomePage.setTitle(u'')
|
||||
self.welcomePage.setSubTitle(u'')
|
||||
self.welcomePage.setObjectName(u'welcomePage')
|
||||
self.welcomeLayout = QtGui.QHBoxLayout(self.welcomePage)
|
||||
self.welcomeLayout.setSpacing(8)
|
||||
self.welcomeLayout.setMargin(0)
|
||||
self.welcomeLayout.setObjectName(u'welcomeLayout')
|
||||
self.importBibleImage = QtGui.QLabel(self.welcomePage)
|
||||
self.importBibleImage.setMinimumSize(QtCore.QSize(163, 0))
|
||||
self.importBibleImage.setMaximumSize(QtCore.QSize(163, 16777215))
|
||||
self.importBibleImage.setLineWidth(0)
|
||||
self.importBibleImage.setText(u'')
|
||||
self.importBibleImage.setPixmap(QtGui.QPixmap(u':/wizards/wizard_importbible.bmp'))
|
||||
self.importBibleImage.setIndent(0)
|
||||
self.importBibleImage.setObjectName(u'importBibleImage')
|
||||
self.welcomeLayout.addWidget(self.importBibleImage)
|
||||
self.welcomePageLayout = QtGui.QVBoxLayout()
|
||||
self.welcomePageLayout.setSpacing(8)
|
||||
self.welcomePageLayout.setObjectName(u'welcomePageLayout')
|
||||
self.titleLabel = QtGui.QLabel(self.welcomePage)
|
||||
self.titleLabel.setObjectName(u'titleLabel')
|
||||
self.welcomePageLayout.addWidget(self.titleLabel)
|
||||
spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed)
|
||||
self.welcomePageLayout.addItem(spacerItem)
|
||||
self.informationLabel = QtGui.QLabel(self.welcomePage)
|
||||
self.informationLabel.setWordWrap(True)
|
||||
self.informationLabel.setMargin(10)
|
||||
self.informationLabel.setObjectName(u'informationLabel')
|
||||
self.welcomePageLayout.addWidget(self.informationLabel)
|
||||
spacerItem1 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
|
||||
self.welcomePageLayout.addItem(spacerItem1)
|
||||
self.welcomeLayout.addLayout(self.welcomePageLayout)
|
||||
ThemeWizard.addPage(self.welcomePage)
|
||||
self.backgroundPage = QtGui.QWizardPage()
|
||||
self.backgroundPage.setObjectName(u'backgroundPage')
|
||||
self.backgroundLayout = QtGui.QFormLayout(self.backgroundPage)
|
||||
self.backgroundLayout.setFieldGrowthPolicy(QtGui.QFormLayout.ExpandingFieldsGrow)
|
||||
self.backgroundLayout.setLabelAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
|
||||
self.backgroundLayout.setMargin(20)
|
||||
self.backgroundLayout.setSpacing(8)
|
||||
self.backgroundLayout.setObjectName(u'backgroundLayout')
|
||||
self.backgroundTypeLabel = QtGui.QLabel(self.backgroundPage)
|
||||
self.backgroundTypeLabel.setObjectName(u'backgroundTypeLabel')
|
||||
self.backgroundLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.backgroundTypeLabel)
|
||||
self.backgroundTypeComboBox = QtGui.QComboBox(self.backgroundPage)
|
||||
self.backgroundTypeComboBox.setObjectName(u'backgroundTypeComboBox')
|
||||
self.backgroundTypeComboBox.addItem(u'')
|
||||
self.backgroundTypeComboBox.addItem(u'')
|
||||
self.backgroundTypeComboBox.addItem(u'')
|
||||
self.backgroundLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.backgroundTypeComboBox)
|
||||
self.color1Label = QtGui.QLabel(self.backgroundPage)
|
||||
self.color1Label.setObjectName(u'color1Label')
|
||||
self.backgroundLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.color1Label)
|
||||
self.color1PushButton = QtGui.QPushButton(self.backgroundPage)
|
||||
self.color1PushButton.setText(u'')
|
||||
self.color1PushButton.setObjectName(u'color1PushButton')
|
||||
self.backgroundLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.color1PushButton)
|
||||
self.color2Label = QtGui.QLabel(self.backgroundPage)
|
||||
self.color2Label.setObjectName(u'color2Label')
|
||||
self.backgroundLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.color2Label)
|
||||
self.color2PushButton = QtGui.QPushButton(self.backgroundPage)
|
||||
self.color2PushButton.setText(u'')
|
||||
self.color2PushButton.setObjectName(u'color2PushButton')
|
||||
self.backgroundLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.color2PushButton)
|
||||
self.imageLabel = QtGui.QLabel(self.backgroundPage)
|
||||
self.imageLabel.setObjectName(u'imageLabel')
|
||||
self.backgroundLayout.setWidget(3, QtGui.QFormLayout.LabelRole, self.imageLabel)
|
||||
self.imageLayout = QtGui.QHBoxLayout()
|
||||
self.imageLayout.setSpacing(8)
|
||||
self.imageLayout.setObjectName(u'imageLayout')
|
||||
self.imageLineEdit = QtGui.QLineEdit(self.backgroundPage)
|
||||
self.imageLineEdit.setObjectName(u'imageLineEdit')
|
||||
self.imageLayout.addWidget(self.imageLineEdit)
|
||||
self.imageBrowseButton = QtGui.QToolButton(self.backgroundPage)
|
||||
self.imageBrowseButton.setText(u'')
|
||||
self.imageBrowseButton.setIcon(build_icon(u':/general/general_open.png'))
|
||||
self.imageBrowseButton.setObjectName(u'imageBrowseButton')
|
||||
self.imageLayout.addWidget(self.imageBrowseButton)
|
||||
self.backgroundLayout.setLayout(3, QtGui.QFormLayout.FieldRole, self.imageLayout)
|
||||
self.gradientLabel = QtGui.QLabel(self.backgroundPage)
|
||||
self.gradientLabel.setObjectName(u'gradientLabel')
|
||||
self.backgroundLayout.setWidget(4, QtGui.QFormLayout.LabelRole, self.gradientLabel)
|
||||
self.gradientComboBox = QtGui.QComboBox(self.backgroundPage)
|
||||
self.gradientComboBox.setObjectName(u'gradientComboBox')
|
||||
self.gradientComboBox.addItem(u'')
|
||||
self.gradientComboBox.addItem(u'')
|
||||
self.gradientComboBox.addItem(u'')
|
||||
self.gradientComboBox.addItem(u'')
|
||||
self.gradientComboBox.addItem(u'')
|
||||
self.backgroundLayout.setWidget(4, QtGui.QFormLayout.FieldRole, self.gradientComboBox)
|
||||
ThemeWizard.addPage(self.backgroundPage)
|
||||
self.mainAreaPage = QtGui.QWizardPage()
|
||||
self.mainAreaPage.setObjectName(u'mainAreaPage')
|
||||
self.formLayout = QtGui.QFormLayout(self.mainAreaPage)
|
||||
self.formLayout.setFormAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop)
|
||||
self.formLayout.setContentsMargins(-1, 20, 20, 20)
|
||||
self.formLayout.setSpacing(8)
|
||||
self.formLayout.setObjectName(u'formLayout')
|
||||
self.mainFontLabel = QtGui.QLabel(self.mainAreaPage)
|
||||
self.mainFontLabel.setObjectName(u'mainFontLabel')
|
||||
self.formLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.mainFontLabel)
|
||||
self.mainFontComboBox = QtGui.QFontComboBox(self.mainAreaPage)
|
||||
self.mainFontComboBox.setObjectName(u'mainFontComboBox')
|
||||
self.formLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.mainFontComboBox)
|
||||
self.mainColorLabel = QtGui.QLabel(self.mainAreaPage)
|
||||
self.mainColorLabel.setObjectName(u'mainColorLabel')
|
||||
self.formLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.mainColorLabel)
|
||||
self.mainColorPushButton = QtGui.QPushButton(self.mainAreaPage)
|
||||
self.mainColorPushButton.setText(u'')
|
||||
self.mainColorPushButton.setObjectName(u'mainColorPushButton')
|
||||
self.formLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.mainColorPushButton)
|
||||
self.mainSizeLabel = QtGui.QLabel(self.mainAreaPage)
|
||||
self.mainSizeLabel.setObjectName(u'mainSizeLabel')
|
||||
self.formLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.mainSizeLabel)
|
||||
self.mainSizeLayout = QtGui.QHBoxLayout()
|
||||
self.mainSizeLayout.setSpacing(8)
|
||||
self.mainSizeLayout.setMargin(0)
|
||||
self.mainSizeLayout.setObjectName(u'mainSizeLayout')
|
||||
self.mainSizeSpinBox = QtGui.QSpinBox(self.mainAreaPage)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.mainSizeSpinBox.sizePolicy().hasHeightForWidth())
|
||||
self.mainSizeSpinBox.setSizePolicy(sizePolicy)
|
||||
self.mainSizeSpinBox.setMinimumSize(QtCore.QSize(70, 0))
|
||||
self.mainSizeSpinBox.setMaximum(999)
|
||||
self.mainSizeSpinBox.setProperty(u'value', 16)
|
||||
self.mainSizeSpinBox.setObjectName(u'mainSizeSpinBox')
|
||||
self.mainSizeLayout.addWidget(self.mainSizeSpinBox)
|
||||
self.mainLineCountLabel = QtGui.QLabel(self.mainAreaPage)
|
||||
self.mainLineCountLabel.setObjectName(u'mainLineCountLabel')
|
||||
self.mainSizeLayout.addWidget(self.mainLineCountLabel)
|
||||
self.formLayout.setLayout(2, QtGui.QFormLayout.FieldRole, self.mainSizeLayout)
|
||||
self.lineSpacingLabel = QtGui.QLabel(self.mainAreaPage)
|
||||
self.lineSpacingLabel.setObjectName(u'lineSpacingLabel')
|
||||
self.formLayout.setWidget(3, QtGui.QFormLayout.LabelRole, self.lineSpacingLabel)
|
||||
self.lineSpacingSpinBox = QtGui.QSpinBox(self.mainAreaPage)
|
||||
self.lineSpacingSpinBox.setMinimum(-50)
|
||||
self.lineSpacingSpinBox.setMaximum(50)
|
||||
self.lineSpacingSpinBox.setObjectName(u'lineSpacingSpinBox')
|
||||
self.formLayout.setWidget(3, QtGui.QFormLayout.FieldRole, self.lineSpacingSpinBox)
|
||||
self.outlineCheckBox = QtGui.QCheckBox(self.mainAreaPage)
|
||||
self.outlineCheckBox.setObjectName(u'outlineCheckBox')
|
||||
self.formLayout.setWidget(4, QtGui.QFormLayout.LabelRole, self.outlineCheckBox)
|
||||
self.outlineLayout = QtGui.QHBoxLayout()
|
||||
self.outlineLayout.setObjectName(u'outlineLayout')
|
||||
self.outlineColorPushButton = QtGui.QPushButton(self.mainAreaPage)
|
||||
self.outlineColorPushButton.setEnabled(True)
|
||||
self.outlineColorPushButton.setText(u'')
|
||||
self.outlineColorPushButton.setObjectName(u'outlineColorPushButton')
|
||||
self.outlineLayout.addWidget(self.outlineColorPushButton)
|
||||
self.outlineSizeLabel = QtGui.QLabel(self.mainAreaPage)
|
||||
self.outlineSizeLabel.setObjectName(u'outlineSizeLabel')
|
||||
self.outlineLayout.addWidget(self.outlineSizeLabel)
|
||||
self.outlineSizeSpinBox = QtGui.QSpinBox(self.mainAreaPage)
|
||||
self.outlineSizeSpinBox.setObjectName(u'outlineSizeSpinBox')
|
||||
self.outlineLayout.addWidget(self.outlineSizeSpinBox)
|
||||
self.formLayout.setLayout(4, QtGui.QFormLayout.FieldRole, self.outlineLayout)
|
||||
self.shadowCheckBox = QtGui.QCheckBox(self.mainAreaPage)
|
||||
self.shadowCheckBox.setObjectName(u'shadowCheckBox')
|
||||
self.formLayout.setWidget(5, QtGui.QFormLayout.LabelRole, self.shadowCheckBox)
|
||||
self.shadowLayout = QtGui.QHBoxLayout()
|
||||
self.shadowLayout.setObjectName(u'shadowLayout')
|
||||
self.shadowColorPushButton = QtGui.QPushButton(self.mainAreaPage)
|
||||
self.shadowColorPushButton.setEnabled(True)
|
||||
self.shadowColorPushButton.setText(u'')
|
||||
self.shadowColorPushButton.setObjectName(u'shadowColorPushButton')
|
||||
self.shadowLayout.addWidget(self.shadowColorPushButton)
|
||||
self.shadowSizeLabel = QtGui.QLabel(self.mainAreaPage)
|
||||
self.shadowSizeLabel.setObjectName(u'shadowSizeLabel')
|
||||
self.shadowLayout.addWidget(self.shadowSizeLabel)
|
||||
self.shadowSizeSpinBox = QtGui.QSpinBox(self.mainAreaPage)
|
||||
self.shadowSizeSpinBox.setObjectName(u'shadowSizeSpinBox')
|
||||
self.shadowLayout.addWidget(self.shadowSizeSpinBox)
|
||||
self.formLayout.setLayout(5, QtGui.QFormLayout.FieldRole, self.shadowLayout)
|
||||
self.boldCheckBox = QtGui.QCheckBox(self.mainAreaPage)
|
||||
self.boldCheckBox.setObjectName(u'boldCheckBox')
|
||||
self.formLayout.setWidget(6, QtGui.QFormLayout.FieldRole, self.boldCheckBox)
|
||||
self.italicsCheckBox = QtGui.QCheckBox(self.mainAreaPage)
|
||||
self.italicsCheckBox.setObjectName(u'italicsCheckBox')
|
||||
self.formLayout.setWidget(7, QtGui.QFormLayout.FieldRole, self.italicsCheckBox)
|
||||
ThemeWizard.addPage(self.mainAreaPage)
|
||||
self.footerAreaPage = QtGui.QWizardPage()
|
||||
self.footerAreaPage.setObjectName(u'footerAreaPage')
|
||||
self.footerLayout = QtGui.QFormLayout(self.footerAreaPage)
|
||||
self.footerLayout.setFieldGrowthPolicy(QtGui.QFormLayout.ExpandingFieldsGrow)
|
||||
self.footerLayout.setContentsMargins(50, 20, 20, 20)
|
||||
self.footerLayout.setSpacing(8)
|
||||
self.footerLayout.setObjectName(u'footerLayout')
|
||||
self.footerFontLabel = QtGui.QLabel(self.footerAreaPage)
|
||||
self.footerFontLabel.setObjectName(u'footerFontLabel')
|
||||
self.footerLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.footerFontLabel)
|
||||
self.footerFontComboBox = QtGui.QFontComboBox(self.footerAreaPage)
|
||||
self.footerFontComboBox.setObjectName(u'footerFontComboBox')
|
||||
self.footerLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.footerFontComboBox)
|
||||
self.footerColorLabel = QtGui.QLabel(self.footerAreaPage)
|
||||
self.footerColorLabel.setObjectName(u'footerColorLabel')
|
||||
self.footerLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.footerColorLabel)
|
||||
self.footerColorPushButton = QtGui.QPushButton(self.footerAreaPage)
|
||||
self.footerColorPushButton.setText(u'')
|
||||
self.footerColorPushButton.setObjectName(u'footerColorPushButton')
|
||||
self.footerLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.footerColorPushButton)
|
||||
self.footerSizeLabel = QtGui.QLabel(self.footerAreaPage)
|
||||
self.footerSizeLabel.setObjectName(u'footerSizeLabel')
|
||||
self.footerLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.footerSizeLabel)
|
||||
self.footerSizeSpinBox = QtGui.QSpinBox(self.footerAreaPage)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.footerSizeSpinBox.sizePolicy().hasHeightForWidth())
|
||||
self.footerSizeSpinBox.setSizePolicy(sizePolicy)
|
||||
self.footerSizeSpinBox.setMinimumSize(QtCore.QSize(70, 0))
|
||||
self.footerSizeSpinBox.setMaximum(999)
|
||||
self.footerSizeSpinBox.setProperty(u'value', 10)
|
||||
self.footerSizeSpinBox.setObjectName(u'footerSizeSpinBox')
|
||||
self.footerLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.footerSizeSpinBox)
|
||||
ThemeWizard.addPage(self.footerAreaPage)
|
||||
self.alignmentPage = QtGui.QWizardPage()
|
||||
self.alignmentPage.setObjectName(u'alignmentPage')
|
||||
self.formLayout_2 = QtGui.QFormLayout(self.alignmentPage)
|
||||
self.formLayout_2.setMargin(20)
|
||||
self.formLayout_2.setObjectName(u'formLayout_2')
|
||||
self.horizontalLabel = QtGui.QLabel(self.alignmentPage)
|
||||
self.horizontalLabel.setObjectName(u'horizontalLabel')
|
||||
self.formLayout_2.setWidget(0, QtGui.QFormLayout.LabelRole, self.horizontalLabel)
|
||||
self.horizontalComboBox = QtGui.QComboBox(self.alignmentPage)
|
||||
self.horizontalComboBox.setEditable(False)
|
||||
self.horizontalComboBox.setObjectName(u'horizontalComboBox')
|
||||
self.horizontalComboBox.addItem(u'')
|
||||
self.horizontalComboBox.addItem(u'')
|
||||
self.horizontalComboBox.addItem(u'')
|
||||
self.formLayout_2.setWidget(0, QtGui.QFormLayout.FieldRole, self.horizontalComboBox)
|
||||
self.verticalLabel = QtGui.QLabel(self.alignmentPage)
|
||||
self.verticalLabel.setObjectName(u'verticalLabel')
|
||||
self.formLayout_2.setWidget(1, QtGui.QFormLayout.LabelRole, self.verticalLabel)
|
||||
self.verticalComboBox = QtGui.QComboBox(self.alignmentPage)
|
||||
self.verticalComboBox.setObjectName(u'verticalComboBox')
|
||||
self.verticalComboBox.addItem(u'')
|
||||
self.verticalComboBox.addItem(u'')
|
||||
self.verticalComboBox.addItem(u'')
|
||||
self.formLayout_2.setWidget(1, QtGui.QFormLayout.FieldRole, self.verticalComboBox)
|
||||
self.transitionsCheckBox = QtGui.QCheckBox(self.alignmentPage)
|
||||
self.transitionsCheckBox.setObjectName(u'transitionsCheckBox')
|
||||
self.formLayout_2.setWidget(2, QtGui.QFormLayout.FieldRole, self.transitionsCheckBox)
|
||||
ThemeWizard.addPage(self.alignmentPage)
|
||||
self.areaPositionPage = QtGui.QWizardPage()
|
||||
self.areaPositionPage.setObjectName(u'areaPositionPage')
|
||||
self.gridLayout_2 = QtGui.QGridLayout(self.areaPositionPage)
|
||||
self.gridLayout_2.setMargin(20)
|
||||
self.gridLayout_2.setSpacing(8)
|
||||
self.gridLayout_2.setObjectName(u'gridLayout_2')
|
||||
self.mainPositionGroupBox = QtGui.QGroupBox(self.areaPositionPage)
|
||||
self.mainPositionGroupBox.setMinimumSize(QtCore.QSize(248, 0))
|
||||
self.mainPositionGroupBox.setObjectName(u'mainPositionGroupBox')
|
||||
self.mainPositionLayout = QtGui.QFormLayout(self.mainPositionGroupBox)
|
||||
self.mainPositionLayout.setMargin(8)
|
||||
self.mainPositionLayout.setSpacing(8)
|
||||
self.mainPositionLayout.setObjectName(u'mainPositionLayout')
|
||||
self.mainDefaultPositionCheckBox = QtGui.QCheckBox(self.mainPositionGroupBox)
|
||||
self.mainDefaultPositionCheckBox.setChecked(True)
|
||||
self.mainDefaultPositionCheckBox.setTristate(False)
|
||||
self.mainDefaultPositionCheckBox.setObjectName(u'mainDefaultPositionCheckBox')
|
||||
self.mainPositionLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.mainDefaultPositionCheckBox)
|
||||
self.nainXLabel = QtGui.QLabel(self.mainPositionGroupBox)
|
||||
self.nainXLabel.setObjectName(u'nainXLabel')
|
||||
self.mainPositionLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.nainXLabel)
|
||||
self.mainXSpinBox = QtGui.QSpinBox(self.mainPositionGroupBox)
|
||||
self.mainXSpinBox.setEnabled(False)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.mainXSpinBox.sizePolicy().hasHeightForWidth())
|
||||
self.mainXSpinBox.setSizePolicy(sizePolicy)
|
||||
self.mainXSpinBox.setMinimumSize(QtCore.QSize(78, 0))
|
||||
self.mainXSpinBox.setMaximum(9999)
|
||||
self.mainXSpinBox.setProperty(u'value', 0)
|
||||
self.mainXSpinBox.setObjectName(u'mainXSpinBox')
|
||||
self.mainPositionLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.mainXSpinBox)
|
||||
self.mainYSpinBox = QtGui.QSpinBox(self.mainPositionGroupBox)
|
||||
self.mainYSpinBox.setEnabled(False)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.mainYSpinBox.sizePolicy().hasHeightForWidth())
|
||||
self.mainYSpinBox.setSizePolicy(sizePolicy)
|
||||
self.mainYSpinBox.setMinimumSize(QtCore.QSize(78, 0))
|
||||
self.mainYSpinBox.setMaximum(9999)
|
||||
self.mainYSpinBox.setObjectName(u'mainYSpinBox')
|
||||
self.mainPositionLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.mainYSpinBox)
|
||||
self.mainYLabel = QtGui.QLabel(self.mainPositionGroupBox)
|
||||
self.mainYLabel.setObjectName(u'mainYLabel')
|
||||
self.mainPositionLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.mainYLabel)
|
||||
self.mainWidthSpinBox = QtGui.QSpinBox(self.mainPositionGroupBox)
|
||||
self.mainWidthSpinBox.setEnabled(False)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.mainWidthSpinBox.sizePolicy().hasHeightForWidth())
|
||||
self.mainWidthSpinBox.setSizePolicy(sizePolicy)
|
||||
self.mainWidthSpinBox.setMinimumSize(QtCore.QSize(78, 0))
|
||||
self.mainWidthSpinBox.setMaximum(9999)
|
||||
self.mainWidthSpinBox.setObjectName(u'mainWidthSpinBox')
|
||||
self.mainPositionLayout.setWidget(3, QtGui.QFormLayout.FieldRole, self.mainWidthSpinBox)
|
||||
self.mainWidthLabel = QtGui.QLabel(self.mainPositionGroupBox)
|
||||
self.mainWidthLabel.setObjectName(u'mainWidthLabel')
|
||||
self.mainPositionLayout.setWidget(3, QtGui.QFormLayout.LabelRole, self.mainWidthLabel)
|
||||
self.mainHeightSpinBox = QtGui.QSpinBox(self.mainPositionGroupBox)
|
||||
self.mainHeightSpinBox.setEnabled(False)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.mainHeightSpinBox.sizePolicy().hasHeightForWidth())
|
||||
self.mainHeightSpinBox.setSizePolicy(sizePolicy)
|
||||
self.mainHeightSpinBox.setMinimumSize(QtCore.QSize(78, 0))
|
||||
self.mainHeightSpinBox.setMaximum(9999)
|
||||
self.mainHeightSpinBox.setObjectName(u'mainHeightSpinBox')
|
||||
self.mainPositionLayout.setWidget(4, QtGui.QFormLayout.FieldRole, self.mainHeightSpinBox)
|
||||
self.mainHeightLabel = QtGui.QLabel(self.mainPositionGroupBox)
|
||||
self.mainHeightLabel.setObjectName(u'mainHeightLabel')
|
||||
self.mainPositionLayout.setWidget(4, QtGui.QFormLayout.LabelRole, self.mainHeightLabel)
|
||||
self.gridLayout_2.addWidget(self.mainPositionGroupBox, 1, 0, 1, 1)
|
||||
self.footerPositionGroupBox = QtGui.QGroupBox(self.areaPositionPage)
|
||||
self.footerPositionGroupBox.setMinimumSize(QtCore.QSize(248, 0))
|
||||
self.footerPositionGroupBox.setObjectName(u'footerPositionGroupBox')
|
||||
self.footerPositionLayout = QtGui.QFormLayout(self.footerPositionGroupBox)
|
||||
self.footerPositionLayout.setMargin(8)
|
||||
self.footerPositionLayout.setSpacing(8)
|
||||
self.footerPositionLayout.setObjectName(u'footerPositionLayout')
|
||||
self.footerXLabel = QtGui.QLabel(self.footerPositionGroupBox)
|
||||
self.footerXLabel.setObjectName(u'footerXLabel')
|
||||
self.footerPositionLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.footerXLabel)
|
||||
self.footerXSpinBox = QtGui.QSpinBox(self.footerPositionGroupBox)
|
||||
self.footerXSpinBox.setEnabled(False)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.footerXSpinBox.sizePolicy().hasHeightForWidth())
|
||||
self.footerXSpinBox.setSizePolicy(sizePolicy)
|
||||
self.footerXSpinBox.setMinimumSize(QtCore.QSize(78, 0))
|
||||
self.footerXSpinBox.setMaximum(9999)
|
||||
self.footerXSpinBox.setProperty(u'value', 0)
|
||||
self.footerXSpinBox.setObjectName(u'footerXSpinBox')
|
||||
self.footerPositionLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.footerXSpinBox)
|
||||
self.footerYLabel = QtGui.QLabel(self.footerPositionGroupBox)
|
||||
self.footerYLabel.setObjectName(u'footerYLabel')
|
||||
self.footerPositionLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.footerYLabel)
|
||||
self.footerYSpinBox = QtGui.QSpinBox(self.footerPositionGroupBox)
|
||||
self.footerYSpinBox.setEnabled(False)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.footerYSpinBox.sizePolicy().hasHeightForWidth())
|
||||
self.footerYSpinBox.setSizePolicy(sizePolicy)
|
||||
self.footerYSpinBox.setMinimumSize(QtCore.QSize(78, 0))
|
||||
self.footerYSpinBox.setMaximum(9999)
|
||||
self.footerYSpinBox.setProperty(u'value', 0)
|
||||
self.footerYSpinBox.setObjectName(u'footerYSpinBox')
|
||||
self.footerPositionLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.footerYSpinBox)
|
||||
self.footerWidthLabel = QtGui.QLabel(self.footerPositionGroupBox)
|
||||
self.footerWidthLabel.setObjectName(u'footerWidthLabel')
|
||||
self.footerPositionLayout.setWidget(3, QtGui.QFormLayout.LabelRole, self.footerWidthLabel)
|
||||
self.footerWidthSpinBox = QtGui.QSpinBox(self.footerPositionGroupBox)
|
||||
self.footerWidthSpinBox.setEnabled(False)
|
||||
self.footerWidthSpinBox.setMinimumSize(QtCore.QSize(78, 0))
|
||||
self.footerWidthSpinBox.setMaximum(9999)
|
||||
self.footerWidthSpinBox.setObjectName(u'footerWidthSpinBox')
|
||||
self.footerPositionLayout.setWidget(3, QtGui.QFormLayout.FieldRole, self.footerWidthSpinBox)
|
||||
self.footerHeightLabel = QtGui.QLabel(self.footerPositionGroupBox)
|
||||
self.footerHeightLabel.setObjectName(u'footerHeightLabel')
|
||||
self.footerPositionLayout.setWidget(4, QtGui.QFormLayout.LabelRole, self.footerHeightLabel)
|
||||
self.footerHeightSpinBox = QtGui.QSpinBox(self.footerPositionGroupBox)
|
||||
self.footerHeightSpinBox.setEnabled(False)
|
||||
self.footerHeightSpinBox.setMinimumSize(QtCore.QSize(78, 0))
|
||||
self.footerHeightSpinBox.setMaximum(9999)
|
||||
self.footerHeightSpinBox.setObjectName(u'footerHeightSpinBox')
|
||||
self.footerPositionLayout.setWidget(4, QtGui.QFormLayout.FieldRole, self.footerHeightSpinBox)
|
||||
self.footerDefaultPositionCheckBox = QtGui.QCheckBox(self.footerPositionGroupBox)
|
||||
self.footerDefaultPositionCheckBox.setChecked(True)
|
||||
self.footerDefaultPositionCheckBox.setObjectName(u'footerDefaultPositionCheckBox')
|
||||
self.footerPositionLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.footerDefaultPositionCheckBox)
|
||||
self.gridLayout_2.addWidget(self.footerPositionGroupBox, 1, 1, 1, 1)
|
||||
ThemeWizard.addPage(self.areaPositionPage)
|
||||
self.previewPage = QtGui.QWizardPage()
|
||||
self.previewPage.setObjectName(u'previewPage')
|
||||
self.themeNameLabel = QtGui.QLabel(self.previewPage)
|
||||
self.themeNameLabel.setGeometry(QtCore.QRect(20, 10, 82, 16))
|
||||
self.themeNameLabel.setTextFormat(QtCore.Qt.PlainText)
|
||||
self.themeNameLabel.setObjectName(u'themeNameLabel')
|
||||
self.previewLabel = QtGui.QLabel(self.previewPage)
|
||||
self.previewLabel.setGeometry(QtCore.QRect(250, 60, 48, 16))
|
||||
self.previewLabel.setAlignment(QtCore.Qt.AlignCenter)
|
||||
self.previewLabel.setObjectName(u'previewLabel')
|
||||
self.themeNameEdit = QtGui.QLineEdit(self.previewPage)
|
||||
self.themeNameEdit.setGeometry(QtCore.QRect(117, 4, 351, 23))
|
||||
self.themeNameEdit.setObjectName(u'themeNameEdit')
|
||||
self.groupBox = QtGui.QGroupBox(self.previewPage)
|
||||
self.groupBox.setGeometry(QtCore.QRect(40, 80, 464, 214))
|
||||
self.groupBox.setTitle(u'')
|
||||
self.groupBox.setObjectName(u'groupBox')
|
||||
self.horizontalLayout = QtGui.QHBoxLayout(self.groupBox)
|
||||
self.horizontalLayout.setObjectName(u'horizontalLayout')
|
||||
spacerItem2 = QtGui.QSpacerItem(58, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
||||
self.horizontalLayout.addItem(spacerItem2)
|
||||
self.previewBoxLabel = QtGui.QLabel(self.groupBox)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.previewBoxLabel.sizePolicy().hasHeightForWidth())
|
||||
self.previewBoxLabel.setSizePolicy(sizePolicy)
|
||||
self.previewBoxLabel.setMinimumSize(QtCore.QSize(300, 200))
|
||||
self.previewBoxLabel.setFrameShape(QtGui.QFrame.WinPanel)
|
||||
self.previewBoxLabel.setFrameShadow(QtGui.QFrame.Sunken)
|
||||
self.previewBoxLabel.setLineWidth(1)
|
||||
self.previewBoxLabel.setText(u'')
|
||||
self.previewBoxLabel.setScaledContents(True)
|
||||
self.previewBoxLabel.setObjectName(u'previewBoxLabel')
|
||||
self.horizontalLayout.addWidget(self.previewBoxLabel)
|
||||
spacerItem3 = QtGui.QSpacerItem(78, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
||||
self.horizontalLayout.addItem(spacerItem3)
|
||||
ThemeWizard.addPage(self.previewPage)
|
||||
self.themeNameLabel.setBuddy(self.themeNameEdit)
|
||||
|
||||
self.retranslateUi(ThemeWizard)
|
||||
QtCore.QObject.connect(ThemeWizard, QtCore.SIGNAL(u'accepted()'), ThemeWizard.accept)
|
||||
QtCore.QMetaObject.connectSlotsByName(ThemeWizard)
|
||||
|
||||
def retranslateUi(self, ThemeWizard):
|
||||
ThemeWizard.setWindowTitle(translate('OpenLP.ThemeForm', 'Theme Wizard'))
|
||||
self.titleLabel.setText(translate('OpenLP.ThemeForm', '<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n'
|
||||
'<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n'
|
||||
'p, li { white-space: pre-wrap; }\n'
|
||||
'</style></head><body style=\" font-family:\'Sans Serif\'; font-size:9pt; font-weight:400; font-style:normal;\">\n'
|
||||
'<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:14pt; font-weight:600;\">Welcome to the Theme Wizard</span></p></body></html>'))
|
||||
self.informationLabel.setText(translate('OpenLP.ThemeForm', 'This wizard will help you to maintain Themes . Click the next button below to start the process by setting up your background.'))
|
||||
self.backgroundPage.setTitle(translate('OpenLP.ThemeForm', 'Set Up Background'))
|
||||
self.backgroundPage.setSubTitle(translate('OpenLP.ThemeForm', 'Set up your theme\'s background according to the parameters below.'))
|
||||
self.backgroundTypeLabel.setText(translate('OpenLP.ThemeForm', 'Background type:'))
|
||||
self.backgroundTypeComboBox.setItemText(0, translate('OpenLP.ThemeForm', 'Solid Color'))
|
||||
self.backgroundTypeComboBox.setItemText(1, translate('OpenLP.ThemeForm', 'Gradient'))
|
||||
self.backgroundTypeComboBox.setItemText(2, translate('OpenLP.ThemeForm', 'Image'))
|
||||
self.color1Label.setText(translate('OpenLP.ThemeForm', '<Color1>'))
|
||||
self.color2Label.setText(translate('OpenLP.ThemeForm', '<Color2>'))
|
||||
self.imageLabel.setText(translate('OpenLP.ThemeForm', 'Image:'))
|
||||
self.gradientLabel.setText(translate('OpenLP.ThemeForm', 'Gradient:'))
|
||||
self.gradientComboBox.setItemText(0, translate('OpenLP.ThemeForm', 'Horizontal'))
|
||||
self.gradientComboBox.setItemText(1, translate('OpenLP.ThemeForm', 'Vertical'))
|
||||
self.gradientComboBox.setItemText(2, translate('OpenLP.ThemeForm', 'Circular'))
|
||||
self.gradientComboBox.setItemText(3, translate('OpenLP.ThemeForm', 'Top Left - Bottom Right'))
|
||||
self.gradientComboBox.setItemText(4, translate('OpenLP.ThemeForm', 'Bottom Left - Top Right'))
|
||||
self.mainAreaPage.setTitle(translate('OpenLP.ThemeForm', 'Main Area Font Details'))
|
||||
self.mainAreaPage.setSubTitle(translate('OpenLP.ThemeForm', 'Define the font and display characteristics for the Display text'))
|
||||
self.mainFontLabel.setText(translate('OpenLP.ThemeForm', 'Font:'))
|
||||
self.mainColorLabel.setText(translate('OpenLP.ThemeForm', 'Color:'))
|
||||
self.mainSizeLabel.setText(translate('OpenLP.ThemeForm', 'Size:'))
|
||||
self.mainSizeSpinBox.setSuffix(translate('OpenLP.ThemeForm', 'pt'))
|
||||
self.mainLineCountLabel.setText(translate('OpenLP.ThemeForm', '(%d lines per slide)'))
|
||||
self.lineSpacingLabel.setText(translate('OpenLP.ThemeForm', 'Line Spacing:'))
|
||||
self.lineSpacingSpinBox.setSuffix(translate('OpenLP.ThemeForm', 'pt'))
|
||||
self.outlineCheckBox.setText(translate('OpenLP.ThemeForm', '&Outline:'))
|
||||
self.outlineSizeLabel.setText(translate('OpenLP.ThemeForm', 'Size:'))
|
||||
self.outlineSizeSpinBox.setSuffix(translate('OpenLP.ThemeForm', 'pt'))
|
||||
self.shadowCheckBox.setText(translate('OpenLP.ThemeForm', '&Shadow:'))
|
||||
self.shadowSizeLabel.setText(translate('OpenLP.ThemeForm', 'Size:'))
|
||||
self.shadowSizeSpinBox.setSuffix(translate('OpenLP.ThemeForm', 'pt'))
|
||||
self.boldCheckBox.setText(translate('OpenLP.ThemeForm', 'Bold Display'))
|
||||
self.italicsCheckBox.setText(translate('OpenLP.ThemeForm', 'Italic Display'))
|
||||
self.footerAreaPage.setTitle(translate('OpenLP.ThemeForm', 'Footer Area Font Details'))
|
||||
self.footerAreaPage.setSubTitle(translate('OpenLP.ThemeForm', 'Define the font and display characteristics for the Footer text'))
|
||||
self.footerFontLabel.setText(translate('OpenLP.ThemeForm', 'Font:'))
|
||||
self.footerColorLabel.setText(translate('OpenLP.ThemeForm', 'Color:'))
|
||||
self.footerSizeLabel.setText(translate('OpenLP.ThemeForm', 'Size:'))
|
||||
self.footerSizeSpinBox.setSuffix(translate('OpenLP.ThemeForm', 'pt'))
|
||||
self.alignmentPage.setTitle(translate('OpenLP.ThemeForm', 'Text Formatting Details'))
|
||||
self.alignmentPage.setSubTitle(translate('OpenLP.ThemeForm', 'Allows additional display formatting information to be defined'))
|
||||
self.horizontalLabel.setText(translate('OpenLP.ThemeForm', 'Horizontal Align:'))
|
||||
self.horizontalComboBox.setItemText(0, translate('OpenLP.ThemeForm', 'Left'))
|
||||
self.horizontalComboBox.setItemText(1, translate('OpenLP.ThemeForm', 'Right'))
|
||||
self.horizontalComboBox.setItemText(2, translate('OpenLP.ThemeForm', 'Center'))
|
||||
self.verticalLabel.setText(translate('OpenLP.ThemeForm', 'Vertcal Align:'))
|
||||
self.verticalComboBox.setItemText(0, translate('OpenLP.ThemeForm', 'Top'))
|
||||
self.verticalComboBox.setItemText(1, translate('OpenLP.ThemeForm', 'Middle'))
|
||||
self.verticalComboBox.setItemText(2, translate('OpenLP.ThemeForm', 'Bottom'))
|
||||
self.transitionsCheckBox.setText(translate('OpenLP.ThemeForm', 'Transitions'))
|
||||
self.areaPositionPage.setTitle(translate('OpenLP.ThemeForm', 'Output Area Locations'))
|
||||
self.areaPositionPage.setSubTitle(translate('OpenLP.ThemeForm', 'Allows you to change and move the Main and Footer areas.'))
|
||||
self.mainPositionGroupBox.setTitle(translate('OpenLP.ThemeForm', '&Main Area'))
|
||||
self.mainDefaultPositionCheckBox.setText(translate('OpenLP.ThemeForm', '&Use default location'))
|
||||
self.nainXLabel.setText(translate('OpenLP.ThemeForm', 'X position:'))
|
||||
self.mainXSpinBox.setSuffix(translate('OpenLP.ThemeForm', 'px'))
|
||||
self.mainYSpinBox.setSuffix(translate('OpenLP.ThemeForm', 'px'))
|
||||
self.mainYLabel.setText(translate('OpenLP.ThemeForm', 'Y position:'))
|
||||
self.mainWidthSpinBox.setSuffix(translate('OpenLP.ThemeForm', 'px'))
|
||||
self.mainWidthLabel.setText(translate('OpenLP.ThemeForm', 'Width:'))
|
||||
self.mainHeightSpinBox.setSuffix(translate('OpenLP.ThemeForm', 'px'))
|
||||
self.mainHeightLabel.setText(translate('OpenLP.ThemeForm', 'Height:'))
|
||||
self.footerPositionGroupBox.setTitle(translate('OpenLP.ThemeForm', 'Footer Area'))
|
||||
self.footerXLabel.setText(translate('OpenLP.ThemeForm', 'X position:'))
|
||||
self.footerXSpinBox.setSuffix(translate('OpenLP.ThemeForm', 'px'))
|
||||
self.footerYLabel.setText(translate('OpenLP.ThemeForm', 'Y position:'))
|
||||
self.footerYSpinBox.setSuffix(translate('OpenLP.ThemeForm', 'px'))
|
||||
self.footerWidthLabel.setText(translate('OpenLP.ThemeForm', 'Width:'))
|
||||
self.footerWidthSpinBox.setSuffix(translate('OpenLP.ThemeForm', 'px'))
|
||||
self.footerHeightLabel.setText(translate('OpenLP.ThemeForm', 'Height:'))
|
||||
self.footerHeightSpinBox.setSuffix(translate('OpenLP.ThemeForm', 'px'))
|
||||
self.footerDefaultPositionCheckBox.setText(translate('OpenLP.ThemeForm', 'Use default location'))
|
||||
self.previewPage.setTitle(translate('OpenLP.ThemeForm', 'Save and Preview'))
|
||||
self.previewPage.setSubTitle(translate('OpenLP.ThemeForm', 'View the theme and save it replacing the current one or change the name to create a new theme'))
|
||||
self.themeNameLabel.setText(translate('OpenLP.ThemeForm', 'Theme name:'))
|
||||
self.previewLabel.setText(translate('OpenLP.ThemeForm', 'Preview'))
|
|
@ -276,6 +276,7 @@ def get_images_filter():
|
|||
return images_filter
|
||||
|
||||
from languagemanager import LanguageManager
|
||||
from actions import ActionList
|
||||
|
||||
__all__ = [u'AppLocation', u'check_latest_version', u'add_actions',
|
||||
u'get_filesystem_encoding', u'LanguageManager']
|
||||
u'get_filesystem_encoding', u'LanguageManager', u'ActionList']
|
||||
|
|
|
@ -0,0 +1,184 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
# --------------------------------------------------------------------------- #
|
||||
# Copyright (c) 2008-2010 Raoul Snyman #
|
||||
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
|
||||
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
|
||||
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
|
||||
# Carsten Tinggaard, Frode Woldsund #
|
||||
# --------------------------------------------------------------------------- #
|
||||
# This program is free software; you can redistribute it and/or modify it #
|
||||
# under the terms of the GNU General Public License as published by the Free #
|
||||
# Software Foundation; version 2 of the License. #
|
||||
# #
|
||||
# This program is distributed in the hope that it will be useful, but WITHOUT #
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
|
||||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
|
||||
# more details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU General Public License along #
|
||||
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
|
||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||
###############################################################################
|
||||
"""
|
||||
The :mod:`~openlp.core.utils.actions` module provides action list classes used
|
||||
by the shortcuts system.
|
||||
"""
|
||||
|
||||
class ActionCategory(object):
|
||||
"""
|
||||
The :class:`~openlp.core.utils.ActionCategory` class encapsulates a
|
||||
category for the :class:`~openlp.core.utils.CategoryList` class.
|
||||
"""
|
||||
def __init__(self, name, weight=0):
|
||||
self.name = name
|
||||
self.weight = weight
|
||||
self.actions = CategoryActionList()
|
||||
|
||||
|
||||
class CategoryActionList(object):
|
||||
"""
|
||||
The :class:`~openlp.core.utils.CategoryActionList` class provides a sorted
|
||||
list of actions within a category.
|
||||
"""
|
||||
def __init__(self):
|
||||
self.index = 0
|
||||
self.actions = []
|
||||
|
||||
def __getitem__(self, key):
|
||||
for weight, action in self.actions:
|
||||
if action.text() == key:
|
||||
return action
|
||||
raise KeyError(u'Action "%s" does not exist.' % key)
|
||||
|
||||
def __contains__(self, item):
|
||||
return self.has_key(item)
|
||||
|
||||
def __len__(self):
|
||||
return len(self.actions)
|
||||
|
||||
def __iter__(self):
|
||||
return self
|
||||
|
||||
def __next__(self):
|
||||
"""
|
||||
Python 3 "next" method.
|
||||
"""
|
||||
if self.index >= len(self.actions):
|
||||
raise StopIteration
|
||||
else:
|
||||
self.index += 1
|
||||
return self.actions[self.index - 1][1]
|
||||
|
||||
def next(self):
|
||||
"""
|
||||
Python 2 "next" method.
|
||||
"""
|
||||
return self.__next__()
|
||||
|
||||
def has_key(self, key):
|
||||
for weight, action in self.actions:
|
||||
if action.text() == key:
|
||||
return True
|
||||
return False
|
||||
|
||||
def append(self, name):
|
||||
weight = 0
|
||||
if len(self.actions) > 0:
|
||||
weight = self.actions[-1][0] + 1
|
||||
self.add(name, weight)
|
||||
|
||||
def add(self, action, weight=0):
|
||||
self.actions.append((weight, action))
|
||||
self.actions.sort(key=lambda act: act[0])
|
||||
|
||||
|
||||
class CategoryList(object):
|
||||
"""
|
||||
The :class:`~openlp.core.utils.CategoryList` class encapsulates a category
|
||||
list for the :class:`~openlp.core.utils.ActionList` class and provides an
|
||||
iterator interface for walking through the list of actions in this category.
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
self.index = 0
|
||||
self.categories = []
|
||||
|
||||
def __getitem__(self, key):
|
||||
for category in self.categories:
|
||||
if category.name == key:
|
||||
return category
|
||||
raise KeyError(u'Category "%s" does not exist.' % key)
|
||||
|
||||
def __contains__(self, item):
|
||||
return self.has_key(item)
|
||||
|
||||
def __len__(self):
|
||||
return len(self.categories)
|
||||
|
||||
def __iter__(self):
|
||||
return self
|
||||
|
||||
def __next__(self):
|
||||
"""
|
||||
Python 3 "next" method for iterator.
|
||||
"""
|
||||
if self.index >= len(self.categories):
|
||||
raise StopIteration
|
||||
else:
|
||||
self.index += 1
|
||||
return self.categories[self.index - 1]
|
||||
|
||||
def next(self):
|
||||
"""
|
||||
Python 2 "next" method for iterator.
|
||||
"""
|
||||
return self.__next__()
|
||||
|
||||
def has_key(self, key):
|
||||
for category in self.categories:
|
||||
if category.name == key:
|
||||
return True
|
||||
return False
|
||||
|
||||
def append(self, name, actions=None):
|
||||
weight = 0
|
||||
if len(self.categories) > 0:
|
||||
weight = self.categories[-1].weight + 1
|
||||
if actions:
|
||||
self.add(name, weight, actions)
|
||||
else:
|
||||
self.add(name, weight)
|
||||
|
||||
def add(self, name, weight=0, actions=None):
|
||||
category = ActionCategory(name, weight)
|
||||
if actions:
|
||||
for action in actions:
|
||||
if isinstance(action, tuple):
|
||||
category.actions.add(action[0], action[1])
|
||||
else:
|
||||
category.actions.append(action)
|
||||
self.categories.append(category)
|
||||
self.categories.sort(key=lambda cat: cat.weight)
|
||||
|
||||
|
||||
class ActionList(object):
|
||||
"""
|
||||
The :class:`~openlp.core.utils.ActionList` class contains a list of menu
|
||||
actions and categories associated with those actions. Each category also
|
||||
has a weight by which it is sorted when iterating through the list of
|
||||
actions or categories.
|
||||
"""
|
||||
def __init__(self):
|
||||
self.categories = CategoryList()
|
||||
|
||||
def add_action(self, action, category=u'Default', weight=None):
|
||||
if category not in self.categories:
|
||||
self.categories.append(category)
|
||||
if weight is None:
|
||||
self.categories[category].actions.append(action)
|
||||
else:
|
||||
self.categories[category].actions.add(action, weight)
|
|
@ -28,7 +28,6 @@ The :mod:`languagemanager` module provides all the translation settings and
|
|||
language file loading for OpenLP.
|
||||
"""
|
||||
import logging
|
||||
import os
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
|
|
|
@ -45,13 +45,15 @@ class AlertsPlugin(Plugin):
|
|||
self.icon = build_icon(u':/plugins/plugin_alerts.png')
|
||||
self.alertsmanager = AlertsManager(self)
|
||||
self.manager = Manager(u'alerts', init_schema)
|
||||
self.alertForm = AlertForm(self)
|
||||
visible_name = self.getString(StringContent.VisibleName)
|
||||
self.alertForm = AlertForm(self, visible_name[u'title'])
|
||||
|
||||
def getSettingsTab(self):
|
||||
"""
|
||||
Return the settings tab for the Alerts plugin
|
||||
"""
|
||||
self.alertsTab = AlertsTab(self)
|
||||
visible_name = self.getString(StringContent.VisibleName)
|
||||
self.alertsTab = AlertsTab(self, visible_name[u'title'])
|
||||
return self.alertsTab
|
||||
|
||||
def addToolsMenuItem(self, tools_menu):
|
||||
|
@ -83,7 +85,11 @@ class AlertsPlugin(Plugin):
|
|||
self.liveController.alertTab = self.alertsTab
|
||||
|
||||
def finalise(self):
|
||||
"""
|
||||
Tidy up on exit
|
||||
"""
|
||||
log.info(u'Alerts Finalising')
|
||||
self.manager.finalise()
|
||||
Plugin.finalise(self)
|
||||
self.toolsAlertItem.setVisible(False)
|
||||
|
||||
|
@ -115,4 +121,3 @@ class AlertsPlugin(Plugin):
|
|||
self.textStrings[StringContent.VisibleName] = {
|
||||
u'title': translate('AlertsPlugin', 'Alerts')
|
||||
}
|
||||
|
|
@ -35,7 +35,7 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
|
|||
"""
|
||||
Provide UI for the alert system
|
||||
"""
|
||||
def __init__(self, title, visible_title):
|
||||
def __init__(self, plugin, visible_title):
|
||||
"""
|
||||
Initialise the alert form
|
||||
"""
|
||||
|
|
|
@ -24,6 +24,6 @@
|
|||
# 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.
|
||||
"""
|
||||
|
|
|
@ -52,7 +52,11 @@ class BiblePlugin(Plugin):
|
|||
self.exportBibleItem.setVisible(True)
|
||||
|
||||
def finalise(self):
|
||||
"""
|
||||
Tidy up on exit
|
||||
"""
|
||||
log.info(u'Plugin Finalise')
|
||||
self.manager.finalise()
|
||||
Plugin.finalise(self)
|
||||
self.importBibleItem.setVisible(False)
|
||||
self.exportBibleItem.setVisible(False)
|
||||
|
@ -133,42 +137,42 @@ class BiblePlugin(Plugin):
|
|||
## Import Button ##
|
||||
self.textStrings[StringContent.Import] = {
|
||||
u'title': translate('BiblesPlugin', 'Import'),
|
||||
u'tooltip': translate('BiblesPlugin',
|
||||
u'tooltip': translate('BiblesPlugin',
|
||||
'Import a Bible')
|
||||
}
|
||||
## New Button ##
|
||||
self.textStrings[StringContent.New] = {
|
||||
u'title': translate('BiblesPlugin', 'Add'),
|
||||
u'tooltip': translate('BiblesPlugin',
|
||||
u'tooltip': translate('BiblesPlugin',
|
||||
'Add a new Bible')
|
||||
}
|
||||
## Edit Button ##
|
||||
self.textStrings[StringContent.Edit] = {
|
||||
u'title': translate('BiblesPlugin', 'Edit'),
|
||||
u'tooltip': translate('BiblesPlugin',
|
||||
u'tooltip': translate('BiblesPlugin',
|
||||
'Edit the selected Bible')
|
||||
}
|
||||
## Delete Button ##
|
||||
self.textStrings[StringContent.Delete] = {
|
||||
u'title': translate('BiblesPlugin', 'Delete'),
|
||||
u'tooltip': translate('BiblesPlugin',
|
||||
u'tooltip': translate('BiblesPlugin',
|
||||
'Delete the selected Bible')
|
||||
}
|
||||
## Preview ##
|
||||
self.textStrings[StringContent.Preview] = {
|
||||
u'title': translate('BiblesPlugin', 'Preview'),
|
||||
u'tooltip': translate('BiblesPlugin',
|
||||
u'tooltip': translate('BiblesPlugin',
|
||||
'Preview the selected Bible')
|
||||
}
|
||||
## Live Button ##
|
||||
self.textStrings[StringContent.Live] = {
|
||||
u'title': translate('BiblesPlugin', 'Live'),
|
||||
u'tooltip': translate('BiblesPlugin',
|
||||
u'tooltip': translate('BiblesPlugin',
|
||||
'Send the selected Bible live')
|
||||
}
|
||||
## Add to service Button ##
|
||||
self.textStrings[StringContent.Service] = {
|
||||
u'title': translate('BiblesPlugin', 'Service'),
|
||||
u'tooltip': translate('BiblesPlugin',
|
||||
u'tooltip': translate('BiblesPlugin',
|
||||
'Add the selected Bible to the service')
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,6 +24,33 @@
|
|||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||
###############################################################################
|
||||
|
||||
from importwizardform import ImportWizardForm
|
||||
"""
|
||||
Forms in OpenLP are made up of two classes. One class holds all the graphical
|
||||
elements, like buttons and lists, and the other class holds all the functional
|
||||
code, like slots and loading and saving.
|
||||
|
||||
__all__ = ['ImportWizardForm']
|
||||
The first class, commonly known as the **Dialog** class, is typically named
|
||||
``Ui_<name>Dialog``. It is a slightly modified version of the class that the
|
||||
``pyuic4`` command produces from Qt4's .ui file. Typical modifications will be
|
||||
converting most strings from "" to u'' and using OpenLP's ``translate()``
|
||||
function for translating strings.
|
||||
|
||||
The second class, commonly known as the **Form** class, is typically named
|
||||
``<name>Form``. This class is the one which is instantiated and used. It uses
|
||||
dual inheritance to inherit from (usually) QtGui.QDialog and the Ui class
|
||||
mentioned above, like so::
|
||||
|
||||
class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard):
|
||||
|
||||
def __init__(self, parent, manager, bibleplugin):
|
||||
QtGui.QWizard.__init__(self, parent)
|
||||
self.setupUi(self)
|
||||
|
||||
This allows OpenLP to use ``self.object`` for all the GUI elements while keeping
|
||||
them separate from the functionality, so that it is easier to recreate the GUI
|
||||
from the .ui files later if necessary.
|
||||
"""
|
||||
|
||||
from bibleimportform import BibleImportForm
|
||||
|
||||
__all__ = ['BibleImportForm']
|
||||
|
|
|
@ -54,7 +54,7 @@ class WebDownload(object):
|
|||
return cls.Names[name]
|
||||
|
||||
|
||||
class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard):
|
||||
class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard):
|
||||
"""
|
||||
This is the Bible Import Wizard, which allows easy importing of Bibles
|
||||
into OpenLP from other formats like OSIS, CSV and OpenSong.
|
|
@ -60,22 +60,32 @@ def parse_reference(reference):
|
|||
and converts it to a reference list, a list of references to be queried
|
||||
from the Bible database files.
|
||||
|
||||
BIBLE_REFERENCE regular expression produces the following match groups:
|
||||
0 This is a special group consisting of the whole string that matched.
|
||||
1 [\w ]+ The book the reference is from.
|
||||
2 [0-9]+ The first (or only) chapter in the reference.
|
||||
3 None|[0-9]+ None or the only verse or the first verse in a
|
||||
verse range or the start verse in a chapter range.
|
||||
4 None|[0-9]+|end None or the end verse of the first verse range or
|
||||
the end chapter of a chapter range.
|
||||
5 None|[0-9]+ None or the second chapter in multiple
|
||||
(non-ranged) chapters.
|
||||
6 None|[0-9]+|end None, the start of the second verse range or the
|
||||
end of a chapter range.
|
||||
7 None|[0-9]+|end None or the end of the second verse range.
|
||||
The ``BIBLE_REFERENCE`` constant regular expression produces the following
|
||||
match groups:
|
||||
|
||||
0. (match string)
|
||||
This is a special group consisting of the whole string that matched.
|
||||
1. ``[\w ]+``
|
||||
The book the reference is from.
|
||||
2. ``[0-9]+``
|
||||
The first (or only) chapter in the reference.
|
||||
3. ``None`` or ``[0-9]+``
|
||||
``None``, or the only verse, or the first verse in a verse range or,
|
||||
the start verse in a chapter 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
|
||||
this::
|
||||
|
||||
(book, chapter, start_verse, end_verse)
|
||||
|
||||
``reference``
|
||||
|
@ -154,7 +164,7 @@ def parse_reference(reference):
|
|||
|
||||
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):
|
||||
"""
|
||||
|
|
|
@ -36,7 +36,7 @@ from BeautifulSoup import BeautifulSoup, NavigableString
|
|||
|
||||
from openlp.core.lib import Receiver
|
||||
from openlp.core.utils import AppLocation
|
||||
from openlp.plugins.bibles.lib import SearchResults
|
||||
from openlp.plugins.bibles.lib import SearchResults
|
||||
from openlp.plugins.bibles.lib.db import BibleDB, Book
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
@ -213,7 +213,7 @@ class BGExtract(object):
|
|||
finally:
|
||||
if not page:
|
||||
return None
|
||||
cleaner = [(re.compile(' |<br />'), lambda match: '')]
|
||||
cleaner = [(re.compile(' |<br />|\'\+\''), lambda match: '')]
|
||||
soup = None
|
||||
try:
|
||||
soup = BeautifulSoup(page, markupMassage=cleaner)
|
||||
|
|
|
@ -310,3 +310,11 @@ class BibleManager(object):
|
|||
if bible == name:
|
||||
return True
|
||||
return False
|
||||
|
||||
def finalise(self):
|
||||
"""
|
||||
Loop through the databases to VACUUM them.
|
||||
"""
|
||||
for bible in self.db_cache:
|
||||
self.db_cache[bible].finalise()
|
||||
|
||||
|
|
|
@ -31,8 +31,7 @@ from PyQt4 import QtCore, QtGui
|
|||
|
||||
from openlp.core.lib import MediaManagerItem, Receiver, BaseListWithDnD, \
|
||||
ItemCapabilities, translate
|
||||
from openlp.plugins.bibles.forms import ImportWizardForm
|
||||
from openlp.plugins.bibles.lib.db import BibleDB
|
||||
from openlp.plugins.bibles.forms import BibleImportForm
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
@ -362,7 +361,7 @@ class BibleMediaItem(MediaManagerItem):
|
|||
|
||||
def onImportClick(self):
|
||||
if not hasattr(self, u'import_wizard'):
|
||||
self.import_wizard = ImportWizardForm(self, self.parent.manager,
|
||||
self.import_wizard = BibleImportForm(self, self.parent.manager,
|
||||
self.parent)
|
||||
self.import_wizard.exec_()
|
||||
self.reloadBibles()
|
||||
|
|
|
@ -6,8 +6,8 @@ Deut,Deuteronomy,Deut
|
|||
Josh,Joshua,Josh
|
||||
Judg,Judges,Judg
|
||||
Ruth,Ruth,Ruth
|
||||
1Sam,1 Samual,1Sam
|
||||
2Sam,2 Samual,2Sam
|
||||
1Sam,1 Samuel,1Sam
|
||||
2Sam,2 Samuel,2Sam
|
||||
1Kgs,1 Kings,1Kgs
|
||||
2Kgs,2 Kings,2Kgs
|
||||
1Chr,1 Chronicles,1Chr
|
||||
|
|
|
|
@ -49,8 +49,8 @@ class CustomPlugin(Plugin):
|
|||
def __init__(self, plugin_helpers):
|
||||
Plugin.__init__(self, u'Custom', u'1.9.3', plugin_helpers)
|
||||
self.weight = -5
|
||||
self.custommanager = Manager(u'custom', init_schema)
|
||||
self.edit_custom_form = EditCustomForm(self.custommanager)
|
||||
self.manager = Manager(u'custom', init_schema)
|
||||
self.edit_custom_form = EditCustomForm(self.manager)
|
||||
self.icon_path = u':/plugins/plugin_custom.png'
|
||||
self.icon = build_icon(self.icon_path)
|
||||
|
||||
|
@ -59,7 +59,7 @@ class CustomPlugin(Plugin):
|
|||
return CustomTab(self.name, visible_name[u'title'])
|
||||
|
||||
def getMediaManagerItem(self):
|
||||
# Create the CustomManagerItem object
|
||||
# Create the ManagerItem object
|
||||
return CustomMediaItem(self, self, self.icon)
|
||||
|
||||
def about(self):
|
||||
|
@ -76,7 +76,7 @@ class CustomPlugin(Plugin):
|
|||
|
||||
Returns True if the theme is being used, otherwise returns False.
|
||||
"""
|
||||
if self.custommanager.get_all_objects(CustomSlide,
|
||||
if self.manager.get_all_objects(CustomSlide,
|
||||
CustomSlide.theme_name == theme):
|
||||
return True
|
||||
return False
|
||||
|
@ -92,11 +92,11 @@ class CustomPlugin(Plugin):
|
|||
``newTheme``
|
||||
The new name the plugin should now use.
|
||||
"""
|
||||
customsUsingTheme = self.custommanager.get_all_objects(CustomSlide,
|
||||
customsUsingTheme = self.manager.get_all_objects(CustomSlide,
|
||||
CustomSlide.theme_name == oldTheme)
|
||||
for custom in customsUsingTheme:
|
||||
custom.theme_name = newTheme
|
||||
self.custommanager.save_object(custom)
|
||||
self.manager.save_object(custom)
|
||||
|
||||
def setPluginTextStrings(self):
|
||||
"""
|
||||
|
@ -115,48 +115,56 @@ class CustomPlugin(Plugin):
|
|||
## Import Button ##
|
||||
self.textStrings[StringContent.Import] = {
|
||||
u'title': translate('CustomsPlugin', 'Import'),
|
||||
u'tooltip': translate('CustomsPlugin',
|
||||
u'tooltip': translate('CustomsPlugin',
|
||||
'Import a Custom')
|
||||
}
|
||||
## Load Button ##
|
||||
self.textStrings[StringContent.Load] = {
|
||||
u'title': translate('CustomsPlugin', 'Load'),
|
||||
u'tooltip': translate('CustomsPlugin',
|
||||
u'tooltip': translate('CustomsPlugin',
|
||||
'Load a new Custom')
|
||||
}
|
||||
## New Button ##
|
||||
self.textStrings[StringContent.New] = {
|
||||
u'title': translate('CustomsPlugin', 'Add'),
|
||||
u'tooltip': translate('CustomsPlugin',
|
||||
u'tooltip': translate('CustomsPlugin',
|
||||
'Add a new Custom')
|
||||
}
|
||||
## Edit Button ##
|
||||
self.textStrings[StringContent.Edit] = {
|
||||
u'title': translate('CustomsPlugin', 'Edit'),
|
||||
u'tooltip': translate('CustomsPlugin',
|
||||
u'tooltip': translate('CustomsPlugin',
|
||||
'Edit the selected Custom')
|
||||
}
|
||||
## Delete Button ##
|
||||
self.textStrings[StringContent.Delete] = {
|
||||
u'title': translate('CustomsPlugin', 'Delete'),
|
||||
u'tooltip': translate('CustomsPlugin',
|
||||
u'tooltip': translate('CustomsPlugin',
|
||||
'Delete the selected Custom')
|
||||
}
|
||||
## Preview ##
|
||||
self.textStrings[StringContent.Preview] = {
|
||||
u'title': translate('CustomsPlugin', 'Preview'),
|
||||
u'tooltip': translate('CustomsPlugin',
|
||||
u'tooltip': translate('CustomsPlugin',
|
||||
'Preview the selected Custom')
|
||||
}
|
||||
## Live Button ##
|
||||
self.textStrings[StringContent.Live] = {
|
||||
u'title': translate('CustomsPlugin', 'Live'),
|
||||
u'tooltip': translate('CustomsPlugin',
|
||||
u'tooltip': translate('CustomsPlugin',
|
||||
'Send the selected Custom live')
|
||||
}
|
||||
## Add to service Button ##
|
||||
self.textStrings[StringContent.Service] = {
|
||||
u'title': translate('CustomsPlugin', 'Service'),
|
||||
u'tooltip': translate('CustomsPlugin',
|
||||
u'tooltip': translate('CustomsPlugin',
|
||||
'Add the selected Custom to the service')
|
||||
}
|
||||
}
|
||||
|
||||
def finalise(self):
|
||||
"""
|
||||
Time to tidy up on exit
|
||||
"""
|
||||
log.info(u'Custom Finalising')
|
||||
self.manager.finalise()
|
||||
Plugin.finalise(self)
|
||||
|
|
|
@ -25,3 +25,4 @@
|
|||
###############################################################################
|
||||
|
||||
from editcustomform import EditCustomForm
|
||||
from editcustomslideform import EditCustomSlideForm
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import build_icon, translate, SpellTextEdit
|
||||
from openlp.core.lib import build_icon, translate
|
||||
|
||||
class Ui_CustomEditDialog(object):
|
||||
def setupUi(self, customEditDialog):
|
||||
|
@ -36,6 +36,70 @@ class Ui_CustomEditDialog(object):
|
|||
build_icon(u':/icon/openlp.org-icon-32.bmp'))
|
||||
self.gridLayout = QtGui.QGridLayout(customEditDialog)
|
||||
self.gridLayout.setObjectName(u'gridLayout')
|
||||
self.horizontalLayout3 = QtGui.QHBoxLayout()
|
||||
self.horizontalLayout3.setObjectName(u'horizontalLayout3')
|
||||
self.themeLabel = QtGui.QLabel(customEditDialog)
|
||||
self.themeLabel.setObjectName(u'themeLabel')
|
||||
self.horizontalLayout3.addWidget(self.themeLabel)
|
||||
self.themeComboBox = QtGui.QComboBox(customEditDialog)
|
||||
self.themeLabel.setBuddy(self.themeComboBox)
|
||||
self.themeComboBox.setObjectName(u'themeComboBox')
|
||||
self.horizontalLayout3.addWidget(self.themeComboBox)
|
||||
self.gridLayout.addLayout(self.horizontalLayout3, 2, 0, 1, 1)
|
||||
self.horizontalLayout2 = QtGui.QHBoxLayout()
|
||||
self.horizontalLayout2.setObjectName(u'horizontalLayout2')
|
||||
self.creditLabel = QtGui.QLabel(customEditDialog)
|
||||
self.creditLabel.setObjectName(u'creditLabel')
|
||||
self.horizontalLayout2.addWidget(self.creditLabel)
|
||||
self.creditEdit = QtGui.QLineEdit(customEditDialog)
|
||||
self.creditLabel.setBuddy(self.creditEdit)
|
||||
self.creditEdit.setObjectName(u'creditEdit')
|
||||
self.horizontalLayout2.addWidget(self.creditEdit)
|
||||
self.gridLayout.addLayout(self.horizontalLayout2, 3, 0, 1, 1)
|
||||
self.buttonBox = QtGui.QDialogButtonBox(customEditDialog)
|
||||
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel |
|
||||
QtGui.QDialogButtonBox.Save)
|
||||
self.buttonBox.setObjectName(u'buttonBox')
|
||||
self.gridLayout.addWidget(self.buttonBox, 4, 0, 1, 1)
|
||||
self.horizontalLayout4 = QtGui.QHBoxLayout()
|
||||
self.horizontalLayout4.setObjectName(u'horizontalLayout4')
|
||||
self.slideListView = QtGui.QListWidget(customEditDialog)
|
||||
self.slideListView.setAlternatingRowColors(True)
|
||||
self.slideListView.setObjectName(u'slideListView')
|
||||
self.horizontalLayout4.addWidget(self.slideListView)
|
||||
self.verticalLayout = QtGui.QVBoxLayout()
|
||||
self.verticalLayout.setObjectName(u'verticalLayout')
|
||||
self.addButton = QtGui.QPushButton(customEditDialog)
|
||||
self.addButton.setObjectName(u'addButton')
|
||||
self.verticalLayout.addWidget(self.addButton)
|
||||
self.editButton = QtGui.QPushButton(customEditDialog)
|
||||
self.editButton.setObjectName(u'editButton')
|
||||
self.verticalLayout.addWidget(self.editButton)
|
||||
self.editAllButton = QtGui.QPushButton(customEditDialog)
|
||||
self.editAllButton.setObjectName(u'editAllButton')
|
||||
self.verticalLayout.addWidget(self.editAllButton)
|
||||
self.deleteButton = QtGui.QPushButton(customEditDialog)
|
||||
self.deleteButton.setObjectName(u'deleteButton')
|
||||
self.verticalLayout.addWidget(self.deleteButton)
|
||||
spacerItem = QtGui.QSpacerItem(20, 128, QtGui.QSizePolicy.Minimum,
|
||||
QtGui.QSizePolicy.Expanding)
|
||||
self.verticalLayout.addItem(spacerItem)
|
||||
self.upButton = QtGui.QPushButton(customEditDialog)
|
||||
icon1 = QtGui.QIcon()
|
||||
icon1.addPixmap(QtGui.QPixmap(u':/services/service_up.png'),
|
||||
QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
self.upButton.setIcon(icon1)
|
||||
self.upButton.setObjectName(u'upButton')
|
||||
self.verticalLayout.addWidget(self.upButton)
|
||||
self.downButton = QtGui.QPushButton(customEditDialog)
|
||||
icon2 = QtGui.QIcon()
|
||||
icon2.addPixmap(QtGui.QPixmap(u':/services/service_down.png'),
|
||||
QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
self.downButton.setIcon(icon2)
|
||||
self.downButton.setObjectName(u'downButton')
|
||||
self.verticalLayout.addWidget(self.downButton)
|
||||
self.horizontalLayout4.addLayout(self.verticalLayout)
|
||||
self.gridLayout.addLayout(self.horizontalLayout4, 1, 0, 1, 1)
|
||||
self.horizontalLayout = QtGui.QHBoxLayout()
|
||||
self.horizontalLayout.setObjectName(u'horizontalLayout')
|
||||
self.titleLabel = QtGui.QLabel(customEditDialog)
|
||||
|
@ -46,91 +110,7 @@ class Ui_CustomEditDialog(object):
|
|||
self.titleEdit.setObjectName(u'titleEdit')
|
||||
self.horizontalLayout.addWidget(self.titleEdit)
|
||||
self.gridLayout.addLayout(self.horizontalLayout, 0, 0, 1, 1)
|
||||
self.horizontalLayout4 = QtGui.QHBoxLayout()
|
||||
self.horizontalLayout4.setObjectName(u'horizontalLayout4')
|
||||
self.verseListView = QtGui.QListWidget(customEditDialog)
|
||||
self.verseListView.setAlternatingRowColors(True)
|
||||
self.verseListView.setObjectName(u'verseListView')
|
||||
self.horizontalLayout4.addWidget(self.verseListView)
|
||||
self.verticalLayout = QtGui.QVBoxLayout()
|
||||
self.verticalLayout.setObjectName(u'verticalLayout')
|
||||
self.upButton = QtGui.QPushButton(customEditDialog)
|
||||
self.upButton.setIcon(build_icon(u':/services/service_up.png'))
|
||||
self.upButton.setObjectName(u'upButton')
|
||||
self.verticalLayout.addWidget(self.upButton)
|
||||
spacerItem = QtGui.QSpacerItem(20, 128, QtGui.QSizePolicy.Minimum,
|
||||
QtGui.QSizePolicy.Expanding)
|
||||
self.verticalLayout.addItem(spacerItem)
|
||||
self.downButton = QtGui.QPushButton(customEditDialog)
|
||||
self.downButton.setIcon(build_icon(u':/services/service_down.png'))
|
||||
self.downButton.setObjectName(u'downButton')
|
||||
self.verticalLayout.addWidget(self.downButton)
|
||||
self.horizontalLayout4.addLayout(self.verticalLayout)
|
||||
self.gridLayout.addLayout(self.horizontalLayout4, 1, 0, 1, 1)
|
||||
self.editWidget = QtGui.QWidget(customEditDialog)
|
||||
self.editWidget.setObjectName(u'editWidget')
|
||||
self.editLayout3 = QtGui.QHBoxLayout(self.editWidget)
|
||||
self.editLayout3.setSpacing(8)
|
||||
self.editLayout3.setMargin(0)
|
||||
self.editLayout3.setObjectName(u'editLayout3')
|
||||
self.verseTextEdit = SpellTextEdit(self)
|
||||
self.verseTextEdit.setObjectName(u'verseTextEdit')
|
||||
self.editLayout3.addWidget(self.verseTextEdit)
|
||||
self.buttonWidget = QtGui.QWidget(self.editWidget)
|
||||
self.buttonWidget.setObjectName(u'buttonWidget')
|
||||
self.verticalLayout2 = QtGui.QVBoxLayout(self.buttonWidget)
|
||||
self.verticalLayout2.setObjectName(u'verticalLayout2')
|
||||
self.addButton = QtGui.QPushButton(self.buttonWidget)
|
||||
self.addButton.setObjectName(u'addButton')
|
||||
self.verticalLayout2.addWidget(self.addButton)
|
||||
self.editButton = QtGui.QPushButton(self.buttonWidget)
|
||||
self.editButton.setObjectName(u'editButton')
|
||||
self.verticalLayout2.addWidget(self.editButton)
|
||||
self.editAllButton = QtGui.QPushButton(self.buttonWidget)
|
||||
self.editAllButton.setObjectName(u'editAllButton')
|
||||
self.verticalLayout2.addWidget(self.editAllButton)
|
||||
self.saveButton = QtGui.QPushButton(self.buttonWidget)
|
||||
self.saveButton.setObjectName(u'saveButton')
|
||||
self.verticalLayout2.addWidget(self.saveButton)
|
||||
self.deleteButton = QtGui.QPushButton(self.buttonWidget)
|
||||
self.deleteButton.setObjectName(u'deleteButton')
|
||||
self.verticalLayout2.addWidget(self.deleteButton)
|
||||
self.clearButton = QtGui.QPushButton(self.buttonWidget)
|
||||
self.clearButton.setObjectName(u'clearButton')
|
||||
self.verticalLayout2.addWidget(self.clearButton)
|
||||
self.splitButton = QtGui.QPushButton(self.buttonWidget)
|
||||
self.splitButton.setObjectName(u'splitButton')
|
||||
self.verticalLayout2.addWidget(self.splitButton)
|
||||
spacerItem1 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum,
|
||||
QtGui.QSizePolicy.Expanding)
|
||||
self.verticalLayout2.addItem(spacerItem1)
|
||||
self.editLayout3.addWidget(self.buttonWidget)
|
||||
self.gridLayout.addWidget(self.editWidget, 2, 0, 1, 1)
|
||||
self.horizontalLayout3 = QtGui.QHBoxLayout()
|
||||
self.horizontalLayout3.setObjectName(u'horizontalLayout3')
|
||||
self.themeLabel = QtGui.QLabel(customEditDialog)
|
||||
self.themeLabel.setObjectName(u'themeLabel')
|
||||
self.horizontalLayout3.addWidget(self.themeLabel)
|
||||
self.themeComboBox = QtGui.QComboBox(customEditDialog)
|
||||
self.themeLabel.setBuddy(self.themeComboBox)
|
||||
self.themeComboBox.setObjectName(u'themeComboBox')
|
||||
self.horizontalLayout3.addWidget(self.themeComboBox)
|
||||
self.gridLayout.addLayout(self.horizontalLayout3, 3, 0, 1, 1)
|
||||
self.horizontalLayout2 = QtGui.QHBoxLayout()
|
||||
self.horizontalLayout2.setObjectName(u'horizontalLayout2')
|
||||
self.creditLabel = QtGui.QLabel(customEditDialog)
|
||||
self.creditLabel.setObjectName(u'creditLabel')
|
||||
self.horizontalLayout2.addWidget(self.creditLabel)
|
||||
self.creditEdit = QtGui.QLineEdit(customEditDialog)
|
||||
self.creditLabel.setBuddy(self.creditEdit)
|
||||
self.creditEdit.setObjectName(u'creditEdit')
|
||||
self.horizontalLayout2.addWidget(self.creditEdit)
|
||||
self.gridLayout.addLayout(self.horizontalLayout2, 4, 0, 1, 1)
|
||||
self.buttonBox = QtGui.QDialogButtonBox(customEditDialog)
|
||||
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel |
|
||||
QtGui.QDialogButtonBox.Save)
|
||||
self.buttonBox.setObjectName(u'buttonBox')
|
||||
self.gridLayout.addWidget(self.buttonBox, 5, 0, 1, 1)
|
||||
|
||||
self.retranslateUi(customEditDialog)
|
||||
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'accepted()'),
|
||||
customEditDialog.accept)
|
||||
|
@ -143,46 +123,32 @@ class Ui_CustomEditDialog(object):
|
|||
translate('CustomPlugin.EditCustomForm', 'Edit Custom Slides'))
|
||||
self.upButton.setToolTip(
|
||||
translate('CustomPlugin.EditCustomForm', 'Move slide up one '
|
||||
'position.'))
|
||||
'position.'))
|
||||
self.downButton.setToolTip(
|
||||
translate('CustomPlugin.EditCustomForm', 'Move slide down one '
|
||||
'position.'))
|
||||
'position.'))
|
||||
self.titleLabel.setText(
|
||||
translate('CustomPlugin.EditCustomForm', '&Title:'))
|
||||
self.addButton.setText(
|
||||
translate('CustomPlugin.EditCustomForm', 'Add New'))
|
||||
translate('CustomPlugin.EditCustomForm', '&Add'))
|
||||
self.addButton.setToolTip(
|
||||
translate('CustomPlugin.EditCustomForm', 'Add a new slide at '
|
||||
'bottom.'))
|
||||
'bottom.'))
|
||||
self.editButton.setText(
|
||||
translate('CustomPlugin.EditCustomForm', 'Edit'))
|
||||
translate('CustomPlugin.EditCustomForm', '&Edit'))
|
||||
self.editButton.setToolTip(
|
||||
translate('CustomPlugin.EditCustomForm', 'Edit the selected '
|
||||
'slide.'))
|
||||
'slide.'))
|
||||
self.editAllButton.setText(
|
||||
translate('CustomPlugin.EditCustomForm', 'Edit All'))
|
||||
translate('CustomPlugin.EditCustomForm', 'Ed&it All'))
|
||||
self.editAllButton.setToolTip(
|
||||
translate('CustomPlugin.EditCustomForm', 'Edit all the slides at '
|
||||
'once.'))
|
||||
self.saveButton.setText(
|
||||
translate('CustomPlugin.EditCustomForm', 'Save'))
|
||||
self.saveButton.setToolTip(
|
||||
translate('CustomPlugin.EditCustomForm', 'Save the slide currently '
|
||||
'being edited.'))
|
||||
'once.'))
|
||||
self.deleteButton.setText(
|
||||
translate('CustomPlugin.EditCustomForm', 'Delete'))
|
||||
translate('CustomPlugin.EditCustomForm', '&Delete'))
|
||||
self.deleteButton.setToolTip(
|
||||
translate('CustomPlugin.EditCustomForm', 'Delete the selected '
|
||||
'slide.'))
|
||||
self.clearButton.setText(
|
||||
translate('CustomPlugin.EditCustomForm', 'Clear'))
|
||||
self.clearButton.setToolTip(
|
||||
translate('CustomPlugin.EditCustomForm', 'Clear edit area'))
|
||||
self.splitButton.setText(
|
||||
translate('CustomPlugin.EditCustomForm', 'Split Slide'))
|
||||
self.splitButton.setToolTip(
|
||||
translate('CustomPlugin.EditCustomForm', 'Split a slide into two '
|
||||
'by inserting a slide splitter.'))
|
||||
'slide.'))
|
||||
self.themeLabel.setText(
|
||||
translate('CustomPlugin.EditCustomForm', 'The&me:'))
|
||||
self.creditLabel.setText(
|
||||
|
|
|
@ -32,6 +32,7 @@ from openlp.core.lib import Receiver, translate
|
|||
from openlp.plugins.custom.lib import CustomXMLBuilder, CustomXMLParser
|
||||
from openlp.plugins.custom.lib.db import CustomSlide
|
||||
from editcustomdialog import Ui_CustomEditDialog
|
||||
from editcustomslideform import EditCustomSlideForm
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
@ -40,7 +41,7 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog):
|
|||
Class documentation goes here.
|
||||
"""
|
||||
log.info(u'Custom Editor loaded')
|
||||
def __init__(self, custommanager, parent = None):
|
||||
def __init__(self, manager, parent=None):
|
||||
"""
|
||||
Constructor
|
||||
"""
|
||||
|
@ -61,28 +62,20 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog):
|
|||
QtCore.SIGNAL(u'pressed()'), self.onEditButtonPressed)
|
||||
QtCore.QObject.connect(self.editAllButton,
|
||||
QtCore.SIGNAL(u'pressed()'), self.onEditAllButtonPressed)
|
||||
QtCore.QObject.connect(self.saveButton,
|
||||
QtCore.SIGNAL(u'pressed()'), self.onSaveButtonPressed)
|
||||
QtCore.QObject.connect(self.deleteButton,
|
||||
QtCore.SIGNAL(u'pressed()'), self.onDeleteButtonPressed)
|
||||
QtCore.QObject.connect(self.clearButton,
|
||||
QtCore.SIGNAL(u'pressed()'), self.onClearButtonPressed)
|
||||
QtCore.QObject.connect(self.upButton,
|
||||
QtCore.SIGNAL(u'pressed()'), self.onUpButtonPressed)
|
||||
QtCore.QObject.connect(self.downButton,
|
||||
QtCore.SIGNAL(u'pressed()'), self.onDownButtonPressed)
|
||||
QtCore.QObject.connect(self.splitButton,
|
||||
QtCore.SIGNAL(u'pressed()'), self.onSplitButtonPressed)
|
||||
QtCore.QObject.connect(self.verseListView,
|
||||
QtCore.SIGNAL(u'itemDoubleClicked(QListWidgetItem*)'),
|
||||
self.onVerseListViewSelected)
|
||||
QtCore.QObject.connect(self.verseListView,
|
||||
QtCore.QObject.connect(self.slideListView,
|
||||
QtCore.SIGNAL(u'itemClicked(QListWidgetItem*)'),
|
||||
self.onVerseListViewPressed)
|
||||
self.onSlideListViewPressed)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'theme_update_list'), self.loadThemes)
|
||||
# Create other objects and forms
|
||||
self.custommanager = custommanager
|
||||
# Create other objects and forms.
|
||||
self.manager = manager
|
||||
self.editSlideForm = EditCustomSlideForm(self)
|
||||
self.initialise()
|
||||
|
||||
def onPreview(self, button):
|
||||
|
@ -92,21 +85,15 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog):
|
|||
Receiver.send_message(u'custom_preview')
|
||||
|
||||
def initialise(self):
|
||||
self.editAll = False
|
||||
self.addButton.setEnabled(True)
|
||||
self.deleteButton.setEnabled(False)
|
||||
self.editButton.setEnabled(False)
|
||||
self.editAllButton.setEnabled(True)
|
||||
self.saveButton.setEnabled(False)
|
||||
self.clearButton.setEnabled(False)
|
||||
self.splitButton.setEnabled(False)
|
||||
self.titleEdit.setText(u'')
|
||||
self.creditEdit.setText(u'')
|
||||
self.verseTextEdit.clear()
|
||||
self.verseListView.clear()
|
||||
#make sure we have a new item
|
||||
self.slideListView.clear()
|
||||
# Make sure we have a new item.
|
||||
self.customSlide = CustomSlide()
|
||||
self.themeComboBox.addItem(u'')
|
||||
|
||||
def loadThemes(self, themelist):
|
||||
self.themeComboBox.clear()
|
||||
|
@ -115,16 +102,26 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog):
|
|||
self.themeComboBox.addItem(themename)
|
||||
|
||||
def loadCustom(self, id, preview=False):
|
||||
"""
|
||||
Called when editing or creating a new custom.
|
||||
|
||||
``id``
|
||||
The cutom's id. If zero, then a new custom is created.
|
||||
|
||||
``preview``
|
||||
States whether the custom is edited while being previewed in the
|
||||
preview panel.
|
||||
"""
|
||||
self.customSlide = CustomSlide()
|
||||
self.initialise()
|
||||
if id != 0:
|
||||
self.customSlide = self.custommanager.get_object(CustomSlide, id)
|
||||
self.customSlide = self.manager.get_object(CustomSlide, id)
|
||||
self.titleEdit.setText(self.customSlide.title)
|
||||
self.creditEdit.setText(self.customSlide.credits)
|
||||
customXML = CustomXMLParser(self.customSlide.text)
|
||||
verseList = customXML.get_verses()
|
||||
for verse in verseList:
|
||||
self.verseListView.addItem(verse[1])
|
||||
slideList = customXML.get_verses()
|
||||
for slide in slideList:
|
||||
self.slideListView.addItem(slide[1])
|
||||
theme = self.customSlide.theme_name
|
||||
id = self.themeComboBox.findText(theme, QtCore.Qt.MatchExactly)
|
||||
if id == -1:
|
||||
|
@ -132,7 +129,8 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog):
|
|||
self.themeComboBox.setCurrentIndex(id)
|
||||
else:
|
||||
self.themeComboBox.setCurrentIndex(0)
|
||||
#if not preview hide the preview button
|
||||
self.editAllButton.setEnabled(False)
|
||||
# If not preview hide the preview button.
|
||||
self.previewButton.setVisible(False)
|
||||
if preview:
|
||||
self.previewButton.setVisible(True)
|
||||
|
@ -148,6 +146,9 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog):
|
|||
self.close()
|
||||
|
||||
def saveCustom(self):
|
||||
"""
|
||||
Saves the custom.
|
||||
"""
|
||||
valid, message = self._validate()
|
||||
if not valid:
|
||||
QtGui.QMessageBox.critical(self,
|
||||
|
@ -157,127 +158,114 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog):
|
|||
sxml.new_document()
|
||||
sxml.add_lyrics_to_song()
|
||||
count = 1
|
||||
for i in range(0, self.verseListView.count()):
|
||||
for i in range(0, self.slideListView.count()):
|
||||
sxml.add_verse_to_lyrics(u'custom', unicode(count),
|
||||
unicode(self.verseListView.item(i).text()))
|
||||
unicode(self.slideListView.item(i).text()))
|
||||
count += 1
|
||||
self.customSlide.title = unicode(self.titleEdit.displayText(), u'utf-8')
|
||||
self.customSlide.title = unicode(self.titleEdit.text())
|
||||
self.customSlide.text = unicode(sxml.extract_xml(), u'utf-8')
|
||||
self.customSlide.credits = unicode(self.creditEdit.displayText(),
|
||||
u'utf-8')
|
||||
self.customSlide.theme_name = unicode(self.themeComboBox.currentText(),
|
||||
u'utf-8')
|
||||
return self.custommanager.save_object(self.customSlide)
|
||||
self.customSlide.credits = unicode(self.creditEdit.text())
|
||||
self.customSlide.theme_name = unicode(self.themeComboBox.currentText())
|
||||
return self.manager.save_object(self.customSlide)
|
||||
|
||||
def onUpButtonPressed(self):
|
||||
selectedRow = self.verseListView.currentRow()
|
||||
selectedRow = self.slideListView.currentRow()
|
||||
if selectedRow != 0:
|
||||
qw = self.verseListView.takeItem(selectedRow)
|
||||
self.verseListView.insertItem(selectedRow - 1, qw)
|
||||
self.verseListView.setCurrentRow(selectedRow - 1)
|
||||
qw = self.slideListView.takeItem(selectedRow)
|
||||
self.slideListView.insertItem(selectedRow - 1, qw)
|
||||
self.slideListView.setCurrentRow(selectedRow - 1)
|
||||
|
||||
def onDownButtonPressed(self):
|
||||
selectedRow = self.verseListView.currentRow()
|
||||
selectedRow = self.slideListView.currentRow()
|
||||
# zero base arrays
|
||||
if selectedRow != self.verseListView.count() - 1:
|
||||
qw = self.verseListView.takeItem(selectedRow)
|
||||
self.verseListView.insertItem(selectedRow + 1, qw)
|
||||
self.verseListView.setCurrentRow(selectedRow + 1)
|
||||
if selectedRow != self.slideListView.count() - 1:
|
||||
qw = self.slideListView.takeItem(selectedRow)
|
||||
self.slideListView.insertItem(selectedRow + 1, qw)
|
||||
self.slideListView.setCurrentRow(selectedRow + 1)
|
||||
|
||||
def onClearButtonPressed(self):
|
||||
self.verseTextEdit.clear()
|
||||
self.editAll = False
|
||||
self.addButton.setEnabled(True)
|
||||
self.editAllButton.setEnabled(True)
|
||||
self.saveButton.setEnabled(False)
|
||||
|
||||
def onVerseListViewPressed(self, item):
|
||||
def onSlideListViewPressed(self, item):
|
||||
self.deleteButton.setEnabled(True)
|
||||
self.editButton.setEnabled(True)
|
||||
|
||||
def onVerseListViewSelected(self, item):
|
||||
self.editText(item.text())
|
||||
|
||||
def onAddButtonPressed(self):
|
||||
self.verseListView.addItem(self.verseTextEdit.toPlainText())
|
||||
self.deleteButton.setEnabled(False)
|
||||
self.verseTextEdit.clear()
|
||||
self.editSlideForm.setText(u'')
|
||||
if self.editSlideForm.exec_():
|
||||
for slide in self.editSlideForm.getText():
|
||||
self.slideListView.addItem(slide)
|
||||
self.editAllButton.setEnabled(True)
|
||||
|
||||
def onEditButtonPressed(self):
|
||||
self.editText(self.verseListView.currentItem().text())
|
||||
self.editSlideForm.setText(self.slideListView.currentItem().text())
|
||||
if self.editSlideForm.exec_():
|
||||
self.updateSlideList(self.editSlideForm.getText())
|
||||
|
||||
def onEditAllButtonPressed(self):
|
||||
self.editAll = True
|
||||
self.addButton.setEnabled(False)
|
||||
self.splitButton.setEnabled(True)
|
||||
if self.verseListView.count() > 0:
|
||||
verse_list = u''
|
||||
for row in range(0, self.verseListView.count()):
|
||||
item = self.verseListView.item(row)
|
||||
verse_list += item.text()
|
||||
if row != self.verseListView.count() - 1:
|
||||
verse_list += u'\n[---]\n'
|
||||
self.editText(verse_list)
|
||||
"""
|
||||
Edits all slides.
|
||||
"""
|
||||
if self.slideListView.count() > 0:
|
||||
slide_list = u''
|
||||
for row in range(0, self.slideListView.count()):
|
||||
item = self.slideListView.item(row)
|
||||
slide_list += item.text()
|
||||
if row != self.slideListView.count() - 1:
|
||||
slide_list += u'\n[---]\n'
|
||||
self.editSlideForm.setText(slide_list)
|
||||
if self.editSlideForm.exec_():
|
||||
self.updateSlideList(self.editSlideForm.getText(), True)
|
||||
|
||||
def editText(self, text):
|
||||
self.beforeText = text
|
||||
self.verseTextEdit.setPlainText(text)
|
||||
self.deleteButton.setEnabled(False)
|
||||
self.editButton.setEnabled(False)
|
||||
self.editAllButton.setEnabled(False)
|
||||
self.saveButton.setEnabled(True)
|
||||
self.clearButton.setEnabled(True)
|
||||
def updateSlideList(self, slides, edit_all=False):
|
||||
"""
|
||||
Updates the slide list after editing slides.
|
||||
|
||||
def onSaveButtonPressed(self):
|
||||
if self.editAll:
|
||||
self.verseListView.clear()
|
||||
for row in unicode(self.verseTextEdit.toPlainText()).split(
|
||||
u'\n[---]\n'):
|
||||
self.verseListView.addItem(row)
|
||||
``slides``
|
||||
A list of all slides which have been edited.
|
||||
|
||||
``edit_all``
|
||||
Indicates if all slides or only one slide has been edited.
|
||||
"""
|
||||
if len(slides) == 1:
|
||||
self.slideListView.currentItem().setText(slides[0])
|
||||
else:
|
||||
self.verseListView.currentItem().setText(
|
||||
self.verseTextEdit.toPlainText())
|
||||
#number of lines has change
|
||||
if len(self.beforeText.split(u'\n')) != \
|
||||
len(self.verseTextEdit.toPlainText().split(u'\n')):
|
||||
tempList = {}
|
||||
for row in range(0, self.verseListView.count()):
|
||||
tempList[row] = self.verseListView.item(row).text()
|
||||
self.verseListView.clear()
|
||||
for row in range (0, len(tempList)):
|
||||
self.verseListView.addItem(tempList[row])
|
||||
self.verseListView.repaint()
|
||||
self.addButton.setEnabled(True)
|
||||
self.saveButton.setEnabled(False)
|
||||
self.editButton.setEnabled(False)
|
||||
self.editAllButton.setEnabled(True)
|
||||
self.splitButton.setEnabled(False)
|
||||
self.verseTextEdit.clear()
|
||||
|
||||
def onSplitButtonPressed(self):
|
||||
if self.verseTextEdit.textCursor().columnNumber() != 0:
|
||||
self.verseTextEdit.insertPlainText(u'\n')
|
||||
self.verseTextEdit.insertPlainText(u'[---]\n' )
|
||||
self.verseTextEdit.setFocus()
|
||||
if edit_all:
|
||||
self.slideListView.clear()
|
||||
for slide in slides:
|
||||
self.slideListView.addItem(slide)
|
||||
else:
|
||||
old_slides = []
|
||||
old_row = self.slideListView.currentRow()
|
||||
# Create a list with all (old/unedited) slides.
|
||||
old_slides = [self.slideListView.item(row).text() for row in \
|
||||
range(0, self.slideListView.count())]
|
||||
self.slideListView.clear()
|
||||
old_slides.pop(old_row)
|
||||
# Insert all slides to make the old_slides list complete.
|
||||
for slide in slides:
|
||||
old_slides.insert(old_row, slide)
|
||||
for slide in old_slides:
|
||||
self.slideListView.addItem(slide)
|
||||
self.slideListView.repaint()
|
||||
|
||||
def onDeleteButtonPressed(self):
|
||||
self.verseListView.takeItem(self.verseListView.currentRow())
|
||||
self.editButton.setEnabled(False)
|
||||
self.slideListView.takeItem(self.slideListView.currentRow())
|
||||
self.editButton.setEnabled(True)
|
||||
self.editAllButton.setEnabled(True)
|
||||
if self.slideListView.count() == 0:
|
||||
self.deleteButton.setEnabled(False)
|
||||
self.editButton.setEnabled(False)
|
||||
self.editAllButton.setEnabled(False)
|
||||
|
||||
def _validate(self):
|
||||
"""
|
||||
Checks whether a custom is valid or not.
|
||||
"""
|
||||
# We must have a title.
|
||||
if len(self.titleEdit.displayText()) == 0:
|
||||
self.titleEdit.setFocus()
|
||||
return False, translate('CustomPlugin.EditCustomForm',
|
||||
'You need to type in a title.')
|
||||
# must have 1 slide
|
||||
if self.verseListView.count() == 0:
|
||||
self.verseTextEdit.setFocus()
|
||||
# We must have one slide.
|
||||
if self.slideListView.count() == 0:
|
||||
return False, translate('CustomPlugin.EditCustomForm',
|
||||
'You need to add at least one slide')
|
||||
if self.verseTextEdit.toPlainText():
|
||||
self.verseTextEdit.setFocus()
|
||||
return False, translate('CustomPlugin.EditCustomForm',
|
||||
'You have one or more unsaved slides, please either save your '
|
||||
'slide(s) or clear your changes.')
|
||||
return True, u''
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
# --------------------------------------------------------------------------- #
|
||||
# Copyright (c) 2008-2010 Raoul Snyman #
|
||||
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
|
||||
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
|
||||
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
|
||||
# Carsten Tinggaard, Frode Woldsund #
|
||||
# --------------------------------------------------------------------------- #
|
||||
# This program is free software; you can redistribute it and/or modify it #
|
||||
# under the terms of the GNU General Public License as published by the Free #
|
||||
# Software Foundation; version 2 of the License. #
|
||||
# #
|
||||
# This program is distributed in the hope that it will be useful, but WITHOUT #
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
|
||||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
|
||||
# more details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU General Public License along #
|
||||
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
|
||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||
###############################################################################
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import translate, SpellTextEdit
|
||||
|
||||
class Ui_CustomSlideEditDialog(object):
|
||||
def setupUi(self, customSlideEditDialog):
|
||||
customSlideEditDialog.setObjectName(u'customSlideEditDialog')
|
||||
customSlideEditDialog.resize(474, 442)
|
||||
self.buttonBox = QtGui.QDialogButtonBox(customSlideEditDialog)
|
||||
self.buttonBox.setGeometry(QtCore.QRect(8, 407, 458, 32))
|
||||
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
|
||||
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel |
|
||||
QtGui.QDialogButtonBox.Save)
|
||||
self.buttonBox.setObjectName(u'buttonBox')
|
||||
self.slideTextEdit = SpellTextEdit(self)
|
||||
self.slideTextEdit.setGeometry(QtCore.QRect(8, 8, 458, 349))
|
||||
self.slideTextEdit.setObjectName(u'slideTextEdit')
|
||||
self.splitButton = QtGui.QPushButton(customSlideEditDialog)
|
||||
self.splitButton.setGeometry(QtCore.QRect(380, 370, 85, 27))
|
||||
self.splitButton.setObjectName(u'splitButton')
|
||||
self.retranslateUi(customSlideEditDialog)
|
||||
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'accepted()'),
|
||||
customSlideEditDialog.accept)
|
||||
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'rejected()'),
|
||||
customSlideEditDialog.reject)
|
||||
QtCore.QMetaObject.connectSlotsByName(customSlideEditDialog)
|
||||
|
||||
def retranslateUi(self, customSlideEditDialog):
|
||||
self.splitButton.setText(
|
||||
translate('CustomPlugin.EditCustomForm', 'Split Slide'))
|
||||
self.splitButton.setToolTip(
|
||||
translate('CustomPlugin.EditCustomForm', 'Split a slide into two '
|
||||
'by inserting a slide splitter.'))
|
|
@ -0,0 +1,75 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
# --------------------------------------------------------------------------- #
|
||||
# Copyright (c) 2008-2010 Raoul Snyman #
|
||||
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
|
||||
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
|
||||
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
|
||||
# Carsten Tinggaard, Frode Woldsund #
|
||||
# --------------------------------------------------------------------------- #
|
||||
# This program is free software; you can redistribute it and/or modify it #
|
||||
# under the terms of the GNU General Public License as published by the Free #
|
||||
# Software Foundation; version 2 of the License. #
|
||||
# #
|
||||
# This program is distributed in the hope that it will be useful, but WITHOUT #
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
|
||||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
|
||||
# more details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU General Public License along #
|
||||
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
|
||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||
###############################################################################
|
||||
|
||||
import logging
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from editcustomslidedialog import Ui_CustomSlideEditDialog
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
class EditCustomSlideForm(QtGui.QDialog, Ui_CustomSlideEditDialog):
|
||||
"""
|
||||
Class documentation goes here.
|
||||
"""
|
||||
log.info(u'Custom Verse Editor loaded')
|
||||
def __init__(self, parent=None):
|
||||
"""
|
||||
Constructor
|
||||
"""
|
||||
QtGui.QDialog.__init__(self, parent)
|
||||
self.setupUi(self)
|
||||
# Connecting signals and slots
|
||||
QtCore.QObject.connect(self.splitButton,
|
||||
QtCore.SIGNAL(u'pressed()'), self.onSplitButtonPressed)
|
||||
|
||||
def setText(self, text):
|
||||
"""
|
||||
Set the text for slideTextEdit.
|
||||
|
||||
``text``
|
||||
The text (unicode).
|
||||
"""
|
||||
self.slideTextEdit.clear()
|
||||
if text:
|
||||
self.slideTextEdit.setPlainText(text)
|
||||
self.slideTextEdit.setFocus()
|
||||
|
||||
def getText(self):
|
||||
"""
|
||||
Returns a list with all slides.
|
||||
"""
|
||||
return self.slideTextEdit.toPlainText().split(u'\n[---]\n')
|
||||
|
||||
def onSplitButtonPressed(self):
|
||||
"""
|
||||
Splits a slide in two slides.
|
||||
"""
|
||||
if self.slideTextEdit.textCursor().columnNumber() != 0:
|
||||
self.slideTextEdit.insertPlainText(u'\n')
|
||||
self.slideTextEdit.insertPlainText(u'[---]\n' )
|
||||
self.slideTextEdit.setFocus()
|
|
@ -56,6 +56,7 @@ class CustomMediaItem(MediaManagerItem):
|
|||
# Holds information about whether the edit is remotly triggered and
|
||||
# which Custom is required.
|
||||
self.remoteCustom = -1
|
||||
self.manager = parent.manager
|
||||
|
||||
def addEndHeaderBar(self):
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
|
@ -71,7 +72,7 @@ class CustomMediaItem(MediaManagerItem):
|
|||
MediaManagerItem.requiredIcons(self)
|
||||
|
||||
def initialise(self):
|
||||
self.loadCustomListView(self.parent.custommanager.get_all_objects(
|
||||
self.loadCustomListView(self.manager.get_all_objects(
|
||||
CustomSlide, order_by_ref=CustomSlide.title))
|
||||
#Called to redisplay the song list screen edith from a search
|
||||
#or from the exit of the Song edit dialog. If remote editing is active
|
||||
|
@ -106,7 +107,7 @@ class CustomMediaItem(MediaManagerItem):
|
|||
type of display is required.
|
||||
"""
|
||||
fields = customid.split(u':')
|
||||
valid = self.parent.custommanager.get_object(CustomSlide, fields[1])
|
||||
valid = self.manager.get_object(CustomSlide, fields[1])
|
||||
if valid:
|
||||
self.remoteCustom = fields[1]
|
||||
self.remoteTriggered = fields[0]
|
||||
|
@ -139,7 +140,7 @@ class CustomMediaItem(MediaManagerItem):
|
|||
id_list = [(item.data(QtCore.Qt.UserRole)).toInt()[0]
|
||||
for item in self.listView.selectedIndexes()]
|
||||
for id in id_list:
|
||||
self.parent.custommanager.delete_object(CustomSlide, id)
|
||||
self.parent.manager.delete_object(CustomSlide, id)
|
||||
for row in row_list:
|
||||
self.listView.takeItem(row)
|
||||
|
||||
|
@ -161,10 +162,10 @@ class CustomMediaItem(MediaManagerItem):
|
|||
service_item.add_capability(ItemCapabilities.AllowsEdit)
|
||||
service_item.add_capability(ItemCapabilities.AllowsPreview)
|
||||
service_item.add_capability(ItemCapabilities.AllowsLoop)
|
||||
customSlide = self.parent.custommanager.get_object(CustomSlide, item_id)
|
||||
customSlide = self.parent.manager.get_object(CustomSlide, item_id)
|
||||
title = customSlide.title
|
||||
credit = customSlide.credits
|
||||
service_item.editId = item_id
|
||||
service_item.edit_id = item_id
|
||||
theme = customSlide.theme_name
|
||||
if theme:
|
||||
service_item.theme = theme
|
||||
|
|
|
@ -166,9 +166,8 @@ class ImageMediaItem(MediaManagerItem):
|
|||
for item in items:
|
||||
bitem = self.listView.item(item.row())
|
||||
filename = unicode(bitem.data(QtCore.Qt.UserRole).toString())
|
||||
frame = QtGui.QImage(unicode(filename))
|
||||
(path, name) = os.path.split(filename)
|
||||
service_item.add_from_image(path, name, frame)
|
||||
service_item.add_from_image(filename, name)
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
@ -185,7 +184,8 @@ class ImageMediaItem(MediaManagerItem):
|
|||
for item in items:
|
||||
bitem = self.listView.item(item.row())
|
||||
filename = unicode(bitem.data(QtCore.Qt.UserRole).toString())
|
||||
self.parent.liveController.display.image(filename)
|
||||
(path, name) = os.path.split(filename)
|
||||
self.parent.liveController.display.directImage(name, filename)
|
||||
self.resetButton.setVisible(True)
|
||||
|
||||
def onPreviewClick(self):
|
||||
|
|
|
@ -56,7 +56,7 @@ class MediaMediaItem(MediaManagerItem):
|
|||
u':/media/media_video.png').toImage()
|
||||
MediaManagerItem.__init__(self, parent, self, icon)
|
||||
self.singleServiceItem = False
|
||||
self.serviceItemIconName = u':/media/media_video.png'
|
||||
self.serviceItemIconName = u':/media/image_clapperboard.png'
|
||||
|
||||
def retranslateUi(self):
|
||||
self.OnNewPrompt = translate('MediaPlugin.MediaItem', 'Select Media')
|
||||
|
@ -125,6 +125,8 @@ class MediaMediaItem(MediaManagerItem):
|
|||
service_item.title = unicode(
|
||||
translate('MediaPlugin.MediaItem', 'Media'))
|
||||
service_item.add_capability(ItemCapabilities.RequiresMedia)
|
||||
# force a nonexistent theme
|
||||
service_item.theme = -1
|
||||
frame = u':/media/image_clapperboard.png'
|
||||
(path, name) = os.path.split(filename)
|
||||
service_item.add_from_command(path, name, frame)
|
||||
|
|