mirror of
https://github.com/MarioSpore/Grinch-AP.git
synced 2025-10-21 12:11:33 -06:00
Options: various fixes to get_option_name falsely giving get_current_option_name instead.
This commit is contained in:
10
Options.py
10
Options.py
@@ -181,6 +181,8 @@ class Choice(Option):
|
||||
return other != self.value
|
||||
elif isinstance(other, bool):
|
||||
return other != bool(self.value)
|
||||
elif other is None:
|
||||
return False
|
||||
else:
|
||||
raise TypeError(f"Can't compare {self.__class__.__name__} with {other.__class__.__name__}")
|
||||
|
||||
@@ -217,7 +219,7 @@ class Range(Option, int):
|
||||
return cls.from_text(str(data))
|
||||
|
||||
def get_option_name(self, value):
|
||||
return str(self.value)
|
||||
return str(value)
|
||||
|
||||
def __str__(self):
|
||||
return str(self.value)
|
||||
@@ -256,7 +258,7 @@ class OptionDict(Option):
|
||||
raise NotImplementedError(f"Cannot Convert from non-dictionary, got {type(data)}")
|
||||
|
||||
def get_option_name(self, value):
|
||||
return ", ".join(f"{key}: {value}" for key, value in self.value.items())
|
||||
return ", ".join(f"{key}: {v}" for key, v in value.items())
|
||||
|
||||
def __contains__(self, item):
|
||||
return item in self.value
|
||||
@@ -282,7 +284,7 @@ class OptionList(Option):
|
||||
return cls.from_text(str(data))
|
||||
|
||||
def get_option_name(self, value):
|
||||
return ", ".join(self.value)
|
||||
return ", ".join(value)
|
||||
|
||||
def __contains__(self, item):
|
||||
return item in self.value
|
||||
@@ -310,7 +312,7 @@ class OptionSet(Option):
|
||||
return cls.from_text(str(data))
|
||||
|
||||
def get_option_name(self, value):
|
||||
return ", ".join(self.value)
|
||||
return ", ".join(value)
|
||||
|
||||
def __contains__(self, item):
|
||||
return item in self.value
|
||||
|
Reference in New Issue
Block a user