[GRASS-SVN] r45824 - grass-addons/gui/wxpython/wx.psmap/gui_modules
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat Apr 2 05:21:43 EDT 2011
Author: annakrat
Date: 2011-04-02 02:21:43 -0700 (Sat, 02 Apr 2011)
New Revision: 45824
Modified:
grass-addons/gui/wxpython/wx.psmap/gui_modules/psmap.py
grass-addons/gui/wxpython/wx.psmap/gui_modules/psmap_dialogs.py
Log:
xwGUI/psmap: fixed a few bugs
Modified: grass-addons/gui/wxpython/wx.psmap/gui_modules/psmap.py
===================================================================
--- grass-addons/gui/wxpython/wx.psmap/gui_modules/psmap.py 2011-04-01 20:17:04 UTC (rev 45823)
+++ grass-addons/gui/wxpython/wx.psmap/gui_modules/psmap.py 2011-04-02 09:21:43 UTC (rev 45824)
@@ -386,7 +386,7 @@
im = Image.open(event.userData['filename'])
if self.instruction[self.pageId]['Orientation'] == 'Landscape':
im = im.rotate(270)
- im.save(self.imgName)
+ im.save(self.imgName, format = 'png', optimize = 1)
except IOError, e:
GError(parent = self,
@@ -796,6 +796,7 @@
ids = [id]
for id in ids:
itype = self.instruction[id].type
+
if itype in ('scalebar', 'mapinfo'):
drawRectangle = self.canvas.CanvasPaperCoordinates(
rect = self.instruction[id]['rect'], canvasToPaper = False)
@@ -855,7 +856,7 @@
self.canvas.RedrawSelectBox(id)
self.canvas.pdcTmp.RemoveId(self.canvas.idZoomBoxTmp)
# redraw to get map to the bottom layer
- self.canvas.Zoom(zoomFactor = 1, view = (0, 0))
+ #self.canvas.Zoom(zoomFactor = 1, view = (0, 0))
if itype == 'rasterLegend':
if self.instruction[id]['rLegend']:
@@ -1276,7 +1277,8 @@
map = self.instruction[mapId]['map'],
mapType = self.instruction[mapId]['mapType'],
rect = self.instruction[mapId]['rect'])
- if self.instruction[mapId]['scaleType'] == 1:
+
+ elif self.instruction[mapId]['scaleType'] == 1:
scale, foo, rect = AutoAdjust(self, scaleType = 1,
region = self.instruction[mapId]['region'],
rect = self.instruction[mapId]['rect'])
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-01 20:17:04 UTC (rev 45823)
+++ grass-addons/gui/wxpython/wx.psmap/gui_modules/psmap_dialogs.py 2011-04-02 09:21:43 UTC (rev 45824)
@@ -316,7 +316,8 @@
vectorMapNumber = 1
file.seek(0)
for line in file:
-
+ if not line.strip():
+ continue
line = line.strip()
if isBuffer:
buffer.append(line)
@@ -656,7 +657,7 @@
# scale
if self.instruction['scaleType'] == 3: #fixed scale
- scaleInstruction = "scale 1:%.0f" % 1/self.instruction['scale']
+ scaleInstruction = "scale 1:%.0f" % (1/self.instruction['scale'])
instr += scaleInstruction
instr += '\n'
# border
@@ -862,7 +863,7 @@
def __str__(self):
text = self.instruction['text'].replace('\n','\\n')
- instr = "text %.3f %.3f" % (self.instruction['east'], self.instruction['north'])
+ instr = "text %s %s" % (self.instruction['east'], self.instruction['north'])
instr += " %s\n" % text
instr += string.Template(" font $font\n fontsize $fontsize\n color $color\n").substitute(self.instruction)
instr += string.Template(" hcolor $hcolor\n").substitute(self.instruction)
@@ -920,9 +921,9 @@
elif sub == 'rotate':
instr['rotate'] = float(line.split(None, 1)[1])
elif sub == 'xoffset':
- instr['xoffset'] = float(line.split(None, 1)[1])
+ instr['xoffset'] = int(line.split(None, 1)[1])
elif sub == 'yoffset':
- instr['yoffset'] = float(line.split(None, 1)[1])
+ instr['yoffset'] = int(line.split(None, 1)[1])
elif sub == 'opaque':
if line.split(None, 1)[1].lower() in ('n', 'none'):
instr['background'] = 'none'
@@ -1507,7 +1508,7 @@
if line.startswith('lpos'):
instr['lpos'] = int(line.split()[1])
elif line.startswith('label'):
- instr['label'] = line.split()[1]
+ instr['label'] = line.split(None, 1)[1]
elif line.startswith('layer'):
instr['layer'] = line.split()[1]
elif line.startswith('masked'):
@@ -2466,6 +2467,7 @@
if notebook:
self.parent.AddPage(page = self, text = _("Vector maps"))
+ self.parent = self.parent.GetParent()
def _layout(self):
"""!Do layout"""
@@ -5051,18 +5053,12 @@
#effects
if self.effect['backgroundCtrl'].GetValue():
background = self.effect['backgroundColor'].GetColour()
-## if background.GetAsString(wx.C2S_NAME) in PSMAP_COLORS:
-## self.textDict['background'] = background.GetAsString(wx.C2S_NAME)
-## else:
self.textDict['background'] = convertRGB(background)
else:
self.textDict['background'] = 'none'
if self.effect['borderCtrl'].GetValue():
border = self.effect['borderColor'].GetColour()
-## if border.GetAsString(wx.C2S_NAME) in PSMAP_COLORS:
-## self.textDict['border'] = border.GetAsString(wx.C2S_NAME)
-## else:
self.textDict['border'] = convertRGB(border)
else:
self.textDict['border'] = 'none'
@@ -5071,9 +5067,6 @@
if self.effect['highlightCtrl'].GetValue():
highlight = self.effect['highlightColor'].GetColour()
-## if highlight.GetAsString(wx.C2S_NAME) in PSMAP_COLORS:
-## self.textDict['hcolor'] = highlight.GetAsString(wx.C2S_NAME)
-## else:
self.textDict['hcolor'] = convertRGB(highlight)
else:
self.textDict['hcolor'] = 'none'
More information about the grass-commit
mailing list