mirror of
https://github.com/RYDE-WORK/ballistica.git
synced 2026-01-26 00:47:10 +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."""
|
||||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
import types
|
||||
import weakref
|
||||
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
|
||||
|
||||
|
||||
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.
|
||||
|
||||
Category: **General Utility Functions**
|
||||
@ -79,6 +83,8 @@ def getclass(name: str, subclassof: type[T]) -> type[T]:
|
||||
splits = name.split('.')
|
||||
modulename = '.'.join(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)
|
||||
cls: type = getattr(module, classname)
|
||||
|
||||
|
||||
@ -278,7 +278,7 @@ class PluginSpec:
|
||||
if not self.loadable:
|
||||
return None
|
||||
try:
|
||||
cls = getclass(self.class_path, Plugin)
|
||||
cls = getclass(self.class_path, Plugin, True)
|
||||
except Exception as exc:
|
||||
_babase.getsimplesound('error').play()
|
||||
_babase.screenmessage(
|
||||
|
||||
@ -400,7 +400,7 @@ class PlaylistCustomizeBrowserWindow(bui.Window):
|
||||
txtw = bui.textwidget(
|
||||
parent=self._columnwidget,
|
||||
size=(self._width - 40, 30),
|
||||
maxwidth=self._width - 110,
|
||||
maxwidth=440,
|
||||
text=self._get_playlist_display_name(pname),
|
||||
h_align='left',
|
||||
v_align='center',
|
||||
|
||||
@ -122,6 +122,7 @@ class PlaylistEditWindow(bui.Window):
|
||||
h_align='left',
|
||||
v_align='center',
|
||||
max_chars=40,
|
||||
maxwidth=380,
|
||||
autoselect=True,
|
||||
color=(0.9, 0.9, 0.9, 1.0),
|
||||
description=bui.Lstr(resource=f'{self._r}.listNameText'),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user