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

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

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

revision 113 by jan, Sun Apr 21 17:38:50 2002 UTC revision 130 by bh, Fri May 3 14:50:18 2002 UTC
# Line 1  Line 1 
1  # Copyright (C) 2001 by Intevation GmbH  # Copyright (C) 2001, 2002 by Intevation GmbH
2  # Authors:  # Authors:
3  # Jan-Oliver Wagner <[email protected]>  # Jan-Oliver Wagner <[email protected]>
4  # Bernhard Herzog <[email protected]>  # Bernhard Herzog <[email protected]>
# Line 30  import tableview, identifyview Line 30  import tableview, identifyview
30    
31  import main  import main
32  from command import registry, Command  from command import registry, Command
33  from messages import SELECTED_SHAPE  from messages import SELECTED_SHAPE, VIEW_POSITION
34    
35    
36  # the directory where the toolbar icons are stored  # the directory where the toolbar icons are stored
# Line 111  class MainWindow(wxFrame): Line 111  class MainWindow(wxFrame):
111    
112          # Create the map canvas          # Create the map canvas
113          canvas = view.MapCanvas(self, -1, interactor)          canvas = view.MapCanvas(self, -1, interactor)
114            canvas.Subscribe(VIEW_POSITION, self.view_position_changed)
115          self.canvas = canvas          self.canvas = canvas
116    
117          self.init_dialogs()          self.init_dialogs()
# Line 223  class MainWindow(wxFrame): Line 224  class MainWindow(wxFrame):
224      def get_open_dialog(self, name):      def get_open_dialog(self, name):
225          return self.dialogs.get(name)          return self.dialogs.get(name)
226    
227        def view_position_changed(self):
228            pos = self.canvas.CurrentPosition()
229            if pos is not None:
230                text = "(%10.10g, %10.10g)" % pos
231            else:
232                text = ""
233            self.SetStatusText(text)
234    
235      def save_modified_session(self, can_veto = 1):      def save_modified_session(self, can_veto = 1):
236          """If the current session has been modified, ask the user          """If the current session has been modified, ask the user
237          whether to save it and do so if requested. Return the outcome of          whether to save it and do so if requested. Return the outcome of
# Line 253  class MainWindow(wxFrame): Line 262  class MainWindow(wxFrame):
262      def OpenSession(self):      def OpenSession(self):
263          self.save_modified_session()          self.save_modified_session()
264          dlg = wxFileDialog(self, "Select a session file", ".", "",          dlg = wxFileDialog(self, "Select a session file", ".", "",
265                             "*.session", wxOPEN)                             "*.thuban", wxOPEN)
266          if dlg.ShowModal() == wxID_OK:          if dlg.ShowModal() == wxID_OK:
267              main.app.OpenSession(dlg.GetPath())              main.app.OpenSession(dlg.GetPath())
268          dlg.Destroy()          dlg.Destroy()
# Line 265  class MainWindow(wxFrame): Line 274  class MainWindow(wxFrame):
274    
275      def SaveSessionAs(self):      def SaveSessionAs(self):
276          dlg = wxFileDialog(self, "Enter a filename for session", ".", "",          dlg = wxFileDialog(self, "Enter a filename for session", ".", "",
277                             "*.session", wxOPEN)                             "*.thuban", wxOPEN)
278          if dlg.ShowModal() == wxID_OK:          if dlg.ShowModal() == wxID_OK:
279              main.app.session.SetFilename(dlg.GetPath())              main.app.session.SetFilename(dlg.GetPath())
280              main.app.SaveSession()              main.app.SaveSession()
# Line 304  class MainWindow(wxFrame): Line 313  class MainWindow(wxFrame):
313                             wxOK | wxICON_INFORMATION)                             wxOK | wxICON_INFORMATION)
314    
315      def AddLayer(self):      def AddLayer(self):
316          dlg = wxFileDialog(self, "Select a session file", ".", "", "*.*",          dlg = wxFileDialog(self, "Select a data file", ".", "", "*.*",
317                             wxOPEN)                             wxOPEN)
318          if dlg.ShowModal() == wxID_OK:          if dlg.ShowModal() == wxID_OK:
319              filename = dlg.GetPath()              filename = dlg.GetPath()

Legend:
Removed from v.113  
changed lines
  Added in v.130

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26