From 215985fa3d113634171ada57a0558ece8288fbb5 Mon Sep 17 00:00:00 2001 From: jannickweisshaupt Date: Wed, 10 Oct 2018 16:15:25 +0200 Subject: [PATCH] - fixed key enter event in material api --- main.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/main.py b/main.py index 49328a1..1b352b9 100755 --- a/main.py +++ b/main.py @@ -954,7 +954,7 @@ def __init__(self, parent=None): self.search_bar.setToolTip('Search the material api database for structures.\nEnter either a chemical formula, e.g. Fe2O3 or LiBH4,\nor a list of elements of the material, e.g. Fe-O or Li-B-H') self.search_bar.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter) search_layout.addWidget(self.search_bar) - self.search_bar.returnPressed.connect(self.search) + # self.search_bar.returnPressed.connect(self.search) self.table = QtGui.QTableWidget(self) self.table.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows) @@ -1103,6 +1103,11 @@ def accept_own(self): self.apply() self.close() + def keyPressEvent(self,event): + if event.key() in [QtCore.Qt.Key_Enter,QtCore.Qt.Key_Return]: + return + else: + super().keyPressEvent(event) class LoadResultsWindow(QtGui.QDialog): def __init__(self, parent, tasks): @@ -3367,7 +3372,7 @@ def update_file_menu(self): self.edit_structure_action.triggered.connect(lambda: self.open_structure_window(new=False)) self.file_menu.addAction(self.edit_structure_action) - self.import_structure_menu = self.file_menu.addMenu('Import structure from') + self.import_structure_menu = self.file_menu.addMenu('&Import structure from') open_structure_action_exciting = QtGui.QAction("exciting input file", self) open_structure_action_exciting.setStatusTip('Load crystal structure from exciting xml') @@ -3380,7 +3385,7 @@ def update_file_menu(self): lambda: self.load_crystal_structure('quantum espresso')) self.import_structure_menu.addAction(open_structure_action_quantum_espresso) - open_structure_action_cif = QtGui.QAction("cif", self) + open_structure_action_cif = QtGui.QAction("&cif", self) open_structure_action_cif.setShortcut('Ctrl+Shift+c') open_structure_action_cif.setStatusTip('Load crystal structure from cif file') open_structure_action_cif.triggered.connect(lambda: self.load_crystal_structure('cif')) @@ -3727,14 +3732,15 @@ def configure_buttons(self, disable_all=False): self.save_project_action.setEnabled(False) self.edit_structure_action.setEnabled(False) self.new_structure_action.setEnabled(False) - self.import_structure_menu.setEnabled(False) self.vis_menu.setEnabled(False) + self.import_structure_menu.setEnabled(False) + else: self.save_project_action.setEnabled(True) self.edit_structure_action.setEnabled(True) self.new_structure_action.setEnabled(True) - self.import_structure_menu.setEnabled(True) self.vis_menu.setEnabled(True) + self.import_structure_menu.setEnabled(True) def check_integrety(self): scf_check = self.dft_engine_window.scf_option_widget.options == esc_handler.scf_options