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

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

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

revision 2587 by jonathan, Wed Mar 23 15:30:27 2005 UTC revision 2700 by dpinte, Mon Sep 18 14:27:02 2006 UTC
# Line 11  __version__ = "$Revision$" Line 11  __version__ = "$Revision$"
11  # $Source$  # $Source$
12  # $Id$  # $Id$
13    
14  from wxPython.wx import *  import wx
15    
16  from Thuban import _  from Thuban import _
17  from Thuban.UI.layerproperties import LayerProperties  from Thuban.UI.layerproperties import LayerProperties
# Line 37  class RasterLayerProperties(LayerPropert Line 37  class RasterLayerProperties(LayerPropert
37    
38          if info is None:          if info is None:
39              panelBox.Add(              panelBox.Add(
40                  wxStaticText(panel, -1,                  wx.StaticText(panel, -1,
41                  _("GDAL image information unavailable. See About box for details.")),                  _("GDAL image information unavailable. See About box for details.")),
42                  0, wxALIGN_LEFT | wxALL, 4)                  0, wx.ALIGN_LEFT | wx.ALL, 4)
43              return              return
44    
45            
46          # Bounding Box          # Bounding Box
47          bbox = self.layer.LatLongBoundingBox()          bbox = self.layer.LatLongBoundingBox()
48          if bbox is None:          if bbox is None:
# Line 50  class RasterLayerProperties(LayerPropert Line 50  class RasterLayerProperties(LayerPropert
50          else:          else:
51              text = _("Extent (lat-lon): (%g, %g, %g, %g)") % tuple(bbox)              text = _("Extent (lat-lon): (%g, %g, %g, %g)") % tuple(bbox)
52    
53          panelBox.Add(wxStaticText(panel, -1, text), 0, wxALIGN_LEFT|wxALL, 4)          panelBox.Add(wx.StaticText(panel, -1, text), 0, wx.ALIGN_LEFT|wx.ALL, 4)
54    
55          rasterBox = wxStaticBoxSizer(wxStaticBox(panel, -1,          rasterBox = wx.StaticBoxSizer(wx.StaticBox(panel, -1,
56                      _("Image Properties")), wxVERTICAL)                      _("Image Properties")), wx.VERTICAL)
57    
58    
59          rasterBox.Add(          rasterBox.Add(
60              wxStaticText(panel, -1,              wx.StaticText(panel, -1,
61              _("Source: %s") % self.layer.GetImageFilename()),              _("Source: %s") % self.layer.GetImageFilename()),
62              0, wxALIGN_LEFT | wxALL, 4)              0, wx.ALIGN_LEFT | wx.ALL, 4)
63    
64          infoBox = wxBoxSizer(wxHORIZONTAL)          infoBox = wx.BoxSizer(wx.HORIZONTAL)
65    
66          nBands = info["nBands"]          nBands = info["nBands"]
67    
68          self.usePalIndex = nBands == 1          self.usePalIndex = nBands == 1
69            
70          infoBox.Add(          infoBox.Add(
71              wxStaticText(panel, -1, _("Driver: %s") % info["Driver"]),              wx.StaticText(panel, -1, _("Driver: %s") % info["Driver"]),
72              0, wxALIGN_LEFT | wxRIGHT, 10)              0, wx.ALIGN_LEFT | wx.RIGHT, 10)
73          infoBox.Add(          infoBox.Add(
74              wxStaticText(panel, -1, _("Size: %ix%i") % info["Size"]),              wx.StaticText(panel, -1, _("Size: %ix%i") % info["Size"]),
75              0, wxALIGN_LEFT | wxRIGHT, 10)              0, wx.ALIGN_LEFT | wx.RIGHT, 10)
76          infoBox.Add(          infoBox.Add(
77              wxStaticText(panel, -1, _("Number of Bands: %i") % nBands),              wx.StaticText(panel, -1, _("Number of Bands: %i") % nBands),
78              0, wxALIGN_LEFT | wxRIGHT, 0)              0, wx.ALIGN_LEFT | wx.RIGHT, 0)
79    
80          rasterBox.Add(infoBox, 0, wxALIGN_LEFT|wxALL, 4)          rasterBox.Add(infoBox, 0, wx.ALIGN_LEFT|wx.ALL, 4)
81    
82          # Mask          # Mask
83    
84          maskBox = wxBoxSizer(wxHORIZONTAL)          maskBox = wx.BoxSizer(wx.HORIZONTAL)
85    
86          if versions['wxPython-tuple'] < (2,5,3):          if versions['wxPython-tuple'] < (2,5,3):
87              choices = ["None", "Bitmap",              choices = ["None", "Bitmap",
88                         "Alpha (Not support by wxPython %s)" % \                         "Alpha (Not support by wxPython %s)" % \
89                         versions['wxPython']]                         versions['wxPython']]
90          else:          else:
91              choices = ["None", "Bitmap", "Alpha"]              choices = ["None", "Bitmap", "Alpha"]
92    
93          self.maskRadioBox = wxRadioBox(panel, ID_RB_MASK, _("Mask Type"),          self.maskRadioBox = wx.RadioBox(panel, ID_RB_MASK, _("Mask Type"),
94                              choices=choices)                              choices=choices)
95          #self.maskCB = wxCheckBox(panel, -1, _("Use Mask"))          #self.maskCB = wxCheckBox(panel, -1, _("Use Mask"))
96          maskBox.Add(self.maskRadioBox, 0, wxRIGHT, 10)          maskBox.Add(self.maskRadioBox, 0, wx.RIGHT, 10)
97    
98          self.opBox = wxBoxSizer(wxHORIZONTAL)          self.opBox = wx.BoxSizer(wx.HORIZONTAL)
99          self.opSpinLabel = wxStaticText(panel, -1, _("Opacity:"))          self.opSpinLabel = wx.StaticText(panel, -1, _("Opacity:"))
100          self.opBox.Add(self.opSpinLabel, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 4)          self.opBox.Add(self.opSpinLabel, 0, wx.ALIGN_CENTER_VERTICAL|wx.RIGHT, 4)
101          self.opSpin = wxSpinCtrl(panel, -1,          self.opSpin = wx.SpinCtrl(panel, -1,
102                                   str(self.layer.Opacity()*255),                                   str(self.layer.Opacity()*255),
103                                   initial = self.layer.Opacity()*255,                                   initial = self.layer.Opacity()*255,
104                                   min=0, max=255)                                   min=0, max=255)
105          self.opBox.Add(self.opSpin, 0, wxALL, 4)          self.opBox.Add(self.opSpin, 0, wx.ALL, 4)
106          maskBox.Add(self.opBox, 0, wxALL|wxALIGN_CENTER_VERTICAL, 4)          maskBox.Add(self.opBox, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 4)
107    
108          rasterBox.Add(maskBox, 0, wxALL, 4)          rasterBox.Add(maskBox, 0, wx.ALL, 4)
109          #rasterBox.Add(opBox, 0, wxALL, 4)          #rasterBox.Add(opBox, 0, wxALL, 4)
110    
111          panelBox.Add(rasterBox, 1, wxGROW | wxALL, 4)          panelBox.Add(rasterBox, 1, wx.GROW | wx.ALL, 4)
112    
113          self.maskRadioBox.SetSelection(self.old_state["mask_type"])          self.maskRadioBox.SetSelection(self.old_state["mask_type"])
114    
115          self.OnMaskSelect(None)          self.OnMaskSelect(None)
116    
117          EVT_RADIOBOX(self, ID_RB_MASK, self.OnMaskSelect)          self.Bind(wx.EVT_RADIOBOX, self.OnMaskSelect, id=ID_RB_MASK)
118    
119      def OnTry(self, event):      def OnTry(self, event):
120          self.set_state()          self.set_state()
121    
122      def OnOK(self, event):      def OnOK(self, event):
123          if self.set_state():          if self.set_state():
124              self.Close()              self.Close()
125    
126      def OnRevert(self, event):      def OnRevert(self, event):

Legend:
Removed from v.2587  
changed lines
  Added in v.2700

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26