From f12b2b45c316bee6cf91efb01b5ebce74e072008 Mon Sep 17 00:00:00 2001 From: benfry Date: Tue, 19 Nov 2002 08:03:38 +0000 Subject: [PATCH] message when running p5 for the first time and serial port sucks --- processing/app/PdeBase.java | 27 ++++++++++++++++++--------- processing/app/PdeEditor.java | 3 +++ 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/processing/app/PdeBase.java b/processing/app/PdeBase.java index fae968526..8dffdb454 100644 --- a/processing/app/PdeBase.java +++ b/processing/app/PdeBase.java @@ -22,6 +22,9 @@ public class PdeBase extends Frame implements ActionListener { protected RedoAction redoAction; protected UndoManager undo = new UndoManager(); + // indicator that this is the first time this feller has used p5 + static boolean firstTime; + boolean errorState; PdeEditor editor; @@ -297,7 +300,6 @@ public class PdeBase extends Frame implements ActionListener { //menu.addSeparator(); serialMenu = new Menu("Serial Port"); menu.add(serialMenu); - buildSerialMenu(); externalEditorItem = new CheckboxMenuItem("Use External Editor"); externalEditorItem.addItemListener(new ItemListener() { @@ -341,6 +343,7 @@ public class PdeBase extends Frame implements ActionListener { editor.frame = frame; // no longer really used editor.init(); rebuildSketchbookMenu(sketchbookMenu); + buildSerialMenu(); frame.show(); // added back in for pde } @@ -714,7 +717,7 @@ public class PdeBase extends Frame implements ActionListener { SerialMenuListener listener = new SerialMenuListener(); String defaultName = get("serial.port", "unspecified"); - //boolean found; + boolean problem = false; try { Enumeration portList = CommPortIdentifier.getPortIdentifiers(); @@ -733,18 +736,24 @@ public class PdeBase extends Frame implements ActionListener { } } } catch (UnsatisfiedLinkError e) { - e.printStackTrace(); - JOptionPane.showMessageDialog(frame, - "Serial port support not installed. " + - "Check the readme for instructions if you " + - "need to use the serial port", - "Serial Port Warning", - JOptionPane.WARNING_MESSAGE); + //e.printStackTrace(); + problem = true; } catch (Exception e) { System.out.println("exception building serial menu"); e.printStackTrace(); } + + // only warn them if this is the first time + //if (getInteger("window.x", 0) == 0) { + if (firstTime) { + JOptionPane.showMessageDialog(frame, + "Serial port support not installed.\n" + + "Check the readme for instructions if you " + + "need to use the serial port. ", + "Serial Port Warning", + JOptionPane.WARNING_MESSAGE); + } } diff --git a/processing/app/PdeEditor.java b/processing/app/PdeEditor.java index f471ba95a..0a5204354 100644 --- a/processing/app/PdeEditor.java +++ b/processing/app/PdeEditor.java @@ -373,6 +373,9 @@ public class PdeEditor extends Panel { // the app reaches here when no sketch.properties file exists //e.printStackTrace(); + // indicator that this is the first time this feller has used p5 + PdeBase.firstTime = true; + // even if folder for 'default' user doesn't exist, or // sketchbook itself is missing, mkdirs() will make it happy userName = "default";