def _draw_layer(self, label, data_cube, z, scale, rect, show_broken_cells=True, label_color=grey, label_font=textutils.mediumFont): # Create title and get remaining space content = layout.make_titled_rect(self.screen, rect, label, label_color, self.background_color, label_font) # Calculate cell size cellW = int(content.w / reactor.reactor_width) cellH = int(content.h / reactor.reactor_height) # Check if we should draw cell labels draw_labels = cellW > 32 and cellH > 12 if not draw_labels: self.screen.lock() # Draw cells for x in self.width_range: for y in self.height_range: # Calculate location xpos = int(content.left + x * cellW) ypos = int(content.top + y * cellH) # Draw self._draw_cell(data_cube, x, y, z, scale, xpos, ypos, cellW, cellH, draw_labels, show_broken_cells) if not draw_labels: self.screen.unlock()
def _draw_graph(self, title, graph, rect, label_color=white, label_font=textutils.largeFont): # Create title and get remaining space content = layout.make_titled_rect( self.screen, rect, title, label_color, self.background_color, label_font, 8, 4 ) # Draw graph graph.draw(self.screen, content)
def _draw_layers(self, name, data_cube, scale, rect, label_color=white, label_font=textutils.largeFont): # Create title and get remaining space content = layout.make_titled_rect(self.screen, rect, name, label_color, self.background_color, label_font) # Calculate layer positions layer_separation = 2 layer_rects = layout.split_rect(content, reactor.reactor_depth, self.vertical_orientation, layer_separation) # Draw layers for z in self.depth_range: label = "Level " + str(z + 1) self._draw_layer(label, data_cube, z, scale, layer_rects[z])
def _draw_graph(self, title, graph, rect, label_color=white, label_font=textutils.largeFont): # Create title and get remaining space content = layout.make_titled_rect(self.screen, rect, title, label_color, self.background_color, label_font, 8, 4) # Draw graph graph.draw(self.screen, content)
def _draw_views(self, title, views, rect, label_color=white, label_font=textutils.largeFont): # Create title and get remaining space content = layout.make_titled_rect( self.screen, rect, title, label_color, self.background_color, label_font, 8, 4 ) # Layout the views num = len(views) view_separation = 6 height = sum(map(lambda v: v.height(), views)) + view_separation * (num - 1) if content.h > height: content.h = height view_rects = layout.split_rect(content, num, True, view_separation) # Draw views for i in range(0, num): view = views[i] view.draw(self.screen, view_rects[i])
def _draw_views(self, title, views, rect, label_color=white, label_font=textutils.largeFont): # Create title and get remaining space content = layout.make_titled_rect(self.screen, rect, title, label_color, self.background_color, label_font, 8, 4) # Layout the views num = len(views) view_separation = 6 height = sum(map(lambda v: v.height(), views)) + view_separation * (num - 1) if content.h > height: content.h = height view_rects = layout.split_rect(content, num, True, view_separation) # Draw views for i in range(0, num): view = views[i] view.draw(self.screen, view_rects[i])
def _draw_layer( self, label, data_cube, z, scale, rect, show_broken_cells=True, label_color=grey, label_font=textutils.mediumFont, ): # Create title and get remaining space content = layout.make_titled_rect(self.screen, rect, label, label_color, self.background_color, label_font) # Calculate cell size cellW = int(content.w / reactor.reactor_width) cellH = int(content.h / reactor.reactor_height) # Check if we should draw cell labels draw_labels = cellW > 32 and cellH > 12 if not draw_labels: self.screen.lock() # Draw cells for x in self.width_range: for y in self.height_range: # Calculate location xpos = int(content.left + x * cellW) ypos = int(content.top + y * cellH) # Draw self._draw_cell(data_cube, x, y, z, scale, xpos, ypos, cellW, cellH, draw_labels, show_broken_cells) if not draw_labels: self.screen.unlock()