-
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from MiguelGuthridge/v0.5.0
Release Version 0.5.0
- Loading branch information
Showing
146 changed files
with
4,165 additions
and
1,221 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[flake8] | ||
exclude = .git,__pycache__,.venv,.env,old,build,dist | ||
; max-complexity = 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,38 @@ | ||
""" | ||
common | ||
Contains common functions and code required to initialise and manage the script. | ||
Contains common functions and code required to initialise and manage the | ||
script. | ||
Authors: | ||
* Miguel Guthridge [[email protected], HDSQ#2154] | ||
""" | ||
|
||
# Check minimum version | ||
import general | ||
from . import consts | ||
if general.getVersion() < consts.MIN_API_VERSION: | ||
# raise RuntimeError( | ||
# f"Your FL Studio version is out of date: expected API " | ||
# f"v{consts.MIN_API_VERSION}, got {general.getVersion()}" | ||
# ) | ||
pass | ||
del general | ||
__all__ = [ | ||
'getVersionString', | ||
'exceptions', | ||
'log', | ||
'verbosity', | ||
'ProfilerContext', | ||
'profilerDecoration', | ||
'getContext', | ||
'resetContext', | ||
'unsafeResetContext', | ||
'catchContextResetException', | ||
'ExtensionManager', | ||
] | ||
|
||
from .consts import getVersionString | ||
|
||
from . import exceptions | ||
from .logger import log, verbosity | ||
from .profiler import ProfilerContext, profilerDecoration | ||
|
||
from .contextmanager import getContext, resetContext, catchContextResetException | ||
|
||
from .eventpattern import BasicPattern, IEventPattern | ||
|
||
from . import util | ||
|
||
from .types import EventData, Color | ||
from .contextmanager import ( | ||
getContext, | ||
resetContext, | ||
unsafeResetContext, | ||
catchContextResetException | ||
) | ||
|
||
from .extensionmanager import ExtensionManager |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
""" | ||
common > activitystate | ||
Contains the definition for the ActivityState class which manages what plugin or | ||
window should be active. | ||
Contains the definition for the ActivityState class which manages what plugin | ||
or window should be active. | ||
Authors: | ||
* Miguel Guthridge [[email protected], HDSQ#2154] | ||
|
@@ -18,10 +18,12 @@ | |
) | ||
from common.util.apifixes import getFocusedPluginIndex, getFocusedWindowIndex | ||
|
||
|
||
class ActivityState: | ||
""" | ||
Maintains the currently selected plugin or window | ||
""" | ||
|
||
def __init__(self) -> None: | ||
""" | ||
Create an ActivityState object | ||
|
@@ -54,16 +56,20 @@ def _forcePlugUpdate(self) -> None: | |
plugin = getFocusedPluginIndex(force=True) | ||
if plugin is None: | ||
if not self._plug_unsafe: | ||
log("state.active", "Using plugin not from selected channel rack group", verbosity.WARNING) | ||
log( | ||
"state.active", | ||
"Using plugin not from selected channel rack group", | ||
verbosity.WARNING | ||
) | ||
self._plug_unsafe = True | ||
self._plugin = (-1,) | ||
self._generator = (-1,) | ||
return | ||
self._plugin = plugin | ||
if len(plugin) == 1: | ||
self._generator = plugin # type: ignore | ||
self._generator = plugin # type: ignore | ||
else: | ||
self._effect = plugin # type: ignore | ||
self._effect = plugin # type: ignore | ||
|
||
def tick(self) -> None: | ||
""" | ||
|
@@ -77,19 +83,24 @@ def tick(self) -> None: | |
self._changed = True | ||
self._window = window | ||
if not self._split: | ||
if self._plug_active: | ||
self._changed = True | ||
self._plug_active = False | ||
self._forcePlugUpdate() | ||
elif (plugin := getFocusedPluginIndex()) is not None: | ||
self._plug_unsafe = False | ||
if plugin != self._plugin: | ||
self._changed = True | ||
self._plugin = plugin | ||
# Ignore typing because len(plugin) doesn't narrow types in mypy | ||
# Ignore typing because len(plugin) doesn't narrow types in | ||
# mypy | ||
if len(plugin) == 1: | ||
self._generator = plugin # type: ignore | ||
self._generator = plugin # type: ignore | ||
else: | ||
self._effect = plugin # type: ignore | ||
self._effect = plugin # type: ignore | ||
if not self._split: | ||
if not self._plug_active: | ||
self._changed = True | ||
self._plug_active = True | ||
else: | ||
self._forcePlugUpdate() | ||
|
@@ -153,8 +164,8 @@ def playPause(self, value: bool = None) -> bool: | |
Pause or resume updating the active plugin | ||
### Args: | ||
* `value` (`bool`, optional): Whether the updating should happen or not. | ||
Defaults to `None` (toggle). | ||
* `value` (`bool`, optional): Whether the updating should happen or | ||
not. Defaults to `None` (toggle). | ||
### Returns: | ||
* `bool`: whether updating will happen | ||
|
@@ -187,7 +198,8 @@ def toggleWindowsPlugins(self, value: bool = None) -> bool: | |
### Args: | ||
* `value` (`bool`, optional): whether the active plugin should be a | ||
plugin (True) or a window (False), or toggled (None). Defaults to `None`. | ||
plugin (True) or a window (False), or toggled (None). Defaults to | ||
`None`. | ||
### Raises: | ||
* `ValueError`: setSplitWindowsPlugins() hasn't been called | ||
|
@@ -200,5 +212,6 @@ def toggleWindowsPlugins(self, value: bool = None) -> bool: | |
"they are being addressed independently") | ||
else: | ||
self._changed = True | ||
self._plug_active = not self._plug_active if value is None else value | ||
self._plug_active = \ | ||
not self._plug_active if value is None else value | ||
return self._plug_active |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.