From 432609a25d7058d6de648102cea2a33026134861 Mon Sep 17 00:00:00 2001 From: jannickweisshaupt Date: Thu, 9 Aug 2018 00:00:18 +0200 Subject: [PATCH] Small fixes: - runtime wanrings are also ignored for non debug mode - changed paths in recent prjects from strings to Path from pathlib because the same project could show up with slightly different string (e.g. / or no / at the end) --- exciting_handler.py | 3 +-- main.py | 23 ++++++++++++++--------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/exciting_handler.py b/exciting_handler.py index c21a89d..66aee6a 100755 --- a/exciting_handler.py +++ b/exciting_handler.py @@ -81,8 +81,7 @@ def __init__(self): self.custom_command_active = False self.dft_installation_folder = self.find_engine_folder() self.scf_options = convert_to_ordered( - {'do': 'fromscratch', 'nempty': '5', 'gmaxvr': '12.0', 'rgkmax': '5.0', 'ngridk': '5 5 5', - 'frozencore': 'false', 'xctype': 'GGA_PBE'}) + {'do': 'fromscratch', 'nempty': '5', 'gmaxvr': '12.0', 'rgkmax': '5.0', 'ngridk': '5 5 5', 'xctype': 'GGA_PBE'}) self.scf_options_tooltip = {'do': """Decides if the ground state is calculated starting from scratch, using the densities from file, or if its calculation is skipped and only the associated input parameters are read in. Type: choose from: fromscratch diff --git a/main.py b/main.py index 28079bd..b8f150a 100755 --- a/main.py +++ b/main.py @@ -4,12 +4,13 @@ import sys from pathlib import Path import psutil +import os +import warnings +from pathlib import Path if not sys.getfilesystemencoding(): sys.getfilesystemencoding = lambda: 'UTF-8' -import os import numpy as np -import warnings import datetime from collections import OrderedDict @@ -20,8 +21,10 @@ if DEBUG: warnings.simplefilter('always', UserWarning) + warnings.simplefilter('always', RuntimeWarning) else: warnings.simplefilter('ignore', UserWarning) + warnings.simplefilter('ignore', RuntimeWarning) os.environ['ETS_TOOLKIT'] = 'qt4' @@ -978,6 +981,7 @@ def __init__(self, parent, options, title='', tooltips={}, checkbuttons=[], butt button = QtGui.QPushButton(text) button.clicked.connect(function) button.setFixedHeight(30) + button.setFixedWidth(150) self.buttons.append(button) self.layout.addWidget(button, counter // self.widgets_per_line, counter % self.widgets_per_line) counter += 1 @@ -994,6 +998,7 @@ def make_option_entries(self): self.entry_dict[option_key] = entry counter += 1 + def read_all_entries(self): for key, entry in self.entry_dict.items(): self.options[key] = entry.get_text() @@ -1279,8 +1284,8 @@ def show_stacktrace_in_error_dialog(self): self.execute_error_dialog.showMessage(error_message) def show_status_bar_message(self,tasks): - time = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") - msg = 'Calculation with tasks: '+', '.join(tasks)+' stated at '+time + time = datetime.datetime.now().strftime("%Y-%m-%d %H:%M") + msg = 'Calculation with tasks: '+', '.join(tasks)+' stated on '+time self.parent.status_bar.showMessage(msg) class ScfWindow(QtGui.QWidget): @@ -2869,7 +2874,7 @@ def make_new_project(self): esc_handler.project_directory = self.project_directory self.initialize_project() self.configure_buttons() - self.recent_projects.appendleft(self.project_directory) + self.recent_projects.appendleft(Path(self.project_directory)) def initialize_project(self): self.project_properties.update( @@ -2942,7 +2947,7 @@ def load_project(self, *args, **kwargs): self.tabWidget.currentWidget().do_select_event() self.setWindowTitle("OpenDFT - " + self.project_directory) self.project_loaded = True - self.recent_projects.appendleft(self.project_directory) + self.recent_projects.appendleft(Path(self.project_directory)) self.configure_buttons() elif not folder_name: return @@ -3147,9 +3152,9 @@ def update_file_menu(self): recent_projects_menu = self.file_menu.addMenu('Recent projects') for recent_project in self.recent_projects: - if recent_project != self.project_directory: - action = QtGui.QAction(recent_project, self) - action.triggered.connect(lambda a,x=recent_project: self.load_project(folder_name=x)) + if str(recent_project) != self.project_directory: + action = QtGui.QAction(str(recent_project), self) + action.triggered.connect(lambda a,x=str(recent_project): self.load_project(folder_name=x)) recent_projects_menu.addAction(action) self.save_project_action = QtGui.QAction("Save project", self)