diff --git a/app/bundle/src/main/scala/org/bitcoins/bundle/gui/BundleGUI.scala b/app/bundle/src/main/scala/org/bitcoins/bundle/gui/BundleGUI.scala index 62354dfa07..0fc532a07d 100644 --- a/app/bundle/src/main/scala/org/bitcoins/bundle/gui/BundleGUI.scala +++ b/app/bundle/src/main/scala/org/bitcoins/bundle/gui/BundleGUI.scala @@ -7,7 +7,7 @@ import org.bitcoins.db.AppConfig.DEFAULT_BITCOIN_S_DATADIR import org.bitcoins.gui._ import org.bitcoins.gui.util.GUIUtil import org.bitcoins.server.util.DatadirUtil -import scalafx.application.{JFXApp, Platform} +import scalafx.application.{JFXApp3, Platform} import scalafx.geometry.Pos import scalafx.scene.Scene import scalafx.scene.control.Alert.AlertType @@ -16,7 +16,7 @@ import scalafx.scene.layout.VBox import java.nio.file.{Path, Paths} -object BundleGUI extends WalletGUI with JFXApp { +object BundleGUI extends WalletGUI with JFXApp3 { // Catch unhandled exceptions on FX Application thread Thread @@ -31,8 +31,13 @@ object BundleGUI extends WalletGUI with JFXApp { }.showAndWait() }) - // Set log location - { + implicit override lazy val system: ActorSystem = ActorSystem( + s"bitcoin-s-gui-${System.currentTimeMillis()}") + + lazy val args = parameters.raw + + override def start(): Unit = { + // Set log location val baseConfig: Config = AppConfig .getBaseConfig(DEFAULT_BITCOIN_S_DATADIR) .resolve() @@ -43,22 +48,26 @@ object BundleGUI extends WalletGUI with JFXApp { val usedDir = DatadirUtil.getFinalDatadir(datadir, baseConfig, None) System.setProperty("bitcoins.log.location", usedDir.toAbsolutePath.toString) + + val landingPane = new LandingPane(glassPane) + rootView.children = Vector(landingPane.view, glassPane) + + lazy val guiScene: Scene = new Scene(1400, 600) { + root = rootView + stylesheets = GlobalData.currentStyleSheets + } + + stage = new JFXApp3.PrimaryStage { + title = "Bitcoin-S Wallet" + scene = guiScene + icons.add(GUIUtil.logo) + } + taskRunner + + () } - implicit lazy val system: ActorSystem = ActorSystem( - s"bitcoin-s-gui-${System.currentTimeMillis()}") - - lazy val args = parameters.raw - - val landingPane = new LandingPane(glassPane) - rootView.children = Vector(landingPane.view, glassPane) - - lazy val guiScene: Scene = new Scene(1400, 600) { - root = rootView - stylesheets = GlobalData.currentStyleSheets - } - - lazy val glassPane: VBox = new VBox { + override lazy val glassPane: VBox = new VBox { children = new ProgressIndicator { progress = ProgressIndicator.IndeterminateProgress visible = true @@ -67,13 +76,6 @@ object BundleGUI extends WalletGUI with JFXApp { visible = false } - stage = new JFXApp.PrimaryStage { - title = "Bitcoin-S Wallet" - scene = guiScene - icons.add(GUIUtil.logo) - } - taskRunner - def changeToWalletGUIScene(): Unit = { Platform.runLater( rootView.children = Vector( diff --git a/app/gui/src/main/scala/org/bitcoins/gui/GUI.scala b/app/gui/src/main/scala/org/bitcoins/gui/GUI.scala index 9a4c0a83f0..11a1b322d3 100644 --- a/app/gui/src/main/scala/org/bitcoins/gui/GUI.scala +++ b/app/gui/src/main/scala/org/bitcoins/gui/GUI.scala @@ -6,7 +6,7 @@ import org.bitcoins.cli.ConsoleCli import org.bitcoins.commons.jsonmodels.BitcoinSServerInfo import org.bitcoins.core.config._ import org.bitcoins.gui.util.GUIUtil._ -import scalafx.application.JFXApp +import scalafx.application.JFXApp3 import scalafx.geometry.Pos import scalafx.scene.Scene import scalafx.scene.control.Alert.AlertType @@ -16,9 +16,9 @@ import scalafx.scene.layout.VBox import scala.util._ -object GUI extends WalletGUI with JFXApp { +object GUI extends WalletGUI with JFXApp3 { - implicit lazy val system: ActorSystem = ActorSystem( + implicit override lazy val system: ActorSystem = ActorSystem( s"bitcoin-s-gui-${System.currentTimeMillis()}") // Catch unhandled exceptions on FX Application thread @@ -34,30 +34,7 @@ object GUI extends WalletGUI with JFXApp { }.showAndWait() }) - lazy val argsWithIndex: Vector[(String, Int)] = - parameters.raw.zipWithIndex.toVector - - lazy val rpcPortOpt: Option[Int] = { - lazy val portOpt = argsWithIndex.find(_._1.toLowerCase == "--rpcport") - portOpt.map { case (_, idx) => - parameters.raw(idx + 1).toInt - } - } - - GlobalData.rpcPortOpt = rpcPortOpt - - lazy val debug: Boolean = { - parameters.raw.exists(_.toLowerCase == "--debug") - } - - GlobalData.debug = debug - - lazy val walletScene: Scene = new Scene(1400, 800) { - root = rootView - stylesheets = GlobalData.currentStyleSheets - } - - lazy val glassPane: VBox = new VBox { + override lazy val glassPane: VBox = new VBox { children = new ProgressIndicator { progress = ProgressIndicator.IndeterminateProgress visible = true @@ -66,34 +43,60 @@ object GUI extends WalletGUI with JFXApp { visible = false } - lazy val info: BitcoinSServerInfo = - ConsoleCli.exec(GetInfo, GlobalData.consoleCliConfig) match { - case Failure(exception) => - throw exception - case Success(str) => - val json = ujson.read(str) - BitcoinSServerInfo.fromJson(json) + override def start(): Unit = { + lazy val argsWithIndex: Vector[(String, Int)] = + parameters.raw.zipWithIndex.toVector + + lazy val rpcPortOpt: Option[Int] = { + lazy val portOpt = argsWithIndex.find(_._1.toLowerCase == "--rpcport") + portOpt.map { case (_, idx) => + parameters.raw(idx + 1).toInt + } } - GlobalData.network = info.network + GlobalData.rpcPortOpt = rpcPortOpt - lazy val (img, titleStr): (Image, String) = info.network match { - case MainNet => - (logo, "Bitcoin-S Wallet") - case TestNet3 => - (logoTestnet, "Bitcoin-S Wallet - [testnet]") - case RegTest => - (logoRegtest, "Bitcoin-S Wallet - [regtest]") - case SigNet => - (logoSignet, "Bitcoin-S Wallet - [signet]") + lazy val debug: Boolean = { + parameters.raw.exists(_.toLowerCase == "--debug") + } + + GlobalData.debug = debug + + lazy val walletScene: Scene = new Scene(1400, 800) { + root = rootView + stylesheets = GlobalData.currentStyleSheets + } + + lazy val info: BitcoinSServerInfo = + ConsoleCli.exec(GetInfo, GlobalData.consoleCliConfig) match { + case Failure(exception) => + throw exception + case Success(str) => + val json = ujson.read(str) + BitcoinSServerInfo.fromJson(json) + } + + GlobalData.network = info.network + + lazy val (img, titleStr): (Image, String) = info.network match { + case MainNet => + (logo, "Bitcoin-S Wallet") + case TestNet3 => + (logoTestnet, "Bitcoin-S Wallet - [testnet]") + case RegTest => + (logoRegtest, "Bitcoin-S Wallet - [regtest]") + case SigNet => + (logoSignet, "Bitcoin-S Wallet - [signet]") + } + + stage = new JFXApp3.PrimaryStage { + title = titleStr + scene = walletScene + icons.add(img) + } + + fetchStartingData() + taskRunner + () } - - stage = new JFXApp.PrimaryStage { - title = titleStr - scene = walletScene - icons.add(img) - } - - fetchStartingData() - taskRunner } diff --git a/project/Deps.scala b/project/Deps.scala index dee44897d3..7b73a1f003 100644 --- a/project/Deps.scala +++ b/project/Deps.scala @@ -24,7 +24,7 @@ object Deps { val nativeLoaderV = "2.3.5" val typesafeConfigV = "1.4.1" - val scalaFxV = "16.0.0-R22" + val scalaFxV = "16.0.0-R24" val javaFxV = "17-ea+8" val asyncNewScalaV = "0.10.0"