-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgui.py~
executable file
·81 lines (66 loc) · 2.6 KB
/
gui.py~
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
#
# generated by wxGlade 0.6.8 on Thu Apr 16 14:22:47 2015
#
<<<<<<< HEAD
import wx
=======
import wx,subprocess,os, sys
>>>>>>> e39041443551c18374971c6e0af3bb7858189b6e
# begin wxGlade: dependencies
import gettext
# end wxGlade
# begin wxGlade: extracode
# end wxGlade
if not os.geteuid() == 0:
subprocess.Popen(['gksudo','Apache']).communicate()
class Gui(wx.Frame):
def __init__(self, *args, **kwds):
# begin wxGlade: Gui.__init__
kwds["style"] = wx.DEFAULT_FRAME_STYLE
wx.Frame.__init__(self, *args, **kwds)
self.Start = wx.Button(self, wx.ID_ANY, _("Start"))
self.Restart = wx.Button(self, wx.ID_ANY, _("Restart"))
self.Stop = wx.Button(self, wx.ID_ANY, _("Stop"))
self.Home = wx.Button(self, wx.ID_ANY, _("Home"))
self.__set_properties()
self.__do_layout()
self.Bind(wx.EVT_BUTTON, self.start, self.Start)
self.Bind(wx.EVT_BUTTON, self.restart, self.Restart)
self.Bind(wx.EVT_BUTTON, self.stop, self.Stop)
self.Bind(wx.EVT_BUTTON, self.home, self.Home)
# end wxGlade
def __set_properties(self):
# begin wxGlade: Gui.__set_properties
self.SetTitle(_("ApacheGUI"))
self.SetSize((150, 200))
# end wxGlade
def __do_layout(self):
# begin wxGlade: Gui.__do_layout
sizer_1 = wx.BoxSizer(wx.VERTICAL)
sizer_1.Add(self.Start, 1, wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL, 0)
sizer_1.Add(self.Restart, 1, wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL, 0)
sizer_1.Add(self.Stop, 1, wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL, 0)
sizer_1.Add(self.Home, 1, wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL, 0)
self.SetSizer(sizer_1)
self.Layout()
# end wxGlade
def start(self, event): # wxGlade: Gui.<event_handler>
subprocess.Popen(['sudo', 'service', 'apache2','start']).communicate()
def restart(self, event): # wxGlade: Gui.<event_handler>
subprocess.Popen(['sudo','service','apache2', 'restart']).communicate()
def stop(self, event): # wxGlade: Gui.<event_handler>
subprocess.Popen(['sudo', 'service', 'apache2', 'stop']).communicate()
def home(self, event): # wxGlade: Gui.<event_handler>
print "Event handler 'home' not implemented!"
event.Skip()
# end of class Gui
if __name__ == "__main__":
gettext.install("app") # replace with the appropriate catalog name
app = wx.PySimpleApp(0)
wx.InitAllImageHandlers()
frame_1 = Gui(None, wx.ID_ANY, "")
app.SetTopWindow(frame_1)
frame_1.Show()
app.MainLoop()