예제 #1
0
    def __init__(self, schedule, event, favourite_toggled_cb):
        MaybeStackableWindow.__init__(self, event.title, self._on_orientation_changed)
        self.schedule = schedule
        self.event = event
        self.favourite_toggled_cb = favourite_toggled_cb

        vbox = gtk.VBox(spacing=12)

        self.label = gtk.Label()
        self.label.set_markup(event.full())
        self.label.set_properties(wrap=True)
        vbox.pack_start(self.label, expand=False)

        toggle = MagicCheckButton("Favourite")
        toggle.set_active(event in self.schedule.favourites)
        toggle.connect("toggled", self.toggle_toggled)
        vbox.pack_end(toggle, expand=False)

        self._update_conflicted_events()
        conflicts_button = MagicButton("Overlapped events")
        conflicts_button.connect("clicked", self._conflicts_button_clicked_cb)
        vbox.pack_end(conflicts_button, expand=False)

        pannable = MaybePannableArea()
        pannable.add_with_viewport(vbox)
        self.add_with_margins(pannable)
        self.show_all()

        if not self.conflict_events:
            conflicts_button.hide()
예제 #2
0
    def __init__(self, schedule, event, favourite_toggled_cb):
        MaybeStackableWindow.__init__(self, event.title,
            self._on_orientation_changed)
        self.schedule = schedule
        self.event = event
        self.favourite_toggled_cb = favourite_toggled_cb

        vbox = gtk.VBox(spacing=12)

        self.label = gtk.Label()
        self.label.set_markup(event.full())
        self.label.set_properties(wrap=True)
        vbox.pack_start(self.label, expand=False)

        toggle = MagicCheckButton("Favourite")
        toggle.set_active(event in self.schedule.favourites)
        toggle.connect('toggled', self.toggle_toggled)
        vbox.pack_end(toggle, expand=False)

        self._update_conflicted_events()
        conflicts_button = MagicButton('Overlapped events')
        conflicts_button.connect('clicked', self._conflicts_button_clicked_cb)
        vbox.pack_end(conflicts_button, expand=False)

        pannable = MaybePannableArea()
        pannable.add_with_viewport(vbox)
        self.add_with_margins(pannable)
        self.show_all()

        if not self.conflict_events:
            conflicts_button.hide()
예제 #3
0
    def __init__(self, schedule, title, events, event_omit=Event.OMIT_DAY):
        MaybeStackableWindow.__init__(self, title)
        self.schedule = schedule
        self.store = gtk.ListStore(str, object, bool, bool, gtk.gdk.Color)
        self.events = events

        self.populate_store(event_omit)
        self.__create_treeview()
예제 #4
0
파일: eventlist.py 프로젝트: wjt/sojourner
    def __init__(self, schedule, title, events, event_omit=Event.OMIT_DAY):
        MaybeStackableWindow.__init__(self, title)
        self.schedule = schedule
        self.store = gtk.ListStore(str, object, bool, bool, gtk.gdk.Color)
        self.events = events

        self.populate_store(event_omit)
        self.__create_treeview()
예제 #5
0
    def __init__(self, schedule, title, categories, event_fmt,
                 show_swatches=False):
        MaybeStackableWindow.__init__(self, title)
        self.schedule = schedule
        self.categories = categories
        self.event_fmt = event_fmt
        # This should really be   (str, list) but that doesn't seem to work:
        #   TypeError: could not get typecode from object
        # I guess list is not a subclass of object.
        self.store = gtk.ListStore(str, object, str, gtk.gdk.Color)

        for category, events in sorted(categories.items()):
            summary = """<b>%(category)s</b>
<small>%(event_summary)s</small>""" % {
                'category': esc(category),
                'event_summary': summarize_events(events),
            }
            colour = get_color(category) if show_swatches else None
            self.store.append((category, events, summary, colour))

        treeview = gtk.TreeView(self.store)
        treeview.set_headers_visible(False)
        treeview.connect("row-activated", self.category_activated)

        tvcolumn = gtk.TreeViewColumn('Stuff')
        treeview.append_column(tvcolumn)

        # FIXME: it'd be nice to show the colours on the room list, too, to
        # show which track(s) are in that room. But then we'd need to support
        # showing more than one.
        if show_swatches:
            add_swatch_cells(tvcolumn,
                colour_col=CategoryList.COL_CATEGORY_COLOUR)

        cell = gtk.CellRendererText()
        cell.set_property("ellipsize", pango.ELLIPSIZE_END)
        tvcolumn.pack_start(cell, True)

        tvcolumn.add_attribute(cell, 'markup',
            CategoryList.COL_CATEGORY_SUMMARY)

        pannable = MaybePannableArea()
        pannable.add(treeview)
        self.add_with_margins(pannable)

        self.show_all()