def displayHeader(self): screen,ft_sz,x_scale,y_scale= Panel.screen, \ Panel.ft_sz,Panel.x_scale,Panel.y_scale b_x = x_scale * 820 b_y = y_scale * 10 b_h = y_scale * 30 if self.total_page == 0: start = 0 stop1 = 0 stop2 = 10 else: start = (self.current_page - 1) * 10 stop1 = start + 10 stop2 = stop1 if self.current_page == self.total_page: stop1 = self.total if self.current_page == 1: button(screen, "<<", ft_sz, b_x, b_y, x_scale * 30, b_h, Panel.gray, red, None, -1) else: button(screen, "<<", ft_sz, b_x, b_y, x_scale * 30, b_h, green, red, self.prevPage, -1) b_x += x_scale * 40 for b in range(start, stop1): if (b + 1) == self.current: button(screen, str(b + 1), ft_sz, b_x, b_y, x_scale * 30, b_h, red, red, self.displayContent, (-1, b + 1, -1)) else: button(screen, str(b + 1), ft_sz, b_x, b_y, x_scale * 30, b_h, green, red, self.displayContent, (-1, b + 1, -1)) b_x += x_scale * 40 for b in range(stop1, stop2): button(screen, "", ft_sz, b_x, b_y, x_scale * 30, b_h, Panel.gray, red, None, b + 1) b_x += x_scale * 40 if self.current_page == self.total_page: button(screen, ">>", ft_sz, b_x, b_y, x_scale * 30, b_h, Panel.gray, red, None, 1) else: button(screen, ">>", ft_sz, b_x, b_y, x_scale * 30, b_h, green, red, self.nextPage, 1) #显示控制按钮 b_map = [("自定", (0, 1, -1)), ("十字", (1, 1, -1)), ("F2L", (2, 1, -1)), ("OLL", (3, 1, -1)), (u"PLL", (4, 1, -1))] b_x = x_scale * 820 b_y = y_scale * 640 b_h = y_scale * 30 for b in b_map: button(screen, b[0], ft_sz, b_x, b_y, x_scale * 60, b_h, green, red, self.displayContent, b[1]) b_x += x_scale * 70 Panel.printRight(s_map[self.lib_level])
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 takeSnapshot(self, cube): self.my_cube_3d.cube = copy.deepcopy(cube) self.my_cube_3d.buildFaces() self.displayContent() Panel.printRight("快照窗口")