2
# -*- coding: utf-8 -*-
3
# generated by wxGlade 0.6.3 on Sun Nov 29 18:42:47 2009
5
import wx, os, datetime, stat
10
print "Attention: If you want to use MySQL you will have to install the MySQLdb module view Read-me for more information"
12
dcmdir=os.path.dirname(__file__) + "/"
13
dirs=[d for d in os.listdir(dcmdir) if os.path.isdir(d)]
16
if add=="DOPEN" or add==".svn":
19
exec("import "+add+".dac")
21
# begin wxGlade: extracode
24
class ChangeDirPanel(wx.Frame):
25
def __init__(self, *args, **kwds):
26
# begin wxGlade: ChangeDirPanel.__init__
27
kwds["style"] = wx.DEFAULT_FRAME_STYLE
28
wx.Frame.__init__(self, *args, **kwds)
29
self.panel_1 = wx.Panel(self, -1)
30
self.text_ctrl_16 = wx.TextCtrl(self.panel_1, -1, "")
31
self.button_5 = wx.Button(self.panel_1, -1, "C&hange")
32
self.button_9 = wx.Button(self.panel_1, wx.ID_CANCEL, "")
34
self.__set_properties()
37
self.Bind(wx.EVT_BUTTON, self.changedir, self.button_5)
38
self.Bind(wx.EVT_BUTTON, self.cancel, self.button_9)
41
def __set_properties(self):
42
# begin wxGlade: ChangeDirPanel.__set_properties
43
self.SetTitle("Change Directory")
44
self.text_ctrl_16.SetMinSize((400, 27))
47
def __do_layout(self):
48
# begin wxGlade: ChangeDirPanel.__do_layout
49
sizer_17 = wx.BoxSizer(wx.VERTICAL)
50
sizer_18 = wx.BoxSizer(wx.VERTICAL)
51
sizer_19 = wx.BoxSizer(wx.HORIZONTAL)
52
sizer_18.Add(self.text_ctrl_16, 0, wx.ADJUST_MINSIZE, 0)
53
sizer_19.Add(self.button_5, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
54
sizer_19.Add(self.button_9, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
55
sizer_18.Add(sizer_19, 0, wx.EXPAND, 0)
56
self.panel_1.SetSizer(sizer_18)
57
sizer_17.Add(self.panel_1, 1, wx.EXPAND, 0)
58
self.SetSizer(sizer_17)
63
def changedir(self, event): # wxGlade: ChangeDirPanel.<event_handler>
64
dcm.filedir = self.text_ctrl_16.GetValue()
68
def cancel(self, event): # wxGlade: ChangeDirPanel.<event_handler>
71
# end of class ChangeDirPanel
74
class DedFrame(wx.MDIChildFrame):
75
def __init__(self, *args, **kwds):
76
# begin wxGlade: DedFrame.__init__
77
kwds["style"] = wx.DEFAULT_FRAME_STYLE
78
wx.MDIChildFrame.__init__(self, *args, **kwds)
79
self.text_ctrl_11 = wx.TextCtrl(self, -1, "")
81
self.__set_properties()
85
def __set_properties(self):
86
# begin wxGlade: DedFrame.__set_properties
87
self.SetTitle("frame_1")
90
def __do_layout(self):
91
# begin wxGlade: DedFrame.__do_layout
92
sizer_13 = wx.BoxSizer(wx.VERTICAL)
93
sizer_13.Add(self.text_ctrl_11, 1, wx.EXPAND|wx.ADJUST_MINSIZE, 0)
94
self.SetSizer(sizer_13)
99
# end of class DedFrame
102
class SendDialog(wx.Dialog):
103
def __init__(self, *args, **kwds):
104
# begin wxGlade: SendDialog.__init__
105
kwds["style"] = wx.DEFAULT_DIALOG_STYLE
106
wx.Dialog.__init__(self, *args, **kwds)
107
self.label_3 = wx.StaticText(self, -1, "To which directory\n should the file be uploaded?", style=wx.ALIGN_CENTRE)
108
self.text_ctrl_10 = wx.TextCtrl(self, -1, "/")
109
self.button_11 = wx.Button(self, -1, "Send!")
111
self.__set_properties()
114
self.Bind(wx.EVT_BUTTON, self.send_ftp, self.button_11)
117
def __set_properties(self):
118
# begin wxGlade: SendDialog.__set_properties
119
self.SetTitle("Send Options")
122
def __do_layout(self):
123
# begin wxGlade: SendDialog.__do_layout
124
sizer_5 = wx.BoxSizer(wx.VERTICAL)
125
sizer_12 = wx.BoxSizer(wx.HORIZONTAL)
126
sizer_12.Add(self.label_3, 1, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
127
sizer_12.Add(self.text_ctrl_10, 1, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
128
sizer_5.Add(sizer_12, 1, wx.EXPAND, 0)
129
sizer_5.Add(self.button_11, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
130
self.SetSizer(sizer_5)
135
def file(self,dcmdir,dir,file):
140
def send_ftp(self, event): # wxGlade: SendDialog.<event_handler>
141
if(self.text_ctrl_10.GetValue()):
142
lastdir = self.text_ctrl_10.GetValue()
143
if(lastdir.startswith("/")):
144
lastdir = lastdir.partition("/")[2]
145
optionframe = OptionFrame(None, -1, "")
146
optionframe.config_set("SLASTDIR",lastdir)
147
optionframe.config_set("SLASTFILE",self.lastfile)
148
ftpp = self.dcmdir + 'ftp.ded'
149
fl = self.curdir + "/" + self.lastfile
160
dcm.log("FTP:SEND:error")
164
# end of class SendDialog
167
class OptionFrame(wx.Frame):
168
def __init__(self, *args, **kwds):
169
# begin wxGlade: OptionFrame.__init__
170
kwds["style"] = wx.DEFAULT_FRAME_STYLE
171
wx.Frame.__init__(self, *args, **kwds)
172
self.notebook_2 = wx.Notebook(self, -1, style=0)
173
self.notebook_2_pane_5 = wx.Panel(self.notebook_2, -1)
174
self.notebook_2_pane_3 = wx.Panel(self.notebook_2, -1)
175
self.notebook_2_pane_2 = wx.Panel(self.notebook_2, -1)
176
self.notebook_2_pane_1 = wx.Panel(self.notebook_2, -1)
177
self.sizer_15_staticbox = wx.StaticBox(self.notebook_2_pane_5, -1, "FTP")
178
self.sizer_7_staticbox = wx.StaticBox(self.notebook_2_pane_1, -1, "Startup")
179
self.combo_box_1 = wx.ComboBox(self.notebook_2_pane_1, -1, choices=["File Manager", "MySql", "Deditor", "FTP"], style=wx.CB_DROPDOWN)
180
self.button_12 = wx.Button(self.notebook_2_pane_1, -1, "Apply")
181
self.label_12 = wx.StaticText(self.notebook_2_pane_2, -1, "The Default Folder:", style=wx.ALIGN_CENTRE)
182
self.text_ctrl_7 = wx.TextCtrl(self.notebook_2_pane_2, -1, "")
183
self.button_8 = wx.Button(self.notebook_2_pane_2, -1, "Apply")
184
self.checkbox_10 = wx.CheckBox(self.notebook_2_pane_3, -1, "Start MySQL by default")
185
self.label_7 = wx.StaticText(self.notebook_2_pane_3, -1, "Server name")
186
self.text_ctrl_3 = wx.TextCtrl(self.notebook_2_pane_3, -1, "")
187
self.label_8 = wx.StaticText(self.notebook_2_pane_3, -1, "Username")
188
self.text_ctrl_4 = wx.TextCtrl(self.notebook_2_pane_3, -1, "")
189
self.label_9 = wx.StaticText(self.notebook_2_pane_3, -1, "Password")
190
self.text_ctrl_5 = wx.TextCtrl(self.notebook_2_pane_3, -1, "", style=wx.TE_PASSWORD)
191
self.label_10 = wx.StaticText(self.notebook_2_pane_3, -1, "Database")
192
self.text_ctrl_6 = wx.TextCtrl(self.notebook_2_pane_3, -1, "")
193
self.label_11 = wx.StaticText(self.notebook_2_pane_3, -1, "You have to fill in a server name, username\npassword and database\nto connect with MySQL")
194
self.button_6 = wx.Button(self.notebook_2_pane_3, -1, "Apply")
195
self.notebook_2_pane_4 = wx.Panel(self.notebook_2, -1)
196
self.label_4 = wx.StaticText(self.notebook_2_pane_5, -1, "Server")
197
self.text_ctrl_13 = wx.TextCtrl(self.notebook_2_pane_5, -1, "")
198
self.label_5 = wx.StaticText(self.notebook_2_pane_5, -1, "User")
199
self.text_ctrl_14 = wx.TextCtrl(self.notebook_2_pane_5, -1, "")
200
self.label_6 = wx.StaticText(self.notebook_2_pane_5, -1, "Pass")
201
self.text_ctrl_15 = wx.TextCtrl(self.notebook_2_pane_5, -1, "", style=wx.TE_PASSWORD)
202
self.button_13 = wx.Button(self.notebook_2_pane_5, -1, "Apply")
204
self.__set_properties()
207
self.Bind(wx.EVT_BUTTON, self.startup, self.button_12)
208
self.Bind(wx.EVT_BUTTON, self.fdeffolder, self.button_8)
209
self.Bind(wx.EVT_CHECKBOX, self.mysql_default, self.checkbox_10)
210
self.Bind(wx.EVT_BUTTON, self.mysql_database, self.button_6)
211
self.Bind(wx.EVT_BUTTON, self.ftp_config, self.button_13)
214
value = dcm.config_get("GSTARTUP")
215
if(value == "MySQL"):
216
self.combo_box_1.SetValue("MySql")
217
elif(value == "Deditor"):
218
self.combo_box_1.SetValue("Deditor")
219
elif(value == "FTP"):
220
self.combo_box_1.SetValue("FTP")
222
self.combo_box_1.SetValue("File Manager")
223
value = dcm.config_get("MSTART")
225
self.checkbox_10.SetValue(1)
227
self.checkbox_10.SetValue(0)
228
value = dcm.config_get("MSERVER")
229
self.text_ctrl_3.SetValue(value)
230
value = dcm.config_get("MUSER")
231
self.text_ctrl_4.SetValue(value)
232
value = dcm.config_get("MPASS")
233
self.text_ctrl_5.SetValue(value)
234
value = dcm.config_get("MDATA")
235
self.text_ctrl_6.SetValue(value)
236
value = dcm.config_get("SSERVER")
237
self.text_ctrl_13.SetValue(value)
238
value = dcm.config_get("SUSER")
239
self.text_ctrl_14.SetValue(value)
240
value = dcm.config_get("SPASS")
241
self.text_ctrl_15.SetValue(value)
243
def __set_properties(self):
244
# begin wxGlade: OptionFrame.__set_properties
245
self.SetTitle("Options")
246
self.SetSize((650, 633))
247
self.combo_box_1.SetSelection(0)
248
self.label_12.SetMinSize((125, 17))
249
self.text_ctrl_7.SetMinSize((200, 27))
250
self.text_ctrl_3.SetMinSize((200, 27))
251
self.text_ctrl_4.SetMinSize((200, 27))
252
self.text_ctrl_5.SetMinSize((200, 27))
253
self.text_ctrl_6.SetMinSize((200, 27))
254
self.label_11.SetFont(wx.Font(10, wx.DEFAULT, wx.ITALIC, wx.NORMAL, 0, ""))
255
self.text_ctrl_13.SetMinSize((300, 27))
256
self.text_ctrl_14.SetMinSize((300, 27))
257
self.text_ctrl_15.SetMinSize((300, 27))
260
def __do_layout(self):
261
# begin wxGlade: OptionFrame.__do_layout
262
sizer_3 = wx.BoxSizer(wx.VERTICAL)
263
sizer_15 = wx.StaticBoxSizer(self.sizer_15_staticbox, wx.VERTICAL)
264
grid_sizer_2 = wx.GridSizer(4, 2, 0, 0)
265
sizer_8 = wx.BoxSizer(wx.VERTICAL)
266
grid_sizer_3 = wx.GridSizer(5, 2, 0, 0)
267
sizer_6 = wx.BoxSizer(wx.VERTICAL)
268
sizer_9 = wx.GridSizer(1, 2, 0, 0)
269
sizer_7 = wx.StaticBoxSizer(self.sizer_7_staticbox, wx.VERTICAL)
270
sizer_7.Add(self.combo_box_1, 0, wx.EXPAND|wx.ADJUST_MINSIZE, 0)
271
sizer_7.Add(self.button_12, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
272
self.notebook_2_pane_1.SetSizer(sizer_7)
273
sizer_9.Add(self.label_12, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 0)
274
sizer_9.Add(self.text_ctrl_7, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 0)
275
sizer_6.Add(sizer_9, 0, wx.EXPAND, 0)
276
sizer_6.Add(self.button_8, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
277
self.notebook_2_pane_2.SetSizer(sizer_6)
278
sizer_8.Add(self.checkbox_10, 0, wx.ADJUST_MINSIZE, 0)
279
grid_sizer_3.Add(self.label_7, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
280
grid_sizer_3.Add(self.text_ctrl_3, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
281
grid_sizer_3.Add(self.label_8, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
282
grid_sizer_3.Add(self.text_ctrl_4, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
283
grid_sizer_3.Add(self.label_9, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
284
grid_sizer_3.Add(self.text_ctrl_5, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
285
grid_sizer_3.Add(self.label_10, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
286
grid_sizer_3.Add(self.text_ctrl_6, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
287
grid_sizer_3.Add(self.label_11, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
288
grid_sizer_3.Add(self.button_6, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
289
sizer_8.Add(grid_sizer_3, 1, wx.EXPAND, 0)
290
self.notebook_2_pane_3.SetSizer(sizer_8)
291
grid_sizer_2.Add(self.label_4, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
292
grid_sizer_2.Add(self.text_ctrl_13, 0, wx.ALIGN_BOTTOM|wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
293
grid_sizer_2.Add(self.label_5, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
294
grid_sizer_2.Add(self.text_ctrl_14, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
295
grid_sizer_2.Add(self.label_6, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
296
grid_sizer_2.Add(self.text_ctrl_15, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
297
grid_sizer_2.Add(self.button_13, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
298
sizer_15.Add(grid_sizer_2, 1, wx.EXPAND|wx.SHAPED, 0)
299
self.notebook_2_pane_5.SetSizer(sizer_15)
300
self.notebook_2.AddPage(self.notebook_2_pane_1, "General")
301
self.notebook_2.AddPage(self.notebook_2_pane_2, "File Manager")
302
self.notebook_2.AddPage(self.notebook_2_pane_3, "MySQL")
303
self.notebook_2.AddPage(self.notebook_2_pane_4, "Deditor")
304
self.notebook_2.AddPage(self.notebook_2_pane_5, "Send")
305
sizer_3.Add(self.notebook_2, 1, wx.EXPAND, 0)
306
self.SetSizer(sizer_3)
308
self.SetSize((650, 633))
311
def config_set(self,name,new):
312
self.config = dcm.dcmdir + "config.ded"
313
last = dcm.config_get(name)
314
last = name + "|" + last
315
new = name + "|" + new
317
s = open(self.config, 'r').read()
319
dcm.log("error: could not open" + self.config + " error generated in config_set")
320
s = s.replace(last, new)
321
f = open(self.config, 'w')
325
def startup(self, event): # wxGlade: OptionFrame.<event_handler>
326
if(self.combo_box_1.GetValue() == "File Manager"):
328
elif(self.combo_box_1.GetValue() == "MySql"):
330
elif(self.combo_box_1.GetValue() == "Deditor"):
331
selection = "Deditor"
334
self.config_set("GSTARTUP",selection)
336
def mysql_default(self, event): # wxGlade: OptionFrame.<event_handler>
337
server = dcm.config_get("MSERVER")
338
muser = dcm.config_get("MUSER")
339
mpass = dcm.config_get("MPASS")
340
mdata = dcm.config_get("MDATA")
341
if((server != 'None') and (muser != 'None') and (mpass != 'None') and (mdata != 'None')):
342
if(self.checkbox_10.GetValue() == 0):
346
self.config_set("MSTART",selection)
348
self.checkbox_10.SetValue(0)
349
dcm.SetStatusText("Please fill in a servername/username/password or databasename")
351
def mysql_database(self, event): # wxGlade: OptionFrame.<event_handler>
352
if(self.text_ctrl_3.GetValue() and self.text_ctrl_4.GetValue() and self.text_ctrl_5.GetValue() and self.text_ctrl_6.GetValue()):
353
self.config_set("MSERVER",self.text_ctrl_3.GetValue())
354
self.config_set("MUSER",self.text_ctrl_4.GetValue())
355
self.config_set("MPASS",self.text_ctrl_5.GetValue())
356
self.config_set("MDATA",self.text_ctrl_6.GetValue())
358
def fdeffolder(self, event): # wxGlade: OptionFrame.<event_handler>
359
if(self.text_ctrl_7.GetValue()):
360
self.config_set("FDEF",self.text_ctrl_7.GetValue())
362
def ftp_config(self, event): # wxGlade: OptionFrame.<event_handler>
363
if(self.text_ctrl_13.GetValue() and self.text_ctrl_14.GetValue() and self.text_ctrl_15.GetValue()):
364
self.config_set("SSERVER",self.text_ctrl_13.GetValue())
365
self.config_set("SUSER",self.text_ctrl_14.GetValue())
366
self.config_set("SPASS",self.text_ctrl_15.GetValue())
368
# end of class OptionFrame
371
class MyFrame(wx.Frame):
372
def __init__(self, *args, **kwds):
373
# begin wxGlade: MyFrame.__init__
374
kwds["style"] = wx.DEFAULT_FRAME_STYLE
375
wx.Frame.__init__(self, *args, **kwds)
376
self.notebook_1 = wx.Notebook(self, -1, style=0)
377
self.notebook_1_pane_5 = wx.Panel(self.notebook_1, -1)
378
self.notebook_1_pane_4 = wx.Panel(self.notebook_1, -1)
379
self.notebook_1_pane_3 = wx.Panel(self.notebook_1, 3)
380
self.notebook_1_pane_2 = wx.Panel(self.notebook_1, 2)
381
self.notebook_1_pane_1 = wx.Panel(self.notebook_1, 1)
382
self.notebook_3 = wx.Notebook(self.notebook_1_pane_1, -1, style=wx.NB_RIGHT)
383
self.notebook_3_pane_2 = wx.Panel(self.notebook_3, -1)
384
self.notebook_3_pane_1 = wx.Panel(self.notebook_3, -1)
387
self.menubar = wx.MenuBar()
388
wxglade_tmp_menu = wx.Menu()
389
wxglade_tmp_menu.Append(5, "Options", "", wx.ITEM_NORMAL)
390
wxglade_tmp_menu.Append(12, "Extlib Manager", "", wx.ITEM_NORMAL)
391
wxglade_tmp_menu.Append(13, "Update Extlib", "", wx.ITEM_NORMAL)
392
wxglade_tmp_menu.Append(11, "Open FIle", "", wx.ITEM_NORMAL)
393
wxglade_tmp_menu.Append(14, "Terminal Window", "", wx.ITEM_NORMAL)
394
wxglade_tmp_menu.AppendSeparator()
395
wxglade_tmp_menu.Append(2, "Quit", "", wx.ITEM_NORMAL)
396
self.menubar.Append(wxglade_tmp_menu, "DCM")
397
wxglade_tmp_menu = wx.Menu()
398
wxglade_tmp_menu.Append(1, "Change Dir", "", wx.ITEM_NORMAL)
399
self.menubar.Append(wxglade_tmp_menu, "File Manager")
400
wxglade_tmp_menu = wx.Menu()
401
wxglade_tmp_menu.Append(3, "Start", "", wx.ITEM_NORMAL)
402
wxglade_tmp_menu.Append(4, "Stop", "", wx.ITEM_NORMAL)
403
self.menubar.Append(wxglade_tmp_menu, "MySql")
404
wxglade_tmp_menu = wx.Menu()
405
wxglade_tmp_menu.Append(6, "start", "", wx.ITEM_NORMAL)
406
wxglade_tmp_menu.Append(7, "stop", "", wx.ITEM_NORMAL)
407
self.menubar.Append(wxglade_tmp_menu, "FTP")
408
wxglade_tmp_menu = wx.Menu()
409
wxglade_tmp_menu.Append(8, "Save", "", wx.ITEM_NORMAL)
410
wxglade_tmp_menu.Append(9, "Upload (FTP)", "", wx.ITEM_NORMAL)
411
wxglade_tmp_menu.Append(10, "2nd Deditor", "", wx.ITEM_NORMAL)
412
self.menubar.Append(wxglade_tmp_menu, "Deditor")
413
self.SetMenuBar(self.menubar)
415
self.statusbar = self.CreateStatusBar(0, 0)
416
self.list_box_1 = wx.ListBox(self.notebook_1_pane_1, -1, choices=[])
417
self.label_1 = wx.StaticText(self.notebook_3_pane_1, -1, "Name:")
418
self.label_2 = wx.StaticText(self.notebook_3_pane_1, -1, "")
419
self.label_15 = wx.StaticText(self.notebook_3_pane_1, -1, "Size:")
420
self.label_16 = wx.StaticText(self.notebook_3_pane_1, -1, "")
421
self.button_1 = wx.Button(self.notebook_3_pane_1, -1, "DOPEN")
422
self.button_2 = wx.Button(self.notebook_3_pane_1, -1, "Edit")
423
self.text_ctrl_1 = wx.TextCtrl(self.notebook_3_pane_2, -1, "")
424
self.button_3 = wx.Button(self.notebook_3_pane_2, -1, "Rename")
425
self.text_ctrl_12 = wx.TextCtrl(self.notebook_3_pane_2, -1, "")
426
self.button_4 = wx.Button(self.notebook_3_pane_2, -1, "Chmod")
427
self.radio_box_1 = wx.RadioBox(self.notebook_3_pane_2, -1, "chmod input", choices=["octal", "symbolic"], majorDimension=0, style=wx.RA_SPECIFY_ROWS)
428
self.label_17 = wx.StaticText(self.notebook_3_pane_2, -1, "example:\nOctal (0)755\nSymbolic rwxr-xr-x")
429
self.text_ctrl_19 = wx.TextCtrl(self.notebook_3_pane_2, -1, "Passphrase")
430
self.button_15 = wx.Button(self.notebook_3_pane_2, -1, "DCrypt")
431
self.list_box_3 = wx.ListBox(self.notebook_1_pane_2, -1, choices=[])
432
self.text_ctrl_2 = wx.TextCtrl(self.notebook_1_pane_2, -1, "")
433
self.button_7 = wx.Button(self.notebook_1_pane_2, -1, "Run!")
434
self.text_ctrl_9 = wx.TextCtrl(self.notebook_1_pane_2, -1, "Query Output Will Appear here.", style=wx.TE_MULTILINE|wx.TE_READONLY)
435
self.text_ctrl_8 = wx.TextCtrl(self.notebook_1_pane_3, -1, "", style=wx.TE_MULTILINE)
436
self.list_box_2 = wx.ListBox(self.notebook_1_pane_4, -1, choices=[])
437
self.label_13 = wx.StaticText(self.notebook_1_pane_4, -1, "Name:")
438
self.label_14 = wx.StaticText(self.notebook_1_pane_4, -1, "")
439
self.button_10 = wx.Button(self.notebook_1_pane_4, -1, "Download and Open with Deditor")
440
self.text_ctrl_17 = wx.TextCtrl(self.notebook_1_pane_5, -1, "")
441
self.button_14 = wx.Button(self.notebook_1_pane_5, -1, "Run!")
442
self.text_ctrl_18 = wx.TextCtrl(self.notebook_1_pane_5, -1, "", style=wx.TE_MULTILINE|wx.TE_READONLY)
444
self.__set_properties()
447
self.Bind(wx.EVT_MENU, self.options, id=5)
448
self.Bind(wx.EVT_MENU, self.extlibman, id=12)
449
self.Bind(wx.EVT_MENU, self.extupdate, id=13)
450
self.Bind(wx.EVT_MENU, self.open_file, id=11)
451
self.Bind(wx.EVT_MENU, self.terminal, id=14)
452
self.Bind(wx.EVT_MENU, self.quit, id=2)
453
self.Bind(wx.EVT_MENU, self.change_dir, id=1)
454
self.Bind(wx.EVT_MENU, self.start_mysql, id=3)
455
self.Bind(wx.EVT_MENU, self.stop_mysql, id=4)
456
self.Bind(wx.EVT_MENU, self.ftp_start, id=6)
457
self.Bind(wx.EVT_MENU, self.ftp_stop, id=7)
458
self.Bind(wx.EVT_MENU, self.dedsave, id=8)
459
self.Bind(wx.EVT_MENU, self.fptup, id=9)
460
self.Bind(wx.EVT_MENU, self.secded, id=10)
461
self.Bind(wx.EVT_LISTBOX_DCLICK, self.listbox, self.list_box_1)
462
self.Bind(wx.EVT_BUTTON, self.dopen, self.button_1)
463
self.Bind(wx.EVT_BUTTON, self.edit, self.button_2)
464
self.Bind(wx.EVT_BUTTON, self.rename, self.button_3)
465
self.Bind(wx.EVT_BUTTON, self.chmod, self.button_4)
466
self.Bind(wx.EVT_RADIOBOX, self.init_chmod, self.radio_box_1)
467
self.Bind(wx.EVT_BUTTON, self.dcrypt, self.button_15)
468
self.Bind(wx.EVT_BUTTON, self.do_query, self.button_7)
469
self.Bind(wx.EVT_LISTBOX_DCLICK, self.ftp_list, self.list_box_2)
470
self.Bind(wx.EVT_BUTTON, self.fdown, self.button_10)
471
self.Bind(wx.EVT_BUTTON, self.derminal, self.button_14)
476
def __set_properties(self):
477
# begin wxGlade: MyFrame.__set_properties
479
_icon = wx.EmptyIcon()
480
_icon.CopyFromBitmap(wx.Bitmap("/home/darragh/Afbeeldingen/mysql.png", wx.BITMAP_TYPE_ANY))
482
self.SetSize((1279, 691))
483
self.statusbar.SetStatusWidths([])
485
statusbar_fields = []
486
for i in range(len(statusbar_fields)):
487
self.statusbar.SetStatusText(statusbar_fields[i], i)
488
self.list_box_1.SetMinSize((350, 605))
489
self.label_1.SetBackgroundColour(wx.Colour(216, 216, 191))
490
self.label_1.SetForegroundColour(wx.Colour(255, 0, 0))
491
self.label_2.SetBackgroundColour(wx.Colour(216, 216, 191))
492
self.label_2.SetForegroundColour(wx.Colour(255, 0, 0))
493
self.label_15.SetBackgroundColour(wx.Colour(216, 216, 191))
494
self.label_15.SetForegroundColour(wx.Colour(255, 0, 0))
495
self.label_16.SetBackgroundColour(wx.Colour(216, 216, 191))
496
self.label_16.SetForegroundColour(wx.Colour(255, 0, 0))
497
self.text_ctrl_1.SetMinSize((400, 27))
498
self.text_ctrl_12.SetMinSize((400, 27))
499
self.radio_box_1.SetSelection(0)
500
self.text_ctrl_19.SetMinSize((400, 27))
501
self.notebook_1_pane_1.SetBackgroundColour(wx.Colour(216, 216, 191))
502
self.list_box_3.SetMinSize((350, 63))
503
self.text_ctrl_2.SetMinSize((250, 27))
504
self.notebook_1_pane_2.SetBackgroundColour(wx.Colour(216, 216, 191))
505
self.text_ctrl_8.SetBackgroundColour(wx.Colour(216, 216, 191))
506
self.list_box_2.SetMinSize((350, 328))
507
self.label_13.SetBackgroundColour(wx.Colour(216, 216, 191))
508
self.label_13.SetForegroundColour(wx.Colour(255, 0, 0))
509
self.label_14.SetBackgroundColour(wx.Colour(216, 216, 191))
510
self.label_14.SetForegroundColour(wx.Colour(255, 0, 0))
511
self.notebook_1_pane_4.SetBackgroundColour(wx.Colour(216, 216, 191))
512
self.text_ctrl_17.SetMinSize((1185, 27))
513
self.text_ctrl_18.SetBackgroundColour(wx.Colour(216, 216, 191))
514
self.notebook_1.SetBackgroundColour(wx.Colour(255, 0, 0))
515
self.notebook_1.SetForegroundColour(wx.Colour(255, 255, 255))
518
def __do_layout(self):
519
# begin wxGlade: MyFrame.__do_layout
520
sizer_1 = wx.BoxSizer(wx.VERTICAL)
521
sizer_20 = wx.BoxSizer(wx.VERTICAL)
522
sizer_21 = wx.BoxSizer(wx.HORIZONTAL)
523
sizer_10 = wx.BoxSizer(wx.HORIZONTAL)
524
grid_sizer_4 = wx.GridSizer(2, 2, 0, 0)
525
sizer_11 = wx.BoxSizer(wx.HORIZONTAL)
526
sizer_4 = wx.BoxSizer(wx.HORIZONTAL)
527
grid_sizer_5 = wx.GridSizer(2, 2, 0, 0)
528
sizer_2 = wx.BoxSizer(wx.HORIZONTAL)
529
sizer_16 = wx.BoxSizer(wx.VERTICAL)
530
grid_sizer_6 = wx.GridSizer(4, 2, 0, 0)
531
sizer_14 = wx.BoxSizer(wx.VERTICAL)
532
grid_sizer_1 = wx.GridSizer(5, 2, 0, 0)
533
sizer_2.Add(self.list_box_1, 0, wx.EXPAND|wx.ADJUST_MINSIZE, 0)
534
grid_sizer_1.Add(self.label_1, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
535
grid_sizer_1.Add(self.label_2, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE|wx.FIXED_MINSIZE, 0)
536
grid_sizer_1.Add(self.label_15, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE|wx.FIXED_MINSIZE, 0)
537
grid_sizer_1.Add(self.label_16, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE|wx.FIXED_MINSIZE, 0)
538
grid_sizer_1.Add(self.button_1, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
539
grid_sizer_1.Add(self.button_2, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
540
sizer_14.Add(grid_sizer_1, 0, wx.EXPAND, 0)
541
self.notebook_3_pane_1.SetSizer(sizer_14)
542
grid_sizer_6.Add(self.text_ctrl_1, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
543
grid_sizer_6.Add(self.button_3, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
544
grid_sizer_6.Add(self.text_ctrl_12, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
545
grid_sizer_6.Add(self.button_4, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
546
grid_sizer_6.Add(self.radio_box_1, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
547
grid_sizer_6.Add(self.label_17, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
548
grid_sizer_6.Add(self.text_ctrl_19, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
549
grid_sizer_6.Add(self.button_15, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
550
sizer_16.Add(grid_sizer_6, 0, wx.EXPAND, 0)
551
self.notebook_3_pane_2.SetSizer(sizer_16)
552
self.notebook_3.AddPage(self.notebook_3_pane_1, "Basic")
553
self.notebook_3.AddPage(self.notebook_3_pane_2, "Advanced")
554
sizer_2.Add(self.notebook_3, 1, wx.EXPAND, 0)
555
self.notebook_1_pane_1.SetSizer(sizer_2)
556
sizer_4.Add(self.list_box_3, 0, wx.EXPAND|wx.ADJUST_MINSIZE, 0)
557
grid_sizer_5.Add(self.text_ctrl_2, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
558
grid_sizer_5.Add(self.button_7, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
559
grid_sizer_5.Add(self.text_ctrl_9, 0, wx.EXPAND|wx.ADJUST_MINSIZE, 0)
560
sizer_4.Add(grid_sizer_5, 1, wx.EXPAND, 0)
561
self.notebook_1_pane_2.SetSizer(sizer_4)
562
sizer_11.Add(self.text_ctrl_8, 1, wx.EXPAND|wx.ADJUST_MINSIZE, 0)
563
self.notebook_1_pane_3.SetSizer(sizer_11)
564
sizer_10.Add(self.list_box_2, 0, wx.EXPAND|wx.ADJUST_MINSIZE, 0)
565
grid_sizer_4.Add(self.label_13, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
566
grid_sizer_4.Add(self.label_14, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
567
grid_sizer_4.Add(self.button_10, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
568
sizer_10.Add(grid_sizer_4, 1, wx.EXPAND, 0)
569
self.notebook_1_pane_4.SetSizer(sizer_10)
570
sizer_21.Add(self.text_ctrl_17, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
571
sizer_21.Add(self.button_14, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
572
sizer_20.Add(sizer_21, 0, wx.EXPAND, 0)
573
sizer_20.Add(self.text_ctrl_18, 1, wx.EXPAND|wx.ADJUST_MINSIZE, 0)
574
self.notebook_1_pane_5.SetSizer(sizer_20)
575
self.notebook_1.AddPage(self.notebook_1_pane_1, "File Manager")
576
self.notebook_1.AddPage(self.notebook_1_pane_2, "MySql")
577
self.notebook_1.AddPage(self.notebook_1_pane_3, "Deditor")
578
self.notebook_1.AddPage(self.notebook_1_pane_4, "Ftp")
579
self.notebook_1.AddPage(self.notebook_1_pane_5, "Derminal")
580
sizer_1.Add(self.notebook_1, 1, wx.EXPAND, 0)
581
self.SetSizer(sizer_1)
583
self.SetSize((1279, 691))
586
def initialize(self):
587
#DCM FILES AND DIRECTORIES CHECK#
588
self.dcmdir = os.path.dirname(__file__) + "/"
589
if(os.path.exists(self.dcmdir + "dcmlog.ded") != True):
590
print "ATTENTION: LOG FILE MISSING: DCMLOG.DED"
591
if(os.path.exists(self.dcmdir + "config.ded") != True):
592
self.log("ATTENTION: CONFIGURATION FILE MISSING: CONFIG.DED")
594
self.SetStatusText("Welcome to DCM!")
595
self.log("DCM Started from " + self.dcmdir)
596
self.mysql_status = False
598
value = self.config_get("@IMPORT:DOPEN")
604
value = self.config_get("GSTARTUP")
605
if(value == "MySQL"):
606
self.notebook_1.SetSelection(1)
607
elif(value == "Deditor"):
608
self.notebook_1.SetSelection(2)
609
elif(value == "FTP"):
610
self.notebook_1.SetSelection(3)
612
self.notebook_1.SetSelection(0)
613
#Mysql Start By default
614
value = self.config_get("MSTART")
619
if(self.extlib("@DCM:VERSION","YES") >= self.config_get("@DCM:VERSION")):
620
self.dopenvalid = True
622
self.dopenvalid = False
623
self.SetStatusText("ATTENTION: DOPEN IS NOT THE RIGHT VERSION")
625
value = self.config_get("SSERVER")
627
self.filedir = self.config_get("FDEF")
630
dirs=[d for d in os.listdir(self.dcmdir) if os.path.isdir(d)]
633
if add=="DOPEN" or add==".svn":
637
#imports are handled in top of file to assure they are global
642
# print "Error in initializing addon: "+str(add)
644
def window(self,add):
645
exec("from "+add+" import *")
649
elif window=="integrated":
650
pc=self.notebook_1.GetPageCount()
651
addpane = wx.Panel(self.notebook_1, -1)
652
sizeradd = wx.BoxSizer(wx.VERTICAL)
653
functions.SetWindow(sizeradd,addpane,pc)
654
addpane.SetSizer(sizeradd)
655
self.notebook_1.AddPage(addpane,add)
657
def addon_menu(self,add):
659
exec("from "+add+" import *")
662
menutitle=dac.menu_title
663
menucontent=dac.menu_content
668
wxglade_tmp_menu = wx.Menu()
670
for menu_item in menucontent:
671
self.ID_OPEN=wx.NewId()
672
wxglade_tmp_menu.Append(self.ID_OPEN, menucontent[i][0], "", eval("wx.ITEM_"+menucontent[i][1]))
673
if len(menucontent[i])==3:
674
self.Bind(wx.EVT_MENU, menucontent[i][2], id=self.ID_OPEN)
676
self.menubar.Append(wxglade_tmp_menu, menutitle)
678
# print "Menu Error in "+str(add)
680
def get_configuration(self,name,loc):
684
if name.strip()==line.strip().split("|")[0]:
685
strip=line.strip().split("|")[1]
690
print "error in configuration retrieving: "+str(loc)+" name: "+str(name)
692
def config_get(self,name):
693
self.config = self.dcmdir + "config.ded"
695
f = open(self.config, 'r')
697
self.log("error: could not open" + self.config + " error generated in config_get")
699
if name.strip() == line.strip().split("|")[0]:
700
strip = line.strip().split("|")[1]
704
def open_file(self, event): # wxGlade: MyFrame.<event_handler>
705
dlg = wx.FileDialog(self, message="Open File", defaultDir=self.filedir, defaultFile="", style=wx.OPEN)
706
if dlg.ShowModal() == wx.ID_OK:
707
self.opnfl = dlg.GetPath()
708
self.editfl(self.opnfl)
711
def quit(self, event): # wxGlade: MyFrame.<event_handler>
714
def file_show_dir(self):
715
self.list_box_1.Set([])
716
self.list_box_1.Append("[Back]")
717
listdir = os.listdir(self.filedir)
720
if(os.path.isdir(self.filedir + "/" + i)):
721
self.list_box_1.Append("[F] " + i)
723
self.list_box_1.Append(i)
724
self.SetStatusText("Directory List Updated")
725
self.log("Directory List Updated")
727
def listbox(self, event): # wxGlade: MyFrame.<event_handler>
728
if event.GetString().startswith("[F]"):
729
ev=event.GetString().strip().split(" ")[1::]
731
self.filedir += "/" + ev
733
elif "[Back]" in event.GetString():
734
if(self.filedir.rpartition("/")[0] == ''):
737
self.filedir = self.filedir.rpartition("/")[0]
740
self.abspath = self.filedir + "/" + event.GetString()
741
self.label_2.SetLabel(event.GetString())
742
self.curfile = event.GetString()
743
self.label_16.SetLabel(self.size(self.abspath))
744
self.text_ctrl_1.SetValue(event.GetString())
748
bytes = os.path.getsize(fl)
749
word=['b','kb','mb','gb','tb']
751
while bytes > 1000 and wrd <= 4:
754
return str(bytes) + " " + str(word[wrd])
756
def rename(self, event): # wxGlade: MyFrame.<event_handler>
757
if(self.text_ctrl_1.GetValue() != ''):
758
os.rename(self.curfile,self.text_ctrl_1.GetValue())
759
self.label_2.SetLabel(self.text_ctrl_1.GetValue())
760
self.SetStatusText("FM: Renamed " + self.curfile + " to " + self.text_ctrl_1.GetValue())
761
self.log("FM: Renamed " + self.curfile + " to " + self.text_ctrl_1.GetValue())
762
self.curfile = self.text_ctrl_1.GetValue()
765
self.SetStatusText("FM: Was not able to rename file")
766
self.log("error: not able to rename file")
768
def send(self, event): # wxGlade: MyFrame.<event_handler>
769
if(self.label_2.GetLabel()):
770
senddialog = SendDialog(None, -1, "")
771
senddialog.file(self.dcmdir,self.filedir,self.label_2.GetLabel())
774
def edit(self, event): # wxGlade: MyFrame.<event_handler>
775
fl = self.filedir + "/" + self.label_2.GetLabel()
778
for line in f.readlines():
781
self.notebook_1.SetSelection(2)
784
self.text_ctrl_8.SetValue(txt)
786
def editfl(self, fl):
792
self.notebook_1.SetSelection(2)
795
self.text_ctrl_8.SetValue(txt)
797
def start_mysql(self, event): # wxGlade: MyFrame.<event_handler>
800
def mysql_start(self):
801
localhost = self.config_get("MSERVER")
802
usr = self.config_get("MUSER")
803
password = self.config_get("MPASS")
804
data = self.config_get("MDATA")
806
self.db = MySQLdb.connect(localhost,usr,password,data)
807
self.cursor = self.db.cursor()
808
self.mysql_status = True
810
self.log("MySql: Start")
811
self.SetStatusText("Mysql: Start")
813
self.SetStatusText("Mysql: Not able to start")
814
self.log("MySQL: Not able to start")
816
def stop_mysql(self, event): # wxGlade: MyFrame.<event_handler>
817
self.mysql_status = False
818
self.SetStatusText("Mysql: Stop")
819
self.log("MySql: Stop")
822
def do_query(self, event): # wxGlade: MyFrame.<event_handler>
823
if(self.mysql_status):
824
self.qry = self.text_ctrl_2.GetValue()
826
self.cursor.execute(self.qry)
827
self.query = self.cursor.fetchall()
830
label += str(i) + "\n"
831
self.text_ctrl_9.SetValue(label)
832
self.SetStatusText("Mysql: Query: " + self.qry)
833
self.log("Mysql: Query: " + self.qry)
834
except MySQLdb.Error, e:
835
label = "Error %d:\n%s" % (e.args[0], e.args[1])
836
self.text_ctrl_9.SetValue(label)
837
self.log("MySql: Error: " + label)
838
self.SetStatusText("Mysql: Error: Query")
840
self.SetStatusText("ATTENTION: Mysql not started!")
842
def table_query(self, event): # wxGlade: MyFrame.<event_handler>
843
if(self.mysql_status):
844
self.qry = "SELECT * FROM " + event.GetString()
846
self.cursor.execute(self.qry)
847
self.query = self.cursor.fetchall()
850
label += str(i) + "\n"
851
self.text_ctrl_9.SetValue(label)
852
self.SetStatusText("Mysql: Query: " + self.qry)
853
self.log("Mysql: Query: " + self.qry)
854
except MySQLdb.Error, e:
855
label = "Error %d:\n%s" % (e.args[0], e.args[1])
856
self.text_ctrl_9.SetValue(label)
857
self.log("MySql: Error: " + label)
858
self.SetStatusText("Mysql: Error: Query")
860
self.SetStatusText("ATTENTION: Mysql not started!")
862
def mysql_table(self):
863
self.list_box_3.Set([])
865
self.cursor.execute("SHOW TABLES;")
866
self.query = self.cursor.fetchall()
870
i = str(i).strip().split("'")[1]
871
self.list_box_3.Append(str(i))
873
def options(self, event): # wxGlade: MyFrame.<event_handler>
874
self.opframe = OptionFrame(MyFrame(self), -1, "")
877
def dopen(self, event): # wxGlade: MyFrame.<event_handler>
878
dopn = self.extlib(self.label_2.GetLabel(),"NO")
879
os.system(dopn + " \"" + self.filedir + "/" + self.label_2.GetLabel() + "\" &")
881
def extlib(self,fl,at):
883
self.extlibloc = self.dcmdir + "DOPEN/extlib.ded"
889
num = len(fl.strip().split(".")) - 1
891
flext = fl.strip().split(".")[num]
893
fl = self.filedir + "/" + self.label_2.GetLabel()
896
for line in f.readlines():
897
if line.startswith("#!/"):
902
num = len(fl.strip().split("/")) - 1
903
flext = flext.split().strip("/")[num]
906
#flext = flext.strip().split(" ")[1]
908
#self.SetStatusText("This file does not have an extension and does not contain a header")
914
f = open(self.extlibloc, 'r')
916
self.log("extlibloc not right")
919
if flext.strip() == line.strip().split("|")[0]:
920
strip = line.strip().split("|")[1]
923
self.SetStatusText("Unknown Extension")
926
self.SetStatusText("DOPEN NOT IMPORTED!")
928
def log(self,string):
929
fl = self.dcmdir + "dcmlog.ded"
930
now = datetime.datetime.now()
931
nu = now.strftime("%Y-%m-%d %H:%M")
932
log = "\n" + nu + " " + string
938
self.SetStatusText("LOG FILE MISSING")
941
self.host = self.config_get("SSERVER")
942
self.usr = self.config_get("SUSER")
943
self.pswd = self.config_get("SPASS")
945
self.ftp = FTP(self.host)
946
self.ftp.login(self.usr,self.pswd)
947
self.SetStatusText("FTP: logged in")
948
self.log("FTP: logged in")
950
self.SetStatusText("FTP: Not able to login")
951
self.log("FTP: Not able to login")
952
self.ftpdir = self.ftp.pwd()
956
def ftp_show_dir(self):
957
self.list_box_2.Set([])
958
self.list_box_2.Append("[Back]")
959
listdir = self.ftp.nlst(self.ftpdir)
963
self.list_box_2.Append(i)
965
self.list_box_2.Append("[F]" + i)
966
#self.SetStatusText("Directory List Updated")
967
#self.log("Directory List Updated")
969
def ftp_list(self, event): # wxGlade: MyFrame.<event_handler>
970
if event.GetString().startswith("[F]"):
971
self.ftpdir = "./" + event.GetString().strip().split("]")[1]
973
elif "[Back]" in event.GetString():
974
if(self.ftpdir.rpartition("/")[0] == ''):
977
self.ftpdir = self.ftpdir.rpartition("/")[0]
980
self.label_14.SetLabel(event.GetString())
981
self.ftpfile = event.GetString()
983
def ftp_download(self,ftp):
984
ftpdir = ftp.rpartition("/")[0]
985
ftpfile = ftp.rpartition("/")[2]
986
self.ftp.cwd('/' + ftpdir)
987
retr = 'RETR ' + ftpfile
988
ftpp = self.dcmdir + 'ftp.ded'
989
self.ftp.retrbinary(retr, open(ftpp,'w').write)
992
for line in f.readlines():
995
self.notebook_1.SetSelection(2)
997
self.text_ctrl_8.SetValue(txt)
999
def ftp_upload(self):
1001
lastdir = self.config_get("SLASTDIR")
1002
lastfile = self.config_get("SLASTFILE")
1003
self.ftp.cwd('/' + lastdir)
1004
stor = 'STOR ' + lastfile
1005
fttp = self.dcmdir + 'ftp.ded'
1006
self.ftp.storbinary(stor, open(fttp))
1008
self.log("FTP:Upload:Error")
1009
self.SetStatusText("FTP:Upload:Error")
1011
def ftp_start(self, event): # wxGlade: MyFrame.<event_handler>
1014
def ftp_stop(self, event): # wxGlade: MyFrame.<event_handler>
1017
def fdown(self, event): # wxGlade: MyFrame.<event_handler>
1018
self.ftp_download(self.label_14.GetLabel())
1020
def fptup(self, event): # wxGlade: MyFrame.<event_handler>
1023
def dedsave(self, event): # wxGlade: MyFrame.<event_handler>
1024
if(self.dedfrom == 'ftp'):
1025
ftpp = self.dcmdir + 'ftp.ded'
1027
open(ftpp, 'w').write(self.text_ctrl_8.GetValue())
1029
self.log("error with deditor save ftp")
1030
elif(self.dedfrom == 'fm'):
1034
g.write(self.text_ctrl_8.GetValue())
1037
self.log("error with deditor save fm")
1039
def change_dir(self, event): # wxGlade: MyFrame.<event_handler>
1040
chgdir=ChangeDirPanel(None, -1, "")
1043
def secded(self, event): # wxGlade: MyFrame.<event_handler>
1044
self.SetStatusText("Opened deditor in own window")
1045
#if(self.dedget("location" != (self.dcmdir + "/Deditor/configuration.ded"))):
1046
#self.dedset("location",(self.dcmdir + "/Deditor/configuration.ded"))
1047
os.system(self.dcmdir + "/deditor.py &")
1049
def dedset(self, name, new):
1050
self.dedconf = self.dcmdir + "/Deditor/configuration.ded"
1051
last = self.dedget(name)
1052
last = name + " " + last
1053
new = name + " " + new
1055
s = open(self.dedconf, 'r').read()
1057
myframe.log("error: could not open" + self.dedconf + " error generated in config_set")
1058
s = s.replace(last, new)
1059
f = open(self.dedconf, 'w')
1063
def dedget(self,name):
1064
self.dedconf = self.dcmdir + "/Deditor/configuration.ded"
1066
f = open(self.dedconf, 'r')
1068
self.log("error: could not open" + self.dedconf + " error generated in config_get")
1070
if name.strip() == line.strip().split(" ")[0]:
1071
strip = line.strip().split(" ")[1]
1075
def chmod(self, event): # wxGlade: MyFrame.<event_handler>
1076
mode=self.text_ctrl_12.GetValue()
1077
if(self.radio_box_1.GetSelection()==0):
1078
os.system("chmod "+mode+" "+self.abspath)
1086
user=int(chmod[0:3],2)
1087
group=int(chmod[3:6],2)
1088
others=int(chmod[6::],2)
1089
chmod=str(user)+str(group)+str(others)
1090
os.system("chmod "+chmod+" "+self.abspath)
1092
def chmod_init(self):
1094
if(self.radio_box_1.GetSelection()==0):
1095
lvl=oct(stat.S_IMODE(os.lstat(self.abspath)[stat.ST_MODE]))
1097
mode=stat.S_IMODE(os.lstat(self.abspath)[stat.ST_MODE])
1098
for level in "USR", "GRP", "OTH":
1099
for perm in "R", "W", "X":
1100
if mode & getattr(stat,"S_I"+perm+level):
1104
self.text_ctrl_12.SetValue(lvl)
1106
def init_chmod(self, event): # wxGlade: MyFrame.<event_handler>
1109
def extlibman(self, event): # wxGlade: MyFrame.<event_handler>
1110
os.system(self.dcmdir + "/DOPEN/extlibman &")
1112
def extupdate(self, event): # wxGlade: MyFrame.<event_handler>
1113
p=os.popen(self.dcmdir + "/dcmd -u")
1114
version=p.readlines()
1119
os.system("curl http://d-cm.googlecode.com/files/extlib.ded -o "+self.dcmdir+"/DOPEN/dwnext.ded &")
1123
g_data=open(self.dcmdir+"/DOPEN/extlib.ded",'r').readlines()
1124
f_data=open(self.dcmdir+"/DOPEN/dwnext.ded",'r').readlines()
1127
if line.strip().split("|")[0] == ln.strip().split("|")[0]:
1129
if line.strip().split("|")[0] == "@DCM:VERSION":
1135
f=open(self.dcmdir+"/DOPEN/extlib.ded",'a')
1141
f = open(self.dcmdir+"/DOPEN/extlib.ded",'r')
1143
if line.strip().split("|")[0] == "@DCM:VERSION":
1151
f = open(self.dcmdir+"/DOPEN/extlib.ded",'w')
1157
def derminal(self, event): # wxGlade: MyFrame.<event_handler>
1158
if self.text_ctrl_17.GetValue() != "":
1159
cmd=os.popen(self.text_ctrl_17.GetValue())
1163
self.text_ctrl_18.SetValue(output)
1165
def terminal(self, event): # wxGlade: MyFrame.<event_handler>
1166
os.system("gnome-terminal --working-directory=\""+self.filedir+"\" &")
1168
def dcrypt(self, event): # wxGlade: MyFrame.<event_handler>
1169
print "Event handler `dcrypt' not implemented"
1172
# end of class MyFrame
1174
if __name__ == "__main__":
1175
app = wx.PySimpleApp(0)
1176
wx.InitAllImageHandlers()
1177
dcm = MyFrame(None, -1, "")
1178
app.SetTopWindow(dcm)