From cb5e0229ff866b9ea8cfe4fdbf602749160841b3 Mon Sep 17 00:00:00 2001 From: octopus_yan Date: Mon, 18 Nov 2024 17:26:03 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E4=BA=8C=E6=AC=A1?= =?UTF-8?q?=E5=8A=A0=E8=BD=BDpbo=E6=97=B6=EF=BC=8C=E7=BF=BB=E8=AF=91?= =?UTF-8?q?=E8=BF=9B=E5=BA=A6=E6=9D=A1=E5=8F=98=E7=B2=97=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cn/octopusyan/dmt/viewModel/MainViewModel.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/java/cn/octopusyan/dmt/viewModel/MainViewModel.java b/src/main/java/cn/octopusyan/dmt/viewModel/MainViewModel.java index 6437068..d70d9a6 100644 --- a/src/main/java/cn/octopusyan/dmt/viewModel/MainViewModel.java +++ b/src/main/java/cn/octopusyan/dmt/viewModel/MainViewModel.java @@ -14,6 +14,7 @@ import cn.octopusyan.dmt.view.ConsoleLog; import javafx.application.Platform; import javafx.beans.property.SimpleStringProperty; import javafx.beans.property.StringProperty; +import javafx.collections.ObservableList; import javafx.concurrent.Worker; import javafx.scene.control.ProgressIndicator; import org.apache.commons.lang3.StringUtils; @@ -103,7 +104,7 @@ public class MainViewModel extends BaseViewModel { * 开始翻译 */ public void startTranslate() { - if(wordItems.isEmpty()) return; + if (wordItems.isEmpty()) return; if (translateTask == null) { List words = wordItems.stream().filter(item -> StringUtils.isEmpty(item.getChinese())).toList(); @@ -135,7 +136,7 @@ public class MainViewModel extends BaseViewModel { * 打包 */ public void pack() { - if(wordItems.isEmpty()) return; + if (wordItems.isEmpty()) return; PackTask packTask = new PackTask(wordItems, unpackPath); packTask.onListen(new PackTask.PackListener() { @@ -192,7 +193,10 @@ public class MainViewModel extends BaseViewModel { private void resetProgress() { translateTask = null; controller.translate.setGraphic(startIcon); - Styles.toggleStyleClass(controller.translateProgress, Styles.SMALL); + ObservableList styleClass = controller.translateProgress.getStyleClass(); + if (!styleClass.contains(Styles.SMALL)) { + Styles.toggleStyleClass(controller.translateProgress, Styles.SMALL); + } controller.translateProgress.progressProperty().unbind(); controller.translateProgress.setProgress(0); controller.translateProgress.setVisible(false);