Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 85f88305 authored by Nikita Sirgienko's avatar Nikita Sirgienko

[Julia] Migrate to Session::finishFirstExpression and Session::setVariableModel

parent 99e827e2
......@@ -43,9 +43,8 @@ JuliaSession::JuliaSession(Cantor::Backend *backend)
: Session(backend)
, m_process(nullptr)
, m_interface(nullptr)
, m_variableModel(new JuliaVariableModel(this))
, m_needUpdate(false)
{
setVariableModel(new JuliaVariableModel(this));
}
void JuliaSession::login()
......@@ -102,14 +101,14 @@ void JuliaSession::login()
JuliaSettings::self()->replPath().path()
);
m_variableModel->setJuliaServer(m_interface);
m_variableModel->update();
static_cast<JuliaVariableModel*>(variableModel())->setJuliaServer(m_interface);
// Plots integration
if (integratePlots()) {
runJuliaCommand(
QLatin1String("import GR; ENV[\"GKS_WSTYPE\"] = \"nul\"")
);
updateVariables();
}
changeStatus(Session::Done);
......@@ -121,7 +120,7 @@ void JuliaSession::logout()
{
m_process->terminate();
m_variableModel->clearVariables();
variableModel()->clearVariables();
changeStatus(Status::Disable);
}
......@@ -186,21 +185,8 @@ void JuliaSession::runJuliaCommandAsync(const QString &command)
void JuliaSession::onResultReady()
{
JuliaExpression* expr = static_cast<JuliaExpression*>(expressionQueue().takeFirst());
expr->finalize();
m_needUpdate |= !expr->isInternal();
if (expressionQueue().isEmpty())
{
if(m_needUpdate)
{
m_variableModel->update();
m_needUpdate = false;
}
changeStatus(Cantor::Session::Done);
}
else
runFirstExpression();
static_cast<JuliaExpression*>(expressionQueue().first())->finalize();
finishFirstExpression(true);
}
void JuliaSession::runFirstExpression()
......@@ -234,11 +220,6 @@ bool JuliaSession::getWasException()
return reply.isValid() && reply.value();
}
Cantor::DefaultVariableModel* JuliaSession::variableModel() const
{
return m_variableModel;
}
bool JuliaSession::integratePlots()
{
......
......@@ -84,11 +84,6 @@ public:
*/
QSyntaxHighlighter *syntaxHighlighter(QObject *parent) override;
/**
* @see Cantor::Session::variableModel
*/
Cantor::DefaultVariableModel *variableModel() const override;
/**
* @return indicator if config says to integrate plots into worksheet
*/
......@@ -104,10 +99,6 @@ private:
KProcess *m_process; //< process to run JuliaServer inside
QDBusInterface *m_interface; //< interface to JuliaServer
/// Variable management model
JuliaVariableModel *m_variableModel;
bool m_needUpdate;
/// Cache to speedup modules whos calls
QMap<QString, QString> m_whos_cache;
......
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