コード例 #1
0
 def __on_save(self, event):
     if globals.active_map.filename is None:
         self.__on_save_as(None)
         return
     try: 
         globals.active_map.write_to_file()
         if globals.scene_filename: 
             scene.save_scene(globals.scene_filename)
     except:
         print("Failed to save map/scene!")
         traceback.print_exc() 
     else: 
         self.view.hide()
コード例 #2
0
    def __on_save(self, event):
        success = True
        if globals.active_map.filename is not None:
            try:
                globals.active_map.write_to_file()
            except:
                success = False
                print("Failed to save map!")
        else:
            self.__on_save_as(None)

        if globals.scene_filename is not None:
            try:
                scene.save_scene(globals.scene_filename)
            except:
                success = False
                print("Failed to save scene!")

        if success:
            self.view.hide()
コード例 #3
0
    def __on_save_as_confirm(self, event):
        pf.unregister_event_handler(EVENT_FILE_CHOOSER_OKAY, MenuVC.__on_save_as_confirm)
        pf.unregister_event_handler(EVENT_FILE_CHOOSER_CANCEL, MenuVC.__on_save_as_cancel)

        assert self.fc is not None
        self.fc.hide()
        self.fc = None
        self.activate()

        old_filename = globals.active_map.filename
        globals.active_map.filename = event[0]
        try: 
            globals.active_map.write_to_file()
            if event[1] is not None:
                scene.save_scene(event[1])
                globals.scene_filename = event[1]
        except:
            globals.active_map.filename = old_filename
            print("Failed to save map/scene!")
            traceback.print_exc() 
        else: 
            self.view.hide()