Skip to content

Commit

Permalink
Merge branch 'master' into Separate-GUI-better
Browse files Browse the repository at this point in the history
  • Loading branch information
i-make-robots committed Feb 21, 2025
2 parents f84a3da + 56953dc commit 3eb36b5
Show file tree
Hide file tree
Showing 5 changed files with 125 additions and 44 deletions.
38 changes: 38 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Description

Please include a summary of the changes and the related issue. Please also include relevant motivation and context. List any dependencies that are required for this change.

Fixes # (issue)

## Type of change

Please delete options that are not relevant.

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] This change requires a documentation update

# How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

- [ ] Test A
- [ ] Test B

**Test Configuration**:
* Firmware version:
* Hardware:
* Toolchain:
* SDK:

# Checklist:

- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged and published in downstream modules
76 changes: 38 additions & 38 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,38 @@ jobs:
- name: Package with Maven
run: ./mvnw -B clean package -DskipTests

- name: Check files 1
run: ls -l src/main/package/

- name: Prepare universal package
shell: bash
run: |
mkdir -p target/universal-package &&
cp src/main/package/*.bat target/universal-package/ &&
cp src/main/package/start* target/universal-package/ &&
cp src/main/package/thankyou.* target/universal-package/ &&
cp CONTRIBUTING.md target/universal-package/ &&
cp LICENSE target/universal-package/ &&
cp README.md target/universal-package/ &&
cp target/Makelangelo-*-with-dependencies.jar target/universal-package/ &&
cd target/universal-package/ &&
7z a -tzip Makelangelo.zip . &&
mv Makelangelo.zip ../..
# - name: Check files 1
# run: ls -l src/main/package/

# - name: Prepare universal package
# shell: bash
# run: |
# mkdir -p target/universal-package &&
# cp src/main/package/*.bat target/universal-package/ &&
# cp src/main/package/start* target/universal-package/ &&
# cp src/main/package/thankyou.* target/universal-package/ &&
# cp CONTRIBUTING.md target/universal-package/ &&
# cp LICENSE target/universal-package/ &&
# cp README.md target/universal-package/ &&
# cp target/Makelangelo-*-with-dependencies.jar target/universal-package/ &&
# cd target/universal-package/ &&
# 7z a -tzip Makelangelo.zip . &&
# mv Makelangelo.zip ../..

# - name: Check files 2a
# run: ls -l target/universal-package/

# - name: Deploy universal release
# if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main')
# uses: WebFreak001/[email protected]
# with:
# token: ${{ secrets.GITHUB_TOKEN }} # automatically provided by github actions
# upload_url: ${{ env.UPLOAD_URL }}
# release_id: ${{ env.RELEASE_ID }}
# asset_path: Makelangelo.zip # path to archive to upload
# asset_name: Makelangelo-nightly-$$.zip # name to upload the release as, use $$ to insert date (YYYYMMDD) and 6 letter commit hash
# asset_content_type: application/zip # required by GitHub API
# max_releases: 1 # optional, if there are more releases than this matching the asset_name, the oldest ones are going to be deleted

- name: Prepare target/package for upload
shell: bash
Expand All @@ -60,23 +75,8 @@ jobs:
cp LICENSE target/package/ &&
cp README.md target/package/
- name: Check files 2a
run: ls -l target/universal-package/

- name: Check files 2b
run: ls -l target/package/

- name: Deploy universal release
if: github.repository == 'MarginallyClever/Makelangelo-software' && github.ref == 'refs/heads/master'
uses: WebFreak001/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }} # automatically provided by github actions
upload_url: ${{ env.UPLOAD_URL }}
release_id: ${{ env.RELEASE_ID }}
asset_path: Makelangelo.zip # path to archive to upload
asset_name: Makelangelo-nightly-$$.zip # name to upload the release as, use $$ to insert date (YYYYMMDD) and 6 letter commit hash
asset_content_type: application/zip # required by GitHub API
max_releases: 1 # optional, if there are more releases than this matching the asset_name, the oldest ones are going to be deleted
# - name: Check files 2b
# run: ls -l target/package/

- name: Upload artifact for package
uses: actions/[email protected]
Expand All @@ -90,8 +90,8 @@ jobs:
README
target/package/*
- name: Check files 3
run: ls -l target/universal-package/
# - name: Check files 3
# run: ls -l target/universal-package/

package:
needs: build
Expand All @@ -109,8 +109,8 @@ jobs:
with:
name: jar

- name: Check files 4
run: ls -l target/package/
# - name: Check files 4
# run: ls -l target/package/

- name: Build installation package
shell: bash
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ It pairs really well with Marlin-polargraph, the code in the brain of the robot
<scope>compile</scope>
</dependency>

<!-- dockable windows -->
<!-- docking windows -->
<dependency>
<groupId>io.github.andrewauclair</groupId>
<artifactId>modern-docking-api</artifactId>
Expand Down Expand Up @@ -570,7 +570,7 @@ It pairs really well with Marlin-polargraph, the code in the brain of the robot
-->
<groupId>com.github.marginallyclever</groupId>
<artifactId>nodegraphcore</artifactId>
<version>1.3.3</version>
<version>1.3.4</version>
</dependency>
<dependency>
<!--
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,18 @@ public static List<FileNameExtensionFilter> getSaveExtensions() {
public static void save(Turtle turtle,String filename, PlotterSettings settings) throws Exception {
if(filename == null || filename.trim().isEmpty()) throw new InvalidParameterException("filename cannot be empty");

String extension = filename.substring(filename.lastIndexOf("."));
if(extension.isEmpty()) throw new InvalidParameterException("filename must have an extension");

for (TurtleSaver saver : savers) {
if(isValidExtension(filename,saver.getFileNameFilter())) {
try (FileOutputStream out = new FileOutputStream(filename)) {
saver.save(out, turtle,settings);
return;
}
return;
}
}
String extension = filename.substring(filename.lastIndexOf("."));

throw new Exception("TurtleFactory could not save '"+filename+"' : invalid file format '" + extension + "'");
}
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
package com.marginallyclever.makelangelo.donatelloimpl;

import com.marginallyclever.makelangelo.donatelloimpl.nodes.turtle.LoadTurtle;
import com.marginallyclever.makelangelo.donatelloimpl.nodes.turtle.SaveTurtle;
import com.marginallyclever.makelangelo.donatelloimpl.nodes.turtle.TurtleDAO4JSON;
import com.marginallyclever.makelangelo.turtle.Turtle;
import com.marginallyclever.nodegraphcore.Connection;
import com.marginallyclever.nodegraphcore.DAO4JSONFactory;
import com.marginallyclever.nodegraphcore.port.*;
import com.marginallyclever.nodegraphcore.Graph;
import com.marginallyclever.nodegraphcore.NodeFactory;
import com.marginallyclever.nodegraphcore.port.Input;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.File;
import java.io.IOException;

import static org.junit.jupiter.api.Assertions.*;

/**
Expand All @@ -22,7 +28,7 @@
public class TestNodeGraphMakelangelo {
private static final Logger logger = LoggerFactory.getLogger(TestNodeGraphMakelangelo.class);

private static Graph model = new Graph();
private static final Graph model = new Graph();

@BeforeAll
public static void beforeAll() throws Exception {
Expand Down Expand Up @@ -81,4 +87,38 @@ public void testTurtleDAO() {
Turtle r2=dao.fromJSON(dao.toJSON(r1));
assertEquals(r1,r2);
}

/**
* Create a donatello panel;
* connect a LoadTurtle node and a SaveTurtle node;
* load a test file;
* save the test file;
* confirm the test file was saved.
*/
@Test
public void testLoadAndSaveTurtle() throws IOException {
Graph graph = new Graph();

// Create and connect LoadTurtle and SaveTurtle nodes
LoadTurtle loadNode = new LoadTurtle();
SaveTurtle saveNode = new SaveTurtle();
graph.add(loadNode);
graph.add(saveNode);
graph.add(new Connection(loadNode,1, saveNode,1));

// get a filename for a non-existent temporary file
File tempFile = File.createTempFile("testTurtle", ".dxf");
tempFile.deleteOnExit();
String tempFilename = tempFile.getAbsolutePath();

// Load a test file
loadNode.getPort("filename").setValue("src/test/resources/dxf/circle.dxf");
saveNode.getPort("filename").setValue(tempFilename);
loadNode.update();
saveNode.update();

// confirm the file saved.
assertTrue(tempFile.exists());
assert(tempFile.length()>0);
}
}

0 comments on commit 3eb36b5

Please sign in to comment.