Skip to content

Commit e7eb348

Browse files
authored
Merge branch 'develop' into xml-dom-unlink
2 parents f4ef693 + bf31cd0 commit e7eb348

24 files changed

+1095
-600
lines changed

.github/workflows/sphinx.yml

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Github Actions workflow to generate documentation
2+
# Uses the following shared task definitions:
3+
# - (checkout, upload artifact) from Github
4+
# - sphinx-action maintained by @ammaraskar
5+
name: Sphinx build
6+
7+
# Controls when the action will run.
8+
# Triggers the workflow on push or pull request events.
9+
on:
10+
- push
11+
- pull_request
12+
13+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
14+
jobs:
15+
# This workflow contains a single job called "build"
16+
build:
17+
# The type of runner that the job will run on
18+
runs-on: ubuntu-latest
19+
20+
# Steps are a sequence of tasks that will be executed as part of the job
21+
steps:
22+
# Check out repository under $GITHUB_WORKSPACE
23+
- uses: actions/checkout@v2
24+
# Builds docs using sphinx
25+
- uses: ammaraskar/sphinx-action@master
26+
with:
27+
docs-folder: "doc/"
28+
# Create an artifact out of the generated HTML
29+
- uses: actions/upload-artifact@v1
30+
with:
31+
name: UserGuideHTML
32+
path: "doc/_build/html/"

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ python3 src/launch.py
129129

130130
## Copyright
131131

132-
Copyright (c) 2008-2019 OpenShot Studios, LLC. This file is part of
132+
Copyright (c) 2008-2020 OpenShot Studios, LLC. This file is part of
133133
OpenShot Video Editor (https://www.openshot.org), an open-source project
134134
dedicated to delivering high quality video editing and animation solutions
135135
to the world.

doc/conf.py

+9
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,15 @@
4343
except ImportError:
4444
pass
4545

46+
import sys
47+
sys.path.insert(0, '.')
48+
try:
49+
# Load our YouTube directive
50+
import youtube_directive
51+
extensions.append('youtube_directive')
52+
except ImportError:
53+
pass
54+
4655
# External links mappings for extlinks
4756
# see: http://www.sphinx-doc.org/en/master/usage/extensions/extlinks.html
4857
extlinks = {

doc/requirements.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
sphinx_rtd_theme
2+
sphinx_copybutton
3+

doc/youtube_directive.py

+97
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
# $Id: misc.py 8257 2019-06-24 17:11:29Z milde $
2+
# Authors: David Goodger <[email protected]>; Dethe Elza
3+
# Copyright: This module has been placed in the public domain.
4+
5+
"""Miscellaneous directives."""
6+
7+
__docformat__ = 'reStructuredText'
8+
__version__ = "0.1.0"
9+
10+
import sys
11+
import re
12+
from docutils import nodes
13+
from docutils.parsers.rst import directives
14+
from docutils.utils.error_reporting import ErrorString
15+
16+
from sphinx import addnodes
17+
from sphinx.util import parselinenos
18+
from sphinx.util.docutils import SphinxDirective
19+
20+
if False:
21+
# For type annotation
22+
from typing import Any, Dict, List, Tuple # NOQA
23+
from sphinx.application import Sphinx # NOQA
24+
from sphinx.config import Config # NOQA
25+
26+
27+
class Youtube(SphinxDirective):
28+
29+
"""
30+
Wrap YouTube URLs in embedding HTML
31+
32+
Content is included in output based on type argument
33+
34+
Content may be included inline (content section of directive) or
35+
imported from a file or url.
36+
"""
37+
38+
embed_template = """
39+
<div style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; max-width: 100%; height: auto;">
40+
<iframe src="{url}" frameborder="0" allowfullscreen style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;"></iframe>
41+
</div>
42+
"""
43+
44+
required_arguments = 1
45+
optional_arguments = 0
46+
final_argument_whitespace = True
47+
option_spec = {'target': directives.unchanged_required,
48+
'encoding': directives.encoding}
49+
has_content = True
50+
51+
def run(self):
52+
if not self.state.document.settings.raw_enabled:
53+
raise self.warning('"%s" directive disabled.' % self.name)
54+
attributes = {'format': 'html'}
55+
encoding = self.options.get(
56+
'encoding', self.state.document.settings.input_encoding)
57+
e_handler=self.state.document.settings.input_encoding_error_handler
58+
if self.content:
59+
raise self.error(
60+
'"%s" directive may not have content.' % self.name)
61+
62+
target = self.arguments[0]
63+
64+
id = ""
65+
try:
66+
results = re.match(
67+
r'https.*(embed/|/|\?v=)(?P<ID>[a-zA-Z0-9_-]*)(?:/?)$',
68+
target)
69+
if results and 'ID' in results.groupdict():
70+
id = results.group('ID')
71+
else:
72+
id = target
73+
except AttributeError:
74+
pass
75+
76+
try:
77+
url = 'https://www.youtube.com/embed/{id}'.format(id=id)
78+
text = self.embed_template.format(url=url)
79+
except UnicodeError as error:
80+
raise self.severe('Problem with "%s" directive:\n%s'
81+
% (self.name, ErrorString(error)))
82+
83+
raw_node = nodes.raw('', text, **attributes)
84+
(raw_node.source, raw_node.line) = \
85+
self.state_machine.get_source_and_line(self.lineno)
86+
return [raw_node]
87+
88+
89+
def setup(app):
90+
# type: (Sphinx) -> Dict[str, Any]
91+
directives.register_directive('youtube', Youtube)
92+
93+
return {
94+
'version': __version__,
95+
'parallel_read_safe': True,
96+
'parallel_write_safe': True,
97+
}

src/blender/picture_frames_4.xml

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,28 +11,28 @@
1111
<default>TitleFileName</default>
1212
</param>
1313

14-
<param name="project_files1" type="dropdown" title="Picture 1 Path" description="">
14+
<param name="project_files1" type="dropdown" title="Picture 1" description="">
1515
<values>
1616
<value name="" num=""/>
1717
</values>
1818
<default></default>
1919
</param>
2020

21-
<param name="project_files2" type="dropdown" title="Picture 2 Path" description="">
21+
<param name="project_files2" type="dropdown" title="Picture 2" description="">
2222
<values>
2323
<value name="" num=""/>
2424
</values>
2525
<default></default>
2626
</param>
2727

28-
<param name="project_files3" type="dropdown" title="Picture 3 Path" description="">
28+
<param name="project_files3" type="dropdown" title="Picture 3" description="">
2929
<values>
3030
<value name="" num=""/>
3131
</values>
3232
<default></default>
3333
</param>
3434

35-
<param name="project_files4" type="dropdown" title="Picture 4 Path" description="">
35+
<param name="project_files4" type="dropdown" title="Picture 4" description="">
3636
<values>
3737
<value name="" num=""/>
3838
</values>

src/classes/info.py

+12-7
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@
2828
import os
2929
from time import strftime
3030

31-
from PyQt5.QtCore import QDir
32-
3331
VERSION = "2.5.1-dev2"
3432
MINIMUM_LIBOPENSHOT_VERSION = "0.2.5"
3533
DATE = "20200228000000"
@@ -98,11 +96,18 @@
9896
print("Loading translations from: {}".format(language_path))
9997

10098
# Compile language list from :/locale resource
101-
langdir = QDir(language_path)
102-
langs = langdir.entryList(['OpenShot.*.qm'], QDir.NoDotAndDotDot | QDir.Files,
103-
sort=QDir.Name)
104-
for trpath in langs:
105-
SUPPORTED_LANGUAGES.append(trpath.split('.')[1])
99+
try:
100+
from PyQt5.QtCore import QDir
101+
langdir = QDir(language_path)
102+
langs = langdir.entryList(
103+
['OpenShot.*.qm'],
104+
QDir.NoDotAndDotDot | QDir.Files,
105+
sort=QDir.Name)
106+
for trpath in langs:
107+
SUPPORTED_LANGUAGES.append(trpath.split('.')[1])
108+
except ImportError:
109+
# Fail gracefully if we're running without PyQt5 (e.g. CI tasks)
110+
pass
106111

107112
SETUP = {
108113
"name": NAME,

src/classes/ui_util.py

+13-8
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,41 @@
1-
"""
1+
"""
22
@file
33
@brief This file contains PyQt help functions, to translate the interface, load icons, and connect signals
44
@author Noah Figg <[email protected]>
55
@author Jonathan Thomas <[email protected]>
66
@author Olivier Girard <[email protected]>
7-
7+
88
@section LICENSE
9-
9+
1010
Copyright (c) 2008-2018 OpenShot Studios, LLC
1111
(http://www.openshotstudios.com). This file is part of
1212
OpenShot Video Editor (http://www.openshot.org), an open-source project
1313
dedicated to delivering high quality video editing and animation solutions
1414
to the world.
15-
15+
1616
OpenShot Video Editor is free software: you can redistribute it and/or modify
1717
it under the terms of the GNU General Public License as published by
1818
the Free Software Foundation, either version 3 of the License, or
1919
(at your option) any later version.
20-
20+
2121
OpenShot Video Editor is distributed in the hope that it will be useful,
2222
but WITHOUT ANY WARRANTY; without even the implied warranty of
2323
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2424
GNU General Public License for more details.
25-
25+
2626
You should have received a copy of the GNU General Public License
2727
along with OpenShot Library. If not, see <http://www.gnu.org/licenses/>.
2828
"""
2929

3030
import os
31-
import xml.etree.ElementTree
3231
import time
3332

33+
# Try to get the security-patched XML functions from defusedxml
34+
try:
35+
from defusedxml import ElementTree
36+
except ImportError:
37+
from xml.etree import ElementTree
38+
3439
from PyQt5.QtCore import QDir, QLocale
3540
from PyQt5.QtGui import QIcon
3641
from PyQt5.QtWidgets import *
@@ -85,7 +90,7 @@ def load_ui(window, path):
8590
raise error
8691

8792
# Save xml tree for ui
88-
window.uiTree = xml.etree.ElementTree.parse(path)
93+
window.uiTree = ElementTree.parse(path)
8994

9095

9196
def get_default_icon(theme_name):

src/language/generate_translations.py

+14-8
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
#!/usr/bin/python3
2-
"""
2+
"""
33
@file
44
@brief This file updates the OpenShot.POT (language translation template) by scanning all source files.
55
@author Jonathan Thomas <[email protected]>
6-
6+
77
This file helps you generate the POT file that contains all of the translatable
88
strings / text in OpenShot. Because some of our text is in custom XML files,
9-
the xgettext command can't correctly generate the POT file. Thus... the
9+
the xgettext command can't correctly generate the POT file. Thus... the
1010
existence of this file. =)
1111
1212
Command to create the individual language PO files (Ascii files)
@@ -28,23 +28,23 @@
2828
$ msgcat ~/openshot/locale/OpenShot/OpenShot_source.pot ~/openshot/openshot/locale/OpenShot/OpenShot_glade.pot -o ~/openshot/main/locale/OpenShot/OpenShot.pot
2929
3030
@section LICENSE
31-
31+
3232
Copyright (c) 2008-2018 OpenShot Studios, LLC
3333
(http://www.openshotstudios.com). This file is part of
3434
OpenShot Video Editor (http://www.openshot.org), an open-source project
3535
dedicated to delivering high quality video editing and animation solutions
3636
to the world.
37-
37+
3838
OpenShot Video Editor is free software: you can redistribute it and/or modify
3939
it under the terms of the GNU General Public License as published by
4040
the Free Software Foundation, either version 3 of the License, or
4141
(at your option) any later version.
42-
42+
4343
OpenShot Video Editor is distributed in the hope that it will be useful,
4444
but WITHOUT ANY WARRANTY; without even the implied warranty of
4545
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4646
GNU General Public License for more details.
47-
47+
4848
You should have received a copy of the GNU General Public License
4949
along with OpenShot Library. If not, see <http://www.gnu.org/licenses/>.
5050
"""
@@ -54,8 +54,14 @@
5454
import os
5555
import subprocess
5656
import sys
57-
import xml.dom.minidom as xml
5857
import json
58+
59+
# Try to get the security-patched XML functions from defusedxml
60+
try:
61+
from defusedxml import minidom as xml
62+
except ImportError:
63+
from xml.dom import minidom as xml
64+
5965
import openshot
6066

6167
# Get the absolute path of this project

src/presets/format_mp4_librav1e.xml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<!DOCTYPE openshot-export-option>
3+
<export-option>
4+
<type translatable="True">All Formats</type>
5+
<title translatable="True">MP4 (AV1 rav1e)</title>
6+
<videoformat>mp4</videoformat>
7+
<videocodec>librav1e</videocodec>
8+
<audiocodec>libvorbis</audiocodec>
9+
<audiochannels>2</audiochannels>
10+
<audiochannellayout>3</audiochannellayout>
11+
<videobitrate
12+
low="200 qp"
13+
med="100 qp"
14+
high="50 qp"></videobitrate>
15+
<audiobitrate
16+
low="96 kb/s"
17+
med="128 kb/s"
18+
high="192 kb/s"></audiobitrate>
19+
<samplerate>48000</samplerate>
20+
</export-option>

src/presets/format_mp4_libsvtav1.xml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<!DOCTYPE openshot-export-option>
3+
<export-option>
4+
<type translatable="True">All Formats</type>
5+
<title translatable="True">MP4 (AV1 svt)</title>
6+
<videoformat>mp4</videoformat>
7+
<videocodec>libsvt_av1</videocodec>
8+
<audiocodec>libvorbis</audiocodec>
9+
<audiochannels>2</audiochannels>
10+
<audiochannellayout>3</audiochannellayout>
11+
<videobitrate
12+
low="60 qp"
13+
med="50 qp"
14+
high="30 qp"></videobitrate>
15+
<audiobitrate
16+
low="96 kb/s"
17+
med="128 kb/s"
18+
high="192 kb/s"></audiobitrate>
19+
<samplerate>48000</samplerate>
20+
</export-option>

src/presets/format_webm_libav1.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<!DOCTYPE openshot-export-option>
33
<export-option>
44
<type translatable="True">All Formats</type>
5-
<title translatable="True">WEBM (AV1)</title>
5+
<title translatable="True">WEBM (AV1 aom)</title>
66
<videoformat>webm</videoformat>
77
<videocodec>libaom-av1</videocodec>
88
<audiocodec>libvorbis</audiocodec>

0 commit comments

Comments
 (0)