Skip to content

Commit a5d4f1a

Browse files
committed
UI Scaling Bug Fix
1 parent 4fefc69 commit a5d4f1a

5 files changed

Lines changed: 100 additions & 87 deletions

File tree

Package/data_management.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from collections import Counter
22
import os
3-
import cProfile
43

54
import datetime
65
import openpyxl as op

Package/note_management.py

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,13 @@ def create_task(self, index):
1313
self.frame.grid_propagate(False)
1414

1515
def title_text(title: str) -> str:
16-
max_letters = 50
16+
max_letters = 40
17+
18+
for letter in title:
19+
if letter.isupper():
20+
max_letters -= 0.35
21+
22+
max_letters = int(max_letters)
1723

1824
display_title = title
1925

@@ -22,12 +28,13 @@ def title_text(title: str) -> str:
2228

2329
return display_title
2430

25-
title = ctk.CTkLabel(self.frame, text=title_text(str(self.data_manager.worksheet["O" + str(index)].value)), font=(font_family, font_size*1.25),
31+
title = ctk.CTkLabel(self.frame, text=title_text(str(self.data_manager.worksheet["O" + str(index)].value)), font=(font_family, font_size*1.2),
2632
text_color=(light_font_color, font_color), anchor="center", height=button_height + frame_padding * 2)
2733
title.grid(row=0, column=0, padx=widget_padding_x)
28-
date = ctk.CTkLabel(self.frame, text=str(self.data_manager.worksheet["N" + str(index)].value), font=(font_family, font_size*1.25),
29-
text_color=(light_font_color, font_color), anchor="center", height=button_height + frame_padding * 2)
30-
date.place(anchor="center", relx=0.5, rely=0.5)
34+
35+
date = ctk.CTkLabel(self.frame, text=str(self.data_manager.worksheet["N" + str(index)].value), font=(font_family, font_size*1),
36+
text_color=(light_off_font_color, off_font_color), anchor="center", height=button_height + frame_padding * 2)
37+
date.place(anchor="center", relx=0.575, rely=0.5)
3138

3239
button_frame = ctk.CTkFrame(self.frame, fg_color="transparent")
3340
button_frame.place(anchor="center", rely=0.5, relx=0.825)
@@ -58,12 +65,26 @@ def _open_notes_text(self, date, title, text, index):
5865
header_frame.grid(row=0, column=0, pady=(0, frame_padding))
5966
header_frame.grid_propagate(False)
6067

61-
title_label = ctk.CTkLabel(header_frame, text=title, font=(font_family, font_size*1.5), text_color=(light_font_color, font_color),
68+
def title_text(title: str) -> str:
69+
max_letters = 45
70+
71+
for letter in title:
72+
if letter.isupper():
73+
max_letters -= 0.4
74+
75+
76+
max_letters = int(max_letters)
77+
78+
display_title = title
79+
80+
if len(title) > max_letters:
81+
display_title = title[:max_letters] + "..."
82+
83+
return display_title
84+
85+
title_label = ctk.CTkLabel(header_frame, text=title_text(title), font=(font_family, font_size*1.5), text_color=(light_font_color, font_color),
6286
height=40, width=WIDTH - 280 - frame_padding * 6, fg_color=(light_frame_color, frame_color), anchor="w")
6387
title_label.grid(row=0, column=0, padx=widget_padding_x, pady=widget_padding_y)
64-
#date_label = ctk.CTkLabel(header_frame, text=date, font=(font_family, font_size), text_color=(light_font_color, font_color),
65-
#height=40, width=WIDTH - 280 - frame_padding * 6, fg_color=(light_frame_color, frame_color))
66-
#date_label.grid(row=0, column=0, padx=widget_padding_x, pady=widget_padding_y)
6788

6889
button_frame = ctk.CTkFrame(header_frame, fg_color="transparent")
6990
button_frame.place(anchor="center", rely=0.5, relx=0.825)

Package/styles.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,15 @@
1010
font_color = "#e6e6e6"
1111
light_font_color = "#262626"
1212

13+
off_font_color = "#d9d9d9"
14+
light_off_font_color = "#404040"
15+
1316
window_color = "#2b2b2b"
1417
light_window_color = "#d4d4d4"
1518

1619

1720
frame_padding = 10
18-
frame_width = 300
21+
frame_width = 325
1922

2023
frame_color = "#383838"
2124
light_frame_color = "#c7c7c7"

Package/timer_management.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ def initialize_variables(self):
1919
def timer_mechanism(self, timer_button, break_button, time_display_label):
2020
if self.timer_start_cooldown:
2121
return
22+
2223
self.timer_start_cooldown = True
2324

2425
self.window.after(1000, self.enable_timer_start)

0 commit comments

Comments
 (0)