Skip to content

Commit

Permalink
minor menu additions (#760)
Browse files Browse the repository at this point in the history
* cleaning translation names

* better documentation

* menu improvements

added tranlsate button + icon + translate string
added "check for updates" icon

* 7.60.0
  • Loading branch information
i-make-robots authored Dec 19, 2024
1 parent 7621147 commit 43385c9
Show file tree
Hide file tree
Showing 8 changed files with 88 additions and 80 deletions.
3 changes: 2 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.marginallyclever</groupId>
<artifactId>Makelangelo</artifactId>
<version>7.59.1</version>
<version>7.60.0</version>
<name>Makelangelo</name>
<description>Makelangelo Software is a Java program that prepares art for CNC plotters. It is especially designed for the Makelangelo Robot.
It pairs really well with Marlin-polargraph, the code in the brain of the robot that receives instructions and moves the motors.</description>
Expand Down Expand Up @@ -177,6 +177,7 @@ It pairs really well with Marlin-polargraph, the code in the brain of the robot
<archive>
<manifestEntries>
<SplashScreen-Image>splash.png</SplashScreen-Image>
<Implementation-Version>${project.version}</Implementation-Version>
</manifestEntries>
<manifest>
<mainClass>com.marginallyclever.makelangelo.Makelangelo</mainClass>
Expand Down
6 changes: 5 additions & 1 deletion src/main/java/com/marginallyclever/makelangelo/MainMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,13 @@ private JMenu createHelpMenu() {
JMenuItem buttonDonation = createMenuItemBrowse(Translator.get("MenuItemPayPalDonation"), "https://www.marginallyclever.com/products/makelangelo-software/");
menu.add(buttonDonation);

JMenuItem buttonTranslate = createMenuItemBrowse(Translator.get("MenuItemTranslate"), "https://crowdin.com/project/makelangelo");
buttonTranslate.setIcon(new ImageIcon(Objects.requireNonNull(getClass().getResource("/com/marginallyclever/makelangelo/icons8-translate-16.png"))));
menu.add(buttonTranslate);

JMenuItem buttonCheckForUpdate = new JMenuItem(Translator.get("MenuUpdate"));
buttonCheckForUpdate.addActionListener((e) -> app.checkForUpdate(true));
//buttonCheckForUpdate.setIcon(new ImageIcon(Objects.requireNonNull(getClass().getResource("/com/marginallyclever/makelangelo/icons8-update-16.png"))));
buttonCheckForUpdate.setIcon(new ImageIcon(Objects.requireNonNull(getClass().getResource("/com/marginallyclever/makelangelo/icons8-update-16.png"))));
menu.add(buttonCheckForUpdate);

menu.addSeparator();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import java.util.stream.Stream;

/**
* Takes care about configuring the file chooser with all the extensions the app supports
* Configuring a {@link JFileChooser} with all the extensions the app supports
*/
public class OpenFileChooser {
private static final Logger logger = LoggerFactory.getLogger(OpenFileChooser.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,11 @@ public void run(Turtle turtle, Plotter plotter, JFrame parent, int trimHead, int
}

/**
* remove trimHead commands from the start of the turtle history.
* remove trimTail commands from the end of the turtle history.
* Returns the {@link Turtle} with the trimmed history.
* <p>Remove trimHead number of commands from the start of the turtle history.</p>
* <p>Remove trimTail number of commands from the end of the turtle history.</p>
* @param turtle the source turtle.
* @param trimHead the number of commands to remove from the start of the turtle history.
* @param trimTail the number of commands to remove from the end of the turtle history.
* @return the {@link Turtle} with the trimmed history.
*/
protected Turtle trimTurtle(Turtle turtle, int trimHead, int trimTail) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.Objects;

/**
* Raspi camera capture to file for image processing
Expand Down Expand Up @@ -52,7 +53,7 @@ public void run(Frame mainFrame, Paper myPaper) {
final int captureH = 650;
final int captureW = (int) ((double) captureH * aspectRatio);

final JDialog dialog = new JDialog(mainFrame,Translator.get("CaptureImageTitle"), true);
final JDialog dialog = new JDialog(mainFrame,Translator.get("PiCaptureAction.CaptureImageTitle"), true);
dialog.setLocation(mainFrame.getLocation());

JPanel panel = new JPanel();
Expand All @@ -79,70 +80,70 @@ public void run(Frame mainFrame, Paper myPaper) {
// all controls to the right
cMain.gridx++;

JLabel label = new JLabel(Translator.get("AWB"));
JLabel label = new JLabel(Translator.get("PiCaptureAction.AWB"));
label.setPreferredSize(new Dimension(100,BUTTON_HEIGHT));
panel.add(label, cMain);
cMain.gridy++;

String[] awbComboBoxChoices = {
Translator.get("Off"),
Translator.get("Auto"),
Translator.get("Sun"),
Translator.get("Cloud"),
Translator.get("Shade"),
Translator.get("Tungsten"),
Translator.get("Fluorescent"),
Translator.get("Incandescent"),
Translator.get("Flash"),
Translator.get("Horizon") };
Translator.get("PiCaptureAction.Off"),
Translator.get("PiCaptureAction.Auto"),
Translator.get("PiCaptureAction.Sun"),
Translator.get("PiCaptureAction.Cloud"),
Translator.get("PiCaptureAction.Shade"),
Translator.get("PiCaptureAction.Tungsten"),
Translator.get("PiCaptureAction.Fluorescent"),
Translator.get("PiCaptureAction.Incandescent"),
Translator.get("PiCaptureAction.Flash"),
Translator.get("PiCaptureAction.Horizon") };
final JComboBox<String> awbComboBox = new JComboBox<String>(awbComboBoxChoices);
awbComboBox.setPreferredSize(new Dimension(100,BUTTON_HEIGHT));
awbComboBox.setSelectedIndex(awb);
panel.add(awbComboBox, cMain);
cMain.gridy++;

JLabel lblNewLabel = new JLabel(Translator.get("DRC"));
JLabel lblNewLabel = new JLabel(Translator.get("PiCaptureAction.DRC"));
lblNewLabel.setPreferredSize(new Dimension(100,BUTTON_HEIGHT));
panel.add(lblNewLabel, cMain);
cMain.gridy++;

String[] drcComboBoxChoices = {
Translator.get("Off"),
Translator.get("High"),
Translator.get("Medium"),
Translator.get("Low") };
final JComboBox<String> drcComboBox = new JComboBox<String>(drcComboBoxChoices);
Translator.get("PiCaptureAction.Off"),
Translator.get("PiCaptureAction.High"),
Translator.get("PiCaptureAction.Medium"),
Translator.get("PiCaptureAction.Low") };
final JComboBox<String> drcComboBox = new JComboBox<>(drcComboBoxChoices);
drcComboBox.setPreferredSize(new Dimension(100,BUTTON_HEIGHT));
drcComboBox.setSelectedIndex(drc);
panel.add(drcComboBox, cMain);
cMain.gridy++;

JLabel label_1 = new JLabel(Translator.get("Exposure"));
JLabel label_1 = new JLabel(Translator.get("PiCaptureAction.Exposure"));
label_1.setPreferredSize(new Dimension(100,BUTTON_HEIGHT));
panel.add(label_1, cMain);
cMain.gridy++;

String[] expComboBoxChoices = {
Translator.get("Antishake"),
Translator.get("Auto"),
Translator.get("Backlight"),
Translator.get("Beach"),
Translator.get("Fireworks"),
Translator.get("FixedFPS"),
Translator.get("Night"),
Translator.get("NightPreview"),
Translator.get("Snow"),
Translator.get("Sports"),
Translator.get("Spotlight"),
Translator.get("Verylong") };
Translator.get("PiCaptureAction.Antishake"),
Translator.get("PiCaptureAction.Auto"),
Translator.get("PiCaptureAction.Backlight"),
Translator.get("PiCaptureAction.Beach"),
Translator.get("PiCaptureAction.Fireworks"),
Translator.get("PiCaptureAction.FixedFPS"),
Translator.get("PiCaptureAction.Night"),
Translator.get("PiCaptureAction.NightPreview"),
Translator.get("PiCaptureAction.Snow"),
Translator.get("PiCaptureAction.Sports"),
Translator.get("PiCaptureAction.Spotlight"),
Translator.get("PiCaptureAction.Verylong") };
final JComboBox<String> expComboBox = new JComboBox<String>(expComboBoxChoices);
// expComboBox.setBounds(584, 362, 90, 20);
expComboBox.setPreferredSize(new Dimension(100,BUTTON_HEIGHT));
expComboBox.setSelectedIndex(exp);
panel.add(expComboBox, cMain);
cMain.gridy++;

JLabel lblContrast = new JLabel(Translator.get("Contrast"));
JLabel lblContrast = new JLabel(Translator.get("PiCaptureAction.Contrast"));
// lblContrast.setBounds(588, 393, 67, 14);
lblContrast.setPreferredSize(new Dimension(100,BUTTON_HEIGHT));
panel.add(lblContrast, cMain);
Expand All @@ -155,7 +156,7 @@ public void run(Frame mainFrame, Paper myPaper) {
panel.add(contrastSlider, cMain);
cMain.gridy++;

JLabel lblQuality = new JLabel(Translator.get("Quality"));
JLabel lblQuality = new JLabel(Translator.get("PiCaptureAction.Quality"));
// lblQuality.setBounds(588, 452, 46, 14);
lblQuality.setPreferredSize(new Dimension(100,BUTTON_HEIGHT));
panel.add(lblQuality, cMain);
Expand All @@ -167,7 +168,7 @@ public void run(Frame mainFrame, Paper myPaper) {
panel.add(qualitySlider, cMain);
cMain.gridy++;

JLabel lblSharpness = new JLabel(Translator.get("Sharpness"));
JLabel lblSharpness = new JLabel(Translator.get("PiCaptureAction.Sharpness"));
// lblSharpness.setBounds(585, 517, 66, 14);
lblSharpness.setPreferredSize(new Dimension(100,BUTTON_HEIGHT));
panel.add(lblSharpness, cMain);
Expand All @@ -185,17 +186,17 @@ public void run(Frame mainFrame, Paper myPaper) {
// a little space between everything else
cMain.insets = new Insets(10,0,0,0); //top padding

buttonCaptureImage = new JButton(Translator.get("CaptureImage"));
buttonCaptureImage = new JButton(Translator.get("PiCaptureAction.CaptureImage"));
buttonCaptureImage.addActionListener((arg0)->{
try {
piCamera.turnOnPreview(
mainFrame.getLocationOnScreen().x + 50,
mainFrame.getLocationOnScreen().y + 100,
captureW,
captureH);
piCamera.setAWB(AWB.valueOf(((String)awbComboBox.getSelectedItem()).toUpperCase()));
piCamera.setDRC(DRC.valueOf(((String)drcComboBox.getSelectedItem()).toUpperCase()));
piCamera.setExposure(Exposure.valueOf(((String)expComboBox.getSelectedItem()).toUpperCase()));
piCamera.setAWB(AWB.valueOf(((String) Objects.requireNonNull(awbComboBox.getSelectedItem())).toUpperCase()));
piCamera.setDRC(DRC.valueOf(((String) Objects.requireNonNull(drcComboBox.getSelectedItem())).toUpperCase()));
piCamera.setExposure(Exposure.valueOf(((String) Objects.requireNonNull(expComboBox.getSelectedItem())).toUpperCase()));
piCamera.setEncoding(Encoding.JPG);
piCamera.setWidth(captureW);
piCamera.setHeight(captureH);
Expand All @@ -218,7 +219,7 @@ public void run(Frame mainFrame, Paper myPaper) {
cMain.gridy++;
cMain.insets = new Insets(2,0,0,0); //top padding

buttonUseCapture = new JButton(Translator.get("UseCapture"));
buttonUseCapture = new JButton(Translator.get("PiCaptureAction.UseCapture"));
buttonUseCapture.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
Expand Down Expand Up @@ -246,7 +247,7 @@ public void actionPerformed(ActionEvent arg0) {
panel.add(buttonUseCapture, cMain);
cMain.gridy++;

buttonCancelCapture = new JButton(Translator.get("CancelCapture"));
buttonCancelCapture = new JButton(Translator.get("PiCaptureAction.CancelCapture"));
buttonCancelCapture.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
dialog.dispose();
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
69 changes: 35 additions & 34 deletions src/main/resources/languages/english.xml
Original file line number Diff line number Diff line change
Expand Up @@ -163,40 +163,40 @@
<string><key>TextSize</key><value>Size</value></string>
<string><key>FontFace</key><value>Typeface</value></string>
<string><key>TextMessage</key><value>Message</value></string>
<string><key>CaptureImageTitle</key><value>Capture Camera Image</value></string>
<string><key>CaptureImage</key><value>Capture</value></string>
<string><key>UseCapture</key><value>Use</value></string>
<string><key>CancelCapture</key><value>Cancel</value></string>
<string><key>AWB</key><value>Automatic White Balance</value></string>
<string><key>DRC</key><value>Dynamic Range</value></string>
<string><key>Exposure</key><value>Exposure</value></string>
<string><key>Contrast</key><value>Contrast</value></string>
<string><key>Quality</key><value>Quality</value></string>
<string><key>Sharpness</key><value>Sharpness</value></string>
<string><key>Off</key><value>Off</value></string>
<string><key>Auto</key><value>Auto</value></string>
<string><key>Sun</key><value>Sun</value></string>
<string><key>Cloud</key><value>Cloud</value></string>
<string><key>Shade</key><value>Shade</value></string>
<string><key>Tungsten</key><value>Tungsten</value></string>
<string><key>Fluorescent</key><value>Fluorescent</value></string>
<string><key>Incandescent</key><value>Incandescent</value></string>
<string><key>Flash</key><value>Flash</value></string>
<string><key>Horizon</key><value>Horizon</value></string>
<string><key>High</key><value>High</value></string>
<string><key>Medium</key><value>Medium</value></string>
<string><key>Low</key><value>Low</value></string>
<string><key>Antishake</key><value>Antishake</value></string>
<string><key>Backlight</key><value>Backlight</value></string>
<string><key>Beach</key><value>Beach</value></string>
<string><key>Fireworks</key><value>Fireworks</value></string>
<string><key>FixedFPS</key><value>FixedFPS</value></string>
<string><key>Night</key><value>Night</value></string>
<string><key>NightPreview</key><value>NightPreview</value></string>
<string><key>Snow</key><value>Snow</value></string>
<string><key>Sports</key><value>Sports</value></string>
<string><key>Spotlight</key><value>Spotlight</value></string>
<string><key>Verylong</key><value>Verylong</value></string>
<string><key>PiCaptureAction.CaptureImageTitle</key><value>Capture Camera Image</value></string>
<string><key>PiCaptureAction.CaptureImage</key><value>Capture</value></string>
<string><key>PiCaptureAction.UseCapture</key><value>Use</value></string>
<string><key>PiCaptureAction.CancelCapture</key><value>Cancel</value></string>
<string><key>PiCaptureAction.AWB</key><value>Automatic White Balance</value></string>
<string><key>PiCaptureAction.DRC</key><value>Dynamic Range</value></string>
<string><key>PiCaptureAction.Exposure</key><value>Exposure</value></string>
<string><key>PiCaptureAction.Contrast</key><value>Contrast</value></string>
<string><key>PiCaptureAction.Quality</key><value>Quality</value></string>
<string><key>PiCaptureAction.Sharpness</key><value>Sharpness</value></string>
<string><key>PiCaptureAction.Off</key><value>Off</value></string>
<string><key>PiCaptureAction.Auto</key><value>Auto</value></string>
<string><key>PiCaptureAction.Sun</key><value>Sun</value></string>
<string><key>PiCaptureAction.Cloud</key><value>Cloud</value></string>
<string><key>PiCaptureAction.Shade</key><value>Shade</value></string>
<string><key>PiCaptureAction.Tungsten</key><value>Tungsten</value></string>
<string><key>PiCaptureAction.Fluorescent</key><value>Fluorescent</value></string>
<string><key>PiCaptureAction.Incandescent</key><value>Incandescent</value></string>
<string><key>PiCaptureAction.Flash</key><value>Flash</value></string>
<string><key>PiCaptureAction.Horizon</key><value>Horizon</value></string>
<string><key>PiCaptureAction.High</key><value>High</value></string>
<string><key>PiCaptureAction.Medium</key><value>Medium</value></string>
<string><key>PiCaptureAction.Low</key><value>Low</value></string>
<string><key>PiCaptureAction.Antishake</key><value>Antishake</value></string>
<string><key>PiCaptureAction.Backlight</key><value>Backlight</value></string>
<string><key>PiCaptureAction.Beach</key><value>Beach</value></string>
<string><key>PiCaptureAction.Fireworks</key><value>Fireworks</value></string>
<string><key>PiCaptureAction.FixedFPS</key><value>FixedFPS</value></string>
<string><key>PiCaptureAction.Night</key><value>Night</value></string>
<string><key>PiCaptureAction.NightPreview</key><value>NightPreview</value></string>
<string><key>PiCaptureAction.Snow</key><value>Snow</value></string>
<string><key>PiCaptureAction.Sports</key><value>Sports</value></string>
<string><key>PiCaptureAction.Spotlight</key><value>Spotlight</value></string>
<string><key>PiCaptureAction.Verylong</key><value>Verylong</value></string>
<string><key>Import</key><value>Import</value></string>
<string><key>Export</key><value>Export</value></string>
<string><key>Reset</key><value>Reset</value></string>
Expand Down Expand Up @@ -238,6 +238,7 @@
<string><key>InfoTitle</key><value>Information</value></string>
<string><key>ErrorTitle</key><value>Error</value></string>
<string><key>MenuItemPayPalDonation</key><value>PayPal donation</value></string>
<string><key>MenuItemTranslate</key><value>Help Translate</value></string>

<string><key>EstimatedTimeIs</key><value>Estimated time is %1</value></string>
<string><key>firmwareVersionBadMessage</key><value><![CDATA[<html><body>The firmware (code in the brain of your robot) is not the version I expect. I found <strong>%1%</strong>.<br/>Please visit <a href="https://www.marginallyclever.com/product/makelangelo-firmware/">https://www.marginallyclever.com/product/makelangelo-firmware/</a><br>for the latest firmware.<br>Please visit <a href="https://www.marginallyclever.com/product/makelangelo-software/">https://www.marginallyclever.com/product/makelangelo-software/</a> for the latest software.</body></html>]]></value></string>
Expand Down

0 comments on commit 43385c9

Please sign in to comment.