Esempio n. 1
0
 def __init__(self, cal, start=None, end=None, **kwargs):
     """
     Constructor.
     """
     self.table = CanvasMagnetTable(align=CanvasMagnetTable.ALIGN_LEFT)
     self.table.set_row_count(24 * 4)
     self.table.set_homogeneus_rows(True)
     CanvasEventView.__init__(self, cal, start, end, **kwargs)
     self.append(self.table, hippo.PACK_EXPAND)
Esempio n. 2
0
 def __init__(self, cal, start=None, end=None, **kwargs):
     """
     Constructor.
     """
     self.table = CanvasMagnetTable(align=CanvasMagnetTable.ALIGN_LEFT)
     self.table.set_row_count(24 * 4)
     self.table.set_homogeneus_rows(True)
     CanvasEventView.__init__(self, cal, start, end, **kwargs)
     self.append(self.table, hippo.PACK_EXPAND)
Esempio n. 3
0
 def __init__(self, cal, start = None, end = None, **kwargs):
     """
     Constructor.
     """
     CanvasEventView.__init__(self, cal, **kwargs)
     self.table = CanvasMagnetTable(align = CanvasMagnetTable.ALIGN_TOP)
     self.table.set_homogeneus_columns(True)
     self.append(self.table, hippo.PACK_EXPAND)
     self.show_normal = True  # whether to show normal events
     self.overflow_indic = []
     self.columns = 0
Esempio n. 4
0
 def __init__(self, cal, start=None, end=None, **kwargs):
     """
     Constructor.
     """
     CanvasEventView.__init__(self, cal, **kwargs)
     self.table = CanvasMagnetTable(align=CanvasMagnetTable.ALIGN_TOP)
     self.table.set_homogeneus_columns(True)
     self.append(self.table, hippo.PACK_EXPAND)
     self.show_normal = True  # whether to show normal events
     self.overflow_indic = []
     self.columns = 0
Esempio n. 5
0
    def do_allocate(self, width, height, origin_changed):
        CanvasEventView.do_allocate(self, width, height, origin_changed)

        # Hide all overflow indicators.
        for child in self.get_children():
            if child != self.table:
                child.set_visible(False)

        rows, cols = self.table.get_size()
        if min(rows, width, height) <= 0:
            return

        # Measure the height of the first event.
        children = self.table.get_children()
        if len(children) == 0:
            return
        first = children[0]
        min_row_h, row_h = first.get_height_request(width / cols)
        if row_h <= 0:
            return

        # Hide events that do not fit into the box.
        max_rows = height / row_h
        matrix   = self.table.get_matrix()
        for colnum, col in enumerate(matrix.get_columns()):
            # Count rows that are already hidden.
            hidden = 0
            for child in col:
                if not child.get_visible():
                    hidden += 1

            # No need to hide anything if the box is large enough.
            if len(col) <= max_rows:
                for child in col:
                    child.set_visible(True)
                continue

            # Hide enough rows to make room for an overflow indicator.
            to_hide = len(col) - max_rows + 1
            hidden  = 0
            for row in reversed(col):
                if hidden >= to_hide:
                    row.set_visible(True)
                    continue
                if not row.get_visible():
                    hidden += 1
                    continue
                row.set_visible(False)
                hidden += 1

            # Show overflow indicator
            indic   = self.overflow_indic[colnum]
            caption = '%d more' % hidden
            alloc   = (width / cols * colnum, height - row_h, width / cols, hidden)
            indic.set_visible(True)

            if self.allocs[indic] == alloc:
                continue
            self.allocs[indic] = alloc
            indic.set_properties(text        = caption,
                                 box_width   = alloc[2])
            self.set_position(indic, alloc[0], alloc[1])
        CanvasEventView.do_allocate(self, width, height, origin_changed)
Esempio n. 6
0
    def do_allocate(self, width, height, origin_changed):
        CanvasEventView.do_allocate(self, width, height, origin_changed)

        # Hide all overflow indicators.
        for child in self.get_children():
            if child != self.table:
                child.set_visible(False)

        rows, cols = self.table.get_size()
        if min(rows, width, height) <= 0:
            return

        # Measure the height of the first event.
        children = self.table.get_children()
        if len(children) == 0:
            return
        first = children[0]
        min_row_h, row_h = first.get_height_request(width / cols)
        if row_h <= 0:
            return

        # Hide events that do not fit into the box.
        max_rows = height / row_h
        matrix = self.table.get_matrix()
        for colnum, col in enumerate(matrix.get_columns()):
            # Count rows that are already hidden.
            hidden = 0
            for child in col:
                if not child.get_visible():
                    hidden += 1

            # No need to hide anything if the box is large enough.
            if len(col) <= max_rows:
                for child in col:
                    child.set_visible(True)
                continue

            # Hide enough rows to make room for an overflow indicator.
            to_hide = len(col) - max_rows + 1
            hidden = 0
            for row in reversed(col):
                if hidden >= to_hide:
                    row.set_visible(True)
                    continue
                if not row.get_visible():
                    hidden += 1
                    continue
                row.set_visible(False)
                hidden += 1

            # Show overflow indicator
            indic = self.overflow_indic[colnum]
            caption = '%d more' % hidden
            alloc = (width / cols * colnum, height - row_h, width / cols,
                     hidden)
            indic.set_visible(True)

            if self.allocs[indic] == alloc:
                continue
            self.allocs[indic] = alloc
            indic.set_properties(text=caption, box_width=alloc[2])
            self.set_position(indic, alloc[0], alloc[1])
        CanvasEventView.do_allocate(self, width, height, origin_changed)