mirror of
https://github.com/TermoraDev/termora.git
synced 2026-01-16 02:12:58 +08:00
chore: do not refresh during installation
This commit is contained in:
@@ -15,10 +15,17 @@ import java.awt.BorderLayout
|
|||||||
import java.awt.CardLayout
|
import java.awt.CardLayout
|
||||||
import java.awt.event.ActionEvent
|
import java.awt.event.ActionEvent
|
||||||
import java.util.concurrent.atomic.AtomicBoolean
|
import java.util.concurrent.atomic.AtomicBoolean
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger
|
||||||
import javax.swing.*
|
import javax.swing.*
|
||||||
|
|
||||||
|
|
||||||
class MarketplacePanel : JPanel(BorderLayout()), Disposable {
|
class MarketplacePanel : JPanel(BorderLayout()), Disposable {
|
||||||
|
companion object {
|
||||||
|
/**
|
||||||
|
* 正在安装的数量
|
||||||
|
*/
|
||||||
|
val installing = AtomicInteger(0)
|
||||||
|
}
|
||||||
|
|
||||||
private val pluginsPanel = JPanel(VerticalFlowLayout(VerticalFlowLayout.TOP, 0, 8))
|
private val pluginsPanel = JPanel(VerticalFlowLayout(VerticalFlowLayout.TOP, 0, 8))
|
||||||
private val cardLayout = CardLayout()
|
private val cardLayout = CardLayout()
|
||||||
@@ -93,6 +100,7 @@ class MarketplacePanel : JPanel(BorderLayout()), Disposable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun reload() {
|
fun reload() {
|
||||||
|
if (installing.get() > 0) return
|
||||||
if (isLoading.compareAndSet(false, true)) {
|
if (isLoading.compareAndSet(false, true)) {
|
||||||
coroutineScope.launch {
|
coroutineScope.launch {
|
||||||
withContext(Dispatchers.Swing) {
|
withContext(Dispatchers.Swing) {
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ import org.apache.commons.net.io.Util
|
|||||||
import org.jdesktop.swingx.JXLabel
|
import org.jdesktop.swingx.JXLabel
|
||||||
import org.slf4j.LoggerFactory
|
import org.slf4j.LoggerFactory
|
||||||
import java.awt.Dimension
|
import java.awt.Dimension
|
||||||
import java.util.concurrent.atomic.AtomicInteger
|
|
||||||
import java.util.zip.ZipEntry
|
import java.util.zip.ZipEntry
|
||||||
import java.util.zip.ZipInputStream
|
import java.util.zip.ZipInputStream
|
||||||
import javax.swing.*
|
import javax.swing.*
|
||||||
@@ -33,11 +32,6 @@ class PluginPanel(val descriptor: PluginPluginDescriptor) : JPanel(), Disposable
|
|||||||
private val log = LoggerFactory.getLogger(PluginPanel::class.java)
|
private val log = LoggerFactory.getLogger(PluginPanel::class.java)
|
||||||
private val installed = mutableSetOf<String>()
|
private val installed = mutableSetOf<String>()
|
||||||
private val uninstalled = mutableSetOf<String>()
|
private val uninstalled = mutableSetOf<String>()
|
||||||
|
|
||||||
/**
|
|
||||||
* 正在安装的数量
|
|
||||||
*/
|
|
||||||
private val installing = AtomicInteger(0)
|
|
||||||
private val publicKey = Ed25519.generatePublic(
|
private val publicKey = Ed25519.generatePublic(
|
||||||
Base64.decodeBase64("MCowBQYDK2VwAyEAHPyJ5kt2UHWYUPnWU84DOEhCCUE5FEpzdAbeTCNV31A")
|
Base64.decodeBase64("MCowBQYDK2VwAyEAHPyJ5kt2UHWYUPnWU84DOEhCCUE5FEpzdAbeTCNV31A")
|
||||||
)
|
)
|
||||||
@@ -47,7 +41,7 @@ class PluginPanel(val descriptor: PluginPluginDescriptor) : JPanel(), Disposable
|
|||||||
private val updateButton = InstallButton().apply { update = true }
|
private val updateButton = InstallButton().apply { update = true }
|
||||||
private val installButton = InstallButton()
|
private val installButton = InstallButton()
|
||||||
private val uninstallButton = JButton(I18n.getString("termora.settings.plugin.uninstall"))
|
private val uninstallButton = JButton(I18n.getString("termora.settings.plugin.uninstall"))
|
||||||
|
private val installing get() = MarketplacePanel.installing
|
||||||
private val restarter get() = TermoraRestarter.getInstance()
|
private val restarter get() = TermoraRestarter.getInstance()
|
||||||
private val pluginManager get() = PluginManager.getInstance()
|
private val pluginManager get() = PluginManager.getInstance()
|
||||||
private val owner get() = SwingUtilities.getWindowAncestor(this)
|
private val owner get() = SwingUtilities.getWindowAncestor(this)
|
||||||
|
|||||||
Reference in New Issue
Block a user