Esempio n. 1
0
    def __init__(self):
        super(TimeStage, self).__init__()
        self.stage.connect('key-press-event', self.keypress)
        self.stage.set_color(Clutter.Color.new(0, 43, 54, 255)) # red,green,blue,alpha
        self.timefont = "Roboto Light 64"
        self.datefont = "Roboto Light 40"
        self.eventfont = "Roboto Light 35"
        self.staticfont = "Roboto Light 20"
        current_time = datetime.now()
        self.textcolor = Clutter.Color.new(147, 161, 161, 255) # red,green,blue,alpha
        self.eventcolor = Clutter.Color.new(42, 161, 152, 255)
        self.datecolor = Clutter.Color.new(203, 75, 22, 255)
        self.timecolor = Clutter.Color.new(38, 139, 210, 255)
        self.timetext = Clutter.Text.new_full(self.timefont, '{0:02d}:{1:02d}:{2:02d}'.format(current_time.hour, current_time.minute, current_time.second), self.timecolor)
        self.datetext = Clutter.Text.new_full(self.datefont, '{0}.{1}'.format(current_time.month, current_time.day), self.datecolor)
        self.eventtitletext = Clutter.Text.new_full(self.eventfont, '', self.eventcolor)
        self.eventtimetext = Clutter.Text.new_full(self.eventfont, '', self.textcolor)
        self.eventstatic1text = Clutter.Text.new_full(self.staticfont, 'Next event is...', self.textcolor)
        self.eventstatic2text = Clutter.Text.new_full(self.staticfont, '...in', self.textcolor)
        self.timetext.set_position(0, 0) # x,y
        self.datetext.set_position(214, 83) # x,y
        self.eventtitletext.set_position(0,140) # x,y
        self.eventtimetext.set_position(200,187) # x,y
        self.eventstatic1text.set_position(2,113) # x,y
        self.eventstatic2text.set_position(158,206) # x,y
        Clutter.Container.add_actor(self.stage, self.timetext)
        Clutter.Container.add_actor(self.stage, self.datetext)
        Clutter.Container.add_actor(self.stage, self.eventtitletext)
        Clutter.Container.add_actor(self.stage, self.eventtimetext)
        Clutter.Container.add_actor(self.stage, self.eventstatic1text)
        Clutter.Container.add_actor(self.stage, self.eventstatic2text)

        self.clock_timeline = Clutter.Timeline()
        self.clock_timeline.set_duration(1000) # timeline lasts one second
        self.clock_timeline.add_marker_at_time("one_second", 1000)
        self.clock_timeline.connect('marker-reached', self.update_time) # when marker reached, call update_time
        self.clock_timeline.set_loop(True) # update every second
        self.clock_timeline.start()

        self.pull_calendar_update()
        self.update_calendar()

        self.calendar_pull_timeline = Clutter.Timeline()
        self.calendar_pull_timeline.set_duration(3600000) # timeline lasts 1 hr
        self.calendar_pull_timeline.add_marker_at_time("one_hour", 3600000)
        self.calendar_pull_timeline.connect('marker-reached', self.pull_calendar_update)  # when marker reached, call pull_calendar_update
        self.calendar_pull_timeline.set_loop(True) # repeat the update timer
        self.calendar_pull_timeline.start()

        self.calendar_update_timeline = Clutter.Timeline()
        self.calendar_update_timeline.set_duration(60000) # timeline lasts one second
        self.calendar_update_timeline.add_marker_at_time("one_minute", 60000)
        self.calendar_update_timeline.connect('marker-reached', self.update_calendar) # when marker reached, call update_calendar
        self.calendar_update_timeline.set_loop(True) # update every minute
        self.calendar_update_timeline.start()
Esempio n. 2
0
stage.set_minimum_size(600, 400)
stage.set_user_resizable(True)
stage.set_title("Event Timer")

stage.set_color(black)
stage.connect_after("key-press-event", parseKeyPress)
stage.connect("allocation-changed", redraw)
stage.connect("destroy", finalize)

time_elapsed = Clutter.Text()
time_elapsed.set_color(white)

time_remaining = Clutter.Text()
time_remaining.set_color(white)

stage.add_actor(time_elapsed)
stage.add_actor(time_remaining)

redraw()
stage.show_all()

t = Clutter.Timeline()
t.set_duration(250)
t.set_loop(True)
t.connect('completed', update_display)
t.start()

gobject.timeout_add(10, redraw)

Clutter.main()
Esempio n. 3
0
File: user.py Progetto: rmatam/vivo
 def __init__(self):
     self.tl = Clutter.Timeline()