[GRASS-SVN] r56696 - in grass/branches/releasebranch_6_4/gui/wxpython: core dbmgr gui_core
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Jun 14 01:35:33 PDT 2013
Author: hamish
Date: 2013-06-14 01:35:33 -0700 (Fri, 14 Jun 2013)
New Revision: 56696
Modified:
grass/branches/releasebranch_6_4/gui/wxpython/core/settings.py
grass/branches/releasebranch_6_4/gui/wxpython/dbmgr/manager.py
grass/branches/releasebranch_6_4/gui/wxpython/gui_core/preferences.py
Log:
#1633: make it very unlikely that field sep will collide with values in the ascii flat table, without requiring user intervention (merge from devbr6)
Modified: grass/branches/releasebranch_6_4/gui/wxpython/core/settings.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/core/settings.py 2013-06-14 08:29:44 UTC (rev 56695)
+++ grass/branches/releasebranch_6_4/gui/wxpython/core/settings.py 2013-06-14 08:35:33 UTC (rev 56696)
@@ -225,9 +225,6 @@
},
'encoding' : {
'value' : '',
- },
- 'fieldSeparator' : {
- 'value' : '|',
}
},
#
Modified: grass/branches/releasebranch_6_4/gui/wxpython/dbmgr/manager.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/dbmgr/manager.py 2013-06-14 08:29:44 UTC (rev 56695)
+++ grass/branches/releasebranch_6_4/gui/wxpython/dbmgr/manager.py 2013-06-14 08:35:33 UTC (rev 56696)
@@ -171,7 +171,6 @@
except:
keyId = -1
- fs = UserSettings.Get(group = 'atm', key = 'fieldSeparator', subkey = 'value')
#
# read data
#
@@ -180,13 +179,16 @@
# stdout can be very large, do not use PIPE, redirect to temp file
# TODO: more effective way should be implemented...
outFile = tempfile.NamedTemporaryFile(mode = 'w+b')
-
+
+ # split on field sep breaks if varchar() column contains the
+ # values, so while sticking with ASCII we make it something
+ # highly unlikely to exist naturally.
+ fs = '{_sep_}'
+
cmdParams = dict(quiet = True,
parent = self,
- flags = 'c')
- # pipe must not be given in the params for windows
- if not (sys.platform == "win32" and fs == '|'):
- cmdParams.update(dict(fs = fs))
+ flags = 'c',
+ fs = fs)
if sql:
cmdParams.update(dict(sql = sql,
@@ -243,9 +245,7 @@
if len(columns) != len(record):
GError(parent = self,
message = _("Inconsistent number of columns "
- "in the table <%(table)s>. "
- "Try to change field separator in GUI Settings, "
- "Attributes tab, Data browser section.") % \
+ "in the table <%(table)s>.") % \
{'table' : tableName })
self.columns = {} # because of IsEmpty method
return
@@ -254,7 +254,7 @@
i += 1
if i >= 100000:
- self.log.write(_("Limit 100000 records."))
+ self.log.write(_("Viewing limit: 100000 records."))
break
self.SetItemCount(i)
Modified: grass/branches/releasebranch_6_4/gui/wxpython/gui_core/preferences.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_core/preferences.py 2013-06-14 08:29:44 UTC (rev 56695)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_core/preferences.py 2013-06-14 08:35:33 UTC (rev 56696)
@@ -46,7 +46,7 @@
from grass.script import core as grass
from core import globalvar
-from core.gcmd import RunCommand, GError
+from core.gcmd import RunCommand
from core.utils import ListOfMapsets, GetColorTables, ReadEpsgCodes, GetSettingsPath
from core.settings import UserSettings
from gui_core.widgets import IntegerValidator
@@ -213,15 +213,6 @@
win.SetValue(self.settings.Get(group = 'atm', key = 'keycolumn', subkey = 'value'))
return False
- if key == 'fieldSeparator':
- try:
- value = str(value)
- except UnicodeEncodeError:
- GError(parent = self, message = _("Field separator must be ASCII character "
- "not <%s> (use e.g. ';', '&', '#')") % value)
- return False
- if value == '':
- value = self.settings.Get(group = 'atm', key = 'fieldSeparator', subkey = 'value')
if subkey1:
self.settings.Set(group, value, key, [subkey, subkey1])
else:
@@ -1048,17 +1039,6 @@
flexSizer.Add(label, proportion = 0, flag = wx.ALIGN_CENTER_VERTICAL)
flexSizer.Add(encoding, proportion = 0, flag = wx.ALIGN_RIGHT | wx.FIXED_MINSIZE)
- # field separator
- label = wx.StaticText(parent = panel, id = wx.ID_ANY,
- label = _("Field separator:"))
- separator = wx.TextCtrl(parent = panel, id = wx.ID_ANY,
- value = self.settings.Get(group = 'atm', key = 'fieldSeparator', subkey = 'value'),
- name = "GetValue", size = (200, -1))
- self.winId['atm:fieldSeparator:value'] = separator.GetId()
-
- flexSizer.Add(label, proportion = 0, flag = wx.ALIGN_CENTER_VERTICAL)
- flexSizer.Add(separator, proportion = 0, flag = wx.ALIGN_RIGHT | wx.FIXED_MINSIZE)
-
# ask on delete record
askOnDeleteRec = wx.CheckBox(parent = panel, id = wx.ID_ANY,
label = _("Ask when deleting data record(s) from table"),
More information about the grass-commit
mailing list