Application plugin in demo

This commit is contained in:
Alexander Nozik 2020-06-09 17:36:34 +03:00
parent 8e261a5ff5
commit 1ae8679a8c
3 changed files with 13 additions and 5 deletions

View File

@ -21,7 +21,7 @@ suspend fun Device.flowValues(): Flow<Pair<String, MetaItem<*>>> = callbackFlow
} }
} }
} }
registerListener(listener, listener) registerListener(listener)
awaitClose { awaitClose {
removeListener(listener) removeListener(listener)
} }

View File

@ -1,6 +1,7 @@
plugins { plugins {
kotlin("jvm") version "1.3.72" kotlin("jvm") version "1.3.72"
id("org.openjfx.javafxplugin") version "0.0.8" id("org.openjfx.javafxplugin") version "0.0.8"
`application`
} }
val plotlyVersion: String by rootProject.extra val plotlyVersion: String by rootProject.extra
@ -30,4 +31,8 @@ tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach
javafx{ javafx{
version = "14" version = "14"
modules("javafx.controls") modules("javafx.controls")
}
application{
mainClassName = "hep.dataforge.control.demo.DemoControllerViewKt"
} }

View File

@ -25,10 +25,6 @@ class DemoDevice(parentScope: CoroutineScope = GlobalScope) : DeviceBase() {
val timeScale: IsolatedDeviceProperty by writingVirtual(5000.0.asValue()) val timeScale: IsolatedDeviceProperty by writingVirtual(5000.0.asValue())
var timeScaleValue by timeScale.double() var timeScaleValue by timeScale.double()
val resetScale: Action by action {
timeScaleValue = 5000.0
}
val sinScale by writingVirtual(1.0.asValue()) val sinScale by writingVirtual(1.0.asValue())
var sinScaleValue by sinScale.double() var sinScaleValue by sinScale.double()
val sin by readingNumber { val sin by readingNumber {
@ -50,6 +46,13 @@ class DemoDevice(parentScope: CoroutineScope = GlobalScope) : DeviceBase() {
"y" put cos(time.toEpochMilli().toDouble() / timeScaleValue)*cosScaleValue "y" put cos(time.toEpochMilli().toDouble() / timeScaleValue)*cosScaleValue
} }
val resetScale: Action by action {
timeScaleValue = 5000.0
sinScaleValue = 1.0
cosScaleValue = 1.0
}
init { init {
sin.readEvery(0.2.seconds) sin.readEvery(0.2.seconds)
cos.readEvery(0.2.seconds) cos.readEvery(0.2.seconds)