Revision: 17488
http://jmol.svn.sourceforge.net/jmol/?rev=17488&view=rev
Author: hansonr
Date: 2012-08-30 00:10:26 +0000 (Thu, 30 Aug 2012)
Log Message:
-----------
___version=13.1.2_dev
bug fix: OPEN dialog doesn't allow for no PDB cartoons.
bug fix: open dialog for 1-residue PDB files does not show atoms.
Modified Paths:
--------------
trunk/Jmol/src/org/jmol/api/JmolViewer.java
trunk/Jmol/src/org/jmol/export/JmolFileDropper.java
trunk/Jmol/src/org/jmol/export/dialog/Dialog.java
trunk/Jmol/src/org/jmol/export/dialog/FilePreview.java
trunk/Jmol/src/org/jmol/viewer/Jmol.properties
trunk/Jmol/src/org/jmol/viewer/Viewer.java
trunk/Jmol/src/org/openscience/jmol/app/jmolpanel/JmolPanel.java
Modified: trunk/Jmol/src/org/jmol/api/JmolViewer.java
===================================================================
--- trunk/Jmol/src/org/jmol/api/JmolViewer.java 2012-08-30 00:09:40 UTC (rev
17487)
+++ trunk/Jmol/src/org/jmol/api/JmolViewer.java 2012-08-30 00:10:26 UTC (rev
17488)
@@ -488,7 +488,11 @@
abstract public JmolAdapter getModelAdapter();
- abstract public void openFileAsynchronously(String fileName);
+ abstract public void openFileAsynchronously(String fileName, boolean
pdbCartoons);
+ public void openFileAsynchronously(String fileName) {
+ openFileAsynchronously(fileName, false);
+ }
+
abstract public Object getFileAsBytes(String fullPathName, OutputStream os);
abstract public String getErrorMessage();
Modified: trunk/Jmol/src/org/jmol/export/JmolFileDropper.java
===================================================================
--- trunk/Jmol/src/org/jmol/export/JmolFileDropper.java 2012-08-30 00:09:40 UTC
(rev 17487)
+++ trunk/Jmol/src/org/jmol/export/JmolFileDropper.java 2012-08-30 00:10:26 UTC
(rev 17488)
@@ -102,7 +102,7 @@
// ignore
}
}
- viewer.openFileAsynchronously(fname);
+ viewer.openFileAsynchronously(fname, true);
}
private void loadFiles(List<File> fileList) {
Modified: trunk/Jmol/src/org/jmol/export/dialog/Dialog.java
===================================================================
--- trunk/Jmol/src/org/jmol/export/dialog/Dialog.java 2012-08-30 00:09:40 UTC
(rev 17487)
+++ trunk/Jmol/src/org/jmol/export/dialog/Dialog.java 2012-08-30 00:10:26 UTC
(rev 17488)
@@ -23,15 +23,20 @@
*/
package org.jmol.export.dialog;
+import java.awt.BorderLayout;
+import java.awt.Component;
import java.awt.Dimension;
+import java.awt.FlowLayout;
import java.awt.Point;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
+import java.io.File;
+
+import javax.swing.JComboBox;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
+import javax.swing.JPanel;
import javax.swing.JSlider;
-import javax.swing.JPanel;
-import javax.swing.JComboBox;
import javax.swing.LookAndFeel;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
@@ -42,11 +47,6 @@
import javax.swing.event.ChangeListener;
import javax.swing.filechooser.FileFilter;
-import java.awt.BorderLayout;
-import java.awt.Component;
-import java.awt.FlowLayout;
-import java.io.File;
-
import org.jmol.api.JmolDialogInterface;
import org.jmol.api.JmolViewer;
import org.jmol.export.history.HistoryFile;
@@ -149,10 +149,11 @@
fileName = file.getAbsolutePath();
}
boolean doAppend = (allowAppend && openPreview != null &&
openPreview.isAppendSelected());
+ boolean doCartoons = (allowAppend && openPreview != null &&
openPreview.isCartoonsSelected());
closePreview();
if (fileName.startsWith("/"))
fileName = "file://" + fileName; // for Macs
- return (doAppend ? "load append " + Escape.escape(fileName) : fileName);
+ return (doCartoons ? "" : "#NOC#;") + (doAppend ? "load append " +
Escape.escape(fileName) : fileName);
}
String closePreview() {
Modified: trunk/Jmol/src/org/jmol/export/dialog/FilePreview.java
===================================================================
--- trunk/Jmol/src/org/jmol/export/dialog/FilePreview.java 2012-08-30
00:09:40 UTC (rev 17487)
+++ trunk/Jmol/src/org/jmol/export/dialog/FilePreview.java 2012-08-30
00:10:26 UTC (rev 17488)
@@ -47,10 +47,10 @@
*/
public class FilePreview extends JPanel implements PropertyChangeListener {
- JCheckBox active = null;
- JCheckBox append = null;
- JFileChooser chooser = null;
- private FPPanel display = null;
+ JCheckBox active, append, cartoons;
+ JFileChooser chooser;
+ private static boolean pdbCartoonChecked = true;
+ private FPPanel display;
/**
* Constructor
@@ -87,9 +87,19 @@
box.add(display);
if (allowAppend) {
- // Add a checkbox to append date
+ // Add a checkbox to append data
append = new JCheckBox(GT._("Append models"), false);
box.add(append);
+ cartoons = new JCheckBox(GT._("PDB cartoons"), pdbCartoonChecked);
+ cartoons.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ if (active.isSelected()) {
+ updatePreview(chooser.getSelectedFile());
+ }
+ }
+ });
+ box.add(cartoons);
+
}
// Add the preview to the File Chooser
@@ -102,12 +112,16 @@
* @return Indicates if Append is selected.
*/
public boolean isAppendSelected() {
- if (append != null) {
- return append.isSelected();
- }
- return false;
+ return (append != null && append.isSelected());
}
+ /**
+ * @return Indicates if Cartoons is selected.
+ */
+ public boolean isCartoonsSelected() {
+ return pdbCartoonChecked = (cartoons != null && cartoons.isSelected());
+ }
+
/* (non-Javadoc)
* @see
java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent)
*/
@@ -142,8 +156,8 @@
script = "script " + script;
else
script = "zap;set zoomlarge false;load " + script
- + " 1;select protein or dna;cartoons only;color structure;";
- }
+ + " 1;if (" + isCartoonsSelected() + " && _loadScript = '' &&
defaultLoadScript == '' && _filetype == 'Pdb' && {(protein or nucleic)&*/1.1}
&& {*/1.1}[1].groupindex != {*/1.1}[0].groupindex) { select protein or
nucleic;cartoons Only;color structure; select * }";
+ }
display.getViewer().evalStringQuiet(script);
//display.repaint();
}
Modified: trunk/Jmol/src/org/jmol/viewer/Jmol.properties
===================================================================
--- trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2012-08-30 00:09:40 UTC
(rev 17487)
+++ trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2012-08-30 00:10:26 UTC
(rev 17488)
@@ -9,6 +9,8 @@
___version=13.1.2_dev
+bug fix: OPEN dialog doesn't allow for no PDB cartoons.
+bug fix: open dialog for 1-residue PDB files does not show atoms.
bug fix: pngj storage of Spartan directory zip files or Spartan directories
cannot be read
because the PNGJ files created do not contain the necessary files
from the directory
Modified: trunk/Jmol/src/org/jmol/viewer/Viewer.java
===================================================================
--- trunk/Jmol/src/org/jmol/viewer/Viewer.java 2012-08-30 00:09:40 UTC (rev
17487)
+++ trunk/Jmol/src/org/jmol/viewer/Viewer.java 2012-08-30 00:10:26 UTC (rev
17488)
@@ -1842,6 +1842,11 @@
// //////////////// methods that open a file to create a model set
///////////
+ @Override
+ public void openFileAsynchronously(String fileName) {
+ openFileAsynchronously(fileName, false);
+ }
+
/**
* opens a file as a model, a script, or a surface via the creation of a
* script that is queued \t at the beginning disallows script option - used
by
@@ -1851,7 +1856,7 @@
* @param fileName
*/
@Override
- public void openFileAsynchronously(String fileName) {
+ public void openFileAsynchronously(String fileName, boolean pdbCartoons) {
fileName = fileName.trim();
boolean allowScript = (!fileName.startsWith("\t"));
if (!allowScript)
@@ -1882,7 +1887,7 @@
} else if (!type.equals("spt")) {
evalString("zap; load "
+ Escape.escape(fileName)
- + ";if (_loadScript = '' && defaultLoadScript == '' && _filetype
== 'Pdb') { select protein or nucleic;cartoons Only;color structure; select *
}");
+ + ";if (" + pdbCartoons + " && _loadScript = '' &&
defaultLoadScript == '' && _filetype == 'Pdb' && {(protein or nucleic)&*/1.1}
&& {*/1.1}[1].groupindex != {*/1.1}[0].groupindex) { select protein or
nucleic;cartoons Only;color structure; select * }");
return;
}
}
Modified: trunk/Jmol/src/org/openscience/jmol/app/jmolpanel/JmolPanel.java
===================================================================
--- trunk/Jmol/src/org/openscience/jmol/app/jmolpanel/JmolPanel.java
2012-08-30 00:09:40 UTC (rev 17487)
+++ trunk/Jmol/src/org/openscience/jmol/app/jmolpanel/JmolPanel.java
2012-08-30 00:10:26 UTC (rev 17488)
@@ -1153,13 +1153,7 @@
@Override
public void actionPerformed(ActionEvent e) {
- String fileName = getOpenFileNameFromDialog(null);
- if (fileName == null)
- return;
- if (fileName.startsWith("load append"))
- viewer.scriptWait(fileName);
- else
- viewer.openFileAsynchronously(fileName);
+ openFile();
}
}
@@ -1448,9 +1442,18 @@
return dir == null ? null : new File(System.getProperty("user.dir"));
}
- String getOpenFileNameFromDialog(String fileName) {
- return (new Dialog()).getOpenFileNameFromDialog(appletContext,
- viewer, fileName, historyFile, FILE_OPEN_WINDOW_NAME, (fileName ==
null));
+ void openFile() {
+ String fileName = (new Dialog()).getOpenFileNameFromDialog(appletContext,
+ viewer, null, historyFile, FILE_OPEN_WINDOW_NAME, true);
+ if (fileName == null)
+ return;
+ boolean pdbCartoons = !fileName.startsWith("#NOC#;");
+ if (!pdbCartoons)
+ fileName = fileName.substring(6);
+ if (fileName.startsWith("load append"))
+ viewer.scriptWait(fileName);
+ else
+ viewer.openFileAsynchronously(fileName, pdbCartoons);
}
static final String chemFileProperty = "chemFile";
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Jmol-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-commits