Skip to content

Commit

Permalink
Added a menu option to save a settings file prior to starting the ana…
Browse files Browse the repository at this point in the history
…lysis.

Binary build system bug fixes
  • Loading branch information
abalijepalli committed Oct 5, 2014
1 parent 19670f6 commit 886aa77
Show file tree
Hide file tree
Showing 7 changed files with 96 additions and 60 deletions.
110 changes: 55 additions & 55 deletions pyinstaller/pyEventAnalysis.spec
Original file line number Diff line number Diff line change
@@ -1,56 +1,56 @@
# -*- mode: python -*-
import sys
from utilities.resource_path import resource_path, format_path

a = Analysis(['../qtgui/qtAnalysisGUI.py'],
pathex=[resource_path('.settings')],
hiddenimports=['scipy.special._ufuncs_cxx', 'qtgui.mplwidget'],
hookspath=None,
runtime_hooks=None)
a.datas += [('.settings', '../.settings', 'DATA')]
pyz = PYZ(a.pure)
# On OS X, collect data files and build an application bundle
if sys.platform=='darwin':
exe = EXE(pyz,
a.scripts,
exclude_binaries=True,
name='pyEventAnalysis',
debug=False,
strip=None,
upx=True,
console=False,
icon='logo.icns' )
coll = COLLECT(exe,
a.binaries,
Tree('../qtgui/ui', prefix='ui'),
a.zipfiles,
a.datas,
strip=None,
upx=True,
name=os.path.join('dist', 'pyEventAnalysis'))
app = BUNDLE(coll,
name=os.path.join('dist', 'pyEventAnalysis.app'))
elif sys.platform=='win32' or sys.platform=='win64':
for d in a.datas:
if 'pyconfig' in d[0]:
a.datas.remove(d)
break
exe = EXE(pyz,
a.scripts,
a.binaries,
Tree(format_path('../qtgui/ui'), prefix='ui'),
a.zipfiles,
a.datas,
name='pyEventAnalysis.exe',
debug=False,
strip=None,
upx=True,
console=False )
# coll = COLLECT(exe,
# a.binaries,
# Tree(format_path('../qtgui/ui'), prefix='ui'),
# a.zipfiles,
# a.datas,
# strip=None,
# upx=True,
# -*- mode: python -*-
import sys
from utilities.resource_path import resource_path, format_path

a = Analysis(['../qtgui/qtAnalysisGUI.py'],
pathex=[resource_path('.settings')],
hiddenimports=['scipy.special._ufuncs_cxx', 'qtgui.mplwidget','Tkinter','FixTk','_tkinter','Tkconstants','FileDialog','Dialog'],
hookspath=None,
runtime_hooks=None)
a.datas += [('.settings', '../.settings', 'DATA')]
pyz = PYZ(a.pure)
# On OS X, collect data files and build an application bundle
if sys.platform=='darwin':
exe = EXE(pyz,
a.scripts,
exclude_binaries=True,
name='pyEventAnalysis',
debug=False,
strip=None,
upx=True,
console=False,
icon='logo.icns' )
coll = COLLECT(exe,
a.binaries,
Tree('../qtgui/ui', prefix='ui'),
a.zipfiles,
a.datas,
strip=None,
upx=True,
name=os.path.join('dist', 'pyEventAnalysis'))
app = BUNDLE(coll,
name=os.path.join('dist', 'pyEventAnalysis.app'))
elif sys.platform=='win32' or sys.platform=='win64':
for d in a.datas:
if 'pyconfig' in d[0]:
a.datas.remove(d)
break
exe = EXE(pyz,
a.scripts,
a.binaries,
Tree(format_path('../qtgui/ui'), prefix='ui'),
a.zipfiles,
a.datas,
name='pyEventAnalysis.exe',
debug=False,
strip=None,
upx=True,
console=False )
# coll = COLLECT(exe,
# a.binaries,
# Tree(format_path('../qtgui/ui'), prefix='ui'),
# a.zipfiles,
# a.datas,
# strip=None,
# upx=True,
# name=os.path.join('dist', 'pyEventAnalysis'))
4 changes: 2 additions & 2 deletions qtgui/consolelog/consolelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import csv

from PyQt4 import QtCore, QtGui, uic
from utilities.resource_path import resource_path, last_file_in_directory
from utilities.resource_path import resource_path, last_file_in_directory, format_path

class AnalysisLogDialog(QtGui.QDialog):
def __init__(self, parent = None):
Expand All @@ -28,7 +28,7 @@ def __init__(self, parent = None):

def dataPath(self, path):
self.logFileTimeStamp=0.0
self.logfile=path+'/eventProcessing.log'
self.logfile=format_path(path+'/eventProcessing.log')

def Update(self):
self.OnAppIdle()
Expand Down
22 changes: 22 additions & 0 deletions qtgui/qtAnalysisGUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ def __init__(self, parent = None):
QtCore.QObject.connect(self.actionStart_Analysis, QtCore.SIGNAL('triggered()'), self.OnStartAnalysis)
QtCore.QObject.connect(self.actionOpen_Analysis, QtCore.SIGNAL('triggered()'), self.OnLoadAnalysis)
QtCore.QObject.connect(self.actionLoad_Data, QtCore.SIGNAL('triggered()'), self.OnSelectPath)
QtCore.QObject.connect(self.actionSave_Settings, QtCore.SIGNAL('triggered()'), self.OnSaveSettings)


# Idle processing
QtCore.QObject.connect(self.idleTimer, QtCore.SIGNAL('timeout()'), self.OnAppIdle)
Expand Down Expand Up @@ -122,6 +124,26 @@ def OnStartAnalysis(self):
self.startAnalysisPushButton.setText("Start Analysis")
self.actionStart_Analysis.setText("Start Analysis")

def OnSaveSettings(self):
if not self.analysisRunning:
if self.analysisDataModel["DataFilesPath"]:

if self.dataFilterDenoise:
fltr=self.analysisDataModel["FilterAlgorithm"]
else:
fltr=None

with open(self.analysisDataModel["DataFilesPath"]+"/.settings", 'w') as f:
f.write(
self.analysisDataModel.GenerateSettingsView(
eventPartitionAlgo=str(self.partitionAlgorithmComboBox.currentText()),
eventProcessingAlgo=str(self.processingAlgorithmComboBox.currentText()),
dataFilterAlgo=fltr
)
)
# QtGui.QMessageBox.information(self, "Settings Saved", "Settings file "+self.analysisDataModel["DataFilesPath"]+"/.settings saved.")
QtGui.QMessageBox.information(self, "Settings Saved", "Settings file saved.")

def OnAnalysisFinished(self, value=True):
if value:
self._setEnableSettingsWidgets(True)
Expand Down
4 changes: 2 additions & 2 deletions qtgui/settingsview.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ def _setThreshold(self, mean, sd, threshold):
except AttributeError:
mu=self.analysisDataModel["lastMeanOpenCurr"]
sig=self.analysisDataModel["lastSDOpenCurr"]
self.ThresholdDoubleSpinBox.setMaximum(mu)
self.ThresholdDoubleSpinBox.setMaximum(max(0,mu))
self.ThresholdDoubleSpinBox.setValue(mu-sig*threshold)
else:
self.ThresholdDoubleSpinBox.setValue(mean-sd*threshold)
Expand Down Expand Up @@ -424,7 +424,7 @@ def OnBlockSizeChangeSpinbox(self, value):
def OnBaselineMeanChange(self, value):
if self.updateDialogs:
self._baselineupdate("meanOpenCurr")

# self.ThresholdDoubleSpinBox.setMaximum(float(value))
self.trajViewerWindow.updatePlot(self.analysisDataModel.GenerateTrajView())

def OnBaselineSDChange(self, value):
Expand Down
5 changes: 5 additions & 0 deletions qtgui/trajview/trajview.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,11 @@ def _calculateThreshold(self, dat):
self.sd=float(self.datadict["sdOpenCurr"])
self.thr=float(self.datadict["eventThreshold"])

# When loading more data, update the parent window
# threshold spinbox maximum
self.parent().ThresholdDoubleSpinBox.setMaximum(self.mu)


def _ticks(self, nticks):
axes=self.mpl_hist.canvas.ax

Expand Down
10 changes: 9 additions & 1 deletion qtgui/ui/SettingsWindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,6 @@
</layout>
<zorder></zorder>
<zorder>horizontalSpacer_4</zorder>
<zorder>eventPartitionGroupBox</zorder>
</widget>
</item>
<item>
Expand Down Expand Up @@ -927,6 +926,7 @@
</property>
<addaction name="actionLoad_Data"/>
<addaction name="actionOpen_Analysis"/>
<addaction name="actionSave_Settings"/>
<addaction name="actionStart_Analysis"/>
</widget>
<widget class="QMenu" name="menuHelp">
Expand Down Expand Up @@ -1033,6 +1033,14 @@
<string>Ctrl+O</string>
</property>
</action>
<action name="actionSave_Settings">
<property name="text">
<string>Save Settings</string>
</property>
<property name="shortcut">
<string>Ctrl+Shift+S</string>
</property>
</action>
</widget>
<resources/>
<connections>
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def read_version():
'qtgui/ui/blockdepthview.ui',
'qtgui/ui/statisticsview.ui',
'qtgui/ui/fiteventsview.ui',
'qtgui/ui/consoleDialog.ui',
'pyinstaller/pyEventAnalysis.spec',
'pyinstaller-sh'
],
Expand Down

0 comments on commit 886aa77

Please sign in to comment.