Skip to content
Permalink
Browse files

more precise fixes (followup be81716)

  • Loading branch information
jef-n committed Dec 6, 2015
1 parent 91f7918 commit a2a10e97135f60609be32066a00c62dece3b7b17
@@ -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()
@@ -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 )
{
@@ -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() )
{
@@ -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 ) ) );
}
@@ -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();
@@ -589,7 +589,7 @@ void QgsAttributeForm::initPython()

switch ( mLayer->editFormConfig()->initCodeSource() )
{
case QgsEditFormConfig::PythonInitCodeSource::CodeSourceFile:
case QgsEditFormConfig::CodeSourceFile:
if ( ! initFilePath.isEmpty() )
{
QFile inputFile( initFilePath );
@@ -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;

0 comments on commit a2a10e9

Please sign in to comment.
You can’t perform that action at this time.