def snapshot(self, dumy): if self.right_panel != "snapshot": self.right_panel = "snapshot" Panel.clearRight() self.comparing = False self.my_snapshot.takeSnapshot(self.my_playground.cube())
def quitz(self, dummy): if self.right_panel != "library": self.right_panel = "library" Panel.clearRight() l = math.ceil(random.random() * 4) self.my_library.setLevel(l) self.current_level = l total = self.my_library.getTotal() r = math.ceil(random.random() * total) self.my_library.setCurrent((-1, r)) self.my_library.displayContent() self.load(0) Panel.printRight(u"当前是第%s题" % (str(r)))
def displayContent(self, level_current=None): Panel.clearRight() Panel.printRight(s_map[self.lib_level]) self.my_cube_3d = None self.single_clicked = False if level_current != None: self.setLevel(level_current[0]) self.setCurrent((level_current[1], level_current[2])) if self.lib_level == 3: self.showLibLevel3() elif self.lib_level == 4: self.showLibLevel4() else: self.showLibBelowLevel3() if self.current_legend != -1: self.my_cube_3d = self.legends[self.current_legend] self.my_cube_3d.drawSelected()
def showLibLevel4(self): if self.total == 0: return Panel.clearRight() start = (self.current - 1) * 12 end = start + 12 if end > len(self.snapshots): end = len(self.snapshots) self.legends = [] for i in range(start, end): file_no = +i file = self.snapshots_dir + self.snapshots[i][0] cube = cubeModel.Cube(file) m, r = divmod(i - start, 3) cube_3d = cubeLegendPLL.CubeLegendPLL(cube, width, height, fov, 20, 650 + r * 180, -120 + m * 150) cube_3d.buildFaces() cube_3d.displayContent() self.legends.append(cube_3d)
def save(self, dumy): if self.right_panel != "library": Panel.clearRight() self.right_panel = "library" self.my_library.saveCube(self.my_playground.cube())
def library(self, level): if self.right_panel != "library": Panel.clearRight() self.right_panel = "library" self.my_library.displayContent() self.comparing = False
def help(self, dumy): if self.right_panel != "help": Panel.clearRight() self.right_panel = "help" self.my_tutorial.nextOrPrevious(0) self.comparing = False