Giter VIP home page Giter VIP logo

mylibrelab / mylibrelab Goto Github PK

View Code? Open in Web Editor NEW
31.0 9.0 8.0 49.95 MB

MyLibreLab is a desktop visual programming environment for controlling and communicating with microcontrollers and microprocessors.

Home Page: https://discord.gg/RcvVUxt

License: GNU General Public License v3.0

Batchfile 10.08% Shell 0.01% Java 86.18% HTML 0.09% Python 0.05% C++ 1.02% C 0.12% VBA 0.06% Pascal 0.03% Kotlin 2.36%
myopenlab desktop-application visual-programming dataflow-programming microcontroller-programming microprocessor-lab arduino raspberry-pi java linux

mylibrelab's Introduction

MyLibreLab

This is a fork of MyOpenLab, which became unmaintained in 2020. The original sources were gathered from https://sourceforge.net/p/myopenlab3/code/HEAD/tree/.

MyLibreLab is currently under heavy development (early alpha stage), and it's not yet functional. If you are looking for a fully functional and stable version, check out original archived MyOpenLab.

Differences to MyOpenLab

  • Provides self-contained distribution. No need to install any Java distribution any more.
  • Built using modern Java 15 technology
  • Maintained on GitHub

Manual installation:

  1. Clone MyLibreLab:
git clone https://github.com/MyLibreLab/MyLibreLab.git
  1. Run with gradle:
cd MyLibreLab
./gradlew run

User documentation

User docs link

Code Setup

Java Development Kit 15

A working Java 15 installation is required. In the command line (terminal in Linux, cmd in Windows) run javac -version and make sure that the reported version is Java 15 (e.g javac 15). If javac is not found or a wrong version is reported, check your PATH environment variable, your JAVA_HOME environment variable or install the most recent JDK.

Download the JDK from https://jdk.java.net/. On Windows, you can execute choco install openjdk (requires installation of chocolatey - a package manager for Windows).

mylibrelab's People

Contributors

alehel avatar foadsf avatar homerjsimpson05 avatar jha-vineet69 avatar koppor avatar lordribblesdale avatar marko-radosavljevic avatar masven avatar myopenlab avatar s0hanian avatar stephen-ai avatar weisj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mylibrelab's Issues

Patch info.plist on macOS for distribution

Darklaf supports automatic darkmode detection on Widows and macOS. However for it to reliably work on macOS the applications info.plist file needs to contain

NSRequiresAquaSystemAppearance = false

as an entry. Jpackage provides a way to provide a custom info.plist file.
This needs to be configured through gradle. Also we should dynamically populate the values of the provided info.plist to stay up to date with the project name and version number.

In the distribution are two info.plist files. One for the runtime and one for the application. I currently don't know which one needs to be patched.

Create settings panel

Create a settings panel which is populates by generated views for SettingsContainers by providing a generic ViewProviderFor<SettingsContainer>. Some settings may need more specific specialized views which can simply be provided with a more specific ViewProviderFor<T>.

Fix setName of Port

Fix the quick hack at a3a5084.

-            serialPort.setName(dis.readUTF());
+
+            //serialPort.setName(dis.readUTF());

It seems that the SerialPort object was patched.

Think, we can introduce a Map here storing the name internally in VserialPort

Fix exception handling

There are many unhandled exceptions in the codebase. Both the empty catch blocks and prints to System.out.
We want every exception handled and logged with tinylog.Logger.

For example, this regex: ^(?!\/\/|\/\*).*catch\s*(?:\([^)]*\))*\s*\{\s*(?:(?:\/\/|\/\*).*(\*\/)?\s*)*\} will match every empty catch block (there are 24 of them).

Every println() in a non-empty catch block should be changed to tinylog.Logger.err(). (Related to #7)
We should also catch specific exceptions instead of the more general ones. Catching Throwable should never be done, and catching Exception only if necessary (we can fix those in a separate issue/PR).

Edit: Added 7 commandments about exception handling:

  • Avoid empty catch blocks at all costs, if an empty catch block is intentional, make it clear with a comment.
  • Catch specific exceptions instead of the more general ones. Catching Throwable should never be done, and catching Exception only if necessary. If there is more than one expected exception, catch them all individually instead of using one Exception.
  • Close every resource with try-with-resources.
  • Avoiding null checks that will hide bugs. Fail fast. NullPointerException is much more preferred than method failing to execute silently. Do not catch NullPointerException.
  • When there is new exception being thrown inside the catch block, send the original (causal) exception with the new one. More precisely, constructor Exception(String message, Throwable cause).
  • Every exception should have a message describing what caused it.

Migrate old view components to module system

We need to convert the old components to the new module system.
A module consists of three parts:

  • The module itself which inherits from DefaultApplicationModule.
  • The view for the module which is created using a ViewProviderFor<T> where T is the type of the module.
  • The model associated with the module. Not all modules necessary have specific models. The model is provided to the view by exposing it through the module.

A (probably incomplete) list of components which need to be converted is:

  • Projects view
  • Property editor
  • Element documentation
  • Elements selection panel
  • Editor
  • Datatype legend
  • Variable watcher
  • Numeric graph
  • Digital graph
  • Testpoint view
  • Error log

Convert icons to svg

Currently icons are either 16x16 or 24x24. For high resolution screens this isn’t an appropriate resolution anymore. Replacing the current icons with svg version solves this issue and will allow us to move further with updating the look and feel (more context as soon as I get the the laf integrated).

All currently used icons are located at resources/Bilder. Some images are available multiple times with different resolutions. They will only be replaced once of course.

Also some of those icons need to be renamed to have a more descriptive name. For some I don’t even know what they depict or used for so that needs to be investigated beforehand.

Generally I think we should aim for a more modern/flat design for the icons, similar to those of IntelliJ.
Note: The IntelliJ icons are available as svg versions to download and are compatible with our license, so we should be fine to use them. A list of all icons can be found here

Translate all non-English words to English

We need to remove all non-English words from the codebase.
For example: public void amRasterAusrichten() to public void alignToTheGrid()

I'm sure there are some great tools we can use to achieve this effortlessly, we don't need perfect translation at the moment, approximation is completely fine.

Implement api for application events.

Currently actions in the application are very tightly coupled to the ui implementation. We should implement an event bus like api to handle messaging between components (in the ui and abstract sense) of the application.

Capabilities:

  • Components should be able to subscribe to certain event types.
  • Components should be able to send events to certain event types.
  • Events are strongly typed both for senders and receivers.
  • Posting a notification should not deadlock the ui. Though Consumers of events are responsible for not blocking
    the event bus. (Maybe provide some api for background tasks that wraps the SwingWorker api).
  • Utility methods for binding to ui components e.g. buttons, menus etc.

Example situation:
We have an "action" button which when pressed causes something to happen.

// postNotification should only take events of type ButtonPressedEvent.
button.addActionListener(e -> EventBus.get(ACTION_BUTTON_PRESSED).postNotification(new ButtonPressedEvent(...));


// when #subscribe should take Consumer<ButtonPressedEvent>
// Somewhere else
EventBus.get(ACTION_BUTTON_PRESSED).subscribe(actionConsumer1, e -> doSomethingWithButtonPressedEvent(e));
// Again somewhere else
EventBus.get(ACTION_BUTTON_PRESSED).subscribe(actionConsumer2, e -> doSomethingElseWithButtonPressedEvent(e));

TODO until first release

Lists tasks Todo until a first release and a good place for new developers is established

Solution for Nashorn deprecation and removal from the JDK

Nashorn, which is used in the MyLibreLab code, is marked as deprecated in JDK 11 and was removed in JDK 15. Probably not a priority at this time as support for JDK 11 will last a couple of years, but we should probably discuss how to handle this.

Exception on project load

Sometimes a saved project can get corrupted, which sets selectedIndex in all combo boxes to a random value. Which, in turn, generates IllegalArgumentException and IndexOutOfBoundsException.

If this happens, the workaround is to create a new project and replicate the original state, or individually reselect every combo box.

Said behaviour is noticed on Firmata element (Firmata.loadFromStream() overwrites good values). I do not have steps to reproduce this issue currently.

Implement actions api

Provide an api to declare actions which will then be consumed by the GUI.
This is related to #67 by depending on it.

There are several places where actions can come up in the gui:

  • In the menubar.
  • In the toolbar.
  • (Implicitly as keyboard shortcuts)

Lets call them ActionViewType for now. I did put keyboard shortcuts into parenthesis because those could be realised by binding them to one of the other view types.

Additionally to the view types the actions serve they should be hierarchical structure with some sort of ActionGroup.
Grouping would then take into effect when constructing the menubar.

ActionGroups have the following properties:

  • A name
  • An optional description
  • An optional icon
  • An indicator whether they are enabled (e.g. a possible EditorActionGroup would be disabled if no project is loaded).

Additionally Actions have:

  • An optional key binding
  • Still an indicator whether they are enabled (e.g. undo/redo con only work if there is something to undo/redo).

Actions should be loaded through the service-loader.

Create proper model for project content.

We need to analyse how the current model works.
Currently the elements and the editor are (though not directly) tightly mangled. This is very undesirable when working with the project model on an abstract level (e.g. during simulation).

I haven't yet looked far into the current structure but I think we could work with something like this:

  • Each "element" is a node in a graph.
  • The nodes have controllers attached (those contain the logic for each node).
  • The nodes have some model object attached which describes the node (i.e. name, description, icon, # of pins etc.)

This is just a rough a outline and I am myself not fully satisfied with the approach as the node still holds too much information about the visual aspect (name, description and icon).

Feedback and thoughts appreciated.

Rewrite editor view

The editor view is probably the most difficult and work intensive part to rewrite.
Currently a graph approach is used. This I’d like to keep as it is the most intuitive approach. However the rendering code is a mess at this point.

We could use https://github.com/jgraph/jgraphx as a replacement.

Add Project interface and api

We need to determine how to handle "Projects" in the application.

Some questions to answer:

  • What information do we need to expose as an api?
  • How do we load/save projects?

Note: The project itself is not the model itself (The model is simply a property of the project).

I'll add some more thoughts in the future. Please feel invited to add anything you think needs to be considered when creating the Project api.

Don't depend on GUI-Builders for the interface.

Currently the GUI is build using the netbeans gui-builder which limits the choice of IDE for people working with the code.
Although the application will run fine in any other ide.

My proposition would be to slowly move the gui code away from gui-builders i.e. every time some view needs changes the
corresponding source file should be converted to be more humanly readable by rewriting the auto generated code.

Some preparatory steps to ensure consistency across the gui would be:

  • Provide utility methods for
    • common components
    • borders
    • insets and spacing
    • resource files i.e. text, icons etc.

I'll add more tasks when I start working on the gui and have gotten a better overview of what needs to be done.

Removing Windows style paths

There are some variables in the code with windows style paths that create an exception on *nix environments. It would be better to make them generalized and using the user's home folder to address them.

the most relevant one is
public static String elementPath = "C:\\Users\\velas\\Documents\\NetBeansProjects\\myoepnlab_source\\distribution\\Elements";

in FrameMain.java class which creates an exception in startup.

Fix all dependencies

After removing every *.jar file from the codebase, we have to find replacements.

Main ones would be:

List of all *jars that are removed:

AbsoluteLayout.jar
CElement.jar
DistributionStarter.jar
Firmata.jar
Gauge_JV.jar
Horizontal_Pipe_JV.jar
InitSerialCOM.jar
Java3DRobot.jar
java-simple-serial-connector-2.8.0.jar
jay.jar
jFuzzyLogic_1_2_1.jar
jna-4.2.2.jar
jna.jar
jna-platform-4.2.2.jar
json-20140107.jar
jssc-2.8.0-arduino1.jar
junit.jar
myopenlab.jar
MyTableEditor.jar
pi4j-core.jar
pi4j-core-javadoc.jar
pi4j-core-sources.jar
pi4j-device.jar
pi4j-device-javadoc.jar
pi4j-device-sources.jar
pi4j-example.jar
pi4j-example-javadoc.jar
pi4j-example-sources.jar
pi4j-gpio-extension.jar
pi4j-gpio-extension-javadoc.jar
pi4j-gpio-extension-sources.jar
pi4j-service.jar
pi4j-service-javadoc.jar
pi4j-service-sources.jar
Read_DI_RPI_JV.jar
Read_RPI_Temp_JV.jar
RobotSimulator3D.jar
RobotSimulatorI.jar
RXTXcomm.jar
SerialPort_Transaction_JV.jar
Set_DI_RPI_JV.jar
Set_DO_RPI_JV.jar
Socket_GET_JV.jar
SrtFcn_JV.jar
SteelSeries-3.9.13.jar
svgSalamander-tiny.jar
swing-layout-1.0.1.jar
swing-layout-1.0.4.jar
swing-layout-1.0.jar
vecmath.jar
Write_DO_RPI_JV.jar
List of all *.jars that are removed, full paths with duplicates, unsorted (click)
./pi4j-1.0/lib/pi4j-device-sources.jar
./pi4j-1.0/lib/pi4j-service-javadoc.jar
./pi4j-1.0/lib/pi4j-service-sources.jar
./pi4j-1.0/lib/pi4j-gpio-extension-sources.jar
./pi4j-1.0/lib/pi4j-example.jar
./pi4j-1.0/lib/junit.jar
./pi4j-1.0/lib/pi4j-example-javadoc.jar
./pi4j-1.0/lib/pi4j-gpio-extension-javadoc.jar
./pi4j-1.0/lib/pi4j-device.jar
./pi4j-1.0/lib/pi4j-core.jar
./pi4j-1.0/lib/pi4j-device-javadoc.jar
./pi4j-1.0/lib/pi4j-gpio-extension.jar
./pi4j-1.0/lib/pi4j-core-javadoc.jar
./pi4j-1.0/lib/pi4j-example-sources.jar
./pi4j-1.0/lib/pi4j-service.jar
./pi4j-1.0/lib/pi4j-core-sources.jar
./myopenlab.jar
./jssc/jssc-2.8.0-arduino1.jar
./distribution/lib_win_32/RXTXcomm.jar
./distribution/lib_arm_64/RXTXcomm.jar
./distribution/lib_mac_64/RXTXcomm.jar
./distribution/myopenlab.jar
./distribution/lib_deb_64/RXTXcomm.jar
./distribution/lib_win_64/RXTXcomm.jar
./distribution/Elements/tools/jay.jar
./distribution/Elements/FrontElements/2Robotics/RobotCanvas/bin/RobotSimulatorI.jar
./distribution/Elements/FrontElements/2Robotics/RobotCanvas/bin/lib/swing-layout-1.0.1.jar
./distribution/Elements/FrontElements/2Robotics/RobotCanvas/bin/lib/swing-layout-1.0.jar
./distribution/Elements/FrontElements/2Robotics/RobotArm3D_1_0/bin/Java3DRobot.jar
./distribution/Elements/FrontElements/2Robotics/RobotCanvas_1_1/bin/RobotSimulatorI.jar
./distribution/Elements/FrontElements/2Robotics/RobotCanvas_1_1/bin/lib/swing-layout-1.0.1.jar
./distribution/Elements/FrontElements/2Robotics/SimpleRobot3D/bin/RobotSimulator3D.jar
./distribution/Elements/FrontElements/2Numerisch/Gauge_JV/bin/Gauge_JV.jar
./distribution/Elements/FrontElements/2Numerisch/Gauge2/bin/Gauge_JV.jar
./distribution/Elements/FrontElements/2Automation/Pipeline_JV/Horizontal_Pipe_JV/bin/Horizontal_Pipe_JV.jar
./distribution/Elements/FrontElements/Version_2_0/Output/Oscilloscope_3_0/bin/lib/swing-layout-1.0.jar
./distribution/Elements/FrontElements/Version_2_0/Output/OscilloscopeXY/bin/lib/swing-layout-1.0.jar
./distribution/Elements/FrontElements/2Dekoratoren/SVGSalamanderImage/bin/svgSalamander-tiny.jar
./distribution/Elements/CircuitElements/Pins/InputPin/bin/CElement.jar
./distribution/Elements/CircuitElements/Pins/OutputPin/bin/CElement.jar
./distribution/Elements/CircuitElements/Automation/FuzzyControl/bin/jFuzzyLogic_1_2_1.jar
./distribution/Elements/CircuitElements/String/StrFcn_JV/bin/SrtFcn_JV.jar
./distribution/Elements/CircuitElements/Interface/Socket_GET_JV/bin/Socket_GET_JV.jar
./distribution/Elements/CircuitElements/Interface/SerialCOM_JV/SerialPort_Transaction_JV/bin/SerialPort_Transaction_JV.jar
./distribution/Elements/CircuitElements/Interface/SerialCOM_JV/SerialPort_Transaction_JV/bin/lib/jssc-2.8.0-arduino1.jar
./distribution/Elements/CircuitElements/Interface/SerialCOM_JV/Read_SerialPort_JV/bin/lib/jssc-2.8.0-arduino1.jar
./distribution/Elements/CircuitElements/Interface/SerialCOM_JV/Print_SerialPort_JV/bin/lib/jssc-2.8.0-arduino1.jar
./distribution/Elements/CircuitElements/Interface/SerialCOM_JV/Get_Bytes_at_Port_JV/bin/lib/jssc-2.8.0-arduino1.jar
./distribution/Elements/CircuitElements/Interface/SerialCOM_JV/InitSerialCOM/bin/InitSerialCOM.jar
./distribution/Elements/CircuitElements/Interface/SerialCOM_JV/InitSerialCOM/bin/lib/java-simple-serial-connector-2.8.0.jar
./distribution/Elements/CircuitElements/Interface/Firmata/bin/Firmata.jar
./distribution/Elements/CircuitElements/Interface/Raspberry_JV/Read_DI_RPI_JV/bin/Read_DI_RPI_JV.jar
./distribution/Elements/CircuitElements/Interface/Raspberry_JV/Set_DI_RPI_JV/bin/Set_DI_RPI_JV.jar
./distribution/Elements/CircuitElements/Interface/Raspberry_JV/Read_RPI_Temp_JV/bin/Read_RPI_Temp_JV.jar
./distribution/Elements/CircuitElements/Interface/Raspberry_JV/Write_DO_RPI_JV/bin/Write_DO_RPI_JV.jar
./distribution/Elements/CircuitElements/Interface/Raspberry_JV/Set_DO_RPI_JV/bin/Set_DO_RPI_JV.jar
./distribution/Elements/CircuitElements/MCU/StackInterpreter/old/InputPin/bin/CElement.jar
./distribution/Elements/CircuitElements/MCU/StackInterpreter/old/OutputPin/bin/CElement.jar
./distribution/Elements/CircuitElements/VectorenMatrix/VectorString/bin/MyTableEditor.jar
./distribution/Elements/CircuitElements/VectorenMatrix/VectorString/bin/lib/swing-layout-1.0.1.jar
./distribution/Elements/CircuitElements/VectorenMatrix/VectorByte/bin/MyTableEditor.jar
./distribution/Elements/CircuitElements/VectorenMatrix/VectorByte/bin/lib/swing-layout-1.0.1.jar
./distribution/Elements/CircuitElements/VectorenMatrix/VectorDouble/bin/MyTableEditor.jar
./distribution/Elements/CircuitElements/VectorenMatrix/VectorDouble/bin/lib/swing-layout-1.0.1.jar
./distribution/Elements/CircuitElements/VectorenMatrix/VectorInteger/bin/MyTableEditor.jar
./distribution/Elements/CircuitElements/VectorenMatrix/VectorInteger/bin/lib/swing-layout-1.0.1.jar
./distribution/Elements/Drivers/modusbus.CompuLab/bin/jna.jar
./distribution/Elements/Drivers/modusbus.CompuLab/lib/jna.jar
./distribution/Elements/Drivers/MyOpenLab.RS232/bin/RXTXcomm.jar
./distribution/Elements/Drivers/Velleman.K8047/bin/jna.jar
./distribution/Elements/Drivers/Velleman.K8055_v1.1/bin/jna.jar
./distribution/Elements/lib/swing-layout-1.0.jar
./distribution/DistributionStarter.jar
./distribution/lib_suse_64/RXTXcomm.jar
./distribution/lib/pi4j-device-sources.jar
./distribution/lib/AbsoluteLayout.jar
./distribution/lib/pi4j-service-javadoc.jar
./distribution/lib/pi4j-service-sources.jar
./distribution/lib/pi4j-gpio-extension-sources.jar
./distribution/lib/pi4j-example.jar
./distribution/lib/jna-platform-4.2.2.jar
./distribution/lib/jna-4.2.2.jar
./distribution/lib/junit.jar
./distribution/lib/pi4j-example-javadoc.jar
./distribution/lib/pi4j-gpio-extension-javadoc.jar
./distribution/lib/pi4j-device.jar
./distribution/lib/pi4j-core.jar
./distribution/lib/pi4j-device-javadoc.jar
./distribution/lib/swing-layout-1.0.4.jar
./distribution/lib/pi4j-gpio-extension.jar
./distribution/lib/pi4j-core-javadoc.jar
./distribution/lib/SteelSeries-3.9.13.jar
./distribution/lib/vecmath.jar
./distribution/lib/pi4j-example-sources.jar
./distribution/lib/pi4j-service.jar
./distribution/lib/pi4j-core-sources.jar
./distribution/lib/jssc-2.8.0-arduino1.jar
./distribution/lib/json-20140107.jar
./json-20140107.jar
./distribution/DistributionStarter.jar
./distribution/Elements/CircuitElements/Automation/FuzzyControl/bin/jFuzzyLogic_1_2_1.jar
./distribution/Elements/CircuitElements/Interface/Firmata/bin/Firmata.jar
./distribution/Elements/CircuitElements/Interface/Raspberry_JV/Read_DI_RPI_JV/bin/Read_DI_RPI_JV.jar
./distribution/Elements/CircuitElements/Interface/Raspberry_JV/Read_RPI_Temp_JV/bin/Read_RPI_Temp_JV.jar
./distribution/Elements/CircuitElements/Interface/Raspberry_JV/Set_DI_RPI_JV/bin/Set_DI_RPI_JV.jar
./distribution/Elements/CircuitElements/Interface/Raspberry_JV/Set_DO_RPI_JV/bin/Set_DO_RPI_JV.jar
./distribution/Elements/CircuitElements/Interface/Raspberry_JV/Write_DO_RPI_JV/bin/Write_DO_RPI_JV.jar
./distribution/Elements/CircuitElements/Interface/SerialCOM_JV/Get_Bytes_at_Port_JV/bin/lib/jssc-2.8.0-arduino1.jar
./distribution/Elements/CircuitElements/Interface/SerialCOM_JV/InitSerialCOM/bin/InitSerialCOM.jar
./distribution/Elements/CircuitElements/Interface/SerialCOM_JV/InitSerialCOM/bin/lib/java-simple-serial-connector-2.8.0.jar
./distribution/Elements/CircuitElements/Interface/SerialCOM_JV/Print_SerialPort_JV/bin/lib/jssc-2.8.0-arduino1.jar
./distribution/Elements/CircuitElements/Interface/SerialCOM_JV/Read_SerialPort_JV/bin/lib/jssc-2.8.0-arduino1.jar
./distribution/Elements/CircuitElements/Interface/SerialCOM_JV/SerialPort_Transaction_JV/bin/lib/jssc-2.8.0-arduino1.jar
./distribution/Elements/CircuitElements/Interface/SerialCOM_JV/SerialPort_Transaction_JV/bin/SerialPort_Transaction_JV.jar
./distribution/Elements/CircuitElements/Interface/Socket_GET_JV/bin/Socket_GET_JV.jar
./distribution/Elements/CircuitElements/MCU/StackInterpreter/old/InputPin/bin/CElement.jar
./distribution/Elements/CircuitElements/MCU/StackInterpreter/old/OutputPin/bin/CElement.jar
./distribution/Elements/CircuitElements/Pins/InputPin/bin/CElement.jar
./distribution/Elements/CircuitElements/Pins/OutputPin/bin/CElement.jar
./distribution/Elements/CircuitElements/String/StrFcn_JV/bin/SrtFcn_JV.jar
./distribution/Elements/CircuitElements/VectorenMatrix/VectorByte/bin/lib/swing-layout-1.0.1.jar
./distribution/Elements/CircuitElements/VectorenMatrix/VectorByte/bin/MyTableEditor.jar
./distribution/Elements/CircuitElements/VectorenMatrix/VectorDouble/bin/lib/swing-layout-1.0.1.jar
./distribution/Elements/CircuitElements/VectorenMatrix/VectorDouble/bin/MyTableEditor.jar
./distribution/Elements/CircuitElements/VectorenMatrix/VectorInteger/bin/lib/swing-layout-1.0.1.jar
./distribution/Elements/CircuitElements/VectorenMatrix/VectorInteger/bin/MyTableEditor.jar
./distribution/Elements/CircuitElements/VectorenMatrix/VectorString/bin/lib/swing-layout-1.0.1.jar
./distribution/Elements/CircuitElements/VectorenMatrix/VectorString/bin/MyTableEditor.jar
./distribution/Elements/Drivers/modusbus.CompuLab/bin/jna.jar
./distribution/Elements/Drivers/modusbus.CompuLab/lib/jna.jar
./distribution/Elements/Drivers/MyOpenLab.RS232/bin/RXTXcomm.jar
./distribution/Elements/Drivers/Velleman.K8047/bin/jna.jar
./distribution/Elements/Drivers/Velleman.K8055_v1.1/bin/jna.jar
./distribution/Elements/FrontElements/2Automation/Pipeline_JV/Horizontal_Pipe_JV/bin/Horizontal_Pipe_JV.jar
./distribution/Elements/FrontElements/2Dekoratoren/SVGSalamanderImage/bin/svgSalamander-tiny.jar
./distribution/Elements/FrontElements/2Numerisch/Gauge2/bin/Gauge_JV.jar
./distribution/Elements/FrontElements/2Numerisch/Gauge_JV/bin/Gauge_JV.jar
./distribution/Elements/FrontElements/2Robotics/RobotArm3D_1_0/bin/Java3DRobot.jar
./distribution/Elements/FrontElements/2Robotics/RobotCanvas_1_1/bin/lib/swing-layout-1.0.1.jar
./distribution/Elements/FrontElements/2Robotics/RobotCanvas_1_1/bin/RobotSimulatorI.jar
./distribution/Elements/FrontElements/2Robotics/RobotCanvas/bin/lib/swing-layout-1.0.1.jar
./distribution/Elements/FrontElements/2Robotics/RobotCanvas/bin/lib/swing-layout-1.0.jar
./distribution/Elements/FrontElements/2Robotics/RobotCanvas/bin/RobotSimulatorI.jar
./distribution/Elements/FrontElements/2Robotics/SimpleRobot3D/bin/RobotSimulator3D.jar
./distribution/Elements/FrontElements/Version_2_0/Output/Oscilloscope_3_0/bin/lib/swing-layout-1.0.jar
./distribution/Elements/FrontElements/Version_2_0/Output/OscilloscopeXY/bin/lib/swing-layout-1.0.jar
./distribution/Elements/lib/swing-layout-1.0.jar
./distribution/Elements/tools/jay.jar
./distribution/lib/AbsoluteLayout.jar
./distribution/lib_arm_64/RXTXcomm.jar
./distribution/lib_deb_64/RXTXcomm.jar
./distribution/lib/jna-4.2.2.jar
./distribution/lib/jna-platform-4.2.2.jar
./distribution/lib/json-20140107.jar
./distribution/lib/jssc-2.8.0-arduino1.jar
./distribution/lib/junit.jar
./distribution/lib_mac_64/RXTXcomm.jar
./distribution/lib/pi4j-core.jar
./distribution/lib/pi4j-core-javadoc.jar
./distribution/lib/pi4j-core-sources.jar
./distribution/lib/pi4j-device.jar
./distribution/lib/pi4j-device-javadoc.jar
./distribution/lib/pi4j-device-sources.jar
./distribution/lib/pi4j-example.jar
./distribution/lib/pi4j-example-javadoc.jar
./distribution/lib/pi4j-example-sources.jar
./distribution/lib/pi4j-gpio-extension.jar
./distribution/lib/pi4j-gpio-extension-javadoc.jar
./distribution/lib/pi4j-gpio-extension-sources.jar
./distribution/lib/pi4j-service.jar
./distribution/lib/pi4j-service-javadoc.jar
./distribution/lib/pi4j-service-sources.jar
./distribution/lib/SteelSeries-3.9.13.jar
./distribution/lib_suse_64/RXTXcomm.jar
./distribution/lib/swing-layout-1.0.4.jar
./distribution/lib/vecmath.jar
./distribution/lib_win_32/RXTXcomm.jar
./distribution/lib_win_64/RXTXcomm.jar
./distribution/myopenlab.jar
./json-20140107.jar
./jssc/jssc-2.8.0-arduino1.jar
./myopenlab.jar
./pi4j-1.0/lib/junit.jar
./pi4j-1.0/lib/pi4j-core.jar
./pi4j-1.0/lib/pi4j-core-javadoc.jar
./pi4j-1.0/lib/pi4j-core-sources.jar
./pi4j-1.0/lib/pi4j-device.jar
./pi4j-1.0/lib/pi4j-device-javadoc.jar
./pi4j-1.0/lib/pi4j-device-sources.jar
./pi4j-1.0/lib/pi4j-example.jar
./pi4j-1.0/lib/pi4j-example-javadoc.jar
./pi4j-1.0/lib/pi4j-example-sources.jar
./pi4j-1.0/lib/pi4j-gpio-extension.jar
./pi4j-1.0/lib/pi4j-gpio-extension-javadoc.jar
./pi4j-1.0/lib/pi4j-gpio-extension-sources.jar
./pi4j-1.0/lib/pi4j-service.jar
./pi4j-1.0/lib/pi4j-service-javadoc.jar
./pi4j-1.0/lib/pi4j-service-sources.jar

Limit elements positioning to left mouse button.

When moving elements one should only be able to do so using the left mouse button.
For example if one uses the right button to open the context menu and keeps the button pressed as soon as the
mouse leaves the menu the elements in the background makes a big jump.

Include "elements" folder properly

The elements folder contains .class files in the bin folder. This all needs to be restructured.

Options:

  • gradle multi-module build
  • move the .java files into the main application

Think, we should NOT do some plugin support. We should tightly integrate the available drivers/elements/... into the application. In case a cool developer wants to add some functionality, he can just create a pull request.

Thus, the second option should be tried as next step.

Update look and feel

Application GUI looks outdated, we should be able to make improvements by updating look & feel.

The "Close" option is written in German

When you click on File option inside the application, the option to "Close" the application is written in German as "schließen".
Given that rest of the application's options are in English, I think this should be translated to English too.
Screenshot

Use proper package hierarchy

Package names are a complete mess currently. We should move forward with creating all new source files in appropriate packages. The base package would be com.github.mylibrelab. To make transition easier and to have a quick overview of what parts of the application are still in the legacy state all current files should stay where they are; only newly created or completely refactored files should be moved.

NullPointerException and ClosedChannelException when opening and editing vlogic files

On Windows 10, using the latest changes from dev and JDK 11, I get a number of NullPointerExceptions and ClosedChannelExceptions when I open a vlogic file. This seems to happen regardless of which file I open. The two exceptions occur several times, but all seem to be the same problem.

Bellow is one of the NullPointerExceptions.

Couldn't create Element :java.lang.NullPointerException 2020-10-05 08:59:25 [SwingWorker-pool-1-thread-3] VisualLogic.Element.loadFromStream() ERROR: java.lang.NullPointerException at Peditor.PropertyEditor.addItem(PropertyEditor.java:1224) at VisualLogic.Element.jAddPEItem(Element.java:1677) at Const.setPropertyEditor(Const.java:111) at VisualLogic.Element.loadProperties(Element.java:878) at VisualLogic.Element.loadFromStream(Element.java:1042) at VisualLogic.VMObject.readElements(VMObject.java:3234) at VisualLogic.VMObject.loadFromStream(VMObject.java:3431) at VisualLogic.Basis.loadFromStream(Basis.java:1817) at VisualLogic.Basis.loadFile(Basis.java:1388) at VisualLogic.Basis.loadFromFile(Basis.java:1459) at VisualLogic.FrameMain.addBasisToVMPanel(FrameMain.java:1023) at VisualLogic.FrameMain$1.doInBackground(FrameMain.java:429) at java.desktop/javax.swing.SwingWorker$1.call(SwingWorker.java:304) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.desktop/javax.swing.SwingWorker.run(SwingWorker.java:343) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630) at java.base/java.lang.Thread.run(Thread.java:832) Error in Element.loadFromStream() :java.lang.NullPointerException

and bellow is one of the ClosedChannelExceptions:

java.io.IOException: Stream Closed 2020-10-05 08:59:26 [SwingWorker-pool-1-thread-3] SimpleFileSystem.FileSystemOutput.addIndexList() ERROR: java.nio.channels.ClosedChannelException at java.base/sun.nio.ch.FileChannelImpl.ensureOpen(FileChannelImpl.java:156) at java.base/sun.nio.ch.FileChannelImpl.position(FileChannelImpl.java:331) at SimpleFileSystem.FileSystemOutput.addIndexList(FileSystemOutput.java:99) at SimpleFileSystem.FileSystemOutput.close(FileSystemOutput.java:123) at VisualLogic.Basis.saveFile(Basis.java:1989) at VisualLogic.Basis.saveForUndoRedo(Basis.java:1491) at VisualLogic.FrameMain.XaddBasisToVMPanel(FrameMain.java:946) at VisualLogic.FrameMain.addBasisToVMPanel(FrameMain.java:1032) at VisualLogic.FrameMain$1.doInBackground(FrameMain.java:429) at java.desktop/javax.swing.SwingWorker$1.call(SwingWorker.java:304) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.desktop/javax.swing.SwingWorker.run(SwingWorker.java:343) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630) at java.base/java.lang.Thread.run(Thread.java:832)

I've attached a file with the entire stacktrace.
stacktrace.txt

I get the same ClosedChannelException if I attempt to add anything to the file, for instance an Oval.

I first discovered this yesterday when I cloned the project for the first time.

StringOutOfBoundsException error on macOS

Running the /distribution/start_macosx file on macOS I get the error:

Exception in thread "main" java.lang.StringOutOfBoundsException: begin 2, end 3, length2
              at java.base/java.lang.String.checkBoundsBeginEnd(String.java:3756)
              at java.base/java.lang.String.substring(String.java:1902)
              at VisualLogic.FrameMain.initApp(FrameMain.java:1112)
              at VisualLogic.FrameMain.(FrameMain.java:1538)
              at VisualLogic.FrameMain.main(FrameMain.java:2273)
               

also posted here on Reddit

Clean code, optimize and bugfixes

Hi! I've forked this repository to manage some (imho) problems and bugs.
Here there is my changes. Main changes are:

  • Some "for" changed into "for each", for code readability
  • Strings to StringBuilder (quicker access to strings, especially for longer ones)
  • Fix for "new Comparator()" used in some ArrayList sorting
  • Refactors to some methods, like this one, also for code readability

I'd like to hear some opinions before creating a first pull request.
Thanks in advance!

Firmata element not found

I'm trying to follow this tutorial, where on interfaces section

Screenshot 2020-04-19 at 20 07 03

we should see the Firmata

ezgif com-video-to-gif

but what I see is this

Screenshot 2020-04-19 at 20 07 14

and the block looks like

Screenshot 2020-04-19 at 20 07 48

trying to open an example, it says the block is not found:

Screenshot 2020-04-19 at 20 18 27

Handle dynamic internationalisation across the ui.

Although decoupling the logic/model from the gui improves maintainability it also proves to be a problem with internationalisation.

In a world where everything is contained in the class which is used as the visual representation one could do something like this:

public interface InternationalizedComponent {

    void localeChanged(final Locale newLocale);
}

public class SomeView extends SomeUIComponent implements InternationalizedComponent {
    
    @Override
    public void localeChanged(final Locale newLocale) {
        // Reload resource strings here and update ui components such as labels etc.
    }
}

However this isn't possible because in the direction which we are moving in some application parts aren't actually responsible for creating their view because they are just declarative containers with logic. (See actions in #68 or settings in #47 ).

We need to decide how we go forward with handling internationalisation. Some possible solutions:

  • Delegate methods like getName() directly to the resource bundle and update the views by calling getName() again.
    • Pro:
      • It's the easiest to implement.
    • Contra:
      • This is hostile to immutable objects such as PropertyValue in the settings-api (#47).
  • Return the resource identifier from getName() and load the resource string where it is used.
    • Pro:
      • Immutable objects can declare the identifier as their name.
      • Also very easy to implement.
    • Contra:
      • Suddenly the names are some magic identifier. If someone forgets that this is the case suddenly something like actions.undo.name pops up in the gui.
      • What if a a name isn't actually internationalised (or doesn't need to be). How do we distinguish "normal" strings from "message property" string. We could consider all strings with a "ref:" prefix to be a "message property" string, but this just adds even more indirection.
  • Introduce a Name class (class name W.I.P) which basically would be a Supplier<String>. Then do the same as in the first option, but getting the new value from the Name object.
    • Pro:
      • Solves the problems above.
      • A factory method such as InternationalizedName.fromProperty("actions.undo.name") does convey meaning on what it does.
      • Names which don't need localization can still declare a Locale independent Name property.
    • Contra:
      • More verbose.

Additionally it would be good to have some convenience components such as InternationalizedLabel, InternationalizedButton, InternationalizedCheckBox etc, whose labels are updated if the locale changes. (Depending on the implementation this could just be a matter of delegating to the Name property).

I would like some input on this matter. Any other options or pro/contra points for the options above which I missed are highly appreciated.

Liesmich.html not found

When selecting Help -> Info in the application, an error message appears stating that it cannot find the file Liesmich.html.
image
image
and the following stacktrace is shown,

2020-10-05 10:10:09 [AWT-EventQueue-0] VisualLogic.FrameInfo.()
ERROR: java.io.IOException: invalid url
at java.desktop/javax.swing.JEditorPane.setPage(JEditorPane.java:416)
at VisualLogic.FrameInfo.(FrameInfo.java:138)
at VisualLogic.FrameMain.showInfo(FrameMain.java:5341)
at VisualLogic.FrameMain.jmiInfoActionPerformed(FrameMain.java:5614)
at VisualLogic.FrameMain$98.actionPerformed(FrameMain.java:3449)
at java.desktop/javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1967)
at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2308)
at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:405)
at java.desktop/javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:262)
at java.desktop/javax.swing.AbstractButton.doClick(AbstractButton.java:369)
at java.desktop/javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1020)
at java.desktop/javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1064)
at java.desktop/java.awt.Component.processMouseEvent(Component.java:6636)
at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3342)
at java.desktop/java.awt.Component.processEvent(Component.java:6401)
at java.desktop/java.awt.Container.processEvent(Container.java:2263)
at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5012)
at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2321)
at java.desktop/java.awt.Component.dispatchEvent(Component.java:4844)
at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4919)
at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4548)
at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4489)
at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2307)
at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2764)
at java.desktop/java.awt.Component.dispatchEvent(Component.java:4844)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:772)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:95)
at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:745)
at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:743)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

As a result, the tab for the license shows an empty text box.

image

I propose that we fix this by including a file called license.txt which contains the GPL-3.0 license text.

Use one method of detecting which mouse button is pressed.

As far as I can tell, the code base currently uses three different methods of checking which mouse button has been pressed. Bellow is an example for each three.

StatusAddElement.java line 151

if (e.getButton() == MouseEvent.BUTTON3) {

StatusEditPathAddMode.java line 214

if (e.getButton() == e.BUTTON3) {

StatusGummiBandX.java line 151

if (e.getButton() == 3) {

I'd like to go through the code base and change any checks of mouse button clicks to use relevant SwingUtilities methods,

  • SwingUtilities.isLeftMouseButton(MouseEvent mouseEvent)
  • SwingUtilities.isMiddleMouseButton(MouseEvent mouseEvent)
  • SwingUtilities.isRightMouseButton(MouseEvent mouseEvent).

I believe this will improve the readability of the code. Is this a change others would approve of?

Migrate old actions to new action system

We need to migrate the current actions to the new actions system.
#88 provides an empty scaffold for all actions which are currently present in the application menu bar.

Here is a list of actions which need to be converted:

  • ShowRepositoryManagerAction
  • ShowSettingsAction
  • CopyAction
  • CutAction
  • PasteAction
  • RedoAction
  • UndoAction
  • SelectAllAction
  • OpenForumAction
  • OpenHomepageAction
  • OpenTutorialsAction
  • ReportBugAction
  • ShowApplicationInfoAction
  • NewProjectAction
  • OpenProjectAction
  • CloseAllVMsAction
  • ShowDatatypeLegendAction
  • ShowDigitalGraphAction
  • ShowErrorLogAction
  • ShowNumericGraphAction
  • ShowTestpointsActions
  • ShowVariableWatcherAction
  • PauseVMAction
  • ResumeVMAction
  • StartVMAction
  • StepVMAction
  • StopVMAction
  • EnableVMProtectionAction
  • DisableVMProtectionAction
  • CreateSubVMAction
  • DefineVMVariablesAction
  • ExportVMAction
  • OpenVMAction
  • PrintVMAction
  • SaveAsVMAction
  • SaveVMAction
  • ShowVMPropertiesAction
  • CreateJavaComponentAction
  • ExitAction

Implement api for observable properties

To make models unaware of their views we need provide some api surface for observing the state of an model object.

I imagine this api consisting of two parts:

  • An interface Observable which classes can implement to indicate they have observable state.
    • Observable exposes an observe(...) method which takes some sort of identifier for the observed value(s) and a callback for when the value changes.
  • Some generic ObservableProperty class with primitive versions to avoid boxing.
    • Maybe those take a reference to the observable class they are used in or they directly manage the list of listeners. This needs to be sorted out for the implementation.

Ideally I'd like the #observe method to provide some static checking that the identifier which is subscribed to actually exists in the class but haven't quite found a good solution.

Listeners should be kept as weak references to avoid having to unregister them.
This is important as using method references will make it impossible to remove the listener i.e.

SomeType value = new SomeType();
var list = new ArrayList<Function<SomeType, String>>();
list.add(value::toString);
list.remove(value::toString);
// list has still size 1.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.