Merge lp:~ic90/openlp/animated-alerts into lp:~openlp-dev/openlp/webengine-migrate

Proposed by Nico Opiyo
Status: Superseded
Proposed branch: lp:~ic90/openlp/animated-alerts
Merge into: lp:~openlp-dev/openlp/webengine-migrate
Diff against target: 58182 lines (+20914/-24777)
539 files modified
.bzrignore (+29/-36)
LICENSE (+624/-289)
copyright.txt (+18/-18)
nose2.cfg (+0/-27)
openlp/__init__.py (+18/-18)
openlp/core/__init__.py (+18/-18)
openlp/core/api/__init__.py (+18/-18)
openlp/core/api/deploy.py (+21/-21)
openlp/core/api/endpoint/__init__.py (+18/-18)
openlp/core/api/endpoint/controller.py (+19/-19)
openlp/core/api/endpoint/core.py (+18/-18)
openlp/core/api/endpoint/pluginhelpers.py (+18/-18)
openlp/core/api/endpoint/remote.py (+18/-18)
openlp/core/api/endpoint/service.py (+18/-18)
openlp/core/api/http/__init__.py (+18/-18)
openlp/core/api/http/endpoint.py (+18/-18)
openlp/core/api/http/errors.py (+18/-18)
openlp/core/api/http/server.py (+18/-18)
openlp/core/api/http/wsgiapp.py (+18/-18)
openlp/core/api/poll.py (+18/-18)
openlp/core/api/tab.py (+18/-18)
openlp/core/api/websockets.py (+18/-18)
openlp/core/app.py (+60/-36)
openlp/core/common/__init__.py (+29/-29)
openlp/core/common/actions.py (+18/-18)
openlp/core/common/applocation.py (+25/-24)
openlp/core/common/db.py (+18/-18)
openlp/core/common/httputils.py (+77/-23)
openlp/core/common/i18n.py (+20/-19)
openlp/core/common/json.py (+157/-39)
openlp/core/common/mixins.py (+18/-18)
openlp/core/common/path.py (+26/-133)
openlp/core/common/registry.py (+19/-19)
openlp/core/common/settings.py (+41/-33)
openlp/core/display/__init__.py (+18/-18)
openlp/core/display/html/display.css (+80/-0)
openlp/core/display/html/display.html (+10/-5)
openlp/core/display/html/display.js (+245/-32)
openlp/core/display/html/reveal.js (+761/-310)
openlp/core/display/render.py (+91/-47)
openlp/core/display/screens.py (+18/-18)
openlp/core/display/webengine.py (+18/-18)
openlp/core/display/window.py (+39/-36)
openlp/core/lib/__init__.py (+83/-31)
openlp/core/lib/db.py (+44/-43)
openlp/core/lib/exceptions.py (+18/-18)
openlp/core/lib/formattingtags.py (+18/-18)
openlp/core/lib/imagemanager.py (+18/-18)
openlp/core/lib/json/__init__.py (+18/-18)
openlp/core/lib/mediamanageritem.py (+34/-35)
openlp/core/lib/plugin.py (+18/-18)
openlp/core/lib/pluginmanager.py (+18/-18)
openlp/core/lib/serviceitem.py (+33/-29)
openlp/core/lib/settingstab.py (+18/-18)
openlp/core/lib/theme.py (+34/-28)
openlp/core/lib/ui.py (+18/-18)
openlp/core/loader.py (+18/-18)
openlp/core/projectors/__init__.py (+18/-18)
openlp/core/projectors/constants.py (+29/-19)
openlp/core/projectors/db.py (+25/-19)
openlp/core/projectors/editform.py (+20/-18)
openlp/core/projectors/manager.py (+29/-45)
openlp/core/projectors/pjlink.py (+184/-613)
openlp/core/projectors/pjlinkcommands.py (+554/-0)
openlp/core/projectors/sourceselectform.py (+18/-18)
openlp/core/projectors/tab.py (+18/-18)
openlp/core/projectors/upgrade.py (+18/-18)
openlp/core/resources.py (+18/-18)
openlp/core/server.py (+21/-19)
openlp/core/state.py (+18/-18)
openlp/core/threading.py (+20/-20)
openlp/core/ui/__init__.py (+19/-19)
openlp/core/ui/aboutdialog.py (+18/-18)
openlp/core/ui/aboutform.py (+18/-18)
openlp/core/ui/advancedtab.py (+30/-23)
openlp/core/ui/exceptiondialog.py (+21/-21)
openlp/core/ui/exceptionform.py (+32/-25)
openlp/core/ui/filerenamedialog.py (+18/-18)
openlp/core/ui/filerenameform.py (+18/-18)
openlp/core/ui/firsttimeform.py (+220/-296)
openlp/core/ui/firsttimelanguagedialog.py (+18/-18)
openlp/core/ui/firsttimelanguageform.py (+18/-18)
openlp/core/ui/firsttimewizard.py (+132/-96)
openlp/core/ui/formattingtagcontroller.py (+19/-19)
openlp/core/ui/formattingtagdialog.py (+18/-18)
openlp/core/ui/formattingtagform.py (+18/-18)
openlp/core/ui/generaltab.py (+20/-39)
openlp/core/ui/icons.py (+28/-22)
openlp/core/ui/mainwindow.py (+35/-33)
openlp/core/ui/media/__init__.py (+32/-18)
openlp/core/ui/media/endpoint.py (+18/-18)
openlp/core/ui/media/mediacontroller.py (+121/-228)
openlp/core/ui/media/mediaplayer.py (+26/-32)
openlp/core/ui/media/mediatab.py (+151/-0)
openlp/core/ui/media/playertab.py (+0/-269)
openlp/core/ui/media/systemplayer.py (+0/-332)
openlp/core/ui/media/vendor/__init__.py (+0/-25)
openlp/core/ui/media/vendor/vlc.py (+0/-8775)
openlp/core/ui/media/vlcplayer.py (+152/-216)
openlp/core/ui/plugindialog.py (+18/-18)
openlp/core/ui/pluginform.py (+18/-18)
openlp/core/ui/printservicedialog.py (+18/-18)
openlp/core/ui/printserviceform.py (+23/-23)
openlp/core/ui/screenstab.py (+19/-19)
openlp/core/ui/serviceitemeditdialog.py (+18/-18)
openlp/core/ui/serviceitemeditform.py (+18/-18)
openlp/core/ui/servicemanager.py (+82/-58)
openlp/core/ui/servicenoteform.py (+18/-18)
openlp/core/ui/settingsdialog.py (+18/-18)
openlp/core/ui/settingsform.py (+23/-23)
openlp/core/ui/shortcutlistdialog.py (+18/-18)
openlp/core/ui/shortcutlistform.py (+18/-18)
openlp/core/ui/slidecontroller.py (+138/-35)
openlp/core/ui/splashscreen.py (+18/-18)
openlp/core/ui/starttimedialog.py (+18/-18)
openlp/core/ui/starttimeform.py (+18/-18)
openlp/core/ui/style.py (+18/-18)
openlp/core/ui/themeform.py (+45/-40)
openlp/core/ui/themelayoutdialog.py (+18/-18)
openlp/core/ui/themelayoutform.py (+18/-18)
openlp/core/ui/thememanager.py (+57/-63)
openlp/core/ui/themestab.py (+19/-19)
openlp/core/ui/themewizard.py (+30/-29)
openlp/core/version.py (+19/-19)
openlp/core/widgets/__init__.py (+18/-18)
openlp/core/widgets/buttons.py (+18/-18)
openlp/core/widgets/dialogs.py (+26/-26)
openlp/core/widgets/docks.py (+18/-18)
openlp/core/widgets/edits.py (+25/-24)
openlp/core/widgets/enums.py (+18/-18)
openlp/core/widgets/layouts.py (+19/-19)
openlp/core/widgets/toolbar.py (+18/-18)
openlp/core/widgets/views.py (+30/-26)
openlp/core/widgets/widgets.py (+48/-20)
openlp/core/widgets/wizard.py (+19/-59)
openlp/plugins/__init__.py (+18/-18)
openlp/plugins/alerts/__init__.py (+18/-18)
openlp/plugins/alerts/alertsplugin.py (+21/-19)
openlp/plugins/alerts/endpoint.py (+18/-18)
openlp/plugins/alerts/forms/__init__.py (+18/-18)
openlp/plugins/alerts/forms/alertdialog.py (+18/-18)
openlp/plugins/alerts/forms/alertform.py (+18/-18)
openlp/plugins/alerts/lib/__init__.py (+18/-18)
openlp/plugins/alerts/lib/alertsmanager.py (+51/-21)
openlp/plugins/alerts/lib/alertstab.py (+87/-35)
openlp/plugins/alerts/lib/db.py (+18/-18)
openlp/plugins/bibles/__init__.py (+18/-18)
openlp/plugins/bibles/bibleplugin.py (+18/-18)
openlp/plugins/bibles/endpoint.py (+18/-18)
openlp/plugins/bibles/forms/__init__.py (+18/-18)
openlp/plugins/bibles/forms/bibleimportform.py (+20/-20)
openlp/plugins/bibles/forms/booknamedialog.py (+18/-18)
openlp/plugins/bibles/forms/booknameform.py (+18/-18)
openlp/plugins/bibles/forms/editbibledialog.py (+18/-18)
openlp/plugins/bibles/forms/editbibleform.py (+18/-18)
openlp/plugins/bibles/forms/languagedialog.py (+18/-18)
openlp/plugins/bibles/forms/languageform.py (+18/-18)
openlp/plugins/bibles/lib/__init__.py (+18/-18)
openlp/plugins/bibles/lib/bibleimport.py (+20/-20)
openlp/plugins/bibles/lib/biblestab.py (+18/-18)
openlp/plugins/bibles/lib/db.py (+27/-27)
openlp/plugins/bibles/lib/importers/__init__.py (+18/-18)
openlp/plugins/bibles/lib/importers/csvbible.py (+20/-20)
openlp/plugins/bibles/lib/importers/http.py (+18/-18)
openlp/plugins/bibles/lib/importers/opensong.py (+18/-18)
openlp/plugins/bibles/lib/importers/osis.py (+18/-18)
openlp/plugins/bibles/lib/importers/sword.py (+18/-18)
openlp/plugins/bibles/lib/importers/wordproject.py (+20/-20)
openlp/plugins/bibles/lib/importers/zefania.py (+18/-18)
openlp/plugins/bibles/lib/manager.py (+20/-20)
openlp/plugins/bibles/lib/mediaitem.py (+21/-21)
openlp/plugins/bibles/lib/upgrade.py (+18/-18)
openlp/plugins/bibles/lib/versereferencelist.py (+18/-18)
openlp/plugins/custom/__init__.py (+18/-18)
openlp/plugins/custom/customplugin.py (+18/-18)
openlp/plugins/custom/endpoint.py (+18/-18)
openlp/plugins/custom/forms/__init__.py (+18/-18)
openlp/plugins/custom/forms/editcustomdialog.py (+18/-18)
openlp/plugins/custom/forms/editcustomform.py (+18/-18)
openlp/plugins/custom/forms/editcustomslidedialog.py (+18/-18)
openlp/plugins/custom/forms/editcustomslideform.py (+18/-18)
openlp/plugins/custom/lib/__init__.py (+18/-18)
openlp/plugins/custom/lib/customtab.py (+18/-18)
openlp/plugins/custom/lib/customxmlhandler.py (+18/-18)
openlp/plugins/custom/lib/db.py (+18/-18)
openlp/plugins/custom/lib/mediaitem.py (+21/-24)
openlp/plugins/images/__init__.py (+18/-18)
openlp/plugins/images/endpoint.py (+18/-18)
openlp/plugins/images/forms/__init__.py (+18/-18)
openlp/plugins/images/forms/addgroupdialog.py (+18/-18)
openlp/plugins/images/forms/addgroupform.py (+18/-18)
openlp/plugins/images/forms/choosegroupdialog.py (+18/-18)
openlp/plugins/images/forms/choosegroupform.py (+18/-18)
openlp/plugins/images/imageplugin.py (+18/-18)
openlp/plugins/images/lib/__init__.py (+18/-18)
openlp/plugins/images/lib/db.py (+18/-18)
openlp/plugins/images/lib/imagetab.py (+18/-18)
openlp/plugins/images/lib/mediaitem.py (+27/-27)
openlp/plugins/images/lib/upgrade.py (+21/-21)
openlp/plugins/media/__init__.py (+18/-18)
openlp/plugins/media/endpoint.py (+18/-18)
openlp/plugins/media/forms/__init__.py (+18/-18)
openlp/plugins/media/forms/mediaclipselectordialog.py (+18/-18)
openlp/plugins/media/forms/mediaclipselectorform.py (+19/-19)
openlp/plugins/media/lib/__init__.py (+18/-18)
openlp/plugins/media/lib/mediaitem.py (+54/-50)
openlp/plugins/media/lib/mediatab.py (+0/-73)
openlp/plugins/media/mediaplugin.py (+18/-31)
openlp/plugins/presentations/__init__.py (+18/-18)
openlp/plugins/presentations/endpoint.py (+18/-18)
openlp/plugins/presentations/lib/__init__.py (+18/-18)
openlp/plugins/presentations/lib/impresscontroller.py (+225/-41)
openlp/plugins/presentations/lib/libreofficeserver.py (+431/-0)
openlp/plugins/presentations/lib/maclocontroller.py (+266/-0)
openlp/plugins/presentations/lib/mediaitem.py (+32/-34)
openlp/plugins/presentations/lib/messagelistener.py (+43/-48)
openlp/plugins/presentations/lib/pdfcontroller.py (+43/-25)
openlp/plugins/presentations/lib/powerpointcontroller.py (+44/-25)
openlp/plugins/presentations/lib/presentationcontroller.py (+38/-32)
openlp/plugins/presentations/lib/presentationtab.py (+21/-21)
openlp/plugins/presentations/lib/serializers.py (+52/-0)
openlp/plugins/presentations/lib/vendor/do_not_delete.txt (+5/-0)
openlp/plugins/presentations/presentationplugin.py (+34/-32)
openlp/plugins/songs/__init__.py (+18/-18)
openlp/plugins/songs/endpoint.py (+18/-18)
openlp/plugins/songs/forms/__init__.py (+18/-18)
openlp/plugins/songs/forms/authorsdialog.py (+18/-18)
openlp/plugins/songs/forms/authorsform.py (+18/-18)
openlp/plugins/songs/forms/duplicatesongremovalform.py (+18/-18)
openlp/plugins/songs/forms/editsongdialog.py (+18/-18)
openlp/plugins/songs/forms/editsongform.py (+20/-19)
openlp/plugins/songs/forms/editversedialog.py (+18/-18)
openlp/plugins/songs/forms/editverseform.py (+18/-18)
openlp/plugins/songs/forms/mediafilesdialog.py (+18/-18)
openlp/plugins/songs/forms/mediafilesform.py (+20/-20)
openlp/plugins/songs/forms/songbookdialog.py (+18/-18)
openlp/plugins/songs/forms/songbookform.py (+18/-18)
openlp/plugins/songs/forms/songexportform.py (+18/-18)
openlp/plugins/songs/forms/songimportform.py (+25/-20)
openlp/plugins/songs/forms/songmaintenancedialog.py (+18/-18)
openlp/plugins/songs/forms/songmaintenanceform.py (+18/-18)
openlp/plugins/songs/forms/songreviewwidget.py (+48/-28)
openlp/plugins/songs/forms/songselectdialog.py (+18/-18)
openlp/plugins/songs/forms/songselectform.py (+29/-20)
openlp/plugins/songs/forms/topicsdialog.py (+18/-18)
openlp/plugins/songs/forms/topicsform.py (+18/-18)
openlp/plugins/songs/lib/__init__.py (+18/-18)
openlp/plugins/songs/lib/db.py (+18/-18)
openlp/plugins/songs/lib/importer.py (+18/-18)
openlp/plugins/songs/lib/importers/__init__.py (+18/-18)
openlp/plugins/songs/lib/importers/cclifile.py (+23/-23)
openlp/plugins/songs/lib/importers/chordpro.py (+18/-18)
openlp/plugins/songs/lib/importers/dreambeam.py (+18/-18)
openlp/plugins/songs/lib/importers/easyslides.py (+18/-18)
openlp/plugins/songs/lib/importers/easyworship.py (+19/-19)
openlp/plugins/songs/lib/importers/foilpresenter.py (+18/-18)
openlp/plugins/songs/lib/importers/lyrix.py (+18/-18)
openlp/plugins/songs/lib/importers/mediashout.py (+18/-18)
openlp/plugins/songs/lib/importers/openlp.py (+19/-19)
openlp/plugins/songs/lib/importers/openlyrics.py (+18/-18)
openlp/plugins/songs/lib/importers/openoffice.py (+18/-18)
openlp/plugins/songs/lib/importers/opensong.py (+18/-18)
openlp/plugins/songs/lib/importers/opspro.py (+18/-18)
openlp/plugins/songs/lib/importers/powerpraise.py (+18/-18)
openlp/plugins/songs/lib/importers/powersong.py (+20/-20)
openlp/plugins/songs/lib/importers/presentationmanager.py (+20/-20)
openlp/plugins/songs/lib/importers/propresenter.py (+19/-19)
openlp/plugins/songs/lib/importers/songbeamer.py (+20/-20)
openlp/plugins/songs/lib/importers/songimport.py (+22/-21)
openlp/plugins/songs/lib/importers/songpro.py (+19/-19)
openlp/plugins/songs/lib/importers/songshowplus.py (+18/-18)
openlp/plugins/songs/lib/importers/songsoffellowship.py (+18/-18)
openlp/plugins/songs/lib/importers/sundayplus.py (+20/-20)
openlp/plugins/songs/lib/importers/videopsalm.py (+19/-19)
openlp/plugins/songs/lib/importers/wordsofworship.py (+164/-97)
openlp/plugins/songs/lib/importers/worshipassistant.py (+19/-19)
openlp/plugins/songs/lib/importers/worshipcenterpro.py (+18/-18)
openlp/plugins/songs/lib/importers/zionworx.py (+18/-18)
openlp/plugins/songs/lib/mediaitem.py (+67/-62)
openlp/plugins/songs/lib/openlyricsexport.py (+19/-19)
openlp/plugins/songs/lib/openlyricsxml.py (+18/-18)
openlp/plugins/songs/lib/songcompare.py (+18/-18)
openlp/plugins/songs/lib/songselect.py (+43/-23)
openlp/plugins/songs/lib/songstab.py (+91/-56)
openlp/plugins/songs/lib/ui.py (+18/-18)
openlp/plugins/songs/lib/upgrade.py (+21/-21)
openlp/plugins/songs/reporting.py (+19/-26)
openlp/plugins/songs/songsplugin.py (+73/-23)
openlp/plugins/songusage/__init__.py (+18/-18)
openlp/plugins/songusage/forms/__init__.py (+18/-18)
openlp/plugins/songusage/forms/songusagedeletedialog.py (+18/-18)
openlp/plugins/songusage/forms/songusagedeleteform.py (+18/-18)
openlp/plugins/songusage/forms/songusagedetaildialog.py (+18/-18)
openlp/plugins/songusage/forms/songusagedetailform.py (+21/-21)
openlp/plugins/songusage/lib/__init__.py (+18/-18)
openlp/plugins/songusage/lib/db.py (+18/-18)
openlp/plugins/songusage/lib/upgrade.py (+18/-18)
openlp/plugins/songusage/songusageplugin.py (+18/-18)
package.json (+2/-2)
resources/forms/about.ui (+240/-107)
run_openlp.py (+26/-20)
scripts/appveyor-webhook.py (+18/-18)
scripts/appveyor.yml (+18/-18)
scripts/check_dependencies.py (+28/-22)
scripts/clean_up_resources.py (+18/-18)
scripts/generate_resources.sh (+18/-18)
scripts/jenkins_script.py (+18/-18)
scripts/lp-merge.py (+18/-18)
scripts/resources.patch (+18/-18)
scripts/translation_utils.py (+18/-18)
scripts/websocket_client.py (+18/-18)
setup.cfg (+4/-0)
setup.py (+53/-49)
tests/__init__.py (+18/-18)
tests/functional/__init__.py (+18/-18)
tests/functional/openlp_core/__init__.py (+18/-18)
tests/functional/openlp_core/api/__init__.py (+18/-18)
tests/functional/openlp_core/api/endpoint/test_controller.py (+18/-18)
tests/functional/openlp_core/api/endpoint/test_remote.py (+18/-18)
tests/functional/openlp_core/api/http/__init__.py (+18/-18)
tests/functional/openlp_core/api/http/test_error.py (+18/-18)
tests/functional/openlp_core/api/http/test_http.py (+18/-18)
tests/functional/openlp_core/api/http/test_init.py (+18/-18)
tests/functional/openlp_core/api/http/test_wsgiapp.py (+18/-18)
tests/functional/openlp_core/api/test_deploy.py (+26/-25)
tests/functional/openlp_core/api/test_tab.py (+18/-18)
tests/functional/openlp_core/api/test_websockets.py (+18/-18)
tests/functional/openlp_core/common/__init__.py (+18/-18)
tests/functional/openlp_core/common/test_actions.py (+18/-18)
tests/functional/openlp_core/common/test_applocation.py (+19/-19)
tests/functional/openlp_core/common/test_common.py (+23/-23)
tests/functional/openlp_core/common/test_db.py (+18/-18)
tests/functional/openlp_core/common/test_httputils.py (+24/-28)
tests/functional/openlp_core/common/test_i18n.py (+18/-18)
tests/functional/openlp_core/common/test_init.py (+35/-29)
tests/functional/openlp_core/common/test_json.py (+216/-38)
tests/functional/openlp_core/common/test_mixins.py (+18/-18)
tests/functional/openlp_core/common/test_path.py (+33/-208)
tests/functional/openlp_core/common/test_registry.py (+18/-18)
tests/functional/openlp_core/common/test_settings.py (+20/-19)
tests/functional/openlp_core/display/__init__.py (+18/-18)
tests/functional/openlp_core/display/test_render.py (+18/-18)
tests/functional/openlp_core/display/test_screens.py (+18/-18)
tests/functional/openlp_core/lib/__init__.py (+18/-18)
tests/functional/openlp_core/lib/test_db.py (+19/-19)
tests/functional/openlp_core/lib/test_exceptions.py (+18/-18)
tests/functional/openlp_core/lib/test_formattingtags.py (+18/-18)
tests/functional/openlp_core/lib/test_image_manager.py (+20/-20)
tests/functional/openlp_core/lib/test_lib.py (+199/-21)
tests/functional/openlp_core/lib/test_mediamanageritem.py (+18/-18)
tests/functional/openlp_core/lib/test_pluginmanager.py (+18/-18)
tests/functional/openlp_core/lib/test_serviceitem.py (+23/-23)
tests/functional/openlp_core/lib/test_theme.py (+18/-18)
tests/functional/openlp_core/lib/test_ui.py (+18/-18)
tests/functional/openlp_core/test_app.py (+43/-20)
tests/functional/openlp_core/test_server.py (+21/-22)
tests/functional/openlp_core/test_state.py (+18/-18)
tests/functional/openlp_core/test_threading.py (+23/-27)
tests/functional/openlp_core/test_version.py (+18/-18)
tests/functional/openlp_core/ui/__init__.py (+18/-18)
tests/functional/openlp_core/ui/media/__init__.py (+18/-18)
tests/functional/openlp_core/ui/media/test_mediacontroller.py (+61/-41)
tests/functional/openlp_core/ui/media/test_systemplayer.py (+0/-567)
tests/functional/openlp_core/ui/media/test_vlcplayer.py (+109/-159)
tests/functional/openlp_core/ui/test_aboutform.py (+18/-18)
tests/functional/openlp_core/ui/test_advancedtab.py (+18/-18)
tests/functional/openlp_core/ui/test_exceptionform.py (+19/-19)
tests/functional/openlp_core/ui/test_first_time.py (+18/-18)
tests/functional/openlp_core/ui/test_firsttimeform.py (+234/-111)
tests/functional/openlp_core/ui/test_formattingtagscontroller.py (+18/-18)
tests/functional/openlp_core/ui/test_formattingtagsform.py (+18/-18)
tests/functional/openlp_core/ui/test_icons.py (+18/-18)
tests/functional/openlp_core/ui/test_mainwindow.py (+19/-20)
tests/functional/openlp_core/ui/test_media.py (+18/-18)
tests/functional/openlp_core/ui/test_servicemanager.py (+18/-18)
tests/functional/openlp_core/ui/test_settingsform.py (+18/-18)
tests/functional/openlp_core/ui/test_shortcutlistdialog.py (+18/-18)
tests/functional/openlp_core/ui/test_slidecontroller.py (+18/-18)
tests/functional/openlp_core/ui/test_style.py (+18/-18)
tests/functional/openlp_core/ui/test_themeform.py (+19/-19)
tests/functional/openlp_core/ui/test_thememanager.py (+37/-37)
tests/functional/openlp_core/ui/test_themetab.py (+18/-18)
tests/functional/openlp_core/widgets/__init__.py (+18/-18)
tests/functional/openlp_core/widgets/test_buttons.py (+18/-18)
tests/functional/openlp_core/widgets/test_dialogs.py (+22/-1)
tests/functional/openlp_core/widgets/test_edits.py (+19/-19)
tests/functional/openlp_core/widgets/test_views.py (+18/-18)
tests/functional/openlp_core/widgets/test_widgets.py (+18/-18)
tests/functional/openlp_plugins/__init__.py (+18/-18)
tests/functional/openlp_plugins/alerts/__init__.py (+18/-18)
tests/functional/openlp_plugins/alerts/test_manager.py (+18/-18)
tests/functional/openlp_plugins/bibles/__init__.py (+18/-18)
tests/functional/openlp_plugins/bibles/test_bibleimport.py (+19/-19)
tests/functional/openlp_plugins/bibles/test_bibleserver.py (+18/-18)
tests/functional/openlp_plugins/bibles/test_csvimport.py (+20/-21)
tests/functional/openlp_plugins/bibles/test_db.py (+18/-18)
tests/functional/openlp_plugins/bibles/test_lib.py (+18/-18)
tests/functional/openlp_plugins/bibles/test_manager.py (+22/-21)
tests/functional/openlp_plugins/bibles/test_mediaitem.py (+18/-18)
tests/functional/openlp_plugins/bibles/test_opensongimport.py (+18/-18)
tests/functional/openlp_plugins/bibles/test_osisimport.py (+18/-18)
tests/functional/openlp_plugins/bibles/test_swordimport.py (+18/-18)
tests/functional/openlp_plugins/bibles/test_upgrade.py (+18/-18)
tests/functional/openlp_plugins/bibles/test_versereferencelist.py (+18/-18)
tests/functional/openlp_plugins/bibles/test_wordprojectimport.py (+19/-19)
tests/functional/openlp_plugins/bibles/test_zefaniaimport.py (+18/-18)
tests/functional/openlp_plugins/custom/__init__.py (+18/-18)
tests/functional/openlp_plugins/custom/test_mediaitem.py (+18/-18)
tests/functional/openlp_plugins/images/__init__.py (+18/-18)
tests/functional/openlp_plugins/images/test_imagetab.py (+18/-18)
tests/functional/openlp_plugins/images/test_lib.py (+19/-19)
tests/functional/openlp_plugins/images/test_upgrade.py (+19/-19)
tests/functional/openlp_plugins/media/test_mediaitem.py (+19/-19)
tests/functional/openlp_plugins/media/test_mediaplugin.py (+19/-19)
tests/functional/openlp_plugins/presentations/__init__.py (+18/-18)
tests/functional/openlp_plugins/presentations/test_impresscontroller.py (+18/-18)
tests/functional/openlp_plugins/presentations/test_libreofficeserver.py (+948/-0)
tests/functional/openlp_plugins/presentations/test_maclocontroller.py (+453/-0)
tests/functional/openlp_plugins/presentations/test_mediaitem.py (+23/-20)
tests/functional/openlp_plugins/presentations/test_messagelistener.py (+18/-18)
tests/functional/openlp_plugins/presentations/test_pdfcontroller.py (+70/-34)
tests/functional/openlp_plugins/presentations/test_powerpointcontroller.py (+18/-18)
tests/functional/openlp_plugins/presentations/test_pptviewcontroller.py.THIS (+18/-18)
tests/functional/openlp_plugins/presentations/test_presentationcontroller.py (+19/-19)
tests/functional/openlp_plugins/songs/__init__.py (+18/-18)
tests/functional/openlp_plugins/songs/test_chordproimport.py (+18/-18)
tests/functional/openlp_plugins/songs/test_db.py (+18/-18)
tests/functional/openlp_plugins/songs/test_easyslidesimport.py (+19/-18)
tests/functional/openlp_plugins/songs/test_editsongform.py (+18/-18)
tests/functional/openlp_plugins/songs/test_editverseform.py (+18/-18)
tests/functional/openlp_plugins/songs/test_ewimport.py (+18/-18)
tests/functional/openlp_plugins/songs/test_foilpresenterimport.py (+18/-18)
tests/functional/openlp_plugins/songs/test_lib.py (+19/-19)
tests/functional/openlp_plugins/songs/test_lyriximport.py (+19/-18)
tests/functional/openlp_plugins/songs/test_mediaitem.py (+125/-87)
tests/functional/openlp_plugins/songs/test_mediashout.py (+18/-18)
tests/functional/openlp_plugins/songs/test_openlpimporter.py (+24/-24)
tests/functional/openlp_plugins/songs/test_openlyricsexport.py (+21/-20)
tests/functional/openlp_plugins/songs/test_openlyricsimport.py (+18/-18)
tests/functional/openlp_plugins/songs/test_openoffice.py (+18/-18)
tests/functional/openlp_plugins/songs/test_opensongimport.py (+18/-18)
tests/functional/openlp_plugins/songs/test_opsproimport.py (+18/-18)
tests/functional/openlp_plugins/songs/test_powerpraiseimport.py (+18/-18)
tests/functional/openlp_plugins/songs/test_presentationmanagerimport.py (+22/-18)
tests/functional/openlp_plugins/songs/test_propresenterimport.py (+18/-18)
tests/functional/openlp_plugins/songs/test_songbeamerimport.py (+18/-18)
tests/functional/openlp_plugins/songs/test_songformat.py (+18/-18)
tests/functional/openlp_plugins/songs/test_songproimport.py (+18/-18)
tests/functional/openlp_plugins/songs/test_songselect.py (+30/-25)
tests/functional/openlp_plugins/songs/test_songshowplusimport.py (+18/-18)
tests/functional/openlp_plugins/songs/test_sundayplusimport.py (+19/-18)
tests/functional/openlp_plugins/songs/test_videopsalm.py (+19/-18)
tests/functional/openlp_plugins/songs/test_wordsofworshipimport.py (+54/-30)
tests/functional/openlp_plugins/songs/test_worshipassistantimport.py (+18/-18)
tests/functional/openlp_plugins/songs/test_worshipcenterproimport.py (+18/-18)
tests/functional/openlp_plugins/songs/test_zionworximport.py (+18/-18)
tests/functional/openlp_plugins/songusage/__init__.py (+18/-18)
tests/functional/openlp_plugins/songusage/test_songusage.py (+20/-20)
tests/helpers/__init__.py (+18/-18)
tests/helpers/songfileimport.py (+19/-19)
tests/helpers/testmixin.py (+18/-18)
tests/interfaces/__init__.py (+18/-18)
tests/interfaces/openlp_core/__init__.py (+18/-18)
tests/interfaces/openlp_core/api/__init__.py (+18/-18)
tests/interfaces/openlp_core/common/__init__.py (+18/-18)
tests/interfaces/openlp_core/common/test_utils.py (+18/-18)
tests/interfaces/openlp_core/lib/__init__.py (+18/-18)
tests/interfaces/openlp_core/lib/test_pluginmanager.py (+21/-20)
tests/interfaces/openlp_core/ui/__init__.py (+18/-18)
tests/interfaces/openlp_core/ui/lib/__init__.py (+18/-18)
tests/interfaces/openlp_core/ui/test_filerenamedialog.py (+18/-18)
tests/interfaces/openlp_core/ui/test_firsttimeform.py (+88/-0)
tests/interfaces/openlp_core/ui/test_init.py (+18/-18)
tests/interfaces/openlp_core/ui/test_mainwindow.py (+18/-18)
tests/interfaces/openlp_core/ui/test_servicemanager.py (+18/-18)
tests/interfaces/openlp_core/ui/test_servicenotedialog.py (+18/-18)
tests/interfaces/openlp_core/ui/test_settings_form.py (+18/-18)
tests/interfaces/openlp_core/ui/test_shortcutlistform.py (+18/-18)
tests/interfaces/openlp_core/ui/test_starttimedialog.py (+18/-18)
tests/interfaces/openlp_core/ui/test_thememanager.py (+19/-19)
tests/interfaces/openlp_core/widgets/__init__.py (+18/-18)
tests/interfaces/openlp_core/widgets/test_edits.py (+18/-18)
tests/interfaces/openlp_core/widgets/test_views.py (+18/-18)
tests/interfaces/openlp_core/widgets/test_widgets.py (+18/-18)
tests/interfaces/openlp_plugins/__init__.py (+18/-18)
tests/interfaces/openlp_plugins/bibles/__init__.py (+18/-18)
tests/interfaces/openlp_plugins/bibles/forms/__init__.py (+18/-18)
tests/interfaces/openlp_plugins/bibles/forms/test_bibleimportform.py (+18/-18)
tests/interfaces/openlp_plugins/bibles/test_lib_http.py (+18/-18)
tests/interfaces/openlp_plugins/bibles/test_lib_manager.py (+18/-18)
tests/interfaces/openlp_plugins/bibles/test_lib_parse_reference.py (+18/-18)
tests/interfaces/openlp_plugins/custom/__init__.py (+18/-18)
tests/interfaces/openlp_plugins/custom/forms/__init__.py (+18/-18)
tests/interfaces/openlp_plugins/custom/forms/test_customform.py (+18/-18)
tests/interfaces/openlp_plugins/custom/forms/test_customslideform.py (+18/-18)
tests/interfaces/openlp_plugins/images/__init__.py (+18/-18)
tests/interfaces/openlp_plugins/images/forms/test_choosegroupform.py (+18/-18)
tests/interfaces/openlp_plugins/media/__init__.py (+18/-18)
tests/interfaces/openlp_plugins/media/forms/__init__.py (+18/-18)
tests/interfaces/openlp_plugins/media/forms/test_mediaclipselectorform.py (+18/-18)
tests/interfaces/openlp_plugins/songs/__init__.py (+18/-18)
tests/interfaces/openlp_plugins/songs/forms/__init__.py (+18/-18)
tests/interfaces/openlp_plugins/songs/forms/test_authorsform.py (+18/-18)
tests/interfaces/openlp_plugins/songs/forms/test_editsongform.py (+18/-18)
tests/interfaces/openlp_plugins/songs/forms/test_editverseform.py (+18/-18)
tests/interfaces/openlp_plugins/songs/forms/test_songmaintenanceform.py (+20/-20)
tests/interfaces/openlp_plugins/songs/forms/test_topicsform.py (+18/-18)
tests/js/test_display.js (+346/-0)
tests/openlp_core/__init__.py (+18/-18)
tests/openlp_core/common/test_network_interfaces.py (+19/-19)
tests/openlp_core/projectors/__init__.py (+18/-18)
tests/openlp_core/projectors/test_projector_bugfixes_01.py (+23/-23)
tests/openlp_core/projectors/test_projector_command_routing.py (+225/-0)
tests/openlp_core/projectors/test_projector_commands_01.py (+483/-741)
tests/openlp_core/projectors/test_projector_commands_02.py (+550/-0)
tests/openlp_core/projectors/test_projector_commands_03.py (+234/-329)
tests/openlp_core/projectors/test_projector_constants.py (+20/-19)
tests/openlp_core/projectors/test_projector_db.py (+22/-21)
tests/openlp_core/projectors/test_projector_editform.py (+18/-18)
tests/openlp_core/projectors/test_projector_pjlink_base_01.py (+368/-380)
tests/openlp_core/projectors/test_projector_pjlink_base_02.py (+645/-78)
tests/openlp_core/projectors/test_projector_pjlink_base_03.py (+130/-0)
tests/openlp_core/projectors/test_projector_pjlink_cmd_routing.py (+116/-228)
tests/openlp_core/projectors/test_projector_pjlink_udp.py (+18/-19)
tests/openlp_core/projectors/test_projector_sourceform.py (+20/-20)
tests/openlp_core/projectors/test_projector_utilities.py (+18/-18)
tests/openlp_core/projectors/test_projectormanager.py (+18/-18)
tests/openlp_core/ui/test_themeform.py (+23/-19)
tests/resources/projector/data.py (+18/-18)
tests/resources/songs/wordsofworship/Amazing Grace (6 Verses)_v2_1_2.json (+1/-1)
tests/resources/songs/wordsofworship/Holy Holy Holy Lord God Almighty_v2_1_2.json (+1/-1)
tests/resources/songs/wordsofworship/Test_Song_v2_0_0.json (+18/-0)
tests/resources/songs/wordsofworship/Test_Song_v2_1_2.json (+26/-0)
tests/resources/songs/wordsofworship/When morning gilds the skies_v2_0_0.json (+1/-1)
tests/utils/__init__.py (+19/-19)
tests/utils/constants.py (+19/-20)
tests/utils/osdinteraction.py (+18/-18)
tests/utils/test_bzr_tags.py (+23/-20)
tests/utils/test_pylint.py (+18/-18)
To merge this branch: bzr merge lp:~ic90/openlp/animated-alerts
Reviewer Review Type Date Requested Status
Tomas Groth Needs Fixing
Raoul Snyman Needs Fixing
Nico Opiyo Pending
Review via email: mp+363053@code.launchpad.net

This proposal supersedes a proposal from 2019-02-06.

Commit message

Refactored the tests and optimized alert display code plus fixed spacing

Description of the change

Refactored the tests and optimized alert display code plus fixed spacing

JS Test Output is as below:
PhantomJS 2.1.1 (Windows 8.0.0) Display.setTextSlides should correctly set outline width FAILED
        TypeError: undefined is not an object (evaluating 'dom.wrapper.querySelectorAll') in openlp/core/display/html/reveal.js (line 2304)
        slide@openlp/core/display/html/reveal.js:2304:37
        goToSlide@openlp/core/display/html/display.js:712:19
        setTextSlides@openlp/core/display/html/display.js:569:22
        tests/js/test_display.js:365:26
PhantomJS 2.1.1 (Windows 8.0.0): Executed 68 of 68 (1 FAILED) (0 secs / 0.099 secs)
PhantomJS 2.1.1 (Windows 8.0.0): Executed 68 of 68 (1 FAILED) (0.127 secs / 0.099 secs)
TOTAL: 1 FAILED, 67 SUCCESS

To post a comment you must log in.
Revision history for this message
Raoul Snyman (raoul-snyman) wrote : Posted in a previous version of this proposal

See the inline comments.

Also, in your tests you seem to be testing a single style every time, you should be able to combine those into a single test. For example:

   it("should set the correct styles when the location is the top of the page", function(){
       Display.doEntranceTransition("0");
       expect(alertBackground.style.top).toEqual('0px');
       expect(alertBackground.style.transition).toEqual("2s linear");
       expect(alertBackground.style.height).toEqual("25%");
   });

review: Needs Fixing
Revision history for this message
Nico Opiyo (ic90) wrote : Posted in a previous version of this proposal

Javascript Test Output:

PhantomJS 2.1.1 (Windows 8.0.0) Display.setTextSlides should correctly set outline width FAILED
        TypeError: undefined is not an object (evaluating 'dom.wrapper.querySelectorAll') in openlp/core/display/html/reveal.js (line 2304)
        slide@openlp/core/display/html/reveal.js:2304:37
        goToSlide@openlp/core/display/html/display.js:712:19
        setTextSlides@openlp/core/display/html/display.js:569:22
        tests/js/test_display.js:365:26
PhantomJS 2.1.1 (Windows 8.0.0): Executed 68 of 68 (1 FAILED) (0 secs / 0.063 secs)
PhantomJS 2.1.1 (Windows 8.0.0): Executed 68 of 68 (1 FAILED) (0.073 secs / 0.063 secs)
TOTAL: 1 FAILED, 67 SUCCESS

Revision history for this message
Raoul Snyman (raoul-snyman) wrote :

I just actually ran the alerts, and there are some problems :-(

Almost none of the settings in the Settings dialog seem to have any effect on the alerts:

- font isn't applied
- font size is not applied either
- alert duration seems to be ignored
- there's no option to turn off the scrolling

review: Needs Fixing
lp:~ic90/openlp/animated-alerts updated
2867. By Nico Opiyo

Refactored transition code and added settings from alert settings configuration

2868. By Nico Opiyo

Refactored the tests for the alerts to mkae them DRY

2869. By Nico Opiyo

Refactored the hex_to_rgb method in the alerts manager class

2870. By Nico Opiyo

Added queuing functionality to the alerts

2871. By Nico Opiyo

Added a few tests and fixed failing JS tests

2872. By Nico Opiyo

Fixed exit transition bug

2873. By Nico Opiyo

Added scrolling option to alerts

2874. By Nico Opiyo

Fixed tests and refactored event listeners for effective testing

2875. By Nico Opiyo

Fixed buggy alerts and refactored CSS

2876. By Nico Opiyo

Cleaned up Javascript and refactored the functions and tests plus optimized animation of text

2877. By Nico Opiyo

Fixed all tests and changed entrance transition to class based toggling

2878. By Nico Opiyo

Fixed queue bug when showing alerts from the queue

2879. By Nico Opiyo

Fixed alert positioning with CSS flexbox and also fixed non-scrolling alert display

2880. By Nico Opiyo

Pulled in changes from trunk

2881. By Nico Opiyo

Fixed scrolling bug display

Revision history for this message
Tomas Groth (tomasgroth) wrote :

You need to make the merge request against the trunk repo, not webengine-migrate, since that is no longer used.

review: Needs Fixing
lp:~ic90/openlp/animated-alerts updated
2882. By Nico Opiyo

Fixed unit tests for alerts branch

2883. By Nico Opiyo

Pulled in latest changes from trunk

2884. By Nico Opiyo

Changed variable names to camelCase and added parameter for Jenkins JS tests

Unmerged revisions

2884. By Nico Opiyo

Changed variable names to camelCase and added parameter for Jenkins JS tests

2883. By Nico Opiyo

Pulled in latest changes from trunk

2882. By Nico Opiyo

Fixed unit tests for alerts branch

2881. By Nico Opiyo

Fixed scrolling bug display

2880. By Nico Opiyo

Pulled in changes from trunk

2879. By Nico Opiyo

Fixed alert positioning with CSS flexbox and also fixed non-scrolling alert display

2878. By Nico Opiyo

Fixed queue bug when showing alerts from the queue

2877. By Nico Opiyo

Fixed all tests and changed entrance transition to class based toggling

2876. By Nico Opiyo

Cleaned up Javascript and refactored the functions and tests plus optimized animation of text

2875. By Nico Opiyo

Fixed buggy alerts and refactored CSS

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file '.bzrignore'
--- .bzrignore 2018-09-07 06:43:01 +0000
+++ .bzrignore 2019-07-01 17:47:01 +0000
@@ -1,55 +1,48 @@
1*.*~1*.*~
2*.~\?~
3\#*\#
4build
5.cache
6cover
7.coverage
8coverage
9.directory
10dist
11*.dll2*.dll
12documentation/build/doctrees
13documentation/build/html
14*.e4*3*.e4*
15*eric[1-9]project
16.git
17# Git files
18.gitignore
19htmlcov
20.idea
21*.kate-swp4*.kate-swp
22*.kdev45*.kdev4
23.kdev4
24*.komodoproject6*.komodoproject
25.komodotools
26list
27*.log*7*.log*
28*.nja8*.nja
29openlp.cfg
30openlp/core/resources.py.old
31OpenLP.egg-info
32openlp.org 2.0.e4*
33openlp.pro
34openlp-test-projectordb.sqlite
35*.orig9*.orig
36output
37*.pyc10*.pyc
38__pycache__
39.pylint.d
40.pytest_cache
41*.qm11*.qm
42*.rej12*.rej
43# Rejected diff's
44resources/innosetup/Output
45resources/windows/warnOpenLP.txt
46*.ropeproject13*.ropeproject
47tags14*.~\?~
48output15*eric[1-9]project
16.cache
17.coverage
18.directory
19.git
20.gitignore
21.idea
22.kdev4
23.komodotools
24.pylint.d
25.pytest_cache
26.vscode
27OpenLP.egg-info
28\#*\#
29__pycache__
30build
31cover
32coverage
33dist
34env
49htmlcov35htmlcov
36list
50node_modules37node_modules
51openlp-test-projectordb.sqlite38openlp-test-projectordb.sqlite
39openlp.cfg
40openlp.pro
41openlp/core/resources.py.old
42openlp/plugins/presentations/lib/vendor/Pyro4
43openlp/plugins/presentations/lib/vendor/serpent.py
44output
52package-lock.json45package-lock.json
53.cache46tags
54test47test
55tests.kdev448tests.kdev4
5649
=== modified file 'LICENSE'
--- LICENSE 2011-02-24 05:47:38 +0000
+++ LICENSE 2019-07-01 17:47:01 +0000
@@ -1,285 +1,626 @@
1 GNU GENERAL PUBLIC LICENSE1 GNU GENERAL PUBLIC LICENSE
2 Version 2, June 19912 Version 3, 29 June 2007
33
4 Copyright (C) 1989, 1991 Free Software Foundation, Inc.,4 Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
5 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6 Everyone is permitted to copy and distribute verbatim copies5 Everyone is permitted to copy and distribute verbatim copies
7 of this license document, but changing it is not allowed.6 of this license document, but changing it is not allowed.
87
9 Preamble8 Preamble
109
11 The licenses for most software are designed to take away your10 The GNU General Public License is a free, copyleft license for
12freedom to share and change it. By contrast, the GNU General Public11software and other kinds of works.
13License is intended to guarantee your freedom to share and change free12
14software--to make sure the software is free for all its users. This13 The licenses for most software and other practical works are designed
15General Public License applies to most of the Free Software14to take away your freedom to share and change the works. By contrast,
16Foundation's software and to any other program whose authors commit to15the GNU General Public License is intended to guarantee your freedom to
17using it. (Some other Free Software Foundation software is covered by16share and change all versions of a program--to make sure it remains free
18the GNU Lesser General Public License instead.) You can apply it to17software for all its users. We, the Free Software Foundation, use the
18GNU General Public License for most of our software; it applies also to
19any other work released this way by its authors. You can apply it to
19your programs, too.20your programs, too.
2021
21 When we speak of free software, we are referring to freedom, not22 When we speak of free software, we are referring to freedom, not
22price. Our General Public Licenses are designed to make sure that you23price. Our General Public Licenses are designed to make sure that you
23have the freedom to distribute copies of free software (and charge for24have the freedom to distribute copies of free software (and charge for
24this service if you wish), that you receive source code or can get it25them if you wish), that you receive source code or can get it if you
25if you want it, that you can change the software or use pieces of it26want it, that you can change the software or use pieces of it in new
26in new free programs; and that you know you can do these things.27free programs, and that you know you can do these things.
2728
28 To protect your rights, we need to make restrictions that forbid29 To protect your rights, we need to prevent others from denying you
29anyone to deny you these rights or to ask you to surrender the rights.30these rights or asking you to surrender the rights. Therefore, you have
30These restrictions translate to certain responsibilities for you if you31certain responsibilities if you distribute copies of the software, or if
31distribute copies of the software, or if you modify it.32you modify it: responsibilities to respect the freedom of others.
3233
33 For example, if you distribute copies of such a program, whether34 For example, if you distribute copies of such a program, whether
34gratis or for a fee, you must give the recipients all the rights that35gratis or for a fee, you must pass on to the recipients the same
35you have. You must make sure that they, too, receive or can get the36freedoms that you received. You must make sure that they, too, receive
36source code. And you must show them these terms so they know their37or can get the source code. And you must show them these terms so they
37rights.38know their rights.
3839
39 We protect your rights with two steps: (1) copyright the software, and40 Developers that use the GNU GPL protect your rights with two steps:
40(2) offer you this license which gives you legal permission to copy,41(1) assert copyright on the software, and (2) offer you this License
41distribute and/or modify the software.42giving you legal permission to copy, distribute and/or modify it.
4243
43 Also, for each author's protection and ours, we want to make certain44 For the developers' and authors' protection, the GPL clearly explains
44that everyone understands that there is no warranty for this free45that there is no warranty for this free software. For both users' and
45software. If the software is modified by someone else and passed on, we46authors' sake, the GPL requires that modified versions be marked as
46want its recipients to know that what they have is not the original, so47changed, so that their problems will not be attributed erroneously to
47that any problems introduced by others will not reflect on the original48authors of previous versions.
48authors' reputations.49
4950 Some devices are designed to deny users access to install or run
50 Finally, any free program is threatened constantly by software51modified versions of the software inside them, although the manufacturer
51patents. We wish to avoid the danger that redistributors of a free52can do so. This is fundamentally incompatible with the aim of
52program will individually obtain patent licenses, in effect making the53protecting users' freedom to change the software. The systematic
53program proprietary. To prevent this, we have made it clear that any54pattern of such abuse occurs in the area of products for individuals to
54patent must be licensed for everyone's free use or not licensed at all.55use, which is precisely where it is most unacceptable. Therefore, we
56have designed this version of the GPL to prohibit the practice for those
57products. If such problems arise substantially in other domains, we
58stand ready to extend this provision to those domains in future versions
59of the GPL, as needed to protect the freedom of users.
60
61 Finally, every program is threatened constantly by software patents.
62States should not allow patents to restrict development and use of
63software on general-purpose computers, but in those that do, we wish to
64avoid the special danger that patents applied to a free program could
65make it effectively proprietary. To prevent this, the GPL assures that
66patents cannot be used to render the program non-free.
5567
56 The precise terms and conditions for copying, distribution and68 The precise terms and conditions for copying, distribution and
57modification follow.69modification follow.
5870
59 GNU GENERAL PUBLIC LICENSE71 TERMS AND CONDITIONS
60 TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION72
6173 0. Definitions.
62 0. This License applies to any program or other work which contains74
63a notice placed by the copyright holder saying it may be distributed75 "This License" refers to version 3 of the GNU General Public License.
64under the terms of this General Public License. The "Program", below,76
65refers to any such program or work, and a "work based on the Program"77 "Copyright" also means copyright-like laws that apply to other kinds of
66means either the Program or any derivative work under copyright law:78works, such as semiconductor masks.
67that is to say, a work containing the Program or a portion of it,79
68either verbatim or with modifications and/or translated into another80 "The Program" refers to any copyrightable work licensed under this
69language. (Hereinafter, translation is included without limitation in81License. Each licensee is addressed as "you". "Licensees" and
70the term "modification".) Each licensee is addressed as "you".82"recipients" may be individuals or organizations.
7183
72Activities other than copying, distribution and modification are not84 To "modify" a work means to copy from or adapt all or part of the work
73covered by this License; they are outside its scope. The act of85in a fashion requiring copyright permission, other than the making of an
74running the Program is not restricted, and the output from the Program86exact copy. The resulting work is called a "modified version" of the
75is covered only if its contents constitute a work based on the87earlier work or a work "based on" the earlier work.
76Program (independent of having been made by running the Program).88
77Whether that is true depends on what the Program does.89 A "covered work" means either the unmodified Program or a work based
7890on the Program.
79 1. You may copy and distribute verbatim copies of the Program's91
80source code as you receive it, in any medium, provided that you92 To "propagate" a work means to do anything with it that, without
81conspicuously and appropriately publish on each copy an appropriate93permission, would make you directly or secondarily liable for
82copyright notice and disclaimer of warranty; keep intact all the94infringement under applicable copyright law, except executing it on a
83notices that refer to this License and to the absence of any warranty;95computer or modifying a private copy. Propagation includes copying,
84and give any other recipients of the Program a copy of this License96distribution (with or without modification), making available to the
85along with the Program.97public, and in some countries other activities as well.
8698
87You may charge a fee for the physical act of transferring a copy, and99 To "convey" a work means any kind of propagation that enables other
88you may at your option offer warranty protection in exchange for a fee.100parties to make or receive copies. Mere interaction with a user through
89101a computer network, with no transfer of a copy, is not conveying.
90 2. You may modify your copy or copies of the Program or any portion102
91of it, thus forming a work based on the Program, and copy and103 An interactive user interface displays "Appropriate Legal Notices"
92distribute such modifications or work under the terms of Section 1104to the extent that it includes a convenient and prominently visible
93above, provided that you also meet all of these conditions:105feature that (1) displays an appropriate copyright notice, and (2)
94106tells the user that there is no warranty for the work (except to the
95 a) You must cause the modified files to carry prominent notices107extent that warranties are provided), that licensees may convey the
96 stating that you changed the files and the date of any change.108work under this License, and how to view a copy of this License. If
97109the interface presents a list of user commands or options, such as a
98 b) You must cause any work that you distribute or publish, that in110menu, a prominent item in the list meets this criterion.
99 whole or in part contains or is derived from the Program or any111
100 part thereof, to be licensed as a whole at no charge to all third112 1. Source Code.
101 parties under the terms of this License.113
102114 The "source code" for a work means the preferred form of the work
103 c) If the modified program normally reads commands interactively115for making modifications to it. "Object code" means any non-source
104 when run, you must cause it, when started running for such116form of a work.
105 interactive use in the most ordinary way, to print or display an117
106 announcement including an appropriate copyright notice and a118 A "Standard Interface" means an interface that either is an official
107 notice that there is no warranty (or else, saying that you provide119standard defined by a recognized standards body, or, in the case of
108 a warranty) and that users may redistribute the program under120interfaces specified for a particular programming language, one that
109 these conditions, and telling the user how to view a copy of this121is widely used among developers working in that language.
110 License. (Exception: if the Program itself is interactive but122
111 does not normally print such an announcement, your work based on123 The "System Libraries" of an executable work include anything, other
112 the Program is not required to print an announcement.)124than the work as a whole, that (a) is included in the normal form of
113125packaging a Major Component, but which is not part of that Major
114These requirements apply to the modified work as a whole. If126Component, and (b) serves only to enable use of the work with that
115identifiable sections of that work are not derived from the Program,127Major Component, or to implement a Standard Interface for which an
116and can be reasonably considered independent and separate works in128implementation is available to the public in source code form. A
117themselves, then this License, and its terms, do not apply to those129"Major Component", in this context, means a major essential component
118sections when you distribute them as separate works. But when you130(kernel, window system, and so on) of the specific operating system
119distribute the same sections as part of a whole which is a work based131(if any) on which the executable work runs, or a compiler used to
120on the Program, the distribution of the whole must be on the terms of132produce the work, or an object code interpreter used to run it.
121this License, whose permissions for other licensees extend to the133
122entire whole, and thus to each and every part regardless of who wrote it.134 The "Corresponding Source" for a work in object code form means all
123135the source code needed to generate, install, and (for an executable
124Thus, it is not the intent of this section to claim rights or contest136work) run the object code and to modify the work, including scripts to
125your rights to work written entirely by you; rather, the intent is to137control those activities. However, it does not include the work's
126exercise the right to control the distribution of derivative or138System Libraries, or general-purpose tools or generally available free
127collective works based on the Program.139programs which are used unmodified in performing those activities but
128140which are not part of the work. For example, Corresponding Source
129In addition, mere aggregation of another work not based on the Program141includes interface definition files associated with source files for
130with the Program (or with a work based on the Program) on a volume of142the work, and the source code for shared libraries and dynamically
131a storage or distribution medium does not bring the other work under143linked subprograms that the work is specifically designed to require,
132the scope of this License.144such as by intimate data communication or control flow between those
133145subprograms and other parts of the work.
134 3. You may copy and distribute the Program (or a work based on it,146
135under Section 2) in object code or executable form under the terms of147 The Corresponding Source need not include anything that users
136Sections 1 and 2 above provided that you also do one of the following:148can regenerate automatically from other parts of the Corresponding
137149Source.
138 a) Accompany it with the complete corresponding machine-readable150
139 source code, which must be distributed under the terms of Sections151 The Corresponding Source for a work in source code form is that
140 1 and 2 above on a medium customarily used for software interchange; or,152same work.
141153
142 b) Accompany it with a written offer, valid for at least three154 2. Basic Permissions.
143 years, to give any third party, for a charge no more than your155
144 cost of physically performing source distribution, a complete156 All rights granted under this License are granted for the term of
145 machine-readable copy of the corresponding source code, to be157copyright on the Program, and are irrevocable provided the stated
146 distributed under the terms of Sections 1 and 2 above on a medium158conditions are met. This License explicitly affirms your unlimited
147 customarily used for software interchange; or,159permission to run the unmodified Program. The output from running a
148160covered work is covered by this License only if the output, given its
149 c) Accompany it with the information you received as to the offer161content, constitutes a covered work. This License acknowledges your
150 to distribute corresponding source code. (This alternative is162rights of fair use or other equivalent, as provided by copyright law.
151 allowed only for noncommercial distribution and only if you163
152 received the program in object code or executable form with such164 You may make, run and propagate covered works that you do not
153 an offer, in accord with Subsection b above.)165convey, without conditions so long as your license otherwise remains
154166in force. You may convey covered works to others for the sole purpose
155The source code for a work means the preferred form of the work for167of having them make modifications exclusively for you, or provide you
156making modifications to it. For an executable work, complete source168with facilities for running those works, provided that you comply with
157code means all the source code for all modules it contains, plus any169the terms of this License in conveying all material for which you do
158associated interface definition files, plus the scripts used to170not control copyright. Those thus making or running the covered works
159control compilation and installation of the executable. However, as a171for you must do so exclusively on your behalf, under your direction
160special exception, the source code distributed need not include172and control, on terms that prohibit them from making any copies of
161anything that is normally distributed (in either source or binary173your copyrighted material outside their relationship with you.
162form) with the major components (compiler, kernel, and so on) of the174
163operating system on which the executable runs, unless that component175 Conveying under any other circumstances is permitted solely under
164itself accompanies the executable.176the conditions stated below. Sublicensing is not allowed; section 10
165177makes it unnecessary.
166If distribution of executable or object code is made by offering178
167access to copy from a designated place, then offering equivalent179 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
168access to copy the source code from the same place counts as180
169distribution of the source code, even though third parties are not181 No covered work shall be deemed part of an effective technological
170compelled to copy the source along with the object code.182measure under any applicable law fulfilling obligations under article
17118311 of the WIPO copyright treaty adopted on 20 December 1996, or
172 4. You may not copy, modify, sublicense, or distribute the Program184similar laws prohibiting or restricting circumvention of such
173except as expressly provided under this License. Any attempt185measures.
174otherwise to copy, modify, sublicense or distribute the Program is186
175void, and will automatically terminate your rights under this License.187 When you convey a covered work, you waive any legal power to forbid
176However, parties who have received copies, or rights, from you under188circumvention of technological measures to the extent such circumvention
177this License will not have their licenses terminated so long as such189is effected by exercising rights under this License with respect to
178parties remain in full compliance.190the covered work, and you disclaim any intention to limit operation or
179191modification of the work as a means of enforcing, against the work's
180 5. You are not required to accept this License, since you have not192users, your or third parties' legal rights to forbid circumvention of
181signed it. However, nothing else grants you permission to modify or193technological measures.
182distribute the Program or its derivative works. These actions are194
183prohibited by law if you do not accept this License. Therefore, by195 4. Conveying Verbatim Copies.
184modifying or distributing the Program (or any work based on the196
185Program), you indicate your acceptance of this License to do so, and197 You may convey verbatim copies of the Program's source code as you
186all its terms and conditions for copying, distributing or modifying198receive it, in any medium, provided that you conspicuously and
187the Program or works based on it.199appropriately publish on each copy an appropriate copyright notice;
188200keep intact all notices stating that this License and any
189 6. Each time you redistribute the Program (or any work based on the201non-permissive terms added in accord with section 7 apply to the code;
190Program), the recipient automatically receives a license from the202keep intact all notices of the absence of any warranty; and give all
191original licensor to copy, distribute or modify the Program subject to203recipients a copy of this License along with the Program.
192these terms and conditions. You may not impose any further204
193restrictions on the recipients' exercise of the rights granted herein.205 You may charge any price or no price for each copy that you convey,
194You are not responsible for enforcing compliance by third parties to206and you may offer support or warranty protection for a fee.
207
208 5. Conveying Modified Source Versions.
209
210 You may convey a work based on the Program, or the modifications to
211produce it from the Program, in the form of source code under the
212terms of section 4, provided that you also meet all of these conditions:
213
214 a) The work must carry prominent notices stating that you modified
215 it, and giving a relevant date.
216
217 b) The work must carry prominent notices stating that it is
218 released under this License and any conditions added under section
219 7. This requirement modifies the requirement in section 4 to
220 "keep intact all notices".
221
222 c) You must license the entire work, as a whole, under this
223 License to anyone who comes into possession of a copy. This
224 License will therefore apply, along with any applicable section 7
225 additional terms, to the whole of the work, and all its parts,
226 regardless of how they are packaged. This License gives no
227 permission to license the work in any other way, but it does not
228 invalidate such permission if you have separately received it.
229
230 d) If the work has interactive user interfaces, each must display
231 Appropriate Legal Notices; however, if the Program has interactive
232 interfaces that do not display Appropriate Legal Notices, your
233 work need not make them do so.
234
235 A compilation of a covered work with other separate and independent
236works, which are not by their nature extensions of the covered work,
237and which are not combined with it such as to form a larger program,
238in or on a volume of a storage or distribution medium, is called an
239"aggregate" if the compilation and its resulting copyright are not
240used to limit the access or legal rights of the compilation's users
241beyond what the individual works permit. Inclusion of a covered work
242in an aggregate does not cause this License to apply to the other
243parts of the aggregate.
244
245 6. Conveying Non-Source Forms.
246
247 You may convey a covered work in object code form under the terms
248of sections 4 and 5, provided that you also convey the
249machine-readable Corresponding Source under the terms of this License,
250in one of these ways:
251
252 a) Convey the object code in, or embodied in, a physical product
253 (including a physical distribution medium), accompanied by the
254 Corresponding Source fixed on a durable physical medium
255 customarily used for software interchange.
256
257 b) Convey the object code in, or embodied in, a physical product
258 (including a physical distribution medium), accompanied by a
259 written offer, valid for at least three years and valid for as
260 long as you offer spare parts or customer support for that product
261 model, to give anyone who possesses the object code either (1) a
262 copy of the Corresponding Source for all the software in the
263 product that is covered by this License, on a durable physical
264 medium customarily used for software interchange, for a price no
265 more than your reasonable cost of physically performing this
266 conveying of source, or (2) access to copy the
267 Corresponding Source from a network server at no charge.
268
269 c) Convey individual copies of the object code with a copy of the
270 written offer to provide the Corresponding Source. This
271 alternative is allowed only occasionally and noncommercially, and
272 only if you received the object code with such an offer, in accord
273 with subsection 6b.
274
275 d) Convey the object code by offering access from a designated
276 place (gratis or for a charge), and offer equivalent access to the
277 Corresponding Source in the same way through the same place at no
278 further charge. You need not require recipients to copy the
279 Corresponding Source along with the object code. If the place to
280 copy the object code is a network server, the Corresponding Source
281 may be on a different server (operated by you or a third party)
282 that supports equivalent copying facilities, provided you maintain
283 clear directions next to the object code saying where to find the
284 Corresponding Source. Regardless of what server hosts the
285 Corresponding Source, you remain obligated to ensure that it is
286 available for as long as needed to satisfy these requirements.
287
288 e) Convey the object code using peer-to-peer transmission, provided
289 you inform other peers where the object code and Corresponding
290 Source of the work are being offered to the general public at no
291 charge under subsection 6d.
292
293 A separable portion of the object code, whose source code is excluded
294from the Corresponding Source as a System Library, need not be
295included in conveying the object code work.
296
297 A "User Product" is either (1) a "consumer product", which means any
298tangible personal property which is normally used for personal, family,
299or household purposes, or (2) anything designed or sold for incorporation
300into a dwelling. In determining whether a product is a consumer product,
301doubtful cases shall be resolved in favor of coverage. For a particular
302product received by a particular user, "normally used" refers to a
303typical or common use of that class of product, regardless of the status
304of the particular user or of the way in which the particular user
305actually uses, or expects or is expected to use, the product. A product
306is a consumer product regardless of whether the product has substantial
307commercial, industrial or non-consumer uses, unless such uses represent
308the only significant mode of use of the product.
309
310 "Installation Information" for a User Product means any methods,
311procedures, authorization keys, or other information required to install
312and execute modified versions of a covered work in that User Product from
313a modified version of its Corresponding Source. The information must
314suffice to ensure that the continued functioning of the modified object
315code is in no case prevented or interfered with solely because
316modification has been made.
317
318 If you convey an object code work under this section in, or with, or
319specifically for use in, a User Product, and the conveying occurs as
320part of a transaction in which the right of possession and use of the
321User Product is transferred to the recipient in perpetuity or for a
322fixed term (regardless of how the transaction is characterized), the
323Corresponding Source conveyed under this section must be accompanied
324by the Installation Information. But this requirement does not apply
325if neither you nor any third party retains the ability to install
326modified object code on the User Product (for example, the work has
327been installed in ROM).
328
329 The requirement to provide Installation Information does not include a
330requirement to continue to provide support service, warranty, or updates
331for a work that has been modified or installed by the recipient, or for
332the User Product in which it has been modified or installed. Access to a
333network may be denied when the modification itself materially and
334adversely affects the operation of the network or violates the rules and
335protocols for communication across the network.
336
337 Corresponding Source conveyed, and Installation Information provided,
338in accord with this section must be in a format that is publicly
339documented (and with an implementation available to the public in
340source code form), and must require no special password or key for
341unpacking, reading or copying.
342
343 7. Additional Terms.
344
345 "Additional permissions" are terms that supplement the terms of this
346License by making exceptions from one or more of its conditions.
347Additional permissions that are applicable to the entire Program shall
348be treated as though they were included in this License, to the extent
349that they are valid under applicable law. If additional permissions
350apply only to part of the Program, that part may be used separately
351under those permissions, but the entire Program remains governed by
352this License without regard to the additional permissions.
353
354 When you convey a copy of a covered work, you may at your option
355remove any additional permissions from that copy, or from any part of
356it. (Additional permissions may be written to require their own
357removal in certain cases when you modify the work.) You may place
358additional permissions on material, added by you to a covered work,
359for which you have or can give appropriate copyright permission.
360
361 Notwithstanding any other provision of this License, for material you
362add to a covered work, you may (if authorized by the copyright holders of
363that material) supplement the terms of this License with terms:
364
365 a) Disclaiming warranty or limiting liability differently from the
366 terms of sections 15 and 16 of this License; or
367
368 b) Requiring preservation of specified reasonable legal notices or
369 author attributions in that material or in the Appropriate Legal
370 Notices displayed by works containing it; or
371
372 c) Prohibiting misrepresentation of the origin of that material, or
373 requiring that modified versions of such material be marked in
374 reasonable ways as different from the original version; or
375
376 d) Limiting the use for publicity purposes of names of licensors or
377 authors of the material; or
378
379 e) Declining to grant rights under trademark law for use of some
380 trade names, trademarks, or service marks; or
381
382 f) Requiring indemnification of licensors and authors of that
383 material by anyone who conveys the material (or modified versions of
384 it) with contractual assumptions of liability to the recipient, for
385 any liability that these contractual assumptions directly impose on
386 those licensors and authors.
387
388 All other non-permissive additional terms are considered "further
389restrictions" within the meaning of section 10. If the Program as you
390received it, or any part of it, contains a notice stating that it is
391governed by this License along with a term that is a further
392restriction, you may remove that term. If a license document contains
393a further restriction but permits relicensing or conveying under this
394License, you may add to a covered work material governed by the terms
395of that license document, provided that the further restriction does
396not survive such relicensing or conveying.
397
398 If you add terms to a covered work in accord with this section, you
399must place, in the relevant source files, a statement of the
400additional terms that apply to those files, or a notice indicating
401where to find the applicable terms.
402
403 Additional terms, permissive or non-permissive, may be stated in the
404form of a separately written license, or stated as exceptions;
405the above requirements apply either way.
406
407 8. Termination.
408
409 You may not propagate or modify a covered work except as expressly
410provided under this License. Any attempt otherwise to propagate or
411modify it is void, and will automatically terminate your rights under
412this License (including any patent licenses granted under the third
413paragraph of section 11).
414
415 However, if you cease all violation of this License, then your
416license from a particular copyright holder is reinstated (a)
417provisionally, unless and until the copyright holder explicitly and
418finally terminates your license, and (b) permanently, if the copyright
419holder fails to notify you of the violation by some reasonable means
420prior to 60 days after the cessation.
421
422 Moreover, your license from a particular copyright holder is
423reinstated permanently if the copyright holder notifies you of the
424violation by some reasonable means, this is the first time you have
425received notice of violation of this License (for any work) from that
426copyright holder, and you cure the violation prior to 30 days after
427your receipt of the notice.
428
429 Termination of your rights under this section does not terminate the
430licenses of parties who have received copies or rights from you under
431this License. If your rights have been terminated and not permanently
432reinstated, you do not qualify to receive new licenses for the same
433material under section 10.
434
435 9. Acceptance Not Required for Having Copies.
436
437 You are not required to accept this License in order to receive or
438run a copy of the Program. Ancillary propagation of a covered work
439occurring solely as a consequence of using peer-to-peer transmission
440to receive a copy likewise does not require acceptance. However,
441nothing other than this License grants you permission to propagate or
442modify any covered work. These actions infringe copyright if you do
443not accept this License. Therefore, by modifying or propagating a
444covered work, you indicate your acceptance of this License to do so.
445
446 10. Automatic Licensing of Downstream Recipients.
447
448 Each time you convey a covered work, the recipient automatically
449receives a license from the original licensors, to run, modify and
450propagate that work, subject to this License. You are not responsible
451for enforcing compliance by third parties with this License.
452
453 An "entity transaction" is a transaction transferring control of an
454organization, or substantially all assets of one, or subdividing an
455organization, or merging organizations. If propagation of a covered
456work results from an entity transaction, each party to that
457transaction who receives a copy of the work also receives whatever
458licenses to the work the party's predecessor in interest had or could
459give under the previous paragraph, plus a right to possession of the
460Corresponding Source of the work from the predecessor in interest, if
461the predecessor has it or can get it with reasonable efforts.
462
463 You may not impose any further restrictions on the exercise of the
464rights granted or affirmed under this License. For example, you may
465not impose a license fee, royalty, or other charge for exercise of
466rights granted under this License, and you may not initiate litigation
467(including a cross-claim or counterclaim in a lawsuit) alleging that
468any patent claim is infringed by making, using, selling, offering for
469sale, or importing the Program or any portion of it.
470
471 11. Patents.
472
473 A "contributor" is a copyright holder who authorizes use under this
474License of the Program or a work on which the Program is based. The
475work thus licensed is called the contributor's "contributor version".
476
477 A contributor's "essential patent claims" are all patent claims
478owned or controlled by the contributor, whether already acquired or
479hereafter acquired, that would be infringed by some manner, permitted
480by this License, of making, using, or selling its contributor version,
481but do not include claims that would be infringed only as a
482consequence of further modification of the contributor version. For
483purposes of this definition, "control" includes the right to grant
484patent sublicenses in a manner consistent with the requirements of
195this License.485this License.
196486
197 7. If, as a consequence of a court judgment or allegation of patent487 Each contributor grants you a non-exclusive, worldwide, royalty-free
198infringement or for any other reason (not limited to patent issues),488patent license under the contributor's essential patent claims, to
199conditions are imposed on you (whether by court order, agreement or489make, use, sell, offer for sale, import and otherwise run, modify and
490propagate the contents of its contributor version.
491
492 In the following three paragraphs, a "patent license" is any express
493agreement or commitment, however denominated, not to enforce a patent
494(such as an express permission to practice a patent or covenant not to
495sue for patent infringement). To "grant" such a patent license to a
496party means to make such an agreement or commitment not to enforce a
497patent against the party.
498
499 If you convey a covered work, knowingly relying on a patent license,
500and the Corresponding Source of the work is not available for anyone
501to copy, free of charge and under the terms of this License, through a
502publicly available network server or other readily accessible means,
503then you must either (1) cause the Corresponding Source to be so
504available, or (2) arrange to deprive yourself of the benefit of the
505patent license for this particular work, or (3) arrange, in a manner
506consistent with the requirements of this License, to extend the patent
507license to downstream recipients. "Knowingly relying" means you have
508actual knowledge that, but for the patent license, your conveying the
509covered work in a country, or your recipient's use of the covered work
510in a country, would infringe one or more identifiable patents in that
511country that you have reason to believe are valid.
512
513 If, pursuant to or in connection with a single transaction or
514arrangement, you convey, or propagate by procuring conveyance of, a
515covered work, and grant a patent license to some of the parties
516receiving the covered work authorizing them to use, propagate, modify
517or convey a specific copy of the covered work, then the patent license
518you grant is automatically extended to all recipients of the covered
519work and works based on it.
520
521 A patent license is "discriminatory" if it does not include within
522the scope of its coverage, prohibits the exercise of, or is
523conditioned on the non-exercise of one or more of the rights that are
524specifically granted under this License. You may not convey a covered
525work if you are a party to an arrangement with a third party that is
526in the business of distributing software, under which you make payment
527to the third party based on the extent of your activity of conveying
528the work, and under which the third party grants, to any of the
529parties who would receive the covered work from you, a discriminatory
530patent license (a) in connection with copies of the covered work
531conveyed by you (or copies made from those copies), or (b) primarily
532for and in connection with specific products or compilations that
533contain the covered work, unless you entered into that arrangement,
534or that patent license was granted, prior to 28 March 2007.
535
536 Nothing in this License shall be construed as excluding or limiting
537any implied license or other defenses to infringement that may
538otherwise be available to you under applicable patent law.
539
540 12. No Surrender of Others' Freedom.
541
542 If conditions are imposed on you (whether by court order, agreement or
200otherwise) that contradict the conditions of this License, they do not543otherwise) that contradict the conditions of this License, they do not
201excuse you from the conditions of this License. If you cannot544excuse you from the conditions of this License. If you cannot convey a
202distribute so as to satisfy simultaneously your obligations under this545covered work so as to satisfy simultaneously your obligations under this
203License and any other pertinent obligations, then as a consequence you546License and any other pertinent obligations, then as a consequence you may
204may not distribute the Program at all. For example, if a patent547not convey it at all. For example, if you agree to terms that obligate you
205license would not permit royalty-free redistribution of the Program by548to collect a royalty for further conveying from those to whom you convey
206all those who receive copies directly or indirectly through you, then549the Program, the only way you could satisfy both those terms and this
207the only way you could satisfy both it and this License would be to550License would be to refrain entirely from conveying the Program.
208refrain entirely from distribution of the Program.551
209552 13. Use with the GNU Affero General Public License.
210If any portion of this section is held invalid or unenforceable under553
211any particular circumstance, the balance of the section is intended to554 Notwithstanding any other provision of this License, you have
212apply and the section as a whole is intended to apply in other555permission to link or combine any covered work with a work licensed
213circumstances.556under version 3 of the GNU Affero General Public License into a single
214557combined work, and to convey the resulting work. The terms of this
215It is not the purpose of this section to induce you to infringe any558License will continue to apply to the part which is the covered work,
216patents or other property right claims or to contest validity of any559but the special requirements of the GNU Affero General Public License,
217such claims; this section has the sole purpose of protecting the560section 13, concerning interaction through a network will apply to the
218integrity of the free software distribution system, which is561combination as such.
219implemented by public license practices. Many people have made562
220generous contributions to the wide range of software distributed563 14. Revised Versions of this License.
221through that system in reliance on consistent application of that564
222system; it is up to the author/donor to decide if he or she is willing565 The Free Software Foundation may publish revised and/or new versions of
223to distribute software through any other system and a licensee cannot566the GNU General Public License from time to time. Such new versions will
224impose that choice.
225
226This section is intended to make thoroughly clear what is believed to
227be a consequence of the rest of this License.
228
229 8. If the distribution and/or use of the Program is restricted in
230certain countries either by patents or by copyrighted interfaces, the
231original copyright holder who places the Program under this License
232may add an explicit geographical distribution limitation excluding
233those countries, so that distribution is permitted only in or among
234countries not thus excluded. In such case, this License incorporates
235the limitation as if written in the body of this License.
236
237 9. The Free Software Foundation may publish revised and/or new versions
238of the General Public License from time to time. Such new versions will
239be similar in spirit to the present version, but may differ in detail to567be similar in spirit to the present version, but may differ in detail to
240address new problems or concerns.568address new problems or concerns.
241569
242Each version is given a distinguishing version number. If the Program570 Each version is given a distinguishing version number. If the
243specifies a version number of this License which applies to it and "any571Program specifies that a certain numbered version of the GNU General
244later version", you have the option of following the terms and conditions572Public License "or any later version" applies to it, you have the
245either of that version or of any later version published by the Free573option of following the terms and conditions either of that numbered
246Software Foundation. If the Program does not specify a version number of574version or of any later version published by the Free Software
247this License, you may choose any version ever published by the Free Software575Foundation. If the Program does not specify a version number of the
248Foundation.576GNU General Public License, you may choose any version ever published
249577by the Free Software Foundation.
250 10. If you wish to incorporate parts of the Program into other free578
251programs whose distribution conditions are different, write to the author579 If the Program specifies that a proxy can decide which future
252to ask for permission. For software which is copyrighted by the Free580versions of the GNU General Public License can be used, that proxy's
253Software Foundation, write to the Free Software Foundation; we sometimes581public statement of acceptance of a version permanently authorizes you
254make exceptions for this. Our decision will be guided by the two goals582to choose that version for the Program.
255of preserving the free status of all derivatives of our free software and583
256of promoting the sharing and reuse of software generally.584 Later license versions may give you additional or different
257585permissions. However, no additional obligations are imposed on any
258 NO WARRANTY586author or copyright holder as a result of your choosing to follow a
259587later version.
260 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY588
261FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN589 15. Disclaimer of Warranty.
262OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES590
263PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED591 THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
264OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF592APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
265MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS593HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
266TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE594OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
267PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,595THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
268REPAIR OR CORRECTION.596PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
269597IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
270 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING598ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
271WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR599
272REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,600 16. Limitation of Liability.
273INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING601
274OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED602 IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
275TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY603WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
276YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER604THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
277PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE605GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
278POSSIBILITY OF SUCH DAMAGES.606USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
279607DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
280 END OF TERMS AND CONDITIONS608PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
281609EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
282 How to Apply These Terms to Your New Programs610SUCH DAMAGES.
611
612 17. Interpretation of Sections 15 and 16.
613
614 If the disclaimer of warranty and limitation of liability provided
615above cannot be given local legal effect according to their terms,
616reviewing courts shall apply local law that most closely approximates
617an absolute waiver of all civil liability in connection with the
618Program, unless a warranty or assumption of liability accompanies a
619copy of the Program in return for a fee.
620
621 END OF TERMS AND CONDITIONS
622
623 How to Apply These Terms to Your New Programs
283624
284 If you develop a new program, and you want it to be of the greatest625 If you develop a new program, and you want it to be of the greatest
285possible use to the public, the best way to achieve this is to make it626possible use to the public, the best way to achieve this is to make it
@@ -287,15 +628,15 @@
287628
288 To do so, attach the following notices to the program. It is safest629 To do so, attach the following notices to the program. It is safest
289to attach them to the start of each source file to most effectively630to attach them to the start of each source file to most effectively
290convey the exclusion of warranty; and each file should have at least631state the exclusion of warranty; and each file should have at least
291the "copyright" line and a pointer to where the full notice is found.632the "copyright" line and a pointer to where the full notice is found.
292633
293 <one line to give the program's name and a brief idea of what it does.>634 <one line to give the program's name and a brief idea of what it does.>
294 Copyright (C) <year> <name of author>635 Copyright (C) <year> <name of author>
295636
296 This program is free software; you can redistribute it and/or modify637 This program is free software: you can redistribute it and/or modify
297 it under the terms of the GNU General Public License as published by638 it under the terms of the GNU General Public License as published by
298 the Free Software Foundation; either version 2 of the License, or639 the Free Software Foundation, either version 3 of the License, or
299 (at your option) any later version.640 (at your option) any later version.
300641
301 This program is distributed in the hope that it will be useful,642 This program is distributed in the hope that it will be useful,
@@ -303,37 +644,31 @@
303 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the644 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
304 GNU General Public License for more details.645 GNU General Public License for more details.
305646
306 You should have received a copy of the GNU General Public License along647 You should have received a copy of the GNU General Public License
307 with this program; if not, write to the Free Software Foundation, Inc.,648 along with this program. If not, see <https://www.gnu.org/licenses/>.
308 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
309649
310Also add information on how to contact you by electronic and paper mail.650Also add information on how to contact you by electronic and paper mail.
311651
312If the program is interactive, make it output a short notice like this652 If the program does terminal interaction, make it output a short
313when it starts in an interactive mode:653notice like this when it starts in an interactive mode:
314654
315 Gnomovision version 69, Copyright (C) year name of author655 <program> Copyright (C) <year> <name of author>
316 Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.656 This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
317 This is free software, and you are welcome to redistribute it657 This is free software, and you are welcome to redistribute it
318 under certain conditions; type `show c' for details.658 under certain conditions; type `show c' for details.
319659
320The hypothetical commands `show w' and `show c' should show the appropriate660The hypothetical commands `show w' and `show c' should show the appropriate
321parts of the General Public License. Of course, the commands you use may661parts of the General Public License. Of course, your program's commands
322be called something other than `show w' and `show c'; they could even be662might be different; for a GUI interface, you would use an "about box".
323mouse-clicks or menu items--whatever suits your program.663
324664 You should also get your employer (if you work as a programmer) or school,
325You should also get your employer (if you work as a programmer) or your665if any, to sign a "copyright disclaimer" for the program, if necessary.
326school, if any, to sign a "copyright disclaimer" for the program, if666For more information on this, and how to apply and follow the GNU GPL, see
327necessary. Here is a sample; alter the names:667<https://www.gnu.org/licenses/>.
328668
329 Yoyodyne, Inc., hereby disclaims all copyright interest in the program669 The GNU General Public License does not permit incorporating your program
330 `Gnomovision' (which makes passes at compilers) written by James Hacker.670into proprietary programs. If your program is a subroutine library, you
331671may consider it more useful to permit linking proprietary applications with
332 <signature of Ty Coon>, 1 April 1989672the library. If this is what you want to do, use the GNU Lesser General
333 Ty Coon, President of Vice673Public License instead of this License. But first, please read
334674<https://www.gnu.org/licenses/why-not-lgpl.html>.
335This General Public License does not permit incorporating your program into
336proprietary programs. If your program is a subroutine library, you may
337consider it more useful to permit linking proprietary applications with the
338library. If this is what you want to do, use the GNU Lesser General
339Public License instead of this License.
340675
=== modified file 'copyright.txt'
--- copyright.txt 2019-02-14 15:09:09 +0000
+++ copyright.txt 2019-07-01 17:47:01 +0000
@@ -1,21 +1,21 @@
1# -*- coding: utf-8 -*-1# -*- coding: utf-8 -*-
2# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=42# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
33
4###############################################################################4##########################################################################
5# OpenLP - Open Source Lyrics Projection #5# OpenLP - Open Source Lyrics Projection #
6# --------------------------------------------------------------------------- #6# ---------------------------------------------------------------------- #
7# Copyright (c) 2008-2019 OpenLP Developers #7# Copyright (c) 2008-2019 OpenLP Developers #
8# --------------------------------------------------------------------------- #8# ---------------------------------------------------------------------- #
9# This program is free software; you can redistribute it and/or modify it #9# This program is free software: you can redistribute it and/or modify #
10# under the terms of the GNU General Public License as published by the Free #10# it under the terms of the GNU General Public License as published by #
11# Software Foundation; version 2 of the License. #11# the Free Software Foundation, either version 3 of the License, or #
12# #12# (at your option) any later version. #
13# This program is distributed in the hope that it will be useful, but WITHOUT #13# #
14# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #14# This program is distributed in the hope that it will be useful, #
15# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #15# but WITHOUT ANY WARRANTY; without even the implied warranty of #
16# more details. #16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
17# #17# GNU General Public License for more details. #
18# You should have received a copy of the GNU General Public License along #18# #
19# with this program; if not, write to the Free Software Foundation, Inc., 59 #19# You should have received a copy of the GNU General Public License #
20# Temple Place, Suite 330, Boston, MA 02111-1307 USA #20# along with this program. If not, see <https://www.gnu.org/licenses/>. #
21###############################################################################21##########################################################################
2222
=== removed file 'nose2.cfg'
--- nose2.cfg 2017-12-02 05:31:23 +0000
+++ nose2.cfg 1970-01-01 00:00:00 +0000
@@ -1,27 +0,0 @@
1[unittest]
2verbose = true
3plugins = nose2.plugins.mp
4
5[log-capture]
6always-on = true
7clear-handlers = true
8filter = -nose
9log-level = ERROR
10
11[test-result]
12always-on = true
13descriptions = true
14
15[coverage]
16always-on = true
17coverage = openlp
18coverage-report = html
19
20[multiprocess]
21always-on = false
22processes = 4
23
24[output-buffer]
25always-on = true
26stderr = true
27stdout = true
280
=== modified file 'openlp/__init__.py'
--- openlp/__init__.py 2019-02-14 15:09:09 +0000
+++ openlp/__init__.py 2019-07-01 17:47:01 +0000
@@ -1,24 +1,24 @@
1# -*- coding: utf-8 -*-1# -*- coding: utf-8 -*-
2# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=42# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
33
4###############################################################################4##########################################################################
5# OpenLP - Open Source Lyrics Projection #5# OpenLP - Open Source Lyrics Projection #
6# --------------------------------------------------------------------------- #6# ---------------------------------------------------------------------- #
7# Copyright (c) 2008-2019 OpenLP Developers #7# Copyright (c) 2008-2019 OpenLP Developers #
8# --------------------------------------------------------------------------- #8# ---------------------------------------------------------------------- #
9# This program is free software; you can redistribute it and/or modify it #9# This program is free software: you can redistribute it and/or modify #
10# under the terms of the GNU General Public License as published by the Free #10# it under the terms of the GNU General Public License as published by #
11# Software Foundation; version 2 of the License. #11# the Free Software Foundation, either version 3 of the License, or #
12# #12# (at your option) any later version. #
13# This program is distributed in the hope that it will be useful, but WITHOUT #13# #
14# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #14# This program is distributed in the hope that it will be useful, #
15# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #15# but WITHOUT ANY WARRANTY; without even the implied warranty of #
16# more details. #16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
17# #17# GNU General Public License for more details. #
18# You should have received a copy of the GNU General Public License along #18# #
19# with this program; if not, write to the Free Software Foundation, Inc., 59 #19# You should have received a copy of the GNU General Public License #
20# Temple Place, Suite 330, Boston, MA 02111-1307 USA #20# along with this program. If not, see <https://www.gnu.org/licenses/>. #
21###############################################################################21##########################################################################
22"""22"""
23The :mod:`openlp` module contains all the project produced OpenLP functionality23The :mod:`openlp` module contains all the project produced OpenLP functionality
24"""24"""
2525
=== modified file 'openlp/core/__init__.py'
--- openlp/core/__init__.py 2019-02-14 15:09:09 +0000
+++ openlp/core/__init__.py 2019-07-01 17:47:01 +0000
@@ -1,24 +1,24 @@
1# -*- coding: utf-8 -*-1# -*- coding: utf-8 -*-
2# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=42# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
33
4###############################################################################4##########################################################################
5# OpenLP - Open Source Lyrics Projection #5# OpenLP - Open Source Lyrics Projection #
6# --------------------------------------------------------------------------- #6# ---------------------------------------------------------------------- #
7# Copyright (c) 2008-2019 OpenLP Developers #7# Copyright (c) 2008-2019 OpenLP Developers #
8# --------------------------------------------------------------------------- #8# ---------------------------------------------------------------------- #
9# This program is free software; you can redistribute it and/or modify it #9# This program is free software: you can redistribute it and/or modify #
10# under the terms of the GNU General Public License as published by the Free #10# it under the terms of the GNU General Public License as published by #
11# Software Foundation; version 2 of the License. #11# the Free Software Foundation, either version 3 of the License, or #
12# #12# (at your option) any later version. #
13# This program is distributed in the hope that it will be useful, but WITHOUT #13# #
14# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #14# This program is distributed in the hope that it will be useful, #
15# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #15# but WITHOUT ANY WARRANTY; without even the implied warranty of #
16# more details. #16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
17# #17# GNU General Public License for more details. #
18# You should have received a copy of the GNU General Public License along #18# #
19# with this program; if not, write to the Free Software Foundation, Inc., 59 #19# You should have received a copy of the GNU General Public License #
20# Temple Place, Suite 330, Boston, MA 02111-1307 USA #20# along with this program. If not, see <https://www.gnu.org/licenses/>. #
21###############################################################################21##########################################################################
2222
23"""23"""
24The :mod:`core` module provides all core application functions24The :mod:`core` module provides all core application functions
2525
=== modified file 'openlp/core/api/__init__.py'
--- openlp/core/api/__init__.py 2019-02-14 15:09:09 +0000
+++ openlp/core/api/__init__.py 2019-07-01 17:47:01 +0000
@@ -1,21 +1,21 @@
1# -*- coding: utf-8 -*-1# -*- coding: utf-8 -*-
2# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=42# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
33
4###############################################################################4##########################################################################
5# OpenLP - Open Source Lyrics Projection #5# OpenLP - Open Source Lyrics Projection #
6# --------------------------------------------------------------------------- #6# ---------------------------------------------------------------------- #
7# Copyright (c) 2008-2019 OpenLP Developers #7# Copyright (c) 2008-2019 OpenLP Developers #
8# --------------------------------------------------------------------------- #8# ---------------------------------------------------------------------- #
9# This program is free software; you can redistribute it and/or modify it #9# This program is free software: you can redistribute it and/or modify #
10# under the terms of the GNU General Public License as published by the Free #10# it under the terms of the GNU General Public License as published by #
11# Software Foundation; version 2 of the License. #11# the Free Software Foundation, either version 3 of the License, or #
12# #12# (at your option) any later version. #
13# This program is distributed in the hope that it will be useful, but WITHOUT #13# #
14# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #14# This program is distributed in the hope that it will be useful, #
15# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #15# but WITHOUT ANY WARRANTY; without even the implied warranty of #
16# more details. #16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
17# #17# GNU General Public License for more details. #
18# You should have received a copy of the GNU General Public License along #18# #
19# with this program; if not, write to the Free Software Foundation, Inc., 59 #19# You should have received a copy of the GNU General Public License #
20# Temple Place, Suite 330, Boston, MA 02111-1307 USA #20# along with this program. If not, see <https://www.gnu.org/licenses/>. #
21###############################################################################21##########################################################################
2222
=== modified file 'openlp/core/api/deploy.py'
--- openlp/core/api/deploy.py 2019-02-14 15:09:09 +0000
+++ openlp/core/api/deploy.py 2019-07-01 17:47:01 +0000
@@ -1,24 +1,24 @@
1# -*- coding: utf-8 -*-1# -*- coding: utf-8 -*-
2# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=42# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
33
4###############################################################################4##########################################################################
5# OpenLP - Open Source Lyrics Projection #5# OpenLP - Open Source Lyrics Projection #
6# --------------------------------------------------------------------------- #6# ---------------------------------------------------------------------- #
7# Copyright (c) 2008-2019 OpenLP Developers #7# Copyright (c) 2008-2019 OpenLP Developers #
8# --------------------------------------------------------------------------- #8# ---------------------------------------------------------------------- #
9# This program is free software; you can redistribute it and/or modify it #9# This program is free software: you can redistribute it and/or modify #
10# under the terms of the GNU General Public License as published by the Free #10# it under the terms of the GNU General Public License as published by #
11# Software Foundation; version 2 of the License. #11# the Free Software Foundation, either version 3 of the License, or #
12# #12# (at your option) any later version. #
13# This program is distributed in the hope that it will be useful, but WITHOUT #13# #
14# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #14# This program is distributed in the hope that it will be useful, #
15# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #15# but WITHOUT ANY WARRANTY; without even the implied warranty of #
16# more details. #16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
17# #17# GNU General Public License for more details. #
18# You should have received a copy of the GNU General Public License along #18# #
19# with this program; if not, write to the Free Software Foundation, Inc., 59 #19# You should have received a copy of the GNU General Public License #
20# Temple Place, Suite 330, Boston, MA 02111-1307 USA #20# along with this program. If not, see <https://www.gnu.org/licenses/>. #
21###############################################################################21##########################################################################
22"""22"""
23Download and "install" the remote web client23Download and "install" the remote web client
24"""24"""
@@ -34,13 +34,13 @@
34 Process the downloaded zip file and add to the correct directory34 Process the downloaded zip file and add to the correct directory
3535
36 :param str zip_name: the zip file name to be processed36 :param str zip_name: the zip file name to be processed
37 :param openlp.core.common.path.Path app_root_path: The directory to expand the zip to37 :param pathlib.Path app_root_path: The directory to expand the zip to
3838
39 :return: None39 :return: None
40 """40 """
41 zip_path = app_root_path / zip_name41 zip_path = app_root_path / zip_name
42 web_zip = ZipFile(str(zip_path))42 web_zip = ZipFile(zip_path)
43 web_zip.extractall(str(app_root_path))43 web_zip.extractall(app_root_path)
4444
4545
46def download_sha256():46def download_sha256():
4747
=== modified file 'openlp/core/api/endpoint/__init__.py'
--- openlp/core/api/endpoint/__init__.py 2019-02-14 15:09:09 +0000
+++ openlp/core/api/endpoint/__init__.py 2019-07-01 17:47:01 +0000
@@ -1,24 +1,24 @@
1# -*- coding: utf-8 -*-1# -*- coding: utf-8 -*-
2# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=42# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
33
4###############################################################################4##########################################################################
5# OpenLP - Open Source Lyrics Projection #5# OpenLP - Open Source Lyrics Projection #
6# --------------------------------------------------------------------------- #6# ---------------------------------------------------------------------- #
7# Copyright (c) 2008-2019 OpenLP Developers #7# Copyright (c) 2008-2019 OpenLP Developers #
8# --------------------------------------------------------------------------- #8# ---------------------------------------------------------------------- #
9# This program is free software; you can redistribute it and/or modify it #9# This program is free software: you can redistribute it and/or modify #
10# under the terms of the GNU General Public License as published by the Free #10# it under the terms of the GNU General Public License as published by #
11# Software Foundation; version 2 of the License. #11# the Free Software Foundation, either version 3 of the License, or #
12# #12# (at your option) any later version. #
13# This program is distributed in the hope that it will be useful, but WITHOUT #13# #
14# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #14# This program is distributed in the hope that it will be useful, #
15# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #15# but WITHOUT ANY WARRANTY; without even the implied warranty of #
16# more details. #16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
17# #17# GNU General Public License for more details. #
18# You should have received a copy of the GNU General Public License along #18# #
19# with this program; if not, write to the Free Software Foundation, Inc., 59 #19# You should have received a copy of the GNU General Public License #
20# Temple Place, Suite 330, Boston, MA 02111-1307 USA #20# along with this program. If not, see <https://www.gnu.org/licenses/>. #
21###############################################################################21##########################################################################
22"""22"""
23The Endpoint class, which provides plugins with a way to serve their own portion of the API23The Endpoint class, which provides plugins with a way to serve their own portion of the API
24"""24"""
2525
=== modified file 'openlp/core/api/endpoint/controller.py'
--- openlp/core/api/endpoint/controller.py 2019-02-14 15:09:09 +0000
+++ openlp/core/api/endpoint/controller.py 2019-07-01 17:47:01 +0000
@@ -1,34 +1,34 @@
1# -*- coding: utf-8 -*-1# -*- coding: utf-8 -*-
2# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=42# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
33
4###############################################################################4##########################################################################
5# OpenLP - Open Source Lyrics Projection #5# OpenLP - Open Source Lyrics Projection #
6# --------------------------------------------------------------------------- #6# ---------------------------------------------------------------------- #
7# Copyright (c) 2008-2019 OpenLP Developers #7# Copyright (c) 2008-2019 OpenLP Developers #
8# --------------------------------------------------------------------------- #8# ---------------------------------------------------------------------- #
9# This program is free software; you can redistribute it and/or modify it #9# This program is free software: you can redistribute it and/or modify #
10# under the terms of the GNU General Public License as published by the Free #10# it under the terms of the GNU General Public License as published by #
11# Software Foundation; version 2 of the License. #11# the Free Software Foundation, either version 3 of the License, or #
12# #12# (at your option) any later version. #
13# This program is distributed in the hope that it will be useful, but WITHOUT #13# #
14# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #14# This program is distributed in the hope that it will be useful, #
15# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #15# but WITHOUT ANY WARRANTY; without even the implied warranty of #
16# more details. #16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
17# #17# GNU General Public License for more details. #
18# You should have received a copy of the GNU General Public License along #18# #
19# with this program; if not, write to the Free Software Foundation, Inc., 59 #19# You should have received a copy of the GNU General Public License #
20# Temple Place, Suite 330, Boston, MA 02111-1307 USA #20# along with this program. If not, see <https://www.gnu.org/licenses/>. #
21###############################################################################21##########################################################################
22import json22import json
23import logging23import logging
24import os24import os
25import urllib.error25import urllib.error
26import urllib.request26import urllib.request
27from pathlib import Path
2728
28from openlp.core.api.http import requires_auth29from openlp.core.api.http import requires_auth
29from openlp.core.api.http.endpoint import Endpoint30from openlp.core.api.http.endpoint import Endpoint
30from openlp.core.common.applocation import AppLocation31from openlp.core.common.applocation import AppLocation
31from openlp.core.common.path import Path
32from openlp.core.common.registry import Registry32from openlp.core.common.registry import Registry
33from openlp.core.common.settings import Settings33from openlp.core.common.settings import Settings
34from openlp.core.lib import create_thumb34from openlp.core.lib import create_thumb
3535
=== modified file 'openlp/core/api/endpoint/core.py'
--- openlp/core/api/endpoint/core.py 2019-02-14 15:09:09 +0000
+++ openlp/core/api/endpoint/core.py 2019-07-01 17:47:01 +0000
@@ -1,24 +1,24 @@
1# -*- coding: utf-8 -*-1# -*- coding: utf-8 -*-
2# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=42# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
33
4###############################################################################4##########################################################################
5# OpenLP - Open Source Lyrics Projection #5# OpenLP - Open Source Lyrics Projection #
6# --------------------------------------------------------------------------- #6# ---------------------------------------------------------------------- #
7# Copyright (c) 2008-2019 OpenLP Developers #7# Copyright (c) 2008-2019 OpenLP Developers #
8# --------------------------------------------------------------------------- #8# ---------------------------------------------------------------------- #
9# This program is free software; you can redistribute it and/or modify it #9# This program is free software: you can redistribute it and/or modify #
10# under the terms of the GNU General Public License as published by the Free #10# it under the terms of the GNU General Public License as published by #
11# Software Foundation; version 2 of the License. #11# the Free Software Foundation, either version 3 of the License, or #
12# #12# (at your option) any later version. #
13# This program is distributed in the hope that it will be useful, but WITHOUT #13# #
14# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #14# This program is distributed in the hope that it will be useful, #
15# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #15# but WITHOUT ANY WARRANTY; without even the implied warranty of #
16# more details. #16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
17# #17# GNU General Public License for more details. #
18# You should have received a copy of the GNU General Public License along #18# #
19# with this program; if not, write to the Free Software Foundation, Inc., 59 #19# You should have received a copy of the GNU General Public License #
20# Temple Place, Suite 330, Boston, MA 02111-1307 USA #20# along with this program. If not, see <https://www.gnu.org/licenses/>. #
21###############################################################################21##########################################################################
22"""22"""
23The :mod:`~openlp.core.api.endpoint.core` module contains the core API endpoints23The :mod:`~openlp.core.api.endpoint.core` module contains the core API endpoints
24"""24"""
2525
=== modified file 'openlp/core/api/endpoint/pluginhelpers.py'
--- openlp/core/api/endpoint/pluginhelpers.py 2019-02-14 15:09:09 +0000
+++ openlp/core/api/endpoint/pluginhelpers.py 2019-07-01 17:47:01 +0000
@@ -1,24 +1,24 @@
1# -*- coding: utf-8 -*-1# -*- coding: utf-8 -*-
2# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=42# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
33
4###############################################################################4##########################################################################
5# OpenLP - Open Source Lyrics Projection #5# OpenLP - Open Source Lyrics Projection #
6# --------------------------------------------------------------------------- #6# ---------------------------------------------------------------------- #
7# Copyright (c) 2008-2019 OpenLP Developers #7# Copyright (c) 2008-2019 OpenLP Developers #
8# --------------------------------------------------------------------------- #8# ---------------------------------------------------------------------- #
9# This program is free software; you can redistribute it and/or modify it #9# This program is free software: you can redistribute it and/or modify #
10# under the terms of the GNU General Public License as published by the Free #10# it under the terms of the GNU General Public License as published by #
11# Software Foundation; version 2 of the License. #11# the Free Software Foundation, either version 3 of the License, or #
12# #12# (at your option) any later version. #
13# This program is distributed in the hope that it will be useful, but WITHOUT #13# #
14# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #14# This program is distributed in the hope that it will be useful, #
15# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #15# but WITHOUT ANY WARRANTY; without even the implied warranty of #
16# more details. #16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
17# #17# GNU General Public License for more details. #
18# You should have received a copy of the GNU General Public License along #18# #
19# with this program; if not, write to the Free Software Foundation, Inc., 59 #19# You should have received a copy of the GNU General Public License #
20# Temple Place, Suite 330, Boston, MA 02111-1307 USA #20# along with this program. If not, see <https://www.gnu.org/licenses/>. #
21###############################################################################21##########################################################################
22import json22import json
23import re23import re
24import urllib24import urllib
2525
=== modified file 'openlp/core/api/endpoint/remote.py'
--- openlp/core/api/endpoint/remote.py 2019-02-14 15:09:09 +0000
+++ openlp/core/api/endpoint/remote.py 2019-07-01 17:47:01 +0000
@@ -1,24 +1,24 @@
1# -*- coding: utf-8 -*-1# -*- coding: utf-8 -*-
2# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=42# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
33
4###############################################################################4##########################################################################
5# OpenLP - Open Source Lyrics Projection #5# OpenLP - Open Source Lyrics Projection #
6# --------------------------------------------------------------------------- #6# ---------------------------------------------------------------------- #
7# Copyright (c) 2008-2019 OpenLP Developers #7# Copyright (c) 2008-2019 OpenLP Developers #
8# --------------------------------------------------------------------------- #8# ---------------------------------------------------------------------- #
9# This program is free software; you can redistribute it and/or modify it #9# This program is free software: you can redistribute it and/or modify #
10# under the terms of the GNU General Public License as published by the Free #10# it under the terms of the GNU General Public License as published by #
11# Software Foundation; version 2 of the License. #11# the Free Software Foundation, either version 3 of the License, or #
12# #12# (at your option) any later version. #
13# This program is distributed in the hope that it will be useful, but WITHOUT #13# #
14# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #14# This program is distributed in the hope that it will be useful, #
15# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #15# but WITHOUT ANY WARRANTY; without even the implied warranty of #
16# more details. #16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
17# #17# GNU General Public License for more details. #
18# You should have received a copy of the GNU General Public License along #18# #
19# with this program; if not, write to the Free Software Foundation, Inc., 59 #19# You should have received a copy of the GNU General Public License #
20# Temple Place, Suite 330, Boston, MA 02111-1307 USA #20# along with this program. If not, see <https://www.gnu.org/licenses/>. #
21###############################################################################21##########################################################################
22import logging22import logging
2323
24from openlp.core.api.endpoint.core import TRANSLATED_STRINGS24from openlp.core.api.endpoint.core import TRANSLATED_STRINGS
2525
=== modified file 'openlp/core/api/endpoint/service.py'
--- openlp/core/api/endpoint/service.py 2019-02-14 15:09:09 +0000
+++ openlp/core/api/endpoint/service.py 2019-07-01 17:47:01 +0000
@@ -1,24 +1,24 @@
1# -*- coding: utf-8 -*-1# -*- coding: utf-8 -*-
2# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=42# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
33
4###############################################################################4##########################################################################
5# OpenLP - Open Source Lyrics Projection #5# OpenLP - Open Source Lyrics Projection #
6# --------------------------------------------------------------------------- #6# ---------------------------------------------------------------------- #
7# Copyright (c) 2008-2019 OpenLP Developers #7# Copyright (c) 2008-2019 OpenLP Developers #
8# --------------------------------------------------------------------------- #8# ---------------------------------------------------------------------- #
9# This program is free software; you can redistribute it and/or modify it #9# This program is free software: you can redistribute it and/or modify #
10# under the terms of the GNU General Public License as published by the Free #10# it under the terms of the GNU General Public License as published by #
11# Software Foundation; version 2 of the License. #11# the Free Software Foundation, either version 3 of the License, or #
12# #12# (at your option) any later version. #
13# This program is distributed in the hope that it will be useful, but WITHOUT #13# #
14# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #14# This program is distributed in the hope that it will be useful, #
15# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #15# but WITHOUT ANY WARRANTY; without even the implied warranty of #
16# more details. #16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
17# #17# GNU General Public License for more details. #
18# You should have received a copy of the GNU General Public License along #18# #
19# with this program; if not, write to the Free Software Foundation, Inc., 59 #19# You should have received a copy of the GNU General Public License #
20# Temple Place, Suite 330, Boston, MA 02111-1307 USA #20# along with this program. If not, see <https://www.gnu.org/licenses/>. #
21###############################################################################21##########################################################################
22import json22import json
23import logging23import logging
2424
2525
=== modified file 'openlp/core/api/http/__init__.py'
--- openlp/core/api/http/__init__.py 2019-02-14 15:09:09 +0000
+++ openlp/core/api/http/__init__.py 2019-07-01 17:47:01 +0000
@@ -1,24 +1,24 @@
1# -*- coding: utf-8 -*-1# -*- coding: utf-8 -*-
2# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=42# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
33
4###############################################################################4##########################################################################
5# OpenLP - Open Source Lyrics Projection #5# OpenLP - Open Source Lyrics Projection #
6# --------------------------------------------------------------------------- #6# ---------------------------------------------------------------------- #
7# Copyright (c) 2008-2019 OpenLP Developers #7# Copyright (c) 2008-2019 OpenLP Developers #
8# --------------------------------------------------------------------------- #8# ---------------------------------------------------------------------- #
9# This program is free software; you can redistribute it and/or modify it #9# This program is free software: you can redistribute it and/or modify #
10# under the terms of the GNU General Public License as published by the Free #10# it under the terms of the GNU General Public License as published by #
11# Software Foundation; version 2 of the License. #11# the Free Software Foundation, either version 3 of the License, or #
12# #12# (at your option) any later version. #
13# This program is distributed in the hope that it will be useful, but WITHOUT #13# #
14# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #14# This program is distributed in the hope that it will be useful, #
15# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #15# but WITHOUT ANY WARRANTY; without even the implied warranty of #
16# more details. #16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
17# #17# GNU General Public License for more details. #
18# You should have received a copy of the GNU General Public License along #18# #
19# with this program; if not, write to the Free Software Foundation, Inc., 59 #19# You should have received a copy of the GNU General Public License #
20# Temple Place, Suite 330, Boston, MA 02111-1307 USA #20# along with this program. If not, see <https://www.gnu.org/licenses/>. #
21###############################################################################21##########################################################################
2222
23import base6423import base64
24from functools import wraps24from functools import wraps
2525
=== modified file 'openlp/core/api/http/endpoint.py'
--- openlp/core/api/http/endpoint.py 2019-02-14 15:09:09 +0000
+++ openlp/core/api/http/endpoint.py 2019-07-01 17:47:01 +0000
@@ -1,24 +1,24 @@
1# -*- coding: utf-8 -*-1# -*- coding: utf-8 -*-
2# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=42# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
33
4###############################################################################4##########################################################################
5# OpenLP - Open Source Lyrics Projection #5# OpenLP - Open Source Lyrics Projection #
6# --------------------------------------------------------------------------- #6# ---------------------------------------------------------------------- #
7# Copyright (c) 2008-2019 OpenLP Developers #7# Copyright (c) 2008-2019 OpenLP Developers #
8# --------------------------------------------------------------------------- #8# ---------------------------------------------------------------------- #
9# This program is free software; you can redistribute it and/or modify it #9# This program is free software: you can redistribute it and/or modify #
10# under the terms of the GNU General Public License as published by the Free #10# it under the terms of the GNU General Public License as published by #
11# Software Foundation; version 2 of the License. #11# the Free Software Foundation, either version 3 of the License, or #
12# #12# (at your option) any later version. #
13# This program is distributed in the hope that it will be useful, but WITHOUT #13# #
14# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #14# This program is distributed in the hope that it will be useful, #
15# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #15# but WITHOUT ANY WARRANTY; without even the implied warranty of #
16# more details. #16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
17# #17# GNU General Public License for more details. #
18# You should have received a copy of the GNU General Public License along #18# #
19# with this program; if not, write to the Free Software Foundation, Inc., 59 #19# You should have received a copy of the GNU General Public License #
20# Temple Place, Suite 330, Boston, MA 02111-1307 USA #20# along with this program. If not, see <https://www.gnu.org/licenses/>. #
21###############################################################################21##########################################################################
22"""22"""
23The Endpoint class, which provides plugins with a way to serve their own portion of the API23The Endpoint class, which provides plugins with a way to serve their own portion of the API
24"""24"""
2525
=== modified file 'openlp/core/api/http/errors.py'
--- openlp/core/api/http/errors.py 2019-02-14 15:09:09 +0000
+++ openlp/core/api/http/errors.py 2019-07-01 17:47:01 +0000
@@ -1,24 +1,24 @@
1# -*- coding: utf-8 -*-1# -*- coding: utf-8 -*-
2# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=42# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
33
4###############################################################################4##########################################################################
5# OpenLP - Open Source Lyrics Projection #5# OpenLP - Open Source Lyrics Projection #
6# --------------------------------------------------------------------------- #6# ---------------------------------------------------------------------- #
7# Copyright (c) 2008-2019 OpenLP Developers #7# Copyright (c) 2008-2019 OpenLP Developers #
8# --------------------------------------------------------------------------- #8# ---------------------------------------------------------------------- #
9# This program is free software; you can redistribute it and/or modify it #9# This program is free software: you can redistribute it and/or modify #
10# under the terms of the GNU General Public License as published by the Free #10# it under the terms of the GNU General Public License as published by #
11# Software Foundation; version 2 of the License. #11# the Free Software Foundation, either version 3 of the License, or #
12# #12# (at your option) any later version. #
13# This program is distributed in the hope that it will be useful, but WITHOUT #13# #
14# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #14# This program is distributed in the hope that it will be useful, #
15# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #15# but WITHOUT ANY WARRANTY; without even the implied warranty of #
16# more details. #16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
17# #17# GNU General Public License for more details. #
18# You should have received a copy of the GNU General Public License along #18# #
19# with this program; if not, write to the Free Software Foundation, Inc., 59 #19# You should have received a copy of the GNU General Public License #
20# Temple Place, Suite 330, Boston, MA 02111-1307 USA #20# along with this program. If not, see <https://www.gnu.org/licenses/>. #
21###############################################################################21##########################################################################
22"""22"""
23HTTP Error classes23HTTP Error classes
24"""24"""
2525
=== modified file 'openlp/core/api/http/server.py'
--- openlp/core/api/http/server.py 2019-02-14 15:09:09 +0000
+++ openlp/core/api/http/server.py 2019-07-01 17:47:01 +0000
@@ -1,24 +1,24 @@
1# -*- coding: utf-8 -*-1# -*- coding: utf-8 -*-
2# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=42# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
33
4###############################################################################4##########################################################################
5# OpenLP - Open Source Lyrics Projection #5# OpenLP - Open Source Lyrics Projection #
6# --------------------------------------------------------------------------- #6# ---------------------------------------------------------------------- #
7# Copyright (c) 2008-2019 OpenLP Developers #7# Copyright (c) 2008-2019 OpenLP Developers #
8# --------------------------------------------------------------------------- #8# ---------------------------------------------------------------------- #
9# This program is free software; you can redistribute it and/or modify it #9# This program is free software: you can redistribute it and/or modify #
10# under the terms of the GNU General Public License as published by the Free #10# it under the terms of the GNU General Public License as published by #
11# Software Foundation; version 2 of the License. #11# the Free Software Foundation, either version 3 of the License, or #
12# #12# (at your option) any later version. #
13# This program is distributed in the hope that it will be useful, but WITHOUT #13# #
14# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #14# This program is distributed in the hope that it will be useful, #
15# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #15# but WITHOUT ANY WARRANTY; without even the implied warranty of #
16# more details. #16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
17# #17# GNU General Public License for more details. #
18# You should have received a copy of the GNU General Public License along #18# #
19# with this program; if not, write to the Free Software Foundation, Inc., 59 #19# You should have received a copy of the GNU General Public License #
20# Temple Place, Suite 330, Boston, MA 02111-1307 USA #20# along with this program. If not, see <https://www.gnu.org/licenses/>. #
21###############################################################################21##########################################################################
22"""22"""
23The :mod:`http` module contains the API web server. This is a lightweight web server used by remotes to interact23The :mod:`http` module contains the API web server. This is a lightweight web server used by remotes to interact
24with OpenLP. It uses JSON to communicate with the remotes.24with OpenLP. It uses JSON to communicate with the remotes.
2525
=== modified file 'openlp/core/api/http/wsgiapp.py'
--- openlp/core/api/http/wsgiapp.py 2019-02-14 15:09:09 +0000
+++ openlp/core/api/http/wsgiapp.py 2019-07-01 17:47:01 +0000
@@ -2,24 +2,24 @@
2# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=42# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
3# pylint: disable=logging-format-interpolation3# pylint: disable=logging-format-interpolation
44
5###############################################################################5##########################################################################
6# OpenLP - Open Source Lyrics Projection #6# OpenLP - Open Source Lyrics Projection #
7# --------------------------------------------------------------------------- #7# ---------------------------------------------------------------------- #
8# Copyright (c) 2008-2019 OpenLP Developers #8# Copyright (c) 2008-2019 OpenLP Developers #
9# --------------------------------------------------------------------------- #9# ---------------------------------------------------------------------- #
10# This program is free software; you can redistribute it and/or modify it #10# This program is free software: you can redistribute it and/or modify #
11# under the terms of the GNU General Public License as published by the Free #11# it under the terms of the GNU General Public License as published by #
12# Software Foundation; version 2 of the License. #12# the Free Software Foundation, either version 3 of the License, or #
13# #13# (at your option) any later version. #
14# This program is distributed in the hope that it will be useful, but WITHOUT #14# #
15# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #15# This program is distributed in the hope that it will be useful, #
16# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #16# but WITHOUT ANY WARRANTY; without even the implied warranty of #
17# more details. #17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
18# #18# GNU General Public License for more details. #
19# You should have received a copy of the GNU General Public License along #19# #
20# with this program; if not, write to the Free Software Foundation, Inc., 59 #20# You should have received a copy of the GNU General Public License #
21# Temple Place, Suite 330, Boston, MA 02111-1307 USA #21# along with this program. If not, see <https://www.gnu.org/licenses/>. #
22###############################################################################22##########################################################################
23"""23"""
24App stuff24App stuff
25"""25"""
2626
=== modified file 'openlp/core/api/poll.py'
--- openlp/core/api/poll.py 2019-02-14 15:09:09 +0000
+++ openlp/core/api/poll.py 2019-07-01 17:47:01 +0000
@@ -1,24 +1,24 @@
1# -*- coding: utf-8 -*-1# -*- coding: utf-8 -*-
2# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=42# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
33
4###############################################################################4##########################################################################
5# OpenLP - Open Source Lyrics Projection #5# OpenLP - Open Source Lyrics Projection #
6# --------------------------------------------------------------------------- #6# ---------------------------------------------------------------------- #
7# Copyright (c) 2008-2019 OpenLP Developers #7# Copyright (c) 2008-2019 OpenLP Developers #
8# --------------------------------------------------------------------------- #8# ---------------------------------------------------------------------- #
9# This program is free software; you can redistribute it and/or modify it #9# This program is free software: you can redistribute it and/or modify #
10# under the terms of the GNU General Public License as published by the Free #10# it under the terms of the GNU General Public License as published by #
11# Software Foundation; version 2 of the License. #11# the Free Software Foundation, either version 3 of the License, or #
12# #12# (at your option) any later version. #
13# This program is distributed in the hope that it will be useful, but WITHOUT #13# #
14# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #14# This program is distributed in the hope that it will be useful, #
15# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #15# but WITHOUT ANY WARRANTY; without even the implied warranty of #
16# more details. #16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
17# #17# GNU General Public License for more details. #
18# You should have received a copy of the GNU General Public License along #18# #
19# with this program; if not, write to the Free Software Foundation, Inc., 59 #19# You should have received a copy of the GNU General Public License #
20# Temple Place, Suite 330, Boston, MA 02111-1307 USA #20# along with this program. If not, see <https://www.gnu.org/licenses/>. #
21###############################################################################21##########################################################################
2222
23import json23import json
2424
2525
=== modified file 'openlp/core/api/tab.py'
--- openlp/core/api/tab.py 2019-02-14 15:09:09 +0000
+++ openlp/core/api/tab.py 2019-07-01 17:47:01 +0000
@@ -1,24 +1,24 @@
1# -*- coding: utf-8 -*-1# -*- coding: utf-8 -*-
2# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=42# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
33
4###############################################################################4##########################################################################
5# OpenLP - Open Source Lyrics Projection #5# OpenLP - Open Source Lyrics Projection #
6# --------------------------------------------------------------------------- #6# ---------------------------------------------------------------------- #
7# Copyright (c) 2008-2019 OpenLP Developers #7# Copyright (c) 2008-2019 OpenLP Developers #
8# --------------------------------------------------------------------------- #8# ---------------------------------------------------------------------- #
9# This program is free software; you can redistribute it and/or modify it #9# This program is free software: you can redistribute it and/or modify #
10# under the terms of the GNU General Public License as published by the Free #10# it under the terms of the GNU General Public License as published by #
11# Software Foundation; version 2 of the License. #11# the Free Software Foundation, either version 3 of the License, or #
12# #12# (at your option) any later version. #
13# This program is distributed in the hope that it will be useful, but WITHOUT #13# #
14# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #14# This program is distributed in the hope that it will be useful, #
15# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #15# but WITHOUT ANY WARRANTY; without even the implied warranty of #
16# more details. #16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
17# #17# GNU General Public License for more details. #
18# You should have received a copy of the GNU General Public License along #18# #
19# with this program; if not, write to the Free Software Foundation, Inc., 59 #19# You should have received a copy of the GNU General Public License #
20# Temple Place, Suite 330, Boston, MA 02111-1307 USA #20# along with this program. If not, see <https://www.gnu.org/licenses/>. #
21###############################################################################21##########################################################################
22"""22"""
23The :mod:`~openlp.core.api.tab` module contains the settings tab for the API23The :mod:`~openlp.core.api.tab` module contains the settings tab for the API
24"""24"""
2525
=== modified file 'openlp/core/api/websockets.py'
--- openlp/core/api/websockets.py 2019-02-14 15:09:09 +0000
+++ openlp/core/api/websockets.py 2019-07-01 17:47:01 +0000
@@ -1,24 +1,24 @@
1# -*- coding: utf-8 -*-1# -*- coding: utf-8 -*-
2# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=42# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
33
4###############################################################################4##########################################################################
5# OpenLP - Open Source Lyrics Projection #5# OpenLP - Open Source Lyrics Projection #
6# --------------------------------------------------------------------------- #6# ---------------------------------------------------------------------- #
7# Copyright (c) 2008-2019 OpenLP Developers #7# Copyright (c) 2008-2019 OpenLP Developers #
8# --------------------------------------------------------------------------- #8# ---------------------------------------------------------------------- #
9# This program is free software; you can redistribute it and/or modify it #9# This program is free software: you can redistribute it and/or modify #
10# under the terms of the GNU General Public License as published by the Free #10# it under the terms of the GNU General Public License as published by #
11# Software Foundation; version 2 of the License. #11# the Free Software Foundation, either version 3 of the License, or #
12# #12# (at your option) any later version. #
13# This program is distributed in the hope that it will be useful, but WITHOUT #13# #
14# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #14# This program is distributed in the hope that it will be useful, #
15# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #15# but WITHOUT ANY WARRANTY; without even the implied warranty of #
16# more details. #16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
17# #17# GNU General Public License for more details. #
18# You should have received a copy of the GNU General Public License along #18# #
19# with this program; if not, write to the Free Software Foundation, Inc., 59 #19# You should have received a copy of the GNU General Public License #
20# Temple Place, Suite 330, Boston, MA 02111-1307 USA #20# along with this program. If not, see <https://www.gnu.org/licenses/>. #
21###############################################################################21##########################################################################
22"""22"""
23The :mod:`http` module contains the API web server. This is a lightweight web server used by remotes to interact23The :mod:`http` module contains the API web server. This is a lightweight web server used by remotes to interact
24with OpenLP. It uses JSON to communicate with the remotes.24with OpenLP. It uses JSON to communicate with the remotes.
2525
=== modified file 'openlp/core/app.py'
--- openlp/core/app.py 2019-02-14 15:09:09 +0000
+++ openlp/core/app.py 2019-07-01 17:47:01 +0000
@@ -1,24 +1,24 @@
1# -*- coding: utf-8 -*-1# -*- coding: utf-8 -*-
2# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=42# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
33
4###############################################################################4##########################################################################
5# OpenLP - Open Source Lyrics Projection #5# OpenLP - Open Source Lyrics Projection #
6# --------------------------------------------------------------------------- #6# ---------------------------------------------------------------------- #
7# Copyright (c) 2008-2019 OpenLP Developers #7# Copyright (c) 2008-2019 OpenLP Developers #
8# --------------------------------------------------------------------------- #8# ---------------------------------------------------------------------- #
9# This program is free software; you can redistribute it and/or modify it #9# This program is free software: you can redistribute it and/or modify #
10# under the terms of the GNU General Public License as published by the Free #10# it under the terms of the GNU General Public License as published by #
11# Software Foundation; version 2 of the License. #11# the Free Software Foundation, either version 3 of the License, or #
12# #12# (at your option) any later version. #
13# This program is distributed in the hope that it will be useful, but WITHOUT #13# #
14# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #14# This program is distributed in the hope that it will be useful, #
15# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #15# but WITHOUT ANY WARRANTY; without even the implied warranty of #
16# more details. #16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
17# #17# GNU General Public License for more details. #
18# You should have received a copy of the GNU General Public License along #18# #
19# with this program; if not, write to the Free Software Foundation, Inc., 59 #19# You should have received a copy of the GNU General Public License #
20# Temple Place, Suite 330, Boston, MA 02111-1307 USA #20# along with this program. If not, see <https://www.gnu.org/licenses/>. #
21###############################################################################21##########################################################################
2222
23"""23"""
24The :mod:`core` module provides all core application functions24The :mod:`core` module provides all core application functions
@@ -28,9 +28,12 @@
28"""28"""
29import argparse29import argparse
30import logging30import logging
31import os
31import sys32import sys
32import time33import time
33from datetime import datetime34from datetime import datetime
35from pathlib import Path
36from shutil import copytree
34from traceback import format_exception37from traceback import format_exception
3538
36from PyQt5 import QtCore, QtWebEngineWidgets, QtWidgets # noqa39from PyQt5 import QtCore, QtWebEngineWidgets, QtWidgets # noqa
@@ -40,7 +43,7 @@
40from openlp.core.common.applocation import AppLocation43from openlp.core.common.applocation import AppLocation
41from openlp.core.loader import loader44from openlp.core.loader import loader
42from openlp.core.common.i18n import LanguageManager, UiStrings, translate45from openlp.core.common.i18n import LanguageManager, UiStrings, translate
43from openlp.core.common.path import copytree, create_paths46from openlp.core.common.path import create_paths
44from openlp.core.common.registry import Registry47from openlp.core.common.registry import Registry
45from openlp.core.common.settings import Settings48from openlp.core.common.settings import Settings
46from openlp.core.display.screens import ScreenList49from openlp.core.display.screens import ScreenList
@@ -101,7 +104,7 @@
101 ftw.initialize(screens)104 ftw.initialize(screens)
102 if ftw.exec() == QtWidgets.QDialog.Accepted:105 if ftw.exec() == QtWidgets.QDialog.Accepted:
103 Settings().setValue('core/has run wizard', True)106 Settings().setValue('core/has run wizard', True)
104 elif ftw.was_cancelled:107 else:
105 QtCore.QCoreApplication.exit()108 QtCore.QCoreApplication.exit()
106 sys.exit()109 sys.exit()
107 # Correct stylesheet bugs110 # Correct stylesheet bugs
@@ -286,12 +289,12 @@
286 return QtWidgets.QApplication.event(self, event)289 return QtWidgets.QApplication.event(self, event)
287290
288291
289def parse_options(args=None):292def parse_options():
290 """293 """
291 Parse the command line arguments294 Parse the command line arguments
292295
293 :param args: list of command line arguments296 :return: An :object:`argparse.Namespace` insatnce containing the parsed args.
294 :return: a tuple of parsed options of type optparse.Value and a list of remaining argsZ297 :rtype: argparse.Namespace
295 """298 """
296 # Set up command line options.299 # Set up command line options.
297 parser = argparse.ArgumentParser(prog='openlp')300 parser = argparse.ArgumentParser(prog='openlp')
@@ -301,37 +304,37 @@
301 help='Set logging to LEVEL level. Valid values are "debug", "info", "warning".')304 help='Set logging to LEVEL level. Valid values are "debug", "info", "warning".')
302 parser.add_argument('-p', '--portable', dest='portable', action='store_true',305 parser.add_argument('-p', '--portable', dest='portable', action='store_true',
303 help='Specify if this should be run as a portable app, ')306 help='Specify if this should be run as a portable app, ')
307 parser.add_argument('-pp', '--portable-path', dest='portablepath', default=None,
308 help='Specify the path of the portable data, defaults to "{dir_name}".'.format(
309 dir_name=os.path.join('<AppDir>', '..', '..')))
304 parser.add_argument('-w', '--no-web-server', dest='no_web_server', action='store_true',310 parser.add_argument('-w', '--no-web-server', dest='no_web_server', action='store_true',
305 help='Turn off the Web and Socket Server ')311 help='Turn off the Web and Socket Server ')
306 parser.add_argument('rargs', nargs='?', default=[])312 parser.add_argument('rargs', nargs='*', default=[])
307 # Parse command line options and deal with them. Use args supplied pragmatically if possible.313 # Parse command line options and deal with them.
308 return parser.parse_args(args) if args else parser.parse_args()314 return parser.parse_args()
309315
310316
311def set_up_logging(log_path):317def set_up_logging(log_path):
312 """318 """
313 Setup our logging using log_path319 Setup our logging using log_path
314320
315 :param openlp.core.common.path.Path log_path: The file to save the log to.321 :param Path log_path: The file to save the log to.
316 :rtype: None322 :rtype: None
317 """323 """
318 create_paths(log_path, do_not_log=True)324 create_paths(log_path, do_not_log=True)
319 file_path = log_path / 'openlp.log'325 file_path = log_path / 'openlp.log'
320 # TODO: FileHandler accepts a Path object in Py3.6326 logfile = logging.FileHandler(file_path, 'w', encoding='UTF-8')
321 logfile = logging.FileHandler(str(file_path), 'w', encoding='UTF-8')
322 logfile.setFormatter(logging.Formatter('%(asctime)s %(threadName)s %(name)-55s %(levelname)-8s %(message)s'))327 logfile.setFormatter(logging.Formatter('%(asctime)s %(threadName)s %(name)-55s %(levelname)-8s %(message)s'))
323 log.addHandler(logfile)328 log.addHandler(logfile)
324 if log.isEnabledFor(logging.DEBUG):329 if log.isEnabledFor(logging.DEBUG):
325 print('Logging to: {name}'.format(name=file_path))330 print('Logging to: {name}'.format(name=file_path))
326331
327332
328def main(args=None):333def main():
329 """334 """
330 The main function which parses command line options and then runs335 The main function which parses command line options and then runs
331
332 :param args: Some args
333 """336 """
334 args = parse_options(args)337 args = parse_options()
335 qt_args = ['--disable-web-security']338 qt_args = ['--disable-web-security']
336 # qt_args = []339 # qt_args = []
337 if args and args.loglevel.lower() in ['d', 'debug']:340 if args and args.loglevel.lower() in ['d', 'debug']:
@@ -357,14 +360,21 @@
357 application.setApplicationName('OpenLPPortable')360 application.setApplicationName('OpenLPPortable')
358 Settings.setDefaultFormat(Settings.IniFormat)361 Settings.setDefaultFormat(Settings.IniFormat)
359 # Get location OpenLPPortable.ini362 # Get location OpenLPPortable.ini
360 portable_path = (AppLocation.get_directory(AppLocation.AppDir) / '..' / '..').resolve()363 if args.portablepath:
364 if os.path.isabs(args.portablepath):
365 portable_path = Path(args.portablepath)
366 else:
367 portable_path = AppLocation.get_directory(AppLocation.AppDir) / '..' / args.portablepath
368 else:
369 portable_path = AppLocation.get_directory(AppLocation.AppDir) / '..' / '..'
370 portable_path = portable_path.resolve()
361 data_path = portable_path / 'Data'371 data_path = portable_path / 'Data'
362 set_up_logging(portable_path / 'Other')372 set_up_logging(portable_path / 'Other')
363 log.info('Running portable')373 log.info('Running portable')
364 portable_settings_path = data_path / 'OpenLP.ini'374 portable_settings_path = data_path / 'OpenLP.ini'
365 # Make this our settings file375 # Make this our settings file
366 log.info('INI file: {name}'.format(name=portable_settings_path))376 log.info('INI file: {name}'.format(name=portable_settings_path))
367 Settings.set_filename(str(portable_settings_path))377 Settings.set_filename(portable_settings_path)
368 portable_settings = Settings()378 portable_settings = Settings()
369 # Set our data path379 # Set our data path
370 log.info('Data path: {name}'.format(name=data_path))380 log.info('Data path: {name}'.format(name=data_path))
@@ -375,6 +385,15 @@
375 else:385 else:
376 application.setApplicationName('OpenLP')386 application.setApplicationName('OpenLP')
377 set_up_logging(AppLocation.get_directory(AppLocation.CacheDir))387 set_up_logging(AppLocation.get_directory(AppLocation.CacheDir))
388 # Set the libvlc environment variable if we're frozen
389 if getattr(sys, 'frozen', False):
390 if is_macosx():
391 vlc_lib = 'libvlc.dylib'
392 elif is_win():
393 vlc_lib = 'libvlc.dll'
394 os.environ['PYTHON_VLC_LIB_PATH'] = str(AppLocation.get_directory(AppLocation.AppDir) / vlc_lib)
395 log.debug('VLC Path: {}'.format(os.environ['PYTHON_VLC_LIB_PATH']))
396 # Initialise the Registry
378 Registry.create()397 Registry.create()
379 Registry().register('application', application)398 Registry().register('application', application)
380 Registry().set_flag('no_web_server', args.no_web_server)399 Registry().set_flag('no_web_server', args.no_web_server)
@@ -405,7 +424,12 @@
405 None, translate('OpenLP', 'Settings Upgrade'),424 None, translate('OpenLP', 'Settings Upgrade'),
406 translate('OpenLP', 'Your settings are about to be upgraded. A backup will be created at '425 translate('OpenLP', 'Your settings are about to be upgraded. A backup will be created at '
407 '{back_up_path}').format(back_up_path=back_up_path))426 '{back_up_path}').format(back_up_path=back_up_path))
408 settings.export(back_up_path)427 try:
428 settings.export(back_up_path)
429 except OSError:
430 QtWidgets.QMessageBox.warning(
431 None, translate('OpenLP', 'Settings Upgrade'),
432 translate('OpenLP', 'Settings back up failed.\n\nContinuining to upgrade.'))
409 settings.upgrade_settings()433 settings.upgrade_settings()
410 # First time checks in settings434 # First time checks in settings
411 if not Settings().value('core/has run wizard'):435 if not Settings().value('core/has run wizard'):
412436
=== modified file 'openlp/core/common/__init__.py'
--- openlp/core/common/__init__.py 2019-02-14 15:09:09 +0000
+++ openlp/core/common/__init__.py 2019-07-01 17:47:01 +0000
@@ -1,24 +1,24 @@
1# -*- coding: utf-8 -*-1# -*- coding: utf-8 -*-
2# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=42# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
33
4###############################################################################4##########################################################################
5# OpenLP - Open Source Lyrics Projection #5# OpenLP - Open Source Lyrics Projection #
6# --------------------------------------------------------------------------- #6# ---------------------------------------------------------------------- #
7# Copyright (c) 2008-2019 OpenLP Developers #7# Copyright (c) 2008-2019 OpenLP Developers #
8# --------------------------------------------------------------------------- #8# ---------------------------------------------------------------------- #
9# This program is free software; you can redistribute it and/or modify it #9# This program is free software: you can redistribute it and/or modify #
10# under the terms of the GNU General Public License as published by the Free #10# it under the terms of the GNU General Public License as published by #
11# Software Foundation; version 2 of the License. #11# the Free Software Foundation, either version 3 of the License, or #
12# #12# (at your option) any later version. #
13# This program is distributed in the hope that it will be useful, but WITHOUT #13# #
14# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #14# This program is distributed in the hope that it will be useful, #
15# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #15# but WITHOUT ANY WARRANTY; without even the implied warranty of #
16# more details. #16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
17# #17# GNU General Public License for more details. #
18# You should have received a copy of the GNU General Public License along #18# #
19# with this program; if not, write to the Free Software Foundation, Inc., 59 #19# You should have received a copy of the GNU General Public License #
20# Temple Place, Suite 330, Boston, MA 02111-1307 USA #20# along with this program. If not, see <https://www.gnu.org/licenses/>. #
21###############################################################################21##########################################################################
22"""22"""
23The :mod:`common` module contains most of the components and libraries that make23The :mod:`common` module contains most of the components and libraries that make
24OpenLP work.24OpenLP work.
@@ -134,15 +134,15 @@
134 importlib.import_module(module_name)134 importlib.import_module(module_name)
135 except (ImportError, OSError):135 except (ImportError, OSError):
136 # On some platforms importing vlc.py might cause OSError exceptions. (e.g. Mac OS X)136 # On some platforms importing vlc.py might cause OSError exceptions. (e.g. Mac OS X)
137 log.warning('Failed to import {module_name} on path {extension_path}'137 log.exception('Failed to import {module_name} on path {extension_path}'
138 .format(module_name=module_name, extension_path=extension_path))138 .format(module_name=module_name, extension_path=extension_path))
139139
140140
141def path_to_module(path):141def path_to_module(path):
142 """142 """
143 Convert a path to a module name (i.e openlp.core.common)143 Convert a path to a module name (i.e openlp.core.common)
144144
145 :param openlp.core.common.path.Path path: The path to convert to a module name.145 :param pathlib.Path path: The path to convert to a module name.
146 :return: The module name.146 :return: The module name.
147 :rtype: str147 :rtype: str
148 """148 """
@@ -371,7 +371,7 @@
371 """371 """
372 Deletes a file from the system.372 Deletes a file from the system.
373373
374 :param openlp.core.common.path.Path file_path: The file, including path, to delete.374 :param pathlib.Path file_path: The file, including path, to delete.
375 :return: True if the deletion was successful, or the file never existed. False otherwise.375 :return: True if the deletion was successful, or the file never existed. False otherwise.
376 :rtype: bool376 :rtype: bool
377 """377 """
@@ -407,7 +407,7 @@
407 """407 """
408 Validate that the file is not an image file.408 Validate that the file is not an image file.
409409
410 :param openlp.core.common.path.Path file_path: The file to be checked.410 :param pathlib.Path file_path: The file to be checked.
411 :return: If the file is not an image411 :return: If the file is not an image
412 :rtype: bool412 :rtype: bool
413 """413 """
@@ -435,7 +435,7 @@
435 """435 """
436 Function that checks whether a binary exists.436 Function that checks whether a binary exists.
437437
438 :param openlp.core.common.path.Path program_path: The full path to the binary to check.438 :param pathlib.Path program_path: The full path to the binary to check.
439 :return: program output to be parsed439 :return: program output to be parsed
440 :rtype: bytes440 :rtype: bytes
441 """441 """
@@ -462,9 +462,9 @@
462 """462 """
463 Utility function to incrementally detect the file encoding.463 Utility function to incrementally detect the file encoding.
464464
465 :param openlp.core.common.path.Path file_path: Filename for the file to determine the encoding for.465 :param pathlib.Path file_path: Filename for the file to determine the encoding for.
466 :return: A dict with the keys 'encoding' and 'confidence'466 :return: The name of the encoding detected
467 :rtype: dict[str, float]467 :rtype: str
468 """468 """
469 detector = UniversalDetector()469 detector = UniversalDetector()
470 try:470 try:
@@ -474,10 +474,10 @@
474 if not chunk:474 if not chunk:
475 break475 break
476 detector.feed(chunk)476 detector.feed(chunk)
477 detector.close()
478 return detector.result
479 except OSError:477 except OSError:
480 log.exception('Error detecting file encoding')478 log.exception('Error detecting file encoding')
479 finally:
480 return detector.close()['encoding']
481481
482482
483def normalize_str(irregular_string):483def normalize_str(irregular_string):
484484
=== modified file 'openlp/core/common/actions.py'
--- openlp/core/common/actions.py 2019-02-14 15:09:09 +0000
+++ openlp/core/common/actions.py 2019-07-01 17:47:01 +0000
@@ -1,24 +1,24 @@
1# -*- coding: utf-8 -*-1# -*- coding: utf-8 -*-
2# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=42# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
33
4###############################################################################4##########################################################################
5# OpenLP - Open Source Lyrics Projection #5# OpenLP - Open Source Lyrics Projection #
6# --------------------------------------------------------------------------- #6# ---------------------------------------------------------------------- #
7# Copyright (c) 2008-2019 OpenLP Developers #7# Copyright (c) 2008-2019 OpenLP Developers #
8# --------------------------------------------------------------------------- #8# ---------------------------------------------------------------------- #
9# This program is free software; you can redistribute it and/or modify it #9# This program is free software: you can redistribute it and/or modify #
10# under the terms of the GNU General Public License as published by the Free #10# it under the terms of the GNU General Public License as published by #
11# Software Foundation; version 2 of the License. #11# the Free Software Foundation, either version 3 of the License, or #
12# #12# (at your option) any later version. #
13# This program is distributed in the hope that it will be useful, but WITHOUT #13# #
14# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #14# This program is distributed in the hope that it will be useful, #
15# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #15# but WITHOUT ANY WARRANTY; without even the implied warranty of #
16# more details. #16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
17# #17# GNU General Public License for more details. #
18# You should have received a copy of the GNU General Public License along #18# #
19# with this program; if not, write to the Free Software Foundation, Inc., 59 #19# You should have received a copy of the GNU General Public License #
20# Temple Place, Suite 330, Boston, MA 02111-1307 USA #20# along with this program. If not, see <https://www.gnu.org/licenses/>. #
21###############################################################################21##########################################################################
22"""22"""
23The :mod:`~openlp.core.common.actions` module provides action list classes used23The :mod:`~openlp.core.common.actions` module provides action list classes used
24by the shortcuts system.24by the shortcuts system.
2525
=== modified file 'openlp/core/common/applocation.py'
--- openlp/core/common/applocation.py 2019-02-14 15:09:09 +0000
+++ openlp/core/common/applocation.py 2019-07-01 17:47:01 +0000
@@ -1,36 +1,37 @@
1# -*- coding: utf-8 -*-1# -*- coding: utf-8 -*-
2# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=42# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
33
4###############################################################################4##########################################################################
5# OpenLP - Open Source Lyrics Projection #5# OpenLP - Open Source Lyrics Projection #
6# --------------------------------------------------------------------------- #6# ---------------------------------------------------------------------- #
7# Copyright (c) 2008-2019 OpenLP Developers #7# Copyright (c) 2008-2019 OpenLP Developers #
8# --------------------------------------------------------------------------- #8# ---------------------------------------------------------------------- #
9# This program is free software; you can redistribute it and/or modify it #9# This program is free software: you can redistribute it and/or modify #
10# under the terms of the GNU General Public License as published by the Free #10# it under the terms of the GNU General Public License as published by #
11# Software Foundation; version 2 of the License. #11# the Free Software Foundation, either version 3 of the License, or #
12# #12# (at your option) any later version. #
13# This program is distributed in the hope that it will be useful, but WITHOUT #13# #
14# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #14# This program is distributed in the hope that it will be useful, #
15# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #15# but WITHOUT ANY WARRANTY; without even the implied warranty of #
16# more details. #16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
17# #17# GNU General Public License for more details. #
18# You should have received a copy of the GNU General Public License along #18# #
19# with this program; if not, write to the Free Software Foundation, Inc., 59 #19# You should have received a copy of the GNU General Public License #
20# Temple Place, Suite 330, Boston, MA 02111-1307 USA #20# along with this program. If not, see <https://www.gnu.org/licenses/>. #
21###############################################################################21##########################################################################
22"""22"""
23The :mod:`openlp.core.common.applocation` module provides an utility for OpenLP receiving the data path etc.23The :mod:`openlp.core.common.applocation` module provides an utility for OpenLP receiving the data path etc.
24"""24"""
25import logging25import logging
26import os26import os
27import sys27import sys
28from pathlib import Path
2829
29import appdirs30import appdirs
3031
31import openlp32import openlp
32from openlp.core.common import get_frozen_path, is_macosx, is_win33from openlp.core.common import get_frozen_path, is_macosx, is_win
33from openlp.core.common.path import Path, create_paths34from openlp.core.common.path import create_paths
34from openlp.core.common.settings import Settings35from openlp.core.common.settings import Settings
3536
3637
@@ -58,7 +59,7 @@
5859
59 :param dir_type: The directory type you want, for instance the data directory. Default *AppLocation.AppDir*60 :param dir_type: The directory type you want, for instance the data directory. Default *AppLocation.AppDir*
60 :return: The requested path61 :return: The requested path
61 :rtype: openlp.core.common.path.Path62 :rtype: Path
62 """63 """
63 if dir_type == AppLocation.AppDir or dir_type == AppLocation.VersionDir:64 if dir_type == AppLocation.AppDir or dir_type == AppLocation.VersionDir:
64 return get_frozen_path(FROZEN_APP_PATH, APP_PATH)65 return get_frozen_path(FROZEN_APP_PATH, APP_PATH)
@@ -75,7 +76,7 @@
75 Return the path OpenLP stores all its data under.76 Return the path OpenLP stores all its data under.
7677
77 :return: The data path to use.78 :return: The data path to use.
78 :rtype: openlp.core.common.path.Path79 :rtype: Path
79 """80 """
80 # Check if we have a different data location.81 # Check if we have a different data location.
81 if Settings().contains('advanced/data path'):82 if Settings().contains('advanced/data path'):
@@ -95,7 +96,7 @@
95 :param str extension: Defaults to ''. The extension to search for. For example::96 :param str extension: Defaults to ''. The extension to search for. For example::
96 '.png'97 '.png'
97 :return: List of files found.98 :return: List of files found.
98 :rtype: list[openlp.core.common.path.Path]99 :rtype: list[Path]
99 """100 """
100 path = AppLocation.get_data_path()101 path = AppLocation.get_data_path()
101 if section:102 if section:
@@ -112,7 +113,7 @@
112 Return the path a particular module stores its data under.113 Return the path a particular module stores its data under.
113114
114 :param str section:115 :param str section:
115 :rtype: openlp.core.common.path.Path116 :rtype: Path
116 """117 """
117 path = AppLocation.get_data_path() / section118 path = AppLocation.get_data_path() / section
118 create_paths(path)119 create_paths(path)
@@ -125,7 +126,7 @@
125126
126 :param dir_type: AppLocation Enum of the requested path type127 :param dir_type: AppLocation Enum of the requested path type
127 :return: The requested path128 :return: The requested path
128 :rtype: openlp.core.common.path.Path129 :rtype: Path
129 """130 """
130 # If running from source, return the language directory from the source directory131 # If running from source, return the language directory from the source directory
131 if dir_type == AppLocation.LanguageDir:132 if dir_type == AppLocation.LanguageDir:
132133
=== modified file 'openlp/core/common/db.py'
--- openlp/core/common/db.py 2019-02-14 15:09:09 +0000
+++ openlp/core/common/db.py 2019-07-01 17:47:01 +0000
@@ -1,24 +1,24 @@
1# -*- coding: utf-8 -*-1# -*- coding: utf-8 -*-
2# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=42# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
33
4###############################################################################4##########################################################################
5# OpenLP - Open Source Lyrics Projection #5# OpenLP - Open Source Lyrics Projection #
6# --------------------------------------------------------------------------- #6# ---------------------------------------------------------------------- #
7# Copyright (c) 2008-2019 OpenLP Developers #7# Copyright (c) 2008-2019 OpenLP Developers #
8# --------------------------------------------------------------------------- #8# ---------------------------------------------------------------------- #
9# This program is free software; you can redistribute it and/or modify it #9# This program is free software: you can redistribute it and/or modify #
10# under the terms of the GNU General Public License as published by the Free #10# it under the terms of the GNU General Public License as published by #
11# Software Foundation; version 2 of the License. #11# the Free Software Foundation, either version 3 of the License, or #
12# #12# (at your option) any later version. #
13# This program is distributed in the hope that it will be useful, but WITHOUT #13# #
14# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #14# This program is distributed in the hope that it will be useful, #
15# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #15# but WITHOUT ANY WARRANTY; without even the implied warranty of #
16# more details. #16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
17# #17# GNU General Public License for more details. #
18# You should have received a copy of the GNU General Public License along #18# #
19# with this program; if not, write to the Free Software Foundation, Inc., 59 #19# You should have received a copy of the GNU General Public License #
20# Temple Place, Suite 330, Boston, MA 02111-1307 USA #20# along with this program. If not, see <https://www.gnu.org/licenses/>. #
21###############################################################################21##########################################################################
22"""22"""
23The :mod:`db` module provides helper functions for database related methods.23The :mod:`db` module provides helper functions for database related methods.
24"""24"""
2525
=== modified file 'openlp/core/common/httputils.py'
--- openlp/core/common/httputils.py 2019-02-14 15:09:09 +0000
+++ openlp/core/common/httputils.py 2019-07-01 17:47:01 +0000
@@ -1,24 +1,24 @@
1# -*- coding: utf-8 -*-1# -*- coding: utf-8 -*-
2# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=42# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
33
4###############################################################################4##########################################################################
5# OpenLP - Open Source Lyrics Projection #5# OpenLP - Open Source Lyrics Projection #
6# --------------------------------------------------------------------------- #6# ---------------------------------------------------------------------- #
7# Copyright (c) 2008-2019 OpenLP Developers #7# Copyright (c) 2008-2019 OpenLP Developers #
8# --------------------------------------------------------------------------- #8# ---------------------------------------------------------------------- #
9# This program is free software; you can redistribute it and/or modify it #9# This program is free software: you can redistribute it and/or modify #
10# under the terms of the GNU General Public License as published by the Free #10# it under the terms of the GNU General Public License as published by #
11# Software Foundation; version 2 of the License. #11# the Free Software Foundation, either version 3 of the License, or #
12# #12# (at your option) any later version. #
13# This program is distributed in the hope that it will be useful, but WITHOUT #13# #
14# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #14# This program is distributed in the hope that it will be useful, #
15# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #15# but WITHOUT ANY WARRANTY; without even the implied warranty of #
16# more details. #16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
17# #17# GNU General Public License for more details. #
18# You should have received a copy of the GNU General Public License along #18# #
19# with this program; if not, write to the Free Software Foundation, Inc., 59 #19# You should have received a copy of the GNU General Public License #
20# Temple Place, Suite 330, Boston, MA 02111-1307 USA #20# along with this program. If not, see <https://www.gnu.org/licenses/>. #
21###############################################################################21##########################################################################
22"""22"""
23The :mod:`openlp.core.common.httputils` module provides the utility methods for downloading stuff.23The :mod:`openlp.core.common.httputils` module provides the utility methods for downloading stuff.
24"""24"""
@@ -26,13 +26,17 @@
26import logging26import logging
27import sys27import sys
28import time28import time
29from pathlib import Path
29from random import randint30from random import randint
31from tempfile import gettempdir
3032
31import requests33import requests
34from PyQt5 import QtCore
3235
33from openlp.core.common import trace_error_handler36from openlp.core.common import trace_error_handler
34from openlp.core.common.registry import Registry37from openlp.core.common.registry import Registry
35from openlp.core.common.settings import ProxyMode, Settings38from openlp.core.common.settings import ProxyMode, Settings
39from openlp.core.threading import ThreadWorker
3640
3741
38log = logging.getLogger(__name__ + '.__init__')42log = logging.getLogger(__name__ + '.__init__')
@@ -154,16 +158,20 @@
154 return response.text158 return response.text
155159
156160
157def get_url_file_size(url):161def get_url_file_size(url, proxy=None):
158 """162 """
159 Get the size of a file.163 Get the size of a file.
160164
161 :param url: The URL of the file we want to download.165 :param url: The URL of the file we want to download.
166 :param dict | ProxyMode | None proxy: ProxyMode enum or a dictionary containing the proxy servers, with their types
167 as the key e.g. {'http': 'http://proxyserver:port', 'https': 'https://proxyserver:port'}
162 """168 """
163 retries = 0169 retries = 0
170 if not isinstance(proxy, dict):
171 proxy = get_proxy_settings(mode=proxy)
164 while True:172 while True:
165 try:173 try:
166 response = requests.head(url, timeout=float(CONNECTION_TIMEOUT), allow_redirects=True)174 response = requests.head(url, proxies=proxy, timeout=float(CONNECTION_TIMEOUT), allow_redirects=True)
167 return int(response.headers['Content-Length'])175 return int(response.headers['Content-Length'])
168 except OSError:176 except OSError:
169 if retries > CONNECTION_RETRIES:177 if retries > CONNECTION_RETRIES:
@@ -174,7 +182,7 @@
174 continue182 continue
175183
176184
177def download_file(update_object, url, file_path, sha256=None):185def download_file(update_object, url, file_path, sha256=None, proxy=None):
178 """"186 """"
179 Download a file given a URL. The file is retrieved in chunks, giving the ability to cancel the download at any187 Download a file given a URL. The file is retrieved in chunks, giving the ability to cancel the download at any
180 point. Returns False on download error.188 point. Returns False on download error.
@@ -183,15 +191,19 @@
183 :param url: URL to download191 :param url: URL to download
184 :param file_path: Destination file192 :param file_path: Destination file
185 :param sha256: The check sum value to be checked against the download value193 :param sha256: The check sum value to be checked against the download value
194 :param dict | ProxyMode | None proxy: ProxyMode enum or a dictionary containing the proxy servers, with their types
195 as the key e.g. {'http': 'http://proxyserver:port', 'https': 'https://proxyserver:port'}
186 """196 """
187 block_count = 0197 block_count = 0
188 block_size = 4096198 block_size = 4096
189 retries = 0199 retries = 0
200 if not isinstance(proxy, dict):
201 proxy = get_proxy_settings(mode=proxy)
190 log.debug('url_get_file: %s', url)202 log.debug('url_get_file: %s', url)
191 while retries < CONNECTION_RETRIES:203 while retries < CONNECTION_RETRIES:
192 try:204 try:
193 with file_path.open('wb') as saved_file:205 with file_path.open('wb') as saved_file:
194 response = requests.get(url, timeout=float(CONNECTION_TIMEOUT), stream=True)206 response = requests.get(url, proxies=proxy, timeout=float(CONNECTION_TIMEOUT), stream=True)
195 if sha256:207 if sha256:
196 hasher = hashlib.sha256()208 hasher = hashlib.sha256()
197 # Download until finished or canceled.209 # Download until finished or canceled.
@@ -227,4 +239,46 @@
227 return True239 return True
228240
229241
230__all__ = ['get_web_page']242class DownloadWorker(ThreadWorker):
243 """
244 This worker allows a file to be downloaded in a thread
245 """
246 download_failed = QtCore.pyqtSignal()
247 download_succeeded = QtCore.pyqtSignal(Path)
248
249 def __init__(self, base_url, file_name):
250 """
251 Set up the worker object
252 """
253 self._base_url = base_url
254 self._file_name = file_name
255 self.was_cancelled = False
256 super().__init__()
257
258 def start(self):
259 """
260 Download the url to the temporary directory
261 """
262 if self.was_cancelled:
263 self.quit.emit()
264 return
265 try:
266 dest_path = Path(gettempdir()) / 'openlp' / self._file_name
267 url = '{url}{name}'.format(url=self._base_url, name=self._file_name)
268 is_success = download_file(self, url, dest_path)
269 if is_success and not self.was_cancelled:
270 self.download_succeeded.emit(dest_path)
271 else:
272 self.download_failed.emit()
273 except Exception:
274 log.exception('Unable to download %s', url)
275 self.download_failed.emit()
276 finally:
277 self.quit.emit()
278
279 @QtCore.pyqtSlot()
280 def cancel_download(self):
281 """
282 A slot to allow the download to be cancelled from outside of the thread
283 """
284 self.was_cancelled = True
231285
=== modified file 'openlp/core/common/i18n.py'
--- openlp/core/common/i18n.py 2019-02-14 15:09:09 +0000
+++ openlp/core/common/i18n.py 2019-07-01 17:47:01 +0000
@@ -1,24 +1,24 @@
1# -*- coding: utf-8 -*-1# -*- coding: utf-8 -*-
2# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=42# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
33
4###############################################################################4##########################################################################
5# OpenLP - Open Source Lyrics Projection #5# OpenLP - Open Source Lyrics Projection #
6# --------------------------------------------------------------------------- #6# ---------------------------------------------------------------------- #
7# Copyright (c) 2008-2019 OpenLP Developers #7# Copyright (c) 2008-2019 OpenLP Developers #
8# --------------------------------------------------------------------------- #8# ---------------------------------------------------------------------- #
9# This program is free software; you can redistribute it and/or modify it #9# This program is free software: you can redistribute it and/or modify #
10# under the terms of the GNU General Public License as published by the Free #10# it under the terms of the GNU General Public License as published by #
11# Software Foundation; version 2 of the License. #11# the Free Software Foundation, either version 3 of the License, or #
12# #12# (at your option) any later version. #
13# This program is distributed in the hope that it will be useful, but WITHOUT #13# #
14# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #14# This program is distributed in the hope that it will be useful, #
15# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #15# but WITHOUT ANY WARRANTY; without even the implied warranty of #
16# more details. #16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
17# #17# GNU General Public License for more details. #
18# You should have received a copy of the GNU General Public License along #18# #
19# with this program; if not, write to the Free Software Foundation, Inc., 59 #19# You should have received a copy of the GNU General Public License #
20# Temple Place, Suite 330, Boston, MA 02111-1307 USA #20# along with this program. If not, see <https://www.gnu.org/licenses/>. #
21###############################################################################21##########################################################################
22"""22"""
23The :mod:`languages` module provides a list of language names with utility functions.23The :mod:`languages` module provides a list of language names with utility functions.
24"""24"""
@@ -385,7 +385,8 @@
385 self.Error = translate('OpenLP.Ui', 'Error')385 self.Error = translate('OpenLP.Ui', 'Error')
386 self.Export = translate('OpenLP.Ui', 'Export')386 self.Export = translate('OpenLP.Ui', 'Export')
387 self.File = translate('OpenLP.Ui', 'File')387 self.File = translate('OpenLP.Ui', 'File')
388 self.FontSizePtUnit = translate('OpenLP.Ui', 'pt', 'Abbreviated font pointsize unit')388 self.FileCorrupt = translate('OpenLP.Ui', 'File appears to be corrupt.')
389 self.FontSizePtUnit = translate('OpenLP.Ui', 'pt', 'Abbreviated font point size unit')
389 self.Help = translate('OpenLP.Ui', 'Help')390 self.Help = translate('OpenLP.Ui', 'Help')
390 self.Hours = translate('OpenLP.Ui', 'h', 'The abbreviated unit for hours')391 self.Hours = translate('OpenLP.Ui', 'h', 'The abbreviated unit for hours')
391 self.IFdSs = translate('OpenLP.Ui', 'Invalid Folder Selected', 'Singular')392 self.IFdSs = translate('OpenLP.Ui', 'Invalid Folder Selected', 'Singular')
392393
=== modified file 'openlp/core/common/json.py'
--- openlp/core/common/json.py 2019-02-14 15:09:09 +0000
+++ openlp/core/common/json.py 2019-07-01 17:47:01 +0000
@@ -1,32 +1,93 @@
1# -*- coding: utf-8 -*-1# -*- coding: utf-8 -*-
2# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=42# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
33
4###############################################################################4##########################################################################
5# OpenLP - Open Source Lyrics Projection #5# OpenLP - Open Source Lyrics Projection #
6# --------------------------------------------------------------------------- #6# ---------------------------------------------------------------------- #
7# Copyright (c) 2008-2019 OpenLP Developers #7# Copyright (c) 2008-2019 OpenLP Developers #
8# --------------------------------------------------------------------------- #8# ---------------------------------------------------------------------- #
9# This program is free software; you can redistribute it and/or modify it #9# This program is free software: you can redistribute it and/or modify #
10# under the terms of the GNU General Public License as published by the Free #10# it under the terms of the GNU General Public License as published by #
11# Software Foundation; version 2 of the License. #11# the Free Software Foundation, either version 3 of the License, or #
12# #12# (at your option) any later version. #
13# This program is distributed in the hope that it will be useful, but WITHOUT #13# #
14# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #14# This program is distributed in the hope that it will be useful, #
15# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #15# but WITHOUT ANY WARRANTY; without even the implied warranty of #
16# more details. #16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
17# #17# GNU General Public License for more details. #
18# You should have received a copy of the GNU General Public License along #18# #
19# with this program; if not, write to the Free Software Foundation, Inc., 59 #19# You should have received a copy of the GNU General Public License #
20# Temple Place, Suite 330, Boston, MA 02111-1307 USA #20# along with this program. If not, see <https://www.gnu.org/licenses/>. #
21###############################################################################21##########################################################################
22from contextlib import suppress
22from json import JSONDecoder, JSONEncoder23from json import JSONDecoder, JSONEncoder
2324from pathlib import Path
24from openlp.core.common.path import Path25
2526_registered_classes = {}
2627
27class OpenLPJsonDecoder(JSONDecoder):28
28 """29class JSONMixin(object):
29 Implement a custom JSONDecoder to handle Path objects30 """
31 :class:`JSONMixin` is a mixin class to simplify the serialization of a subclass to JSON.
32
33 :cvar:`_json_keys` is used to specify the attributes of the subclass that you wish to serialize.
34 :vartype _json_keys: list[str]
35 :cvar:`_name` set to override the the subclass name, useful if using a `proxy` class
36 :vartype _name: str
37 """
38 _json_keys = []
39 _name = None
40 _version = 1
41
42 def __init_subclass__(cls, register_names=None, **kwargs):
43 """
44 Register the subclass.
45
46 :param collections.Iterable[str] register_names: Alternative names to register instead of the class name
47 :param kwargs: Other args to pass to the super method
48 :return None:
49 """
50 super().__init_subclass__(**kwargs)
51 for key in register_names or [cls.__name__]:
52 _registered_classes[key] = cls
53
54 @classmethod
55 def encode_json(cls, obj, **kwargs):
56 """
57 Create a instance of the subclass from the dictionary that has been constructed by the JSON representation.
58 Only use the keys specified in :cvar:`_json_keys`.
59
60 :param dict[str] obj: The dictionary representation of the subclass (deserailized from the JSON)
61 :param kwargs: Contains any extra parameters. Not used!
62 :return: The desrialized object
63 """
64 return cls(**{key: obj[key] for key in cls._json_keys if obj.get(key) is not None})
65
66 @classmethod
67 def attach_meta(cls, j_dict):
68 """
69 Attach meta data to the serialized dictionary.
70
71 :param dict[str] j_dict: The dictionary to update with the meta data
72 :return None:
73 """
74 j_dict.update({'json_meta': {'class': cls._name or cls.__name__, 'version': cls._version}})
75
76 def json_object(self, **kwargs):
77 """
78 Create a dictionary that can be JSON decoded.
79
80 :param kwargs: Contains any extra parameters. Not used!
81 :return dict[str]: The dictionary representation of this Path object.
82 """
83 j_dict = {key: self.__dict__[key] for key in self._json_keys if self.__dict__.get(key) is not None}
84 self.attach_meta(j_dict)
85 return j_dict
86
87
88class OpenLPJSONDecoder(JSONDecoder):
89 """
90 Implement a custom JSONDecoder to extend compatibility to custom objects
3091
31 Example Usage:92 Example Usage:
32 object = json.loads(json_string, cls=OpenLPJsonDecoder)93 object = json.loads(json_string, cls=OpenLPJsonDecoder)
@@ -45,23 +106,28 @@
45106
46 def custom_object_hook(self, obj):107 def custom_object_hook(self, obj):
47 """108 """
48 Implement a custom Path object decoder.109 Implement a custom object decoder.
49110
50 :param dict obj: A decoded JSON object111 :param dict obj: A decoded JSON object
51 :return: The original object literal, or a Path object if the object literal contains a key '__Path__'112 :return: The custom object from the serialized data if the custom object is registered, else obj
52 :rtype: dict | openlp.core.common.path.Path
53 """113 """
54 if '__Path__' in obj:114 if '__Path__' in obj:
55 obj = Path.encode_json(obj, **self.kwargs)115 return PathSerializer.encode_json(obj, **self.kwargs)
116 try:
117 key = obj['json_meta']['class']
118 except KeyError:
119 return obj
120 if key in _registered_classes:
121 return _registered_classes[key].encode_json(obj, **self.kwargs)
56 return obj122 return obj
57123
58124
59class OpenLPJsonEncoder(JSONEncoder):125class OpenLPJSONEncoder(JSONEncoder):
60 """126 """
61 Implement a custom JSONEncoder to handle Path objects127 Implement a custom JSONEncoder to handle to extend compatibility to custom objects
62128
63 Example Usage:129 Example Usage:
64 json_string = json.dumps(object, cls=OpenLPJsonEncoder)130 json_string = json.dumps(object, cls=OpenLPJSONEncoder)
65 """131 """
66 def __init__(self, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False,132 def __init__(self, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False,
67 indent=None, separators=None, default=None, **kwargs):133 indent=None, separators=None, default=None, **kwargs):
@@ -78,12 +144,64 @@
78144
79 def custom_default(self, obj):145 def custom_default(self, obj):
80 """146 """
81 Convert any Path objects into a dictionary object which can be serialized.147 Convert any registered objects into a dictionary object which can be serialized.
82148
83 :param object obj: The object to convert149 :param object obj: The object to convert
84 :return: The serializable object150 :return dict: The serializable object
85 :rtype: dict151 """
86 """152 if isinstance(obj, JSONMixin):
87 if isinstance(obj, Path):153 return obj.json_object()
88 return obj.json_object(**self.kwargs)154 elif obj.__class__.__name__ in _registered_classes:
89 return super().default(obj)155 return _registered_classes[obj.__class__.__name__].json_object(obj, **self.kwargs)
156 return super().default(obj, **self.kwargs)
157
158
159def is_serializable(obj):
160 return obj.__class__.__name__ in _registered_classes
161
162
163class PathSerializer(JSONMixin, register_names=('Path', 'PosixPath', 'WindowsPath')):
164 """
165 Implement a de/serializer for pathlib.Path objects
166 """
167 _name = 'Path'
168
169 @staticmethod
170 def encode_json(obj, base_path=None, **kwargs):
171 """
172 Reimplement encode_json to create a Path object from a dictionary representation.
173
174 :param dict[str] obj: The dictionary representation
175 :param Path base_path: If specified, an absolute path to base the relative path off of.
176 :param kwargs: Contains any extra parameters. Not used!
177 :return Path: The deserialized Path object
178 """
179 if '__Path__' in obj:
180 parts = obj['__Path__']
181 else:
182 parts = obj['parts']
183 path = Path(*parts)
184 if base_path and not path.is_absolute():
185 return base_path / path
186 return path
187
188 @classmethod
189 def json_object(cls, obj, base_path=None, is_js=False, **kwargs):
190 """
191 Create a dictionary that can be JSON decoded.
192
193 :param Path base_path: If specified, an absolute path to make a relative path from.
194 :param bool is_js: Encode the path as a uri. For example for use in the js rendering code.
195 :param kwargs: Contains any extra parameters. Not used!
196 :return: The dictionary representation of this Path object.
197 :rtype: dict[tuple]
198 """
199 path = obj
200 if base_path:
201 with suppress(ValueError):
202 path = path.relative_to(base_path)
203 if is_js is True:
204 return path.as_uri()
205 json_dict = {'parts': path.parts}
206 cls.attach_meta(json_dict)
207 return json_dict
90208
=== modified file 'openlp/core/common/mixins.py'
--- openlp/core/common/mixins.py 2019-02-14 15:09:09 +0000
+++ openlp/core/common/mixins.py 2019-07-01 17:47:01 +0000
@@ -1,24 +1,24 @@
1# -*- coding: utf-8 -*-1# -*- coding: utf-8 -*-
2# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=42# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
33
4###############################################################################4##########################################################################
5# OpenLP - Open Source Lyrics Projection #5# OpenLP - Open Source Lyrics Projection #
6# --------------------------------------------------------------------------- #6# ---------------------------------------------------------------------- #
7# Copyright (c) 2008-2019 OpenLP Developers #7# Copyright (c) 2008-2019 OpenLP Developers #
8# --------------------------------------------------------------------------- #8# ---------------------------------------------------------------------- #
9# This program is free software; you can redistribute it and/or modify it #9# This program is free software: you can redistribute it and/or modify #
10# under the terms of the GNU General Public License as published by the Free #10# it under the terms of the GNU General Public License as published by #
11# Software Foundation; version 2 of the License. #11# the Free Software Foundation, either version 3 of the License, or #
12# #12# (at your option) any later version. #
13# This program is distributed in the hope that it will be useful, but WITHOUT #13# #
14# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #14# This program is distributed in the hope that it will be useful, #
15# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #15# but WITHOUT ANY WARRANTY; without even the implied warranty of #
16# more details. #16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
17# #17# GNU General Public License for more details. #
18# You should have received a copy of the GNU General Public License along #18# #
19# with this program; if not, write to the Free Software Foundation, Inc., 59 #19# You should have received a copy of the GNU General Public License #
20# Temple Place, Suite 330, Boston, MA 02111-1307 USA #20# along with this program. If not, see <https://www.gnu.org/licenses/>. #
21###############################################################################21##########################################################################
22"""22"""
23Provide Error Handling and login Services23Provide Error Handling and login Services
24"""24"""
2525
=== modified file 'openlp/core/common/path.py'
--- openlp/core/common/path.py 2019-02-14 15:09:09 +0000
+++ openlp/core/common/path.py 2019-07-01 17:47:01 +0000
@@ -1,86 +1,31 @@
1# -*- coding: utf-8 -*-1# -*- coding: utf-8 -*-
2# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=42# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
33
4###############################################################################4##########################################################################
5# OpenLP - Open Source Lyrics Projection #5# OpenLP - Open Source Lyrics Projection #
6# --------------------------------------------------------------------------- #6# ---------------------------------------------------------------------- #
7# Copyright (c) 2008-2019 OpenLP Developers #7# Copyright (c) 2008-2019 OpenLP Developers #
8# --------------------------------------------------------------------------- #8# ---------------------------------------------------------------------- #
9# This program is free software; you can redistribute it and/or modify it #9# This program is free software: you can redistribute it and/or modify #
10# under the terms of the GNU General Public License as published by the Free #10# it under the terms of the GNU General Public License as published by #
11# Software Foundation; version 2 of the License. #11# the Free Software Foundation, either version 3 of the License, or #
12# #12# (at your option) any later version. #
13# This program is distributed in the hope that it will be useful, but WITHOUT #13# #
14# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #14# This program is distributed in the hope that it will be useful, #
15# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #15# but WITHOUT ANY WARRANTY; without even the implied warranty of #
16# more details. #16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
17# #17# GNU General Public License for more details. #
18# You should have received a copy of the GNU General Public License along #18# #
19# with this program; if not, write to the Free Software Foundation, Inc., 59 #19# You should have received a copy of the GNU General Public License #
20# Temple Place, Suite 330, Boston, MA 02111-1307 USA #20# along with this program. If not, see <https://www.gnu.org/licenses/>. #
21###############################################################################21##########################################################################
22import logging22import logging
23import shutil23import shutil
24from contextlib import suppress24from pathlib import Path
25
26from openlp.core.common import is_win
27
28
29if is_win():
30 from pathlib import WindowsPath as PathVariant # pragma: nocover
31else:
32 from pathlib import PosixPath as PathVariant # pragma: nocover
3325
34log = logging.getLogger(__name__)26log = logging.getLogger(__name__)
3527
3628
37class Path(PathVariant):
38 """
39 Subclass pathlib.Path, so we can add json conversion methods
40 """
41 @staticmethod
42 def encode_json(obj, base_path=None, **kwargs):
43 """
44 Create a Path object from a dictionary representation. The dictionary has been constructed by JSON encoding of
45 a JSON reprensation of a Path object.
46
47 :param dict[str] obj: The dictionary representation
48 :param openlp.core.common.path.Path base_path: If specified, an absolute path to base the relative path off of.
49 :param kwargs: Contains any extra parameters. Not used!
50 :return: The reconstructed Path object
51 :rtype: openlp.core.common.path.Path
52 """
53 path = Path(*obj['__Path__'])
54 if base_path and not path.is_absolute():
55 return base_path / path
56 return path
57
58 def json_object(self, base_path=None, **kwargs):
59 """
60 Create a dictionary that can be JSON decoded.
61
62 :param openlp.core.common.path.Path base_path: If specified, an absolute path to make a relative path from.
63 :param kwargs: Contains any extra parameters. Not used!
64 :return: The dictionary representation of this Path object.
65 :rtype: dict[tuple]
66 """
67 path = self
68 if base_path:
69 with suppress(ValueError):
70 path = path.relative_to(base_path)
71 return {'__Path__': path.parts}
72
73 def rmtree(self, ignore_errors=False, onerror=None):
74 """
75 Provide an interface to :func:`shutil.rmtree`
76
77 :param bool ignore_errors: Ignore errors
78 :param onerror: Handler function to handle any errors
79 :rtype: None
80 """
81 shutil.rmtree(str(self), ignore_errors, onerror)
82
83
84def replace_params(args, kwargs, params):29def replace_params(args, kwargs, params):
85 """30 """
86 Apply a transformation function to the specified args or kwargs31 Apply a transformation function to the specified args or kwargs
@@ -110,65 +55,11 @@
110 return tuple(args), kwargs55 return tuple(args), kwargs
11156
11257
113def copy(*args, **kwargs):
114 """
115 Wraps :func:`shutil.copy` so that we can accept Path objects.
116
117 :param src openlp.core.common.path.Path: Takes a Path object which is then converted to a str object
118 :param dst openlp.core.common.path.Path: Takes a Path object which is then converted to a str object
119 :return: Converts the str object received from :func:`shutil.copy` to a Path or NoneType object
120 :rtype: openlp.core.common.path.Path | None
121
122 See the following link for more information on the other parameters:
123 https://docs.python.org/3/library/shutil.html#shutil.copy
124 """
125
126 args, kwargs = replace_params(args, kwargs, ((0, 'src', path_to_str), (1, 'dst', path_to_str)))
127
128 return str_to_path(shutil.copy(*args, **kwargs))
129
130
131def copyfile(*args, **kwargs):
132 """
133 Wraps :func:`shutil.copyfile` so that we can accept Path objects.
134
135 :param openlp.core.common.path.Path src: Takes a Path object which is then converted to a str object
136 :param openlp.core.common.path.Path dst: Takes a Path object which is then converted to a str object
137 :return: Converts the str object received from :func:`shutil.copyfile` to a Path or NoneType object
138 :rtype: openlp.core.common.path.Path | None
139
140 See the following link for more information on the other parameters:
141 https://docs.python.org/3/library/shutil.html#shutil.copyfile
142 """
143
144 args, kwargs = replace_params(args, kwargs, ((0, 'src', path_to_str), (1, 'dst', path_to_str)))
145
146 return str_to_path(shutil.copyfile(*args, **kwargs))
147
148
149def copytree(*args, **kwargs):
150 """
151 Wraps :func:shutil.copytree` so that we can accept Path objects.
152
153 :param openlp.core.common.path.Path src : Takes a Path object which is then converted to a str object
154 :param openlp.core.common.path.Path dst: Takes a Path object which is then converted to a str object
155 :return: Converts the str object received from :func:`shutil.copytree` to a Path or NoneType object
156 :rtype: openlp.core.common.path.Path | None
157
158 See the following link for more information on the other parameters:
159 https://docs.python.org/3/library/shutil.html#shutil.copytree
160 """
161
162 args, kwargs = replace_params(args, kwargs, ((0, 'src', path_to_str), (1, 'dst', path_to_str)))
163
164 return str_to_path(shutil.copytree(*args, **kwargs))
165
166
167def which(*args, **kwargs):58def which(*args, **kwargs):
168 """59 """
169 Wraps :func:shutil.which` so that it return a Path objects.60 Wraps :func:shutil.which` so that it return a Path objects.
17061
171 :rtype: openlp.core.common.Path62 :rtype: Path
17263
173 See the following link for more information on the other parameters:64 See the following link for more information on the other parameters:
174 https://docs.python.org/3/library/shutil.html#shutil.which65 https://docs.python.org/3/library/shutil.html#shutil.which
@@ -183,10 +74,12 @@
183 """74 """
184 A utility function to convert a Path object or NoneType to a string equivalent.75 A utility function to convert a Path object or NoneType to a string equivalent.
18576
186 :param openlp.core.common.path.Path | None path: The value to convert to a string77 :param Path | None path: The value to convert to a string
187 :return: An empty string if :param:`path` is None, else a string representation of the :param:`path`78 :return: An empty string if :param:`path` is None, else a string representation of the :param:`path`
188 :rtype: str79 :rtype: str
189 """80 """
81 if isinstance(path, str):
82 return path
190 if not isinstance(path, Path) and path is not None:83 if not isinstance(path, Path) and path is not None:
191 raise TypeError('parameter \'path\' must be of type Path or NoneType')84 raise TypeError('parameter \'path\' must be of type Path or NoneType')
192 if path is None:85 if path is None:
@@ -204,7 +97,7 @@
20497
205 :param str string: The string to convert98 :param str string: The string to convert
206 :return: None if :param:`string` is empty, or a Path object representation of :param:`string`99 :return: None if :param:`string` is empty, or a Path object representation of :param:`string`
207 :rtype: openlp.core.common.path.Path | None100 :rtype: Path | None
208 """101 """
209 if not isinstance(string, str):102 if not isinstance(string, str):
210 log.error('parameter \'string\' must be of type str, got {} which is a {} instead'.format(string, type(string)))103 log.error('parameter \'string\' must be of type str, got {} which is a {} instead'.format(string, type(string)))
@@ -218,7 +111,7 @@
218 """111 """
219 Create one or more paths112 Create one or more paths
220113
221 :param openlp.core.common.path.Path paths: The paths to create114 :param Path paths: The paths to create
222 :param bool do_not_log: To not log anything. This is need for the start up, when the log isn't ready.115 :param bool do_not_log: To not log anything. This is need for the start up, when the log isn't ready.
223 :rtype: None116 :rtype: None
224 """117 """
@@ -239,7 +132,7 @@
239132
240 :param list[str] file_names: The list of file names to convert.133 :param list[str] file_names: The list of file names to convert.
241 :return: The list converted to file paths134 :return: The list converted to file paths
242 :rtype: openlp.core.common.path.Path135 :rtype: Path
243 """136 """
244 if file_names:137 if file_names:
245 return [str_to_path(file_name) for file_name in file_names]138 return [str_to_path(file_name) for file_name in file_names]
246139
=== modified file 'openlp/core/common/registry.py'
--- openlp/core/common/registry.py 2019-02-14 15:09:09 +0000
+++ openlp/core/common/registry.py 2019-07-01 17:47:01 +0000
@@ -1,24 +1,24 @@
1# -*- coding: utf-8 -*-1# -*- coding: utf-8 -*-
2# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=42# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
33
4###############################################################################4##########################################################################
5# OpenLP - Open Source Lyrics Projection #5# OpenLP - Open Source Lyrics Projection #
6# --------------------------------------------------------------------------- #6# ---------------------------------------------------------------------- #
7# Copyright (c) 2008-2019 OpenLP Developers #7# Copyright (c) 2008-2019 OpenLP Developers #
8# --------------------------------------------------------------------------- #8# ---------------------------------------------------------------------- #
9# This program is free software; you can redistribute it and/or modify it #9# This program is free software: you can redistribute it and/or modify #
10# under the terms of the GNU General Public License as published by the Free #10# it under the terms of the GNU General Public License as published by #
11# Software Foundation; version 2 of the License. #11# the Free Software Foundation, either version 3 of the License, or #
12# #12# (at your option) any later version. #
13# This program is distributed in the hope that it will be useful, but WITHOUT #13# #
14# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #14# This program is distributed in the hope that it will be useful, #
15# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #15# but WITHOUT ANY WARRANTY; without even the implied warranty of #
16# more details. #16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
17# #17# GNU General Public License for more details. #
18# You should have received a copy of the GNU General Public License along #18# #
19# with this program; if not, write to the Free Software Foundation, Inc., 59 #19# You should have received a copy of the GNU General Public License #
20# Temple Place, Suite 330, Boston, MA 02111-1307 USA #20# along with this program. If not, see <https://www.gnu.org/licenses/>. #
21###############################################################################21##########################################################################
22"""22"""
23Provide Registry Services23Provide Registry Services
24"""24"""
@@ -146,7 +146,7 @@
146 try:146 try:
147 log.debug('Running function {} for {}'.format(function, event))147 log.debug('Running function {} for {}'.format(function, event))
148 result = function(*args, **kwargs)148 result = function(*args, **kwargs)
149 if result:149 if result is not None:
150 results.append(result)150 results.append(result)
151 except TypeError:151 except TypeError:
152 # Who has called me can help in debugging152 # Who has called me can help in debugging
153153
=== modified file 'openlp/core/common/settings.py'
--- openlp/core/common/settings.py 2019-02-14 15:09:09 +0000
+++ openlp/core/common/settings.py 2019-07-01 17:47:01 +0000
@@ -1,24 +1,24 @@
1# -*- coding: utf-8 -*-1# -*- coding: utf-8 -*-
2# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=42# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
33
4###############################################################################4##########################################################################
5# OpenLP - Open Source Lyrics Projection #5# OpenLP - Open Source Lyrics Projection #
6# --------------------------------------------------------------------------- #6# ---------------------------------------------------------------------- #
7# Copyright (c) 2008-2019 OpenLP Developers #7# Copyright (c) 2008-2019 OpenLP Developers #
8# --------------------------------------------------------------------------- #8# ---------------------------------------------------------------------- #
9# This program is free software; you can redistribute it and/or modify it #9# This program is free software: you can redistribute it and/or modify #
10# under the terms of the GNU General Public License as published by the Free #10# it under the terms of the GNU General Public License as published by #
11# Software Foundation; version 2 of the License. #11# the Free Software Foundation, either version 3 of the License, or #
12# #12# (at your option) any later version. #
13# This program is distributed in the hope that it will be useful, but WITHOUT #13# #
14# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #14# This program is distributed in the hope that it will be useful, #
15# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #15# but WITHOUT ANY WARRANTY; without even the implied warranty of #
16# more details. #16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
17# #17# GNU General Public License for more details. #
18# You should have received a copy of the GNU General Public License along #18# #
19# with this program; if not, write to the Free Software Foundation, Inc., 59 #19# You should have received a copy of the GNU General Public License #
20# Temple Place, Suite 330, Boston, MA 02111-1307 USA #20# along with this program. If not, see <https://www.gnu.org/licenses/>. #
21###############################################################################21##########################################################################
22"""22"""
23This class contains the core default settings.23This class contains the core default settings.
24"""24"""
@@ -27,13 +27,14 @@
27import logging27import logging
28import os28import os
29from enum import IntEnum29from enum import IntEnum
30from pathlib import Path
30from tempfile import gettempdir31from tempfile import gettempdir
3132
32from PyQt5 import QtCore, QtGui33from PyQt5 import QtCore, QtGui
3334
34from openlp.core.common import SlideLimits, ThemeLevel, is_linux, is_win35from openlp.core.common import SlideLimits, ThemeLevel, is_linux, is_win
35from openlp.core.common.json import OpenLPJsonDecoder, OpenLPJsonEncoder36from openlp.core.common.json import OpenLPJSONDecoder, OpenLPJSONEncoder, is_serializable
36from openlp.core.common.path import Path, files_to_paths, str_to_path37from openlp.core.common.path import files_to_paths, str_to_path
3738
3839
39log = logging.getLogger(__name__)40log = logging.getLogger(__name__)
@@ -177,14 +178,13 @@
177 'api/thumbnails': True,178 'api/thumbnails': True,
178 'crashreport/last directory': None,179 'crashreport/last directory': None,
179 'formattingTags/html_tags': '',180 'formattingTags/html_tags': '',
180 'core/audio repeat list': False,
181 'core/auto open': False,181 'core/auto open': False,
182 'core/auto preview': False,182 'core/auto preview': False,
183 'core/audio start paused': True,
184 'core/auto unblank': False,183 'core/auto unblank': False,
185 'core/click live slide to unblank': False,184 'core/click live slide to unblank': False,
186 'core/blank warning': False,185 'core/blank warning': False,
187 'core/ccli number': '',186 'core/ccli number': '',
187 'advanced/experimental': False,
188 'core/has run wizard': False,188 'core/has run wizard': False,
189 'core/language': '[en]',189 'core/language': '[en]',
190 'core/last version test': '',190 'core/last version test': '',
@@ -202,13 +202,16 @@
202 'core/view mode': 'default',202 'core/view mode': 'default',
203 # The other display settings (display position and dimensions) are defined in the ScreenList class due to a203 # The other display settings (display position and dimensions) are defined in the ScreenList class due to a
204 # circular dependency.204 # circular dependency.
205 'core/display on monitor': True,205 'core/display on monitor': False,
206 'core/override position': False,206 'core/override position': False,
207 'core/monitor': {},207 'core/monitor': {},
208 'core/application version': '0.0',208 'core/application version': '0.0',
209 'images/background color': '#000000',209 'images/background color': '#000000',
210 'media/players': 'system,webkit',210 'media/media auto start': QtCore.Qt.Unchecked,
211 'media/override player': QtCore.Qt.Unchecked,211 'media/stream command': '',
212 'media/vlc arguments': '',
213 'media/video': '',
214 'media/audio': '',
212 'remotes/download version': '0.0',215 'remotes/download version': '0.0',
213 'players/background color': '#000000',216 'players/background color': '#000000',
214 'servicemanager/last directory': None,217 'servicemanager/last directory': None,
@@ -311,7 +314,11 @@
311 ('bibles/proxy name', '', []), # Just remove these bible proxy settings. They weren't used in 2.4!314 ('bibles/proxy name', '', []), # Just remove these bible proxy settings. They weren't used in 2.4!
312 ('bibles/proxy address', '', []),315 ('bibles/proxy address', '', []),
313 ('bibles/proxy username', '', []),316 ('bibles/proxy username', '', []),
314 ('bibles/proxy password', '', [])317 ('bibles/proxy password', '', []),
318 ('media/players', '', []),
319 ('media/override player', '', []),
320 ('core/audio start paused', '', []),
321 ('core/audio repeat list', '', [])
315 ]322 ]
316323
317 @staticmethod324 @staticmethod
@@ -330,7 +337,7 @@
330337
331 Does not affect existing Settings objects.338 Does not affect existing Settings objects.
332339
333 :param openlp.core.common.path.Path ini_path: ini file path340 :param Path ini_path: ini file path
334 :rtype: None341 :rtype: None
335 """342 """
336 Settings.__file_path__ = str(ini_path)343 Settings.__file_path__ = str(ini_path)
@@ -540,7 +547,7 @@
540 old_values = [self._convert_value(old_value, default_value)547 old_values = [self._convert_value(old_value, default_value)
541 for old_value, default_value in zip(old_values, default_values)]548 for old_value, default_value in zip(old_values, default_values)]
542 # Iterate over our rules and check what the old_value should be "converted" to.549 # Iterate over our rules and check what the old_value should be "converted" to.
543 new_value = None550 new_value = old_values[0]
544 for new_rule, old_rule in rules:551 for new_rule, old_rule in rules:
545 # If the value matches with the condition (rule), then use the provided value. This is used to552 # If the value matches with the condition (rule), then use the provided value. This is used to
546 # convert values. E. g. an old value 1 results in True, and 0 in False.553 # convert values. E. g. an old value 1 results in True, and 0 in False.
@@ -577,8 +584,9 @@
577 :param value: The value to save584 :param value: The value to save
578 :rtype: None585 :rtype: None
579 """586 """
580 if isinstance(value, (Path, dict)) or (isinstance(value, list) and value and isinstance(value[0], Path)):587 if is_serializable(value) or isinstance(value, dict) or \
581 value = json.dumps(value, cls=OpenLPJsonEncoder)588 (isinstance(value, list) and value and is_serializable(value[0])):
589 value = json.dumps(value, cls=OpenLPJSONEncoder)
582 super().setValue(key, value)590 super().setValue(key, value)
583591
584 def _convert_value(self, setting, default_value):592 def _convert_value(self, setting, default_value):
@@ -604,8 +612,8 @@
604 elif isinstance(default_value, dict):612 elif isinstance(default_value, dict):
605 return {}613 return {}
606 elif isinstance(setting, str):614 elif isinstance(setting, str):
607 if '__Path__' in setting or setting.startswith('{'):615 if 'json_meta' in setting or '__Path__' in setting or setting.startswith('{'):
608 return json.loads(setting, cls=OpenLPJsonDecoder)616 return json.loads(setting, cls=OpenLPJSONDecoder)
609 # Convert the setting to the correct type.617 # Convert the setting to the correct type.
610 if isinstance(default_value, bool):618 if isinstance(default_value, bool):
611 if isinstance(setting, bool):619 if isinstance(setting, bool):
@@ -622,7 +630,7 @@
622 """630 """
623 Export the settings to file.631 Export the settings to file.
624632
625 :param openlp.core.common.path.Path dest_path: The file path to create the export file.633 :param Path dest_path: The file path to create the export file.
626 :return: Success634 :return: Success
627 :rtype: bool635 :rtype: bool
628 """636 """
629637
=== modified file 'openlp/core/display/__init__.py'
--- openlp/core/display/__init__.py 2019-02-14 15:09:09 +0000
+++ openlp/core/display/__init__.py 2019-07-01 17:47:01 +0000
@@ -1,24 +1,24 @@
1# -*- coding: utf-8 -*-1# -*- coding: utf-8 -*-
2# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=42# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
33
4###############################################################################4##########################################################################
5# OpenLP - Open Source Lyrics Projection #5# OpenLP - Open Source Lyrics Projection #
6# --------------------------------------------------------------------------- #6# ---------------------------------------------------------------------- #
7# Copyright (c) 2008-2019 OpenLP Developers #7# Copyright (c) 2008-2019 OpenLP Developers #
8# --------------------------------------------------------------------------- #8# ---------------------------------------------------------------------- #
9# This program is free software; you can redistribute it and/or modify it #9# This program is free software: you can redistribute it and/or modify #
10# under the terms of the GNU General Public License as published by the Free #10# it under the terms of the GNU General Public License as published by #
11# Software Foundation; version 2 of the License. #11# the Free Software Foundation, either version 3 of the License, or #
12# #12# (at your option) any later version. #
13# This program is distributed in the hope that it will be useful, but WITHOUT #13# #
14# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #14# This program is distributed in the hope that it will be useful, #
15# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #15# but WITHOUT ANY WARRANTY; without even the implied warranty of #
16# more details. #16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
17# #17# GNU General Public License for more details. #
18# You should have received a copy of the GNU General Public License along #18# #
19# with this program; if not, write to the Free Software Foundation, Inc., 59 #19# You should have received a copy of the GNU General Public License #
20# Temple Place, Suite 330, Boston, MA 02111-1307 USA #20# along with this program. If not, see <https://www.gnu.org/licenses/>. #
21###############################################################################21##########################################################################
22"""22"""
23The :mod:`~openlp.core.display` module contains all the code related to rendering and output23The :mod:`~openlp.core.display` module contains all the code related to rendering and output
24"""24"""
2525
=== added file 'openlp/core/display/html/display.css'
--- openlp/core/display/html/display.css 1970-01-01 00:00:00 +0000
+++ openlp/core/display/html/display.css 2019-07-01 17:47:01 +0000
@@ -0,0 +1,80 @@
1@keyframes alert-scrolling-text {
2 0% { transform: translateX(100%); opacity: 1; }
3 99% { opacity: 1; }
4 100% { transform: translateX(-101%); opacity: 0;}
5}
6
7/* ALERT BACKGROUND STYLING */
8.bg-default {
9 position: absolute;
10 margin: 0;
11 padding: 0;
12 left: 0;
13 z-index: 11;
14 width: 100%;
15 height: 0;
16 min-height: 0;
17 overflow: hidden;
18 transform: translate(0,0);
19 transition: min-height 1s ease-out .5s;
20 white-space: nowrap;
21 display: flex;
22 flex-direction: row;
23 align-items: center;
24 /* align-content: center; */
25}
26
27.bg-default span {
28 display: inline-block;
29 padding-left: 120%;
30}
31
32.show-bg {
33 /* height: auto; */
34 min-height: 25%;
35 transition: min-height 1s ease-in .5s;
36}
37
38.middle {
39 align-items: center;
40}
41
42.alert-container {
43 position: absolute;
44 display: flex;
45 flex-direction: row;
46 height: 100vh;
47 width: 100vw;
48}
49
50.top {
51 align-items: flex-start;
52}
53
54.bottom {
55 align-items: flex-end;
56}
57
58/* ALERT TEXT STYLING */
59#alert {
60 z-index: 100;
61 overflow: visible;
62 color: #ffffff;
63 font-size: 40pt;
64 padding: 0;
65 margin: 0;
66 opacity: 0;
67 transition: opacity .5s linear;
68}
69
70#alert.hide-text {
71 opacity: 0;
72}
73
74#alert.show-text {
75 transform: none;
76 transition: none;
77 animation: none;
78 padding: auto 5px;
79 opacity: 1;
80}
081
=== modified file 'openlp/core/display/html/display.html'
--- openlp/core/display/html/display.html 2018-10-12 19:51:51 +0000
+++ openlp/core/display/html/display.html 2019-07-01 17:47:01 +0000
@@ -2,11 +2,11 @@
2<html>2<html>
3 <head>3 <head>
4 <title>Display Window</title>4 <title>Display Window</title>
5 <link href="reveal.css" rel="stylesheet">5 <link href="reveal.css" rel="stylesheet">
6 <style type="text/css">6 <style type="text/css">
7 body {7 body {
8 background: transparent !important;8 background: transparent !important;
9 color: #fff !important;9 color: rgb(255, 255, 255) !important;
10 }10 }
11 sup {11 sup {
12 vertical-align: super !important;12 vertical-align: super !important;
@@ -24,16 +24,21 @@
24 visibility: visible;24 visibility: visible;
25 z-index: -1;25 z-index: -1;
26 }26 }
27 </style>27 </style>
28 <link rel="stylesheet" type="text/css" href="display.css"></link>
28 <script type="text/javascript" src="qrc:///qtwebchannel/qwebchannel.js"></script>29 <script type="text/javascript" src="qrc:///qtwebchannel/qwebchannel.js"></script>
29 <script type="text/javascript" src="reveal.js"></script>30 <script type="text/javascript" src="reveal.js"></script>
30 <script type="text/javascript" src="display.js"></script>31 <script type="text/javascript" src="display.js"></script>
31 </head>32 </head>
33
32 <body>34 <body>
35 <div class="alert-container">
36 <div id="alert-background" class="bg-default"><span id="alert">Testing alerts</span></div>
37 </div>
33 <div class="reveal">38 <div class="reveal">
34 <div id="global-background" class="slide-background present" data-loaded="true"></div>39 <div id="global-background" class="slide-background present" data-loaded="true"></div>
35 <div class="slides"></div>40 <div class="slides"></div>
36 <div class="footer"></div>41 <div class="footer"></div>
37 </div>42 </div>
38 </body>43 </body>
39</html>44</html>
4045
=== modified file 'openlp/core/display/html/display.js'
--- openlp/core/display/html/display.js 2019-02-05 21:26:30 +0000
+++ openlp/core/display/html/display.js 2019-07-01 17:47:01 +0000
@@ -53,6 +53,50 @@
53};53};
5454
55/**55/**
56 * Transition state enumeration
57 */
58var TransitionState = {
59 EntranceTransition: "entranceTransition",
60 NoTransition: "noTransition",
61 ExitTransition: "exitTransition"
62};
63
64/**
65 * Animation state enumeration
66 */
67var AnimationState = {
68 NoAnimation: "noAnimation",
69 ScrollingText: "scrollingText",
70 NonScrollingText: "noScrollingText"
71};
72
73/**
74 * Alert location enumeration
75 */
76var AlertLocation = {
77 Top: 0,
78 Middle: 1,
79 Bottom: 2
80};
81
82/**
83 * Alert state enumeration
84 */
85var AlertState = {
86 Displaying: "displaying",
87 NotDisplaying: "notDisplaying"
88}
89
90/**
91 * Alert delay enumeration
92 */
93var AlertDelay = {
94 FiftyMilliseconds: 50,
95 OneSecond: 1000,
96 OnePointFiveSeconds: 1500
97}
98
99/**
56 * Return an array of elements based on the selector query100 * Return an array of elements based on the selector query
57 * @param {string} selector - The selector to find elements101 * @param {string} selector - The selector to find elements
58 * @returns {array} An array of matching elements102 * @returns {array} An array of matching elements
@@ -118,20 +162,6 @@
118}162}
119163
120/**164/**
121 * The paths we get are JSON versions of Python Path objects, so let's just fix that.
122 * @private
123 * @param {object} path - The Path object
124 * @returns {string} The actual file path
125 */
126function _pathToString(path) {
127 var filename = path.__Path__.join("/").replace("//", "/");
128 if (!filename.startsWith("/")) {
129 filename = "/" + filename;
130 }
131 return filename;
132}
133
134/**
135 * An audio player with a play list165 * An audio player with a play list
136 */166 */
137var AudioPlayer = function (audioElement) {167var AudioPlayer = function (audioElement) {
@@ -248,7 +278,12 @@
248 * The Display object is what we use from OpenLP278 * The Display object is what we use from OpenLP
249 */279 */
250var Display = {280var Display = {
281 _alerts: [],
251 _slides: {},282 _slides: {},
283 _alertSettings: {},
284 _alertState: AlertState.NotDisplaying,
285 _transitionState: TransitionState.NoTransition,
286 _animationState: AnimationState.NoAnimation,
252 _revealConfig: {287 _revealConfig: {
253 margin: 0.0,288 margin: 0.0,
254 minScale: 1.0,289 minScale: 1.0,
@@ -315,7 +350,7 @@
315 section.setAttribute("style", "height: 100%; width: 100%; position: relative;");350 section.setAttribute("style", "height: 100%; width: 100%; position: relative;");
316 var img = document.createElement('img');351 var img = document.createElement('img');
317 img.src = image;352 img.src = image;
318 img.setAttribute("style", "position: absolute; top: 0; bottom: 0; left: 0; right: 0; margin: auto;");353 img.setAttribute("style", "position: absolute; top: 0; bottom: 0; left: 0; right: 0; margin: auto; max-height: 100%; max-width: 100%");
319 section.appendChild(img);354 section.appendChild(img);
320 slidesDiv.appendChild(section);355 slidesDiv.appendChild(section);
321 Display._slides['0'] = 0;356 Display._slides['0'] = 0;
@@ -370,19 +405,197 @@
370 /**405 /**
371 * Display an alert406 * Display an alert
372 * @param {string} text - The alert text407 * @param {string} text - The alert text
373 * @param {int} location - The location of the text (top, middle or bottom)408 * @param {string} JSON object - The settings for the alert object e.g '{"backgroundColor": "rgb(255, 85, 0)",
374 */409 * "location": 1, "fontFace": "Open Sans Condensed", "fontSize": 90, "fontColor": "rgb(255, 255, 255)",
375 alert: function (text, location) {410 * "timeout": 10, "repeat": 2, "scroll": true}'
376 console.debug(" alert text: " + text, ", location: " + location);411 */
377 /*412 alert: function (text, alertSettings) {
378 * The implementation should show an alert.413 var alertBackground = $('#alert-background')[0];
379 * It should be able to handle receiving a new alert before a previous one is "finished", basically queueing it.414 var alertText = $('#alert')[0];
380 */415 if (text == "") {
381 return;416 return null;
382},417 }
383418 else {
384 /**419 if (this._alertState === AlertState.Displaying) {
385 * Add a slides. If the slide exists but the HTML is different, update the slide.420 Display.addAlertToQueue(text, alert_settings);
421 }
422 }
423 var settings = JSON.parse(alertSettings);
424 this._alertSettings = settings;
425 Display.setAlertText(text, settings.fontColor, settings.fontFace, settings.fontSize);
426 Display.setAlertLocation(settings.location);
427 /* Check if the alert is a queued alert */
428 if (Display._alertState !== AlertState.DisplayingFromQueue) {
429 Display._alertState = AlertState.Displaying;
430 }
431
432 alertBackground.addEventListener('transitionend', Display.alertTransitionEndEvent, false);
433 alertText.addEventListener('animationend', Display.alertAnimationEndEvent, false);
434
435 Display.showAlertBackground(settings.backgroundColor);
436 },
437 /**
438 * Add an alert to the alert queue
439 * @param {string} text - The alert text to be displayed
440 * @param {string} setttings - JSON object containing the settings for the alert
441 */
442 addAlertToQueue: function (text, settings) {
443 var alertObject = {text: text, settings: settings};
444 this._alerts.push(JSON.stringify(alertObject));
445 return null;
446 },
447 /**
448 * Set Alert Text
449 * @param {string} text - The alert text to display
450 */
451 setAlertText: function (text, color, fontFace, fontSize) {
452 var alertText = $("#alert")[0];
453 alertText.textContent = text;
454 alertText.style.color = color;
455 alertText.style.fontFamily = fontFace;
456 alertText.style.fontSize = fontSize + "pt";
457 },
458 /**
459 * The alertTransitionEndEvent called after a transition has ended
460 */
461 alertTransitionEndEvent: function (e) {
462 e.stopPropagation();
463 console.debug("Transition end event reached");
464 if (Display._transitionState === TransitionState.EntranceTransition) {
465 Display._transitionState = TransitionState.NoTransition;
466 Display.showAlertText(Display._alertSettings);
467 }
468 else if (Display._transitionState === TransitionState.ExitTransition) {
469 Display._transitionState = TransitionState.NoTransition;
470 Display.removeAlertLocation(Display._alertSettings.location);
471 Display.clearAlertSettings();
472 setTimeout(function () {
473 Display.showNextAlert();
474 }, AlertDelay.OnePointFiveSeconds);
475
476 }
477 },
478 /**
479 * The alertAnimationEndEvent called after an animation has ended
480 */
481 alertAnimationEndEvent: function (e) {
482 e.stopPropagation();
483 Display.hideAlertText();
484 },
485 /**
486 * Start background entrance transition for display of alert
487 * @param {string} hex_color - The background color of the alert
488 */
489 showAlertBackground: function (bg_color) {
490 var alertBackground = $("#alert-background")[0];
491 alertBackground.classList.add("show-bg");
492 alertBackground.style.backgroundColor = bg_color;
493 this._transitionState = TransitionState.EntranceTransition;
494 },
495 /**
496 * Set the location of the alert
497 * @param {int} location - Integer number with the location of the alert on screen
498 */
499 setAlertLocation: function (location) {
500 var alertContainer = $(".alert-container")[0];
501
502 switch (location) {
503 case AlertLocation.Top:
504 alertContainer.classList.add("top");
505 break;
506 case AlertLocation.Middle:
507 alertContainer.classList.add("middle");
508 break;
509 case AlertLocation.Bottom:
510 default:
511 alertContainer.classList.add("bottom");
512 break;
513 }
514 },
515 /**
516 * Remove the location class set after displaying the alert
517 * @param {int} location - Integer number with the location of the alert on screen
518 */
519 removeAlertLocation: function (location) {
520 var alertContainer = $(".alert-container")[0];
521 console.debug("The value of location for removal is: " + location);
522
523 switch (location) {
524 case AlertLocation.Top:
525 alertContainer.classList.remove("top");
526 break;
527 case AlertLocation.Middle:
528 alertContainer.classList.remove("middle");
529 break;
530 case AlertLocation.Bottom:
531 default:
532 alertContainer.classList.remove("bottom");
533 break;
534 }
535 },
536 /**
537 * Hide the alert background after the alert has been shown
538 */
539 hideAlertBackground: function () {
540 var alertBackground = $("#alert-background")[0];
541 alertBackground.classList.remove("show-bg");
542 this._transitionState = TransitionState.ExitTransition;
543 this._alertState = AlertState.NotDisplaying;
544 },
545 /**
546 * Sets the alert text styles correctly after the entrance transition has ended.
547 * @param {json} settings object - The settings to use for the animation
548 */
549 showAlertText: function (settings) {
550 var alertText = $("#alert")[0];
551
552 if (settings.scroll) {
553 var animationSettings = "alert-scrolling-text " + settings.timeout +
554 "s linear 0.6s " + settings.repeat + " normal";
555 alertText.style.animation = animationSettings;
556 Display._animationState = AnimationState.ScrollingText;
557 }
558 else {
559 Display._animationState = AnimationState.NonScrollingText;
560 alertText.classList.add("show-text");
561 setTimeout (function () {
562 Display._animationState = AnimationState.NoAnimation;
563 alertText.classList.add("hide-text");
564 alertText.classList.remove("show-text");
565 Display.hideAlertText();
566 }, settings.timeout * AlertDelay.OneSecond);
567 }
568 },
569 /**
570 * Reset styling and hide the alert text after displaying the animation
571 */
572 hideAlertText: function () {
573 var alertText = $('#alert')[0];
574 Display._animationState = AnimationState.NoAnimation;
575 alertText.style.animation = "";
576 Display.hideAlertBackground();
577 },
578 /**
579 * Display the next alert in the queue
580 */
581 showNextAlert: function () {
582 if (Display._alerts.length > 0) {
583 var alertObject = JSON.parse(this._alerts.shift());
584 this._alertState = AlertState.DisplayingFromQueue;
585 Display.alert(alertObject.text, alertObject.settings);
586 }
587 else {
588 return null;
589 }
590 },
591 /**
592 * Clears the alert settings after displaying an alert
593 */
594 clearAlertSettings: function () {
595 this._alertSettings = {};
596 },
597 /**
598 * Add a slide. If the slide exists but the HTML is different, update the slide.
386 * @param {string} verse - The verse number, e.g. "v1"599 * @param {string} verse - The verse number, e.g. "v1"
387 * @param {string} text - The HTML for the verse, e.g. "line1<br>line2"600 * @param {string} text - The HTML for the verse, e.g. "line1<br>line2"
388 * @param {string} footer_text - The HTML for the footer"601 * @param {string} footer_text - The HTML for the footer"
@@ -676,13 +889,13 @@
676 }889 }
677 break;890 break;
678 case BackgroundType.Image:891 case BackgroundType.Image:
679 background_filename = _pathToString(theme.background_filename);892 backgroundStyle["background-image"] = "url('" + theme.background_filename + "')";
680 backgroundStyle["background-image"] = "url('file://" + background_filename + "')";893 console.warn(backgroundStyle["background-image"]);
681 break;894 break;
682 case BackgroundType.Video:895 case BackgroundType.Video:
683 background_filename = _pathToString(theme.background_filename);
684 backgroundStyle["background-color"] = theme.background_border_color;896 backgroundStyle["background-color"] = theme.background_border_color;
685 backgroundHtml = "<video loop autoplay muted><source src='file://" + background_filename + "'></video>";897 backgroundHtml = "<video loop autoplay muted><source src='" + theme.background_filename + "'></video>";
898 console.warn(backgroundHtml);
686 break;899 break;
687 default:900 default:
688 backgroundStyle["background"] = "#000";901 backgroundStyle["background"] = "#000";
689902
=== modified file 'openlp/core/display/html/reveal.js'
--- openlp/core/display/html/reveal.js 2019-02-11 20:34:20 +0000
+++ openlp/core/display/html/reveal.js 2019-07-01 17:47:01 +0000
@@ -3,7 +3,7 @@
3 * http://revealjs.com3 * http://revealjs.com
4 * MIT licensed4 * MIT licensed
5 *5 *
6 * Copyright (C) 2018 Hakim El Hattab, http://hakim.se6 * Copyright (C) 2019 Hakim El Hattab, http://hakim.se
7 */7 */
8(function( root, factory ) {8(function( root, factory ) {
9 if( typeof define === 'function' && define.amd ) {9 if( typeof define === 'function' && define.amd ) {
@@ -26,7 +26,7 @@
26 var Reveal;26 var Reveal;
2727
28 // The reveal.js version28 // The reveal.js version
29 var VERSION = '3.7.0';29 var VERSION = '3.8.0';
3030
31 var SLIDES_SELECTOR = '.slides section',31 var SLIDES_SELECTOR = '.slides section',
32 HORIZONTAL_SLIDES_SELECTOR = '.slides>section',32 HORIZONTAL_SLIDES_SELECTOR = '.slides>section',
@@ -67,16 +67,36 @@
67 progress: true,67 progress: true,
6868
69 // Display the page number of the current slide69 // Display the page number of the current slide
70 // - true: Show slide number
71 // - false: Hide slide number
72 //
73 // Can optionally be set as a string that specifies the number formatting:
74 // - "h.v": Horizontal . vertical slide number (default)
75 // - "h/v": Horizontal / vertical slide number
76 // - "c": Flattened slide number
77 // - "c/t": Flattened slide number / total slides
78 //
79 // Alternatively, you can provide a function that returns the slide
80 // number for the current slide. The function needs to return an array
81 // with one string [slideNumber] or three strings [n1,delimiter,n2].
82 // See #formatSlideNumber().
70 slideNumber: false,83 slideNumber: false,
7184
85 // Can be used to limit the contexts in which the slide number appears
86 // - "all": Always show the slide number
87 // - "print": Only when printing to PDF
88 // - "speaker": Only in the speaker view
89 showSlideNumber: 'all',
90
72 // Use 1 based indexing for # links to match slide number (default is zero91 // Use 1 based indexing for # links to match slide number (default is zero
73 // based)92 // based)
74 hashOneBasedIndex: false,93 hashOneBasedIndex: false,
7594
76 // Determine which displays to show the slide number on95 // Add the current slide number to the URL hash so that reloading the
77 showSlideNumber: 'all',96 // page/copying the URL will return you to the same slide
97 hash: false,
7898
79 // Push each slide change to the browser history99 // Push each slide change to the browser history. Implies `hash: true`
80 history: false,100 history: false,
81101
82 // Enable keyboard shortcuts for navigation102 // Enable keyboard shortcuts for navigation
@@ -104,6 +124,32 @@
104 // Change the presentation direction to be RTL124 // Change the presentation direction to be RTL
105 rtl: false,125 rtl: false,
106126
127 // Changes the behavior of our navigation directions.
128 //
129 // "default"
130 // Left/right arrow keys step between horizontal slides, up/down
131 // arrow keys step between vertical slides. Space key steps through
132 // all slides (both horizontal and vertical).
133 //
134 // "linear"
135 // Removes the up/down arrows. Left/right arrows step through all
136 // slides (both horizontal and vertical).
137 //
138 // "grid"
139 // When this is enabled, stepping left/right from a vertical stack
140 // to an adjacent vertical stack will land you at the same vertical
141 // index.
142 //
143 // Consider a deck with six slides ordered in two vertical stacks:
144 // 1.1 2.1
145 // 1.2 2.2
146 // 1.3 2.3
147 //
148 // If you're on slide 1.3 and navigate right, you will normally move
149 // from 1.3 -> 2.1. If "grid" is used, the same navigation takes you
150 // from 1.3 -> 2.3.
151 navigationMode: 'default',
152
107 // Randomizes the order of slides each time the presentation loads153 // Randomizes the order of slides each time the presentation loads
108 shuffle: false,154 shuffle: false,
109155
@@ -134,6 +180,13 @@
134 // - false: No media will autoplay, regardless of individual setting180 // - false: No media will autoplay, regardless of individual setting
135 autoPlayMedia: null,181 autoPlayMedia: null,
136182
183 // Global override for preloading lazy-loaded iframes
184 // - null: Iframes with data-src AND data-preload will be loaded when within
185 // the viewDistance, iframes with only data-src will be loaded when visible
186 // - true: All iframes with data-src will be loaded when within the viewDistance
187 // - false: All iframes with data-src will be loaded only when visible
188 preloadIframes: null,
189
137 // Controls automatic progression to the next slide190 // Controls automatic progression to the next slide
138 // - 0: Auto-sliding only happens if the data-autoslide HTML attribute191 // - 0: Auto-sliding only happens if the data-autoslide HTML attribute
139 // is present on the current slide or fragment192 // is present on the current slide or fragment
@@ -220,6 +273,12 @@
220 // The display mode that will be used to show slides273 // The display mode that will be used to show slides
221 display: 'block',274 display: 'block',
222275
276 // Hide cursor if inactive
277 hideInactiveCursor: true,
278
279 // Time before the cursor is hidden (in ms)
280 hideCursorTime: 5000,
281
223 // Script dependencies to load282 // Script dependencies to load
224 dependencies: []283 dependencies: []
225284
@@ -267,6 +326,12 @@
267 // Cached references to DOM elements326 // Cached references to DOM elements
268 dom = {},327 dom = {},
269328
329 // A list of registered reveal.js plugins
330 plugins = {},
331
332 // List of asynchronously loaded reveal.js dependencies
333 asyncDependencies = [],
334
270 // Features supported by the browser, see #checkCapabilities()335 // Features supported by the browser, see #checkCapabilities()
271 features = {},336 features = {},
272337
@@ -282,6 +347,12 @@
282 // Delays updates to the URL due to a Chrome thumbnailer bug347 // Delays updates to the URL due to a Chrome thumbnailer bug
283 writeURLTimeout = 0,348 writeURLTimeout = 0,
284349
350 // Is the mouse pointer currently hidden from view
351 cursorHidden = false,
352
353 // Timeout used to determine when the cursor is inactive
354 cursorInactiveTimeout = 0,
355
285 // Flags if the interaction event listeners are bound356 // Flags if the interaction event listeners are bound
286 eventsAreBound = false,357 eventsAreBound = false,
287358
@@ -298,26 +369,14 @@
298 touch = {369 touch = {
299 startX: 0,370 startX: 0,
300 startY: 0,371 startY: 0,
301 startSpan: 0,
302 startCount: 0,372 startCount: 0,
303 captured: false,373 captured: false,
304 threshold: 40374 threshold: 40
305 },375 },
306376
307 // Holds information about the keyboard shortcuts377 // A key:value map of shortcut keyboard keys and descriptions of
308 keyboardShortcuts = {378 // the actions they trigger, generated in #configure()
309 'N , SPACE': 'Next slide',379 keyboardShortcuts = {},
310 'P': 'Previous slide',
311 '&#8592; , H': 'Navigate left',
312 '&#8594; , L': 'Navigate right',
313 '&#8593; , K': 'Navigate up',
314 '&#8595; , J': 'Navigate down',
315 'Home': 'First slide',
316 'End': 'Last slide',
317 'B , .': 'Pause',
318 'F': 'Fullscreen',
319 'ESC, O': 'Slide overview'
320 },
321380
322 // Holds custom key code mappings381 // Holds custom key code mappings
323 registeredKeyBindings = {};382 registeredKeyBindings = {};
@@ -377,7 +436,7 @@
377 // Hide the address bar in mobile browsers436 // Hide the address bar in mobile browsers
378 hideAddressBar();437 hideAddressBar();
379438
380 // Loads the dependencies and continues to #start() once done439 // Loads dependencies and continues to #start() once done
381 load();440 load();
382441
383 }442 }
@@ -440,57 +499,148 @@
440 function load() {499 function load() {
441500
442 var scripts = [],501 var scripts = [],
443 scriptsAsync = [],502 scriptsToLoad = 0;
444 scriptsToPreload = 0;503
445504 config.dependencies.forEach( function( s ) {
446 // Called once synchronous scripts finish loading
447 function proceed() {
448 if( scriptsAsync.length ) {
449 // Load asynchronous scripts
450 head.js.apply( null, scriptsAsync );
451 }
452
453 start();
454 }
455
456 function loadScript( s ) {
457 head.ready( s.src.match( /([\w\d_\-]*)\.?js(\?[\w\d.=&]*)?$|[^\\\/]*$/i )[0], function() {
458 // Extension may contain callback functions
459 if( typeof s.callback === 'function' ) {
460 s.callback.apply( this );
461 }
462
463 if( --scriptsToPreload === 0 ) {
464 proceed();
465 }
466 });
467 }
468
469 for( var i = 0, len = config.dependencies.length; i < len; i++ ) {
470 var s = config.dependencies[i];
471
472 // Load if there's no condition or the condition is truthy505 // Load if there's no condition or the condition is truthy
473 if( !s.condition || s.condition() ) {506 if( !s.condition || s.condition() ) {
474 if( s.async ) {507 if( s.async ) {
475 scriptsAsync.push( s.src );508 asyncDependencies.push( s );
476 }509 }
477 else {510 else {
478 scripts.push( s.src );511 scripts.push( s );
479 }512 }
480
481 loadScript( s );
482 }513 }
483 }514 } );
484515
485 if( scripts.length ) {516 if( scripts.length ) {
486 scriptsToPreload = scripts.length;517 scriptsToLoad = scripts.length;
487518
488 // Load synchronous scripts519 // Load synchronous scripts
489 head.js.apply( null, scripts );520 scripts.forEach( function( s ) {
490 }521 loadScript( s.src, function() {
491 else {522
492 proceed();523 if( typeof s.callback === 'function' ) s.callback();
493 }524
525 if( --scriptsToLoad === 0 ) {
526 initPlugins();
527 }
528
529 } );
530 } );
531 }
532 else {
533 initPlugins();
534 }
535
536 }
537
538 /**
539 * Initializes our plugins and waits for them to be ready
540 * before proceeding.
541 */
542 function initPlugins() {
543
544 var pluginsToInitialize = Object.keys( plugins ).length;
545
546 // If there are no plugins, skip this step
547 if( pluginsToInitialize === 0 ) {
548 loadAsyncDependencies();
549 }
550 // ... otherwise initialize plugins
551 else {
552
553 var afterPlugInitialized = function() {
554 if( --pluginsToInitialize === 0 ) {
555 loadAsyncDependencies();
556 }
557 };
558
559 for( var i in plugins ) {
560
561 var plugin = plugins[i];
562
563 // If the plugin has an 'init' method, invoke it
564 if( typeof plugin.init === 'function' ) {
565 var callback = plugin.init();
566
567 // If the plugin returned a Promise, wait for it
568 if( callback && typeof callback.then === 'function' ) {
569 callback.then( afterPlugInitialized );
570 }
571 else {
572 afterPlugInitialized();
573 }
574 }
575 else {
576 afterPlugInitialized();
577 }
578
579 }
580
581 }
582
583 }
584
585 /**
586 * Loads all async reveal.js dependencies.
587 */
588 function loadAsyncDependencies() {
589
590 if( asyncDependencies.length ) {
591 asyncDependencies.forEach( function( s ) {
592 loadScript( s.src, s.callback );
593 } );
594 }
595
596 start();
597
598 }
599
600 /**
601 * Loads a JavaScript file from the given URL and executes it.
602 *
603 * @param {string} url Address of the .js file to load
604 * @param {function} callback Method to invoke when the script
605 * has loaded and executed
606 */
607 function loadScript( url, callback ) {
608
609 var script = document.createElement( 'script' );
610 script.type = 'text/javascript';
611 script.async = false;
612 script.defer = false;
613 script.src = url;
614
615 if( callback ) {
616
617 // Success callback
618 script.onload = script.onreadystatechange = function( event ) {
619 if( event.type === "load" || (/loaded|complete/.test( script.readyState ) ) ) {
620
621 // Kill event listeners
622 script.onload = script.onreadystatechange = script.onerror = null;
623
624 callback();
625
626 }
627 };
628
629 // Error callback
630 script.onerror = function( err ) {
631
632 // Kill event listeners
633 script.onload = script.onreadystatechange = script.onerror = null;
634
635 callback( new Error( 'Failed loading script: ' + script.src + '\n' + err) );
636
637 };
638
639 }
640
641 // Append the script at the end of <head>
642 var head = document.querySelector( 'head' );
643 head.insertBefore( script, head.lastChild );
494644
495 }645 }
496646
@@ -601,8 +751,7 @@
601 dom.speakerNotes.setAttribute( 'tabindex', '0' );751 dom.speakerNotes.setAttribute( 'tabindex', '0' );
602752
603 // Overlay graphic which is displayed during the paused mode753 // Overlay graphic which is displayed during the paused mode
604 dom.pauseOverlay = createSingletonNode( dom.wrapper, 'div', 'pause-overlay', '<button class="resume-button">Resume presentation</button>' );754 dom.pauseOverlay = createSingletonNode( dom.wrapper, 'div', 'pause-overlay', config.controls ? '<button class="resume-button">Resume presentation</button>' : null );
605 dom.resumeButton = dom.pauseOverlay.querySelector( '.resume-button' );
606755
607 dom.wrapper.setAttribute( 'role', 'application' );756 dom.wrapper.setAttribute( 'role', 'application' );
608757
@@ -1082,18 +1231,27 @@
1082 if( data.backgroundPosition ) contentElement.style.backgroundPosition = data.backgroundPosition;1231 if( data.backgroundPosition ) contentElement.style.backgroundPosition = data.backgroundPosition;
1083 if( data.backgroundOpacity ) contentElement.style.opacity = data.backgroundOpacity;1232 if( data.backgroundOpacity ) contentElement.style.opacity = data.backgroundOpacity;
10841233
1085 // If this slide has a background color, add a class that1234 // If this slide has a background color, we add a class that
1086 // signals if it is light or dark. If the slide has no background1235 // signals if it is light or dark. If the slide has no background
1087 // color, no class will be set1236 // color, no class will be added
1088 var computedBackgroundStyle = window.getComputedStyle( element );1237 var contrastColor = data.backgroundColor;
1089 if( computedBackgroundStyle && computedBackgroundStyle.backgroundColor ) {1238
1090 var rgb = colorToRgb( computedBackgroundStyle.backgroundColor );1239 // If no bg color was found, check the computed background
1240 if( !contrastColor ) {
1241 var computedBackgroundStyle = window.getComputedStyle( element );
1242 if( computedBackgroundStyle && computedBackgroundStyle.backgroundColor ) {
1243 contrastColor = computedBackgroundStyle.backgroundColor;
1244 }
1245 }
1246
1247 if( contrastColor ) {
1248 var rgb = colorToRgb( contrastColor );
10911249
1092 // Ignore fully transparent backgrounds. Some browsers return1250 // Ignore fully transparent backgrounds. Some browsers return
1093 // rgba(0,0,0,0) when reading the computed background color of1251 // rgba(0,0,0,0) when reading the computed background color of
1094 // an element with no background1252 // an element with no background
1095 if( rgb && rgb.a !== 0 ) {1253 if( rgb && rgb.a !== 0 ) {
1096 if( colorBrightness( computedBackgroundStyle.backgroundColor ) < 128 ) {1254 if( colorBrightness( contrastColor ) < 128 ) {
1097 slide.classList.add( 'has-dark-background' );1255 slide.classList.add( 'has-dark-background' );
1098 }1256 }
1099 else {1257 else {
@@ -1216,6 +1374,18 @@
1216 disableRollingLinks();1374 disableRollingLinks();
1217 }1375 }
12181376
1377 // Auto-hide the mouse pointer when its inactive
1378 if( config.hideInactiveCursor ) {
1379 document.addEventListener( 'mousemove', onDocumentCursorActive, false );
1380 document.addEventListener( 'mousedown', onDocumentCursorActive, false );
1381 }
1382 else {
1383 showCursor();
1384
1385 document.removeEventListener( 'mousemove', onDocumentCursorActive, false );
1386 document.removeEventListener( 'mousedown', onDocumentCursorActive, false );
1387 }
1388
1219 // Iframe link previews1389 // Iframe link previews
1220 if( config.previewLinks ) {1390 if( config.previewLinks ) {
1221 enablePreviewLinks();1391 enablePreviewLinks();
@@ -1263,6 +1433,34 @@
12631433
1264 dom.slideNumber.style.display = slideNumberDisplay;1434 dom.slideNumber.style.display = slideNumberDisplay;
12651435
1436 // Add the navigation mode to the DOM so we can adjust styling
1437 if( config.navigationMode !== 'default' ) {
1438 dom.wrapper.setAttribute( 'data-navigation-mode', config.navigationMode );
1439 }
1440 else {
1441 dom.wrapper.removeAttribute( 'data-navigation-mode' );
1442 }
1443
1444 // Define our contextual list of keyboard shortcuts
1445 if( config.navigationMode === 'linear' ) {
1446 keyboardShortcuts['&#8594; , &#8595; , SPACE , N , L , J'] = 'Next slide';
1447 keyboardShortcuts['&#8592; , &#8593; , P , H , K'] = 'Previous slide';
1448 }
1449 else {
1450 keyboardShortcuts['N , SPACE'] = 'Next slide';
1451 keyboardShortcuts['P'] = 'Previous slide';
1452 keyboardShortcuts['&#8592; , H'] = 'Navigate left';
1453 keyboardShortcuts['&#8594; , L'] = 'Navigate right';
1454 keyboardShortcuts['&#8593; , K'] = 'Navigate up';
1455 keyboardShortcuts['&#8595; , J'] = 'Navigate down';
1456 }
1457
1458 keyboardShortcuts['Home , &#8984;/CTRL &#8592;'] = 'First slide';
1459 keyboardShortcuts['End , &#8984;/CTRL &#8594;'] = 'Last slide';
1460 keyboardShortcuts['B , .'] = 'Pause';
1461 keyboardShortcuts['F'] = 'Fullscreen';
1462 keyboardShortcuts['ESC, O'] = 'Slide overview';
1463
1266 sync();1464 sync();
12671465
1268 }1466 }
@@ -1307,7 +1505,7 @@
1307 dom.progress.addEventListener( 'click', onProgressClicked, false );1505 dom.progress.addEventListener( 'click', onProgressClicked, false );
1308 }1506 }
13091507
1310 dom.resumeButton.addEventListener( 'click', resume, false );1508 dom.pauseOverlay.addEventListener( 'click', resume, false );
13111509
1312 if( config.focusBodyOnPageVisibilityChange ) {1510 if( config.focusBodyOnPageVisibilityChange ) {
1313 var visibilityChange;1511 var visibilityChange;
@@ -1372,7 +1570,7 @@
1372 dom.wrapper.removeEventListener( 'touchmove', onTouchMove, false );1570 dom.wrapper.removeEventListener( 'touchmove', onTouchMove, false );
1373 dom.wrapper.removeEventListener( 'touchend', onTouchEnd, false );1571 dom.wrapper.removeEventListener( 'touchend', onTouchEnd, false );
13741572
1375 dom.resumeButton.removeEventListener( 'click', resume, false );1573 dom.pauseOverlay.removeEventListener( 'click', resume, false );
13761574
1377 if ( config.progress && dom.progress ) {1575 if ( config.progress && dom.progress ) {
1378 dom.progress.removeEventListener( 'click', onProgressClicked, false );1576 dom.progress.removeEventListener( 'click', onProgressClicked, false );
@@ -1390,6 +1588,53 @@
1390 }1588 }
13911589
1392 /**1590 /**
1591 * Registers a new plugin with this reveal.js instance.
1592 *
1593 * reveal.js waits for all regisered plugins to initialize
1594 * before considering itself ready, as long as the plugin
1595 * is registered before calling `Reveal.initialize()`.
1596 */
1597 function registerPlugin( id, plugin ) {
1598
1599 if( plugins[id] === undefined ) {
1600 plugins[id] = plugin;
1601
1602 // If a plugin is registered after reveal.js is loaded,
1603 // initialize it right away
1604 if( loaded && typeof plugin.init === 'function' ) {
1605 plugin.init();
1606 }
1607 }
1608 else {
1609 console.warn( 'reveal.js: "'+ id +'" plugin has already been registered' );
1610 }
1611
1612 }
1613
1614 /**
1615 * Checks if a specific plugin has been registered.
1616 *
1617 * @param {String} id Unique plugin identifier
1618 */
1619 function hasPlugin( id ) {
1620
1621 return !!plugins[id];
1622
1623 }
1624
1625 /**
1626 * Returns the specific plugin instance, if a plugin
1627 * with the given ID has been registered.
1628 *
1629 * @param {String} id Unique plugin identifier
1630 */
1631 function getPlugin( id ) {
1632
1633 return plugins[id];
1634
1635 }
1636
1637 /**
1393 * Add a custom key binding with optional description to1638 * Add a custom key binding with optional description to
1394 * be added to the help screen.1639 * be added to the help screen.
1395 */1640 */
@@ -1677,11 +1922,19 @@
1677 // Change the .stretch element height to 0 in order find the height of all1922 // Change the .stretch element height to 0 in order find the height of all
1678 // the other elements1923 // the other elements
1679 element.style.height = '0px';1924 element.style.height = '0px';
1925
1926 // In Overview mode, the parent (.slide) height is set of 700px.
1927 // Restore it temporarily to its natural height.
1928 element.parentNode.style.height = 'auto';
1929
1680 newHeight = height - element.parentNode.offsetHeight;1930 newHeight = height - element.parentNode.offsetHeight;
16811931
1682 // Restore the old height, just in case1932 // Restore the old height, just in case
1683 element.style.height = oldHeight + 'px';1933 element.style.height = oldHeight + 'px';
16841934
1935 // Clear the parent (.slide) height. .removeProperty works in IE9+
1936 element.parentNode.style.removeProperty('height');
1937
1685 return newHeight;1938 return newHeight;
1686 }1939 }
16871940
@@ -1699,15 +1952,6 @@
1699 }1952 }
17001953
1701 /**1954 /**
1702 * Check if this instance is being used to print a PDF with fragments.
1703 */
1704 function isPrintingPDFFragments() {
1705
1706 return ( /print-pdf-fragments/gi ).test( window.location.search );
1707
1708 }
1709
1710 /**
1711 * Hides the address bar if we're on a mobile device.1955 * Hides the address bar if we're on a mobile device.
1712 */1956 */
1713 function hideAddressBar() {1957 function hideAddressBar() {
@@ -1970,8 +2214,20 @@
19702214
1971 if( !config.disableLayout ) {2215 if( !config.disableLayout ) {
19722216
2217 // On some mobile devices '100vh' is taller than the visible
2218 // viewport which leads to part of the presentation being
2219 // cut off. To work around this we define our own '--vh' custom
2220 // property where 100x adds up to the correct height.
2221 //
2222 // https://css-tricks.com/the-trick-to-viewport-units-on-mobile/
2223 if( isMobileDevice ) {
2224 document.documentElement.style.setProperty( '--vh', ( window.innerHeight * 0.01 ) + 'px' );
2225 }
2226
1973 var size = getComputedSlideSize();2227 var size = getComputedSlideSize();
19742228
2229 var oldScale = scale;
2230
1975 // Layout the contents of the slides2231 // Layout the contents of the slides
1976 layoutSlideContents( config.width, config.height );2232 layoutSlideContents( config.width, config.height );
19772233
@@ -2044,6 +2300,13 @@
20442300
2045 }2301 }
20462302
2303 if( oldScale !== scale ) {
2304 dispatchEvent( 'resize', {
2305 'oldScale': oldScale,
2306 'scale': scale,
2307 'size': size
2308 } );
2309 }
2047 }2310 }
20482311
2049 updateProgress();2312 updateProgress();
@@ -2443,6 +2706,32 @@
2443 }2706 }
24442707
2445 /**2708 /**
2709 * Shows the mouse pointer after it has been hidden with
2710 * #hideCursor.
2711 */
2712 function showCursor() {
2713
2714 if( cursorHidden ) {
2715 cursorHidden = false;
2716 dom.wrapper.style.cursor = '';
2717 }
2718
2719 }
2720
2721 /**
2722 * Hides the mouse pointer when it's on top of the .reveal
2723 * container.
2724 */
2725 function hideCursor() {
2726
2727 if( cursorHidden === false ) {
2728 cursorHidden = true;
2729 dom.wrapper.style.cursor = 'none';
2730 }
2731
2732 }
2733
2734 /**
2446 * Enters the paused mode which fades everything on screen to2735 * Enters the paused mode which fades everything on screen to
2447 * black.2736 * black.
2448 */2737 */
@@ -2584,28 +2873,6 @@
25842873
2585 layout();2874 layout();
25862875
2587 // Apply the new state
2588 stateLoop: for( var i = 0, len = state.length; i < len; i++ ) {
2589 // Check if this state existed on the previous slide. If it
2590 // did, we will avoid adding it repeatedly
2591 for( var j = 0; j < stateBefore.length; j++ ) {
2592 if( stateBefore[j] === state[i] ) {
2593 stateBefore.splice( j, 1 );
2594 continue stateLoop;
2595 }
2596 }
2597
2598 document.documentElement.classList.add( state[i] );
2599
2600 // Dispatch custom event matching the state's name
2601 dispatchEvent( state[i] );
2602 }
2603
2604 // Clean up the remains of the previous state
2605 while( stateBefore.length ) {
2606 document.documentElement.classList.remove( stateBefore.pop() );
2607 }
2608
2609 // Update the overview if it's currently active2876 // Update the overview if it's currently active
2610 if( isOverview() ) {2877 if( isOverview() ) {
2611 updateOverview();2878 updateOverview();
@@ -2654,6 +2921,28 @@
2654 }2921 }
2655 }2922 }
26562923
2924 // Apply the new state
2925 stateLoop: for( var i = 0, len = state.length; i < len; i++ ) {
2926 // Check if this state existed on the previous slide. If it
2927 // did, we will avoid adding it repeatedly
2928 for( var j = 0; j < stateBefore.length; j++ ) {
2929 if( stateBefore[j] === state[i] ) {
2930 stateBefore.splice( j, 1 );
2931 continue stateLoop;
2932 }
2933 }
2934
2935 document.documentElement.classList.add( state[i] );
2936
2937 // Dispatch custom event matching the state's name
2938 dispatchEvent( state[i] );
2939 }
2940
2941 // Clean up the remains of the previous state
2942 while( stateBefore.length ) {
2943 document.documentElement.classList.remove( stateBefore.pop() );
2944 }
2945
2657 if( slideChanged ) {2946 if( slideChanged ) {
2658 dispatchEvent( 'slidechanged', {2947 dispatchEvent( 'slidechanged', {
2659 'indexh': indexh,2948 'indexh': indexh,
@@ -2679,6 +2968,7 @@
2679 updateParallax();2968 updateParallax();
2680 updateSlideNumber();2969 updateSlideNumber();
2681 updateNotes();2970 updateNotes();
2971 updateFragments();
26822972
2683 // Update the URL hash2973 // Update the URL hash
2684 writeURL();2974 writeURL();
@@ -2751,6 +3041,9 @@
2751 */3041 */
2752 function syncSlide( slide ) {3042 function syncSlide( slide ) {
27533043
3044 // Default to the current slide
3045 slide = slide || currentSlide;
3046
2754 syncBackground( slide );3047 syncBackground( slide );
2755 syncFragments( slide );3048 syncFragments( slide );
27563049
@@ -2767,10 +3060,14 @@
2767 * after reveal.js has already initialized.3060 * after reveal.js has already initialized.
2768 *3061 *
2769 * @param {HTMLElement} slide3062 * @param {HTMLElement} slide
3063 * @return {Array} a list of the HTML fragments that were synced
2770 */3064 */
2771 function syncFragments( slide ) {3065 function syncFragments( slide ) {
27723066
2773 sortFragments( slide.querySelectorAll( '.fragment' ) );3067 // Default to the current slide
3068 slide = slide || currentSlide;
3069
3070 return sortFragments( slide.querySelectorAll( '.fragment' ) );
27743071
2775 }3072 }
27763073
@@ -2903,14 +3200,11 @@
2903 element.classList.add( reverse ? 'future' : 'past' );3200 element.classList.add( reverse ? 'future' : 'past' );
29043201
2905 if( config.fragments ) {3202 if( config.fragments ) {
2906 var pastFragments = toArray( element.querySelectorAll( '.fragment' ) );3203 // Show all fragments in prior slides
29073204 toArray( element.querySelectorAll( '.fragment' ) ).forEach( function( fragment ) {
2908 // Show all fragments on prior slides3205 fragment.classList.add( 'visible' );
2909 while( pastFragments.length ) {3206 fragment.classList.remove( 'current-fragment' );
2910 var pastFragment = pastFragments.pop();3207 } );
2911 pastFragment.classList.add( 'visible' );
2912 pastFragment.classList.remove( 'current-fragment' );
2913 }
2914 }3208 }
2915 }3209 }
2916 else if( i > index ) {3210 else if( i > index ) {
@@ -2918,14 +3212,11 @@
2918 element.classList.add( reverse ? 'past' : 'future' );3212 element.classList.add( reverse ? 'past' : 'future' );
29193213
2920 if( config.fragments ) {3214 if( config.fragments ) {
2921 var futureFragments = toArray( element.querySelectorAll( '.fragment.visible' ) );3215 // Hide all fragments in future slides
29223216 toArray( element.querySelectorAll( '.fragment.visible' ) ).forEach( function( fragment ) {
2923 // No fragments in future slides should be visible ahead of time3217 fragment.classList.remove( 'visible' );
2924 while( futureFragments.length ) {3218 fragment.classList.remove( 'current-fragment' );
2925 var futureFragment = futureFragments.pop();3219 } );
2926 futureFragment.classList.remove( 'visible' );
2927 futureFragment.classList.remove( 'current-fragment' );
2928 }
2929 }3220 }
2930 }3221 }
2931 }3222 }
@@ -3104,47 +3395,47 @@
31043395
31053396
3106 /**3397 /**
3107 * Updates the slide number div to reflect the current slide.3398 * Updates the slide number to match the current slide.
3108 *
3109 * The following slide number formats are available:
3110 * "h.v": horizontal . vertical slide number (default)
3111 * "h/v": horizontal / vertical slide number
3112 * "c": flattened slide number
3113 * "c/t": flattened slide number / total slides
3114 */3399 */
3115 function updateSlideNumber() {3400 function updateSlideNumber() {
31163401
3117 // Update slide number if enabled3402 // Update slide number if enabled
3118 if( config.slideNumber && dom.slideNumber ) {3403 if( config.slideNumber && dom.slideNumber ) {
31193404
3120 var value = [];3405 var value;
3121 var format = 'h.v';3406 var format = 'h.v';
31223407
3123 // Check if a custom number format is available3408 if( typeof config.slideNumber === 'function' ) {
3124 if( typeof config.slideNumber === 'string' ) {3409 value = config.slideNumber();
3125 format = config.slideNumber;3410 }
3126 }3411 else {
31273412 // Check if a custom number format is available
3128 // If there are ONLY vertical slides in this deck, always use3413 if( typeof config.slideNumber === 'string' ) {
3129 // a flattened slide number3414 format = config.slideNumber;
3130 if( !/c/.test( format ) && dom.wrapper.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR ).length === 1 ) {3415 }
3131 format = 'c';3416
3132 }3417 // If there are ONLY vertical slides in this deck, always use
31333418 // a flattened slide number
3134 switch( format ) {3419 if( !/c/.test( format ) && dom.wrapper.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR ).length === 1 ) {
3135 case 'c':3420 format = 'c';
3136 value.push( getSlidePastCount() + 1 );3421 }
3137 break;3422
3138 case 'c/t':3423 value = [];
3139 value.push( getSlidePastCount() + 1, '/', getTotalSlides() );3424 switch( format ) {
3140 break;3425 case 'c':
3141 case 'h/v':3426 value.push( getSlidePastCount() + 1 );
3142 value.push( indexh + 1 );3427 break;
3143 if( isVerticalSlide() ) value.push( '/', indexv + 1 );3428 case 'c/t':
3144 break;3429 value.push( getSlidePastCount() + 1, '/', getTotalSlides() );
3145 default:3430 break;
3146 value.push( indexh + 1 );3431 case 'h/v':
3147 if( isVerticalSlide() ) value.push( '.', indexv + 1 );3432 value.push( indexh + 1 );
3433 if( isVerticalSlide() ) value.push( '/', indexv + 1 );
3434 break;
3435 default:
3436 value.push( indexh + 1 );
3437 if( isVerticalSlide() ) value.push( '.', indexv + 1 );
3438 }
3148 }3439 }
31493440
3150 dom.slideNumber.innerHTML = formatSlideNumber( value[0], value[1], value[2] );3441 dom.slideNumber.innerHTML = formatSlideNumber( value[0], value[1], value[2] );
@@ -3428,6 +3719,26 @@
3428 }3719 }
34293720
3430 /**3721 /**
3722 * Should the given element be preloaded?
3723 * Decides based on local element attributes and global config.
3724 *
3725 * @param {HTMLElement} element
3726 */
3727 function shouldPreload( element ) {
3728
3729 // Prefer an explicit global preload setting
3730 var preload = config.preloadIframes;
3731
3732 // If no global setting is available, fall back on the element's
3733 // own preload setting
3734 if( typeof preload !== 'boolean' ) {
3735 preload = element.hasAttribute( 'data-preload' );
3736 }
3737
3738 return preload;
3739 }
3740
3741 /**
3431 * Called when the given slide is within the configured view3742 * Called when the given slide is within the configured view
3432 * distance. Shows the slide element and loads any content3743 * distance. Shows the slide element and loads any content
3433 * that is set to load lazily (data-src).3744 * that is set to load lazily (data-src).
@@ -3442,10 +3753,12 @@
3442 slide.style.display = config.display;3753 slide.style.display = config.display;
34433754
3444 // Media elements with data-src attributes3755 // Media elements with data-src attributes
3445 toArray( slide.querySelectorAll( 'img[data-src], video[data-src], audio[data-src]' ) ).forEach( function( element ) {3756 toArray( slide.querySelectorAll( 'img[data-src], video[data-src], audio[data-src], iframe[data-src]' ) ).forEach( function( element ) {
3446 element.setAttribute( 'src', element.getAttribute( 'data-src' ) );3757 if( element.tagName !== 'IFRAME' || shouldPreload( element ) ) {
3447 element.setAttribute( 'data-lazy-loaded', '' );3758 element.setAttribute( 'src', element.getAttribute( 'data-src' ) );
3448 element.removeAttribute( 'data-src' );3759 element.setAttribute( 'data-lazy-loaded', '' );
3760 element.removeAttribute( 'data-src' );
3761 }
3449 } );3762 } );
34503763
3451 // Media elements with <source> children3764 // Media elements with <source> children
@@ -3563,7 +3876,7 @@
3563 }3876 }
35643877
3565 // Reset lazy-loaded media elements with src attributes3878 // Reset lazy-loaded media elements with src attributes
3566 toArray( slide.querySelectorAll( 'video[data-lazy-loaded][src], audio[data-lazy-loaded][src]' ) ).forEach( function( element ) {3879 toArray( slide.querySelectorAll( 'video[data-lazy-loaded][src], audio[data-lazy-loaded][src], iframe[data-lazy-loaded][src]' ) ).forEach( function( element ) {
3567 element.setAttribute( 'data-src', element.getAttribute( 'src' ) );3880 element.setAttribute( 'data-src', element.getAttribute( 'src' ) );
3568 element.removeAttribute( 'src' );3881 element.removeAttribute( 'src' );
3569 } );3882 } );
@@ -3663,13 +3976,6 @@
3663 _appendParamToIframeSource( 'src', 'player.vimeo.com/', 'api=1' );3976 _appendParamToIframeSource( 'src', 'player.vimeo.com/', 'api=1' );
3664 _appendParamToIframeSource( 'data-src', 'player.vimeo.com/', 'api=1' );3977 _appendParamToIframeSource( 'data-src', 'player.vimeo.com/', 'api=1' );
36653978
3666 // Always show media controls on mobile devices
3667 if( isMobileDevice ) {
3668 toArray( dom.slides.querySelectorAll( 'video, audio' ) ).forEach( function( el ) {
3669 el.controls = true;
3670 } );
3671 }
3672
3673 }3979 }
36743980
3675 /**3981 /**
@@ -3713,7 +4019,20 @@
3713 // Mobile devices never fire a loaded event so instead4019 // Mobile devices never fire a loaded event so instead
3714 // of waiting, we initiate playback4020 // of waiting, we initiate playback
3715 else if( isMobileDevice ) {4021 else if( isMobileDevice ) {
3716 el.play();4022 var promise = el.play();
4023
4024 // If autoplay does not work, ensure that the controls are visible so
4025 // that the viewer can start the media on their own
4026 if( promise && typeof promise.catch === 'function' && el.controls === false ) {
4027 promise.catch( function() {
4028 el.controls = true;
4029
4030 // Once the video does start playing, hide the controls again
4031 el.addEventListener( 'play', function() {
4032 el.controls = false;
4033 } );
4034 } );
4035 }
3717 }4036 }
3718 // If the media isn't loaded, wait before playing4037 // If the media isn't loaded, wait before playing
3719 else {4038 else {
@@ -3947,7 +4266,7 @@
39474266
3948 }4267 }
39494268
3950 return pastCount / ( totalCount - 1 );4269 return Math.min( pastCount / ( totalCount - 1 ), 1 );
39514270
3952 }4271 }
39534272
@@ -3974,9 +4293,9 @@
3974 var bits = hash.slice( 2 ).split( '/' ),4293 var bits = hash.slice( 2 ).split( '/' ),
3975 name = hash.replace( /#|\//gi, '' );4294 name = hash.replace( /#|\//gi, '' );
39764295
3977 // If the first bit is invalid and there is a name we can4296 // If the first bit is not fully numeric and there is a name we
3978 // assume that this is a named link4297 // can assume that this is a named link
3979 if( isNaN( parseInt( bits[0], 10 ) ) && name.length ) {4298 if( !/^[0-9]*$/.test( bits[0] ) && name.length ) {
3980 var element;4299 var element;
39814300
3982 // Ensure the named link is a valid HTML ID attribute4301 // Ensure the named link is a valid HTML ID attribute
@@ -3988,10 +4307,13 @@
3988 // Ensure that we're not already on a slide with the same name4307 // Ensure that we're not already on a slide with the same name
3989 var isSameNameAsCurrentSlide = currentSlide ? currentSlide.getAttribute( 'id' ) === name : false;4308 var isSameNameAsCurrentSlide = currentSlide ? currentSlide.getAttribute( 'id' ) === name : false;
39904309
3991 if( element && !isSameNameAsCurrentSlide ) {4310 if( element ) {
3992 // Find the position of the named slide and navigate to it4311 // If the slide exists and is not the current slide...
3993 var indices = Reveal.getIndices( element );4312 if ( !isSameNameAsCurrentSlide ) {
3994 slide( indices.h, indices.v );4313 // ...find the position of the named slide and navigate to it
4314 var indices = Reveal.getIndices(element);
4315 slide(indices.h, indices.v);
4316 }
3995 }4317 }
3996 // If the slide doesn't exist, navigate to the current slide4318 // If the slide doesn't exist, navigate to the current slide
3997 else {4319 else {
@@ -4029,18 +4351,30 @@
4029 */4351 */
4030 function writeURL( delay ) {4352 function writeURL( delay ) {
40314353
4032 if( config.history ) {4354 // Make sure there's never more than one timeout running
40334355 clearTimeout( writeURLTimeout );
4034 // Make sure there's never more than one timeout running4356
4035 clearTimeout( writeURLTimeout );4357 // If a delay is specified, timeout this call
40364358 if( typeof delay === 'number' ) {
4037 // If a delay is specified, timeout this call4359 writeURLTimeout = setTimeout( writeURL, delay );
4038 if( typeof delay === 'number' ) {4360 }
4039 writeURLTimeout = setTimeout( writeURL, delay );4361 else if( currentSlide ) {
4040 }4362 // If we're configured to push to history OR the history
4041 else if( currentSlide ) {4363 // API is not avaialble.
4364 if( config.history || !window.history ) {
4042 window.location.hash = locationHash();4365 window.location.hash = locationHash();
4043 }4366 }
4367 // If we're configured to reflect the current slide in the
4368 // URL without pushing to history.
4369 else if( config.hash ) {
4370 window.history.replaceState( null, null, '#' + locationHash() );
4371 }
4372 // If history and hash are both disabled, a hash may still
4373 // be added to the URL by clicking on a href with a hash
4374 // target. Counter this by always removing the hash.
4375 else {
4376 window.history.replaceState( null, null, window.location.pathname + window.location.search );
4377 }
4044 }4378 }
40454379
4046 }4380 }
@@ -4108,6 +4442,25 @@
4108 }4442 }
41094443
4110 /**4444 /**
4445 * Returns an array of objects where each object represents the
4446 * attributes on its respective slide.
4447 */
4448 function getSlidesAttributes() {
4449
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches

to all changes: