Skip to content

Commit

Permalink
* Changes the configuration directory from .openpnp to .openpnp2.
Browse files Browse the repository at this point in the history
* Adds a one time Welcome to OpenPnP 2.0 dialog explaining the changes.
  • Loading branch information
vonnieda committed Jun 1, 2019
1 parent 4b0b030 commit 1ac7757
Show file tree
Hide file tree
Showing 5 changed files with 131 additions and 2 deletions.
24 changes: 24 additions & 0 deletions OPENPNP_2_0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Welcome to OpenPnP 2.0!

Your configuration is safe.

OpenPnP 2.0 is a major update to OpenPnP and includes many new features and changes to existing
features. As part of this upgrade, you will need to reconfigure your machine, but don't panic. Your
old configuration is still available and you can downgrade back to 1.0 very easily. Keep reading.

For a list of all the changes in OpenPnP 2.0, please go to Menu -> About.

OpenPnP uses a new configuration directory. Instead of .openpnp it uses .openpnp2. Your old
configuration, if you had one, is still in .openpnp. If you would like to downgrade back to
1.0 please download the Stable version from http://openpnp.org/downloads/.

If you are interested in trying the new features in OpenPnP, please be aware that it is currently
under heavy development and breaking changes are expected to happen regularly until at least
the third quarter of 2019.

If you have any questions, or problems, or just want to discuss the new features, please join
the discussion group at http://groups.google.com/group/openpnp.

Thanks for trying OpenPnP 2.0. Onward!

-Jason
2 changes: 1 addition & 1 deletion src/main/java/org/openpnp/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public static void main(String[] args) {
}

File configurationDirectory = new File(System.getProperty("user.home"));
configurationDirectory = new File(configurationDirectory, ".openpnp");
configurationDirectory = new File(configurationDirectory, ".openpnp2");

if (System.getProperty("configDir") != null) {
configurationDirectory = new File(System.getProperty("configDir"));
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/openpnp/gui/AboutDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public AboutDialog(Frame frame) {
lblOpenpnp.setAlignmentX(Component.CENTER_ALIGNMENT);
lblOpenpnp.setFont(new Font("Lucida Grande", Font.BOLD, 32));
contentPanel.add(lblOpenpnp);
JLabel lblCopyright = new JLabel("Copyright © 2011 - 2016 Jason von Nieda");
JLabel lblCopyright = new JLabel("Copyright © 2011 - 2019 Jason von Nieda");
lblCopyright.setFont(new Font("Lucida Grande", Font.PLAIN, 10));
lblCopyright.setAlignmentX(Component.CENTER_ALIGNMENT);
contentPanel.add(lblCopyright);
Expand Down
9 changes: 9 additions & 0 deletions src/main/java/org/openpnp/gui/MainFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,15 @@ public void propertyChange(PropertyChangeEvent evt) {
try {
configuration.load();
configuration.getScripting().setMenu(mnScripts);

if (Configuration.get().getMachine().getProperty("Welcome2_0_Dialog_Shown") == null) {
Welcome2_0Dialog dialog = new Welcome2_0Dialog(this);
dialog.setSize(750, 550);
dialog.setLocationRelativeTo(null);
dialog.setModal(true);
dialog.setVisible(true);
Configuration.get().getMachine().setProperty("Welcome2_0_Dialog_Shown", true);
}
}
catch (Exception e) {
e.printStackTrace();
Expand Down
96 changes: 96 additions & 0 deletions src/main/java/org/openpnp/gui/Welcome2_0Dialog.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
/*
* Copyright (C) 2011 Jason von Nieda <jason@vonnieda.org>
*
* This file is part of OpenPnP.
*
* OpenPnP 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, either version 3 of the
* License, or (at your option) any later version.
*
* OpenPnP 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 OpenPnP. If not, see
* <http://www.gnu.org/licenses/>.
*
* For more information about OpenPnP visit http://openpnp.org
*/

package org.openpnp.gui;

import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.Frame;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;

import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextPane;
import javax.swing.border.EmptyBorder;

import org.apache.commons.io.FileUtils;
import org.openpnp.Main;

@SuppressWarnings("serial")
public class Welcome2_0Dialog extends JDialog {

private final JPanel contentPanel = new JPanel();
private JTextPane textPane;

public Welcome2_0Dialog(Frame frame) {
super(frame, true);
setTitle("Welcome to OpenPnP 2.0");
setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
setBounds(100, 100, 347, 360);
getContentPane().setLayout(new BorderLayout());
contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
getContentPane().add(contentPanel, BorderLayout.CENTER);
contentPanel.setLayout(new BoxLayout(contentPanel, BoxLayout.Y_AXIS));
JLabel lblOpenpnp = new JLabel("Welcome to OpenPnP 2.0");
lblOpenpnp.setAlignmentX(Component.CENTER_ALIGNMENT);
lblOpenpnp.setFont(new Font("Lucida Grande", Font.BOLD, 32));
contentPanel.add(lblOpenpnp);
JLabel lblCopyright = new JLabel("Copyright © 2011 - 2019 Jason von Nieda");
lblCopyright.setFont(new Font("Lucida Grande", Font.PLAIN, 10));
lblCopyright.setAlignmentX(Component.CENTER_ALIGNMENT);
contentPanel.add(lblCopyright);
JLabel lblVersion = new JLabel("Version: " + Main.getVersion());
lblVersion.setFont(new Font("Lucida Grande", Font.PLAIN, 10));
lblVersion.setAlignmentX(Component.CENTER_ALIGNMENT);
contentPanel.add(lblVersion);

textPane = new JTextPane();
textPane.setEditable(false);
contentPanel.add(new JScrollPane(textPane));
JPanel buttonPane = new JPanel();
buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
getContentPane().add(buttonPane, BorderLayout.SOUTH);
JButton okButton = new JButton("OK");
okButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
setVisible(false);
}
});
okButton.setActionCommand("OK");
buttonPane.add(okButton);
getRootPane().setDefaultButton(okButton);

try {
String s = FileUtils.readFileToString(new File("OPENPNP_2_0.md"));
textPane.setText(s);
textPane.setCaretPosition(0);
}
catch (Exception e) {

}
}
}

0 comments on commit 1ac7757

Please sign in to comment.