Skip to content

Commit

Permalink
feat: ReAdded IsUserAnAdmin (apparently it's needed)
Browse files Browse the repository at this point in the history
  • Loading branch information
nozwock committed Oct 14, 2020
1 parent f9c2185 commit 06e0493
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
12 changes: 12 additions & 0 deletions votm/manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import win32api
import xlsxwriter
import win32event
import ctypes
from shutil import copyfile
from os import path, remove
from datetime import date
Expand Down Expand Up @@ -81,6 +82,17 @@ def __init__(self):
]
]
)
if not ctypes.windll.shell32.IsUserAnAdmin():
self.withdraw()
self.attributes("-topmost", 1)
self.title("Error")
mg.showwarning(
"Error",
"This App requires Administrator Privileges to function properly.\nPlease Retry with Run As Administrator.",
parent=self,
)
self.destroy()
sys.exit(0)
self.iconbitmap(Root.DATAFILE[0])

@classmethod
Expand Down
12 changes: 12 additions & 0 deletions votm/vote.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import win32api
import win32event
import ctypes
from os import path
from datetime import date
import tkinter as tk
Expand Down Expand Up @@ -49,6 +50,17 @@ def __init__(self):
self.attributes("-alpha", 0.0)
self.protocol("WM_DELETE_WINDOW", Win.s_cls)
self.ins_dat([ASSETS_PATH.joinpath(i) for i in ["v_r.ico", "bg.png"]])
if not ctypes.windll.shell32.IsUserAnAdmin():
self.withdraw()
self.attributes("-topmost", 1)
self.title("Error")
mg.showwarning(
"Error",
"This App requires Administrator Privileges to function properly.\nPlease Retry with Run As Administrator.",
parent=self,
)
self.destroy()
sys.exit(0)
self.iconbitmap(default=Root.DATAFILE[0])

@classmethod
Expand Down

0 comments on commit 06e0493

Please sign in to comment.