BEEP cool console feature
This commit is contained in:
parent
865b099ad0
commit
debb360d0c
|
@ -6,7 +6,7 @@ import java.net.URL;
|
|||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
public class rusEFIVersion {
|
||||
public static final int CONSOLE_VERSION = 20230130;
|
||||
public static final int CONSOLE_VERSION = 20230203;
|
||||
public static AtomicReference<String> firmwareVersion = new AtomicReference<>("N/A");
|
||||
|
||||
public static long classBuildTimeMillis() {
|
||||
|
|
|
@ -63,6 +63,10 @@ public class MessagesPanel {
|
|||
return messagesView.messages.getFont();
|
||||
}
|
||||
|
||||
public MessagesView getMessagesView() {
|
||||
return messagesView;
|
||||
}
|
||||
|
||||
public void setFont(Font font, Node config) {
|
||||
messagesView.messages.setFont(font);
|
||||
config.setProperty(FONT_SIZE, font.getSize());
|
||||
|
|
|
@ -25,6 +25,8 @@ public class MessagesView {
|
|||
protected final JTextPane messages = new JTextPane();
|
||||
public final JScrollPane messagesScroll = new JScrollPane(messages, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
|
||||
|
||||
public Listener listener = Listener.VOID;
|
||||
|
||||
public MessagesView(Node config) {
|
||||
this.config = config;
|
||||
messages.setEditable(false);
|
||||
|
@ -42,8 +44,10 @@ public class MessagesView {
|
|||
@Override
|
||||
public void onMessage(Class clazz, String message) {
|
||||
final String date = DATE_FORMAT.format(new Date());
|
||||
if (!isPaused)
|
||||
if (!isPaused) {
|
||||
append(date + ": " + clazz.getSimpleName() + ": " + message, clazz);
|
||||
listener.onMessage(message);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -125,4 +129,11 @@ does not work? maybe wrong UI colors since control is not editable?
|
|||
public boolean isPaused() {
|
||||
return isPaused;
|
||||
}
|
||||
|
||||
public interface Listener {
|
||||
Listener VOID = message -> {
|
||||
};
|
||||
|
||||
void onMessage(String message);
|
||||
}
|
||||
}
|
|
@ -6,6 +6,7 @@ import com.rusefi.config.generated.Fields;
|
|||
import com.rusefi.io.ConnectionStatusLogic;
|
||||
import com.rusefi.io.LinkManager;
|
||||
import com.rusefi.ui.MessagesPanel;
|
||||
import com.rusefi.ui.MessagesView;
|
||||
import com.rusefi.ui.UIContext;
|
||||
import com.rusefi.core.preferences.storage.Node;
|
||||
import com.rusefi.ui.util.URLLabel;
|
||||
|
@ -41,6 +42,11 @@ public class LuaScriptPanel {
|
|||
|
||||
MessagesPanel mp = new MessagesPanel(null, config);
|
||||
|
||||
mp.getMessagesView().listener = message -> {
|
||||
if (message.contains("BEEP"))
|
||||
Toolkit.getDefaultToolkit().beep();
|
||||
};
|
||||
|
||||
writeButton.addActionListener(e -> {
|
||||
write();
|
||||
// resume messages on 'write new script to ECU'
|
||||
|
@ -57,7 +63,8 @@ public class LuaScriptPanel {
|
|||
scriptText.setText(formatted);
|
||||
} catch (Exception ignored) {
|
||||
// todo: fix luaformatter no reason for exception
|
||||
} }
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
burnButton.addActionListener(e -> {
|
||||
|
|
Loading…
Reference in New Issue