diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-02-19 15:05:52 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-02-19 16:15:47 +0000 |
commit | b686174b07bd56af4e5ffaa23c24f27f417fc305 (patch) | |
tree | 1ce335620d99341d94e88c159c0b9b0f6f0de5a0 /deluge/plugins/Stats/deluge_stats/graph.py | |
parent | Adding debian version 2.0.3-4. (diff) | |
download | deluge-b686174b07bd56af4e5ffaa23c24f27f417fc305.tar.xz deluge-b686174b07bd56af4e5ffaa23c24f27f417fc305.zip |
Merging upstream version 2.1.1 (Closes: #1026291).
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'deluge/plugins/Stats/deluge_stats/graph.py')
-rw-r--r-- | deluge/plugins/Stats/deluge_stats/graph.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/deluge/plugins/Stats/deluge_stats/graph.py b/deluge/plugins/Stats/deluge_stats/graph.py index 847c253..0d3220f 100644 --- a/deluge/plugins/Stats/deluge_stats/graph.py +++ b/deluge/plugins/Stats/deluge_stats/graph.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Copyright (C) 2009 Ian Martin <ianmartin@cantab.net> # Copyright (C) 2008 Damien Churchill <damoxc@gmail.com> @@ -14,13 +13,15 @@ port of old plugin by markybob. """ -from __future__ import division, unicode_literals - import logging import math import time -from gi.repository import cairo +import gi + +gi.require_foreign('cairo') + +import cairo # isort:skip (gi checks required before import). log = logging.getLogger(__name__) @@ -58,7 +59,7 @@ def change_opacity(color, opactiy): return tuple(color) -class Graph(object): +class Graph: def __init__(self): self.width = 100 self.height = 100 @@ -174,7 +175,7 @@ class Graph(object): te = self.ctx.text_extents(text) return math.ceil(te[4] - te[0]) - y_tick_width = max((space_required(text) for text in y_tick_text)) + y_tick_width = max(space_required(text) for text in y_tick_text) top = font_extents[2] / 2 # bounds(left, top, right, bottom) |