Closed hanslovsky closed 5 years ago
I checked the side bar and all the preference nodes seem to be present after refactoring.
As far as I can tell, all key bindings that do not include any mouse event handling are now converted into KeyCombination
style matching and are documented in the F1
help window in the UI.
This is pretty much ready for merge but the mouse event handling needs some work, which should happen in a separate PR once this is merged.
I think I found a way to ship the readme with Paintera:
README.md
to src/main/resources/README.html
, e.g. with pandoc
ln -s $(realpath img) src/main/resources
(relative link is better but you get the idea, can even be done permanently on GH)import javafx.application.Application
import javafx.scene.Scene
import javafx.scene.web.WebView
import javafx.stage.Stage
class WebViewIssue : Application() {
override fun start(primaryStage: Stage) {
val url = javaClass.getResource("README.html")
val wv = WebView().also { it.engine.load(url.toString()) }
primaryStage.scene = Scene(wv)
primaryStage.show()
}
}
fun main() = Application.launch(WebViewIssue::class.java)
Relevant for the rendering of resources: https://community.oracle.com/thread/2332194
README Rendering works now if classes are loaded from .class
files, i.e. when run from Intellij IDE but images are not rendered when run from .jar
file. This might be good enough for now but should be investigated further. I will test on my other machine and then probably merge soon.
FWIW, this is how I render the README.md
from md into html at runtime:
val vs = Version.VERSION_STRING
val tag = if (vs.endsWith("SNAPSHOT"))
"master"
else
"^.*-SNAPSHOT-([A-Za-z0-9]+)$"
.toRegex()
.find(vs)
?.let { it.groupValues[1] }
?: "paintera-$vs"
val ghurl = "https://github.com/saalfeldlab/paintera/blob/$tag/README.md"
val jarPath = javaClass.protectionDomain.codeSource.location.let { URLDecoder.decode(it.file, "UTF-8") }
// TODO what is the correct prefix when loading from jar?
val prefix = if (jarPath.endsWith(".jar")) "jar:file:$jarPath!" else "file://$jarPath"
val extensions = listOf(TablesExtension.create())
val parser = Parser.builder().extensions(extensions).build()
val renderer = HtmlRenderer.builder().extensions(extensions).build()
val document = javaClass.getResource("/README.md").openStream().use { parser.parseReader(it.reader()) }
val readmeHtml = renderer.render(document).replace("img src=\"img", "img src=\"${prefix}/img")
val dialog = PainteraAlerts.information("_Close", true).also { it.initModality(Modality.NONE) }
val wv = WebView()
.also { it.engine.loadContent(readmeHtml) }
.also { it.maxHeight = Double.POSITIVE_INFINITY }
I will go ahead and merge. I will work with @igorpisarev to fix any merge issues with #267 once that PR is ready to merge.
I will add a new paintera-experimental
command to saalfeldlab/paintera-cmd
This is WIP with multiple targets:
BorderPane
BorderPane
KeyCombination.match
instead ofKeyTracker
for all key event handling. For mouse based events with keys, we probably still need the key tracker, unfortunately.Properties2
class.This will most likely be merged only after #267
Fixes #190 Fixes #245 Fixes #256