diff --git a/CHANGELOG b/CHANGELOG index e3435eac85..b0f2db0556 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,4 @@ +* Add day view on calendar * Add CSV exports into print toolbar * Display unread and total of notes * Support badge on icon diff --git a/tryton/gui/window/view_form/view/calendar_gtk/calendar_.py b/tryton/gui/window/view_form/view/calendar_gtk/calendar_.py index b1968f4e62..924dca2df6 100644 --- a/tryton/gui/window/view_form/view/calendar_gtk/calendar_.py +++ b/tryton/gui/window/view_form/view/calendar_gtk/calendar_.py @@ -27,6 +27,9 @@ class Calendar_(goocalendar.Calendar): def get_displayed_period(self): cal = calendar.Calendar(self.firstweekday) + if self.view == 'day': + first_date = self.selected_date + last_date = self.selected_date + datetime.timedelta(1) if self.view == 'week': week = goocalendar.util.my_weekdatescalendar(cal, self.selected_date) diff --git a/tryton/gui/window/view_form/view/calendar_gtk/toolbar.py b/tryton/gui/window/view_form/view/calendar_gtk/toolbar.py index c261db0463..11f0bd55a9 100644 --- a/tryton/gui/window/view_form/view/calendar_gtk/toolbar.py +++ b/tryton/gui/window/view_form/view/calendar_gtk/toolbar.py @@ -107,7 +107,15 @@ class Toolbar(Gtk.Toolbar): blank_widget.set_expand(True) self.insert(blank_widget, -1) - week_button = Gtk.RadioToolButton() + day_button = Gtk.RadioToolButton() + day_button.set_label(_('Day View')) + day_button.connect("clicked", self.on_day_button_clicked) + day_button.add_accelerator( + "clicked", self.accel_group, Gdk.KEY_d, + Gdk.ModifierType.MODIFIER_MASK, Gtk.AccelFlags.VISIBLE) + self.insert(day_button, -1) + + week_button = Gtk.RadioToolButton.new_from_widget(day_button) week_button.set_label(_('Week View')) week_button.connect("clicked", self.on_week_button_clicked) week_button.add_accelerator( @@ -124,7 +132,8 @@ class Toolbar(Gtk.Toolbar): self.insert(month_button, -1) buttons = { 'month': month_button, - 'week': week_button + 'week': week_button, + 'day': day_button, } buttons[self.goocalendar.view].set_active(True) self.update_displayed_date() @@ -135,15 +144,18 @@ class Toolbar(Gtk.Toolbar): year = date.timetuple()[0] month = date.timetuple()[1] day = date.timetuple()[2] + month_label = calendar.month_name[month] self.current_year_label.set_text(str(year)) if self.goocalendar.view == "month": - new_label = calendar.month_name[month] - self.current_page_label.set_text(new_label) + self.current_page_label.set_text(month_label) elif self.goocalendar.view == "week": week_number = datetime.date(year, month, day).isocalendar()[1] new_label = _('Week') + ' ' + str(week_number) - new_label += ' (' + calendar.month_name[month] + ')' + new_label += ' (' + month_label + ')' + self.current_page_label.set_text(new_label) + elif self.goocalendar.view == "day": + new_label = date.strftime('%x') self.current_page_label.set_text(new_label) def on_today_button_clicked(self, widget): @@ -224,6 +236,9 @@ class Toolbar(Gtk.Toolbar): day = max(next_month_days) self.goocalendar.select(datetime.datetime(year, month, day)) + def on_day_button_clicked(self, widget): + self.goocalendar.set_view("day") + def on_week_button_clicked(self, widget): self.goocalendar.set_view("week")