Skip to content

Commit 54093ab

Browse files
author
Tom Schimansky
committed
add settings in menu bar
1 parent f412e03 commit 54093ab

File tree

5 files changed

+23
-60
lines changed

5 files changed

+23
-60
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"check_for_updates": true, "bell_muted": true, "agreed_on_usage_stats": false, "open_times": 0, "id": null}
1+
{"check_for_updates": true, "bell_muted": true, "agreed_on_usage_stats": true, "open_times": 0, "id": null}

main.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ def __init__(self, *args, **kwargs):
8282
self.bind("<Command-q>", self.on_closing)
8383
self.bind("<Command-w>", self.on_closing)
8484
self.createcommand('tk::mac::Quit', self.on_closing)
85+
self.createcommand('tk::mac::ShowPreferences', self.draw_settings_frame)
8586

8687
menu_bar = tkinter.Menu(master=self)
8788
app_menu = tkinter.Menu(menu_bar, name='apple')
@@ -116,7 +117,6 @@ def draw_main_frame(self, event=0):
116117
self.main_frame.place(relx=0, rely=0, relheight=1, relwidth=1)
117118

118119
def manage_usage_stats(self, option, open_times, id):
119-
120120
# check usage_monitor module could be loaded
121121
if usage_monitor is not None:
122122

@@ -140,8 +140,10 @@ def manage_usage_stats(self, option, open_times, id):
140140
self.on_closing()
141141

142142
def check_for_updates(self):
143+
# check if user agreed on update checking
143144
if self.read_user_setting("check_for_updates") is True:
144145
try:
146+
# use github API to get latest version string
145147
response = requests.get(Settings.GITHUB_API_URL + "/releases/latest")
146148
latest_version = response.json()["tag_name"]
147149
except Exception as err:

tuner_appearance_manager/color_manager.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,6 @@
44

55
class ColorManager(object):
66
def __init__(self):
7-
self.background_layer_1 = None
8-
self.background_layer_0 = None
9-
self.text_main = None
10-
self.text_2 = None
11-
self.text_2_highlight = None
12-
self.theme_main = None
13-
self.theme_dark = None
14-
self.theme_light = None
15-
self.needle = None
16-
self.needle_hit = None
17-
187
self.set_mode("Light")
198

209
def set_mode(self, mode):

tuner_ui_parts/settings_frame.py

Lines changed: 15 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,7 @@ def __init__(self, master, *args, **kwargs):
1919

2020
self.bottom_frame = tkinter.Frame(master=self,
2121
bg=self.color_manager.background_layer_0)
22-
self.bottom_frame.place(anchor=tkinter.S,
23-
relx=0.5,
24-
rely=1,
25-
relheight=0.2,
26-
relwidth=1)
22+
self.bottom_frame.place(anchor=tkinter.S, relx=0.5, rely=1, relheight=0.2, relwidth=1)
2723

2824
self.button_back = TkinterCustomButton(master=self.bottom_frame,
2925
bg_color=self.color_manager.background_layer_0,
@@ -36,10 +32,7 @@ def __init__(self, master, *args, **kwargs):
3632
width=110,
3733
height=40,
3834
command=self.master.draw_main_frame)
39-
40-
self.button_back.place(anchor=tkinter.SE,
41-
relx=0.95,
42-
rely=0.75)
35+
self.button_back.place(anchor=tkinter.SE, relx=0.95, rely=0.75)
4336

4437
self.button_website = TkinterCustomButton(master=self.bottom_frame,
4538
bg_color=self.color_manager.background_layer_0,
@@ -52,34 +45,21 @@ def __init__(self, master, *args, **kwargs):
5245
width=110,
5346
height=40,
5447
command=self.website_button)
55-
56-
self.button_website.place(anchor=tkinter.SW,
57-
relx=0.05,
58-
rely=0.75)
48+
self.button_website.place(anchor=tkinter.SW, relx=0.05, rely=0.75)
5949

6050
self.label_info_text = tkinter.Label(master=self,
6151
bg=self.color_manager.background_layer_1,
6252
fg=self.color_manager.text_2,
6353
font=self.font_manager.info_text_font,
6454
text=Settings.ABOUT_TEXT)
65-
66-
self.label_info_text.place(anchor=tkinter.CENTER,
67-
relx=0.5,
68-
rely=0.12,
69-
relheight=0.2,
70-
relwidth=0.8)
55+
self.label_info_text.place(anchor=tkinter.CENTER, relx=0.5, rely=0.12, relheight=0.2, relwidth=0.8)
7156

7257
self.label_note_text = tkinter.Label(master=self,
7358
bg=self.color_manager.background_layer_1,
7459
fg=self.color_manager.text_2,
7560
font=self.font_manager.settings_text_font,
7661
text="A4 =")
77-
78-
self.label_note_text.place(relx=0.2,
79-
rely=0.45,
80-
relheight=0.1,
81-
relwidth=0.2,
82-
anchor=tkinter.CENTER)
62+
self.label_note_text.place(relx=0.2, rely=0.45, relheight=0.1, relwidth=0.2, anchor=tkinter.CENTER)
8363

8464
self.label_frequency = TkinterCustomButton(master=self,
8565
bg_color=self.color_manager.background_layer_1,
@@ -92,38 +72,29 @@ def __init__(self, master, *args, **kwargs):
9272
width=170,
9373
height=65,
9474
hover=False)
95-
96-
self.label_frequency.place(anchor=tkinter.CENTER,
97-
relx=0.5,
98-
rely=0.45)
75+
self.label_frequency.place(anchor=tkinter.CENTER, relx=0.5, rely=0.45)
9976

10077
self.button_frequency_up = TkinterCustomButtonImageset(master=self,
78+
height=50,
79+
width=150,
10180
bg_color=self.color_manager.background_layer_1,
10281
image_dict={"standard": self.image_manager.arrowUp_image,
10382
"clicked": self.image_manager.arrowUp_image,
10483
"standard_hover": self.image_manager.arrowUp_image_hovered,
10584
"clicked_hover": self.image_manager.arrowUp_image_hovered},
10685
command=self.frequency_button_up)
107-
108-
self.button_frequency_up.place(anchor=tkinter.CENTER,
109-
relx=0.5,
110-
rely=0.3,
111-
height=50,
112-
width=150)
86+
self.button_frequency_up.place(anchor=tkinter.CENTER, relx=0.5, rely=0.3)
11387

11488
self.button_frequency_down = TkinterCustomButtonImageset(master=self,
89+
height=50,
90+
width=150,
11591
bg_color=self.color_manager.background_layer_1,
11692
image_dict={"standard": self.image_manager.arrowDown_image,
11793
"clicked": self.image_manager.arrowDown_image,
11894
"standard_hover": self.image_manager.arrowDown_image_hovered,
11995
"clicked_hover": self.image_manager.arrowDown_image_hovered},
12096
command=self.frequency_button_down)
121-
122-
self.button_frequency_down.place(anchor=tkinter.CENTER,
123-
relx=0.5,
124-
rely=0.6,
125-
height=50,
126-
width=150)
97+
self.button_frequency_down.place(anchor=tkinter.CENTER, relx=0.5, rely=0.6)
12798

12899
def update_color(self):
129100
self.configure(bg=self.color_manager.background_layer_1)
@@ -155,8 +126,9 @@ def frequency_button_up(self):
155126
self.label_frequency.set_text(str(self.master.a4_frequency) + " Hz")
156127

157128
def frequency_button_down(self):
158-
self.master.a4_frequency -= 1
159-
self.label_frequency.set_text(str(self.master.a4_frequency) + " Hz")
129+
if self.master.a4_frequency > 1:
130+
self.master.a4_frequency -= 1
131+
self.label_frequency.set_text(str(self.master.a4_frequency) + " Hz")
160132

161133
def website_button(self):
162134
webbrowser.open(Settings.GITHUB_URL_README)

tuner_ui_parts/tkinter_custom_button.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@ def __init__(self,
5151
self.width = width
5252
self.height = height
5353

54-
if corner_radius*2 > self.height:
55-
self.corner_radius = self.height/2
56-
elif corner_radius*2 > self.width:
57-
self.corner_radius = self.width/2
54+
if corner_radius * 2 > self.height:
55+
self.corner_radius = self.height / 2
56+
elif corner_radius * 2 > self.width:
57+
self.corner_radius = self.width / 2
5858
else:
5959
self.corner_radius = corner_radius
6060

0 commit comments

Comments
 (0)