[GRASS-SVN] r45858 - grass-addons/gui/wxpython/wx.psmap/gui_modules
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Apr 6 14:32:47 EDT 2011
Author: annakrat
Date: 2011-04-06 11:32:47 -0700 (Wed, 06 Apr 2011)
New Revision: 45858
Modified:
grass-addons/gui/wxpython/wx.psmap/gui_modules/psmap.py
grass-addons/gui/wxpython/wx.psmap/gui_modules/psmap_dialogs.py
Log:
minor changes in GUI
Modified: grass-addons/gui/wxpython/wx.psmap/gui_modules/psmap.py
===================================================================
--- grass-addons/gui/wxpython/wx.psmap/gui_modules/psmap.py 2011-04-06 17:07:25 UTC (rev 45857)
+++ grass-addons/gui/wxpython/wx.psmap/gui_modules/psmap.py 2011-04-06 18:32:47 UTC (rev 45858)
@@ -388,20 +388,27 @@
if haveImage and event.userData['temp']:
RunCommand('g.region', cols = event.userData['regionOld']['cols'], rows = event.userData['regionOld']['rows'])
+## wx.BusyInfo does not display the message
+## busy = wx.BusyInfo(message = "Generating preview, wait please", parent = self)
+
try:
im = Image.open(event.userData['filename'])
if self.instruction[self.pageId]['Orientation'] == 'Landscape':
im = im.rotate(270)
+
im.save(self.imgName, format = 'png')
-
+
except IOError, e:
GError(parent = self,
message = _("Unable to generate preview. %s") % e)
+
+
rect = self.previewCanvas.ImageRect()
self.previewCanvas.image = wx.Image(self.imgName, wx.BITMAP_TYPE_PNG)
self.previewCanvas.DrawImage(rect = rect)
+## busy.Destroy()
self.SetStatusText(_('Preview generated'), 0)
self.book.SetSelection(1)
self.currentPage = 1
@@ -931,6 +938,7 @@
os.remove(self.imgName)
except OSError:
pass
+ grass.set_raise_on_error(False)
self.Destroy()
Modified: grass-addons/gui/wxpython/wx.psmap/gui_modules/psmap_dialogs.py
===================================================================
--- grass-addons/gui/wxpython/wx.psmap/gui_modules/psmap_dialogs.py 2011-04-06 17:07:25 UTC (rev 45857)
+++ grass-addons/gui/wxpython/wx.psmap/gui_modules/psmap_dialogs.py 2011-04-06 18:32:47 UTC (rev 45858)
@@ -2497,7 +2497,7 @@
# choose vector map
- box = wx.StaticBox (parent = self, id = wx.ID_ANY, label = " %s " % _("Choose map"))
+ box = wx.StaticBox (parent = self, id = wx.ID_ANY, label = " %s " % _("Add map"))
sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
gridBagSizer = wx.GridBagSizer (hgap = 5, vgap = 5)
@@ -2520,7 +2520,7 @@
# manage vector layers
- box = wx.StaticBox (parent = self, id = wx.ID_ANY, label = " %s " % _("Vector maps order"))
+ box = wx.StaticBox (parent = self, id = wx.ID_ANY, label = " %s " % _("Manage vector maps"))
sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
gridBagSizer = wx.GridBagSizer (hgap = 5, vgap = 5)
gridBagSizer.AddGrowableCol(0,2)
@@ -2535,7 +2535,7 @@
self.btnDel = wx.Button(self, id = wx.ID_ANY, label = _("Delete"))
self.btnProp = wx.Button(self, id = wx.ID_ANY, label = _("Properties"))
- self.updateListBox()
+ self.updateListBox(selected = 0)
gridBagSizer.Add(text, pos = (0,0), span = (1,2), flag = wx.ALIGN_CENTER_VERTICAL, border = 0)
@@ -2557,6 +2557,8 @@
self.SetSizer(border)
self.Fit()
+
+ self.Bind(wx.EVT_LISTBOX_DCLICK, self.OnProperties, self.listbox)
def OnVector(self, event):
"""!Gets info about toplogy and enables/disables choices point/line/area"""
@@ -2604,6 +2606,7 @@
self.listbox.SetSelection(0)
self.listbox.EnsureVisible(0)
self.btnProp.SetFocus()
+ self.enableButtons()
def OnDelete(self, event):
"""!Deletes vector map from the list"""
@@ -2617,6 +2620,8 @@
if self.vectorList[i][3]:# can be 0
self.vectorList[i][3] -= 1
self.updateListBox(selected = pos if pos < len(self.vectorList) -1 else len(self.vectorList) -1)
+ if self.listbox.IsEmpty():
+ self.enableButtons(False)
def OnUp(self, event):
@@ -2651,7 +2656,12 @@
self.parent.FindWindowById(wx.ID_OK).SetFocus()
-
+ def enableButtons(self, enable = True):
+ """!Enable/disable up, down, properties, delete buttons"""
+ self.btnUp.Enable(enable)
+ self.btnDown.Enable(enable)
+ self.btnProp.Enable(enable)
+ self.btnDel.Enable(enable)
def updateListBox(self, selected = None):
mapList = ["%s - %s" % (item[0], item[1]) for item in self.vectorList]
@@ -2659,6 +2669,10 @@
if selected is not None:
self.listbox.SetSelection(selected)
self.listbox.EnsureVisible(selected)
+ if self.listbox.IsEmpty():
+ self.enableButtons(False)
+ else:
+ self.enableButtons(True)
def reposition(self):
"""!Update position in legend, used only if there is no vlegend yet"""
@@ -2705,7 +2719,7 @@
class RasterDialog(PsmapDialog):
def __init__(self, parent, id, settings):
- PsmapDialog.__init__(self, parent = parent, id = id, title = "Choose raster map", settings = settings)
+ PsmapDialog.__init__(self, parent = parent, id = id, title = "Raster map settings", settings = settings)
self.objectType = ('raster',)
self.rPanel = RasterPanel(parent = self, id = self.id, settings = self.instruction, notebook = False)
@@ -2742,7 +2756,7 @@
class MainVectorDialog(PsmapDialog):
def __init__(self, parent, id, settings):
- PsmapDialog.__init__(self, parent = parent, id = id, title = "Choose vector maps", settings = settings)
+ PsmapDialog.__init__(self, parent = parent, id = id, title = "Vector maps settings", settings = settings)
self.objectType = ('vector',)
self.vPanel = VectorPanel(parent = self, id = self.id, settings = self.instruction, notebook = False)
More information about the grass-commit
mailing list