/[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 1667 by bh, Thu Aug 28 10:21:05 2003 UTC revision 1782 by bh, Mon Oct 6 17:31:54 2003 UTC
# Line 23  from wxPython.wx import * Line 23  from wxPython.wx import *
23  import Thuban  import Thuban
24    
25  from Thuban import _  from Thuban import _
26    from Thuban.Model.messages import TITLE_CHANGED
27  from Thuban.Model.session import create_empty_session  from Thuban.Model.session import create_empty_session
28  from Thuban.Model.layer import Layer, RasterLayer  from Thuban.Model.layer import Layer, RasterLayer
29  from Thuban.Model.postgisdb import PostGISShapeStore, has_postgis_support  from Thuban.Model.postgisdb import PostGISShapeStore, has_postgis_support
# Line 101  class MainWindow(DockFrame): Line 102  class MainWindow(DockFrame):
102          canvas.Subscribe(VIEW_POSITION, self.view_position_changed)          canvas.Subscribe(VIEW_POSITION, self.view_position_changed)
103          canvas.Subscribe(SHAPES_SELECTED, self.identify_view_on_demand)          canvas.Subscribe(SHAPES_SELECTED, self.identify_view_on_demand)
104          self.canvas = canvas          self.canvas = canvas
105            self.canvas.Subscribe(TITLE_CHANGED, self.title_changed)
106    
107          self.SetMainWindow(self.canvas)          self.SetMainWindow(self.canvas)
108    
# Line 417  class MainWindow(DockFrame): Line 419  class MainWindow(DockFrame):
419    
420      def SetMap(self, map):      def SetMap(self, map):
421          self.canvas.SetMap(map)          self.canvas.SetMap(map)
422          self.__SetTitle(map.Title())          self.update_title()
423    
424          dialog = self.FindRegisteredDock("legend")          dialog = self.FindRegisteredDock("legend")
425          if dialog is not None:          if dialog is not None:
# Line 509  class MainWindow(DockFrame): Line 511  class MainWindow(DockFrame):
511      def AddDBLayer(self):      def AddDBLayer(self):
512          """Add a layer read from a database"""          """Add a layer read from a database"""
513          session = self.application.Session()          session = self.application.Session()
514          dlg = ChooseDBTableDialog(self.application.Session(), self,-1, "")          dlg = ChooseDBTableDialog(self, self.application.Session())
515    
516          if dlg.ShowModal() == wxID_OK:          if dlg.ShowModal() == wxID_OK:
517              dbconn, dbtable = dlg.GetTable()              dbconn, dbtable = dlg.GetTable()
# Line 856  class MainWindow(DockFrame): Line 858  class MainWindow(DockFrame):
858              title = dlg.GetValue()              title = dlg.GetValue()
859              if title != "":              if title != "":
860                  self.Map().SetTitle(title)                  self.Map().SetTitle(title)
                 self.__SetTitle(title)  
861    
862          dlg.Destroy()          dlg.Destroy()
863    
# Line 898  class MainWindow(DockFrame): Line 899  class MainWindow(DockFrame):
899                  # FIXME: bring dialog to front?                  # FIXME: bring dialog to front?
900                  pass                  pass
901    
902      def __SetTitle(self, title):      def title_changed(self, map):
903          self.SetTitle("Thuban - " + title)          """Subscribed to the canvas' TITLE_CHANGED messages"""
904            self.update_title()
905    
906        def update_title(self):
907            """Update the window's title according to it's current state.
908    
909            In this default implementation the title is 'Thuban - ' followed
910            by the map's title or simply 'Thuban' if there is not map.
911            Derived classes should override this method to get different
912            titles.
913    
914            This method is called automatically by other methods when the
915            title may have to change. For the methods implemented in this
916            class this usually only means that a different map has been set
917            or the current map's title has changed.
918            """
919            map = self.Map()
920            if map is not None:
921                title = _("Thuban - %s") % (map.Title(),)
922            else:
923                title = _("Thuban")
924            self.SetTitle(title)
925    
926    
927  #  #
928  # Define all the commands available in the main window  # Define all the commands available in the main window

Legend:
Removed from v.1667  
changed lines
  Added in v.1782

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26