2
# -*- coding: utf-8 -*-
3
# generated by wxGlade 0.6.3 on Sun Feb 21 17:46:46 2010
7
# begin wxGlade: extracode
12
class Setup(wx.Frame):
13
def __init__(self, *args, **kwds):
14
# begin wxGlade: Setup.__init__
15
kwds["style"] = wx.DEFAULT_FRAME_STYLE
16
wx.Frame.__init__(self, *args, **kwds)
17
self.notebook_1 = wx.Notebook(self, -1, style=0)
18
self.notebook_1_pane_6 = wx.Panel(self.notebook_1, -1)
19
self.notebook_1_pane_5 = wx.Panel(self.notebook_1, -1)
20
self.notebook_1_pane_4 = wx.Panel(self.notebook_1, -1)
21
self.notebook_1_pane_3 = wx.Panel(self.notebook_1, -1)
22
self.notebook_1_pane_2 = wx.Panel(self.notebook_1, -1)
23
self.notebook_1_pane_1 = wx.Panel(self.notebook_1, -1)
24
self.label_1 = wx.StaticText(self.notebook_1_pane_1, -1, "Welcome to D-CM,\nWe hope you will have a great time\ndeveloping your site(s) with d-cm")
25
self.button_1 = wx.Button(self.notebook_1_pane_1, -1, "Start D-CM")
26
self.button_2 = wx.Button(self.notebook_1_pane_1, -1, "Goto Setup")
27
self.label_2 = wx.StaticText(self.notebook_1_pane_2, -1, "Options:")
28
self.radio_box_1 = wx.RadioBox(self.notebook_1_pane_2, -1, "Startup", choices=["Start your home directory", "Start the last visited folder", " Start this folder:"], majorDimension=0, style=wx.RA_SPECIFY_ROWS)
29
self.text_ctrl_1 = wx.TextCtrl(self.notebook_1_pane_2, -1, "")
30
self.button_3 = wx.Button(self.notebook_1_pane_2, -1, "Go on!")
31
self.label_3 = wx.StaticText(self.notebook_1_pane_3, -1, "MySQL is not installed :(")
32
self.text_ctrl_2 = wx.TextCtrl(self.notebook_1_pane_3, -1, "Servername")
33
self.text_ctrl_3 = wx.TextCtrl(self.notebook_1_pane_3, -1, "Username")
34
self.text_ctrl_4 = wx.TextCtrl(self.notebook_1_pane_3, -1, "Password")
35
self.text_ctrl_5 = wx.TextCtrl(self.notebook_1_pane_3, -1, "Database")
36
self.button_4 = wx.Button(self.notebook_1_pane_3, -1, "Go on!")
37
self.label_4 = wx.StaticText(self.notebook_1_pane_4, -1, "FTP is not installed :(")
38
self.text_ctrl_6 = wx.TextCtrl(self.notebook_1_pane_4, -1, "Servername")
39
self.text_ctrl_7 = wx.TextCtrl(self.notebook_1_pane_4, -1, "Username")
40
self.text_ctrl_8 = wx.TextCtrl(self.notebook_1_pane_4, -1, "Password")
41
self.button_5 = wx.Button(self.notebook_1_pane_4, -1, "Go on!")
42
self.label_5 = wx.StaticText(self.notebook_1_pane_5, -1, "What should be opened on startup?")
43
self.radio_box_2 = wx.RadioBox(self.notebook_1_pane_5, -1, "Startup", choices=["File Manager", "MySQL", "FTP", "Deditor"], majorDimension=0, style=wx.RA_SPECIFY_ROWS)
44
self.button_6 = wx.Button(self.notebook_1_pane_5, -1, "Go on!")
45
self.label_6 = wx.StaticText(self.notebook_1_pane_6, -1, "You're now ready to start using d-cm!")
46
self.button_7 = wx.Button(self.notebook_1_pane_6, -1, "Start D-CM!")
48
self.__set_properties()
51
self.Bind(wx.EVT_BUTTON, self.start, self.button_1)
52
self.Bind(wx.EVT_BUTTON, self.goon, self.button_2)
53
self.Bind(wx.EVT_RADIOBOX, self.fm, self.radio_box_1)
54
self.Bind(wx.EVT_BUTTON, self.goon, self.button_3)
55
self.Bind(wx.EVT_BUTTON, self.goon, self.button_4)
56
self.Bind(wx.EVT_BUTTON, self.goon, self.button_5)
57
self.Bind(wx.EVT_BUTTON, self.goon, self.button_6)
58
self.Bind(wx.EVT_BUTTON, self.setup, self.button_7)
63
def __set_properties(self):
64
# begin wxGlade: Setup.__set_properties
65
self.SetTitle("D-CM Setup")
66
self.label_1.SetMinSize((400, 51))
67
self.label_2.SetMinSize((100, 17))
68
self.radio_box_1.SetSelection(0)
69
self.text_ctrl_1.SetMinSize((400, 27))
70
self.text_ctrl_1.Enable(False)
71
self.text_ctrl_2.SetMinSize((400, 27))
72
self.text_ctrl_2.Enable(False)
73
self.text_ctrl_3.SetMinSize((400, 27))
74
self.text_ctrl_3.Enable(False)
75
self.text_ctrl_4.SetMinSize((400, 27))
76
self.text_ctrl_4.Enable(False)
77
self.text_ctrl_5.SetMinSize((400, 27))
78
self.text_ctrl_5.Enable(False)
79
self.text_ctrl_6.SetMinSize((400, 27))
80
self.text_ctrl_6.Enable(False)
81
self.text_ctrl_7.SetMinSize((400, 27))
82
self.text_ctrl_7.Enable(False)
83
self.text_ctrl_8.SetMinSize((400, 27))
84
self.text_ctrl_8.Enable(False)
85
self.radio_box_2.SetSelection(0)
88
def __do_layout(self):
89
# begin wxGlade: Setup.__do_layout
90
sizer_1 = wx.BoxSizer(wx.VERTICAL)
91
sizer_8 = wx.BoxSizer(wx.VERTICAL)
92
sizer_7 = wx.BoxSizer(wx.VERTICAL)
93
sizer_6 = wx.BoxSizer(wx.VERTICAL)
94
sizer_5 = wx.BoxSizer(wx.VERTICAL)
95
sizer_4 = wx.BoxSizer(wx.VERTICAL)
96
sizer_4_copy = wx.BoxSizer(wx.HORIZONTAL)
97
sizer_2 = wx.BoxSizer(wx.VERTICAL)
98
sizer_3 = wx.BoxSizer(wx.HORIZONTAL)
99
sizer_2.Add(self.label_1, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
100
sizer_3.Add(self.button_1, 0, wx.ADJUST_MINSIZE, 0)
101
sizer_3.Add(self.button_2, 0, wx.ADJUST_MINSIZE, 0)
102
sizer_2.Add(sizer_3, 0, wx.EXPAND, 0)
103
self.notebook_1_pane_1.SetSizer(sizer_2)
104
sizer_4_copy.Add(self.label_2, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ADJUST_MINSIZE, 0)
105
sizer_4_copy.Add(self.radio_box_1, 0, wx.ADJUST_MINSIZE, 0)
106
sizer_4.Add(sizer_4_copy, 0, wx.EXPAND, 0)
107
sizer_4.Add(self.text_ctrl_1, 0, wx.ADJUST_MINSIZE, 0)
108
sizer_4.Add(self.button_3, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
109
self.notebook_1_pane_2.SetSizer(sizer_4)
110
sizer_5.Add(self.label_3, 0, wx.ADJUST_MINSIZE, 0)
111
sizer_5.Add(self.text_ctrl_2, 0, wx.ADJUST_MINSIZE, 0)
112
sizer_5.Add(self.text_ctrl_3, 0, wx.ADJUST_MINSIZE, 0)
113
sizer_5.Add(self.text_ctrl_4, 0, wx.ADJUST_MINSIZE, 0)
114
sizer_5.Add(self.text_ctrl_5, 0, wx.ADJUST_MINSIZE, 0)
115
sizer_5.Add(self.button_4, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
116
self.notebook_1_pane_3.SetSizer(sizer_5)
117
sizer_6.Add(self.label_4, 0, wx.ADJUST_MINSIZE, 0)
118
sizer_6.Add(self.text_ctrl_6, 0, wx.ADJUST_MINSIZE, 0)
119
sizer_6.Add(self.text_ctrl_7, 0, wx.ADJUST_MINSIZE, 0)
120
sizer_6.Add(self.text_ctrl_8, 0, wx.ADJUST_MINSIZE, 0)
121
sizer_6.Add(self.button_5, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
122
self.notebook_1_pane_4.SetSizer(sizer_6)
123
sizer_7.Add(self.label_5, 0, wx.ADJUST_MINSIZE, 0)
124
sizer_7.Add(self.radio_box_2, 0, wx.ADJUST_MINSIZE, 0)
125
sizer_7.Add(self.button_6, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
126
self.notebook_1_pane_5.SetSizer(sizer_7)
127
sizer_8.Add(self.label_6, 0, wx.ADJUST_MINSIZE, 0)
128
sizer_8.Add(self.button_7, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
129
self.notebook_1_pane_6.SetSizer(sizer_8)
130
self.notebook_1.AddPage(self.notebook_1_pane_1, "Start")
131
self.notebook_1.AddPage(self.notebook_1_pane_2, "File Manager")
132
self.notebook_1.AddPage(self.notebook_1_pane_3, "MySql")
133
self.notebook_1.AddPage(self.notebook_1_pane_4, "FTP")
134
self.notebook_1.AddPage(self.notebook_1_pane_5, " Startup")
135
self.notebook_1.AddPage(self.notebook_1_pane_6, " Finish")
136
sizer_1.Add(self.notebook_1, 1, wx.EXPAND, 0)
137
self.SetSizer(sizer_1)
142
def initialize(self):
143
self.dir = os.path.dirname(__file__) + "/"
147
self.label_3.SetLabel("MySql not installed :(")
150
self.label_3.SetLabel("MySql is installed =D")
151
self.text_ctrl_2.Enable(True)
152
self.text_ctrl_3.Enable(True)
153
self.text_ctrl_4.Enable(True)
154
self.text_ctrl_5.Enable(True)
159
self.label_4.SetLabel("FTP not installed :(")
162
self.label_4.SetLabel("FTP is installed =D")
163
self.text_ctrl_6.Enable(True)
164
self.text_ctrl_7.Enable(True)
165
self.text_ctrl_8.Enable(True)
169
def start(self, event): # wxGlade: Setup.<event_handler>
170
os.system(self.dir+"dcm")
173
def goon(self, event): # wxGlade: Setup.<event_handler>
175
self.notebook_1.SetSelection(self.gn)
177
def fm(self, event): # wxGlade: Setup.<event_handler>
178
if self.radio_box_1.GetSelection()==2:
179
self.text_ctrl_1.Enable(True)
181
self.text_ctrl_1.Enable(False)
183
def setup(self, event): # wxGlade: Setup.<event_handler>
184
self.config_set("GSTARTUP",self.radio_box_2.GetSelection())
186
self.config_set("MSERVER",self.text_ctrl_2.GetValue())
187
self.config_set("MUSER",self.text_ctrl_3.GetValue())
188
self.config_set("MPASS",self.text_ctrl_4.GetValue())
189
self.config_set("MDATA",self.text_ctrl_5.GetValue())
191
self.config_set("SSERVER",self.text_ctrl_6.GetValue())
192
self.config_set("SUSER",self.text_ctrl_7.GetValue())
193
self.config_set("SPASS",self.text_ctrl_8.GetValue())
194
if self.radio_box_1.GetSelection()==2:
195
self.config_set("FDEF",self.radio_box_1.GetSelection())
196
if self.radio_box_1.GetSelection()==1:
197
self.config_set("FDEF",os.getenv("USERNAME"))
199
def config_set(self,name,new):
200
self.config = self.dir + "config.ded"
201
last = dcm.config_get(name)
202
last = name + "|" + last
203
new = name + "|" + new
205
s = open(self.config, 'r').read()
207
print "error: could not open" + self.config + " error generated in config_set"
208
s = s.replace(last, new)
209
f = open(self.config, 'w')
213
def config_get(self,name):
214
self.config = self.dir + "config.ded"
216
f = open(self.config, 'r')
218
print "error: could not open" + self.config + " error generated in config_get"
220
if name.strip() == line.strip().split("|")[0]:
221
strip = line.strip().split("|")[1]
228
if __name__ == "__main__":
229
app = wx.PySimpleApp(0)
230
wx.InitAllImageHandlers()
231
frame_1 = Setup(None, -1, "")
232
app.SetTopWindow(frame_1)