[update] finalized recent projects

[minor] some small fixes, improvements
This commit is contained in:
Marcel Paffrath 2018-08-15 15:39:43 +02:00
parent 402248f340
commit 8a187905cb
2 changed files with 14 additions and 7 deletions

View File

@ -204,7 +204,6 @@ class MainWindow(QMainWindow):
if settings.value('autoFilter', None) is None:
settings.setValue('autoFilter', True)
settings.sync()
print(settings.value('recentProjects'))
# setup UI
self.setupUi()
@ -870,10 +869,12 @@ class MainWindow(QMainWindow):
# add recent projects
recentProjects = settings.value('recentProjects', [])
if not type(recentProjects) == list:
recentProjects = [recentProjects]
for project in reversed(recentProjects):
action = self.createAction(self, project,
self.createNewProject,
None, None)
lambda fnm=project: self.loadProject(fnm),
None, None)
self.recentProjectsMenu.addAction(action)
@ -3306,6 +3307,10 @@ class MainWindow(QMainWindow):
self.setDirty(False)
self.init_metadata()
message = 'Opened project file {}.'.format(fnm)
print(message)
self.update_status(message)
self.init_array_tab()
self.set_metadata()
self.add2recentProjects(fnm)
@ -3315,9 +3320,11 @@ class MainWindow(QMainWindow):
recent = settings.value('recentProjects', [])
if not type(recent) == list:
recent = [recent]
recent.append(fnm)
if not fnm in recent:
recent.append(fnm)
new_recent = recent[-5:]
settings.setValue('recentProjects', new_recent)
settings.sync()
def saveProjectAs(self, exists=False):
'''

View File

@ -421,9 +421,9 @@ class Array_map(QtGui.QWidget):
def annotate_ax(self):
self.annotations = []
stations, xs, ys = self.get_st_x_y_for_plot()
# MP MP test
if self.picks_rel:
self.test_gradient()
# MP MP testing station highlighting if they have high impact on mean gradient of color map
# if self.picks_rel:
# self.test_gradient()
color_marked = {True: 'red',
False: 'white'}
for st, x, y in zip(stations, xs, ys):