Staging
v0.5.1
v0.5.1
https://foss.heptapod.net/mercurial/hgview
Revision a13d9dfe73477485569262ebce6f8e1dd618fa73 authored by Mads Kiilerich on 04 April 2020, 02:09:16 UTC, committed by Mads Kiilerich on 04 April 2020, 02:09:16 UTC
Clarify the role of the Viewer stubs in hgviewlib/application.py . It is a mess to use multiple inheritance and super() and different parameter profiles in diferent parent/sibling classes. The empty Viewer stubs should thus not be used as interfaces / purely virtual base classes; they are just an example and documentation.
1 parent 4b52201
Tip revision: a13d9dfe73477485569262ebce6f8e1dd618fa73 authored by Mads Kiilerich on 04 April 2020, 02:09:16 UTC
qt5: simplify Viewer class hierarchy to work better with multiple inheritance of Qt classes
qt5: simplify Viewer class hierarchy to work better with multiple inheritance of Qt classes
Tip revision: a13d9df
decorators.py
# -*- coding: utf-8 -*-
"""
Some useful decorator functions
"""
from __future__ import print_function
import time
def timeit(func):
"""Decorator used to time the execution of a function"""
def timefunc(*args, **kwargs):
"""wrapper"""
t_1 = time.time()
t_2 = time.clock()
res = func(*args, **kwargs)
t_3 = time.clock()
t_4 = time.time()
print("%s: %.2fms (time) %.2fms (clock)" %
(func.__name__, 1000*(t_3 - t_2), 1000*(t_4 - t_1)))
return res
return timefunc
Computing file changes ...