Commit c42c1be4 authored by Victor Yacovlev's avatar Victor Yacovlev

Fixed actor get acceptable command line parameters

parent 54ce1499
......@@ -1137,12 +1137,16 @@ class CppClassBase:
signatureBeginPos = firstLine.index(self.className + "::", rtypeEndPos) + 2 + len(self.className)
signature = firstLine[signatureBeginPos:]
assert groupName in ["public", "protected", "private", "public_slot", "protected_slot", "private_slot",
"public_virtual", "public_virtual_slot"]
group = locals()[groupName + 's']
"public_virtual", "public_virtual_slot", "public_static"]
if "virtual" in groupName:
modifier = "virtual "
group = locals()[groupName + 's']
elif "static" in groupName:
modifier = "static "
group = locals()[groupName[0:-7] + 's']
else:
modifier = ""
group = locals()[groupName + 's']
group += [_addIndent(modifier + returnType + " " + signature + ";")]
elif key == "constructorImplementation":
implMethod = value.__func__
......@@ -1907,13 +1911,9 @@ private:
return """
/* protected */ QList<ExtensionSystem::CommandLineParameter> %s::acceptableCommandLineParameters() const
{
QList<ExtensionSystem::CommandLineParameter> result;
if (module_) {
result = module_->acceptableCommandLineParameters();
}
return result;
return %s::acceptableCommandLineParameters();
}
""" % self.className
""" % (self.className, self._module.className())
class AsyncThreadCppClass(CppClassBase):
......@@ -2420,22 +2420,6 @@ class ModuleBaseCppClass(CppClassBase):
}
""" % (self.className, self._module.pluginClassName(), self._module.pluginClassName())
def acceptableCommandLineParametersCppImplementation(self):
"""
Empty implementation to get acceptable command line parameters
:rtype: str
:return: implementation of QList<ExtensionSystem::CommandLineParameter> acceptableCommandLineParameters()
"""
return """
/* public virtual */ QList<ExtensionSystem::CommandLineParameter> %s::acceptableCommandLineParameters() const
{
// See "src/shared/extensionsystem/commandlineparameter.h" for constructor details
return QList<ExtensionSystem::CommandLineParameter>();
}
""" % self.className
def initializeCppImplementation(self):
"""
Pass initialization to module itself
......@@ -2628,6 +2612,22 @@ class ModuleCppClass(CppClassBase):
}
""" % self.className
def acceptableCommandLineParametersCppImplementation(self):
"""
Empty implementation to get acceptable command line parameters
:rtype: str
:return: implementation of QList<ExtensionSystem::CommandLineParameter> acceptableCommandLineParameters()
"""
return """
/* public static */ QList<ExtensionSystem::CommandLineParameter> %s::acceptableCommandLineParameters()
{
// See "src/shared/extensionsystem/commandlineparameter.h" for constructor details
return QList<ExtensionSystem::CommandLineParameter>();
}
""" % self.className
# Script workflow functions
......
......@@ -3,104 +3,109 @@
<TS version="2.0" language="ru_RU">
<context>
<name>ActorRobot::RobotModule</name>
<message>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3447"/>
<source>Robot field file name</source>
<translation>Имя файла с обстановкой Робота</translation>
</message>
<message utf8="true">
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3441"/>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3465"/>
<source>Робот разбился: сверху стена!</source>
<translation type="unfinished"></translation>
</message>
<message utf8="true">
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3442"/>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3460"/>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3478"/>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3495"/>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3466"/>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3484"/>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3505"/>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3526"/>
<source>Отказ</source>
<translation type="unfinished"></translation>
</message>
<message utf8="true">
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3458"/>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3482"/>
<source>Робот разбился: снизу стена!</source>
<translation type="unfinished"></translation>
</message>
<message utf8="true">
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3477"/>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3504"/>
<source>Робот разбился: слева стена!</source>
<translation type="unfinished"></translation>
</message>
<message utf8="true">
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3496"/>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3527"/>
<source>Робот разбился: справа стена!</source>
<translation type="unfinished"></translation>
</message>
<message utf8="true">
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3519"/>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3530"/>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3541"/>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3552"/>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3562"/>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3573"/>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3584"/>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3595"/>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3605"/>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3615"/>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3623"/>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3631"/>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3559"/>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3570"/>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3581"/>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3592"/>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3602"/>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3613"/>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3624"/>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3635"/>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3645"/>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3655"/>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3663"/>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3671"/>
<source>да</source>
<translation type="unfinished"></translation>
</message>
<message utf8="true">
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3519"/>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3530"/>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3541"/>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3552"/>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3562"/>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3573"/>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3584"/>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3595"/>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3605"/>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3615"/>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3623"/>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3631"/>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3559"/>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3570"/>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3581"/>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3592"/>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3602"/>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3613"/>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3624"/>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3635"/>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3645"/>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3655"/>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3663"/>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3671"/>
<source>нет</source>
<translation type="unfinished"></translation>
</message>
<message utf8="true">
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3660"/>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3700"/>
<source>Нет какой клетки!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3682"/>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3879"/>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3722"/>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3920"/>
<source>Robot</source>
<translation>Робот</translation>
</message>
<message>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3816"/>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3911"/>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3857"/>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3952"/>
<source>New field</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3817"/>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3912"/>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3858"/>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3953"/>
<source>Save current field?</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3822"/>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3917"/>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3863"/>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3958"/>
<source>Save</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3824"/>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3919"/>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3865"/>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3960"/>
<source>Don&apos;t save</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3826"/>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3921"/>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3867"/>
<location filename="../../../src/actors/robot/robotmodule.cpp" line="3962"/>
<source>Cancel</source>
<translation type="unfinished"></translation>
</message>
......
......@@ -35,6 +35,10 @@ void ComplexNumbersModule::setAnimationEnabled(bool enabled)
*/
}
QList<ExtensionSystem::CommandLineParameter> ComplexNumbersModule::acceptableCommandLineParameters()
{
return QList<ExtensionSystem::CommandLineParameter>();
}
qreal ComplexNumbersModule::runRe(const Complex& x)
{
......
......@@ -22,7 +22,7 @@ class ComplexNumbersModule
Q_OBJECT
public:
// Constructor
static QList<ExtensionSystem::CommandLineParameter> acceptableCommandLineParameters();
ComplexNumbersModule(ExtensionSystem::KPlugin * parent);
inline void reloadSettings(ExtensionSystem::SettingsPtr ) {}
inline void changeGlobalState(ExtensionSystem::GlobalState, ExtensionSystem::GlobalState) {}
......
set(QT_USE_QTMAIN 1)
find_package(Qt4 4.7.0 COMPONENTS QtCore QtGui REQUIRED)
find_package(PythonInterp 2.6 REQUIRED)
include (${QT_USE_FILE})
include(../../kumir2_plugin.cmake)
......@@ -93,4 +92,3 @@ install(
TARGETS ActorDraw
DESTINATION ${PLUGINS_DIR}
)
......@@ -25,6 +25,12 @@ DrawModule::DrawModule(ExtensionSystem::KPlugin * parent)
// TODO implement me
}
/* public static */ QList<ExtensionSystem::CommandLineParameter> DrawModule::acceptableCommandLineParameters()
{
// See "src/shared/extensionsystem/commandlineparameter.h" for constructor details
return QList<ExtensionSystem::CommandLineParameter>();
}
/* public slot */ void DrawModule::changeGlobalState(ExtensionSystem::GlobalState old, ExtensionSystem::GlobalState current)
{
// Called when changed kumir state. The states are defined as enum ExtensionSystem::GlobalState:
......@@ -45,6 +51,14 @@ DrawModule::DrawModule(ExtensionSystem::KPlugin * parent)
Q_UNUSED(current); // Remove this line on implementation
}
/* public slot */ void DrawModule::loadActorData(QIODevice * source)
{
// Set actor specific data (like environment)
// The source should be ready-to-read QIODevice like QBuffer or QFile
Q_UNUSED(source); // By default do nothing
}
/* public */ QWidget* DrawModule::mainWidget() const
{
// Returns module main view widget, or nullptr if there is no any views
......
......@@ -28,10 +28,12 @@ class DrawModule
Q_OBJECT
public /* methods */:
DrawModule(ExtensionSystem::KPlugin * parent);
static QList<ExtensionSystem::CommandLineParameter> acceptableCommandLineParameters();
QWidget* mainWidget() const;
QWidget* pultWidget() const;
public slots:
void changeGlobalState(ExtensionSystem::GlobalState old, ExtensionSystem::GlobalState current);
void loadActorData(QIODevice * source);
void reloadSettings(ExtensionSystem::SettingsPtr settings);
void reset();
void setAnimationEnabled(bool enabled);
......
......@@ -28,6 +28,11 @@ PainterModule::PainterModule(ExtensionSystem::KPlugin * parent)
reset();
}
QList<ExtensionSystem::CommandLineParameter> PainterModule::acceptableCommandLineParameters()
{
return QList<ExtensionSystem::CommandLineParameter>();
}
void PainterModule::reset()
{
QImage * del = canvas;
......
......@@ -28,6 +28,7 @@ class PainterModule
public:
// Constructor
PainterModule(ExtensionSystem::KPlugin * parent);
static QList<ExtensionSystem::CommandLineParameter> acceptableCommandLineParameters();
inline void reloadSettings(ExtensionSystem::SettingsPtr) {}
inline void changeGlobalState(ExtensionSystem::GlobalState, ExtensionSystem::GlobalState) {}
public slots:
......
......@@ -3441,10 +3441,10 @@ QWidget* RobotModule::pultWidget() const
*/
return m_pultWidget;
}
QList<ExtensionSystem::CommandLineParameter> RobotModule::acceptableCommandLineParameters() const
QList<ExtensionSystem::CommandLineParameter> RobotModule::acceptableCommandLineParameters()
{
QList<ExtensionSystem::CommandLineParameter> params;
params.append(ExtensionSystem::CommandLineParameter(true,'f',"field",tr("Robot:field file name."),QVariant::String,false));
params.append(ExtensionSystem::CommandLineParameter(true,'f',"field",tr("Robot field file name"),QVariant::String,false));
return params;
}
......
......@@ -516,7 +516,7 @@ namespace ActorRobot {
// Set animation flag
void setAnimationEnabled(bool enabled);
QList<ExtensionSystem::CommandLineParameter> acceptableCommandLineParameters() const;
static QList<ExtensionSystem::CommandLineParameter> acceptableCommandLineParameters();
QString initialize(const QStringList &configurationParameters, const ExtensionSystem::CommandLine & runtimeParameters);
// Actor methods
void runGoUp();
......
......@@ -21,6 +21,11 @@ IsometricRobotModule::IsometricRobotModule(ExtensionSystem::KPlugin * parent)
{
}
QList<ExtensionSystem::CommandLineParameter> IsometricRobotModule::acceptableCommandLineParameters()
{
return QList<ExtensionSystem::CommandLineParameter>();
}
void IsometricRobotModule::reset()
{
bool wasAnimated = robotView_->isAnimated();
......
......@@ -25,7 +25,7 @@ public:
// Constructor
IsometricRobotModule(ExtensionSystem::KPlugin * parent);
static QList<ExtensionSystem::CommandLineParameter> acceptableCommandLineParameters();
public slots:
// Reset actor state before program starts
void reset();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment