/[thuban]/branches/WIP-pyshapelib-bramz/Extensions/ogr/ogrstart.py
ViewVC logotype

Diff of /branches/WIP-pyshapelib-bramz/Extensions/ogr/ogrstart.py

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

revision 2713 by bernhard, Thu Oct 26 16:37:42 2006 UTC revision 2721 by dpinte, Sat Jan 13 15:11:42 2007 UTC
# Line 1  Line 1 
1  # Copyright (c) 2004,2006 by Intevation GmbH    vim:encoding=latin-1:  # Copyright (c) 2004,2006 by Intevation GmbH    vim:encoding=latin-1:
2  # Authors:  # Authors:
3  # Nina H�ffmeyer <[email protected]>  # Nina Hüffmeyer <[email protected]>
4  #  #
5  # This program is free software under the GPL (>=v2)  # This program is free software under the GPL (>=v2)
6  # Read the file COPYING coming with Thuban for details.  # Read the file COPYING coming with Thuban for details.
# Line 9  __version__ = "$Revision$" Line 9  __version__ = "$Revision$"
9  # $Source$  # $Source$
10  # $Id$  # $Id$
11    
12  # Needed wx-toolkit classes  # Needed wx.-toolkit classes
13  from wxPython.wx import wxFileDialog, wxOPEN, wxMULTIPLE, wxID_OK  import wx
14    
15  # We need os.path  # We need os.path
16  import os  import os
# Line 34  def open_with_ogr(context): Line 34  def open_with_ogr(context):
34      map = canvas.Map()      map = canvas.Map()
35    
36      # Get the file to be opened      # Get the file to be opened
37      dlg = wxFileDialog(canvas, _("Select a data file"),      dlg = wx.FileDialog(canvas, _("Select a data file"),
38                             context.application.Path("data"), "",                             context.application.Path("data"), "",
39                             _("Shapefiles (*.shp)") + "|*.shp|" +                             _("Shapefiles (*.shp)") + "|*.shp|" +
40                             _("GML files (*.gml)") + "|*.gml|" +                             _("GML files (*.gml)") + "|*.gml|" +
# Line 42  def open_with_ogr(context): Line 42  def open_with_ogr(context):
42                             _("DGN files (*.dgn)") + "|*.dgn|" +                             _("DGN files (*.dgn)") + "|*.dgn|" +
43                             _("CSV files (*.csv)") + "|*.csv|" +                             _("CSV files (*.csv)") + "|*.csv|" +
44                             _("All Files (*.*)") + "|*.*|",                             _("All Files (*.*)") + "|*.*|",
45                             wxOPEN | wxMULTIPLE)                             wx.OPEN | wx.MULTIPLE)
46    
47      if dlg.ShowModal() == wxID_OK:      if dlg.ShowModal() == wx.ID_OK:
48          filenames = dlg.GetPaths()          filenames = dlg.GetPaths()
49          for filename in filenames:          for filename in filenames:
50              title = os.path.splitext(os.path.basename(filename))[0]              title = os.path.splitext(os.path.basename(filename))[0]
51              has_layers = map.HasLayers()              has_layers = map.HasLayers()
52              layerDlg = ogrdialog.ChooseLayer(canvas, filename)              layerDlg = ogrdialog.ChooseLayer(canvas, filename)
53              if layerDlg.ShowModal() == wxID_OK:              if layerDlg.ShowModal() == wx.ID_OK:
54                  layername = layerDlg.GetLayer()                  layername = layerDlg.GetLayer()
55                  try:                  try:
56                      session = context.application.Session()                      session = context.application.Session()
# Line 84  def select_file_format(context): Line 84  def select_file_format(context):
84    
85      dlg = ogrdialog.ChooseFileFormat(canvas, session)      dlg = ogrdialog.ChooseFileFormat(canvas, session)
86    
87      if dlg.ShowModal() == wxID_OK:      if dlg.ShowModal() == wx.ID_OK:
88          pass          pass
89      dlg.Destroy()      dlg.Destroy()
90    
# Line 98  def open_db(context): Line 98  def open_db(context):
98      session = context.application.Session()      session = context.application.Session()
99      dlg = ChooseOGRDBTableDialog(canvas, session)      dlg = ChooseOGRDBTableDialog(canvas, session)
100    
101      if dlg.ShowModal() == wxID_OK:      if dlg.ShowModal() == wx.ID_OK:
102          dbconn, connString, dbtable, id_column = dlg.GetTable()          dbconn, connString, dbtable, id_column = dlg.GetTable()
103          try:          try:
104              store = OpenDBShapestore(session, dbconn, dbtable, id_column,              store = OpenDBShapestore(session, dbconn, dbtable, id_column,
# Line 126  def open_OGRConnection(context): Line 126  def open_OGRConnection(context):
126      session = context.application.Session()      session = context.application.Session()
127      dlg = ogrdialog.OGRConnectionDialog(canvas, session)      dlg = ogrdialog.OGRConnectionDialog(canvas, session)
128    
129      if dlg.ShowModal() == wxID_OK:      if dlg.ShowModal() == wx.ID_OK:
130          dsname = dlg.GetDatasourceName()          dsname = dlg.GetDatasourceName()
131    
132          layerDlg = ogrdialog.ChooseLayer(canvas, dsname)          layerDlg = ogrdialog.ChooseLayer(canvas, dsname)
133          if layerDlg.ShowModal() == wxID_OK:          if layerDlg.ShowModal() == wx.ID_OK:
134              layername = layerDlg.GetLayer()              layername = layerDlg.GetLayer()
135              try:              try:
136                  store = ogrshapes.OGRShapeStore(session, dsname, layername)                  store = ogrshapes.OGRShapeStore(session, dsname, layername)

Legend:
Removed from v.2713  
changed lines
  Added in v.2721

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26