From 4b53c6f969986c258e6cfbe20781c497caf33618 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Fri, 31 Jan 2020 10:57:45 +0000 Subject: [PATCH] JAL-2422 more responsive Chimera/X path prompts in Preferences --- resources/lang/Messages.properties | 2 +- resources/lang/Messages_es.properties | 2 +- src/jalview/gui/Preferences.java | 6 +++++- src/jalview/jbgui/GPreferences.java | 23 ++++++++++++++--------- 4 files changed, 21 insertions(+), 12 deletions(-) diff --git a/resources/lang/Messages.properties b/resources/lang/Messages.properties index 3ead942..c5031c2 100644 --- a/resources/lang/Messages.properties +++ b/resources/lang/Messages.properties @@ -265,7 +265,7 @@ label.autoadd_secstr = Add secondary structure annotation to alignment label.autoadd_temp = Add Temperature Factor annotation to alignment label.structure_viewer = Default structure viewer label.double_click_to_browse = Double-click to browse for file -label.chimera_path = Path to Chimera(X) program +label.chimera_path = Path to {0} program label.chimera_path_tip = Jalview will first try any path entered here, else standard installation locations.
Double-click to browse for file. label.invalid_chimera_path = Chimera path not found or not executable label.chimera_missing = Chimera structure viewer not found.
Please enter the path to Chimera (if installed),
or download and install UCSF Chimera. diff --git a/resources/lang/Messages_es.properties b/resources/lang/Messages_es.properties index daa4418..369ac96 100644 --- a/resources/lang/Messages_es.properties +++ b/resources/lang/Messages_es.properties @@ -1203,7 +1203,7 @@ label.configure_displayed_columns=Configurar Columnas Mostradas label.aacon_calculations=cálculos AACon label.pdb_web-service_error=Error de servicio web PDB exception.unable_to_detect_internet_connection=Jalview no puede detectar una conexión a Internet -label.chimera_path=Ruta de acceso a Chimera +label.chimera_path=Ruta de acceso a {0} warn.delete_all=Borrar todas las secuencias cerrará la ventana del alineamiento.
Confirmar o Cancelar. label.select_all=Seleccionar Todos label.alpha_helix=Hélice Alfa diff --git a/src/jalview/gui/Preferences.java b/src/jalview/gui/Preferences.java index abe175b..3667f55 100755 --- a/src/jalview/gui/Preferences.java +++ b/src/jalview/gui/Preferences.java @@ -1237,13 +1237,17 @@ public class Preferences extends GPreferences if (selectedItem.equals(ViewerType.JMOL.name())) { chimeraPath.setEnabled(false); + chimeraPathLabel.setEnabled(false); return; } boolean found = false; chimeraPath.setEnabled(true); + chimeraPathLabel.setEnabled(true); + chimeraPathLabel.setText(MessageManager + .formatMessage("label.chimera_path", selectedItem)); /* - * Try user-specified and standard paths for Chimera executable. + * Try user-specified and standard paths for Chimera executable */ boolean isChimeraX = selectedItem.equals(ViewerType.CHIMERAX.name()); chimeraPath.setText(Cache diff --git a/src/jalview/jbgui/GPreferences.java b/src/jalview/jbgui/GPreferences.java index 5456935..58045cb 100755 --- a/src/jalview/jbgui/GPreferences.java +++ b/src/jalview/jbgui/GPreferences.java @@ -179,6 +179,8 @@ public class GPreferences extends JPanel protected JComboBox structViewer = new JComboBox<>(); + protected JLabel chimeraPathLabel; + protected JTextField chimeraPath = new JTextField(); protected ButtonGroup mappingMethod = new ButtonGroup(); @@ -1247,7 +1249,7 @@ public class GPreferences extends JPanel structureTab.add(viewerLabel); structViewer.setFont(LABEL_FONT); - structViewer.setBounds(new Rectangle(180, ypos, 120, height)); + structViewer.setBounds(new Rectangle(190, ypos, 120, height)); structViewer.addItem(ViewerType.JMOL.name()); structViewer.addItem(ViewerType.CHIMERA.name()); structViewer.addItem(ViewerType.CHIMERAX.name()); @@ -1263,25 +1265,28 @@ public class GPreferences extends JPanel structureTab.add(structViewer); ypos += lineSpacing; - JLabel pathLabel = new JLabel(); - pathLabel.setFont(new java.awt.Font("SansSerif", 0, 11)); - pathLabel.setHorizontalAlignment(SwingConstants.LEFT); - pathLabel.setText(MessageManager.getString("label.chimera_path")); - pathLabel.setBounds(new Rectangle(10, ypos, 160, height)); - structureTab.add(pathLabel); + chimeraPathLabel = new JLabel(); + chimeraPathLabel.setFont(LABEL_FONT);// new Font("SansSerif", 0, 11)); + chimeraPathLabel.setHorizontalAlignment(SwingConstants.LEFT); + chimeraPathLabel.setText(MessageManager + .formatMessage("label.chimera_path", "Chimera(X)")); + chimeraPathLabel.setBounds(new Rectangle(10, ypos, 170, height)); + chimeraPathLabel.setEnabled(false); + structureTab.add(chimeraPathLabel); chimeraPath.setFont(LABEL_FONT); chimeraPath.setText(""); + chimeraPath.setEnabled(false); final String tooltip = JvSwingUtils.wrapTooltip(true, MessageManager.getString("label.chimera_path_tip")); chimeraPath.setToolTipText(tooltip); - chimeraPath.setBounds(new Rectangle(180, ypos, 300, height)); + chimeraPath.setBounds(new Rectangle(190, ypos, 290, height)); chimeraPath.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { - if (e.getClickCount() == 2) + if (chimeraPath.isEnabled() && e.getClickCount() == 2) { String chosen = openFileChooser(); if (chosen != null) -- 1.7.10.2