Skip to content

Commit

Permalink
Merge pull request #12 from stfc/release-2.2.0
Browse files Browse the repository at this point in the history
Release 2.2.0 to master
  • Loading branch information
gregcorbett authored Nov 10, 2018
2 parents 21908cc + a1c2724 commit e146a13
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 6 deletions.
8 changes: 8 additions & 0 deletions ChangeLog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
Changelog

========== Version 2.2.0 ==========

New Features and Minor Changes:
- Add an 'Erase Arduino Program' Button to the UI

Patches, Bug Fixes and Documentation Changes:
- Style improvements to 'Getting Started with ArduBlock' section of README.md

========== Version 2.1.1 ==========

Patches and Bug Fixes:
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ Code written in Ardublock has the file extension .abp.
#### Getting Started with ArduBlock
1. Install the Arduino IDE, from https://www.arduino.cc/en/Main/Software
2. Download ardublock-all.jar https://github.com/stfc/ardublock/releases/latest
3. Copy ardublock-all.jar to C:/Users/<username>/Arduino/tools/ArduBlockTool/tool/ardublock-all.jar under
* Be careful, the name of folder “ArduBlockTool” under tools folder is case sensitive.
* In Mac, /Users/<username>/Documents/Arduino/tools/ArduBlockTool/tool/ardublock-all.jar
* In Linux, /home/<username>/sketchbook/tools/ArduBlockTool/tool/ardublock-all.jar
3. Copy ardublock-all.jar to `C:/Users/<username>/Arduino/tools/ArduBlockTool/tool/ardublock-all.jar` under
* Be careful, the name of folder “ArduBlockTool” under tools folder is case sensitive.
* In Mac, `/Users/<username>/Documents/Arduino/tools/ArduBlockTool/tool/ardublock-all.jar`
* In Linux, `/home/<username>/sketchbook/tools/ArduBlockTool/tool/ardublock-all.jar`
4. Start the Arduino IDE and find ArduBlock under the Tool menu

## Developers
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<groupId>org.ardublock</groupId>
<artifactId>ardublock</artifactId>
<packaging>jar</packaging>
<version>2.1.1-SNAPSHOT</version>
<version>2.2.0-SNAPSHOT</version>
<name>ArduBlock</name>
<description>A Block Programming Language for Arduino</description>
<properties>
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/com/ardublock/ui/OpenblocksFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import com.ardublock.ui.listener.OpenblocksFrameListener;
import com.ardublock.ui.listener.SaveAsButtonListener;
import com.ardublock.ui.listener.SaveButtonListener;
import com.ardublock.ui.listener.EraseButtonListener;

import edu.mit.blocks.controller.WorkspaceController;
import edu.mit.blocks.workspace.Workspace;
Expand Down Expand Up @@ -168,8 +169,13 @@ public void actionPerformed(ActionEvent e) {
}
}
});

JButton eraseProgramButton = new JButton(uiMessageBundle.getString("ardublock.ui.erase"));
eraseProgramButton.addActionListener(new EraseButtonListener(this, context));

JLabel versionLabel = new JLabel("v " + uiMessageBundle.getString("ardublock.ui.version"));

bottomPanel.add(eraseProgramButton);
bottomPanel.add(saveImageButton);
bottomPanel.add(websiteButton);
bottomPanel.add(versionLabel);
Expand Down
50 changes: 50 additions & 0 deletions src/main/java/com/ardublock/ui/listener/EraseButtonListener.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package com.ardublock.ui.listener;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ResourceBundle;

import javax.swing.JFrame;

import com.ardublock.core.Context;
import com.ardublock.translator.AutoFormat;

import edu.mit.blocks.workspace.Workspace;

public class EraseButtonListener implements ActionListener
{
private JFrame parentFrame;
private Context context;
private Workspace workspace;
private ResourceBundle uiMessageBundle;

public EraseButtonListener(JFrame frame, Context context)
{
this.parentFrame = frame;
this.context = context;
workspace = context.getWorkspaceController().getWorkspace();
uiMessageBundle = ResourceBundle.getBundle("com/ardublock/block/ardublock");
}

public void actionPerformed(ActionEvent e)
{
AutoFormat formatter = new AutoFormat();
String codeOut = "void setup() {\n"
+ "// put your setup code here, to run once:\n\n"
+ "}\n\n"
+ "void loop() {\n"
+ "// put your main code here, to run repeatedly:\n\n"
+ "}";

if (context.isNeedAutoFormat)
{
codeOut = formatter.format(codeOut);
}

if (!context.isInArduino())
{
System.out.println(codeOut);
}
context.didGenerate(codeOut);
}
}
3 changes: 2 additions & 1 deletion src/main/resources/com/ardublock/block/ardublock.properties
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,7 @@ ardublock.ui.save=Save
ardublock.ui.saveAs=Save As
ardublock.ui.load=Open
ardublock.ui.upload=Upload to Arduino
ardublock.ui.erase=Erase Arduino Program
ardublock.ui.clone=Clone
ardublock.ui.add_comment=Add Comment
ardublock.ui.delete_comment=Delete Comment
Expand All @@ -438,7 +439,7 @@ ardublock.ui.create_refer=create reference
ardublock.ui.website=Go to Web Site
ardublock.ui.serialMonitor=Serial Monitor
ardublock.ui.saveImage=Save as image...
ardublock.ui.version=2.1.1
ardublock.ui.version=2.2.0

ardublock.error_msg.digital_var_slot=Digital variable slot must take a 'digital variable' name.\nHint: Look at the 'variable' socket on the highlighted block
ardublock.error_msg.number_var_slot=Standard variable slot must take a standard 'numeric' variable name.\nHint: Look at the 'variable' socket on the highlighted block
Expand Down

0 comments on commit e146a13

Please sign in to comment.