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

View File

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