예제 #1
0
    def on_facts_loaded(self):
        stats = Stats(self.facts, lambda fact: (fact.category, fact.activity))
        by_hour = stats.by_hour()

        self.clear()
        main = layout.VBox(padding=10, spacing=10)
        self.add_child(main)

        first_row = layout.HBox(spacing=10, expand=False)
        main.add_child(first_row)

        activity_weekdays = layout.HBox([
            layout.VBox(spacing=15, expand=False),
            layout.VBox(spacing=15, expand=False),
            layout.VBox(spacing=15)
        ],
                                        spacing=20)
        first_row.add_child(activity_weekdays)

        activity_weekdays[0].add_child(
            layout.Label("Activity", expand=False, x_align=0))
        activity_weekdays[1].add_child(
            layout.Label("Hour of the day", expand=False, x_align=0))

        for activity in sorted(stats.groups.keys()):
            label = layout.Label("%s@%s" % (activity[1], activity[0]),
                                 color="#333",
                                 size=12,
                                 x_align=0,
                                 y_align=0.5)
            label.max_width = 150
            activity_weekdays[0].add_child(label)
            activity_weekdays[1].add_child(SparkBars(by_hour[activity], 150))
    def on_facts_loaded(self):
        self.clear()
        main = layout.VBox(padding=10, spacing=10)
        self.add_child(main)

        first_row = layout.HBox(spacing=10, expand=False)
        main.add_child(first_row)

        # add sparkbars of activity by weekday
        row = layout.HBox([
            layout.VBox(spacing=20, expand=False),
            layout.VBox(spacing=15, expand=False),
            layout.VBox(spacing=15)
        ],
                          spacing=20)
        first_row.add_child(row)

        row[0].add_child(layout.Label("Category", expand=False, x_align=0))
        row[1].add_child(layout.Label("Weekdays", expand=False, x_align=0))
        row[2].add_child(layout.Label("By week", expand=False, x_align=0))
        self._add_stats(row, lambda fact: (fact.category, ""))

        row[0].add_child(
            layout.Label("Activity", expand=False, x_align=0, margin_top=20))
        row[1].add_child(
            layout.Label("Weekdays", expand=False, x_align=0, margin_top=20))
        row[2].add_child(
            layout.Label("By week", expand=False, x_align=0, margin_top=20))
        self._add_stats(row, lambda fact: (fact.category, fact.activity))
예제 #3
0
    def __init__(self):
        graphics.Scene.__init__(self)

        base = layout.VBox()
        self.add_child(base)

        self.fiddly_bits_container = layout.VBox()
        base.add_child(self.fiddly_bits_container)

        button_box = layout.VBox(expand=False, padding=10)
        base.add_child(button_box)

        self.fiddly_bits = [FiddlyBit() for i in range(4)]
        self.populate_fiddlybits()

        self.connect("on-drag", self.on_drag_sprite)
예제 #4
0
    def __init__(self):
        graphics.Scene.__init__(self)
        self.storage = Storage()

        self._load_end_date = dt.datetime.now()
        self.facts = []

        self.label = layout.Label("Loading...", y=100, color="#666", size=50)
        self.add_child(layout.VBox(self.label))

        gobject.timeout_add(10, self.load_facts)
예제 #5
0
    def __init__(self):
        graphics.Scene.__init__(self, background_color="#333")

        self.rattles = [
            RattleRandomXY(),
            RattleRandomAngle(),
            RattleRandomAngleShadow(),
            RattleRandomAngle2Shadow(),
            RattleWithEase(),
        ]

        box = layout.HBox()
        self.add_child(box)

        for rattle in self.rattles:
            container = layout.VBox(rattle, fill=False)
            box.add_child(container)

        self.rattling = False
        self.connect("on-first-frame", self.on_first_frame)