Beispiel #1
0
    def edit_behaviours(self):
        """Show the dialog to edit behaviours"""
        dialog = Behaviours(self)
        values = dialog.show_modal(self.editor_gui.editor_window,
                                   self.engine.pump)
        if not dialog.return_value:
            return False
        BehaviourManager.clear_behaviours()
        current_items = list(values["current_items"])
        self.project.set("fife-rpg", "Behaviours", current_items)
        self.register_behaviours(current_items)

        self.project_changed = True
Beispiel #2
0
 def clear(self):
     """Clears all data and restores saved settings"""
     self._maps = {}
     self._current_map = None
     self._components = {}
     self._actions = {}
     self._systems = {}
     self._behaviours = {}
     self.changed_maps = []
     self.project_changed = False
     self.entity_changed = False
     self.editor_gui.reset_layerlist()
     self.map_entities = None
     self.set_selected_object(None)
     tmp_settings = list(self.settings.getSettingsFromFile("fife-rpg").keys())
     for setting in tmp_settings:
         if setting in self.editor_settings:
             self.settings.set("fife-rpg", setting,
                               self.editor_settings[setting])
         else:
             self.settings.remove("fife-rpg", setting)
     ComponentManager.clear_components()
     ComponentManager.clear_checkers()
     ActionManager.clear_actions()
     ActionManager.clear_commands()
     SystemManager.clear_systems()
     BehaviourManager.clear_behaviours()
     self.editor.delete_maps()
     self.editor.delete_objects()
     if self.project_source is not None:
         self.engine.getVFS().removeSource(self.project_source)
         self.project_source = None
     if self.project_dir is not None:
         sys.path.remove(self.project_dir)
         self.project_dir = None
     self.project = None
     for callback in self._project_cleared_callbacks:
         callback()
     self.create_world()