コード例 #1
0
ファイル: reactor_visualizer.py プロジェクト: zbyso23/reactor
    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()
コード例 #2
0
    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)
コード例 #3
0
    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])
コード例 #4
0
ファイル: reactor_visualizer.py プロジェクト: zbyso23/reactor
    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)
コード例 #5
0
    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])
コード例 #6
0
ファイル: reactor_visualizer.py プロジェクト: zbyso23/reactor
    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])
コード例 #7
0
ファイル: reactor_visualizer.py プロジェクト: zbyso23/reactor
    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])
コード例 #8
0
    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()