summaryrefslogtreecommitdiffstats
path: root/Mac/Lib/EasyDialogs.py
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>1996-10-15 16:11:50 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>1996-10-15 16:11:50 (GMT)
commit3a4b3b0132a553444b29bbb9a04b28af71852660 (patch)
treee2fcbee7cf356142e4bd6d34f542a35cc3aa93ef /Mac/Lib/EasyDialogs.py
parent008ec689be2b6181259f6493eb5e90119c3d2f65 (diff)
downloadcpython-3a4b3b0132a553444b29bbb9a04b28af71852660.zip
cpython-3a4b3b0132a553444b29bbb9a04b28af71852660.tar.gz
cpython-3a4b3b0132a553444b29bbb9a04b28af71852660.tar.bz2
Fixed flashing in ProgressBar update.
Diffstat (limited to 'Mac/Lib/EasyDialogs.py')
-rw-r--r--Mac/Lib/EasyDialogs.py17
1 files changed, 8 insertions, 9 deletions
diff --git a/Mac/Lib/EasyDialogs.py b/Mac/Lib/EasyDialogs.py
index 9834ae1..9ad3858 100644
--- a/Mac/Lib/EasyDialogs.py
+++ b/Mac/Lib/EasyDialogs.py
@@ -118,7 +118,7 @@ class ProgressBar:
self.curval = -1
self.d = GetNewDialog(259, -1)
tp, text_h, rect = self.d.GetDialogItem(2)
- SetDialogItemText(text_h, "Progress...")
+ SetDialogItemText(text_h, label)
self._update(0)
def _update(self, value):
@@ -128,17 +128,16 @@ class ProgressBar:
Qd.FrameRect(bar_rect) # Draw outline
inner_rect = Qd.InsetRect(bar_rect, 1, 1)
- Qd.ForeColor(QuickDraw.whiteColor)
- Qd.BackColor(QuickDraw.whiteColor)
- Qd.PaintRect(inner_rect) # Clear internal
-
l, t, r, b = inner_rect
- r = int(l + (r-l)*value/self.maxval)
- inner_rect = l, t, r, b
+
Qd.ForeColor(QuickDraw.blackColor)
Qd.BackColor(QuickDraw.blackColor)
- Qd.PaintRect(inner_rect) # Draw bar
-
+ Qd.PaintRect((l, t, int(l + (r-l)*value/self.maxval), b)) # Draw bar
+
+ Qd.ForeColor(QuickDraw.whiteColor)
+ Qd.BackColor(QuickDraw.whiteColor)
+ Qd.PaintRect((int(l + (r-l)*value/self.maxval), t, r, b)) # Clear rest
+
# Restore settings
Qd.ForeColor(QuickDraw.blackColor)
Qd.BackColor(QuickDraw.whiteColor)