mirror of
https://github.com/RYDE-WORK/ballistica.git
synced 2026-02-06 07:23:37 +08:00
Merge pull request #718 from vishal332008/master
Fixing a bug related to Plugin File Names.
This commit is contained in:
commit
ff819aff9d
@ -3,6 +3,7 @@
|
|||||||
"""Utility snippets applying to generic Python code."""
|
"""Utility snippets applying to generic Python code."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import sys
|
||||||
import types
|
import types
|
||||||
import weakref
|
import weakref
|
||||||
import random
|
import random
|
||||||
@ -66,7 +67,10 @@ def existing(obj: ExistableT | None) -> ExistableT | None:
|
|||||||
return obj if obj is not None and obj.exists() else None
|
return obj if obj is not None and obj.exists() else None
|
||||||
|
|
||||||
|
|
||||||
def getclass(name: str, subclassof: type[T]) -> type[T]:
|
def getclass(name: str,
|
||||||
|
subclassof: type[T],
|
||||||
|
check_sdlib_modulename_clash: bool = False
|
||||||
|
) -> type[T]:
|
||||||
"""Given a full class name such as foo.bar.MyClass, return the class.
|
"""Given a full class name such as foo.bar.MyClass, return the class.
|
||||||
|
|
||||||
Category: **General Utility Functions**
|
Category: **General Utility Functions**
|
||||||
@ -79,6 +83,8 @@ def getclass(name: str, subclassof: type[T]) -> type[T]:
|
|||||||
splits = name.split('.')
|
splits = name.split('.')
|
||||||
modulename = '.'.join(splits[:-1])
|
modulename = '.'.join(splits[:-1])
|
||||||
classname = splits[-1]
|
classname = splits[-1]
|
||||||
|
if modulename in sys.stdlib_module_names and check_sdlib_modulename_clash:
|
||||||
|
raise Exception(f'{modulename} is an inbuilt module.')
|
||||||
module = importlib.import_module(modulename)
|
module = importlib.import_module(modulename)
|
||||||
cls: type = getattr(module, classname)
|
cls: type = getattr(module, classname)
|
||||||
|
|
||||||
|
|||||||
@ -278,7 +278,7 @@ class PluginSpec:
|
|||||||
if not self.loadable:
|
if not self.loadable:
|
||||||
return None
|
return None
|
||||||
try:
|
try:
|
||||||
cls = getclass(self.class_path, Plugin)
|
cls = getclass(self.class_path, Plugin, True)
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
_babase.getsimplesound('error').play()
|
_babase.getsimplesound('error').play()
|
||||||
_babase.screenmessage(
|
_babase.screenmessage(
|
||||||
|
|||||||
@ -400,7 +400,7 @@ class PlaylistCustomizeBrowserWindow(bui.Window):
|
|||||||
txtw = bui.textwidget(
|
txtw = bui.textwidget(
|
||||||
parent=self._columnwidget,
|
parent=self._columnwidget,
|
||||||
size=(self._width - 40, 30),
|
size=(self._width - 40, 30),
|
||||||
maxwidth=self._width - 110,
|
maxwidth=440,
|
||||||
text=self._get_playlist_display_name(pname),
|
text=self._get_playlist_display_name(pname),
|
||||||
h_align='left',
|
h_align='left',
|
||||||
v_align='center',
|
v_align='center',
|
||||||
|
|||||||
@ -122,6 +122,7 @@ class PlaylistEditWindow(bui.Window):
|
|||||||
h_align='left',
|
h_align='left',
|
||||||
v_align='center',
|
v_align='center',
|
||||||
max_chars=40,
|
max_chars=40,
|
||||||
|
maxwidth=380,
|
||||||
autoselect=True,
|
autoselect=True,
|
||||||
color=(0.9, 0.9, 0.9, 1.0),
|
color=(0.9, 0.9, 0.9, 1.0),
|
||||||
description=bui.Lstr(resource=f'{self._r}.listNameText'),
|
description=bui.Lstr(resource=f'{self._r}.listNameText'),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user