Browse Source

just some files

master
Nils 3 years ago
parent
commit
75cdc4120c
  1. 131
      .gitignore
  2. 10
      CHANGELOG
  3. 136
      README.md
  4. 1
      __main__.py
  5. 6
      configure
  6. 10
      desktop/desktop.desktop
  7. BIN
      desktop/icon256x256.png
  8. BIN
      desktop/icon32x32.png
  9. 430
      documentation/LICENSE
  10. 7
      documentation/README.txt
  11. 18
      documentation/build-documentation.sh
  12. 5
      documentation/english.part.adoc
  13. BIN
      documentation/favicon.ico
  14. BIN
      documentation/favicon.png
  15. 5
      documentation/german.part.adoc
  16. 37
      documentation/index.adoc
  17. 45
      documentation/manpageinclude.h2m
  18. 64
      documentation/readme.template
  19. BIN
      documentation/screenshot.png
  20. 30
      engine/__init__.py
  21. 65
      engine/api.py
  22. 63
      engine/config.py
  23. 40
      engine/main.py
  24. 0
      qtgui/__init__.py
  25. 30
      qtgui/constantsAndConfigs.py
  26. 93
      qtgui/designer/mainwindow.py
  27. 189
      qtgui/designer/mainwindow.ui
  28. 165
      qtgui/instrument.py
  29. 85
      qtgui/mainwindow.py
  30. 884
      qtgui/resources.py
  31. BIN
      qtgui/resources/aboutlogo.png
  32. 4
      qtgui/resources/buildresources.sh
  33. BIN
      qtgui/resources/icon.png
  34. 7
      qtgui/resources/resources.qrc
  35. 2
      qtgui/resources/translations/config.pro
  36. BIN
      qtgui/resources/translations/de.qm
  37. 29
      qtgui/resources/translations/de.ts
  38. 5
      qtgui/resources/translations/update.sh
  39. 1
      tembro
  40. 16086
      template/calfbox/configure~
  41. 1
      template/documentation/index.adoc.template

131
.gitignore

@ -0,0 +1,131 @@
# Byte-compiled / optimized / DLL files
*__pycache__
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
target/
# Jupyter Notebook
.ipynb_checkpoints
# pyenv
.python-version
# celery beat schedule file
celerybeat-schedule
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
#build process
*.bin
*.build
build/
Makefile
compiledprefix.py
sitepackages
template/calfbox/.deps
template/calfbox/build
template/calfbox/autom4te.cache
template/calfbox/Makefile.in
template/calfbox/aclocal.m4
template/calfbox/compile
template/calfbox/config.h
template/calfbox/config.h.in
template/calfbox/config.h.in~
template/calfbox/config.status
template/calfbox/configure
template/calfbox/depcomp
template/calfbox/install-sh
template/calfbox/ltmain.sh
template/calfbox/missing
template/calfbox/stamp-h1
tempalte/calfbox/configure~

10
CHANGELOG

@ -0,0 +1,10 @@
#Changelog
Format: Double ## for a version number followed by a space, ISO-Date, Semantic Versioning:
## YYYY-MM-DD major.minor.patch
Two empty lines before the next entry.
External contributors notice at the end of the line: (LastName, FirstName / nick)
## 1111-11-11 0.1.0
Initial proof-of-concept release

136
README.md

@ -1,3 +1,135 @@
# Tembro
Sampled Instrument Player with static and monolithic design. All instruments are built-in.
[//]: # (Generated 2021-02-13T20:17:14.249024. Changes belong into template/documentation/readme.template)
#Patroneo
Program version 2.1.0
![Screenshot](https://git.laborejo.org/lss/Patroneo/raw/branch/master/documentation/screenshot.png "Screenshot")
Patroneo (which is Esperanto for "Pattern") is an easy to use, pattern based midi sequencer, a
program that sends digital "notes" to software instruments such as synthesizers and samplers.
Patroneo is primarily designed for educational purposes, where the main goal is to teach the
importance of patterns and repetitions in any kind of music. However, Patroneo is a full sequencer
you can use to create real music. The constraints it presents will more likely boost your
creativity than suppressing it.
You have tracks with one pattern each. Turn on steps in the pattern to play
musical notes. Switch the patterns on and off in a sequence to create a song structure.
Connect external synthesizers and samplers to create sounds.
This README is just a short introduction. Consult the manual (see below) for more information.
# Contact and Information
* Website https://www.laborejo.org
* Bugs and Issues: https://www.laborejo.org/bugs
* Git Repositories for all programs: https://git.laborejo.org
* Documentation and Manual https://www.laborejo.org/documentation/patroneo
# Installation and Starting
## Download
### Release Version
If the latest release is not available through your package manger you can build it yourself:
Download the latest code release on https://www.laborejo.org/downloads and extract it.
### Git Version
It is possible to clone a git repository.
`git clone https://git.laborejo.org/lss/patroneo.git`
## Dependencies
* Glibc
* Python 3.6 (maybe earlier)
* PyQt5 for Python 3
* DejaVu Sans Sarif TTF (Font) (recommended, but not technically necessary)
#### Build Dependencies
* Bash
* GCC (development is done on 8.2, but most likely you can use a much earlier version)
### Environment:
* Jack Audio Connection Kit must be running
* Agordejo / New Session Manager ("NSM")
## Build
./configure --prefix=/usr/local
make
sudo make install
## Starting
There are multiple ways to run Patroneo which should give you the flexibility to configure your
system as you want.
We make no distinction if you installed Patroneo yourself or through the distributions package-manager.
The differences are: With or without Agordejo, with or without sound, installed or from the source dir.
### Installed , running through Agordejo (New Session Manager) (recommended)
Starting Patroneo through Agordejo after you installed patroneo system-wide
is the recommended and only supported way. Start agordejo and load or create a new
session. Then use the program launcher to add `patroneo`.
It should appear with an icon in the list and open its GUI.
### Installed without Agordejo
If you start patroneo directly it will present you with a dialog to choose your session directory.
You can also start patroneo from a terminal (or create a starter script).
`patroneo --save DIRECTORY`
Uses the given directory to save. The dir will be created or loaded from if already present. Use
the applications file menu to save (Ctrl+s).
You can use this to load and save the files from an existing NSM session. If you create a new
directory you can copy it manually to an NSM session directory, but that requires renaming the
directory to append the unique ID provided by NSM.
Sending SIGUSR1 to the program in this mode will trigger a save.
Closing through your window manager in this mode will actually quit the application without a
prompt to save changes.
## From source directory
You can run Patroneo after extracting the release archive or cloning from git, without installation.
### Calfbox
"Calfbox" is the name of our internal realtime midi/audio python module.
* It is bundled with the application for a normal install.
* Or you could run `./configure` and `make calfbox` without subsequent install, which creates a `sitepackages` directory in the source dir. You can then run `./patroneo` directly from the source.
* A third option is `./patroneo --mute` which runs without sound at all and does not need calfbox.
### From source directory with NSM
The developer uses this way to develop and use the software, so it will always be as stable as the
compiled version. But it is a bit less performant than building and installing it.
After extracting the release archive create a symlink from `patroneo` into your PATH. e.g. /usr/bin
or ~/bin, if that exists on your system.
If you compiled without installing you can also symlink to `./patroneo.bin`
### From source dir without NSM
Use `./patroneo --save` (see above). If you compiled without installing you can also run `./patroneo.bin`
### No NSM, no Make, No Sound
Combining the above options you can start the program directly after unpacking or cloning from git:
`./patroneo --save /tmp --mute`
Or even shorter:
`./patroneo -s /tmp -m`
This is the minimal run mode which is only useful for testing and development. But if you only want
to look at the GUI and are not in the mood to install anything -including dependencies-, go ahead.

1
__main__.py

@ -0,0 +1 @@
template/main.py.template

6
configure

@ -0,0 +1,6 @@
#!/bin/bash
program=tembro
cboxconfigure="--without-fluidsynth --without-libsmf"
version=0.1.0
. template/configure.template #. is the posix compatible version of source

10
desktop/desktop.desktop

@ -0,0 +1,10 @@
[Desktop Entry]
Type=Application
Name=QtCboxNsm Exรคmple ใƒ„
Comment=Just an example
Exec=exampleClientCboxQtNsm
Icon=exampleClientCboxQtNsm
Terminal=false
StartupNotify=false
Version=1.0
Categories=AudioVideo;Audio;X-Recorders;X-Multitrack;X-Jack;

BIN
desktop/icon256x256.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 680 B

BIN
desktop/icon32x32.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 680 B

430
documentation/LICENSE

@ -0,0 +1,430 @@
from: https://creativecommons.org/licenses/by-sa/4.0/legalcode.txt
Attribution-ShareAlike 4.0 International
=======================================================================
Creative Commons Corporation ("Creative Commons") is not a law firm and
does not provide legal services or legal advice. Distribution of
Creative Commons public licenses does not create a lawyer-client or
other relationship. Creative Commons makes its licenses and related
information available on an "as-is" basis. Creative Commons gives no
warranties regarding its licenses, any material licensed under their
terms and conditions, or any related information. Creative Commons
disclaims all liability for damages resulting from their use to the
fullest extent possible.
Using Creative Commons Public Licenses
Creative Commons public licenses provide a standard set of terms and
conditions that creators and other rights holders may use to share
original works of authorship and other material subject to copyright
and certain other rights specified in the public license below. The
following considerations are for informational purposes only, are not
exhaustive, and do not form part of our licenses.
Considerations for licensors: Our public licenses are
intended for use by those authorized to give the public
permission to use material in ways otherwise restricted by
copyright and certain other rights. Our licenses are
irrevocable. Licensors should read and understand the terms
and conditions of the license they choose before applying it.
Licensors should also secure all rights necessary before
applying our licenses so that the public can reuse the
material as expected. Licensors should clearly mark any
material not subject to the license. This includes other CC-
licensed material, or material used under an exception or
limitation to copyright. More considerations for licensors:
wiki.creativecommons.org/Considerations_for_licensors
Considerations for the public: By using one of our public
licenses, a licensor grants the public permission to use the
licensed material under specified terms and conditions. If
the licensor's permission is not necessary for any reason--for
example, because of any applicable exception or limitation to
copyright--then that use is not regulated by the license. Our
licenses grant only permissions under copyright and certain
other rights that a licensor has authority to grant. Use of
the licensed material may still be restricted for other
reasons, including because others have copyright or other
rights in the material. A licensor may make special requests,
such as asking that all changes be marked or described.
Although not required by our licenses, you are encouraged to
respect those requests where reasonable. More considerations
for the public:
wiki.creativecommons.org/Considerations_for_licensees
=======================================================================
Creative Commons Attribution-ShareAlike 4.0 International Public
License
By exercising the Licensed Rights (defined below), You accept and agree
to be bound by the terms and conditions of this Creative Commons
Attribution-ShareAlike 4.0 International Public License ("Public
License"). To the extent this Public License may be interpreted as a
contract, You are granted the Licensed Rights in consideration of Your
acceptance of these terms and conditions, and the Licensor grants You
such rights in consideration of benefits the Licensor receives from
making the Licensed Material available under these terms and
conditions.
Section 1 -- Definitions.
a. Adapted Material means material subject to Copyright and Similar
Rights that is derived from or based upon the Licensed Material
and in which the Licensed Material is translated, altered,
arranged, transformed, or otherwise modified in a manner requiring
permission under the Copyright and Similar Rights held by the
Licensor. For purposes of this Public License, where the Licensed
Material is a musical work, performance, or sound recording,
Adapted Material is always produced where the Licensed Material is
synched in timed relation with a moving image.
b. Adapter's License means the license You apply to Your Copyright
and Similar Rights in Your contributions to Adapted Material in
accordance with the terms and conditions of this Public License.
c. BY-SA Compatible License means a license listed at
creativecommons.org/compatiblelicenses, approved by Creative
Commons as essentially the equivalent of this Public License.
d. Copyright and Similar Rights means copyright and/or similar rights
closely related to copyright including, without limitation,
performance, broadcast, sound recording, and Sui Generis Database
Rights, without regard to how the rights are labeled or
categorized. For purposes of this Public License, the rights
specified in Section 2(b)(1)-(2) are not Copyright and Similar
Rights.
e. Effective Technological Measures means those measures that, in the
absence of proper authority, may not be circumvented under laws
fulfilling obligations under Article 11 of the WIPO Copyright
Treaty adopted on December 20, 1996, and/or similar international
agreements.
f. Exceptions and Limitations means fair use, fair dealing, and/or
any other exception or limitation to Copyright and Similar Rights
that applies to Your use of the Licensed Material.
g. License Elements means the license attributes listed in the name
of a Creative Commons Public License. The License Elements of this
Public License are Attribution and ShareAlike.
h. Licensed Material means the artistic or literary work, database,
or other material to which the Licensor applied this Public
License.
i. Licensed Rights means the rights granted to You subject to the
terms and conditions of this Public License, which are limited to
all Copyright and Similar Rights that apply to Your use of the
Licensed Material and that the Licensor has authority to license.
j. Licensor means the individual(s) or entity(ies) granting rights
under this Public License.
k. Share means to provide material to the public by any means or
process that requires permission under the Licensed Rights, such
as reproduction, public display, public performance, distribution,
dissemination, communication, or importation, and to make material
available to the public including in ways that members of the
public may access the material from a place and at a time
individually chosen by them.
l. Sui Generis Database Rights means rights other than copyright
resulting from Directive 96/9/EC of the European Parliament and of
the Council of 11 March 1996 on the legal protection of databases,
as amended and/or succeeded, as well as other essentially
equivalent rights anywhere in the world.
m. You means the individual or entity exercising the Licensed Rights
under this Public License. Your has a corresponding meaning.
Section 2 -- Scope.
a. License grant.
1. Subject to the terms and conditions of this Public License,
the Licensor hereby grants You a worldwide, royalty-free,
non-sublicensable, non-exclusive, irrevocable license to
exercise the Licensed Rights in the Licensed Material to:
a. reproduce and Share the Licensed Material, in whole or
in part; and
b. produce, reproduce, and Share Adapted Material.
2. Exceptions and Limitations. For the avoidance of doubt, where
Exceptions and Limitations apply to Your use, this Public
License does not apply, and You do not need to comply with
its terms and conditions.
3. Term. The term of this Public License is specified in Section
6(a).
4. Media and formats; technical modifications allowed. The
Licensor authorizes You to exercise the Licensed Rights in
all media and formats whether now known or hereafter created,
and to make technical modifications necessary to do so. The
Licensor waives and/or agrees not to assert any right or
authority to forbid You from making technical modifications
necessary to exercise the Licensed Rights, including
technical modifications necessary to circumvent Effective
Technological Measures. For purposes of this Public License,
simply making modifications authorized by this Section 2(a)
(4) never produces Adapted Material.
5. Downstream recipients.
a. Offer from the Licensor -- Licensed Material. Every
recipient of the Licensed Material automatically
receives an offer from the Licensor to exercise the
Licensed Rights under the terms and conditions of this
Public License.
b. Additional offer from the Licensor -- Adapted Material.
Every recipient of Adapted Material from You
automatically receives an offer from the Licensor to
exercise the Licensed Rights in the Adapted Material
under the conditions of the Adapter's License You apply.
c. No downstream restrictions. You may not offer or impose
any additional or different terms or conditions on, or
apply any Effective Technological Measures to, the
Licensed Material if doing so restricts exercise of the
Licensed Rights by any recipient of the Licensed
Material.
6. No endorsement. Nothing in this Public License constitutes or
may be construed as permission to assert or imply that You
are, or that Your use of the Licensed Material is, connected
with, or sponsored, endorsed, or granted official status by,
the Licensor or others designated to receive attribution as
provided in Section 3(a)(1)(A)(i).
b. Other rights.
1. Moral rights, such as the right of integrity, are not
licensed under this Public License, nor are publicity,
privacy, and/or other similar personality rights; however, to
the extent possible, the Licensor waives and/or agrees not to
assert any such rights held by the Licensor to the limited
extent necessary to allow You to exercise the Licensed
Rights, but not otherwise.
2. Patent and trademark rights are not licensed under this
Public License.
3. To the extent possible, the Licensor waives any right to
collect royalties from You for the exercise of the Licensed
Rights, whether directly or through a collecting society
under any voluntary or waivable statutory or compulsory
licensing scheme. In all other cases the Licensor expressly
reserves any right to collect such royalties.
Section 3 -- License Conditions.
Your exercise of the Licensed Rights is expressly made subject to the
following conditions.
a. Attribution.
1. If You Share the Licensed Material (including in modified
form), You must:
a. retain the following if it is supplied by the Licensor
with the Licensed Material:
i. identification of the creator(s) of the Licensed
Material and any others designated to receive
attribution, in any reasonable manner requested by
the Licensor (including by pseudonym if
designated);
ii. a copyright notice;
iii. a notice that refers to this Public License;
iv. a notice that refers to the disclaimer of
warranties;
v. a URI or hyperlink to the Licensed Material to the
extent reasonably practicable;
b. indicate if You modified the Licensed Material and
retain an indication of any previous modifications; and
c. indicate the Licensed Material is licensed under this
Public License, and include the text of, or the URI or
hyperlink to, this Public License.
2. You may satisfy the conditions in Section 3(a)(1) in any
reasonable manner based on the medium, means, and context in
which You Share the Licensed Material. For example, it may be
reasonable to satisfy the conditions by providing a URI or
hyperlink to a resource that includes the required
information.
3. If requested by the Licensor, You must remove any of the
information required by Section 3(a)(1)(A) to the extent
reasonably practicable.
b. ShareAlike.
In addition to the conditions in Section 3(a), if You Share
Adapted Material You produce, the following conditions also apply.
1. The Adapter's License You apply must be a Creative Commons
license with the same License Elements, this version or
later, or a BY-SA Compatible License.
2. You must include the text of, or the URI or hyperlink to, the
Adapter's License You apply. You may satisfy this condition
in any reasonable manner based on the medium, means, and
context in which You Share Adapted Material.
3. You may not offer or impose any additional or different terms
or conditions on, or apply any Effective Technological
Measures to, Adapted Material that restrict exercise of the
rights granted under the Adapter's License You apply.
Section 4 -- Sui Generis Database Rights.
Where the Licensed Rights include Sui Generis Database Rights that
apply to Your use of the Licensed Material:
a. for the avoidance of doubt, Section 2(a)(1) grants You the right
to extract, reuse, reproduce, and Share all or a substantial
portion of the contents of the database;
b. if You include all or a substantial portion of the database
contents in a database in which You have Sui Generis Database
Rights, then the database in which You have Sui Generis Database
Rights (but not its individual contents) is Adapted Material,
including for purposes of Section 3(b); and
c. You must comply with the conditions in Section 3(a) if You Share
all or a substantial portion of the contents of the database.
For the avoidance of doubt, this Section 4 supplements and does not
replace Your obligations under this Public License where the Licensed
Rights include other Copyright and Similar Rights.
Section 5 -- Disclaimer of Warranties and Limitation of Liability.
a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
c. The disclaimer of warranties and limitation of liability provided
above shall be interpreted in a manner that, to the extent
possible, most closely approximates an absolute disclaimer and
waiver of all liability.
Section 6 -- Term and Termination.
a. This Public License applies for the term of the Copyright and
Similar Rights licensed here. However, if You fail to comply with
this Public License, then Your rights under this Public License
terminate automatically.
b. Where Your right to use the Licensed Material has terminated under
Section 6(a), it reinstates:
1. automatically as of the date the violation is cured, provided
it is cured within 30 days of Your discovery of the
violation; or
2. upon express reinstatement by the Licensor.
For the avoidance of doubt, this Section 6(b) does not affect any
right the Licensor may have to seek remedies for Your violations
of this Public License.
c. For the avoidance of doubt, the Licensor may also offer the
Licensed Material under separate terms or conditions or stop
distributing the Licensed Material at any time; however, doing so
will not terminate this Public License.
d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
License.
Section 7 -- Other Terms and Conditions.
a. The Licensor shall not be bound by any additional or different
terms or conditions communicated by You unless expressly agreed.
b. Any arrangements, understandings, or agreements regarding the
Licensed Material not stated herein are separate from and
independent of the terms and conditions of this Public License.
Section 8 -- Interpretation.
a. For the avoidance of doubt, this Public License does not, and
shall not be interpreted to, reduce, limit, restrict, or impose
conditions on any use of the Licensed Material that could lawfully
be made without permission under this Public License.
b. To the extent possible, if any provision of this Public License is
deemed unenforceable, it shall be automatically reformed to the
minimum extent necessary to make it enforceable. If the provision
cannot be reformed, it shall be severed from this Public License
without affecting the enforceability of the remaining terms and
conditions.
c. No term or condition of this Public License will be waived and no
failure to comply consented to unless expressly agreed to by the
Licensor.
d. Nothing in this Public License constitutes or may be interpreted
as a limitation upon, or waiver of, any privileges and immunities
that apply to the Licensor or You, including from the legal
processes of any jurisdiction or authority.
=======================================================================
Creative Commons is not a party to its public
licenses. Notwithstanding, Creative Commons may elect to apply one of
its public licenses to material it publishes and in those instances
will be considered the โ€œLicensor.โ€ The text of the Creative Commons
public licenses is dedicated to the public domain under the CC0 Public
Domain Dedication. Except for the limited purpose of indicating that
material is shared under a Creative Commons public license or as
otherwise permitted by the Creative Commons policies published at
creativecommons.org/policies, Creative Commons does not authorize the
use of the trademark "Creative Commons" or any other trademark or logo
of Creative Commons without its prior written consent including,
without limitation, in connection with any unauthorized modifications
to any of its public licenses or any other arrangements,
understandings, or agreements concerning use of licensed material. For
the avoidance of doubt, this paragraph does not form part of the
public licenses.
Creative Commons may be contacted at creativecommons.org.

7
documentation/README.txt

@ -0,0 +1,7 @@
Run ./build-documentation.sh for html output in the /out directory.
.adoc is asciidoctor, not simple asciidoc.
This documentation is licensed under Creative Commons-BY-SA-4.0.
Please read the provided documentation/LICENSE file or visit
https://creativecommons.org/licenses/by-sa/4.0/legalcode

18
documentation/build-documentation.sh

@ -0,0 +1,18 @@
#!/bin/sh
#The documentation is built statically and does not belong to the normal build process with configure and make
#Its updating is part of the development process, not packaging and running.
#The correct out/ dir is already part of git.
set -e
asciidoctor index.adoc -o out/index.html
asciidoctor german.adoc -o out/german.html
cp overview-german.png out/overview-german.png
asciidoctor english.adoc -o out/english.html
cp overview-english.png out/overview-english.png
#cp *-quickstart*.mp4 out/
cp favicon.* out/

5
documentation/english.part.adoc

@ -0,0 +1,5 @@
== Usage
* Nothing
* To
* See
* Here

BIN
documentation/favicon.ico

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

BIN
documentation/favicon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 942 B

5
documentation/german.part.adoc

@ -0,0 +1,5 @@
== Bedienung
Hier gibt es nichts zu sehen.
* Weiter
* Gehen

37
documentation/index.adoc

@ -0,0 +1,37 @@
:Author: Laborejo Software Suite
:Version: 2.1.0
:iconfont-remote!:
:!webfonts:
////
This documentation is licensed under the Creative Commons Attribution-ShareAlike 4.0 International License.
To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/4.0/ or send a
letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
A copy of the license has been provided in the file documentation/LICENSE.
////
////
https://powerman.name/doc/asciidoc
https://asciidoctor.org/docs/user-manual/
////
:nofooter:
== Patroneo Multi-Language Documentation
image::logo.png["logo", 320, 180]
For program version 2.1.0
This site is part of the https://www.laborejo.org[Laborejo Software Suite]
Please choose a language
* link:english.html[English]
* link:german.html[Deutsch (German)]
Further Links
* https://laborejo.org/bugs/[Bug and Issues, and other Feedback]
* Write to info@laborejo.org for any comment or question.

45
documentation/manpageinclude.h2m

@ -0,0 +1,45 @@
[name]
Patroneo - Easy to use pattern based midi sequencer.
[usage]
Patroneo (which is Esperanto for "Pattern") is an easy to use, pattern based midi sequencer, a
program that sends digital "notes" to software instruments such as synthesizers and samplers.
Patroneo is primarily designed for educational purposes, where the main goal is to teach the
importance of patterns and repetitions in any kind of music. However, Patroneo is a full sequencer
you can use to create real music. The constraints it presents will more likely boost your
creativity than suppressing it.
You have tracks with one pattern each. Turn on steps in the pattern to play
musical notes. Switch the patterns on and off in a sequence to create a song structure.
Connect external synthesizers and samplers to create sounds.
[Reporting bugs]
https://www.laborejo.org/bugs
[copyright]
Patroneo 2.1.0 - Copyright 2021
Laborejo Software Suite
https://www.laborejo.org/
[examples]
Start patroneo through NSM, e.g. through Agordejo. This will take care of all
settings and save directories.
Other modes of operations, mostly for testing, are:
Run without session management and save in /tmp.
patroneo --save /tmp
Run without audio and midi. Skips all JACK checks. Used to just look at the GUI, e.g. to make screenshots
patroneo --mute
[see also]
The full documentation for Patroneo is maintained as a multi-lingual html site to your systems doc-dir.
For example:
xdg-open file:///usr/share/doc/patroneo/index.html
The documentation can also be found online https://www.laborejo.org/documentation/patroneo

64
documentation/readme.template

@ -0,0 +1,64 @@
[//]: # (Generated <date>. Changes belong into template/documentation/readme.template)
#<name>
Program version <version>
![Screenshot](https://git.laborejo.org/lss/<name>/raw/branch/master/documentation/screenshot.png "Screenshot")
<description>
This README is just a short introduction. Consult the manual (see below) for more information.
# Contact and Information
* Website https://www.laborejo.org
* Bugs and Issues: https://www.laborejo.org/bugs
* Git Repositories for all programs: https://git.laborejo.org
* Documentation and Manual https://www.laborejo.org/documentation/<shortname>
# Installation and Starting
## Download
### Release Version
If the latest release is not available through your package manger you can build it yourself:
Download the latest code release on https://www.laborejo.org/downloads and extract it.
### Git Version
It is possible to clone a git repository.
`git clone https://git.laborejo.org/lss/<shortname>.git`
## Dependencies
* Glibc
* Python 3.6 (maybe earlier)
* PyQt5 for Python 3
* DejaVu Sans Sarif TTF (Font) (recommended, but not technically necessary)
<dependencies>
#### Build Dependencies
* Bash
* GCC (development is done on 8.2, but most likely you can use a much earlier version)
### Environment:
* Jack Audio Connection Kit must be running
## Build and Install
./configure --prefix=/usr/local
make
sudo make install
## Starting
If you installed <name> through a packager manager or yourself simple use your application launcher
or terminal to start the executable `<shortname>`
You can also run <name> after extracting the release archive or cloning from git, without make or
installation. If you did so, for additional features please link tools/nsm-data to your executable PATH.
Use the manpage `man <shortname>` or run `<shortname> --help` (or local variant `./<shortname> --help` )
to see available command line parameters.

BIN
documentation/screenshot.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

30
engine/__init__.py

@ -0,0 +1,30 @@
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Copyright 2021, Nils Hilbricht, Germany ( https://www.hilbricht.net )
This file is part of the Laborejo Software Suite ( https://www.laborejo.org ),
This application is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
import logging; logger = logging.getLogger(__name__); logger.info("import")
#This file only exists as a reminder to _not_ create it again wrongly in the future.
#from .api import * #Do not star-import here!
#This leads to uncontrollable behaviour because importing _any_ file from engine will first import this init file, which would trigger the api to start its session.
#Instead use explicit import to get the api.
#No!: import engine.api as api #This loads the engine and starts a session.

65
engine/api.py

@ -0,0 +1,65 @@
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Copyright 2021, Nils Hilbricht, Germany ( https://www.hilbricht.net )
This file is part of the Laborejo Software Suite ( https://www.laborejo.org ),
This application is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
import logging; logger = logging.getLogger(__name__); logger.info("import")
#Standard Library Modules
from typing import List, Set, Dict, Tuple
#Third Party Modules
from calfbox import cbox
#Template Modules
import template.engine.api #we need direct access to the module to inject data in the provided structures. but we also need the functions directly. next line:
from template.engine.api import *
#New callbacks
class ClientCallbacks(Callbacks): #inherits from the templates api callbacks
def __init__(self):
super().__init__()
self.tempCallback = []
def _tempCallback(self):
"""Just for copy paste during development"""
export = session.data.export()
for func in self.tempCallback:
func(export)
callbacks._dataChanged()
#Inject our derived Callbacks into the parent module
template.engine.api.callbacks = ClientCallbacks()
from template.engine.api import callbacks
_templateStartEngine = startEngine
def startEngine(nsmClient):
_templateStartEngine(nsmClient) #loads save files or creates empty structure.
#Send initial Callbacks to create the first GUI state.
#The order of initial callbacks must not change to avoid GUI problems.
#For example it is important that the tracks get created first and only then the number of measures
logger.info("Sending initial callbacks to GUI")
callbacks._tempCallback()
logger.info("Tembro api startEngine complete")

63
engine/config.py

@ -0,0 +1,63 @@
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
#Do not change these during runtime!
METADATA={
#The pretty name of this program. Used for NSM display and Jack client name
#Can contain everything a linux file/path supports. Never change this or it will break the
#session, making your file unable to load and destroying saved Jack connections.
"name" : "Tembro",
#Set this to the name the user types into a terminal.
#MUST be the same as the binary name as well as the name in configure.
#Program reports that as proc title so you can killall it by name.
#Should not contain spaces or special characters. We use this as save file extension as well
#to distinguish between compatible program versions. In basic programs this will just be e.g.
#patroneo. But in complex programs with a bright future it will be "laborejo1" "laborejo2" etc.
"shortName" : "tembro",
#A very short description used in various places: Desktop file, overview on the website,
#release announcements, entries in software directories etc.
"tagline" : 'Sampled Software Instruments ',
"version" : "0.1.0",
"year" : "2021",
"author" : "Laborejo Software Suite",
"url" : "https://www.laborejo.org/tembro",
"supportedLanguages" : {"German":"de.qm"},
#Show the About Dialog the first time the program starts up. This is the initial state for a
#new instance in NSM, not the saved state! Decide on how annoying it would be for every new
#instance to show about. Fluajho does not show it because you add it many times into a session.
#Patroneo does because its only added once.
"showAboutDialogFirstStart" : False,
#If your program handles very small duration with n-tuplets you should increase D4.
#This will not be visible to the outside jack world
"quarterNoteInTicks" : 96,
#How many audio outputs do you want? must be pairs. These are just unconnected jack outputs
#that need to be connected internally to instrument outputs like fluidsynth
"cboxOutputs" : 2 * 4,
#Does the program uses a metronome? In this case you need at least two cboxOutputs above
"metronome" : False,
#Various strings for the README
#Extra whitespace will be stripped so we don't need to worry about docstring indentation
"description" : """
Tembro (which is Esperanto for musical "Timbre") is a virtual software instrument based on
samples. All instruments are permanently built-in, there is no option to load your own files.
New instruments are only added with new releases, old ones are never removed.
That makes Tembro reliable, predictable, portable and compatible.
All projects and all users have the same "instrument" with the same instrument sounds,
numbering system, midi controls etc.
Only "soft" settings, such as filters, can be changed dynamically and will be saved in your project.
""",
"dependencies" : "\n".join("* "+dep for dep in ()),
}

40
engine/main.py

@ -0,0 +1,40 @@
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Copyright 2021, Nils Hilbricht, Germany ( https://www.hilbricht.net )
This file is part of the Laborejo Software Suite ( https://www.laborejo.org ),
This application is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
import logging; logger = logging.getLogger(__name__); logger.info("import")
#Python Standard Lib
import os.path
#Third Party
from calfbox import cbox
#Template Modules
from template.engine.data import Data as TemplateData
from template.start import PATHS
class Data(TemplateData):
"""There must always be a Data class in a file main.py.
Simply inheriting from engine.data.Data is easiest.
"""
def __init__(self, parentSession): #Program start.
pass

0
qtgui/__init__.py

30
qtgui/constantsAndConfigs.py

@ -0,0 +1,30 @@
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Copyright 2021, Nils Hilbricht, Germany ( https://www.hilbricht.net )
This file is part of the Laborejo Software Suite ( https://www.laborejo.org ),
Laborejo2 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
import logging; logging.info("import {}".format(__file__))
from template.qtgui.constantsAndConfigs import ConstantsAndConfigs as TemplateConstantsAndConfigs
class ConstantsAndConfigs(TemplateConstantsAndConfigs):
def __init__(self):
super().__init__()
constantsAndConfigs = ConstantsAndConfigs() #singleton

93
qtgui/designer/mainwindow.py

@ -0,0 +1,93 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'mainwindow.ui'
#
# Created by: PyQt5 UI code generator 5.15.4
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(894, 836)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
self.verticalLayout = QtWidgets.QVBoxLayout(self.centralwidget)
self.verticalLayout.setObjectName("verticalLayout")
self.splitter_2 = QtWidgets.QSplitter(self.centralwidget)
self.splitter_2.setOrientation(QtCore.Qt.Horizontal)
self.splitter_2.setObjectName("splitter_2")
self.search_groupBox = QtWidgets.QGroupBox(self.splitter_2)
self.search_groupBox.setObjectName("search_groupBox")
self.verticalLayout_4 = QtWidgets.QVBoxLayout(self.search_groupBox)
self.verticalLayout_4.setContentsMargins(0, 0, 0, 0)
self.verticalLayout_4.setSpacing(0)
self.verticalLayout_4.setObjectName("verticalLayout_4")
self.search_listWidget = QtWidgets.QListWidget(self.search_groupBox)
self.search_listWidget.setObjectName("search_listWidget")
self.verticalLayout_4.addWidget(self.search_listWidget)
self.splitter = QtWidgets.QSplitter(self.splitter_2)
self.splitter.setOrientation(QtCore.Qt.Vertical)
self.splitter.setObjectName("splitter")
self.iinstruments_groupBox = QtWidgets.QGroupBox(self.splitter)
self.iinstruments_groupBox.setObjectName("iinstruments_groupBox")
self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.iinstruments_groupBox)
self.verticalLayout_2.setContentsMargins(0, 0, 0, 0)
self.verticalLayout_2.setSpacing(0)
self.verticalLayout_2.setObjectName("verticalLayout_2")
self.instruments_treeWidget = QtWidgets.QTreeWidget(self.iinstruments_groupBox)
self.instruments_treeWidget.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers)
self.instruments_treeWidget.setProperty("showDropIndicator", False)
self.instruments_treeWidget.setAlternatingRowColors(True)
self.instruments_treeWidget.setSelectionMode(QtWidgets.QAbstractItemView.NoSelection)
self.instruments_treeWidget.setVerticalScrollMode(QtWidgets.QAbstractItemView.ScrollPerPixel)
self.instruments_treeWidget.setHorizontalScrollMode(QtWidgets.QAbstractItemView.ScrollPerPixel)
self.instruments_treeWidget.setObjectName("instruments_treeWidget")
self.verticalLayout_2.addWidget(self.instruments_treeWidget)
self.details_groupBox = QtWidgets.QGroupBox(self.splitter)
self.details_groupBox.setObjectName("details_groupBox")
self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.details_groupBox)
self.verticalLayout_3.setContentsMargins(0, 0, 0, 0)
self.verticalLayout_3.setSpacing(0)
self.verticalLayout_3.setObjectName("verticalLayout_3")
self.details_scrollArea = QtWidgets.QScrollArea(self.details_groupBox)
self.details_scrollArea.setWidgetResizable(True)
self.details_scrollArea.setObjectName("details_scrollArea")
self.scrollAreaWidgetContents = QtWidgets.QWidget()
self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 428, 208))
self.scrollAreaWidgetContents.setObjectName("scrollAreaWidgetContents")
self.details_scrollArea.setWidget(self.scrollAreaWidgetContents)
self.verticalLayout_3.addWidget(self.details_scrollArea)
self.verticalLayout.addWidget(self.splitter_2)
MainWindow.setCentralWidget(self.centralwidget)
self.menubar = QtWidgets.QMenuBar(MainWindow)
self.menubar.setGeometry(QtCore.QRect(0, 0, 894, 20))
self.menubar.setObjectName("menubar")
MainWindow.setMenuBar(self.menubar)
self.statusbar = QtWidgets.QStatusBar(MainWindow)
self.statusbar.setObjectName("statusbar")
MainWindow.setStatusBar(self.statusbar)
self.actionRofl = QtWidgets.QAction(MainWindow)
self.actionRofl.setObjectName("actionRofl")
self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
self.search_groupBox.setTitle(_translate("MainWindow", "Search"))
self.iinstruments_groupBox.setTitle(_translate("MainWindow", "Instruments"))
self.instruments_treeWidget.headerItem().setText(0, _translate("MainWindow", " "))
self.instruments_treeWidget.headerItem().setText(1, _translate("MainWindow", "ID"))
self.instruments_treeWidget.headerItem().setText(2, _translate("MainWindow", "Name"))
self.instruments_treeWidget.headerItem().setText(3, _translate("MainWindow", "Version"))
self.instruments_treeWidget.headerItem().setText(4, _translate("MainWindow", "Vendor"))
self.instruments_treeWidget.headerItem().setText(5, _translate("MainWindow", "Logo"))
self.details_groupBox.setTitle(_translate("MainWindow", "NamePlaceholder"))
self.actionRofl.setText(_translate("MainWindow", "Rofl!"))

189
qtgui/designer/mainwindow.ui

@ -0,0 +1,189 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>894</width>
<height>836</height>
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QSplitter" name="splitter_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<widget class="QGroupBox" name="search_groupBox">
<property name="title">
<string>Search</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QListWidget" name="search_listWidget"/>
</item>
</layout>
</widget>
<widget class="QSplitter" name="splitter">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<widget class="QGroupBox" name="iinstruments_groupBox">
<property name="title">
<string>Instruments</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QTreeWidget" name="instruments_treeWidget">
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="showDropIndicator" stdset="0">
<bool>false</bool>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::NoSelection</enum>
</property>
<property name="verticalScrollMode">
<enum>QAbstractItemView::ScrollPerPixel</enum>
</property>
<property name="horizontalScrollMode">
<enum>QAbstractItemView::ScrollPerPixel</enum>
</property>
<column>
<property name="text">
<string> </string>
</property>
</column>
<column>
<property name="text">
<string>ID</string>
</property>
</column>
<column>
<property name="text">
<string>Name</string>
</property>
</column>
<column>
<property name="text">
<string>Version</string>
</property>
</column>
<column>
<property name="text">
<string>Vendor</string>
</property>
</column>
<column>
<property name="text">
<string>Logo</string>
</property>
</column>
</widget>
</item>
</layout>
</widget>
<widget class="QGroupBox" name="details_groupBox">
<property name="title">
<string>NamePlaceholder</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QScrollArea" name="details_scrollArea">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>428</width>
<height>208</height>
</rect>
</property>
</widget>
</widget>
</item>
</layout>
</widget>
</widget>
</widget>
</item>
</layout>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>894</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QStatusBar" name="statusbar"/>
<action name="actionRofl">
<property name="text">
<string>Rofl!</string>
</property>
</action>
</widget>
<resources/>
<connections/>
</ui>

165
qtgui/instrument.py

@ -0,0 +1,165 @@
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Copyright 2021, Nils Hilbricht, Germany ( https://www.hilbricht.net )
This file is part of the Laborejo Software Suite ( https://www.laborejo.org ),
This application is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
import logging; logger = logging.getLogger(__name__); logger.info("import")
#Standard Library
#Third Party
from PyQt5 import QtCore, QtGui, QtWidgets
#Our Qt
from template.qtgui.helper import ToggleSwitch
#Engine
import engine.api as api
class InstrumentTreeController(object):
"""Not a qt class. We externally controls the QTreeWidget
Why is this not a QTableWidget? As in Agordejo, a TableWidget is a complex item, and inconvenient
to use. You need to add an Item to each cell. While in TreeWidget you just create one item.
And we might use the TreeView to group by manufacturer etc. Eventhough we have a Filter.
"""
def __init__(self, parentMainWindow):
self.parentMainWindow = parentMainWindow
self.treeWidget = self.parentMainWindow.ui.instruments_treeWidget
self.sortByColumnValue = 1 #by instrId
self.sortDescendingValue = 0 # Qt::SortOrder which is 0 for ascending and 1 for descending
self._testData()
def newInstrument(self, instrumentDict):
gi = GuiInstrument(parentTreeController=self, instrumentDict=instrumentDict)
self.treeWidget.addTopLevelItem(gi)
gi.injectToggleSwitch() #only possible after gi.init was done and item inserted.
self._adjustColumnSize()
def _testData(self):
exampleInstrumentDict1 = {
"instrId" : 123,
"state": False,
"prettyName" : "My Instrument 2000",
"vendor" : "Nils Productions",
"version" : "1.0.3",
"logo" : None,
}
exampleInstrumentDict2 = {
"instrId" : 124,
"state": False,
"prettyName" : "Untuned Guitar",
"vendor" : "Merle Instrument Design",
"version" : "0.4.1",
"logo" : None,
}
self.newInstrument(exampleInstrumentDict1)
self.newInstrument(exampleInstrumentDict2)
def _adjustColumnSize(self):
self.treeWidget.sortItems(self.sortByColumnValue, self.sortDescendingValue)
for index in range(self.treeWidget.columnCount()):
self.treeWidget.resizeColumnToContents(index)
class GuiInstrument(QtWidgets.QTreeWidgetItem):
"""
Why is this not a QTableWidget? As in Agordejo, a TableWidget is a complex item, and inconvenient
to use. You need to add an Item to each cell. While in TreeWidget you just create one item.
All data is received at program start. No new items will be created, none will get deleted.
All instruments in Tembro are static.
By default all instruments are switched off. The user can switch them on/off here or
a loaded save state will send the state on program start.
Most parameters we receive are read only, like instrId, prettyName and version"""
allItems = {} # instrId : GuiInstrument
def __init__(self, parentTreeController, instrumentDict):
GuiInstrument.allItems[instrumentDict["instrId"]] = self
self.parentTreeController = parentTreeController
#Start with empty columns. We fill in later in _writeColumns
super().__init__([], type=1000) #type 0 is default qt type. 1000 is subclassed user type)
self.columns = ("state" , "instrId", "prettyName", "version", "vendor", "logo") #Same keys as instrumentDict. Keep in sync manually with Qt Designer. All code must use this, never number directly.
#Use with:
#nameColumnIndex = self.columns.index("prettyName")
#self.setText(nameColumnIndex, "hello")
self.state = None #by self.switch()
self.instrumentDict = None
self._writeColumns(instrumentDict)
self.toggleSwitch = ToggleSwitch()
self.toggleSwitch.setAutoFillBackground(True) #otherwise conflicts with setItemWidget
self.toggleSwitch.toggled.connect(lambda c: print('toggled', c))
self.toggleSwitch.clicked.connect(lambda c: print('clicked', c))
self.toggleSwitch.pressed.connect(lambda: print('pressed'))
self.toggleSwitch.released.connect(lambda: print('released'))
#We cannot add the ToggleSwitch Widget here.
#It must be inserted after self was added to the Tree. Use self.injectToggleSwitch from parent
def injectToggleSwitch(self):
"""Call this after the item was added to the tree"""
stateColumnIndex = self.columns.index("state")
self.parentTreeController.treeWidget.setItemWidget(self, stateColumnIndex, self.toggleSwitch)
def _writeColumns(self, instrumentDict):
self.instrumentDict = instrumentDict
for index, key in enumerate(self.columns):
value = instrumentDict[key]
QtCore.QCoreApplication.translate("OpenSession", "not saved")
if type(instrumentDict[key]) is str or key == "instrId":
self.setText(index, str(instrumentDict[key]))
elif key == "logo":
pass
elif key == "state": #use parameter for initial value. loaded from file or default = False.
state = instrumentDict[key]
assert type(state) is bool, state
self.switch(state)
def switch(self, state:bool):
"""This is not the Qt function but if an instrument is enabled, loaded to RAM and ready to
receive midi data.
Function will mimic Qt disabled behaviour by greying things out and deactivating individual
sub-widgets. But some, like the GUI switch itself, will always stay enabled."""
self.state = state
def toggleSwitchState(self):
self.switch(not self.state)

85
qtgui/mainwindow.py

@ -0,0 +1,85 @@
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Copyright 2021, Nils Hilbricht, Germany ( https://www.hilbricht.net )
This file is part of the Laborejo Software Suite ( https://www.laborejo.org ),
This application is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
import logging; logging.info("import {}".format(__file__))
#Standard Library Modules
import os.path
#Third Party Modules
from PyQt5 import QtWidgets, QtCore, QtGui
#Template Modules
from template.qtgui.mainwindow import MainWindow as TemplateMainWindow
from template.qtgui.menu import Menu
from template.qtgui.about import About
#Our modules
import engine.api as api
from .instrument import InstrumentTreeController
class MainWindow(TemplateMainWindow):
def __init__(self):
"""The order of calls is very important.
The split ploint is calling the super.__init. Some functions need to be called before,
some after.
For example:
The about dialog is created in the template main window init. So we need to set additional
help texts before that init.
"""
#Inject more help texts in the templates About "Did You Know" field.
#About.didYouKnow is a class variable.
#Make the first three words matter!
#Do not start them all with "You can..." or "...that you can", in response to the Did you know? title.
#We use injection into the class and not a parameter because this dialog gets shown by creating an object. We can't give the parameters when this is shown via the mainWindow menu.
About.didYouKnow = [
QtCore.QCoreApplication.translate("About", "There is no way to load your own instruments into this program. If you create your own instruments and would like them to be included please contact the developers for a collaboration.")
] + About.didYouKnow
super().__init__()
#make the search bar smaller
self.ui.search_groupBox.setMinimumSize(30, 1)
self.ui.splitter_2.setSizes([1,1])
self.setupMenu()