From c81dddb117b1efa4e48d6928f9b8147ba8bd64fb Mon Sep 17 00:00:00 2001 From: sirjonasxx <36828922+sirjonasxx@users.noreply.github.com> Date: Sat, 10 Oct 2020 17:01:36 +0200 Subject: [PATCH] stuff gpython button --- .../main/java/gearth/ui/GEarthController.java | 35 ------------------- .../ui/extensions/ExtensionsController.java | 4 +++ .../java/gearth/ui/extra/ExtraController.java | 25 +++++++++---- .../src/main/resources/gearth/ui/G-Earth.fxml | 2 +- .../main/resources/gearth/ui/extra/Extra.fxml | 29 ++++++++++----- 5 files changed, 44 insertions(+), 51 deletions(-) diff --git a/G-Earth/src/main/java/gearth/ui/GEarthController.java b/G-Earth/src/main/java/gearth/ui/GEarthController.java index b29a1b0..43a7f45 100644 --- a/G-Earth/src/main/java/gearth/ui/GEarthController.java +++ b/G-Earth/src/main/java/gearth/ui/GEarthController.java @@ -107,39 +107,4 @@ public class GEarthController { tabs.forEach(SubForm::exit); hConnection.abort(); } - - - - - public ConnectionController getConnectionController() { - return connectionController; - } - - public InjectionController getInjectionController() { - return injectionController; - } - - public LoggerController getLoggerController() { - return loggerController; - } - - public ToolsController getToolsController() { - return toolsController; - } - - public SchedulerController getSchedulerController() { - return schedulerController; - } - - public ExtraController getExtraController() { - return extraController; - } - - public InfoController getInfoController() { - return infoController; - } - - public ExtensionsController getExtensionsController() { - return extensionsController; - } } diff --git a/G-Earth/src/main/java/gearth/ui/extensions/ExtensionsController.java b/G-Earth/src/main/java/gearth/ui/extensions/ExtensionsController.java index 1b66357..98ba0d5 100644 --- a/G-Earth/src/main/java/gearth/ui/extensions/ExtensionsController.java +++ b/G-Earth/src/main/java/gearth/ui/extensions/ExtensionsController.java @@ -98,7 +98,11 @@ public class ExtensionsController extends SubForm { else { extensionLogger.hide(); } + } + @Override + protected void onTabOpened() { + btn_gpython.setDisable(!parentController.extraController.useGPython()); } public void gpythonBtnClicked(ActionEvent actionEvent) { diff --git a/G-Earth/src/main/java/gearth/ui/extra/ExtraController.java b/G-Earth/src/main/java/gearth/ui/extra/ExtraController.java index ad8a8cd..c48429d 100644 --- a/G-Earth/src/main/java/gearth/ui/extra/ExtraController.java +++ b/G-Earth/src/main/java/gearth/ui/extra/ExtraController.java @@ -7,6 +7,7 @@ import gearth.protocol.connection.proxy.ProxyProviderFactory; import gearth.protocol.connection.proxy.SocksConfiguration; import gearth.ui.SubForm; import gearth.ui.info.InfoController; +import javafx.event.ActionEvent; import javafx.scene.control.*; import javafx.scene.layout.GridPane; import org.json.JSONObject; @@ -18,10 +19,11 @@ public class ExtraController extends SubForm implements SocksConfiguration { public static final String NOTEPAD_CACHE_KEY = "notepad_text"; public static final String SOCKS_CACHE_KEY = "socks_config"; + public static final String GPYTHON_CACHE_KEY = "use_gpython"; public static final String SOCKS_IP = "ip"; public static final String SOCKS_PORT = "port"; - public static final String IGNORE_ONCE = "ignore_once"; +// public static final String IGNORE_ONCE = "ignore_once"; public TextArea txtarea_notepad; @@ -29,18 +31,19 @@ public class ExtraController extends SubForm implements SocksConfiguration { public CheckBox cbx_alwaysOnTop; public Hyperlink url_troubleshooting; + public CheckBox cbx_gpython; + public CheckBox cbx_advanced; public GridPane grd_advanced; public CheckBox cbx_disableDecryption; public CheckBox cbx_debug; - public CheckBox cbx_useSocks; public GridPane grd_socksInfo; public TextField txt_socksPort; public TextField txt_socksIp; - public CheckBox cbx_socksUseIfNeeded; +// public CheckBox cbx_socksUseIfNeeded; public void initialize() { @@ -56,7 +59,11 @@ public class ExtraController extends SubForm implements SocksConfiguration { JSONObject socksInitValue = Cacher.getCacheContents().getJSONObject(SOCKS_CACHE_KEY); txt_socksIp.setText(socksInitValue.getString(SOCKS_IP)); txt_socksPort.setText(socksInitValue.getString(SOCKS_PORT)); - cbx_socksUseIfNeeded.setSelected(socksInitValue.getBoolean(IGNORE_ONCE)); +// cbx_socksUseIfNeeded.setSelected(socksInitValue.getBoolean(IGNORE_ONCE)); + } + + if (Cacher.getCacheContents().has(GPYTHON_CACHE_KEY)) { + cbx_gpython.setSelected(Cacher.getCacheContents().getBoolean(GPYTHON_CACHE_KEY)); } cbx_debug.selectedProperty().addListener(observable -> HConnection.DEBUG = cbx_debug.isSelected()); @@ -85,6 +92,7 @@ public class ExtraController extends SubForm implements SocksConfiguration { @Override protected void onExit() { Cacher.put(NOTEPAD_CACHE_KEY, txtarea_notepad.getText()); + Cacher.put(GPYTHON_CACHE_KEY, cbx_gpython.isSelected()); saveSocksConfig(); } @@ -92,7 +100,7 @@ public class ExtraController extends SubForm implements SocksConfiguration { JSONObject jsonObject = new JSONObject(); jsonObject.put(SOCKS_IP, txt_socksIp.getText()); jsonObject.put(SOCKS_PORT, txt_socksPort.getText()); - jsonObject.put(IGNORE_ONCE, cbx_socksUseIfNeeded.isSelected()); +// jsonObject.put(IGNORE_ONCE, cbx_socksUseIfNeeded.isSelected()); Cacher.put(SOCKS_CACHE_KEY, jsonObject); } @@ -127,6 +135,11 @@ public class ExtraController extends SubForm implements SocksConfiguration { @Override public boolean onlyUseIfNeeded() { - return cbx_socksUseIfNeeded.isSelected(); +// return cbx_socksUseIfNeeded.isSelected(); + return false; + } + + public boolean useGPython() { + return cbx_gpython.isSelected(); } } diff --git a/G-Earth/src/main/resources/gearth/ui/G-Earth.fxml b/G-Earth/src/main/resources/gearth/ui/G-Earth.fxml index ecfd221..b33211f 100644 --- a/G-Earth/src/main/resources/gearth/ui/G-Earth.fxml +++ b/G-Earth/src/main/resources/gearth/ui/G-Earth.fxml @@ -11,7 +11,7 @@ fx:controller="gearth.ui.GEarthController"> + minWidth="-Infinity" prefHeight="295.0" prefWidth="650.0" tabClosingPolicy="UNAVAILABLE"> diff --git a/G-Earth/src/main/resources/gearth/ui/extra/Extra.fxml b/G-Earth/src/main/resources/gearth/ui/extra/Extra.fxml index e544c43..ff6adad 100644 --- a/G-Earth/src/main/resources/gearth/ui/extra/Extra.fxml +++ b/G-Earth/src/main/resources/gearth/ui/extra/Extra.fxml @@ -4,7 +4,7 @@ - + @@ -26,18 +26,20 @@ - - + + + + - + - - + + @@ -57,7 +59,6 @@ - @@ -66,7 +67,6 @@ - @@ -104,12 +104,23 @@ - + + + + + + + + + + + +