mirror of
https://github.com/bitcoin-s/bitcoin-s.git
synced 2025-03-13 11:35:40 +01:00
Add debug window button to unreserve all utxos (#3633)
This commit is contained in:
parent
2d429db60d
commit
11dd28085a
1 changed files with 37 additions and 5 deletions
|
@ -1,16 +1,19 @@
|
|||
package org.bitcoins.gui.dialog
|
||||
|
||||
import grizzled.slf4j.Logging
|
||||
import org.bitcoins.gui.GlobalData
|
||||
import org.bitcoins.cli.CliCommand.LockUnspent
|
||||
import org.bitcoins.cli.ConsoleCli
|
||||
import org.bitcoins.gui.{GlobalData, TaskRunner}
|
||||
import scalafx.Includes._
|
||||
import scalafx.scene.control.{Button, ButtonType, Dialog}
|
||||
import scalafx.geometry.Pos
|
||||
import scalafx.scene.control.{Button, ButtonType, Dialog, ProgressIndicator}
|
||||
import scalafx.scene.layout.VBox
|
||||
import scalafx.stage.{Modality, Window}
|
||||
|
||||
import java.awt.Desktop
|
||||
import java.io.File
|
||||
import java.nio.file.{Files, Paths}
|
||||
import scala.util.Properties
|
||||
import scala.util.{Failure, Properties, Success}
|
||||
|
||||
object DebugDialog extends Logging {
|
||||
|
||||
|
@ -59,12 +62,41 @@ object DebugDialog extends Logging {
|
|||
}
|
||||
}
|
||||
|
||||
dialog.dialogPane().content = new VBox {
|
||||
val unreserveAllUTXOsButton = new Button("Unreserve All UTXOs")
|
||||
|
||||
val content = new VBox {
|
||||
minWidth = 300
|
||||
minHeight = 300
|
||||
children = Seq(openLogButton)
|
||||
spacing = 10
|
||||
children = Seq(openLogButton, unreserveAllUTXOsButton)
|
||||
}
|
||||
|
||||
val glassPane = new VBox {
|
||||
children = new ProgressIndicator {
|
||||
progress = ProgressIndicator.IndeterminateProgress
|
||||
visible = true
|
||||
}
|
||||
alignment = Pos.Center
|
||||
visible = false
|
||||
}
|
||||
|
||||
lazy val taskRunner = new TaskRunner(content, glassPane)
|
||||
|
||||
unreserveAllUTXOsButton.onAction = _ => {
|
||||
taskRunner.run(
|
||||
"Unreserve All UTXOs", {
|
||||
ConsoleCli.exec(LockUnspent(true, Vector.empty),
|
||||
GlobalData.consoleCliConfig) match {
|
||||
case Success(_) => ()
|
||||
case Failure(err) =>
|
||||
throw err
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
dialog.dialogPane().content = content
|
||||
|
||||
val _ = dialog.show()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue