Ejemplo n.º 1
0
 def GetAny(self) -> Optional[Any]:
     """Return the value currently selected in the form before it was converted to a string"""
     log.warning(
         "SimpleChoiceAny.GetAny is being depreciated and will be removed in the future. Please use SimpleChoiceAny.GetCurrentObject instead",
         exc_info=True,
     )
     return self.GetCurrentObject()
Ejemplo n.º 2
0
 def _reload_operation_loader(self, evt):
     operation_path = self._operation_choice.GetCurrentObject()
     if operation_path:
         operation_loader, success = self._operations[operation_path].reload()
         if success:
             self._operations[operation_path] = operation_loader
         else:
             log.warning(f"Couldn't successfully reload {operation_path}")
             self.reload_operations()
         self._operation_change()
Ejemplo n.º 3
0
    def reload_operations(self):
        self._operation_choice.SetItems(
            {key: value.name for key, value in self._operations.items()}
        )

        if not self.operation:
            return

        items = self._operation_choice.GetItems()
        operation_loader = self._operations[self.operation]

        if operation_loader.name in items and operation_loader.name != items[0]:
            self._operation_choice.SetValue(operation_loader.name)
        else:
            log.warning(
                f"Couldn't successfully reload currently selected operation: {self.operation}"
            )
            self._operation_choice.SetValue(self._operation_choice.GetItems()[0])

        self._operation_change()
Ejemplo n.º 4
0
from amulet.api.errors import LoaderNoneMatched
from amulet_map_editor.api.wx.ui.select_world import WorldSelectDialog
from amulet_map_editor.api import version, lang
from amulet_map_editor.api.logging import log
from amulet_map_editor.api.framework.pages import WorldPageUI
from .pages import AmuletMainMenu, BasePageUI

from amulet_map_editor.api import image

# Uses a conditional so if this breaks a build, we can just delete the file and it will skip the check
try:
    from amulet_map_editor.api.framework import update_check
except ImportError:
    update_check = None
    log.warning("Could not import update checker")

NOTEBOOK_MENU_STYLE = (flatnotebook.FNB_NO_X_BUTTON
                       | flatnotebook.FNB_HIDE_ON_SINGLE_TAB
                       | flatnotebook.FNB_NAV_BUTTONS_WHEN_NEEDED)
NOTEBOOK_STYLE = NOTEBOOK_MENU_STYLE | flatnotebook.FNB_X_ON_TAB

CLOSEABLE_PAGE_TYPE = Union[WorldPageUI]

wx.Image.SetDefaultLoadFlags(0)


class AmuletUI(wx.Frame):
    def __init__(self, parent):
        wx.Frame.__init__(
            self,