Changeset 8fb44c2 in flowtimer


Ignore:
Timestamp:
08/22/24 00:02:57 (9 months ago)
Author:
Enrico Schwass <ennoausberlin@…>
Branches:
guix
Children:
59f6e9a
Parents:
1fd7029
Message:

compute progress value from initial_ticks and ticks left

File:
1 edited

Legend:

Unmodified
Added
Removed
  • flowtimer/main.py

    r1fd7029 r8fb44c2  
    66from PIL import Image, ImageTk
    77from pathlib import Path
    8 import math
    98import datetime
    109
     
    2827        self.photo = ImageTk.PhotoImage(file=Path(__file__).parent /
    2928                                        'resources' / 'flowtimer_startbg_new.png')
    30         print(self.schedule.current_phase)
     29        print(self.schedule.current_phase.title)
    3130        self.show_config = self.schedule.current_phase.title
    3231        self.config_state = 'default'
    33         print(self.schedule)
    3432
    3533        self.build_gui()
     
    7775                                           style="orange.Horizontal.TProgressbar",
    7876                                           orient="horizontal", length=600, mode="determinate")
     77        self.progressbar["maximum"] = 59
    7978        self.progressbar.pack(side='top')
    8079
     
    104103        self.label_start.pack_forget()
    105104        current_process = self.after(1000, self.tick)
    106         self.currentValue = self.currentValue + 1
    107 
    108105        if self.schedule.state == 'initial':
    109106            self.label_sequence.config(self.start_color(root))
     
    111108            self.label_duration.config(self.start_color(root))
    112109            self.label_duration.config(text=("noch " +
    113                                              str(self.schedule.current_phase.time_left) +
     110                                             str(self.schedule.current_phase.ticks_left // 60) +
    114111                                             " Min\n"))
    115112            self.schedule.start()
     
    117114        else:
    118115            if self.schedule.running():
     116                self.schedule.tick(1)
     117                self.progressbar["value"] = (self.schedule.current_phase.initial_ticks -
     118                                             self.schedule.current_phase.ticks_left) % 60
    119119                self.progressbar.update()
    120120                self.label_sequence.configure(self.start_color(root))
     
    123123                self.label_duration.config(self.random_color(root))
    124124                self.label_duration.config(text=("noch " +
    125                                                  str(math.ceil(self.schedule.current_phase.time_left))
     125                                                 str(self.schedule.current_phase.ticks_left // 60)
    126126                                                 + " Min\n"), bg=self.random_color(self.label_duration))
    127                 self.label_config_text.config(text=(self.schedule.current_phase.current_phase_number+1,
    128                                                     "/", self.schedule.current_phase.current_phase_number),
     127                self.label_config_text.config(text=(self.schedule.current_phase.current_phase_number()+1,
     128                                                    "/", self.schedule.current_phase.current_phase_number()),
    129129                                              fg='blue',font="Times 48")
    130130
     
    196196    def progress(self, currentValue):
    197197        self.progressbar["value"] = self.currentValue
    198         self.progressbar["maximum"] = 60
    199         if self.currentValue == 60:
    200             self.currentValue = 0
    201198
    202199    def change_config(self):
Note: See TracChangeset for help on using the changeset viewer.