Skip to content
This repository has been archived by the owner on Nov 5, 2020. It is now read-only.

Commit

Permalink
enh: Display session name in window title
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmueller committed Jul 15, 2019
1 parent 151acb0 commit 7cfd906
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
0.9.5
- fix: Allow to open measurement files that do not contain the features
"area_um" or "deform" (#245)
- enh: Display session name in window title
0.9.4
- fix: Wrong image/trace data shown for a selected event in the scatter
plot when working on a log-scale (#244)
Expand Down
30 changes: 23 additions & 7 deletions shapeout/gui/frontend.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from __future__ import division, print_function, unicode_literals

import os
import pathlib
import platform
import pkg_resources
import sys
Expand Down Expand Up @@ -54,9 +55,8 @@ def __init__(self, version):
#size = (1300,900)
size = (1200,700)
minsize = (900, 700)
gaugeframe.GaugeFrame.__init__(self, None, -1,
title = "Shape-Out - version {}".format(version),
size = size)
gaugeframe.GaugeFrame.__init__(self, None, -1, size=size)
self._set_title()
self.SetMinSize(minsize)

sys.excepthook = MyExceptionHook
Expand Down Expand Up @@ -133,9 +133,21 @@ def __init__(self, version):
except:
self.MainIcon = None

def _set_title(self, session_file=None):
if session_file is None:
title = "Shape-Out {}".format(self.version)
else:
fname_base = pathlib.Path(session_file).name
title = "Shape-Out {} [{}]".format(self.version, fname_base)

try:
self.SetTitle(title)
except BaseException: # maybe there are unicode issues
self._set_title()


def InitRun(self, session_file=None):
"""Performs the first tasks after the publication starts
"""Performs the first tasks after the application starts
- start autosaving
- check for updates
Expand Down Expand Up @@ -524,16 +536,19 @@ def OnMenuExportStatistics(self, e=None):
def OnMenuHelpAbout(self, e=None):
help.about()


def OnMenuHelpDocs(self, e=None):
help.docs()


def OnMenuHelpSoftware(self, e=None):
help.software()


def OnMenuLoad(self, e=None, session_file=None):
""" Load entire analysis """
session_ui.open_session(self, session_file=session_file)
"""Load entire analysis"""
fname = session_ui.open_session(self, session_file=session_file)
self._set_title(fname)


def OnMenuPreferences(self, event):
Expand Down Expand Up @@ -635,7 +650,8 @@ def OnMenuQuit(self, e=None):

def OnMenuSave(self, e=None):
""" Save configuration without measurement data """
session_ui.save_session(self)
fname = session_ui.save_session(self)
self._set_title(fname)


def MyExceptionHook(etype, value, trace):
Expand Down
1 change: 1 addition & 0 deletions shapeout/gui/session_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def open_session(parent, session_file=None):
fname = session_file

open_session_worker(fname, parent)
return fname


def open_session_worker(path, parent):
Expand Down

0 comments on commit 7cfd906

Please sign in to comment.