Skip to content

Commit

Permalink
Fix an absolute ton of import errors
Browse files Browse the repository at this point in the history
  • Loading branch information
MaddyGuthridge committed Jul 30, 2023
1 parent 5c3d019 commit 4b1870b
Show file tree
Hide file tree
Showing 12 changed files with 34 additions and 28 deletions.
6 changes: 3 additions & 3 deletions src/common/param.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"""
import plugins

from common.plug_indexes.fl_index import PluginIndex
from common.plug_indexes import PluginIndex
from abc import abstractmethod


Expand All @@ -29,8 +29,8 @@ def __init__(self, index: PluginIndex) -> None:
"""
...

@abstractmethod
@property
@abstractmethod
def value(self) -> float:
"""
The value of the parameter (read/write)
Expand All @@ -42,8 +42,8 @@ def value(self) -> float:
def value(self, newValue: float):
...

@abstractmethod
@property
@abstractmethod
def name(self) -> str:
"""
The name of the parameter
Expand Down
3 changes: 2 additions & 1 deletion src/common/plug_indexes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
]


from .fl_index import FlIndex, PluginIndex
from .fl_index import FlIndex
from .plugin import PluginIndex
from .window import WindowIndex
from .generator import GeneratorIndex
from .effect import EffectIndex
6 changes: 3 additions & 3 deletions src/common/plug_indexes/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@


class PluginIndex(FlIndex):
@abstractmethod
@property
@abstractmethod
def index(self) -> int:
"""
The primary index of this plugin.
Expand All @@ -19,16 +19,16 @@ def index(self) -> int:
"""
...

@abstractmethod
@property
@abstractmethod
def slotIndex(self) -> int:
"""
The slot index for effects. `-1` for generators.
"""
...

@abstractmethod
@property
@abstractmethod
def track(self) -> AbstractTrack:
"""
The track or channel underlying this function.
Expand Down
10 changes: 5 additions & 5 deletions src/common/tracks/abstract.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ class AbstractTrack:
Allows for their properties to be get/set in a simplified manner
"""
@abstractmethod
@property
@abstractmethod
def index(self) -> int:
"""
Index of the track
"""

@abstractmethod
@property
@abstractmethod
def color(self) -> Color:
"""
Color of the track
Expand All @@ -28,8 +28,8 @@ def color(self) -> Color:
def color(self, new_color: Color) -> None:
...

@abstractmethod
@property
@abstractmethod
def name(self) -> str:
"""
Name of the track. Note that this isn't necessarily the same as the
Expand All @@ -41,8 +41,8 @@ def name(self) -> str:
def name(self, new_name: str) -> None:
...

@abstractmethod
@property
@abstractmethod
def mute(self) -> bool:
"""
Whether the track is muted
Expand All @@ -58,8 +58,8 @@ def muteToggle(self) -> None:
"""
self.mute = not self.mute

@abstractmethod
@property
@abstractmethod
def solo(self) -> bool:
"""
Whether the track is solo
Expand Down
23 changes: 14 additions & 9 deletions src/common/util/api_fixes.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,20 @@
import playlist

from common.profiler import profilerDecoration
from common.plug_indexes import (
WindowIndex,
PluginIndex,
GeneratorIndex,
EffectIndex,
)
from typing import Optional
from typing import Optional, TYPE_CHECKING


if TYPE_CHECKING:
from common.plug_indexes import (
WindowIndex,
PluginIndex,
GeneratorIndex,
EffectIndex,
)


@profilerDecoration("getFocusedPluginIndex")
def getFocusedPluginIndex(force: bool = False) -> Optional[PluginIndex]:
def getFocusedPluginIndex(force: bool = False) -> Optional['PluginIndex']:
"""
Fixes the horrible ui.getFocusedFormIndex() function
Expand All @@ -44,6 +47,7 @@ def getFocusedPluginIndex(force: bool = False) -> Optional[PluginIndex]:
* `int`: grouped index of a channel rack plugin if one is focused
* `int, int`: index of a mixer plugin if one is focused
"""
from common.plug_indexes import GeneratorIndex, EffectIndex
# If a mixer plugin is focused
if ui.getFocused(6):
form_id = ui.getFocusedFormID()
Expand All @@ -69,14 +73,15 @@ def getFocusedPluginIndex(force: bool = False) -> Optional[PluginIndex]:


@profilerDecoration("getFocusedWindowIndex")
def getFocusedWindowIndex() -> Optional[WindowIndex]:
def getFocusedWindowIndex() -> Optional['WindowIndex']:
"""
Fixes the horrible ui.getFocused() function
Returns:
* `None`: if no window is focused
* `int`: index of window
"""
from common.plug_indexes import WindowIndex
for i in range(5):
if ui.getFocused(i):
return WindowIndex(i)
Expand Down
2 changes: 1 addition & 1 deletion src/plugs/mapping_strategies/mod_xy.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"""

from common.param import Param, PluginParameter
from common.util.api_fixes import PluginIndex
from common.plug_indexes import PluginIndex
from control_surfaces import ModX, ModY
from control_surfaces import ControlShadow, ControlShadowEvent
from devices.device_shadow import DeviceShadow
Expand Down
2 changes: 1 addition & 1 deletion src/plugs/mapping_strategies/pedal_strategy.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from typing import Any
from common.consts import PARAM_CC_START
from common.param import Param
from common.util.api_fixes import PluginIndex
from common.plug_indexes import PluginIndex
from control_surfaces.controls.pedal import (
Pedal,
SustainPedal,
Expand Down
2 changes: 1 addition & 1 deletion src/plugs/mapping_strategies/preset_navigation.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
plugs > mapping_strategies > preset_navigation
"""
from common.util.api_fixes import PluginIndex
from common.plug_indexes import PluginIndex
from control_surfaces import (
DirectionNext,
DirectionPrevious,
Expand Down
2 changes: 1 addition & 1 deletion src/plugs/mapping_strategies/simple_faders.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from control_surfaces import ControlShadowEvent, ControlShadow, Fader
from devices.device_shadow import DeviceShadow
from plugs.event_filters import toPluginIndex
from common.util.api_fixes import PluginIndex
from common.plug_indexes import PluginIndex
from . import IMappingStrategy

DEFAULT_COLOR = Color.fromInteger(0x222222)
Expand Down
2 changes: 1 addition & 1 deletion src/plugs/mapping_strategies/wheel_strategy.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from typing import Any
from common.consts import PARAM_CC_START
from common.param import Param
from common.util.api_fixes import PluginIndex, GeneratorIndex
from common.plug_indexes import PluginIndex, GeneratorIndex

from control_surfaces import ModWheel, PitchWheel
from control_surfaces import ControlShadowEvent
Expand Down
2 changes: 1 addition & 1 deletion src/plugs/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from typing import final
from common import log, verbosity
from common.util.abstract_method_error import AbstractMethodError
from common.plug_indexes.fl_index import WindowIndex, FlIndex
from common.plug_indexes import WindowIndex, FlIndex
from control_surfaces import ControlEvent
from devices import DeviceShadow
from plugs.mapping_strategies import IMappingStrategy
Expand Down
2 changes: 1 addition & 1 deletion src/plugs/windows/mixer.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from common.tracks.mixer_track import MixerTrack
from common.types import Color
from common.extension_manager import ExtensionManager
from common.plug_indexes.fl_index import WindowIndex
from common.plug_indexes import WindowIndex
from common.util.api_fixes import (
getSelectedDockMixerTracks,
getMixerDockSides,
Expand Down

0 comments on commit 4b1870b

Please sign in to comment.