Staging
v0.5.1
https://foss.heptapod.net/mercurial/hgview
Revision 877880fe6fc9fccbb1a1f5ca5173a330295f2392 authored by alain leufroy on 09 May 2013, 14:17:05 UTC, committed by alain leufroy on 09 May 2013, 14:17:05 UTC
If the full widget height equal the displayed height, the stroke is 0.
So, the source is fully displayed.

This change fix a ZeroDivisionError.

:related to: #119019
1 parent a10b422
Raw File
Tip revision: 877880fe6fc9fccbb1a1f5ca5173a330295f2392 authored by alain leufroy on 09 May 2013, 14:17:05 UTC
[tui] fix source area stroke
Tip revision: 877880f
decorators.py
# -*- coding: utf-8 -*-
"""
Some useful decorator functions
"""
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.func_name, 1000*(t_3 - t_2), 1000*(t_4 - t_1))
        return res
    return timefunc
back to top