File: 02-wx-namespace-transition.patch

package info (click to toggle)
python-dsv 1.4.1-11
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 424 kB
  • sloc: python: 582; makefile: 7
file content (445 lines) | stat: -rw-r--r-- 22,113 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
From b10117e7dd06f70f73bd941082fc131f94c2ce6e Mon Sep 17 00:00:00 2001
From: SVN-Git Migration <python-modules-team@lists.alioth.debian.org>
Date: Thu, 8 Oct 2015 11:58:08 -0700
Subject: 02-wx-namespace-transition

Patch-Name: 02-wx-namespace-transition.patch
---
 DSV/DSV.py | 205 ++++++++++++++++++++++++++++++++-----------------------------
 1 file changed, 107 insertions(+), 98 deletions(-)

diff --git a/DSV/DSV.py b/DSV/DSV.py
index 8ba7f1e..b17a91b 100644
--- a/DSV/DSV.py
+++ b/DSV/DSV.py
@@ -2,6 +2,9 @@
 DSV.py - Cliff Wells, 2002
   Import/export DSV (delimiter separated values, a generalization of CSV).
 
+2007-01-09: Modified by Joe Pham <djpham@bitpim.org> to accommodate
+            wxPython 2.8+
+
 Basic use:
 
    from DSV import DSV
@@ -133,8 +136,14 @@ import string
 # import os
 # os.putenv('LANG', 'C')
 
+##try:
+##    from wxPython import wx, grid
+##except ImportError:
+##    wx = None
+
 try:
-    from wxPython import wx, grid
+    import wx
+    import wx.grid as gridlib
 except ImportError:
     wx = None
 
@@ -625,19 +634,19 @@ def exportDSV(input, delimiter = ',', textQualifier = '"', quoteall = 0, newline
 
 if wx is not None:
     # ------------------------------------------------------------------------------
-    class ImportWizardPanel_Delimiters(wx.wxPanel):
+    class ImportWizardPanel_Delimiters(wx.Panel):
         """
         CLASS(SUPERCLASS):
-          ImportWizardPanel_Delimiters(wx.wxPanel)
+          ImportWizardPanel_Delimiters(wx.Panel)
         DESCRIPTION:
-          A wx.wxPanel that provides a basic interface for validating and changing the
+          A wx.Panel that provides a basic interface for validating and changing the
           parameters for importing a delimited text file. Similar to MS Excel's
           CSV import wizard. Can be used in a series of wizards or embedded in an
           application.
         PROTOTYPE:
           ImportWizardPanel_Delimiters(parent, id, file, data, isValidCallback = None,
-                                       pos = wx.wxDefaultPosition, size = wx.wxDefaultSize,
-                                       style = wx.wxTAB_TRAVERSAL, name = 'ImportWizardPanel')
+                                       pos = wx.DefaultPosition, size = wx.DefaultSize,
+                                       style = wx.TAB_TRAVERSAL, name = 'ImportWizardPanel')
         ARGUMENTS:
           - parent is the parent window
           - id is the id of this wizard panel
@@ -657,24 +666,24 @@ if wx is not None:
         """
 
         def __init__(self, parent, id, file, data, isValidCallback = None,
-                     pos = wx.wxDefaultPosition, size = wx.wxDefaultSize,
-                     style = wx.wxTAB_TRAVERSAL, name = "ImportWizardPanel"):
-            wx.wxPanel.__init__(self, parent, id, pos, size, style, name)
-            self.SetAutoLayout(wx.true)
-            mainSizer = wx.wxFlexGridSizer(3, 1)
+                     pos = wx.DefaultPosition, size = wx.DefaultSize,
+                     style = wx.TAB_TRAVERSAL, name = "ImportWizardPanel"):
+            wx.Panel.__init__(self, parent, id, pos, size, style, name)
+            self.SetAutoLayout(True)
+            mainSizer = wx.FlexGridSizer(3, 1)
             self.SetSizer(mainSizer)
             mainSizer.AddGrowableCol(0)
 
-            self.initialized = wx.false
+            self.initialized = False
             self.data = data
             self.isValidCallback = isValidCallback
             self.Validate = (isValidCallback and self.Validate) or self.BuildPreview
 
-            dlg = wx.wxProgressDialog("Import Wizard",
+            dlg = wx.ProgressDialog("Import Wizard",
                                    "Analyzing %s... Please wait." % file,
                                    3,
                                    parent,
-                                   wx.wxPD_APP_MODAL | wx.wxPD_AUTO_HIDE)
+                                   wx.PD_APP_MODAL | wx.PD_AUTO_HIDE)
             textQualifier = guessTextQualifier(data)
             dlg.Update(1)
             newdata = organizeIntoLines(data, textQualifier = textQualifier, limit = 100)
@@ -686,13 +695,13 @@ if wx is not None:
             # -------------
             msg = ("This screen lets you set the delimiters your data contains.\n"
                    "You can see how your data is affected in the preview below.")
-            message1 = wx.wxStaticText(self, -1, msg)
+            message1 = wx.StaticText(self, -1, msg)
 
             # -------------
-            delimiterBox = wx.wxBoxSizer(wx.wxHORIZONTAL)
-            delimStaticBox = wx.wxStaticBox(self, -1, "Delimiters")
-            delimStaticSizer = wx.wxStaticBoxSizer(delimStaticBox, wx.wxVERTICAL)
-            delimGridSizer = wx.wxFlexGridSizer(2, 3)
+            delimiterBox = wx.BoxSizer(wx.HORIZONTAL)
+            delimStaticBox = wx.StaticBox(self, -1, "Delimiters")
+            delimStaticSizer = wx.StaticBoxSizer(delimStaticBox, wx.VERTICAL)
+            delimGridSizer = wx.FlexGridSizer(2, 3)
 
             delims = {
                 'Tab':       '\t',
@@ -704,36 +713,36 @@ if wx is not None:
             self.delimChecks = {}
 
             for label, value in delims.items():
-                self.delimChecks[value] = wx.wxCheckBox(self, -1, label)
-                delimGridSizer.Add(self.delimChecks[value], 0, wx.wxALL, 3)
+                self.delimChecks[value] = wx.CheckBox(self, -1, label)
+                delimGridSizer.Add(self.delimChecks[value], 0, wx.ALL, 3)
                 wx.EVT_CHECKBOX(self, self.delimChecks[value].GetId(), self.Validate)
 
-            otherSizer = wx.wxBoxSizer(wx.wxHORIZONTAL)
+            otherSizer = wx.BoxSizer(wx.HORIZONTAL)
 
-            self.delimChecks['Other'] = wx.wxCheckBox(self, -1, 'Other:')
+            self.delimChecks['Other'] = wx.CheckBox(self, -1, 'Other:')
             wx.EVT_CHECKBOX(self, self.delimChecks['Other'].GetId(), self.Validate)
 
-            self.otherDelim = wx.wxTextCtrl(self, -1, size = (20, -1))
+            self.otherDelim = wx.TextCtrl(self, -1, size = (20, -1))
             wx.EVT_TEXT(self, self.otherDelim.GetId(), self.OnCustomDelim)
 
             if self.delimChecks.has_key(delimiter):
-                self.delimChecks[delimiter].SetValue(wx.true)
+                self.delimChecks[delimiter].SetValue(True)
             elif delimiter is not None:
-                self.delimChecks['Other'].SetValue(wx.true)
+                self.delimChecks['Other'].SetValue(True)
                 self.otherDelim.SetValue(delimiter)
 
             otherSizer.AddMany([
-                (self.delimChecks['Other'], 0, wx.wxALL, 3),
-                (self.otherDelim, 0, wx.wxALIGN_CENTER),
+                (self.delimChecks['Other'], 0, wx.ALL, 3),
+                (self.otherDelim, 0, wx.ALIGN_CENTER),
                 ])
             
             delimGridSizer.Add(otherSizer)
-            delimStaticSizer.Add(delimGridSizer, 1, wx.wxEXPAND)
-            delimOtherSizer = wx.wxBoxSizer(wx.wxVERTICAL)
-            self.consecutiveDelimsAs1 = wx.wxCheckBox(self, -1, "Treat consecutive delimiters as one")
-            self.consecutiveDelimsAs1.Enable(wx.false)
-            tqSizer = wx.wxBoxSizer(wx.wxHORIZONTAL)
-            self.textQualifierChoice = wx.wxChoice(self, -1, choices = ['"', "'", "{None}"])
+            delimStaticSizer.Add(delimGridSizer, 1, wx.EXPAND)
+            delimOtherSizer = wx.BoxSizer(wx.VERTICAL)
+            self.consecutiveDelimsAs1 = wx.CheckBox(self, -1, "Treat consecutive delimiters as one")
+            self.consecutiveDelimsAs1.Enable(False)
+            tqSizer = wx.BoxSizer(wx.HORIZONTAL)
+            self.textQualifierChoice = wx.Choice(self, -1, choices = ['"', "'", "{None}"])
             wx.EVT_CHOICE(self, self.textQualifierChoice.GetId(), self.BuildPreview)
             if textQualifier is not None:
                 self.textQualifierChoice.SetStringSelection(textQualifier)
@@ -741,52 +750,52 @@ if wx is not None:
                 self.textQualifierChoice.SetStringSelection('{None}')
                 
             tqSizer.AddMany([
-                (wx.wxStaticText(self, -1, "Text qualifier:"), 0, wx.wxALIGN_RIGHT | wx.wxALIGN_CENTER_VERTICAL),
-                (self.textQualifierChoice, 0, wx.wxALL | wx.wxALIGN_LEFT | wx.wxALIGN_CENTER_VERTICAL, 5),
+                (wx.StaticText(self, -1, "Text qualifier:"), 0, wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL),
+                (self.textQualifierChoice, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5),
                 ])
             
             delimOtherSizer.AddMany([
-                (self.consecutiveDelimsAs1, 1, wx.wxEXPAND | wx.wxALL, 5),
-                (tqSizer, 1, wx.wxALL | wx.wxALIGN_CENTER, 5),
+                (self.consecutiveDelimsAs1, 1, wx.EXPAND | wx.ALL, 5),
+                (tqSizer, 1, wx.ALL | wx.ALIGN_CENTER, 5),
                 ])
 
             delimiterBox.AddMany([
-                (delimStaticSizer, 0, wx.wxALIGN_CENTER),
-                (delimOtherSizer,  0, wx.wxALIGN_CENTER),
+                (delimStaticSizer, 0, wx.ALIGN_CENTER),
+                (delimOtherSizer,  0, wx.ALIGN_CENTER),
                 ])
             
             delimStaticBox.Fit()
 
             # -------------
             self.displayRows = 6
-            previewSettingsBox = wx.wxBoxSizer(wx.wxHORIZONTAL)
-            self.hasHeaderRow = wx.wxCheckBox(self, -1, "First row is header")
+            previewSettingsBox = wx.BoxSizer(wx.HORIZONTAL)
+            self.hasHeaderRow = wx.CheckBox(self, -1, "First row is header")
             wx.EVT_CHECKBOX(self, self.hasHeaderRow.GetId(), self.BuildPreview)
 
-            if wx.wxPlatform in ('__WX.WXGTK__', '__WX.WXMSW__'):
-                # wx.wxSpinCtrl causes seg fault under GTK when <enter> is hit in text - use wx.wxSpinButton instead
-                self.previewRowsText = wx.wxTextCtrl(self, -1, str(self.displayRows),
-                                                  size = (30, -1), style = wx.wxTE_PROCESS_ENTER)
+            if wx.Platform in ('__WX.WXGTK__', '__WX.WXMSW__'):
+                # wx.SpinCtrl causes seg fault under GTK when <enter> is hit in text - use wx.SpinButton instead
+                self.previewRowsText = wx.TextCtrl(self, -1, str(self.displayRows),
+                                                  size = (30, -1), style = wx.TE_PROCESS_ENTER)
                 h = self.previewRowsText.GetSize().height
-                self.previewRows = wx.wxSpinButton(self, -1, size = (-1, h), style = wx.wxSP_VERTICAL)
+                self.previewRows = wx.SpinButton(self, -1, size = (-1, h), style = wx.SP_VERTICAL)
                 self.previewRows.SetRange(self.displayRows, 100)
                 self.previewRows.SetValue(self.displayRows)
                 wx.EVT_SPIN(self, self.previewRows.GetId(), self.OnSpinPreviewRows)
                 wx.EVT_TEXT_ENTER(self, self.previewRowsText.GetId(), self.OnTextPreviewRows)
             else:
-                self.previewRows = wx.wxSpinCtrl(self, -1, str(self.displayRows),
+                self.previewRows = wx.SpinCtrl(self, -1, str(self.displayRows),
                                               min = self.displayRows, max = 100, size = (50, -1))
                 wx.EVT_SPINCTRL(self, self.previewRows.GetId(), self.BuildPreview)
 
             previewSettingsBox.AddMany([
-                (self.hasHeaderRow, 1, wx.wxALL | wx.wxEXPAND, 5),
-                (wx.wxStaticText(self, -1, "Preview"), 0, wx.wxWEST | wx.wxALIGN_RIGHT | wx.wxALIGN_CENTER_VERTICAL, 10),
+                (self.hasHeaderRow, 1, wx.ALL | wx.EXPAND, 5),
+                (wx.StaticText(self, -1, "Preview"), 0, wx.WEST | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 10),
                 ])
-            if wx.wxPlatform in ('__WX.WXGTK__', '__WX.WXMSW__'):
-                previewSettingsBox.Add(self.previewRowsText, 0, wx.wxALIGN_CENTER | wx.wxALL, 3)
+            if wx.Platform in ('__WX.WXGTK__', '__WX.WXMSW__'):
+                previewSettingsBox.Add(self.previewRowsText, 0, wx.ALIGN_CENTER | wx.ALL, 3)
             previewSettingsBox.AddMany([
-                (self.previewRows, 0, wx.wxALIGN_CENTER | wx.wxALL, 3),
-                (wx.wxStaticText(self, -1, "rows"), 0, wx.wxALIGN_RIGHT | wx.wxALIGN_CENTER_VERTICAL),
+                (self.previewRows, 0, wx.ALIGN_CENTER | wx.ALL, 3),
+                (wx.StaticText(self, -1, "rows"), 0, wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL),
                 ])
 
             # -------------
@@ -804,28 +813,28 @@ if wx is not None:
                 hasHeaders = 0
                 cols = 1
 
-            previewStaticBox = wx.wxStaticBox(self, -1, "Data Preview")
-            previewStaticSizer = wx.wxStaticBoxSizer(previewStaticBox, wx.wxVERTICAL)
-            self.preview = grid.wxGrid(self, -1)
+            previewStaticBox = wx.StaticBox(self, -1, "Data Preview")
+            previewStaticSizer = wx.StaticBoxSizer(previewStaticBox, wx.VERTICAL)
+            self.preview = gridlib.Grid(self, -1)
             self.preview.CreateGrid(self.displayRows, cols)
-            self.preview.SetDefaultRowSize(self.preview.GetCharHeight() + 4, wx.true)
-            self.preview.EnableEditing(wx.false)
+            self.preview.SetDefaultRowSize(self.preview.GetCharHeight() + 4, True)
+            self.preview.EnableEditing(False)
             self.preview.SetColLabelSize(0)
             self.preview.SetRowLabelSize(0)
             self.preview.SetMargins(1, 0)
-            self.initialized = wx.true
+            self.initialized = True
             self.BuildPreview()
 
             rowheight = self.preview.GetRowSize(0) + 2
             self.preview.SetSize((-1, rowheight * self.displayRows))
-            previewStaticSizer.Add(self.preview, 0, wx.wxALL | wx.wxEXPAND, 5)
+            previewStaticSizer.Add(self.preview, 0, wx.ALL | wx.EXPAND, 5)
 
             # -------------
             mainSizer.AddMany([
-                (message1,     0, wx.wxALL, 5),
-                (delimiterBox, 0, wx.wxALL, 5),
-                (previewSettingsBox, 0, wx.wxALL, 5),
-                (previewStaticSizer, 0, wx.wxALL | wx.wxEXPAND, 5),
+                (message1,     0, wx.ALL, 5),
+                (delimiterBox, 0, wx.ALL, 5),
+                (previewSettingsBox, 0, wx.ALL, 5),
+                (previewStaticSizer, 0, wx.ALL | wx.EXPAND, 5),
                 ])
 
             self.Layout()
@@ -855,9 +864,9 @@ if wx is not None:
             if not self.initialized:
                 return # got triggered before initialization was completed
 
-            if wx.wxPlatform != '__WX.WXGTK__':
-                wx.wxBeginBusyCursor() # causes a spurious spin event under GTK
-            wx.wxYield() # allow controls to update first, in case of slow preview
+            if wx.Platform != '__WX.WXGTK__':
+                wx.BeginBusyCursor() # causes a spurious spin event under GTK
+            wx.Yield() # allow controls to update first, in case of slow preview
             self.preview.BeginBatch()
             self.preview.DeleteCols(0, self.preview.GetNumberCols())
             self.preview.DeleteRows(0, self.preview.GetNumberRows())
@@ -892,7 +901,7 @@ if wx is not None:
                 for col in range(cols):
                     try:    self.preview.SetColLabelValue(col, str(previewData[0][col]))
                     except: self.preview.SetColLabelValue(col, "")
-                # self.preview.AutoSizeColumns(wx.true) # size columns to headers
+                # self.preview.AutoSizeColumns(True) # size columns to headers
             else:
                 self.preview.SetColLabelSize(0)
 
@@ -902,13 +911,13 @@ if wx is not None:
                     except: pass
 
             # if not hasHeaders:
-            self.preview.AutoSizeColumns(wx.true) # size columns to data
+            self.preview.AutoSizeColumns(True) # size columns to data
 
             rowheight = self.preview.GetRowSize(0)
             self.preview.SetRowSize(0, rowheight)
             self.preview.EndBatch()
-            if wx.wxPlatform != '__WX.WXGTK__':
-                wx.wxEndBusyCursor()
+            if wx.Platform != '__WX.WXGTK__':
+                wx.EndBusyCursor()
 
             self.delimiters = delimiter
             self.textQualifier = textQualifier
@@ -928,17 +937,17 @@ if wx is not None:
             return self.hasHeaders
 
     # ------------------------------------------------------------------------------        
-    class ImportWizardDialog(wx.wxDialog):
+    class ImportWizardDialog(wx.Dialog):
         """
         CLASS(SUPERCLASS):
-          ImportWizardDialog(wx.wxDialog)
+          ImportWizardDialog(wx.Dialog)
         DESCRIPTION:
           A dialog allowing the user to preview and change the options for importing
           a file.
         PROTOTYPE:
           ImportWizardDialog(parent, id, title, file,
-                             pos = wx.wxDefaultPosition, size = wx.wxDefaultSize,
-                             style = wx.wxDEFAULT_DIALOG_STYLE, name = 'ImportWizardDialog')
+                             pos = wx.DefaultPosition, size = wx.DefaultSize,
+                             style = wx.DEFAULT_DIALOG_STYLE, name = 'ImportWizardDialog')
         ARGUMENTS:
           - parent: the parent window
           - id: the id of this window
@@ -955,22 +964,22 @@ if wx is not None:
         """
 
         def __init__(self, parent, id, title, file,
-                     pos = wx.wxDefaultPosition, size = wx.wxDefaultSize,
-                     style = wx.wxDEFAULT_DIALOG_STYLE, name = "ImportWizardDialog"):
-            wx.wxDialog.__init__(self, parent, id, title, pos, size, style, name)
-            self.SetAutoLayout(wx.true)
+                     pos = wx.DefaultPosition, size = wx.DefaultSize,
+                     style = wx.DEFAULT_DIALOG_STYLE, name = "ImportWizardDialog"):
+            wx.Dialog.__init__(self, parent, id, title, pos, size, style, name)
+            self.SetAutoLayout(True)
 
             self.file = file
             f = open(file, 'r')
             self.data = f.read()
             f.close()
 
-            sizer = wx.wxBoxSizer(wx.wxVERTICAL)
+            sizer = wx.BoxSizer(wx.VERTICAL)
             self.delimPanel = ImportWizardPanel_Delimiters(self, -1, file, self.data, self.ValidState)
             buttonBox = self.ButtonBox()
             sizer.AddMany([
-                (self.delimPanel, 0, wx.wxALL, 5),
-                (buttonBox, 0, wx.wxSOUTH | wx.wxALIGN_CENTER_HORIZONTAL | wx.wxALIGN_TOP, 0),
+                (self.delimPanel, 0, wx.ALL, 5),
+                (buttonBox, 0, wx.SOUTH | wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_TOP, 0),
                 ])
 
             self.SetSizer(sizer)
@@ -980,15 +989,15 @@ if wx is not None:
             self.Centre()
 
         def ButtonBox(self):
-            panel = wx.wxPanel(self, -1)
-            panel.SetAutoLayout(wx.true)
-            sizer = wx.wxBoxSizer(wx.wxHORIZONTAL)
+            panel = wx.Panel(self, -1)
+            panel.SetAutoLayout(True)
+            sizer = wx.BoxSizer(wx.HORIZONTAL)
             panel.SetSizer(sizer)
-            self.ok = wx.wxButton(panel, wx.wxID_OK, "Ok")
-            cancel = wx.wxButton(panel, wx.wxID_CANCEL, "Cancel")
+            self.ok = wx.Button(panel, wx.ID_OK, "Ok")
+            cancel = wx.Button(panel, wx.ID_CANCEL, "Cancel")
             sizer.AddMany([
-                (self.ok, 0, wx.wxALIGN_TOP | wx.wxEAST | wx.wxSOUTH, 10),
-                (cancel, 0, wx.wxALIGN_TOP | wx.wxWEST | wx.wxSOUTH, 10),
+                (self.ok, 0, wx.ALIGN_TOP | wx.EAST | wx.SOUTH, 10),
+                (cancel, 0, wx.ALIGN_TOP | wx.WEST | wx.SOUTH, 10),
                 ])
             panel.Layout()
             panel.Fit()
@@ -1002,11 +1011,11 @@ if wx is not None:
         def ImportData(self, errorHandler = skipRow):
             delimiters, qualifier, hasHeaders = self.GetImportInfo()
             self.data = organizeIntoLines(self.data, textQualifier = qualifier)
-            dlg = wx.wxProgressDialog("Import DSV File",
+            dlg = wx.ProgressDialog("Import DSV File",
                                    self.file,
                                    100,
                                    self,
-                                   wx.wxPD_CAN_ABORT | wx.wxPD_APP_MODAL | wx.wxPD_AUTO_HIDE)
+                                   wx.PD_CAN_ABORT | wx.PD_APP_MODAL | wx.PD_AUTO_HIDE)
             self.data = importDSV(self.data,
                                   delimiter = delimiters,
                                   textQualifier = qualifier,
@@ -1034,12 +1043,12 @@ if __name__ == '__main__':
 
 
     def demo():
-        class SampleApp(wx.wxApp):
+        class SampleApp(wx.App):
             def OnInit(self):
-                dlg = wx.wxFileDialog(None, "Choose a file", ".", "",
+                dlg = wx.FileDialog(None, "Choose a file", ".", "",
                                    "CSV files (*.csv)|*.csv|Text files (*.txt)|*.txt|All files (*.*)|*.*",
-                                   wx.wxOPEN)
-                if dlg.ShowModal() == wx.wxID_OK:
+                                   wx.OPEN)
+                if dlg.ShowModal() == wx.ID_OK:
                     path = dlg.GetPath()
                     dlg.Destroy()
 
@@ -1049,7 +1058,7 @@ if __name__ == '__main__':
                         file.write("LINE %d: %s\n" % (linenumber, oldrow))
 
                     dlg = ImportWizardDialog(None, -1, 'CSV Import Wizard (v.%s)' % __version__, path)
-                    if dlg.ShowModal() == wx.wxID_OK:
+                    if dlg.ShowModal() == wx.ID_OK:
                         results = dlg.ImportData(errorHandler = logErrors)
                         dlg.Destroy()
                         errorLog.close()
@@ -1074,7 +1083,7 @@ if __name__ == '__main__':
                 else:
                     dlg.Destroy()
 
-                return wx.true
+                return True
 
         app = SampleApp()
         app.MainLoop()