Skip to content

Fix unneeded "Select port on upload" message #8194

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Nov 14, 2018
16 changes: 11 additions & 5 deletions app/src/processing/app/EditorLineStatus.java
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,17 @@ public void paintComponent(Graphics graphics) {
g.drawString(text, scale(6), baseline);

g.setColor(messageForeground);
String tmp = I18n.format(tr("{0} on {1}"), name, serialport);

Rectangle2D bounds = g.getFontMetrics().getStringBounds(tmp, null);

g.drawString(tmp, size.width - (int) bounds.getWidth() - RESIZE_IMAGE_SIZE,

String statusText;
if (serialport != null && !serialport.isEmpty()) {
statusText = I18n.format(tr("{0} on {1}"), name, serialport);
} else {
statusText = name;
}

Rectangle2D bounds = g.getFontMetrics().getStringBounds(statusText, null);

g.drawString(statusText, size.width - (int) bounds.getWidth() - RESIZE_IMAGE_SIZE,
baseline);

if (OSUtils.isMacOS()) {
Expand Down