Skip to content

Commit ccf3195

Browse files
committed
Merge branch 'master' of github.com:qgis/Quantum-GIS
2 parents f7af2de + 58ba3f0 commit ccf3195

File tree

5 files changed

+32
-88
lines changed

5 files changed

+32
-88
lines changed

python/plugins/sextante/grass/GrassAlgorithm.py

Lines changed: 0 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -103,67 +103,9 @@ def defineCharacteristicsFromFile(self):
103103
raise e
104104
lines.close()
105105

106-
#=======================================================================
107-
# self.xmin = SextanteConfig.getSetting(GrassUtils.GRASS_REGION_XMIN)
108-
# self.xmax = SextanteConfig.getSetting(GrassUtils.GRASS_REGION_XMAX)
109-
# self.ymin = SextanteConfig.getSetting(GrassUtils.GRASS_REGION_YMIN)
110-
# self.ymax = SextanteConfig.getSetting(GrassUtils.GRASS_REGION_YMAX)
111-
# extentString = str(self.xmin) + "," + str(self.xmax) + str(self.xmin) + "," + str(self.xmax)
112-
# self.cellsize = SextanteConfig.getSetting(GrassUtils.GRASS_REGION_CELLSIZE)
113-
#=======================================================================
114106
self.addParameter(ParameterExtent(self.GRASS_REGION_EXTENT_PARAMETER, "GRASS region extent"))
115107
self.addParameter(ParameterNumber(self.GRASS_REGION_CELLSIZE_PARAMETER, "GRASS region cellsize", 0, None, 1))
116108

117-
#===============================================================================
118-
# def calculateRegion(self):
119-
# auto = SextanteConfig.getSetting(GrassUtils.GRASS_AUTO_REGION)
120-
# if auto:
121-
# try:
122-
# self.cellsize = SextanteConfig.getSetting(GrassUtils.GRASS_REGION_CELLSIZE)
123-
# except Exception:
124-
# self.cellsize = 0;
125-
# first = True;
126-
# for param in self.parameters:
127-
# if param.value:
128-
# if isinstance(param, (ParameterRaster, ParameterVector)):
129-
# if isinstance(param.value, (QgsRasterLayer, QgsVectorLayer)):
130-
# layer = param.value
131-
# else:
132-
# layer = QGisLayers.getObjectFromUri(param.value)
133-
# self.addToRegion(layer, first)
134-
# first = False
135-
# elif isinstance(param, ParameterMultipleInput):
136-
# layers = param.value.split(";")
137-
# for layername in layers:
138-
# layer = QGisLayers.getObjectFromUri(layername, first)
139-
# self.addToRegion(layer, first)
140-
# first = False
141-
# if self.cellsize == 0:
142-
# self.cellsize = 1
143-
# else:
144-
# self.xmin = SextanteConfig.getSetting(GrassUtils.GRASS_REGION_XMIN)
145-
# self.xmax = SextanteConfig.getSetting(GrassUtils.GRASS_REGION_XMAX)
146-
# self.ymin = SextanteConfig.getSetting(GrassUtils.GRASS_REGION_YMIN)
147-
# self.ymax = SextanteConfig.getSetting(GrassUtils.GRASS_REGION_YMAX)
148-
# self.cellsize = SextanteConfig.getSetting(GrassUtils.GRASS_REGION_CELLSIZE)
149-
#
150-
#
151-
# def addToRegion(self, layer, first):
152-
# if first:
153-
# self.xmin = layer.extent().xMinimum()
154-
# self.xmax = layer.extent().xMaximum()
155-
# self.ymin = layer.extent().yMinimum()
156-
# self.ymax = layer.extent().yMaximum()
157-
# if isinstance(layer, QgsRasterLayer):
158-
# self.cellsize = (layer.extent().xMaximum() - layer.extent().xMinimum())/layer.width()
159-
# else:
160-
# self.xmin = min(self.xmin, layer.extent().xMinimum())
161-
# self.xmax = max(self.xmax, layer.extent().xMaximum())
162-
# self.ymin = min(self.ymin, layer.extent().yMinimum())
163-
# self.ymax = max(self.ymax, layer.extent().yMaximum())
164-
# if isinstance(layer, QgsRasterLayer):
165-
# self.cellsize = max(self.cellsize, (layer.extent().xMaximum() - layer.extent().xMinimum())/layer.width())
166-
#===============================================================================
167109

168110
def processAlgorithm(self, progress):
169111
if SextanteUtils.isWindows():
@@ -327,18 +269,3 @@ def getTempFilename(self):
327269

328270
def commandLineName(self):
329271
return "grass:" + self.name[:self.name.find(" ")]
330-
331-
#===============================================================================
332-
# def checkBeforeOpeningParametersDialog(self):
333-
# for param in self.parameters:
334-
# if isinstance(param, (ParameterRaster, ParameterVector)):
335-
# return None
336-
# if isinstance(param, ParameterMultipleInput):
337-
# if not param.optional:
338-
# return None
339-
#
340-
# if SextanteConfig.getSetting(GrassUtils.GRASS_AUTO_REGION):
341-
# return "This algorithm cannot be run with the 'auto-region' setting\nPlease set a GRASS region before running it"
342-
# else:
343-
# return None
344-
#===============================================================================

python/plugins/sextante/r/RAlgorithm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ def getImportCommands(self):
230230
# if rgdal is not available, try to install it
231231
# just use US mirror
232232
commands.append('options("repos"="http://cran.us.r-project.org")')
233-
rLibDir = "%s/rlibs" % SextanteUtils.userFolder()
233+
rLibDir = "%s/rlibs" % SextanteUtils.userFolder().replace("\\","/")
234234
if not os.path.isdir(rLibDir): os.mkdir(rLibDir)
235235
commands.append(
236236
'tryCatch(find.package("rgdal"), error=function(e) install.packages("rgdal", lib="%s"))' % rLibDir)

src/app/qgslabelinggui.cpp

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -268,15 +268,12 @@ QgsLabelingGui::QgsLabelingGui( QgsPalLabeling* lbl, QgsVectorLayer* layer, QgsM
268268
connect( quadrantRadios[i], SIGNAL( toggled( bool ) ), this, SLOT( updateQuadrant() ) );
269269
}
270270

271-
// Label tab collapsed groupboxes
272-
chkBuffer->setCollapsed( true );
273-
mFontMultiLineGroupBox->setCollapsed( true );
274-
chkFormattedNumbers->setCollapsed( true );
275-
chkScaleBasedVisibility->setCollapsed( true );
276-
277-
// Data defined tab collapsed groupboxes
278-
mBufferAttributesPropertiesGroupBox->setCollapsed( true );
279-
mFontAttributePropertiesGroupBox->setCollapsed( true );
271+
// Global settings group for groupboxes' saved/retored collapsed state
272+
// maintains state across different dialogs
273+
foreach ( QgsCollapsibleGroupBox *grpbox, findChildren<QgsCollapsibleGroupBox*>() )
274+
{
275+
grpbox->setSettingGroup( QString( "mAdvLabelingDlg" ) );
276+
}
280277

281278
connect( groupBox_mPreview,
282279
SIGNAL( collapsedStateChanged( QgsCollapsibleGroupBox* ) ),

src/gui/qgscollapsiblegroupbox.cpp

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ void QgsCollapsibleGroupBox::init()
5252
// variables
5353
mCollapsed = false;
5454
mSaveState = true;
55+
// NOTE: only turn on mSaveCheckedState for groupboxes NOT used
56+
// in multiple places or used as options for different parent objects
57+
mSaveCheckedState = false;
58+
mSettingGroup = ""; // if not set, use window object name
5559
mInitFlat = false;
5660
mScrollOnExpand = true;
5761
mShown = false;
@@ -167,7 +171,8 @@ QString QgsCollapsibleGroupBox::saveKey() const
167171
// }
168172
// if ( parent() != NULL )
169173
// saveKey = "/" + parent()->objectName() + saveKey;
170-
saveKey = "/" + window()->objectName() + saveKey;
174+
QString setgrp = mSettingGroup.isEmpty() ? window()->objectName() : mSettingGroup;
175+
saveKey = "/" + setgrp + saveKey;
171176
saveKey = "QgsCollapsibleGroupBox" + saveKey;
172177
return saveKey;
173178
}
@@ -181,9 +186,13 @@ void QgsCollapsibleGroupBox::loadState()
181186

182187
QSettings settings;
183188
QString key = saveKey();
184-
QVariant val = settings.value( key + "/checked" );
185-
if ( ! val.isNull() )
186-
setChecked( val.toBool() );
189+
QVariant val;
190+
if ( mSaveCheckedState )
191+
{
192+
val = settings.value( key + "/checked" );
193+
if ( ! val.isNull() )
194+
setChecked( val.toBool() );
195+
}
187196
val = settings.value( key + "/collapsed" );
188197
if ( ! val.isNull() )
189198
setCollapsed( val.toBool() );
@@ -197,7 +206,8 @@ void QgsCollapsibleGroupBox::saveState()
197206
return;
198207
QSettings settings;
199208
QString key = saveKey();
200-
settings.setValue( key + "/checked", isChecked() );
209+
if ( mSaveCheckedState )
210+
settings.setValue( key + "/checked", isChecked() );
201211
settings.setValue( key + "/collapsed", isCollapsed() );
202212
}
203213

src/gui/qgscollapsiblegroupbox.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,14 @@ class GUI_EXPORT QgsCollapsibleGroupBox : public QGroupBox
4444

4545
//! set this to false to not save/restore check and collapse state
4646
void setSaveState( bool save ) { mSaveState = save; }
47+
//! set this to true to save/restore checked state
48+
/** @note only turn on mSaveCheckedState for groupboxes NOT used
49+
* in multiple places or used as options for different parent objects */
50+
void setSaveCheckedState( bool save ) { mSaveCheckedState = save; }
51+
bool saveCheckedState() { return mSaveCheckedState; }
52+
//! set this to a defined string to share save/restore collapsed state across dialogs
53+
void setSettingGroup( const QString &group ) { mSettingGroup = group; }
54+
QString settingGroup() const { return mSettingGroup; }
4755
//! set this to false to not automatically scroll parent QScrollArea to this widget's contents when expanded
4856
void setScrollOnExpand( bool scroll ) { mScrollOnExpand = scroll; }
4957

@@ -71,6 +79,8 @@ class GUI_EXPORT QgsCollapsibleGroupBox : public QGroupBox
7179

7280
bool mCollapsed;
7381
bool mSaveState;
82+
bool mSaveCheckedState;
83+
QString mSettingGroup;
7484
bool mInitFlat;
7585
bool mScrollOnExpand;
7686
bool mShown;

0 commit comments

Comments
 (0)