1
1
from enum import Enum , auto
2
2
from typing import Optional , Callable , List , Iterable
3
3
4
- from Utils import local_path , is_windows
4
+ from Utils import local_path
5
5
6
6
7
7
class Type (Enum ):
8
8
TOOL = auto ()
9
- FUNC = auto () # not a real component
9
+ MISC = auto ()
10
10
CLIENT = auto ()
11
11
ADJUSTER = auto ()
12
+ FUNC = auto () # do not use anymore
13
+ HIDDEN = auto ()
12
14
13
15
14
16
class Component :
15
17
display_name : str
16
- type : Optional [ Type ]
18
+ type : Type
17
19
script_name : Optional [str ]
18
20
frozen_name : Optional [str ]
19
21
icon : str # just the name, no suffix
@@ -22,18 +24,21 @@ class Component:
22
24
file_identifier : Optional [Callable [[str ], bool ]]
23
25
24
26
def __init__ (self , display_name : str , script_name : Optional [str ] = None , frozen_name : Optional [str ] = None ,
25
- cli : bool = False , icon : str = 'icon' , component_type : Type = None , func : Optional [Callable ] = None ,
26
- file_identifier : Optional [Callable [[str ], bool ]] = None ):
27
+ cli : bool = False , icon : str = 'icon' , component_type : Optional [Type ] = None ,
28
+ func : Optional [ Callable ] = None , file_identifier : Optional [Callable [[str ], bool ]] = None ):
27
29
self .display_name = display_name
28
30
self .script_name = script_name
29
31
self .frozen_name = frozen_name or f'Archipelago{ script_name } ' if script_name else None
30
32
self .icon = icon
31
33
self .cli = cli
32
- self .type = component_type or \
33
- None if not display_name else \
34
- Type .FUNC if func else \
35
- Type .CLIENT if 'Client' in display_name else \
36
- Type .ADJUSTER if 'Adjuster' in display_name else Type .TOOL
34
+ if component_type == Type .FUNC :
35
+ from Utils import deprecate
36
+ deprecate (f"Launcher Component { self .display_name } is using Type.FUNC Type, which is pending removal." )
37
+ component_type = Type .MISC
38
+
39
+ self .type = component_type or (
40
+ Type .CLIENT if "Client" in display_name else
41
+ Type .ADJUSTER if "Adjuster" in display_name else Type .MISC )
37
42
self .func = func
38
43
self .file_identifier = file_identifier
39
44
@@ -60,7 +65,7 @@ def __call__(self, path: str):
60
65
61
66
components : List [Component ] = [
62
67
# Launcher
63
- Component ('' , 'Launcher' ),
68
+ Component ('Launcher ' , 'Launcher' , component_type = Type . HIDDEN ),
64
69
# Core
65
70
Component ('Host' , 'MultiServer' , 'ArchipelagoServer' , cli = True ,
66
71
file_identifier = SuffixIdentifier ('.archipelago' , '.zip' )),
0 commit comments