From 1ae8679a8ced12491f537277ee7906f087a77dcd Mon Sep 17 00:00:00 2001 From: darksnake Date: Tue, 9 Jun 2020 17:36:34 +0300 Subject: [PATCH] Application plugin in demo --- .../hep/dataforge/control/controlers/PropertyFlow.kt | 2 +- demo/build.gradle.kts | 5 +++++ .../kotlin/hep/dataforge/control/demo/DemoDevice.kt | 11 +++++++---- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/dataforge-control-core/src/commonMain/kotlin/hep/dataforge/control/controlers/PropertyFlow.kt b/dataforge-control-core/src/commonMain/kotlin/hep/dataforge/control/controlers/PropertyFlow.kt index 2861a06..dbfa448 100644 --- a/dataforge-control-core/src/commonMain/kotlin/hep/dataforge/control/controlers/PropertyFlow.kt +++ b/dataforge-control-core/src/commonMain/kotlin/hep/dataforge/control/controlers/PropertyFlow.kt @@ -21,7 +21,7 @@ suspend fun Device.flowValues(): Flow>> = callbackFlow } } } - registerListener(listener, listener) + registerListener(listener) awaitClose { removeListener(listener) } diff --git a/demo/build.gradle.kts b/demo/build.gradle.kts index ae448df..be79379 100644 --- a/demo/build.gradle.kts +++ b/demo/build.gradle.kts @@ -1,6 +1,7 @@ plugins { kotlin("jvm") version "1.3.72" id("org.openjfx.javafxplugin") version "0.0.8" + `application` } val plotlyVersion: String by rootProject.extra @@ -30,4 +31,8 @@ tasks.withType().configureEach javafx{ version = "14" modules("javafx.controls") +} + +application{ + mainClassName = "hep.dataforge.control.demo.DemoControllerViewKt" } \ No newline at end of file diff --git a/demo/src/main/kotlin/hep/dataforge/control/demo/DemoDevice.kt b/demo/src/main/kotlin/hep/dataforge/control/demo/DemoDevice.kt index ca2e300..e7b3c7e 100644 --- a/demo/src/main/kotlin/hep/dataforge/control/demo/DemoDevice.kt +++ b/demo/src/main/kotlin/hep/dataforge/control/demo/DemoDevice.kt @@ -25,10 +25,6 @@ class DemoDevice(parentScope: CoroutineScope = GlobalScope) : DeviceBase() { val timeScale: IsolatedDeviceProperty by writingVirtual(5000.0.asValue()) var timeScaleValue by timeScale.double() - val resetScale: Action by action { - timeScaleValue = 5000.0 - } - val sinScale by writingVirtual(1.0.asValue()) var sinScaleValue by sinScale.double() val sin by readingNumber { @@ -50,6 +46,13 @@ class DemoDevice(parentScope: CoroutineScope = GlobalScope) : DeviceBase() { "y" put cos(time.toEpochMilli().toDouble() / timeScaleValue)*cosScaleValue } + + val resetScale: Action by action { + timeScaleValue = 5000.0 + sinScaleValue = 1.0 + cosScaleValue = 1.0 + } + init { sin.readEvery(0.2.seconds) cos.readEvery(0.2.seconds)