/[thuban]/branches/WIP-pyshapelib-bramz/Thuban/UI/altpathdialog.py
ViewVC logotype

Diff of /branches/WIP-pyshapelib-bramz/Thuban/UI/altpathdialog.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

trunk/thuban/Thuban/UI/altpathdialog.py revision 2446 by frank, Mon Dec 13 11:52:34 2004 UTC branches/WIP-pyshapelib-bramz/Thuban/UI/altpathdialog.py revision 2734 by bramz, Thu Mar 1 12:42:59 2007 UTC
# Line 14  Line 14 
14    
15  from Thuban import _  from Thuban import _
16    
17  from wxPython.wx import wxFileDialog, wxMessageDialog, wxOPEN, \  import wx
                         wxYES_NO, wxYES_DEFAULT, wxICON_INFORMATION, \  
                         wxID_OK, wxID_YES  
18    
19  import os  import os
20    
21  class AltPathFileDialog(wxFileDialog):  class AltPathFileDialog(wx.FileDialog):
22    
23      def __init__(self, filename):      def __init__(self, filename):
24          msg = _("Select an alternative data file for %s" % \          msg = _("Select an alternative data file for %s" % \
25                          os.path.basename(filename))                          os.path.basename(filename))
26            
27          wxFileDialog.__init__(self, None,          wx.FileDialog.__init__(self, None,
28                             msg,                             msg,
29                             os.path.dirname(filename),                             os.path.dirname(filename),
30                             os.path.basename(filename),                             os.path.basename(filename),
31                             _("Shapefiles (*.shp)") + "|*.shp;*.SHP|" +                             _("Shapefiles (*.shp)") + "|*.shp;*.SHP|" +
32                             _("All Files (*.*)") + "|*.*",                             _("All Files (*.*)") + "|*.*",
33                             wxOPEN)                             wx.OPEN)
34    
35      def RunDialog(self):      def RunDialog(self):
36          val = self.ShowModal()          val = self.ShowModal()
37          self.Destroy()          self.Destroy()
38          if val == wxID_OK:          if val == wx.ID_OK:
39              return self.GetPaths()[0]              return self.GetPaths()[0]
40          else:          else:
41              return None              return None
42    
43  class AltPathConfirmDialog(wxMessageDialog):  class AltPathConfirmDialog(wx.MessageDialog):
44    
45      def __init__(self, filename):      def __init__(self, filename):
46          self.filename = filename          self.filename = filename
47          msg = _("Found the following as an alternative for %s.\n%s\n\n Please confirm with Yes or select alternative with No." % (os.path.basename(filename), filename))          msg = _("Found the following as an alternative for %s.\n%s\n\n Please confirm with Yes or select alternative with No." % (os.path.basename(filename), filename))
48            
49          wxMessageDialog.__init__(self, None, msg, _("Alternative Path"),          wx.MessageDialog.__init__(self, None, msg, _("Alternative Path"),
50                          wxYES_NO|wxYES_DEFAULT|wxICON_INFORMATION)                          wx.YES_NO|wx.YES_DEFAULT|wx.ICON_INFORMATION)
51    
52      def RunDialog(self):      def RunDialog(self):
53          val = self.ShowModal()          val = self.ShowModal()
54          self.Destroy()          self.Destroy()
55          if val == wxID_YES:          if val == wx.ID_YES:
56              return self.filename              return self.filename
57          else:          else:
58              dlg = AltPathFileDialog(self.filename)              dlg = AltPathFileDialog(self.filename)
59              fname = dlg.RunDialog()              fname = dlg.RunDialog()
60              return fname                return fname

Legend:
Removed from v.2446  
changed lines
  Added in v.2734

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26