Skip to content

Commit 50eac25

Browse files
committed
Warn if admin rights are needed
1 parent da063a8 commit 50eac25

File tree

1 file changed

+27
-16
lines changed

1 file changed

+27
-16
lines changed

configure.py

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
import os
2323
import subprocess
24+
import sys
2425
import tkinter.ttk as ttk
2526
from tkinter import *
2627

@@ -68,7 +69,7 @@ class TuringConfigWindow:
6869
def __init__(self):
6970
self.window = Tk()
7071
self.window.title('Turing System Monitor configuration')
71-
self.window.geometry("730x480")
72+
self.window.geometry("730x510")
7273
self.window.iconphoto(True, PhotoImage(file="res/icons/monitor-icon-17865/64.png"))
7374
# When window gets focus again, reload theme preview in case it has been updated by theme editor
7475
self.window.bind("<FocusIn>", self.on_theme_change)
@@ -105,44 +106,47 @@ def __init__(self):
105106
self.wl_cb = ttk.Combobox(self.window, values=get_net_if(), state='readonly')
106107
self.wl_cb.place(x=500, y=150, width=210)
107108

109+
self.lhm_admin_warning = ttk.Label(self.window, text="Admin rights needed, or select another Hardware monitoring", foreground='#00f')
110+
self.lhm_admin_warning.place(x=320, y=190)
111+
108112
sysmon_label = ttk.Label(self.window, text='Display configuration', font='bold')
109-
sysmon_label.place(x=320, y=190)
113+
sysmon_label.place(x=320, y=220)
110114

111115
self.model_label = ttk.Label(self.window, text='Smart screen model')
112-
self.model_label.place(x=320, y=235)
116+
self.model_label.place(x=320, y=265)
113117
self.model_cb = ttk.Combobox(self.window, values=list(revision_map.values()), state='readonly')
114118
self.model_cb.bind('<<ComboboxSelected>>', self.on_model_change)
115-
self.model_cb.place(x=500, y=230, width=210)
119+
self.model_cb.place(x=500, y=260, width=210)
116120

117121
self.com_label = ttk.Label(self.window, text='COM port')
118-
self.com_label.place(x=320, y=275)
122+
self.com_label.place(x=320, y=305)
119123
self.com_cb = ttk.Combobox(self.window, values=get_com_ports(), state='readonly')
120-
self.com_cb.place(x=500, y=270, width=210)
124+
self.com_cb.place(x=500, y=300, width=210)
121125

122126
self.orient_label = ttk.Label(self.window, text='Orientation')
123-
self.orient_label.place(x=320, y=315)
127+
self.orient_label.place(x=320, y=345)
124128
self.orient_cb = ttk.Combobox(self.window, values=list(reverse_map.values()), state='readonly')
125-
self.orient_cb.place(x=500, y=310, width=210)
129+
self.orient_cb.place(x=500, y=340, width=210)
126130

127131
self.brightness_string = StringVar()
128132
self.brightness_label = ttk.Label(self.window, text='Brightness')
129-
self.brightness_label.place(x=320, y=355)
133+
self.brightness_label.place(x=320, y=385)
130134
self.brightness_slider = ttk.Scale(self.window, from_=0, to=100, orient=HORIZONTAL,
131135
command=self.on_brightness_change)
132-
self.brightness_slider.place(x=550, y=350, width=160)
136+
self.brightness_slider.place(x=550, y=380, width=160)
133137
self.brightness_val_label = ttk.Label(self.window, textvariable=self.brightness_string)
134-
self.brightness_val_label.place(x=500, y=355)
138+
self.brightness_val_label.place(x=500, y=385)
135139
self.brightness_warning_label = ttk.Label(self.window, text="⚠ Turing / rev. A displays can get hot at high brightness!", foreground='#f00')
136-
self.brightness_warning_label.place(x=320, y=390)
140+
self.brightness_warning_label.place(x=320, y=420)
137141

138142
self.edit_theme_btn = ttk.Button(self.window, text="Edit theme", command=lambda: self.on_theme_editor_click())
139-
self.edit_theme_btn.place(x=310, y=420, height=50, width=130)
143+
self.edit_theme_btn.place(x=310, y=450, height=50, width=130)
140144

141145
self.save_btn = ttk.Button(self.window, text="Save settings", command=lambda: self.on_save_click())
142-
self.save_btn.place(x=450, y=420, height=50, width=130)
146+
self.save_btn.place(x=450, y=450, height=50, width=130)
143147

144148
self.save_run_btn = ttk.Button(self.window, text="Save and run", command=lambda: self.on_saverun_click())
145-
self.save_run_btn.place(x=590, y=420, height=50, width=130)
149+
self.save_run_btn.place(x=590, y=450, height=50, width=130)
146150

147151
self.config = None
148152
self.load_config_values()
@@ -254,10 +258,17 @@ def on_hwlib_change(self, e=None):
254258
self.eth_cb.configure(state="readonly", foreground="#000")
255259
self.wl_cb.configure(state="readonly", foreground="#000")
256260

261+
if hwlib == "LHM":
262+
self.lhm_admin_warning.place(x=320, y=190)
263+
elif hwlib == "AUTO" and sys.platform == "win32":
264+
self.lhm_admin_warning.place(x=320, y=190)
265+
else:
266+
self.lhm_admin_warning.place_forget()
267+
257268
def show_hide_brightness_warning(self, e=None):
258269
if int(self.brightness_slider.get()) > 50 and [k for k, v in revision_map.items() if v == self.model_cb.get()][0] == "A":
259270
# Show warning for Turing Smart screen with high brightness
260-
self.brightness_warning_label.place(x=320, y=390)
271+
self.brightness_warning_label.place(x=320, y=420)
261272
else:
262273
self.brightness_warning_label.place_forget()
263274

0 commit comments

Comments
 (0)