stuff gpython button

This commit is contained in:
sirjonasxx 2020-10-10 17:01:36 +02:00
parent 7d01c11852
commit c81dddb117
5 changed files with 44 additions and 51 deletions

View File

@ -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;
}
}

View File

@ -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) {

View File

@ -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();
}
}

View File

@ -11,7 +11,7 @@
fx:controller="gearth.ui.GEarthController">
<Pane fx:id="mover" maxHeight="0.0" minHeight="0.0" prefWidth="200.0"/>
<TabPane fx:id="tabBar" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="-Infinity"
minWidth="-Infinity" prefHeight="295.0" prefWidth="565.0" tabClosingPolicy="UNAVAILABLE">
minWidth="-Infinity" prefHeight="295.0" prefWidth="650.0" tabClosingPolicy="UNAVAILABLE">
<Tab text="Connection">
<fx:include fx:id="connection" source="connection/Connection.fxml"/>
</Tab>

View File

@ -4,7 +4,7 @@
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<GridPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="258.0" prefWidth="650.0" xmlns="http://javafx.com/javafx/10.0.2-internal" xmlns:fx="http://javafx.com/fxml/1" fx:controller="gearth.ui.extra.ExtraController">
<GridPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="258.0" prefWidth="650.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="gearth.ui.extra.ExtraController">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="331.0" minWidth="10.0" prefWidth="318.0" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="390.0" minWidth="10.0" prefWidth="247.0" />
@ -26,18 +26,20 @@
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints maxHeight="125.0" minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="235.0" minHeight="10.0" prefHeight="232.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="7.0" minHeight="7.0" prefHeight="7.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="30.0" minHeight="30.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="28.0" minHeight="28.0" prefHeight="28.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="1.7976931348623157E308" minHeight="10.0" prefHeight="232.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<GridPane fx:id="grd_advanced" disable="true" style="-fx-border-color: #888888; -fx-border-radius: 5px;" GridPane.rowIndex="1">
<GridPane fx:id="grd_advanced" disable="true" style="-fx-border-color: #888888; -fx-border-radius: 5px;" GridPane.rowIndex="3">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints maxHeight="30.0" minHeight="30.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="119.0" minHeight="58.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="119.0" minHeight="6.0" prefHeight="15.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="60.0" minHeight="60.0" prefHeight="60.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="1.7976931348623157E308" minHeight="6.0" prefHeight="15.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="30.0" minHeight="30.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="30.0" minHeight="30.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
@ -57,7 +59,6 @@
</columnConstraints>
<rowConstraints>
<RowConstraints maxHeight="60.0" minHeight="60.0" prefHeight="60.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="30.0" minHeight="30.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<GridPane.margin>
<Insets />
@ -66,7 +67,6 @@
<Insets left="5.0" />
</padding>
<children>
<CheckBox fx:id="cbx_socksUseIfNeeded" mnemonicParsing="false" selected="true" text="Only use if needed" GridPane.rowIndex="1" />
<GridPane prefHeight="119.0" prefWidth="259.0">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="159.0" minWidth="10.0" prefWidth="68.0" />
@ -104,12 +104,23 @@
</GridPane>
</children>
</GridPane>
<CheckBox fx:id="cbx_advanced" mnemonicParsing="false" text="Advanced" textFill="#000000ba">
<CheckBox fx:id="cbx_advanced" mnemonicParsing="false" text="Advanced" textFill="#000000ba" GridPane.rowIndex="2">
<GridPane.margin>
<Insets left="10.0" top="2.0" />
</GridPane.margin>
<padding>
<Insets top="2.0" />
</padding>
</CheckBox>
<CheckBox fx:id="cbx_gpython" mnemonicParsing="false" text="Enable G-Python scripting" textFill="#000000ba" GridPane.rowIndex="1">
<GridPane.margin>
<Insets left="10.0" top="2.0" />
</GridPane.margin>
</CheckBox>
</children>
<GridPane.margin>
<Insets />
</GridPane.margin>
</GridPane>
</children>
</GridPane>