Exemplo n.º 1
0
    def _button_clicked(self, button):
        self._calendar_window = ga_Gtk.Window(ga_Gtk.WindowType.TOPLEVEL)
        self._calendar_window.set_type_hint(ga_Gdk.WindowTypeHint.DIALOG)
        self._calendar_window.set_modal(True)
        self._calendar_window.set_title(_("Date Selection"))

        self._calendar.select_month(self._date.month - 1, self._date.year)
        self._calendar.select_day(self._date.day)

        vbox = ga_Gtk.VBox(spacing=3)
        vbox.set_border_width(2)
        vbox.pack_start(self._calendar, True, True, 0)

        button_box = ga_Gtk.HButtonBox()
        button_box.set_layout(ga_Gtk.ButtonBoxStyle.END)
        vbox.pack_start(button_box, True, True, 0)

        button = ga_Gtk.Button(_("Today"))
        button.connect("clicked", self._today_clicked)
        button_box.pack_start(button, True, True, 0)

        frame = ga_Gtk.Frame()
        frame.add(vbox)
        self._calendar_window.add(frame)
        self._calendar_window.set_position(ga_Gtk.WindowPosition.MOUSE)
        self._calendar_window.show_all()

        self._calendar.connect("day-selected-double-click",
                               self._calendar_clicked)