File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
python/plugins/db_manager Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -244,11 +244,31 @@ def fillColumnCombos(self):
244244 if c :
245245 c .close ()
246246 del c
247+
248+ # get sensible default columns. do this before sorting in case there's hints in the column order (eg, id is more likely to be first)
249+ try :
250+ defaultGeomCol = next (col for col in cols if col in ['geom' ,'geometry' ,'the_geom' ])
251+ except :
252+ defaultGeomCol = None
253+ try :
254+ defaultUniqueCol = [col for col in cols if 'id' in col ][0 ]
255+ except :
256+ defaultUniqueCol = None
247257
248258 cols .sort ()
249259 self .uniqueCombo .addItems ( cols )
250260 self .geomCombo .addItems ( cols )
251261
262+ # set sensible default columns
263+ try :
264+ self .geomCombo .setCurrentIndex ( cols .index (defaultGeomCol ) )
265+ except :
266+ pass
267+ try :
268+ self .uniqueCombo .setCurrentIndex ( cols .index (defaultUniqueCol ) )
269+ except :
270+ pass
271+
252272 QApplication .restoreOverrideCursor ()
253273
254274 def copySelectedResults (self ):
You can’t perform that action at this time.
0 commit comments