Skip to content

Commit e6a676b

Browse files
committed
switch back to sphinx + some new events
1 parent 66bb650 commit e6a676b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+625
-26373
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ It also has useful utilities like:
99
* Creating a ZIP looped package from an FLP
1010

1111
## Usage
12-
```Python
12+
```{code-block} python
1313
from pyflp.parser import ProjectParser
1414
project = ProjectParser().parse("/path/to/efelpee.flp")
1515
@@ -18,12 +18,12 @@ project = ProjectParser().parse("/path/to/efelpee.flp")
1818

1919
## Installation
2020

21-
```
21+
```{code-block}
2222
pip install pyflp
2323
```
2424

2525
## Testing
26-
I have created a [null test](test_parser.py). More tests need to be added.
26+
I have created a [null test](tests/test_parser.py). More tests need to be added.
2727

2828
## Thanks
2929

@@ -33,4 +33,4 @@ I have created a [null test](test_parser.py). More tests need to be added.
3333

3434
## Contributions
3535

36-
If you can spare some time for testing and/or contributing, I would be very grateful. Please check the [TODO](../TODO) as well for current goals/issues. You can reach me at **demberto**[at]**protonmail**[dot]**com** as well :)
36+
If you can spare some time for testing and/or contributing, I would be very grateful. Please check the [TODO](TODO.md) as well for current goals/issues. You can reach me at **demberto**[at]**protonmail**[dot]**com** as well :)

docs/Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line, and also
5+
# from the environment for the first two.
6+
SPHINXOPTS ?=
7+
SPHINXBUILD ?= sphinx-build
8+
SOURCEDIR = .
9+
BUILDDIR = _build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

docs/conf.py

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Configuration file for the Sphinx documentation builder.
2+
#
3+
# This file only contains a selection of the most common options. For a full
4+
# list see the documentation:
5+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
6+
7+
# -- Path setup --------------------------------------------------------------
8+
9+
# If extensions (or modules to document with autodoc) are in another directory,
10+
# add these directories to sys.path here. If the directory is relative to the
11+
# documentation root, use os.path.abspath to make it absolute, like shown here.
12+
#
13+
import os
14+
import sys
15+
sys.path.insert(0, os.path.abspath('..'))
16+
17+
18+
# -- Project information -----------------------------------------------------
19+
20+
project = 'PyFLP'
21+
copyright = '2021, demberto'
22+
author = 'demberto'
23+
24+
# The full version, including alpha/beta/rc tags
25+
release = '0.0.3'
26+
27+
28+
# -- General configuration ---------------------------------------------------
29+
30+
# Add any Sphinx extension module names here, as strings. They can be
31+
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
32+
# ones.
33+
extensions = [
34+
'sphinx.ext.napoleon',
35+
'sphinx.ext.todo',
36+
'sphinx.ext.autodoc',
37+
'sphinx.ext.githubpages',
38+
'sphinx.ext.viewcode',
39+
'myst_parser'
40+
]
41+
42+
# Add any paths that contain templates here, relative to this directory.
43+
templates_path = ['_templates']
44+
45+
# List of patterns, relative to source directory, that match files and
46+
# directories to ignore when looking for source files.
47+
# This pattern also affects html_static_path and html_extra_path.
48+
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
49+
50+
51+
# -- Options for HTML output -------------------------------------------------
52+
53+
# The theme to use for HTML and HTML Help pages. See the documentation for
54+
# a list of builtin themes.
55+
#
56+
html_theme = 'sphinx_rtd_theme'
57+
58+
# Add any paths that contain custom static files (such as style sheets) here,
59+
# relative to this directory. They are copied after the builtin static files,
60+
# so a file named "default.css" will overwrite the builtin "default.css".
61+
html_static_path = ['_static']

docs/flp-format.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ data # [size, type depends on id] Either a fixed size event or a variable
1010

1111
*where type of `data` is decided by*
1212

13-
```Python
13+
```{code-block} python
1414
if event_id in range(0, 64):
1515
data.size = 1 # Hence event size = 2 ("ByteEvent" from here on)
1616
elif event_id in range(64, 128):

docs/how-does-it-work.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Since, FLP is an event-based binary format, we need to work with data types of C
88

99
Then I read all the events into a `list` of `Event` objects which I call the **Event Store**. The parsing logic for this is in [`_build_event_store()`](../pyflp/parser.py#L78) method of `ProjectParser`. It is important that every new event has an `index` so it can be sorted later on, while saving. The `Event` class and its subclasses `ByteEvent`, `WordEvent`, `DWordEvent`, `TextEvent`, and `DataEvent` look like this *minified*:
1010

11-
```Python
11+
```{code-block} python
1212
class Event:
1313
def __init__(self, id, data):
1414
self.id = id
@@ -33,7 +33,8 @@ Subclasses have additional `to_*` helper methods, which convert basic types to P
3333
Once the events are created, the `ProjectParser.parse()` starts building the `Project` object, by examining `Event` IDs. All its fields for e.g. `Channel`, `Insert` etc. inherit from `FLObject`.
3434

3535
FLObject class looks like this *minified*:
36-
```Python
36+
37+
```{code-block} python
3738
class FLObject:
3839
def __init__(self):
3940
self._events: Dict[str, Event] = {}

docs/index.html

Lines changed: 0 additions & 271 deletions
This file was deleted.

docs/index.rst

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
.. PyFLP documentation master file, created by
2+
sphinx-quickstart on Fri Sep 24 18:29:27 2021.
3+
You can adapt this file completely to your liking, but it should at least
4+
contain the root `toctree` directive.
5+
6+
Welcome to PyFLP's documentation!
7+
=================================
8+
9+
.. toctree::
10+
:maxdepth: 2
11+
:caption: Contents:
12+
13+
README <readme_link.md>
14+
FLP Format <flp-format.md>
15+
Modules <modules.rst>
16+
17+
Indices and tables
18+
==================
19+
20+
* :ref:`genindex`
21+
* :ref:`modindex`
22+
* :ref:`search`

docs/make.bat

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
@ECHO OFF
2+
3+
pushd %~dp0
4+
5+
REM Command file for Sphinx documentation
6+
7+
if "%SPHINXBUILD%" == "" (
8+
set SPHINXBUILD=sphinx-build
9+
)
10+
set SOURCEDIR=.
11+
set BUILDDIR=_build
12+
13+
if "%1" == "" goto help
14+
15+
%SPHINXBUILD% >NUL 2>NUL
16+
if errorlevel 9009 (
17+
echo.
18+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
19+
echo.installed, then set the SPHINXBUILD environment variable to point
20+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
21+
echo.may add the Sphinx directory to PATH.
22+
echo.
23+
echo.If you don't have Sphinx installed, grab it from
24+
echo.https://www.sphinx-doc.org/
25+
exit /b 1
26+
)
27+
28+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
29+
goto end
30+
31+
:help
32+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
33+
34+
:end
35+
popd

docs/modules.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
pyflp
2+
=====
3+
4+
.. toctree::
5+
:maxdepth: 4
6+
7+
pyflp

docs/pyflp.event.rst

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
pyflp.event package
2+
===================
3+
4+
Submodules
5+
----------
6+
7+
pyflp.event.byte\_event module
8+
------------------------------
9+
10+
.. automodule:: pyflp.event.byte_event
11+
:members:
12+
:undoc-members:
13+
:show-inheritance:
14+
15+
pyflp.event.data\_event module
16+
------------------------------
17+
18+
.. automodule:: pyflp.event.data_event
19+
:members:
20+
:undoc-members:
21+
:show-inheritance:
22+
23+
pyflp.event.dword\_event module
24+
-------------------------------
25+
26+
.. automodule:: pyflp.event.dword_event
27+
:members:
28+
:undoc-members:
29+
:show-inheritance:
30+
31+
pyflp.event.event module
32+
------------------------
33+
34+
.. automodule:: pyflp.event.event
35+
:members:
36+
:undoc-members:
37+
:show-inheritance:
38+
39+
pyflp.event.text\_event module
40+
------------------------------
41+
42+
.. automodule:: pyflp.event.text_event
43+
:members:
44+
:undoc-members:
45+
:show-inheritance:
46+
47+
pyflp.event.word\_event module
48+
------------------------------
49+
50+
.. automodule:: pyflp.event.word_event
51+
:members:
52+
:undoc-members:
53+
:show-inheritance:
54+
55+
Module contents
56+
---------------
57+
58+
.. automodule:: pyflp.event
59+
:members:
60+
:undoc-members:
61+
:show-inheritance:

0 commit comments

Comments
 (0)