2
# -*- coding: utf-8 -*-
3
# generated by wxGlade 0.6.3 on Sat May 1 12:03:34 2010
6
sys.path.append(os.getcwd())
9
# begin wxGlade: extracode
12
class Settings(wx.Frame):
13
def __init__(self, *args, **kwds):
14
# begin wxGlade: Settings.__init__
15
kwds["style"] = wx.DEFAULT_FRAME_STYLE
16
wx.Frame.__init__(self, *args, **kwds)
17
self.list_ctrl_2 = wx.ListCtrl(self, -1, style=wx.LC_REPORT|wx.SUNKEN_BORDER)
18
self.list_ctrl_3 = wx.ListCtrl(self, -1, style=wx.LC_REPORT|wx.SUNKEN_BORDER)
19
self.list_ctrl_1 = wx.ListCtrl(self, -1, style=wx.LC_REPORT|wx.SUNKEN_BORDER)
20
self.list_ctrl_4 = wx.ListCtrl(self, -1, style=wx.LC_REPORT|wx.SUNKEN_BORDER)
21
self.list_ctrl_5 = wx.ListCtrl(self, -1, style=wx.LC_REPORT|wx.SUNKEN_BORDER)
22
self.button_3 = wx.Button(self, wx.ID_OK, "")
24
self.__set_properties()
27
self.Bind(wx.EVT_BUTTON, self.setok, self.button_3)
30
def __set_properties(self):
31
# begin wxGlade: Settings.__set_properties
32
self.SetTitle("DGO: Settings.py")
33
self.SetSize((1200, 300))
36
def __do_layout(self):
37
# begin wxGlade: Settings.__do_layout
38
sizer_4 = wx.BoxSizer(wx.VERTICAL)
39
sizer_5 = wx.BoxSizer(wx.VERTICAL)
40
sizer_6 = wx.BoxSizer(wx.HORIZONTAL)
41
sizer_8 = wx.BoxSizer(wx.VERTICAL)
42
sizer_7 = wx.BoxSizer(wx.VERTICAL)
43
sizer_7.Add(self.list_ctrl_2, 1, wx.EXPAND, 0)
44
sizer_7.Add(self.list_ctrl_3, 1, wx.EXPAND, 0)
45
sizer_6.Add(sizer_7, 1, wx.EXPAND, 0)
46
sizer_6.Add(self.list_ctrl_1, 1, wx.EXPAND, 0)
47
sizer_8.Add(self.list_ctrl_4, 1, wx.EXPAND, 0)
48
sizer_8.Add(self.list_ctrl_5, 1, wx.EXPAND, 0)
49
sizer_6.Add(sizer_8, 1, wx.EXPAND, 0)
50
sizer_5.Add(sizer_6, 1, wx.EXPAND, 0)
51
sizer_5.Add(self.button_3, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 0)
52
sizer_4.Add(sizer_5, 1, wx.EXPAND, 0)
53
self.SetSizer(sizer_4)
57
def init(self,loc,name):
59
ln=loc+name+"/settings.py"
61
ln=loc+"/"+name+"/settings.py"
65
print "Not correct settings.py file"
69
for line in f.readlines():
71
x,y=line.strip().split(" = ")
77
self.list_ctrl_1.InsertColumn(0, 'Variable')
78
self.list_ctrl_1.InsertColumn(1, 'Value')
79
self.list_ctrl_1.SetColumnWidth(0, 200)
80
self.list_ctrl_1.SetColumnWidth(1, 200)
82
num_items = self.list_ctrl_1.GetItemCount()
83
self.list_ctrl_1.InsertStringItem(num_items, item[0])
84
self.list_ctrl_1.SetStringItem(num_items, 1, item[1])
85
self.list_ctrl_2.InsertColumn(0, 'Installed App\'s')
86
self.list_ctrl_2.SetColumnWidth(0, 400)
87
for item in self.gev("INSTALLED_APPS",ln):
88
num_items = self.list_ctrl_2.GetItemCount()
89
self.list_ctrl_2.InsertStringItem(num_items, item)
90
self.list_ctrl_3.InsertColumn(0, 'Middleware Classes')
91
self.list_ctrl_3.SetColumnWidth(0, 400)
92
for item in self.gev("MIDDLEWARE_CLASSES",ln):
93
num_items = self.list_ctrl_3.GetItemCount()
94
self.list_ctrl_3.InsertStringItem(num_items, item)
95
self.list_ctrl_4.InsertColumn(0, 'Template Dirs')
96
self.list_ctrl_4.SetColumnWidth(0, 400)
97
for item in self.gev("TEMPLATE_DIRS",ln):
98
num_items = self.list_ctrl_4.GetItemCount()
99
self.list_ctrl_4.InsertStringItem(num_items, item)
100
self.list_ctrl_5.InsertColumn(0, 'Template Loaders')
101
self.list_ctrl_5.SetColumnWidth(0, 400)
102
for item in self.gev("TEMPLATE_LOADERS",ln):
103
num_items = self.list_ctrl_5.GetItemCount()
104
self.list_ctrl_5.InsertStringItem(num_items, item)
106
def gev(self,varname,loc):
111
for line in f.readlines():
117
lns.append(line.strip())
120
def setok(self, event): # wxGlade: Settings.<event_handler>
123
# end of class Settings
126
class Welcome(wx.Frame):
127
def __init__(self, *args, **kwds):
128
# begin wxGlade: Welcome.__init__
129
kwds["style"] = wx.DEFAULT_FRAME_STYLE
130
wx.Frame.__init__(self, *args, **kwds)
131
self.label_2 = wx.StaticText(self, -1, "Starting a new djangoproject...")
132
self.label_3 = wx.StaticText(self, -1, "project name")
133
self.proname = wx.TextCtrl(self, -1, "")
134
self.label_3_copy_copy = wx.StaticText(self, -1, "project location")
135
self.proloc = wx.TextCtrl(self, -1, "")
136
self.label_3_copy = wx.StaticText(self, -1, "media location")
137
self.medloc = wx.TextCtrl(self, -1, "")
138
self.label_3_copy_1 = wx.StaticText(self, -1, "admin location")
139
self.adminloc = wx.TextCtrl(self, -1, "")
140
self.label_1 = wx.StaticText(self, -1, "Continue?")
141
self.button_1 = wx.Button(self, wx.ID_YES, "")
142
self.button_2 = wx.Button(self, wx.ID_NO, "")
144
self.__set_properties()
147
self.Bind(wx.EVT_BUTTON, self.yes, self.button_1)
148
self.Bind(wx.EVT_BUTTON, self.no, self.button_2)
151
def __set_properties(self):
152
# begin wxGlade: Welcome.__set_properties
153
self.SetTitle("Welcome")
156
def __do_layout(self):
157
# begin wxGlade: Welcome.__do_layout
158
sizer_1 = wx.BoxSizer(wx.VERTICAL)
159
sizer_2 = wx.BoxSizer(wx.VERTICAL)
160
sizer_3 = wx.BoxSizer(wx.HORIZONTAL)
161
grid_sizer_1 = wx.GridSizer(3, 2, 0, 0)
162
sizer_2.Add(self.label_2, 0, 0, 0)
163
grid_sizer_1.Add(self.label_3, 0, wx.EXPAND, 0)
164
grid_sizer_1.Add(self.proname, 0, wx.EXPAND, 0)
165
grid_sizer_1.Add(self.label_3_copy_copy, 0, wx.EXPAND, 0)
166
grid_sizer_1.Add(self.proloc, 0, wx.EXPAND, 0)
167
grid_sizer_1.Add(self.label_3_copy, 0, wx.EXPAND, 0)
168
grid_sizer_1.Add(self.medloc, 0, wx.EXPAND, 0)
169
grid_sizer_1.Add(self.label_3_copy_1, 0, wx.EXPAND, 0)
170
grid_sizer_1.Add(self.adminloc, 0, wx.EXPAND, 0)
171
sizer_2.Add(grid_sizer_1, 0, wx.EXPAND, 0)
172
sizer_3.Add(self.label_1, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 0)
173
sizer_3.Add(self.button_1, 0, 0, 0)
174
sizer_3.Add(self.button_2, 0, 0, 0)
175
sizer_2.Add(sizer_3, 0, wx.EXPAND, 0)
176
sizer_1.Add(sizer_2, 1, wx.EXPAND, 0)
177
self.SetSizer(sizer_1)
182
def yes(self, event): # wxGlade: Welcome.<event_handler>
184
1.Check if django is installed, if not give the possibility between -distro or -recent stable or -recent dev
186
3.show settings.py in easy editable way
187
4.apache or webserver configuration
192
print "django not installed"
195
if os.getcwd()!=self.proloc.GetValue():
196
os.chdir(self.proloc.GetValue())
197
os.system("django-admin.py startproject "+self.proname.GetValue())
198
#Set media and admin media
200
print "project creation error"
202
Set=Settings(None,-1,"")
204
Set.init(self.proloc.GetValue(),self.proname.GetValue())
207
def no(self, event): # wxGlade: Welcome.<event_handler>
210
# end of class Welcome
212
class DGOConf(wx.Frame):
213
def __init__(self, *args, **kwds):
214
# begin wxGlade: DGOConf.__init__
215
kwds["style"] = wx.DEFAULT_FRAME_STYLE
216
wx.Frame.__init__(self, *args, **kwds)
217
self.panel_1 = wx.Panel(self, -1)
218
self.proloc = wx.TextCtrl(self.panel_1, -1, "")
219
self.proname = wx.TextCtrl(self.panel_1, -1, "")
220
self.confbut = wx.Button(self.panel_1, -1, "C&onfigure")
221
self.cancbut = wx.Button(self.panel_1, wx.ID_CANCEL, "")
223
self.__set_properties()
226
self.Bind(wx.EVT_BUTTON, self.conf, self.confbut)
227
self.Bind(wx.EVT_BUTTON, self.cancel, self.cancbut)
230
def __set_properties(self):
231
# begin wxGlade: DGOConf.__set_properties
232
self.SetTitle("DGO Configuration")
235
def __do_layout(self):
236
# begin wxGlade: DGOConf.__do_layout
237
sizer_17 = wx.BoxSizer(wx.VERTICAL)
238
sizer_18 = wx.BoxSizer(wx.VERTICAL)
239
sizer_19 = wx.BoxSizer(wx.HORIZONTAL)
240
sizer_18.Add(self.proloc, 0, wx.ADJUST_MINSIZE, 0)
241
sizer_18.Add(self.proname, 0, wx.ADJUST_MINSIZE, 0)
242
sizer_19.Add(self.confbut, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
243
sizer_19.Add(self.cancbut, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
244
sizer_18.Add(sizer_19, 0, wx.EXPAND, 0)
245
self.panel_1.SetSizer(sizer_18)
246
sizer_17.Add(self.panel_1, 1, wx.EXPAND, 0)
247
self.SetSizer(sizer_17)
252
def conf(self, event): # wxGlade: DGOConf.<event_handler>
253
basics.config_set("proloc",'"'+self.proloc.GetValue()+'"',os.path.dirname(__file__)+"/dac.py")
254
basics.config_set("proname",'"'+self.proname.GetValue()+'"',os.path.dirname(__file__)+"/dac.py")
257
def cancel(self, event): # wxGlade: DGOConf.<event_handler>
260
# end of class DGOConf
262
if __name__ == "__main__":
263
app = wx.PySimpleApp(0)
264
wx.InitAllImageHandlers()
266
if len(sys.argv)==4 and sys.argv[1]=="set":
267
Set = Settings(None, -1, "")
268
app.SetTopWindow(Set)
270
Set.init(sys.argv[2],sys.argv[3])
271
elif sys.argv[1]=="conf":
272
Conf=DGOConf(None,-1,"")
273
app.SetTopWindow(Conf)
276
Welcome = Welcome(None, -1, "")
277
app.SetTopWindow(Welcome)