/[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 640 by jonathan, Thu Apr 10 14:36:08 2003 UTC revision 704 by bh, Tue Apr 22 16:55:50 2003 UTC
# Line 36  from menu import Menu Line 36  from menu import Menu
36    
37  from context import Context  from context import Context
38  from command import registry, Command, ToolCommand  from command import registry, Command, ToolCommand
39  from messages import LAYER_SELECTED, SHAPES_SELECTED, VIEW_POSITION, DOCKABLE_DOCKED, DOCKABLE_UNDOCKED, DOCKABLE_CLOSED  from messages import LAYER_SELECTED, SHAPES_SELECTED, VIEW_POSITION
40    
41  from Thuban.UI.dock import DockableWindow, DockFrame, DockPanel  from Thuban.UI.dock import DockFrame
42    
43    import resource
44    
 # the directory where the toolbar icons are stored  
 bitmapdir = os.path.join(Thuban.__path__[0], os.pardir, "Resources", "Bitmaps")  
 bitmapext = ".xpm"  
   
 ID_WINDOW_LEGEND = 4001  
 ID_WINDOW_CANVAS = 4002  
45    
46    
47  class MainWindow(DockFrame):  class MainWindow(DockFrame):
# Line 243  class MainWindow(DockFrame): Line 238  class MainWindow(DockFrame):
238              command = registry.Command(name)              command = registry.Command(name)
239              if command is not None:              if command is not None:
240                  ID = self.get_id(name)                  ID = self.get_id(name)
241                  filename = os.path.join(bitmapdir, command.Icon()) + bitmapext                  bitmap = resource.GetBitmapResource(command.Icon(),
242                  bitmap = wxBitmap(filename, wxBITMAP_TYPE_XPM)                                                      wxBITMAP_TYPE_XPM)
243                  toolbar.AddTool(ID, bitmap,                  toolbar.AddTool(ID, bitmap,
244                                  shortHelpString = command.HelpText(),                                  shortHelpString = command.HelpText(),
245                                  isToggle = command.IsCheckCommand())                                  isToggle = command.IsCheckCommand())
# Line 403  class MainWindow(DockFrame): Line 398  class MainWindow(DockFrame):
398    
399      def SetMap(self, map):      def SetMap(self, map):
400          self.canvas.SetMap(map)          self.canvas.SetMap(map)
401          self.SetTitle("Thuban - " + map.Title())          self.__SetTitle(map.Title())
402          #self.legendPanel.SetMap(map)          #self.legendPanel.SetMap(map)
403    
404      def Map(self):      def Map(self):
# Line 628  class MainWindow(DockFrame): Line 623  class MainWindow(DockFrame):
623      def PrintMap(self):      def PrintMap(self):
624          self.canvas.Print()          self.canvas.Print()
625    
626        def RenameMap(self):
627            dlg = wxTextEntryDialog(self, "Map Title: ", "Rename Map",
628                                    self.Map().Title())
629            if dlg.ShowModal() == wxID_OK:
630                title = dlg.GetValue()
631                if title != "":
632                    self.Map().SetTitle(title)
633                    self.__SetTitle(title)
634    
635            dlg.Destroy()
636    
637      def identify_view_on_demand(self, layer, shapes):      def identify_view_on_demand(self, layer, shapes):
638          name = "identify_view"          name = "identify_view"
639          if self.canvas.CurrentTool() == "IdentifyTool":          if self.canvas.CurrentTool() == "IdentifyTool":
# Line 639  class MainWindow(DockFrame): Line 645  class MainWindow(DockFrame):
645                  # FIXME: bring dialog to front?                  # FIXME: bring dialog to front?
646                  pass                  pass
647    
648        def __SetTitle(self, title):
649            self.SetTitle("Thuban - " + title)
650    
651  #  #
652  # Define all the commands available in the main window  # Define all the commands available in the main window
653  #  #
# Line 741  _method_command("map_full_extent", _("&F Line 750  _method_command("map_full_extent", _("&F
750                sensitive = _has_visible_map)                sensitive = _has_visible_map)
751  _method_command("map_print", _("Prin&t"), "PrintMap",  _method_command("map_print", _("Prin&t"), "PrintMap",
752                  helptext = _("Print the map"))                  helptext = _("Print the map"))
753    _method_command("map_rename", _("&Rename"), "RenameMap",
754                    helptext = _("Rename the map"))
755    
756  # Layer menu  # Layer menu
757  _method_command("layer_add", _("&Add Layer"), "AddLayer",  _method_command("layer_add", _("&Add Layer"), "AddLayer",
# Line 785  main_menu = Menu("<main>", "<main>", Line 796  main_menu = Menu("<main>", "<main>",
796                          None,                          None,
797                          "toggle_legend",                          "toggle_legend",
798                          None,                          None,
799                          "map_print"]),                          "map_print",
800                            None,
801                            "map_rename"]),
802                    Menu("layer", _("&Layer"),                    Menu("layer", _("&Layer"),
803                          ["layer_raise", "layer_lower",                          ["layer_raise", "layer_lower",
804                          None,                          None,

Legend:
Removed from v.640  
changed lines
  Added in v.704

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26