N3RDIUM / PyTaskbar

The Ultimate python taskbar progress package!
MIT License
18 stars 4 forks source link

Error state re-sets progress to 10% automatically #4

Open L1-0 opened 7 months ago

L1-0 commented 7 months ago

Describe the bug Somehow the setState 'warning' state behaves differently than the 'error' state.

To Reproduce I have the following code:

import time
import PyTaskbar
TaskBarStatus = PyTaskbar.Progress()
TaskBarStatus.init()

for i in range(20):
    time.sleep(0.7)
    TaskBarStatus.setProgress(100)
    TaskBarStatus.setState('error')
    time.sleep(0.7)
    TaskBarStatus.setProgress(100)
    TaskBarStatus.setState('warning')
    time.sleep(0.7)
    TaskBarStatus.setState('normal')

input("Press Enter to continue...")

Expected behavior This piece of code should make my taskbar flash red and yellow while keeping the bar full.

Screenshots Only the yellow warning state is being affected by the previous setProgress instruction. grafik

Desktop (please complete the following information):

L1-0 commented 7 months ago

So this one is on me, it works by setting the progress after setting the state. Still does not explain why i cannot set the progress first but works for me as a solution.

for i in range(20):
    time.sleep(0.7)
    TaskBarStatus.setState('error')
    TaskBarStatus.setProgress(100)
    time.sleep(0.7)
    TaskBarStatus.setState('warning')
    TaskBarStatus.setProgress(100)
    time.sleep(0.7)
    TaskBarStatus.setState('normal')