Changeset 0384305 in flowtimer


Ignore:
Timestamp:
08/29/24 22:08:00 (10 months ago)
Author:
Enrico Schwass <ennoausberlin@…>
Branches:
guix
Children:
813e855
Parents:
794b5c2
Message:

better color scheme support

Location:
flowtimer
Files:
3 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • flowtimer/Schedule.py

    r794b5c2 r0384305  
    155155                sum([block.ticks_left for block in self.upcoming_blocks()]))
    156156
     157    def upcoming_block_titles(self):
     158        return [each.title for each in self.upcoming_blocks()]
     159
    157160    def upcoming_blocks(self):
    158161        index = self.blocks.index(self.current_block)
     
    160163            return self.blocks[index+1:]
    161164        return []
     165
     166    def current_phase(self):
     167        if self.current_block.is_sequence():
     168            return self.current_block.current_phase
     169        else:
     170            return self.current_block
    162171
    163172    def tick(self, ticks):
  • flowtimer/main.py

    r794b5c2 r0384305  
    4040        self.button_frame.pack(side='bottom', fill='both', expand=False)
    4141
    42         self.label_headline = tk.Label(self.headline_frame,
    43                                        text=(self.schedule.current_block.title),
    44                                        bg='white', fg='grey', font="serif 20")
    45         self.label_headline.pack(side='left', fill='both', expand=True)
     42        # self.label_headline = tk.Label(self.headline_frame,
     43        #                                text=(self.schedule.current_block.title),
     44        #                                bg='white', fg='grey', font="serif 20")
     45        # self.label_headline.pack(side='left', fill='both', expand=True)
    4646
    4747        self.label_config = tk.LabelFrame(self.headline_frame,
     
    9393            return self.schedule.current_block.ticks_left
    9494
     95    def default_colors(self):
     96        return next((d for d in self.color_scheme if d.get('title') == 'Default'))
     97
    9598    def colors_for_phase(self, a_title):
    96         return next((d for d in self.color_scheme if d.get('title') == a_title), None)
     99        return next((d for d in self.color_scheme if d.get('title') == a_title), self.default_colors())
    97100
    98101    def current_title(self):
     
    139142                                         self.schedule.current_block.ticks_left) % 60
    140143            self.progressbar.update()
    141             self.label_duration.config(text=self.current_time_status(), font='times 22')
     144            colors = self.colors_for_phase(self.schedule.current_phase().title)
     145            self.label_sequence.config(text=str(self.schedule.upcoming_block_titles()),
     146                                       font='times 22', bg=colors.get('sequence_label'),
     147                                       fg="white")
     148            self.label_duration.config(text=self.current_time_status(), font='times 22',
     149                                       bg=colors.get('duration_label'),
     150                                       fg="white")
     151            self.center_frame.configure(bg=colors.get('center_frame'))
     152
    142153            self.label_config_text.config(text=self.current_config())
    143154
Note: See TracChangeset for help on using the changeset viewer.