1
0
mirror of https://github.com/arduino/Arduino.git synced 2024-12-01 12:24:14 +01:00

Merge pull request #11200 from magedrifaat/linestatusbug

Fix status bar custom board preferences disappearing
This commit is contained in:
Cristian Maglie 2021-01-26 11:56:31 +01:00 committed by GitHub
commit b2265ce4ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 12 deletions

View File

@ -2587,12 +2587,7 @@ public class Editor extends JFrame implements RunnerListener {
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
protected void onBoardOrPortChange() {
TargetBoard board = BaseNoGui.getTargetBoard();
if (board != null)
lineStatus.setBoardName(board.getName());
else
lineStatus.setBoardName("-");
lineStatus.setPort(PreferencesData.get("serial.port"));
lineStatus.updateBoardAndPort();
lineStatus.repaint();
}

View File

@ -92,12 +92,7 @@ public class EditorLineStatus extends JComponent {
public void paintComponent(Graphics graphics) {
Graphics2D g = Theme.setupGraphics2D(graphics);
if (name.isEmpty() && port.isEmpty()) {
PreferencesMap boardPreferences = BaseNoGui.getBoardPreferences();
if (boardPreferences != null)
setBoardName(boardPreferences.get("name"));
else
setBoardName("-");
setPort(PreferencesData.get("serial.port"));
updateBoardAndPort();
}
g.setColor(background);
Dimension size = getSize();
@ -146,4 +141,13 @@ public class EditorLineStatus extends JComponent {
public Dimension getMaximumSize() {
return scale(new Dimension(3000, height));
}
public void updateBoardAndPort() {
PreferencesMap boardPreferences = BaseNoGui.getBoardPreferences();
if (boardPreferences != null)
setBoardName(boardPreferences.get("name"));
else
setBoardName("-");
setPort(PreferencesData.get("serial.port"));
}
}