Skip to content

Commit b2265ce

Browse files
authored
Merge pull request #11200 from magedrifaat/linestatusbug
Fix status bar custom board preferences disappearing
2 parents f4e8a91 + 5e75194 commit b2265ce

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

app/src/processing/app/Editor.java

+1-6
Original file line numberDiff line numberDiff line change
@@ -2587,12 +2587,7 @@ private void statusEmpty() {
25872587
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
25882588

25892589
protected void onBoardOrPortChange() {
2590-
TargetBoard board = BaseNoGui.getTargetBoard();
2591-
if (board != null)
2592-
lineStatus.setBoardName(board.getName());
2593-
else
2594-
lineStatus.setBoardName("-");
2595-
lineStatus.setPort(PreferencesData.get("serial.port"));
2590+
lineStatus.updateBoardAndPort();
25962591
lineStatus.repaint();
25972592
}
25982593

app/src/processing/app/EditorLineStatus.java

+10-6
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,7 @@ public void set(int newStart, int newStop) {
9292
public void paintComponent(Graphics graphics) {
9393
Graphics2D g = Theme.setupGraphics2D(graphics);
9494
if (name.isEmpty() && port.isEmpty()) {
95-
PreferencesMap boardPreferences = BaseNoGui.getBoardPreferences();
96-
if (boardPreferences != null)
97-
setBoardName(boardPreferences.get("name"));
98-
else
99-
setBoardName("-");
100-
setPort(PreferencesData.get("serial.port"));
95+
updateBoardAndPort();
10196
}
10297
g.setColor(background);
10398
Dimension size = getSize();
@@ -146,4 +141,13 @@ public Dimension getMinimumSize() {
146141
public Dimension getMaximumSize() {
147142
return scale(new Dimension(3000, height));
148143
}
144+
145+
public void updateBoardAndPort() {
146+
PreferencesMap boardPreferences = BaseNoGui.getBoardPreferences();
147+
if (boardPreferences != null)
148+
setBoardName(boardPreferences.get("name"));
149+
else
150+
setBoardName("-");
151+
setPort(PreferencesData.get("serial.port"));
152+
}
149153
}

0 commit comments

Comments
 (0)