Skip to content

Commit

Permalink
Closes #305: Read monster type names from ROM
Browse files Browse the repository at this point in the history
  • Loading branch information
theCapypara committed Jul 16, 2021
1 parent 35364c7 commit 31baf19
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion skytemple/module/monster/controller/monster.py
Expand Up @@ -868,7 +868,7 @@ def _init_stores(self):
# Genders
self._comboxbox_for_enum(['cb_gender'], Gender)
# Types
self._comboxbox_for_enum(['cb_type_primary', 'cb_type_secondary'], PokeType)
self._comboxbox_for_enum_with_strings(['cb_type_primary', 'cb_type_secondary'], PokeType, StringType.TYPE_NAMES)
# Movement Types
self._comboxbox_for_enum(['cb_movement_type'], MovementType)
# IQ Groups
Expand Down Expand Up @@ -969,6 +969,13 @@ def _comboxbox_for_enum(self, names: List[str], enum: Type[Enum], sort_by_name =
for name in names:
self._fast_set_comboxbox_store(self.builder.get_object(name), store, 1)

def _comboxbox_for_enum_with_strings(self, names: List[str], enum: Type[Enum], string_type: StringType):
store = Gtk.ListStore(int, str) # id, name
for entry in enum:
store.append([entry.value, self._string_provider.get_value(string_type, entry.value)])
for name in names:
self._fast_set_comboxbox_store(self.builder.get_object(name), store, 1)

@staticmethod
def _fast_set_comboxbox_store(cb: Gtk.ComboBox, store: Gtk.ListStore, col):
cb.set_model(store)
Expand Down

0 comments on commit 31baf19

Please sign in to comment.