mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-03 04:00:57 -06:00
#649 Added 'Refresh' to script collections
This commit is contained in:
parent
0aababbb12
commit
5ec9b9c568
@ -12,6 +12,7 @@ ${CEE_CURRENT_LIST_DIR}RicExecuteScriptFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicExecuteScriptForCasesFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicNewScriptFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicScriptFeatureImpl.h
|
||||
${CEE_CURRENT_LIST_DIR}RicRefreshScriptsFeature.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
@ -22,6 +23,7 @@ ${CEE_CURRENT_LIST_DIR}RicExecuteScriptFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicExecuteScriptForCasesFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicNewScriptFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicScriptFeatureImpl.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicRefreshScriptsFeature.cpp
|
||||
)
|
||||
|
||||
set (QT_MOC_HEADERS
|
||||
|
@ -19,11 +19,13 @@
|
||||
|
||||
#include "RicAddScriptPathFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaPreferences.h"
|
||||
|
||||
#include "RicRefreshScriptsFeature.h"
|
||||
#include "RicScriptFeatureImpl.h"
|
||||
|
||||
#include "RimScriptCollection.h"
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaPreferences.h"
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
#include "cvfAssert.h"
|
||||
@ -62,6 +64,8 @@ void RicAddScriptPathFeature::onActionTriggered(bool isChecked)
|
||||
|
||||
RiaApplication::instance()->preferences()->scriptDirectories = filePathString;
|
||||
RiaApplication::instance()->applyPreferences();
|
||||
|
||||
RicRefreshScriptsFeature::refreshScriptFolders();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,11 +19,13 @@
|
||||
|
||||
#include "RicDeleteScriptPathFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaPreferences.h"
|
||||
|
||||
#include "RicRefreshScriptsFeature.h"
|
||||
#include "RicScriptFeatureImpl.h"
|
||||
|
||||
#include "RimScriptCollection.h"
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaPreferences.h"
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
#include "cvfAssert.h"
|
||||
@ -69,6 +71,8 @@ void RicDeleteScriptPathFeature::onActionTriggered(bool isChecked)
|
||||
|
||||
RiaApplication::instance()->preferences()->scriptDirectories = filePathString;
|
||||
RiaApplication::instance()->applyPreferences();
|
||||
|
||||
RicRefreshScriptsFeature::refreshScriptFolders();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,65 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2016 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicRefreshScriptsFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaPreferences.h"
|
||||
|
||||
#include "RimProject.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicRefreshScriptsFeature, "RicRefreshScriptsFeature");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicRefreshScriptsFeature::isCommandEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicRefreshScriptsFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
refreshScriptFolders();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicRefreshScriptsFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setText("Refresh");
|
||||
actionToSetup->setIcon(QIcon(":/Refresh-32.png"));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicRefreshScriptsFeature::refreshScriptFolders()
|
||||
{
|
||||
RimProject* proj = RiaApplication::instance()->project();
|
||||
RiaPreferences* prefs = RiaApplication::instance()->preferences();
|
||||
|
||||
proj->setScriptDirectories(prefs->scriptDirectories());
|
||||
proj->updateConnectedEditors();
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2016 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafCmdFeature.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicRefreshScriptsFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
public:
|
||||
static void refreshScriptFolders();
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
virtual bool isCommandEnabled();
|
||||
virtual void onActionTriggered( bool isChecked );
|
||||
virtual void setupActionLook( QAction* actionToSetup );
|
||||
};
|
||||
|
||||
|
@ -216,6 +216,8 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
|
||||
{
|
||||
commandIds << "RicAddScriptPathFeature";
|
||||
commandIds << "RicDeleteScriptPathFeature";
|
||||
commandIds << "Separator";
|
||||
commandIds << "RicRefreshScriptsFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimViewController*>(uiItem))
|
||||
{
|
||||
|
BIN
ApplicationCode/Resources/Refresh-32.png
Normal file
BIN
ApplicationCode/Resources/Refresh-32.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 466 B |
@ -56,6 +56,7 @@
|
||||
<file>WellLogCurve16x16.png</file>
|
||||
<file>CrossSection16x16.png</file>
|
||||
<file>CrossSections16x16.png</file>
|
||||
<file>Refresh-32.png</file>
|
||||
</qresource>
|
||||
<qresource prefix="/Shader/">
|
||||
<file>fs_CellFace.glsl</file>
|
||||
|
Loading…
Reference in New Issue
Block a user