mirror of
https://github.com/processing/processing4.git
synced 2026-05-06 19:06:19 +02:00
Merge branch 'master' of https://github.com/processing/processing.git
This commit is contained in:
@@ -1009,9 +1009,6 @@ public abstract class Editor extends JFrame implements RunnerListener {
|
||||
addToolMenuItem(menu, "processing.app.tools.Archiver");
|
||||
|
||||
if (Base.isMacOS()) {
|
||||
if (SerialFixer.isNeeded()) {
|
||||
addToolMenuItem(menu, "processing.app.tools.SerialFixer");
|
||||
}
|
||||
addToolMenuItem(menu, "processing.app.tools.InstallCommander");
|
||||
}
|
||||
|
||||
|
||||
@@ -1,89 +0,0 @@
|
||||
/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
|
||||
|
||||
/*
|
||||
Part of the Processing project - http://processing.org
|
||||
|
||||
Copyright (c) 2012 The Processing Foundation
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, version 2.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
package processing.app.tools;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
import processing.app.Base;
|
||||
import processing.app.Editor;
|
||||
import processing.core.PApplet;
|
||||
|
||||
|
||||
public class SerialFixer implements Tool {
|
||||
Editor editor;
|
||||
|
||||
|
||||
public String getMenuTitle() {
|
||||
return "Fix the Serial Library";
|
||||
}
|
||||
|
||||
|
||||
public void init(Editor editor) {
|
||||
this.editor = editor;
|
||||
}
|
||||
|
||||
|
||||
public void run() {
|
||||
final String primary =
|
||||
"Attempt to fix common serial port problems?";
|
||||
final String secondary =
|
||||
"Click “OK” to perform additional installation steps to enable " +
|
||||
"the Serial library. An administrator password will be required.";
|
||||
|
||||
int result =
|
||||
JOptionPane.showConfirmDialog(editor,
|
||||
"<html> " +
|
||||
"<head> <style type=\"text/css\">"+
|
||||
"b { font: 13pt \"Lucida Grande\" }"+
|
||||
"p { font: 11pt \"Lucida Grande\"; margin-top: 8px }"+
|
||||
"</style> </head>" +
|
||||
"<b>" + primary + "</b>" +
|
||||
"<p>" + secondary + "</p>",
|
||||
"Commander",
|
||||
JOptionPane.OK_CANCEL_OPTION,
|
||||
JOptionPane.QUESTION_MESSAGE);
|
||||
|
||||
if (result == JOptionPane.OK_OPTION) {
|
||||
String shellScript = "mkdir -p /var/lock && chmod 777 /var/lock";
|
||||
String appleScript =
|
||||
"do shell script \"" + shellScript + "\" with administrator privileges";
|
||||
PApplet.exec(new String[] { "osascript", "-e", appleScript });
|
||||
}
|
||||
editor.statusNotice("Finished.");
|
||||
}
|
||||
|
||||
|
||||
static public boolean isNeeded() {
|
||||
if (Base.isMacOS()) {
|
||||
File lockFolder = new File("/var/lock");
|
||||
if (!lockFolder.exists() ||
|
||||
!lockFolder.canRead() ||
|
||||
!lockFolder.canWrite() ||
|
||||
!lockFolder.canExecute()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1066,7 +1066,7 @@
|
||||
<arg line="everything -type f -exec rm -rf {} ';'" />
|
||||
</exec>
|
||||
|
||||
<javadoc access="public" author="false" classpath="../java/libraries/video/library/jna.jar:../java/libraries/serial/bin:lib/antlr.jar:../core/library/jogl-all.jar:../java/libraries/video/bin:lib/apple.jar:lib/jna.jar:lib/ant-launcher.jar:../java/libraries/pdf/bin:lib/ant.jar:../core/bin:../java/libraries/pdf/library/itext.jar:../java/libraries/video/library/gstreamer-java.jar:lib/org-netbeans-swing-outline.jar:../java/libraries/dxf/bin:bin:../java/libraries/net/bin:../java/libraries/serial/library/RXTXcomm.jar:../core/library/gluegen-rt.jar:${java.home}/lib/tools.jar" destdir="javadoc/everything" nodeprecated="false" nodeprecatedlist="false" noindex="false" nonavbar="false" notree="false" source="1.6" splitindex="false" use="false" version="false" noqualifier="all">
|
||||
<javadoc access="public" author="false" classpath="../java/libraries/video/library/jna.jar:../java/libraries/serial/bin:lib/antlr.jar:../core/library/jogl-all.jar:../java/libraries/video/bin:lib/apple.jar:lib/jna.jar:lib/ant-launcher.jar:../java/libraries/pdf/bin:lib/ant.jar:../core/bin:../java/libraries/pdf/library/itext.jar:../java/libraries/video/library/gstreamer-java.jar:lib/org-netbeans-swing-outline.jar:../java/libraries/dxf/bin:bin:../java/libraries/net/bin:../java/libraries/serial/library/jssc.jar:../core/library/gluegen-rt.jar:${java.home}/lib/tools.jar" destdir="javadoc/everything" nodeprecated="false" nodeprecatedlist="false" noindex="false" nonavbar="false" notree="false" source="1.6" splitindex="false" use="false" version="false" noqualifier="all">
|
||||
|
||||
<arg value="-notimestamp" />
|
||||
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
serial.jar
|
||||
@@ -1 +1,4 @@
|
||||
This is using a modified version of Java Simple Serial Connector by Alexey Sokolov. See https://github.com/gohai/java-simple-serial-connector for details on the modifications.
|
||||
|
||||
To compile the C++ portion of the library on OS X:
|
||||
g++ -shared [or: -dynamiclib?] -arch i386 -arch x86_64 -I/System/Library/Frameworks/IOKit.framework/Versions/A/Headers -I$JAVA_HOME/include -I$JAVA_HOME/include/darwin -framework IOKit -framework CoreFoundation -o libjSSC-2.6.jnilib jssc.cpp
|
||||
|
||||
@@ -186,8 +186,6 @@ public class Serial implements SerialPortEventListener {
|
||||
|
||||
|
||||
public static Map<String, String> getProperties(String portName) {
|
||||
//SerialPortList list = new SerialPortList();
|
||||
//return list.getPortProperties(portName);
|
||||
return SerialPortList.getPortProperties(portName);
|
||||
}
|
||||
|
||||
@@ -214,8 +212,6 @@ public class Serial implements SerialPortEventListener {
|
||||
public static String[] list() {
|
||||
// returns list sorted alphabetically, thus cu.* comes before tty.*
|
||||
// this was different with RXTX
|
||||
//SerialPortList list = new SerialPortList();
|
||||
//return list.getPortNames();
|
||||
return SerialPortList.getPortNames();
|
||||
}
|
||||
|
||||
@@ -457,4 +453,4 @@ public class Serial implements SerialPortEventListener {
|
||||
throw new RuntimeException("Error writing to serial port " + e.getPortName() + ": " + e.getExceptionType());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user