/[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 450 by jonathan, Tue Mar 4 10:33:28 2003 UTC revision 517 by jonathan, Tue Mar 11 17:28:39 2003 UTC
# Line 12  The main window Line 12  The main window
12    
13  __version__ = "$Revision$"  __version__ = "$Revision$"
14    
15    __ThubanVersion__ = "0.2" #"$THUBAN_0_2$"
16    #__BuildDate__ = "$Date$"
17    
18  import os  import os
19    
20  from wxPython.wx import *  from wxPython.wx import *
# Line 296  class MainWindow(wxFrame): Line 299  class MainWindow(wxFrame):
299              result = wxID_NO              result = wxID_NO
300          return result          return result
301    
302        def prepare_new_session(self):
303            for d in self.dialogs.values():
304                if not isinstance(d, tree.SessionTreeView):
305                    d.Close()
306    
307      def NewSession(self):      def NewSession(self):
308          self.save_modified_session()          self.save_modified_session()
309            self.prepare_new_session()
310          self.application.SetSession(create_empty_session())          self.application.SetSession(create_empty_session())
311    
312      def OpenSession(self):      def OpenSession(self):
313          self.save_modified_session()          self.save_modified_session()
314          dlg = wxFileDialog(self, _("Open Session"), ".", "",          dlg = wxFileDialog(self, _("Open Session"), ".", "", "*.thuban", wxOPEN)
                            "*.thuban", wxOPEN)  
315          if dlg.ShowModal() == wxID_OK:          if dlg.ShowModal() == wxID_OK:
316                self.prepare_new_session()
317              self.application.OpenSession(dlg.GetPath())              self.application.OpenSession(dlg.GetPath())
318          dlg.Destroy()          dlg.Destroy()
319    
320      def SaveSession(self):      def SaveSession(self):
321          if self.application.session.filename == None:          if self.application.session.filename == None:
322              self.SaveSessionAs()              self.SaveSessionAs()
323          self.application.SaveSession()          else:
324                self.application.SaveSession()
325    
326      def SaveSessionAs(self):      def SaveSessionAs(self):
327          dlg = wxFileDialog(self, _("Save Session As"), ".", "",          dlg = wxFileDialog(self, _("Save Session As"), ".", "",
# Line 348  class MainWindow(wxFrame): Line 358  class MainWindow(wxFrame):
358          if dialog is None:          if dialog is None:
359              dialog = tree.SessionTreeView(self, self.application, name)              dialog = tree.SessionTreeView(self, self.application, name)
360              self.add_dialog(name, dialog)              self.add_dialog(name, dialog)
361              dialog.Show(true)              dialog.Show(True)
362          else:          else:
363              # FIXME: bring dialog to front here              # FIXME: bring dialog to front here
364              pass              pass
365    
366    
367      def About(self):      def About(self):
368          self.RunMessageBox(_("About"),          self.RunMessageBox(_("About"),
369                             _("Thuban is a program for\n"                             _("Thuban v%s\n"
370                                #"Build Date: %s\n"
371                                "\n"
372                                "Thuban is a program for\n"
373                              "exploring geographic data.\n"                              "exploring geographic data.\n"
374                              "Copyright (C) 2001-2003 Intevation GmbH.\n"                              "Copyright (C) 2001-2003 Intevation GmbH.\n"
375                              "Thuban is licensed under the GPL"),                              "Thuban is licensed under the GNU GPL"
376                               % __ThubanVersion__), #__BuildDate__)),
377                             wxOK | wxICON_INFORMATION)                             wxOK | wxICON_INFORMATION)
378    
379      def AddLayer(self):      def AddLayer(self):
# Line 455  class MainWindow(wxFrame): Line 470  class MainWindow(wxFrame):
470          if layer is not None:          if layer is not None:
471              color = self.choose_color()              color = self.choose_color()
472              if color is not None:              if color is not None:
473                  layer.GetClassification().SetDefaultStroke(color)                  layer.GetClassification().SetDefaultLineColor(color)
474    
475      def LayerNoOutline(self):      def LayerNoOutline(self):
476          layer = self.current_layer()          layer = self.current_layer()
477          if layer is not None:          if layer is not None:
478              layer.GetClassification().SetDefaultStroke(Color.None)              layer.GetClassification().SetDefaultLineColor(Color.None)
479    
480      def HideLayer(self):      def HideLayer(self):
481          layer = self.current_layer()          layer = self.current_layer()
# Line 506  class MainWindow(wxFrame): Line 521  class MainWindow(wxFrame):
521          proj4Dlg.Destroy()          proj4Dlg.Destroy()
522    
523      def Classify(self):      def Classify(self):
524          classifyDlg = classifier.Classifier(NULL, self.current_layer())  
525            #
526          classifyDlg.ShowModal()          # the menu option for this should only be available if there
527          classifyDlg.Destroy()          # is a current layer, so we don't need to check if the
528            # current layer is None
529            #
530    
531            layer = self.current_layer()
532            name = "classifier" + str(id(layer))
533            dialog = self.get_open_dialog(name)
534    
535            if dialog is None:
536                dialog = classifier.Classifier(self, self.interactor,
537                                               name, self.current_layer())
538                self.add_dialog(name, dialog)
539                dialog.Show()
540    
541      def ZoomInTool(self):      def ZoomInTool(self):
542          self.canvas.ZoomInTool()          self.canvas.ZoomInTool()

Legend:
Removed from v.450  
changed lines
  Added in v.517

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26