From c46a59e3b1e110cbf9c58a22f023d926aa2a7f8d Mon Sep 17 00:00:00 2001 From: DarkPhoenix Date: Sat, 25 Apr 2020 09:57:49 +0300 Subject: [PATCH] Fix gauge bars --- gui/pyfa_gauge.py | 4 ++-- gui/utils/draw.py | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/gui/pyfa_gauge.py b/gui/pyfa_gauge.py index 0681045a0..056ca1dfc 100644 --- a/gui/pyfa_gauge.py +++ b/gui/pyfa_gauge.py @@ -254,7 +254,6 @@ class PyGauge(wx.Window): w = rect.width else: w = rect.width * (float(value) / 100) - r = copy.copy(rect) r.width = w dc.DrawRectangle(r) @@ -315,7 +314,8 @@ class PyGauge(wx.Window): color, gradient_color ) - dc.DrawBitmap(gradient_bitmap, r.left, r.top) + if gradient_bitmap is not None: + dc.DrawBitmap(gradient_bitmap, r.left, r.top) # font stuff begins here dc.SetFont(self.font) diff --git a/gui/utils/draw.py b/gui/utils/draw.py index 992dbb9fb..4e486afda 100644 --- a/gui/utils/draw.py +++ b/gui/utils/draw.py @@ -35,6 +35,8 @@ def DrawFilledBitmap(width, height, color): def DrawGradientBar(width, height, gStart, gEnd, gMid=None, fillRatio=4): + if width == 0 or height == 0: + return None canvas = wx.Bitmap(width, height) mdc = wx.MemoryDC()