Skip to content
This repository has been archived by the owner on Feb 9, 2021. It is now read-only.

3.1.1 #317

Merged
merged 5 commits into from
Apr 29, 2017
Merged

3.1.1 #317

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 33 additions & 25 deletions dwt.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,36 +72,30 @@ def submit_issue(self, event):

class MainFrame(wx.Frame):
def __init__(self):
super(MainFrame, self).__init__(parent=wx.GetApp().GetTopWindow(), title="Disable Windows 10 Tracking",
size=(415, 245))
self.SetMinSize(self.GetSize())
panel = MainPanel(self)
super(MainFrame, self).__init__(parent=wx.GetApp().GetTopWindow(), title="Disable Windows 10 Tracking",
size=(415, 245))
self.SetMinSize(self.GetSize())
panel = MainPanel(self)

file_menu = wx.Menu()
settings = file_menu.Append(wx.ID_SETUP, "&Settings", "DWT settings")
file_menu = wx.Menu()
settings = file_menu.Append(wx.ID_SETUP, "&Settings", "DWT settings")

help_menu = wx.Menu()
about = help_menu.Append(wx.ID_ABOUT, "&About", "About DWT")
licenses = help_menu.Append(wx.ID_ANY, "&Licenses", "Open-source licenses")
help_menu = wx.Menu()
about = help_menu.Append(wx.ID_ABOUT, "&About", "About DWT")
licenses = help_menu.Append(wx.ID_ANY, "&Licenses", "Open-source licenses")

menu_bar = wx.MenuBar()
menu_bar.Append(file_menu, "&File")
menu_bar.Append(help_menu, "&Help")
self.SetMenuBar(menu_bar)
menu_bar = wx.MenuBar()
menu_bar.Append(file_menu, "&File")
menu_bar.Append(help_menu, "&Help")
self.SetMenuBar(menu_bar)

if not bool(windll.advpack.IsNTAdmin(0, None)):
warn = wx.MessageDialog(parent=self,
message="Program requires elevation, please run it as an administrator.",
caption="ERROR!", style=wx.OK | wx.ICON_WARNING)
warn.ShowModal()
warn.Destroy()
sys.exit(1)
check_elevated()

self.SetIcon(wx.Icon(sys.executable, wx.BITMAP_TYPE_ICO))
self.Bind(wx.EVT_MENU, lambda x: dwt_about.about_dialog(self), about)
self.Bind(wx.EVT_MENU, panel.settings, settings)
self.Bind(wx.EVT_MENU, lambda x: dwt_about.Licenses(self), licenses)
self.Layout()
self.SetIcon(wx.Icon(sys.executable, wx.BITMAP_TYPE_ICO))
self.Bind(wx.EVT_MENU, lambda x: dwt_about.about_dialog(self), about)
self.Bind(wx.EVT_MENU, panel.settings, settings)
self.Bind(wx.EVT_MENU, lambda x: dwt_about.Licenses(self), licenses)
self.Layout()


class MainPanel(wx.Panel):
Expand Down Expand Up @@ -450,9 +444,23 @@ def exception_hook(error, value, trace):
error_dialog.Destroy()
sys.exit(1)

def check_elevated(silent=False):
if not bool(windll.advpack.IsNTAdmin(0, None)):
if not silent:
warn = wx.MessageDialog(parent=None,
message="Program requires elevation, please run it as an administrator.",
caption="ERROR!", style=wx.OK | wx.ICON_WARNING)
warn.ShowModal()
warn.Destroy()
else:
logger.info("You didn't run DWT as administrator. Don't bother posting an issue.")
logger.info("Please re-run as administrator.")
sys.exit(1)

def silent():

setup_logging()
check_elevated(True)

dwt_util.clear_diagtrack()
dwt_util.disable_service("dmwappushsvc")
Expand Down
2 changes: 1 addition & 1 deletion dwt_about.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import wx.adv
import wx.lib.scrolledpanel as sp

__version__ = "3.1.0"
__version__ = "3.1.1"


def about_dialog(parent):
Expand Down