Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
more precise fixes (followup be81716)
  • Loading branch information
jef-n committed Dec 6, 2015
1 parent 91f7918 commit a2a10e9
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
10 changes: 5 additions & 5 deletions src/app/qgsfieldsproperties.cpp
Expand Up @@ -465,11 +465,11 @@ void QgsFieldsProperties::on_mMoveUpItem_clicked()
void QgsFieldsProperties::on_mInitCodeSourceComboBox_currentIndexChanged( int codeSource )
{
// Show or hide ui elements as needed
mInitFunctionContainer->setVisible( codeSource != QgsEditFormConfig::PythonInitCodeSource::CodeSourceNone );
mPythonInitCodeGroupBox->setVisible( codeSource == QgsEditFormConfig::PythonInitCodeSource::CodeSourceDialog );
mInitFilePathLineEdit->setVisible( codeSource == QgsEditFormConfig::PythonInitCodeSource::CodeSourceFile );
mInitFilePathLabel->setVisible( codeSource == QgsEditFormConfig::PythonInitCodeSource::CodeSourceFile );
pbtnSelectInitFilePath->setVisible( codeSource == QgsEditFormConfig::PythonInitCodeSource::CodeSourceFile );
mInitFunctionContainer->setVisible( codeSource != QgsEditFormConfig::CodeSourceNone );
mPythonInitCodeGroupBox->setVisible( codeSource == QgsEditFormConfig::CodeSourceDialog );
mInitFilePathLineEdit->setVisible( codeSource == QgsEditFormConfig::CodeSourceFile );
mInitFilePathLabel->setVisible( codeSource == QgsEditFormConfig::CodeSourceFile );
pbtnSelectInitFilePath->setVisible( codeSource == QgsEditFormConfig::CodeSourceFile );
}

void QgsFieldsProperties::attributeTypeDialog()
Expand Down
8 changes: 4 additions & 4 deletions src/app/qgsvectorlayerproperties.cpp
Expand Up @@ -730,10 +730,10 @@ void QgsVectorLayerProperties::loadDefaultStyle_clicked()

switch ( askToUser.exec() )
{
case( 0 ):
case 0:
return;
break;
case( 2 ):
case 2:
msg = layer->loadNamedStyle( layer->styleURI(), defaultLoadedFlag );
if ( !defaultLoadedFlag )
{
Expand Down Expand Up @@ -787,10 +787,10 @@ void QgsVectorLayerProperties::saveDefaultStyle_clicked()

switch ( askToUser.exec() )
{
case( 0 ):
case 0:
return;
break;
case( 2 ):
case 2:
layer->saveStyleToDatabase( "", "", true, "", errorMsg );
if ( errorMsg.isNull() )
{
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsvectorlayer.cpp
Expand Up @@ -1801,7 +1801,7 @@ bool QgsVectorLayer::readSymbology( const QDomNode& node, QString& errorMessage
int dotPos = initFunction.lastIndexOf( '.' );
if ( dotPos >= 0 ) // It's a module
{
mEditFormConfig->setInitCodeSource( QgsEditFormConfig::PythonInitCodeSource::CodeSourceDialog );
mEditFormConfig->setInitCodeSource( QgsEditFormConfig::CodeSourceDialog );
mEditFormConfig->setInitFunction( initFunction.mid( dotPos + 1 ) );
mEditFormConfig->setInitCode( QString( "from %1 import %2\n" ).arg( initFunction.left( dotPos ), initFunction.mid( dotPos + 1 ) ) );
}
Expand Down
10 changes: 5 additions & 5 deletions src/gui/qgsattributeform.cpp
Expand Up @@ -580,7 +580,7 @@ void QgsAttributeForm::initPython()
// Init Python, if init function is not empty and the combo indicates
// the source for the function code
if ( !mLayer->editFormConfig()->initFunction().isEmpty()
&& mLayer->editFormConfig()->initCodeSource() != QgsEditFormConfig::PythonInitCodeSource::CodeSourceNone )
&& mLayer->editFormConfig()->initCodeSource() != QgsEditFormConfig::CodeSourceNone )
{

QString initFunction = mLayer->editFormConfig()->initFunction();
Expand All @@ -589,7 +589,7 @@ void QgsAttributeForm::initPython()

switch ( mLayer->editFormConfig()->initCodeSource() )
{
case QgsEditFormConfig::PythonInitCodeSource::CodeSourceFile:
case QgsEditFormConfig::CodeSourceFile:
if ( ! initFilePath.isEmpty() )
{
QFile inputFile( initFilePath );
Expand All @@ -612,16 +612,16 @@ void QgsAttributeForm::initPython()
}
break;

case( QgsEditFormConfig::PythonInitCodeSource::CodeSourceDialog ):
case QgsEditFormConfig::CodeSourceDialog:
initCode = mLayer->editFormConfig()->initCode();
if ( initCode.isEmpty() )
{
QgsLogger::warning( QString( "The python code provided in the dialog is empty!" ) );
}
break;

case( QgsEditFormConfig::PythonInitCodeSource::CodeSourceEnvironment ):
case( QgsEditFormConfig::PythonInitCodeSource::CodeSourceNone ):
case QgsEditFormConfig::CodeSourceEnvironment:
case QgsEditFormConfig::CodeSourceNone:
default:
// Nothing to do: the function code should be already in the environment
break;
Expand Down

0 comments on commit a2a10e9

Please sign in to comment.