~darragh-ssa/d-cm/d-cm

« back to all changes in this revision

Viewing changes to dcm

  • Committer: Darragh van Tichelen
  • Date: 2010-05-14 10:43:53 UTC
  • Revision ID: darragh.ssa@gmail.com-20100514104353-8wp7qs02mskmtx7c
Cleanup of old files

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/env python
2
 
# -*- coding: utf-8 -*-
3
 
# generated by wxGlade 0.6.3 on Sun Nov 29 18:42:47 2009
4
 
 
5
 
import wx, os, datetime, stat
6
 
from ftplib import FTP
7
 
try:
8
 
    import MySQLdb
9
 
except:
10
 
    print "Attention: If you want to use MySQL you will have to install the MySQLdb module view Read-me for more information"
11
 
 
12
 
dcmdir=os.path.dirname(__file__) + "/"
13
 
dirs=[d for d in os.listdir(dcmdir) if os.path.isdir(d)]
14
 
adds=[]
15
 
for add in dirs:
16
 
    if add=="DOPEN" or add==".svn":
17
 
        pass
18
 
    else:
19
 
        exec("import "+add+".dac")
20
 
 
21
 
# begin wxGlade: extracode
22
 
# end wxGlade
23
 
 
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, "")
33
 
 
34
 
        self.__set_properties()
35
 
        self.__do_layout()
36
 
 
37
 
        self.Bind(wx.EVT_BUTTON, self.changedir, self.button_5)
38
 
        self.Bind(wx.EVT_BUTTON, self.cancel, self.button_9)
39
 
        # end wxGlade
40
 
 
41
 
    def __set_properties(self):
42
 
        # begin wxGlade: ChangeDirPanel.__set_properties
43
 
        self.SetTitle("Change Directory")
44
 
        self.text_ctrl_16.SetMinSize((400, 27))
45
 
        # end wxGlade
46
 
 
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)
59
 
        sizer_17.Fit(self)
60
 
        self.Layout()
61
 
        # end wxGlade
62
 
 
63
 
    def changedir(self, event): # wxGlade: ChangeDirPanel.<event_handler>
64
 
        dcm.filedir = self.text_ctrl_16.GetValue()
65
 
        dcm.file_show_dir()
66
 
        self.Close()
67
 
 
68
 
    def cancel(self, event): # wxGlade: ChangeDirPanel.<event_handler>
69
 
        self.Close()
70
 
 
71
 
# end of class ChangeDirPanel
72
 
 
73
 
 
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, "")
80
 
 
81
 
        self.__set_properties()
82
 
        self.__do_layout()
83
 
        # end wxGlade
84
 
 
85
 
    def __set_properties(self):
86
 
        # begin wxGlade: DedFrame.__set_properties
87
 
        self.SetTitle("frame_1")
88
 
        # end wxGlade
89
 
 
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)
95
 
        sizer_13.Fit(self)
96
 
        self.Layout()
97
 
        # end wxGlade
98
 
 
99
 
# end of class DedFrame
100
 
 
101
 
 
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!")
110
 
 
111
 
        self.__set_properties()
112
 
        self.__do_layout()
113
 
 
114
 
        self.Bind(wx.EVT_BUTTON, self.send_ftp, self.button_11)
115
 
        # end wxGlade
116
 
 
117
 
    def __set_properties(self):
118
 
        # begin wxGlade: SendDialog.__set_properties
119
 
        self.SetTitle("Send Options")
120
 
        # end wxGlade
121
 
 
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)
131
 
        sizer_5.Fit(self)
132
 
        self.Layout()
133
 
        # end wxGlade
134
 
 
135
 
    def file(self,dcmdir,dir,file):
136
 
        self.dcmdir = dcmdir
137
 
        self.curdir = dir
138
 
        self.lastfile = file
139
 
 
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
150
 
            try:
151
 
                f = open(fl, 'r')
152
 
                label = ""
153
 
                for line in f:
154
 
                    label += line
155
 
                f.close()
156
 
                g = open(ftpp,'w')
157
 
                g.write(label)
158
 
                g.close()
159
 
            except:
160
 
                dcm.log("FTP:SEND:error")
161
 
            dcm.ftp_upload()
162
 
            self.Destroy()
163
 
 
164
 
# end of class SendDialog
165
 
 
166
 
 
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")
203
 
 
204
 
        self.__set_properties()
205
 
        self.__do_layout()
206
 
 
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)
212
 
        # end wxGlade
213
 
 
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")
221
 
        else:
222
 
            self.combo_box_1.SetValue("File Manager")
223
 
        value = dcm.config_get("MSTART")
224
 
        if(value == "YES"):
225
 
            self.checkbox_10.SetValue(1)
226
 
        else:
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)
242
 
 
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))
258
 
        # end wxGlade
259
 
 
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)
307
 
        self.Layout()
308
 
        self.SetSize((650, 633))
309
 
        # end wxGlade
310
 
 
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
316
 
        try:
317
 
            s = open(self.config, 'r').read()
318
 
        except:
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')
322
 
        f.write(s)
323
 
        f.close()
324
 
 
325
 
    def startup(self, event): # wxGlade: OptionFrame.<event_handler>
326
 
        if(self.combo_box_1.GetValue() == "File Manager"):
327
 
            selection = "FM"
328
 
        elif(self.combo_box_1.GetValue() == "MySql"):
329
 
            selection = "MySQL"
330
 
        elif(self.combo_box_1.GetValue() == "Deditor"):
331
 
            selection = "Deditor"
332
 
        else:
333
 
            selection = "FTP"
334
 
        self.config_set("GSTARTUP",selection)
335
 
 
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):
343
 
                selection = "NO"
344
 
            else:
345
 
                selection = "YES"
346
 
            self.config_set("MSTART",selection)
347
 
        else:
348
 
            self.checkbox_10.SetValue(0)
349
 
            dcm.SetStatusText("Please fill in a servername/username/password or databasename")
350
 
 
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())
357
 
 
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())
361
 
 
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())
367
 
 
368
 
# end of class OptionFrame
369
 
 
370
 
 
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)
385
 
        
386
 
        # Menu Bar
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)
414
 
        # Menu Bar end
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)
443
 
 
444
 
        self.__set_properties()
445
 
        self.__do_layout()
446
 
 
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)
472
 
        # end wxGlade
473
 
 
474
 
        self.initialize()
475
 
 
476
 
    def __set_properties(self):
477
 
        # begin wxGlade: MyFrame.__set_properties
478
 
        self.SetTitle("DCM")
479
 
        _icon = wx.EmptyIcon()
480
 
        _icon.CopyFromBitmap(wx.Bitmap("/home/darragh/Afbeeldingen/mysql.png", wx.BITMAP_TYPE_ANY))
481
 
        self.SetIcon(_icon)
482
 
        self.SetSize((1279, 691))
483
 
        self.statusbar.SetStatusWidths([])
484
 
        # statusbar fields
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))
516
 
        # end wxGlade
517
 
 
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)
582
 
        self.Layout()
583
 
        self.SetSize((1279, 691))
584
 
        # end wxGlade
585
 
 
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")
593
 
        #Welcome Message
594
 
        self.SetStatusText("Welcome to DCM!")
595
 
        self.log("DCM Started from " + self.dcmdir)
596
 
        self.mysql_status = False
597
 
        #@Dopen
598
 
        value = self.config_get("@IMPORT:DOPEN")
599
 
        if(value == "YES"):
600
 
            self.dopen = True
601
 
        else:
602
 
            self.dopen = False
603
 
        #Notebook Check
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)
611
 
        else:
612
 
            self.notebook_1.SetSelection(0)
613
 
        #Mysql Start By default
614
 
        value = self.config_get("MSTART")
615
 
        if(value == "YES"):
616
 
            self.mysql_start()
617
 
        #DEXTLIB Check
618
 
        if(self.dopen):
619
 
            if(self.extlib("@DCM:VERSION","YES") >= self.config_get("@DCM:VERSION")):
620
 
                self.dopenvalid = True
621
 
            else:
622
 
                self.dopenvalid = False
623
 
                self.SetStatusText("ATTENTION: DOPEN IS NOT THE RIGHT VERSION")
624
 
        #DFTP Check
625
 
        value = self.config_get("SSERVER")
626
 
        #FDEF Check
627
 
        self.filedir = self.config_get("FDEF")
628
 
        self.file_show_dir()
629
 
        #ADDON Check
630
 
        dirs=[d for d in os.listdir(self.dcmdir) if os.path.isdir(d)]
631
 
        adds=[]
632
 
        for add in dirs:
633
 
            if add=="DOPEN" or add==".svn":
634
 
                pass
635
 
            else:
636
 
                #try:
637
 
                #imports are handled in top of file to assure they are global
638
 
                self.window(add)
639
 
                self.addon_menu(add)
640
 
                adds.append(add)
641
 
                #except:
642
 
                #    print "Error in initializing addon: "+str(add)
643
 
    
644
 
    def window(self,add):
645
 
        exec("from "+add+" import *")
646
 
        window=dac.window
647
 
        if window=="own":
648
 
            pass
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)
656
 
    
657
 
    def addon_menu(self,add):
658
 
        #try:
659
 
        exec("from "+add+" import *")
660
 
        menu=dac.menu
661
 
        menuadd=dac.menu_add
662
 
        menutitle=dac.menu_title
663
 
        menucontent=dac.menu_content
664
 
        imprts=dac.imp
665
 
        if menu=="ERROR":
666
 
            raise Exception()
667
 
        elif menu=="own":
668
 
            wxglade_tmp_menu = wx.Menu()
669
 
            i=0
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)
675
 
                i+=1
676
 
            self.menubar.Append(wxglade_tmp_menu, menutitle)
677
 
#        except:
678
 
#            print "Menu Error in "+str(add)
679
 
 
680
 
    def get_configuration(self,name,loc):
681
 
        try:
682
 
            f=open(loc,"r")
683
 
            for line in f:
684
 
                if name.strip()==line.strip().split("|")[0]:
685
 
                    strip=line.strip().split("|")[1]
686
 
            return strip
687
 
            f.close()
688
 
        except:
689
 
            return "ERROR"
690
 
            print "error in configuration retrieving: "+str(loc)+" name: "+str(name)
691
 
 
692
 
    def config_get(self,name):
693
 
        self.config = self.dcmdir + "config.ded"
694
 
        try:
695
 
            f = open(self.config, 'r')
696
 
        except:
697
 
            self.log("error: could not open" + self.config + " error generated in config_get")
698
 
        for line in f:
699
 
            if name.strip() == line.strip().split("|")[0]:
700
 
                 strip = line.strip().split("|")[1]
701
 
        return strip
702
 
        f.close()
703
 
 
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)
709
 
        dlg.Destroy()
710
 
 
711
 
    def quit(self, event): # wxGlade: MyFrame.<event_handler>
712
 
        self.Close()
713
 
 
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)
718
 
        listdir.sort()
719
 
        for i in listdir:
720
 
            if(os.path.isdir(self.filedir + "/" + i)):
721
 
                self.list_box_1.Append("[F] " + i)
722
 
            else:
723
 
                self.list_box_1.Append(i)
724
 
        self.SetStatusText("Directory List Updated")
725
 
        self.log("Directory List Updated")
726
 
 
727
 
    def listbox(self, event): # wxGlade: MyFrame.<event_handler>
728
 
        if event.GetString().startswith("[F]"):
729
 
            ev=event.GetString().strip().split(" ")[1::]
730
 
            ev=' '.join(ev)
731
 
            self.filedir += "/" + ev
732
 
            self.file_show_dir()
733
 
        elif "[Back]" in event.GetString():
734
 
            if(self.filedir.rpartition("/")[0] == ''):
735
 
                self.filedir = "/"
736
 
            else:
737
 
                self.filedir = self.filedir.rpartition("/")[0]
738
 
            self.file_show_dir()
739
 
        else:
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())
745
 
            self.chmod_init()
746
 
 
747
 
    def size(self, fl):
748
 
        bytes = os.path.getsize(fl)
749
 
        word=['b','kb','mb','gb','tb']
750
 
        wrd=0
751
 
        while bytes > 1000 and wrd <= 4:
752
 
            wrd += 1
753
 
            bytes /= 1000
754
 
            return str(bytes) + " " + str(word[wrd])
755
 
 
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()
763
 
            self.file_show_dir()
764
 
        else:
765
 
            self.SetStatusText("FM: Was not able to rename file")
766
 
            self.log("error: not able to rename file")
767
 
 
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())
772
 
            senddialog.Show()
773
 
 
774
 
    def edit(self, event): # wxGlade: MyFrame.<event_handler>
775
 
        fl = self.filedir + "/" + self.label_2.GetLabel()
776
 
        f = open(fl, 'r')
777
 
        txt = ""
778
 
        for line in f.readlines():
779
 
            txt = txt + line
780
 
        f.close()
781
 
        self.notebook_1.SetSelection(2)
782
 
        self.dedfrom = "fm"
783
 
        self.dedfl = fl
784
 
        self.text_ctrl_8.SetValue(txt)
785
 
 
786
 
    def editfl(self, fl):
787
 
        f = open(fl, 'r')
788
 
        txt = ""
789
 
        for line in f:
790
 
            txt+=line
791
 
        f.close()
792
 
        self.notebook_1.SetSelection(2)
793
 
        self.dedfrom = "fm"
794
 
        self.dedfl = fl
795
 
        self.text_ctrl_8.SetValue(txt)
796
 
 
797
 
    def start_mysql(self, event): # wxGlade: MyFrame.<event_handler>
798
 
        self.mysql_start()
799
 
 
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")
805
 
        try:
806
 
            self.db = MySQLdb.connect(localhost,usr,password,data)
807
 
            self.cursor = self.db.cursor()
808
 
            self.mysql_status = True
809
 
            self.mysql_table()
810
 
            self.log("MySql: Start")
811
 
            self.SetStatusText("Mysql: Start")
812
 
        except:
813
 
            self.SetStatusText("Mysql: Not able to start")
814
 
            self.log("MySQL: Not able to start")
815
 
 
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")
820
 
        self.db.close()
821
 
 
822
 
    def do_query(self, event): # wxGlade: MyFrame.<event_handler>
823
 
        if(self.mysql_status):
824
 
            self.qry = self.text_ctrl_2.GetValue()
825
 
            try:
826
 
                self.cursor.execute(self.qry)
827
 
                self.query = self.cursor.fetchall()
828
 
                label = ""
829
 
                for i in self.query:
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")
839
 
        else:
840
 
            self.SetStatusText("ATTENTION: Mysql not started!")
841
 
 
842
 
    def table_query(self, event): # wxGlade: MyFrame.<event_handler>
843
 
        if(self.mysql_status):
844
 
            self.qry = "SELECT * FROM " + event.GetString()
845
 
            try:
846
 
                self.cursor.execute(self.qry)
847
 
                self.query = self.cursor.fetchall()
848
 
                label = ""
849
 
                for i in self.query:
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")
859
 
        else:
860
 
            self.SetStatusText("ATTENTION: Mysql not started!")
861
 
 
862
 
    def mysql_table(self):
863
 
        self.list_box_3.Set([])
864
 
        try:
865
 
            self.cursor.execute("SHOW TABLES;")
866
 
            self.query = self.cursor.fetchall()
867
 
        except:
868
 
            self.log("error")
869
 
        for i in self.query:
870
 
            i = str(i).strip().split("'")[1]
871
 
            self.list_box_3.Append(str(i))
872
 
 
873
 
    def options(self, event): # wxGlade: MyFrame.<event_handler>
874
 
        self.opframe = OptionFrame(MyFrame(self), -1, "")
875
 
        self.opframe.Show()
876
 
 
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() + "\" &")
880
 
 
881
 
    def extlib(self,fl,at):
882
 
        if(self.dopen):
883
 
            self.extlibloc = self.dcmdir + "DOPEN/extlib.ded"
884
 
            goon = True
885
 
            if(at=="YES"):
886
 
                flext = fl
887
 
            else:
888
 
                try:
889
 
                    num = len(fl.strip().split(".")) - 1
890
 
                    if num != 0:
891
 
                        flext = fl.strip().split(".")[num]
892
 
                    else:
893
 
                        fl = self.filedir + "/" + self.label_2.GetLabel()
894
 
                        f = open(fl, 'r')
895
 
                        txt = ""
896
 
                        for line in f.readlines():
897
 
                            if line.startswith("#!/"):
898
 
                                flext = line
899
 
                        f.close()
900
 
                        print flext
901
 
                        try:
902
 
                            num = len(fl.strip().split("/")) - 1
903
 
                            flext = flext.split().strip("/")[num]
904
 
                        except:
905
 
                            #try:
906
 
                            #flext = flext.strip().split(" ")[1]
907
 
                            #except:
908
 
                            #self.SetStatusText("This file does not have an extension and does not contain a header")
909
 
                            goon = False
910
 
                except:
911
 
                    goon = False
912
 
            if(goon):
913
 
                try:
914
 
                    f = open(self.extlibloc, 'r')
915
 
                except:
916
 
                    self.log("extlibloc not right")
917
 
                try:
918
 
                    for line in f:
919
 
                        if flext.strip() == line.strip().split("|")[0]:
920
 
                            strip = line.strip().split("|")[1]
921
 
                    return strip
922
 
                except:
923
 
                    self.SetStatusText("Unknown Extension")
924
 
            f.close()
925
 
        else:
926
 
            self.SetStatusText("DOPEN NOT IMPORTED!")
927
 
 
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
933
 
        try:
934
 
            f = open(fl, 'a')
935
 
            f.write(log)
936
 
            f.close()
937
 
        except:
938
 
            self.SetStatusText("LOG FILE MISSING")
939
 
 
940
 
    def start_ftp(self):
941
 
        self.host = self.config_get("SSERVER")
942
 
        self.usr = self.config_get("SUSER")
943
 
        self.pswd = self.config_get("SPASS")
944
 
        try:
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")
949
 
        except:
950
 
            self.SetStatusText("FTP: Not able to login")
951
 
            self.log("FTP: Not able to login")
952
 
        self.ftpdir = self.ftp.pwd()
953
 
        self.ftpfile = ""
954
 
        self.ftp_show_dir()
955
 
 
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)
960
 
        for i in listdir:
961
 
            try:
962
 
                self.ftp.size(i)
963
 
                self.list_box_2.Append(i)
964
 
            except:
965
 
                self.list_box_2.Append("[F]" + i)
966
 
        #self.SetStatusText("Directory List Updated")
967
 
        #self.log("Directory List Updated")
968
 
 
969
 
    def ftp_list(self, event): # wxGlade: MyFrame.<event_handler>
970
 
        if event.GetString().startswith("[F]"):
971
 
            self.ftpdir = "./" + event.GetString().strip().split("]")[1]
972
 
            self.ftp_show_dir()
973
 
        elif "[Back]" in event.GetString():
974
 
            if(self.ftpdir.rpartition("/")[0] == ''):
975
 
                self.ftpdir = '.'
976
 
            else:
977
 
                self.ftpdir = self.ftpdir.rpartition("/")[0]
978
 
            self.ftp_show_dir()
979
 
        else:
980
 
            self.label_14.SetLabel(event.GetString())
981
 
            self.ftpfile = event.GetString()
982
 
 
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)
990
 
        txt = ''
991
 
        f = open(ftpp, 'r')
992
 
        for line in f.readlines():
993
 
            txt = txt + line
994
 
        f.close()
995
 
        self.notebook_1.SetSelection(2)
996
 
        self.dedfrom = "ftp"
997
 
        self.text_ctrl_8.SetValue(txt)
998
 
 
999
 
    def ftp_upload(self):
1000
 
        try:
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))
1007
 
        except:
1008
 
            self.log("FTP:Upload:Error")
1009
 
            self.SetStatusText("FTP:Upload:Error")
1010
 
 
1011
 
    def ftp_start(self, event): # wxGlade: MyFrame.<event_handler>
1012
 
        self.start_ftp()
1013
 
 
1014
 
    def ftp_stop(self, event): # wxGlade: MyFrame.<event_handler>
1015
 
        self.ftp.quit()
1016
 
 
1017
 
    def fdown(self, event): # wxGlade: MyFrame.<event_handler>
1018
 
        self.ftp_download(self.label_14.GetLabel())
1019
 
 
1020
 
    def fptup(self, event): # wxGlade: MyFrame.<event_handler>
1021
 
        self.ftp_upload()
1022
 
 
1023
 
    def dedsave(self, event): # wxGlade: MyFrame.<event_handler>
1024
 
        if(self.dedfrom == 'ftp'):
1025
 
            ftpp = self.dcmdir + 'ftp.ded'
1026
 
            try:
1027
 
                open(ftpp, 'w').write(self.text_ctrl_8.GetValue())
1028
 
            except:
1029
 
                self.log("error with deditor save ftp")
1030
 
        elif(self.dedfrom == 'fm'):
1031
 
            fl = self.dedfl
1032
 
            try:
1033
 
                g = open(fl,'w')
1034
 
                g.write(self.text_ctrl_8.GetValue())
1035
 
                g.close()
1036
 
            except:
1037
 
                self.log("error with deditor save fm")
1038
 
 
1039
 
    def change_dir(self, event): # wxGlade: MyFrame.<event_handler>
1040
 
        chgdir=ChangeDirPanel(None, -1, "")
1041
 
        chgdir.Show()
1042
 
 
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 &")
1048
 
 
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
1054
 
        try:
1055
 
            s = open(self.dedconf, 'r').read()
1056
 
        except:
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')
1060
 
        f.write(s)
1061
 
        f.close()
1062
 
 
1063
 
    def dedget(self,name):
1064
 
        self.dedconf = self.dcmdir + "/Deditor/configuration.ded"
1065
 
        try:
1066
 
            f = open(self.dedconf, 'r')
1067
 
        except:
1068
 
            self.log("error: could not open" + self.dedconf + " error generated in config_get")
1069
 
        for line in f:
1070
 
            if name.strip() == line.strip().split(" ")[0]:
1071
 
                strip = line.strip().split(" ")[1]
1072
 
        return strip
1073
 
        f.close()
1074
 
 
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)
1079
 
        else:
1080
 
            chmod=""
1081
 
            for i in mode:
1082
 
                if i == "-":
1083
 
                    chmod+="0"
1084
 
                else:
1085
 
                    chmod+="1"
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)
1091
 
 
1092
 
    def chmod_init(self):
1093
 
        lvl=""
1094
 
        if(self.radio_box_1.GetSelection()==0):
1095
 
            lvl=oct(stat.S_IMODE(os.lstat(self.abspath)[stat.ST_MODE]))
1096
 
        else:
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):
1101
 
                        lvl+=perm
1102
 
                    else:
1103
 
                        lvl+="-"
1104
 
        self.text_ctrl_12.SetValue(lvl)
1105
 
 
1106
 
    def init_chmod(self, event): # wxGlade: MyFrame.<event_handler>
1107
 
        self.chmod_init()
1108
 
 
1109
 
    def extlibman(self, event): # wxGlade: MyFrame.<event_handler>
1110
 
        os.system(self.dcmdir + "/DOPEN/extlibman &")
1111
 
 
1112
 
    def extupdate(self, event): # wxGlade: MyFrame.<event_handler>
1113
 
        p=os.popen(self.dcmdir + "/dcmd -u")
1114
 
        version=p.readlines()
1115
 
        p.close()
1116
 
        if p == "uptodate":
1117
 
            pass
1118
 
        else:
1119
 
            os.system("curl http://d-cm.googlecode.com/files/extlib.ded -o "+self.dcmdir+"/DOPEN/dwnext.ded &")
1120
 
            append=""
1121
 
            content=""
1122
 
            x="n"
1123
 
            g_data=open(self.dcmdir+"/DOPEN/extlib.ded",'r').readlines()
1124
 
            f_data=open(self.dcmdir+"/DOPEN/dwnext.ded",'r').readlines()
1125
 
            for line in f_data:
1126
 
                for ln in g_data:
1127
 
                    if line.strip().split("|")[0] == ln.strip().split("|")[0]:
1128
 
                        x="y"
1129
 
                    if line.strip().split("|")[0] == "@DCM:VERSION":
1130
 
                        dwnvers=line
1131
 
                if x!="y":
1132
 
                    append=append+line
1133
 
                x="n"
1134
 
            try:
1135
 
                f=open(self.dcmdir+"/DOPEN/extlib.ded",'a')
1136
 
                f.write(append)
1137
 
                f.close()
1138
 
            except:
1139
 
                print "e1"
1140
 
            try:
1141
 
                f = open(self.dcmdir+"/DOPEN/extlib.ded",'r')
1142
 
                for line in f:
1143
 
                    if line.strip().split("|")[0] == "@DCM:VERSION":
1144
 
                        content+=dwnvers
1145
 
                    else:
1146
 
                        content+=line
1147
 
                f.close()
1148
 
            except:
1149
 
              print "e2"
1150
 
            try:
1151
 
                f = open(self.dcmdir+"/DOPEN/extlib.ded",'w')
1152
 
                f.write(content)
1153
 
                f.close()
1154
 
            except:
1155
 
                print "e3"
1156
 
 
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())
1160
 
            output=""
1161
 
            for item in cmd:
1162
 
                output+=item
1163
 
            self.text_ctrl_18.SetValue(output)
1164
 
 
1165
 
    def terminal(self, event): # wxGlade: MyFrame.<event_handler>
1166
 
        os.system("gnome-terminal --working-directory=\""+self.filedir+"\" &")
1167
 
 
1168
 
    def dcrypt(self, event): # wxGlade: MyFrame.<event_handler>
1169
 
        print "Event handler `dcrypt' not implemented"
1170
 
        event.Skip()
1171
 
 
1172
 
# end of class MyFrame
1173
 
 
1174
 
if __name__ == "__main__":
1175
 
    app = wx.PySimpleApp(0)
1176
 
    wx.InitAllImageHandlers()
1177
 
    dcm = MyFrame(None, -1, "")
1178
 
    app.SetTopWindow(dcm)
1179
 
    dcm.Show()
1180
 
    app.MainLoop()