Skip to content

Commit

Permalink
Small fixes:
Browse files Browse the repository at this point in the history
- 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)
  • Loading branch information
JannickWeisshaupt committed Aug 8, 2018
1 parent e05a8a0 commit 432609a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
3 changes: 1 addition & 2 deletions exciting_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
23 changes: 14 additions & 9 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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'

Expand Down Expand Up @@ -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
Expand All @@ -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()
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 432609a

Please sign in to comment.