Пример #1
0
 def get_normal_events(self, start, end, include_multi_day_events = True):
     # Get a list of non-all-day events and sort them by length.
     events = []
     for event in self.get_events(start, end):
         if not include_multi_day_events \
           and not util.same_day(event.start, event.end):
             continue
         if not event.all_day:
             events.append(event)
     return events
Пример #2
0
 def get_normal_events(self, start, end, include_multi_day_events=True):
     # Get a list of non-all-day events and sort them by length.
     events = []
     for event in self.get_events(start, end):
         if not include_multi_day_events \
           and not util.same_day(event.start, event.end):
             continue
         if not event.all_day:
             events.append(event)
     return events
Пример #3
0
 def get_all_day_events(self, start, end, include_timed_events = False):
     # Get a list of all-day events and sort them by length.
     events = []
     for event in self.get_events(start, end):
         if event.all_day:
             events.append(event)
             continue
         if include_timed_events \
           and not util.same_day(event.start, event.end):
             events.append(event)
     return events
Пример #4
0
 def get_all_day_events(self, start, end, include_timed_events=False):
     # Get a list of all-day events and sort them by length.
     events = []
     for event in self.get_events(start, end):
         if event.all_day:
             events.append(event)
             continue
         if include_timed_events \
           and not util.same_day(event.start, event.end):
             events.append(event)
     return events
Пример #5
0
    def _add_event(self, event):
        event_start      = max(event.start, self.range[0])
        event_end        = min(event.end,   self.range[1])
        event_off_days   = (event_start - self.range[0]).days
        event_width_days = (event_end - event_start).days + 1

        # Create the event.
        item = CanvasEvent(self.cal, event)
        self.event_items[event] = item
        item.connect('button-press-event',   self.on_event_button_press_event)
        item.connect('button-release-event', self.on_event_button_release_event)
        self.table.add(item,
                       event_off_days,
                       event_off_days + event_width_days,
                       len(self.event_items))
        item.set_text(event.caption)
        if event.all_day:
            item.set_property('color', color.to_int(event.bg_color))
        if self.show_normal and not util.same_day(event.start, event.end):
            item.set_property('color', color.to_int(event.bg_color))
        elif not event.all_day:
            time = self._format_time(event)
            item.set_text(time)
            item.set_text_properties(xalign = hippo.ALIGNMENT_START)
        if event.text_color is not None:
            item.set_text_color(event.text_color)
        radius_top_left     = 10
        radius_top_right    = 10
        radius_bottom_left  = 10
        radius_bottom_right = 10
        if event.end > self.range[1]:
            radius_top_right    = 0
            radius_bottom_right = 0
        if event.start < self.range[0]:
            radius_top_left    = 0
            radius_bottom_left = 0
        item.set_properties(radius_top_left     = radius_top_left,
                            radius_top_right    = radius_top_right,
                            radius_bottom_left  = radius_bottom_left,
                            radius_bottom_right = radius_bottom_right)
Пример #6
0
    def _add_event(self, event):
        event_start = max(event.start, self.range[0])
        event_end = min(event.end, self.range[1])
        event_off_days = (event_start - self.range[0]).days
        event_width_days = (event_end - event_start).days + 1

        # Create the event.
        item = CanvasEvent(self.cal, event)
        self.event_items[event] = item
        item.connect('button-press-event', self.on_event_button_press_event)
        item.connect('button-release-event',
                     self.on_event_button_release_event)
        self.table.add(item, event_off_days, event_off_days + event_width_days,
                       len(self.event_items))
        item.set_text(event.caption, event.description)
        item.set_property('color', color.to_int(event.bg_color))
        if self.show_normal and not util.same_day(event.start, event.end):
            item.set_property('color', color.to_int(event.bg_color))
        elif not event.all_day:
            time = self._format_time(event)
            item.set_text(time, event.description)
            item.set_text_properties(xalign=hippo.ALIGNMENT_START)
        if event.text_color is not None:
            item.set_text_color(event.text_color)
        radius_top_left = 10
        radius_top_right = 10
        radius_bottom_left = 10
        radius_bottom_right = 10
        if event.end > self.range[1]:
            radius_top_right = 0
            radius_bottom_right = 0
        if event.start < self.range[0]:
            radius_top_left = 0
            radius_bottom_left = 0
        item.set_properties(radius_top_left=radius_top_left,
                            radius_top_right=radius_top_right,
                            radius_bottom_left=radius_bottom_left,
                            radius_bottom_right=radius_bottom_right)