Skip to content

Commit 2f306de

Browse files
Put root password window on top of the advanced settings window
1 parent 6799347 commit 2f306de

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

bin/gui_components/advanced_settings_window.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def __init_nm_frame__(self):
6767
self.nm_checkbutton.pack(pady=8)
6868

6969
def remove_cred(self):
70-
if not get_root_permissions():
70+
if not get_root_permissions(parent=self):
7171
return
7272

7373
if messagebox.askyesno(parent=self, title='Confirm', message="Are you sure you want "

bin/root.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
logger = get_logger(__name__)
55

66

7-
def get_root_permissions(sudo_password=None):
7+
def get_root_permissions(sudo_password=None, parent=None):
88
"""
99
Obtains root permission by launching a simple sudo command, asking for password is sudo_password is None.
1010
:param sudo_password: the root password
@@ -14,7 +14,7 @@ def get_root_permissions(sudo_password=None):
1414
return True
1515

1616
if sudo_password is None:
17-
sudo_password = ask_root_password()
17+
sudo_password = ask_root_password(parent)
1818

1919
# no password has been inserted
2020
if sudo_password is None:
@@ -60,12 +60,16 @@ def wrong_root_password():
6060
messagebox.showwarning(title="Wrong password", message="Wrong root password, insert it again")
6161

6262

63-
def ask_root_password():
63+
def ask_root_password(parent=None):
6464
"""
6565
Shows a window dialog that asks for the root password
6666
:return: the correct root password if inserted correctly, None otherwise
6767
"""
68-
root_password = simpledialog.askstring("Password", "Enter root password:", show='*')
68+
69+
if parent is None:
70+
root_password = simpledialog.askstring("Password", "Enter root password:", show='*')
71+
else:
72+
root_password = simpledialog.askstring("Password", "Enter root password:", parent=parent, show='*')
6973

7074
if root_password is None:
7175
return None

0 commit comments

Comments
 (0)