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

Commit

Permalink
Console window sizer border to console textctrl, extra block getting …
Browse files Browse the repository at this point in the history
…domains from normal list

Made console window's sizers more pretty, added a border to the actual console text box so it doesn't look weird and fixed the extra domain block getting domains from the normal domain list.
  • Loading branch information
10se1ucgo committed Sep 26, 2015
1 parent c04f286 commit 78bd4b6
Showing 1 changed file with 12 additions and 21 deletions.
33 changes: 12 additions & 21 deletions run.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,12 @@ def write(self, string):
class ConsoleFrame(wx.Dialog):
def __init__(self):
wx.Dialog.__init__(self, parent=wx.GetApp().TopWindow, title="Console Output", size=[500, 200],
style=wx.DEFAULT_FRAME_STYLE ^ wx.MAXIMIZE_BOX)
style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)

panel = wx.Panel(self) # Frame panel

consoleSizer = wx.BoxSizer(wx.VERTICAL)
buttonSizer = wx.BoxSizer(wx.HORIZONTAL)

consoleSizer.Add(buttonSizer, 0, wx.ALL | wx.ALIGN_BOTTOM)

# Redirect console output to TextCtrl box
self.consolebox = wx.TextCtrl(panel, wx.ID_ANY, size=(475, 125), style=wx.TE_MULTILINE | wx.TE_READONLY,
pos=(10, 10))

consoleSizer.Add(self.consolebox, 0, wx.ALL | wx.EXPAND, 5)
self.consolebox = wx.TextCtrl(panel, wx.ID_ANY, style=wx.TE_MULTILINE | wx.TE_READONLY)

self.redirect = RedirectText(self.consolebox)
sys.stdout = self.redirect
Expand All @@ -54,11 +46,16 @@ def __init__(self):
self.okbutton = wx.Button(panel, wx.ID_OK, label="OK", pos=(398, 140))
self.okbutton.Bind(wx.EVT_BUTTON, self.onok)

buttonSizer.Add(self.okbutton, 0, wx.ALL | wx.LEFT)
buttonSizer.Add(self.issuebutton, 0, wx.ALL | wx.RIGHT)
consolesizer = wx.BoxSizer(wx.VERTICAL)
buttonsizer = wx.BoxSizer(wx.HORIZONTAL)

consolesizer.Add(buttonsizer)
consolesizer.Add(self.consolebox, 1, wx.ALL | wx.EXPAND, 1)

buttonsizer.Add(self.okbutton)
buttonsizer.Add(self.issuebutton)

panel.SetSizer(consoleSizer)
consoleSizer.Fit(self)
panel.SetSizerAndFit(consolesizer)

def onok(self, event):
sys.exit()
Expand Down Expand Up @@ -136,7 +133,6 @@ def __init__(self):
self.onedrivedbox = wx.CheckBox(panel, label="Uninstall &OneDrive", pos=(10, 115))
self.onedrivedbox.SetToolTip(wx.ToolTip("Uninstalls OneDrive from your computer and removes it from Explorer."))


# App static box
self.appbox = wx.StaticBox(panel, label="Built-in Apps", pos=(10, 130), size=(351, 160))

Expand Down Expand Up @@ -326,7 +322,7 @@ def go(self, event):
modifyhostfile(undo=undo, domainlist=self.normalpicker.GetSelections(), name="Domain block")
if self.extrahostbox.IsChecked():
logging.info("Extra host box ticked")
modifyhostfile(undo=undo, domainlist=self.normalpicker.GetSelections(), name="Extra domain block")
modifyhostfile(undo=undo, domainlist=self.extrapicker.GetSelections(), name="Extra domain block")
if self.ipbox.IsChecked():
logging.info("IP block box ticked")
blockips(undo=undo)
Expand Down Expand Up @@ -590,11 +586,6 @@ def modifyhostfile(undo, domainlist, name):

hostspath = os.path.join(os.environ['SYSTEMROOT'], 'System32\\drivers\\etc\\hosts')

try:
subprocess.call("takeown /f {0} && icacls {0} /grant administrators:F".format(hostspath), shell=True)
except (WindowsError, IOError):
pass

if not undo:
try:
with open(hostspath, 'ab') as f:
Expand Down

0 comments on commit 78bd4b6

Please sign in to comment.