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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2700 - (hide annotations)
Mon Sep 18 14:27:02 2006 UTC (18 years, 5 months ago) by dpinte
Original Path: trunk/thuban/Thuban/UI/altpathdialog.py
File MIME type: text/x-python
File size: 1859 byte(s)
2006-09-18 Didrik Pinte <dpinte@itae.be>
    
        * wxPython 2.6 update : wx 2.4 syntax has been updated to 2.6


1 frank 2446 # Copyright (c) 2004 by Intevation GmbH
2     # Authors:
3     # Frank Koormann <[email protected]>
4     #
5     # This program is free software under the GPL (>=v2)
6     # Read the file COPYING coming with Thuban for details.
7    
8    
9     """Dialogs for alternative paths (path recovery).
10    
11     AltPathFileDialog: File dialog to specify alterative path.
12     AltPathConfirmDialog: Confirm or cancel alternative path suggestion.
13     """
14    
15     from Thuban import _
16    
17 dpinte 2700 import wx
18 frank 2446
19     import os
20    
21 dpinte 2700 class AltPathFileDialog(wx.FileDialog):
22 frank 2446
23     def __init__(self, filename):
24     msg = _("Select an alternative data file for %s" % \
25     os.path.basename(filename))
26 dpinte 2700
27     wx.FileDialog.__init__(self, None,
28     msg,
29     os.path.dirname(filename),
30 frank 2446 os.path.basename(filename),
31     _("Shapefiles (*.shp)") + "|*.shp;*.SHP|" +
32     _("All Files (*.*)") + "|*.*",
33 dpinte 2700 wx.OPEN)
34 frank 2446
35     def RunDialog(self):
36     val = self.ShowModal()
37     self.Destroy()
38 dpinte 2700 if val == wx.ID_OK:
39 frank 2446 return self.GetPaths()[0]
40     else:
41     return None
42    
43 dpinte 2700 class AltPathConfirmDialog(wx.MessageDialog):
44 frank 2446
45     def __init__(self, filename):
46     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))
48    
49 dpinte 2700 wx.MessageDialog.__init__(self, None, msg, _("Alternative Path"),
50     wx.YES_NO|wx.YES_DEFAULT|wx.ICON_INFORMATION)
51    
52 frank 2446 def RunDialog(self):
53     val = self.ShowModal()
54     self.Destroy()
55 dpinte 2700 if val == wx.ID_YES:
56 frank 2446 return self.filename
57     else:
58     dlg = AltPathFileDialog(self.filename)
59     fname = dlg.RunDialog()
60 dpinte 2700 return fname

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26