Hello community, here is the log from the commit of package python-GooCalendar for openSUSE:Factory checked in at 2019-03-28 22:49:43 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-GooCalendar (Old) and /work/SRC/openSUSE:Factory/.python-GooCalendar.new.25356 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-GooCalendar" Thu Mar 28 22:49:43 2019 rev:4 rq:689360 version:0.5 Changes: -------- --- /work/SRC/openSUSE:Factory/python-GooCalendar/python-GooCalendar.changes 2019-02-01 11:44:27.208613615 +0100 +++ /work/SRC/openSUSE:Factory/.python-GooCalendar.new.25356/python-GooCalendar.changes 2019-03-28 22:49:48.259042400 +0100 @@ -1,0 +2,6 @@ +Thu Mar 28 13:32:08 UTC 2019 - Tomáš Chvátal <[email protected]> + +- Update to 0.5 release: + * Actual python3 support using typelib introspection dependencies + +------------------------------------------------------------------- Old: ---- GooCalendar-0.4.tar.gz New: ---- GooCalendar-0.5.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-GooCalendar.spec ++++++ --- /var/tmp/diff_new_pack.ST9Q06/_old 2019-03-28 22:49:48.695042303 +0100 +++ /var/tmp/diff_new_pack.ST9Q06/_new 2019-03-28 22:49:48.695042303 +0100 @@ -13,14 +13,14 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ # %{?!python_module:%define python_module() python-%{**} python3-%{**}} -%define skip_python3 1 +%define skip_python2 1 Name: python-GooCalendar -Version: 0.4 +Version: 0.5 Release: 0 Summary: A calendar widget for GTK using PyGoocanvas License: GPL-2.0-only @@ -32,9 +32,13 @@ BuildRequires: %{python_module setuptools} BuildRequires: fdupes BuildRequires: python-rpm-macros +BuildRequires: typelib(Gdk) +BuildRequires: typelib(GooCanvas) +BuildRequires: typelib(Gtk) +Requires: typelib(Gdk) +Requires: typelib(GooCanvas) +Requires: typelib(Gtk) BuildArch: noarch -Requires: goocanvas >= 2.0 -Requires: python-goocanvas %python_subpackages %description ++++++ GooCalendar-0.4.tar.gz -> GooCalendar-0.5.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/GooCalendar-0.4/.hgtags new/GooCalendar-0.5/.hgtags --- old/GooCalendar-0.4/.hgtags 2018-06-26 10:39:40.000000000 +0200 +++ new/GooCalendar-0.5/.hgtags 2019-03-22 15:53:40.000000000 +0100 @@ -2,3 +2,4 @@ d30305cc7226e493679ad7b53f959bf882f4c9ca 0.2 27cc16bf82003592e0dbca15f829596b0aef9a12 0.3 66ceeaa15674495de2792c790c2ee4eacf32a341 0.4 +fb5fc95a2f043fd985332b3044858913667f5fa7 0.5 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/GooCalendar-0.4/CHANGELOG new/GooCalendar-0.5/CHANGELOG --- old/GooCalendar-0.4/CHANGELOG 2018-06-26 10:38:41.000000000 +0200 +++ new/GooCalendar-0.5/CHANGELOG 2019-03-22 15:52:59.000000000 +0100 @@ -1,3 +1,8 @@ +Version 0.5 - 2019-03-22 +* Use GTK+ 3 +* Remove support for Python 2 +* Add single day view + Version 0.4 - 2018-06-26 * Add support for Python 3 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/GooCalendar-0.4/COPYRIGHT new/GooCalendar-0.5/COPYRIGHT --- old/GooCalendar-0.4/COPYRIGHT 2015-02-11 21:09:31.000000000 +0100 +++ new/GooCalendar-0.5/COPYRIGHT 2019-02-22 18:34:31.000000000 +0100 @@ -1,5 +1,5 @@ Copyright (C) 2012 Antoine Smolders -Copyright (C) 2012-2013 Cédric Krier +Copyright (C) 2012-2019 Cédric Krier Copyright (C) 2007 Samuel Abels <http://debain.org> This program is free software; you can redistribute it and/or diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/GooCalendar-0.4/GooCalendar.egg-info/PKG-INFO new/GooCalendar-0.5/GooCalendar.egg-info/PKG-INFO --- old/GooCalendar-0.4/GooCalendar.egg-info/PKG-INFO 2018-06-26 10:42:21.000000000 +0200 +++ new/GooCalendar-0.5/GooCalendar.egg-info/PKG-INFO 2019-03-22 15:55:27.000000000 +0100 @@ -1,12 +1,11 @@ -Metadata-Version: 1.1 +Metadata-Version: 1.2 Name: GooCalendar -Version: 0.4 +Version: 0.5 Summary: A calendar widget for GTK using PyGoocanvas Home-page: https://goocalendar.tryton.org/ Author: Cédric Krier Author-email: [email protected] License: GPL-2 -Description-Content-Type: UNKNOWN Description: GooCalendar =========== @@ -32,9 +31,9 @@ Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: GNU General Public License v2 (GPLv2) Classifier: Operating System :: OS Independent -Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 Classifier: Topic :: Software Development :: Libraries :: Python Modules Classifier: Topic :: Software Development :: Widget Sets +Requires-Python: >=3.4 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/GooCalendar-0.4/GooCalendar.egg-info/SOURCES.txt new/GooCalendar-0.5/GooCalendar.egg-info/SOURCES.txt --- old/GooCalendar-0.4/GooCalendar.egg-info/SOURCES.txt 2018-06-26 10:42:21.000000000 +0200 +++ new/GooCalendar-0.5/GooCalendar.egg-info/SOURCES.txt 2019-03-22 15:55:27.000000000 +0100 @@ -14,7 +14,6 @@ doc/conf.py doc/index.rst examples/simple.py -examples/simple3.py goocalendar/__init__.py goocalendar/_calendar.py goocalendar/_event.py diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/GooCalendar-0.4/INSTALL new/GooCalendar-0.5/INSTALL --- old/GooCalendar-0.4/INSTALL 2016-09-12 20:55:07.000000000 +0200 +++ new/GooCalendar-0.5/INSTALL 2019-02-22 16:28:13.000000000 +0100 @@ -6,7 +6,7 @@ * Python (http://www.python.org/) * GooCanvas >= 2.0 (https://wiki.gnome.org/Projects/GooCanvas) - * Optional: PyGoocanvas (https://wiki.gnome.org/Projects/PyGoocanvas) + * gtk+ 3.20 or later and py-gobject3 3.20 or later (http://www.gtk.org/) Installation ------------ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/GooCalendar-0.4/PKG-INFO new/GooCalendar-0.5/PKG-INFO --- old/GooCalendar-0.4/PKG-INFO 2018-06-26 10:42:21.000000000 +0200 +++ new/GooCalendar-0.5/PKG-INFO 2019-03-22 15:55:27.000000000 +0100 @@ -1,12 +1,11 @@ -Metadata-Version: 1.1 +Metadata-Version: 1.2 Name: GooCalendar -Version: 0.4 +Version: 0.5 Summary: A calendar widget for GTK using PyGoocanvas Home-page: https://goocalendar.tryton.org/ Author: Cédric Krier Author-email: [email protected] License: GPL-2 -Description-Content-Type: UNKNOWN Description: GooCalendar =========== @@ -32,9 +31,9 @@ Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: GNU General Public License v2 (GPLv2) Classifier: Operating System :: OS Independent -Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 Classifier: Topic :: Software Development :: Libraries :: Python Modules Classifier: Topic :: Software Development :: Widget Sets +Requires-Python: >=3.4 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/GooCalendar-0.4/doc/conf.py new/GooCalendar-0.5/doc/conf.py --- old/GooCalendar-0.4/doc/conf.py 2016-11-28 15:43:21.000000000 +0100 +++ new/GooCalendar-0.5/doc/conf.py 2019-02-22 16:21:57.000000000 +0100 @@ -38,17 +38,17 @@ master_doc = 'index' # General information about the project. -project = u'GooCalendar' -copyright = u'2012, Samuel Abels, Cédric Krier, Antoine Smolders' +project = 'GooCalendar' +copyright = '2012, Samuel Abels, Cédric Krier, Antoine Smolders' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. -version = '0.3' +version = '0.5' # The full version, including alpha/beta/rc tags. -release = '0.4' +release = '0.5' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. @@ -181,8 +181,8 @@ # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass [howto/manual]) latex_documents = [ - ('index', 'GooCalendar.tex', u'GooCalendar Documentation', - u'Samuel Abels, Cédric Krier, Antoine Smolders', 'manual'), + ('index', 'GooCalendar.tex', 'GooCalendar Documentation', + 'Samuel Abels, Cédric Krier, Antoine Smolders', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of @@ -211,8 +211,8 @@ # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ - ('index', 'goocalendar', u'GooCalendar Documentation', - [u'Samuel Abels, Cédric Krier, Antoine Smolders'], 1) + ('index', 'goocalendar', 'GooCalendar Documentation', + ['Samuel Abels, Cédric Krier, Antoine Smolders'], 1) ] # If true, show URL addresses after external links. @@ -225,8 +225,8 @@ # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ - ('index', 'GooCalendar', u'GooCalendar Documentation', - u'Samuel Abels, Cédric Krier, Antoine Smolders', 'GooCalendar', + ('index', 'GooCalendar', 'GooCalendar Documentation', + 'Samuel Abels, Cédric Krier, Antoine Smolders', 'GooCalendar', 'One line description of project.', 'Miscellaneous'), ] @@ -244,10 +244,10 @@ # -- Options for Epub output -------------------------------------------------- # Bibliographic Dublin Core info. -epub_title = u'GooCalendar' -epub_author = u'Samuel Abels, Cédric Krier, Antoine Smolders' -epub_publisher = u'Samuel Abels, Cédric Krier, Antoine Smolders' -epub_copyright = u'2012, Samuel Abels, Cédric Krier, Antoine Smolders' +epub_title = 'GooCalendar' +epub_author = 'Samuel Abels, Cédric Krier, Antoine Smolders' +epub_publisher = 'Samuel Abels, Cédric Krier, Antoine Smolders' +epub_copyright = '2012, Samuel Abels, Cédric Krier, Antoine Smolders' # The language of the text. It defaults to the language option # or en if the language is not set. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/GooCalendar-0.4/examples/simple.py new/GooCalendar-0.5/examples/simple.py --- old/GooCalendar-0.4/examples/simple.py 2016-09-12 14:31:33.000000000 +0200 +++ new/GooCalendar-0.5/examples/simple.py 2019-02-22 17:26:34.000000000 +0100 @@ -1,77 +1,79 @@ # This file is part of GooCalendar. The COPYRIGHT file at the top level of # this repository contains the full copyright notices and license terms. -import datetime - -import gtk -import goocalendar +import datetime +from goocalendar import Calendar, Event, EventStore +from gi.repository import Gdk, Gtk def on_event_pressed(calendar, event, event_store): - print "Event %s was pressed" % event.caption + print("Event %s was pressed" % event.caption) def on_day_selected(calendar, day): - print "Day %s was selected" % day + print("Day %s was selected" % day) def on_key_pressed(widget, event): - if (event.state & gtk.gdk.CONTROL_MASK and - event.keyval == gtk.gdk.keyval_from_name('l')): + if (event.state & Gdk.ModifierType.CONTROL_MASK + and event.keyval == Gdk.KEY_l): if widget.view == 'week': + widget.set_view('day') + elif widget.view == 'day': widget.set_view('month') else: widget.set_view('week') -window = gtk.Window() -event_store = goocalendar.EventStore() -calendar = goocalendar.Calendar(event_store) + +window = Gtk.Window() +event_store = EventStore() +calendar = Calendar(event_store) calendar.set_has_tooltip(True) # Normal events. -event = goocalendar.Event('Event number 1', - datetime.datetime(2007, 10, 8, 02), +event = Event('Event number 1', + datetime.datetime(2007, 10, 8, 2), datetime.datetime(2007, 10, 8, 17), bg_color='lightgreen') event_store.add(event) -event = goocalendar.Event('Event number 2', +event = Event('Event number 2', datetime.datetime(2007, 10, 8, 12), datetime.datetime(2007, 10, 8, 14), bg_color='lightblue') event_store.add(event) -event = goocalendar.Event('Event number 3', +event = Event('Event number 3', datetime.datetime(2007, 10, 8, 15), datetime.datetime(2007, 10, 8, 16, 30), bg_color='lightgrey') event_store.add(event) -event = goocalendar.Event('Event number 3b', +event = Event('Event number 3b', datetime.datetime(2007, 10, 8, 15, 30), datetime.datetime(2007, 10, 8, 17, 15), bg_color='lightgrey') event_store.add(event) -event = goocalendar.Event('Event number 4', +event = Event('Event number 4', datetime.datetime(2007, 10, 8, 17), datetime.datetime(2007, 10, 8, 18), bg_color='yellow') event_store.add(event) # A singularity event. -event = goocalendar.Event('Singularity', +event = Event('Singularity', datetime.datetime(2007, 10, 7, 12), datetime.datetime(2007, 10, 7, 12)) event_store.add(event) # A normal multi-day event. -event = goocalendar.Event('Long Event', +event = Event('Long Event', datetime.datetime(2007, 10, 9), datetime.datetime(2007, 10, 11)) event_store.add(event) # The following events are all-day events and displayed differently in # week mode. -event = goocalendar.Event('One-day Event', datetime.datetime(2007, 10, 9)) +event = Event('One-day Event', datetime.datetime(2007, 10, 9)) event_store.add(event) -event = goocalendar.Event('Four-day Event', +event = Event('Four-day Event', datetime.datetime(2007, 10, 9), datetime.datetime(2007, 10, 12), all_day=True, @@ -84,8 +86,8 @@ window.set_size_request(400, 400) window.show_all() -window.connect('delete-event', gtk.main_quit) +window.connect('delete-event', Gtk.main_quit) calendar.connect('event-pressed', on_event_pressed, event_store) calendar.connect('day-selected', on_day_selected) calendar.connect('key-press-event', on_key_pressed) -gtk.main() +Gtk.main() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/GooCalendar-0.4/examples/simple3.py new/GooCalendar-0.5/examples/simple3.py --- old/GooCalendar-0.4/examples/simple3.py 2016-09-06 16:00:20.000000000 +0200 +++ new/GooCalendar-0.5/examples/simple3.py 1970-01-01 01:00:00.000000000 +0100 @@ -1,7 +0,0 @@ -# This file is part of GooCalendar. The COPYRIGHT file at the top level of -# this repository contains the full copyright notices and license terms. -import pygtkcompat -pygtkcompat.enable() -pygtkcompat.enable_gtk(version='3.0') -pygtkcompat.enable_goocanvas() -import simple diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/GooCalendar-0.4/goocalendar/__init__.py new/GooCalendar-0.5/goocalendar/__init__.py --- old/GooCalendar-0.4/goocalendar/__init__.py 2018-05-08 15:41:42.000000000 +0200 +++ new/GooCalendar-0.5/goocalendar/__init__.py 2019-03-05 12:52:16.000000000 +0100 @@ -1,18 +1,11 @@ # This file is part of GooCalendar. The COPYRIGHT file at the top level of # this repository contains the full copyright notices and license terms. -import goocanvas -import pango - -if not hasattr(goocanvas, 'Text'): - goocanvas.Text = goocanvas.CanvasText - -if hasattr(pango, 'Rectangle'): - def getitem(self, i): - return [self.x, self.y, self.width, self.height][i] - pango.Rectangle.__getitem__ = getitem - +import gi +gi.require_version('Gtk', '3.0') +gi.require_version('Gdk', '3.0') +gi.require_version('GooCanvas', '2.0') from ._calendar import Calendar from ._event import Event, EventStore __all__ = ['Calendar', 'EventStore', 'Event'] -__version__ = '0.4' +__version__ = '0.5' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/GooCalendar-0.4/goocalendar/_calendar.py new/GooCalendar-0.5/goocalendar/_calendar.py --- old/GooCalendar-0.4/goocalendar/_calendar.py 2018-06-21 23:54:53.000000000 +0200 +++ new/GooCalendar-0.5/goocalendar/_calendar.py 2019-02-23 10:38:17.000000000 +0100 @@ -5,40 +5,37 @@ import math from operator import add -import gtk -import gobject -import goocanvas -import pango +from gi.repository import Gdk, GObject, GooCanvas, Gtk, Pango from . import util -class Calendar(goocanvas.Canvas): - AVAILABLE_VIEWS = ["month", "week"] +class Calendar(GooCanvas.Canvas): + AVAILABLE_VIEWS = ["month", "week", "day"] MIN_PER_LEVEL = 15 # Number of minutes per graduation for drag and drop __gproperties__ = { - 'text-color': (gobject.TYPE_STRING, '#2E3634', "Text Color", - "The color of the text", gobject.PARAM_READWRITE), - 'inactive-text-color': (gobject.TYPE_STRING, '#8B8F8E', + 'text-color': (GObject.TYPE_STRING, '#2E3634', "Text Color", + "The color of the text", GObject.ParamFlags.READWRITE), + 'inactive-text-color': (GObject.TYPE_STRING, '#8B8F8E', "Inactive Text Color", "The color of the inactive text", - gobject.PARAM_READWRITE), - 'border-color': (gobject.TYPE_STRING, '#D2D0D2', "Border Color", - "The color of border", gobject.PARAM_READWRITE), - 'selected-border-color': (gobject.TYPE_STRING, '#5EC590', + GObject.ParamFlags.READWRITE), + 'border-color': (GObject.TYPE_STRING, '#D2D0D2', "Border Color", + "The color of border", GObject.ParamFlags.READWRITE), + 'selected-border-color': (GObject.TYPE_STRING, '#5EC590', "Selected Border Color", "The color of selected border", - gobject.PARAM_READWRITE), - 'inactive-border-color': (gobject.TYPE_STRING, '#E8E7E8', + GObject.ParamFlags.READWRITE), + 'inactive-border-color': (GObject.TYPE_STRING, '#E8E7E8', "Inactive Border Color", "The color of inactive border", - gobject.PARAM_READWRITE), - 'body-color': (gobject.TYPE_STRING, 'white', "Body Color", - "The color of the body", gobject.PARAM_READWRITE), - 'today-body-color': (gobject.TYPE_STRING, 'ivory', "Today Body Color", - "The color of the today body", gobject.PARAM_READWRITE), + GObject.ParamFlags.READWRITE), + 'body-color': (GObject.TYPE_STRING, 'white', "Body Color", + "The color of the body", GObject.ParamFlags.READWRITE), + 'today-body-color': (GObject.TYPE_STRING, 'ivory', "Today Body Color", + "The color of the today body", GObject.ParamFlags.READWRITE), # TODO font - 'font-desc': (gobject.TYPE_PYOBJECT, "Font Description", + 'font-desc': (GObject.TYPE_PYOBJECT, "Font Description", "The attributes specifying which font to use", - gobject.PARAM_READWRITE), + GObject.ParamFlags.READWRITE), } def __init__(self, event_store=None, view="month", time_format="%H:%M", @@ -81,27 +78,25 @@ self.selected_date = datetime.date.today() self.time_format = time_format self.set_bounds(0, 0, 200, 200) - if hasattr(self, 'set_flags'): - self.set_flags(gtk.CAN_FOCUS) - else: - self.set_can_focus(True) - self.set_events(gtk.gdk.EXPOSURE_MASK - | gtk.gdk.BUTTON_PRESS_MASK - | gtk.gdk.BUTTON_RELEASE_MASK - | gtk.gdk.POINTER_MOTION_MASK - | gtk.gdk.POINTER_MOTION_HINT_MASK - | gtk.gdk.KEY_PRESS_MASK - | gtk.gdk.KEY_RELEASE_MASK - | gtk.gdk.ENTER_NOTIFY_MASK - | gtk.gdk.LEAVE_NOTIFY_MASK - | gtk.gdk.FOCUS_CHANGE_MASK) + self.set_can_focus(True) + self.set_events( + Gdk.EventMask.EXPOSURE_MASK + | Gdk.EventMask.BUTTON_PRESS_MASK + | Gdk.EventMask.BUTTON_RELEASE_MASK + | Gdk.EventMask.POINTER_MOTION_MASK + | Gdk.EventMask.POINTER_MOTION_HINT_MASK + | Gdk.EventMask.KEY_PRESS_MASK + | Gdk.EventMask.KEY_RELEASE_MASK + | Gdk.EventMask.ENTER_NOTIFY_MASK + | Gdk.EventMask.LEAVE_NOTIFY_MASK + | Gdk.EventMask.FOCUS_CHANGE_MASK) self.connect_after('realize', self.on_realize) self.connect('size-allocate', self.on_size_allocate) self.connect('key-press-event', self.on_key_press_event) # Initialize background, timeline and days and add them to canvas root = self.get_root_item() - self._bg_rect = goocanvas.Rect(parent=root, x=0, y=0, + self._bg_rect = GooCanvas.CanvasRect(parent=root, x=0, y=0, stroke_color='white', fill_color='white') self._timeline = TimelineItem(self, time_format=self.time_format) root.add_child(self._timeline, -1) @@ -122,11 +117,8 @@ def do_get_property(self, prop): if prop.name == 'font-desc': if self._font_desc is None: - if hasattr(self, 'get_style_context'): - return self.get_style_context().get_font( - gtk.STATE_FLAG_NORMAL) - else: - return self.get_style().font_desc + self._font_desc = self.get_style_context().get_property( + 'font', Gtk.StateFlags.NORMAL) return self._font_desc else: return self.__props[prop.name] @@ -145,6 +137,8 @@ old_first_weekday = util.first_day_of_week(cal, old_date) new_first_weekday = util.first_day_of_week(cal, new_date) page_changed = old_first_weekday != new_first_weekday + elif self.view == "day": + page_changed = old_date != new_date # This is slow: When the month was changed we need to update # the entire canvas. @@ -183,18 +177,14 @@ def previous_page(self): cal = calendar.Calendar(self.firstweekday) - if self.view == "month": - new_date = util.previous_month(cal, self.selected_date) - elif self.view == "week": - new_date = util.previous_week(cal, self.selected_date) + new_date = getattr( + util, 'previous_%s' % self.view)(cal, self.selected_date) self.select(new_date) def next_page(self): cal = calendar.Calendar(self.firstweekday) - if self.view == "month": - new_date = util.next_month(cal, self.selected_date) - elif self.view == "week": - new_date = util.next_month(cal, self.selected_date) + new_date = getattr( + util, 'next_%s' % self.view)(cal, self.selected_date) self.select(new_date) def set_view(self, level): @@ -250,6 +240,8 @@ self.draw_month() elif self.view == "week": self.draw_week() + elif self.view == "day": + self.draw_day() self.draw_events() def draw_background(self): @@ -257,6 +249,60 @@ self._bg_rect.set_property('width', w) self._bg_rect.set_property('height', h) + def draw_day(self): + """ + Draws the currently selected day. + """ + pango_size = self.props.font_desc.get_size() + x, y, w, h = self.get_bounds() + timeline_w = self._timeline.width + dayno = self.selected_date.weekday() + day_name = calendar.day_name[dayno] + # Sum the needed space for the date before the day_name + caption_size = len(day_name) + 3 + day_width_min = caption_size * pango_size / Pango.SCALE + day_width_max = (w - timeline_w) + self._day_width = max(day_width_min, day_width_max) + self._day_height = h + width, height = self.get_size_request() + new_width = int(timeline_w + self._day_width) + if (width != new_width and day_width_min >= day_width_max): + self.set_size_request(new_width, height) # Minimum widget size + + # Redraw all days. + cal = calendar.Calendar(self.firstweekday) + weeks = util.my_monthdatescalendar(cal, self.selected_date) + for weekno, week in enumerate(weeks): + # Hide all days that are not part of the current day + if self.selected_date not in week: + for dayno, date in enumerate(week): + box = self.days[weekno * 7 + dayno] + box.set_property( + 'visibility', GooCanvas.CanvasItemVisibility.INVISIBLE) + continue + + if self.selected_date == datetime.date.today(): + the_body_color = self.props.today_body_color + else: + the_body_color = self.props.body_color + + # Draw. + box = self.days[weekno * 7 + dayno] + box.x = timeline_w + box.y = 0 + box.width = self._day_width - 2 + box.height = self._day_height + box.type = 'day' + box.date = self.selected_date + box.full_border = True + box.border_color = self.props.selected_border_color + box.body_color = the_body_color + box.title_text_color = self.props.text_color + box.event_text_color = self.props.text_color + box.set_property( + 'visibility', GooCanvas.CanvasItemVisibility.VISIBLE) + box.update() + def draw_week(self): """ Draws the currently selected week. @@ -266,7 +312,7 @@ timeline_w = self._timeline.width caption_size = max(len(day_name) for day_name in calendar.day_name) caption_size += 3 # The needed space for the date before the day_name - day_width_min = caption_size * pango_size / pango.SCALE + day_width_min = caption_size * pango_size / Pango.SCALE day_width_max = (w - timeline_w) / 7 self._day_width = max(day_width_min, day_width_max) self._day_height = h @@ -283,7 +329,8 @@ if self.selected_date not in week: for dayno, date in enumerate(week): box = self.days[weekno * 7 + dayno] - box.set_property('visibility', goocanvas.ITEM_INVISIBLE) + box.set_property( + 'visibility', GooCanvas.CanvasItemVisibility.INVISIBLE) continue # Draw the days that are part of the current week. @@ -312,7 +359,8 @@ box.body_color = the_body_color box.title_text_color = self.props.text_color box.event_text_color = self.props.text_color - box.set_property('visibility', goocanvas.ITEM_VISIBLE) + box.set_property( + 'visibility', GooCanvas.CanvasItemVisibility.VISIBLE) box.update() if selected: @@ -327,14 +375,15 @@ pango_size = self.props.font_desc.get_size() caption_size = max(len(day_name) for day_name in calendar.day_name) caption_size += 3 # The needed space for the date before the day_name - day_width_min = caption_size * pango_size / pango.SCALE + day_width_min = caption_size * pango_size / Pango.SCALE day_width_max = w / 7 self._day_width = max(day_width_min, day_width_max) self._day_height = h / 6 # Hide the timeline. if self._timeline is not None: - self._timeline.set_property('visibility', goocanvas.ITEM_INVISIBLE) + self._timeline.set_property( + 'visibility', GooCanvas.CanvasItemVisibility.INVISIBLE) # Draw the grid. y_pos = 0 @@ -373,7 +422,8 @@ box.title_text_color = the_text_color box.event_text_color = the_text_color box.type = 'month' - box.set_property('visibility', goocanvas.ITEM_VISIBLE) + box.set_property( + 'visibility', GooCanvas.CanvasItemVisibility.VISIBLE) box.update() if selected: @@ -436,6 +486,8 @@ return None def draw_events(self): + _, _, bound_width, _ = self.get_bounds() + timeline_witdh = self._timeline.width # Clear previous events. for item in self._event_items: item.remove() @@ -454,8 +506,10 @@ dates = [] for week in weeks: dates += week - else: + elif self.view == "week": dates = util.my_weekdatescalendar(cal, self.selected_date) + else: + dates = [self.selected_date] # Retrieve a list of all events in the current time span, # and sort them by event length. @@ -472,8 +526,8 @@ non_all_day_events = [] for event in events: event.event_items = [] - # Handle non-all-day events differently in week mode. - if (self.view == "week" and not event.all_day + # Handle non-all-day events differently in week and day modes. + if (self.view in {"week", "day"} and not event.all_day and not event.multidays): non_all_day_events.append(event) continue @@ -523,12 +577,18 @@ self.on_event_item_motion_notified) self._event_items.append(event_item) self.get_root_item().add_child(event_item, -1) - event_item.x = day.x - event_item.left_border = day.x + 2 + if self.view == "day": + x_start = timeline_witdh + width = bound_width + else: + x_start = day.x + width = (day.width + 2) * len(week) + event_item.x = x_start + event_item.left_border = x_start + 2 event_item.y = day.y + (free_line + 1) * day.line_height event_item.y += free_line * 2 # 2px of margin per line event_item.y += 1 # 1px padding-top - event_item.width = (day.width + 2) * len(week) + event_item.width = width event_item.height = day.line_height week_start = week[0].date week_end = week[-1].date @@ -550,11 +610,12 @@ event_item.type = 'leftright' event_item.update() - if self.view != "week": + if self.view == "month": return # Redraw the timeline. - self._timeline.set_property('visibility', goocanvas.ITEM_VISIBLE) + self._timeline.set_property( + 'visibility', GooCanvas.CanvasItemVisibility.VISIBLE) x, y, w, h = self.get_bounds() self._timeline.x = x self._timeline.y = max_y @@ -627,9 +688,14 @@ self.get_root_item().add_child(event_item, -1) y_off1 = top_offset_mins * self.minute_height y_off2 = bottom_offset_mins * self.minute_height - column_width = day.width / parallel - event_item.left_border = day.x + 2 - event_item.x = day.x + (columnno * column_width) + 2 + if self.view == "day": + x_start = timeline_witdh + column_width = w / parallel + else: + column_width = day.width / parallel + x_start = day.x + event_item.left_border = x_start + 2 + event_item.x = x_start + (columnno * column_width) + 2 event_item.y = max_y + y_off1 event_item.width = column_width - 4 if columnno != (parallel - 1): @@ -656,13 +722,13 @@ def on_key_press_event(self, widget, event): date = self.selected_date - if event.keyval == gtk.gdk.keyval_from_name('Up'): + if event.keyval == Gdk.KEY_Up: self.select(date - datetime.timedelta(7)) - elif event.keyval == gtk.gdk.keyval_from_name('Down'): + elif event.keyval == Gdk.KEY_Down: self.select(date + datetime.timedelta(7)) - elif event.keyval == gtk.gdk.keyval_from_name('Left'): + elif event.keyval == Gdk.KEY_Left: self.select(date - datetime.timedelta(1)) - elif event.keyval == gtk.gdk.keyval_from_name('Right'): + elif event.keyval == Gdk.KEY_Right: self.select(date + datetime.timedelta(1)) @util.left_click @@ -674,7 +740,7 @@ self.emit('day-activated', day.date) def _is_double_click(self, event): - gtk_settings = gtk.settings_get_default() + gtk_settings = Gtk.Settings.get_default() double_click_distance = gtk_settings.props.gtk_double_click_distance double_click_time = gtk_settings.props.gtk_double_click_time if (self._last_click_x is not None and @@ -695,6 +761,8 @@ """ Return the date of the day_item pointed by two coordinates [x,y] """ + if self.view == 'day': + return self.selected_date # Get current week cal = calendar.Calendar(self.firstweekday) weeks = util.my_monthdatescalendar(cal, self.selected_date) @@ -893,49 +961,49 @@ self._drag_height -= pxdelta -gobject.signal_new('event-pressed', +GObject.signal_new('event-pressed', Calendar, - gobject.SIGNAL_RUN_FIRST, - gobject.TYPE_NONE, - (gobject.TYPE_PYOBJECT,)) -gobject.signal_new('event-activated', + GObject.SignalFlags.RUN_FIRST, + GObject.TYPE_NONE, + (GObject.TYPE_PYOBJECT,)) +GObject.signal_new('event-activated', Calendar, - gobject.SIGNAL_RUN_FIRST, - gobject.TYPE_NONE, - (gobject.TYPE_PYOBJECT,)) -gobject.signal_new('event-released', + GObject.SignalFlags.RUN_FIRST, + GObject.TYPE_NONE, + (GObject.TYPE_PYOBJECT,)) +GObject.signal_new('event-released', Calendar, - gobject.SIGNAL_RUN_FIRST, - gobject.TYPE_NONE, - (gobject.TYPE_PYOBJECT,)) -gobject.signal_new('day-pressed', + GObject.SignalFlags.RUN_FIRST, + GObject.TYPE_NONE, + (GObject.TYPE_PYOBJECT,)) +GObject.signal_new('day-pressed', Calendar, - gobject.SIGNAL_RUN_FIRST, - gobject.TYPE_NONE, - (gobject.TYPE_PYOBJECT,)) -gobject.signal_new('day-activated', + GObject.SignalFlags.RUN_FIRST, + GObject.TYPE_NONE, + (GObject.TYPE_PYOBJECT,)) +GObject.signal_new('day-activated', Calendar, - gobject.SIGNAL_RUN_FIRST, - gobject.TYPE_NONE, - (gobject.TYPE_PYOBJECT,)) -gobject.signal_new('day-selected', + GObject.SignalFlags.RUN_FIRST, + GObject.TYPE_NONE, + (GObject.TYPE_PYOBJECT,)) +GObject.signal_new('day-selected', Calendar, - gobject.SIGNAL_RUN_FIRST, - gobject.TYPE_NONE, - (gobject.TYPE_PYOBJECT,)) -gobject.signal_new('view-changed', + GObject.SignalFlags.RUN_FIRST, + GObject.TYPE_NONE, + (GObject.TYPE_PYOBJECT,)) +GObject.signal_new('view-changed', Calendar, - gobject.SIGNAL_RUN_FIRST, - gobject.TYPE_NONE, - (gobject.TYPE_PYOBJECT,)) -gobject.signal_new('page-changed', + GObject.SignalFlags.RUN_FIRST, + GObject.TYPE_NONE, + (GObject.TYPE_PYOBJECT,)) +GObject.signal_new('page-changed', Calendar, - gobject.SIGNAL_RUN_FIRST, - gobject.TYPE_NONE, - (gobject.TYPE_PYOBJECT,)) + GObject.SignalFlags.RUN_FIRST, + GObject.TYPE_NONE, + (GObject.TYPE_PYOBJECT,)) -class DayItem(goocanvas.Group): +class DayItem(GooCanvas.CanvasGroup): """ A canvas item representing a day. """ @@ -960,10 +1028,10 @@ self.line_height = 0 # Create canvas items. - self.border = goocanvas.Rect(parent=self) - self.text = goocanvas.Text(parent=self) - self.box = goocanvas.Rect(parent=self) - self.indic = goocanvas.Rect(parent=self) + self.border = GooCanvas.CanvasRect(parent=self) + self.text = GooCanvas.CanvasText(parent=self) + self.box = GooCanvas.CanvasRect(parent=self) + self.indic = GooCanvas.CanvasRect(parent=self) def update(self): if not self.date: @@ -974,8 +1042,8 @@ caption = '%s %s' % (self.date.day, day_name) self.text.set_property('font-desc', self._cal.props.font_desc) self.text.set_property('text', caption) - logical_height = self.text.get_natural_extents()[1][3] - line_height = int(math.ceil(float(logical_height) / pango.SCALE)) + logical_height = self.text.get_natural_extents()[1].height + line_height = int(math.ceil(float(logical_height) / Pango.SCALE)) self.line_height = line_height # Draw the border. @@ -1015,10 +1083,12 @@ # Show an indicator in the title, if requested. if not self.show_indic: - self.indic.set_property('visibility', goocanvas.ITEM_INVISIBLE) + self.indic.set_property( + 'visibility', GooCanvas.CanvasItemVisibility.INVISIBLE) return - self.indic.set_property('visibility', goocanvas.ITEM_VISIBLE) + self.indic.set_property( + 'visibility', GooCanvas.CanvasItemVisibility.VISIBLE) self.indic.set_property('x', self.x + self.width - line_height / 1.5) self.indic.set_property('y', self.y + line_height / 3) @@ -1038,7 +1108,7 @@ self.indic.set_property('clip_path', path) -class EventItem(goocanvas.Group): +class EventItem(GooCanvas.CanvasGroup): """ A canvas item representing an event. """ @@ -1060,11 +1130,11 @@ self.no_caption = False # Create canvas items. - self.box = goocanvas.Rect(parent=self) - self.text = goocanvas.Text(parent=self) + self.box = GooCanvas.CanvasRect(parent=self) + self.text = GooCanvas.CanvasText(parent=self) self.text.set_property('font-desc', self._cal.props.font_desc) - logical_height = self.text.get_natural_extents()[1][3] - self.line_height = logical_height / pango.SCALE + logical_height = self.text.get_natural_extents()[1].height + self.line_height = logical_height / Pango.SCALE if self.x is not None: self.update() @@ -1085,13 +1155,13 @@ # Do we have enough width for caption first_line = starttime + ' - ' + endtime self.text.set_property('text', first_line) - logical_width = self.text.get_natural_extents()[1][2] / pango.SCALE + logical_width = self.text.get_natural_extents()[1].width / Pango.SCALE if self.width < logical_width: first_line = starttime + ' - ' second_line = self.event.caption self.text.set_property('text', second_line) - logical_width = self.text.get_natural_extents()[1][2] / pango.SCALE + logical_width = self.text.get_natural_extents()[1].width / Pango.SCALE if self.width < logical_width: second_line = None @@ -1122,8 +1192,8 @@ bg_rgba_color = self.box.get_property('stroke_color_rgba') bg_colors = list(util.rgba_to_colors(bg_rgba_color)) # We make background color 1/4 brighter (+64 over 255) - bg_colors[:3] = map(min, - map(add, bg_colors[:3], (64,) * 3), (255,) * 3) + bg_colors[:3] = list(map(min, + list(map(add, bg_colors[:3], (64,) * 3)), (255,) * 3)) bg_colors = util.colors_to_rgba(*bg_colors) self.box.set_property('fill_color_rgba', bg_colors) @@ -1177,8 +1247,8 @@ caption = '' if self.no_caption else caption the_event_bg_color = self.event.bg_color self.text.set_property('text', caption) - logical_height = self.text.get_natural_extents()[1][3] - self.height = logical_height / pango.SCALE + logical_height = self.text.get_natural_extents()[1].height + self.height = logical_height / Pango.SCALE # Choose text color. if self.event.text_color is None: @@ -1194,8 +1264,8 @@ self.box.set_property('stroke_color', the_event_bg_color) bg_rgba_color = self.box.get_property('stroke_color_rgba') bg_colors = list(util.rgba_to_colors(bg_rgba_color)) - bg_colors[:3] = map(min, - map(add, bg_colors[:3], (64,) * 3), (255,) * 3) + bg_colors[:3] = list(map(min, + list(map(add, bg_colors[:3], (64,) * 3)), (255,) * 3)) bg_colors = util.colors_to_rgba(*bg_colors) self.box.set_property('fill_color_rgba', bg_colors) transparent_color = self.box.get_property('fill_color_rgba') - 128 @@ -1217,7 +1287,7 @@ self.text.set_property('clip_path', path) -class TimelineItem(goocanvas.Group): +class TimelineItem(GooCanvas.CanvasGroup): """ A canvas item representing a timeline. """ @@ -1239,8 +1309,9 @@ self._timeline_text = {} for n in range(24): caption = datetime.time(n).strftime(self.time_format) - self._timeline_rect[n] = goocanvas.Rect(parent=self) - self._timeline_text[n] = goocanvas.Text(parent=self, text=caption) + self._timeline_rect[n] = GooCanvas.CanvasRect(parent=self) + self._timeline_text[n] = GooCanvas.CanvasText( + parent=self, text=caption) if self.x is not None: self.update() @@ -1252,10 +1323,10 @@ for n in range(24): natural_extents = self._timeline_text[n].get_natural_extents() logical_rect = natural_extents[1] - logical_height = max(logical_height, logical_rect[3]) + logical_height = max(logical_height, logical_rect.height) ink_rect = natural_extents[0] - self.ink_padding_top = max(self.ink_padding_top, ink_rect[0]) - line_height = int(math.ceil(float(logical_height) / pango.SCALE)) + self.ink_padding_top = max(self.ink_padding_top, ink_rect.x) + line_height = int(math.ceil(float(logical_height) / Pango.SCALE)) return line_height @property @@ -1265,9 +1336,9 @@ if line_height < self.height / 24: line_height = self.height / 24 pango_size = self._cal.props.font_desc.get_size() - padding_top = (line_height - pango_size / pango.SCALE) / 2 - padding_top -= int(math.ceil(float(self.ink_padding_top) / - pango.SCALE)) + padding_top = (line_height - pango_size / Pango.SCALE) / 2 + padding_top -= int(math.ceil( + float(self.ink_padding_top) / Pango.SCALE)) self.padding_top = padding_top return line_height @@ -1279,10 +1350,10 @@ self._timeline_text[n].set_property('font-desc', font_desc) natural_extents = self._timeline_text[n].get_natural_extents() ink_rect = natural_extents[0] - ink_padding_left = max(ink_padding_left, ink_rect[0]) - ink_max_width = max(ink_max_width, ink_rect[2]) - self.width = int(math.ceil(float(ink_padding_left + ink_max_width) - / pango.SCALE)) + ink_padding_left = max(ink_padding_left, ink_rect.x) + ink_max_width = max(ink_max_width, ink_rect.width) + self.width = int(math.ceil( + float(ink_padding_left + ink_max_width) / Pango.SCALE)) def update(self): self._compute_width() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/GooCalendar-0.4/goocalendar/_event.py new/GooCalendar-0.5/goocalendar/_event.py --- old/GooCalendar-0.4/goocalendar/_event.py 2018-06-01 14:08:56.000000000 +0200 +++ new/GooCalendar-0.5/goocalendar/_event.py 2019-02-22 17:34:29.000000000 +0100 @@ -1,6 +1,6 @@ # This file is part of GooCalendar. The COPYRIGHT file at the top level of # this repository contains the full copyright notices and license terms. -import gobject +from gi.repository import GObject from . import util @@ -44,16 +44,16 @@ return (self.start, self.end) < (other_event.start, other_event.start) -class EventStore(gobject.GObject): +class EventStore(GObject.GObject): __gsignals__ = { - 'event-removed': (gobject.SIGNAL_RUN_FIRST, - gobject.TYPE_NONE, - (gobject.TYPE_PYOBJECT,)), - 'event-added': (gobject.SIGNAL_RUN_FIRST, - gobject.TYPE_NONE, - (gobject.TYPE_PYOBJECT,)), - 'events-cleared': (gobject.SIGNAL_RUN_FIRST, - gobject.TYPE_NONE, ())} + 'event-removed': (GObject.SignalFlags.RUN_FIRST, + GObject.TYPE_NONE, + (GObject.TYPE_PYOBJECT,)), + 'event-added': (GObject.SignalFlags.RUN_FIRST, + GObject.TYPE_NONE, + (GObject.TYPE_PYOBJECT,)), + 'events-cleared': (GObject.SignalFlags.RUN_FIRST, + GObject.TYPE_NONE, ())} def __init__(self): super(EventStore, self).__init__() @@ -90,9 +90,9 @@ and end times. """ if not start and not end: - return self._events.values() + return list(self._events.values()) events = [] - for event in self._events.values(): + for event in list(self._events.values()): if util.event_intersects(event, start, end): events.append(event) return events diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/GooCalendar-0.4/goocalendar/util.py new/GooCalendar-0.5/goocalendar/util.py --- old/GooCalendar-0.4/goocalendar/util.py 2018-06-01 14:11:04.000000000 +0200 +++ new/GooCalendar-0.5/goocalendar/util.py 2018-10-23 20:56:23.000000000 +0200 @@ -72,6 +72,14 @@ return date + datetime.timedelta(7) +def previous_day(cal, date): + return date - datetime.timedelta(1) + + +def next_day(cal, date): + return date + datetime.timedelta(1) + + def time_delta(datetime1, datetime2): delta = datetime1 - datetime2 if delta < datetime.timedelta(): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/GooCalendar-0.4/setup.py new/GooCalendar-0.5/setup.py --- old/GooCalendar-0.4/setup.py 2018-06-01 14:14:37.000000000 +0200 +++ new/GooCalendar-0.5/setup.py 2019-03-05 12:52:50.000000000 +0100 @@ -15,7 +15,7 @@ setup(name='GooCalendar', - version='0.4', + version='0.5', author='Cédric Krier', author_email='[email protected]', url='https://goocalendar.tryton.org/', @@ -28,7 +28,6 @@ 'Intended Audience :: Developers', 'License :: OSI Approved :: GNU General Public License v2 (GPLv2)', 'Operating System :: OS Independent', - 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', @@ -36,4 +35,5 @@ 'Topic :: Software Development :: Widget Sets', ], license='GPL-2', + python_requires='>=3.4', )
