Skip to content

Commit 97583f4

Browse files
dmgermangitmsr
andauthored
Properly draw progress bar when timer advanced (#334)
if the number of pixels to advance per second was larger than one a non-existing function was being called. This has been addressed. Addresses #325 Also, removed spurious debugging print. Co-authored-by: Daniel M German <dmg@turingmachine.org>
1 parent f436bcd commit 97583f4

1 file changed

Lines changed: 10 additions & 15 deletions

File tree

Source/CountDown.spoon/init.lua

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,6 @@ function obj:show_message(msg, duration)
224224
if not duration then
225225
duration = obj.messageDuration
226226
end
227-
print(">>>>>>>>>>>>>>>>", duration)
228227
hs.alert.show(msg, obj.messageAttributes, nil, duration)
229228
end
230229

@@ -379,21 +378,17 @@ function obj:bar_create_timer()
379378
local secCount = math.ceil(60*minutes)
380379
obj.currentIcon = obj.menuBarIconActive
381380
obj.loopCount = 0
382-
383-
if mainRes.w/secCount >= minimumStep then
384-
-- do every second
385-
barTimer = hs.timer.doEvery(1, function()
386-
obj:bar_updateProgress()
387-
end)
388-
else
389-
-- we need few seconds to advance two pixels
390-
local interval = 2/(mainRes.w/secCount)
391-
barTimer = hs.timer.doEvery(interval,
392-
function()
393-
obj:barSetProgresspercentage(obj.barProgress)
394-
end
395-
)
381+
382+
local interval = 1
383+
384+
if mainRes.w/secCount < minimumStep then
385+
interval = 2/(mainRes.w/secCount)
396386
end
387+
barTimer = hs.timer.doEvery(interval,
388+
function()
389+
obj:bar_updateProgress()
390+
end
391+
)
397392
end
398393

399394
---- warning related functions

0 commit comments

Comments
 (0)