def get_xml(rubikscube, type_cube="Cube"):
        rubikscube = RubiksCubeConverter.to_code_cube(rubikscube)

        element = ET.Element(type_cube)
        for x in Helper.CUBE_SIDES:
            side = ET.Element(x)
            rubiks_cube_side = rubikscube.get_side(x)
            for y in range(rubikscube.get_size()):
                for z in range(rubikscube.get_size()):
                    cube = ET.Element("Part-"+str(y)+"-"+str(z))
                    cube.text = str(rubiks_cube_side[y][z])
                    side.append(cube)
            element.append(side)
        return element
 def switch_to_code(self):
     self._turn_invisible()
     self.current_cube = RubiksCubeConverter.to_visual_cube(RubiksCubeConverter.to_code_cube(self._start_cube))
     self.current_cube.set_cube_visible(True)
 def load_from_xml_object(self, xml_object):
     self._start_cube = RubiksCubeConverter.to_visual_cube(xml_object._start_cube)
     self._result_cube = RubiksCubeConverter.to_visual_cube(xml_object._result_cube)
 def set_matching_cube(self, cube):
     if cube.get_size() == self.cube_size:
         self.match_cube = RubiksCubeConverter.to_code_cube(cube)
     else:
         raise Exception("Cube size doesn't match")
 def _write_to_storage(self):
     self.display._storage._start_cube = RubiksCubeConverter.to_visual_cube(self.current_xml._start_cube)
     self.display._storage._result_cube = RubiksCubeConverter.to_visual_cube(self.current_xml._result_cube)
     self.display._storage._code_cube = RubiksCubeConverter.to_visual_cube(self.current_xml._start_cube)
     self.display._panels.action.steps = self.current_xml._codes
     self.display._panels.action._reset_textbox()