Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save Summary Not Populating #247

Merged
merged 22 commits into from
Jun 13, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,12 @@ addons:
- wx2.8-headers
- wx2.8-i18n

# mariadb: '10.1'
before_script:
- ./scripts/tests/mysql_setup.sh
- ./scripts/tests/postgres_setup.sh
- ./scripts/tests/freetds.sh

before_install:
# python -m pip makes the install go into the virtualenv
- python -m pip install pandas
- export PYMSSQL_BUILD_WITH_BUNDLED_FREETDS=1;python -m pip install pymssql

# - python -m pip install mysql-python
install: # now just our code
- pip install geoalchemy2
Expand All @@ -60,8 +56,17 @@ install: # now just our code
# don't forget to open up the azure mssql server to these addreses
# https://docs.travis-ci.com/user/ip-addresses/

# mariadb: '10.1'
before_script:
- chmod +x ./tests/scripts/mysql_setup.sh
# - chmod +x ./tests/scripts/postgres_setup.sh
- chmod +x ./tests/scripts/freetds.sh
- ./tests/scripts/mysql_setup.sh
# - ./tests/scripts/postgres_setup.sh
- ./tests/scripts/freetds.sh

# command to run tests
script:

# - pythonw -m pytest
- py.test

26 changes: 24 additions & 2 deletions odmtools/controller/frmSeriesSelector.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ def refreshTableSeries(self, db):

:return:
"""
chcklist= self.tblSeries.GetCheckedObjects()


self.memDB.set_series_service(db)
object = self.series_service.get_all_series()
#checkedObjs = self.tblSeries.GetCheckedObjects()
Expand All @@ -93,6 +96,11 @@ def refreshTableSeries(self, db):
if x.id not in idList:
self.tblSeries.AddObject(x)


for c in chcklist:
self.tblSeries.SetCheckState(c, True)


#for x in checkedObjs:
# super(FastObjectListView, self.tblSeries).SetCheckState(x, True)

Expand All @@ -101,12 +109,21 @@ def refreshSeries(self):

:return:
"""
chcklist= self.tblSeries.GetCheckedObjects()
self.series_service = None

self.series_service = self.parent.Parent.createService()
#self.refreshTableSeries(self.dbservice)
self.resetDB(self.series_service)
for c in chcklist:
for val in self.tblSeries.GetObjects():
if c == val:
self.tblSeries.SetCheckState(val, True)
break

logger.debug("Repopulate Series Selector")


def initSVBoxes(self):
"""

Expand Down Expand Up @@ -555,14 +572,19 @@ def onReadyToEdit(self):

def stopEdit(self):
"""When edit button is untoggled, the editing feature closes

:return:
"""

self.isEditing = False
chcklist= self.tblSeries.GetCheckedObjects()

self.tblSeries.RefreshObject(self.tblSeries.editingObject)
self.tblSeries.editingObject = None
for c in chcklist:
self.tblSeries.SetCheckState(c, True)

self.memDB.stopEdit()


def isEditing(self):
"""

Expand Down
4 changes: 2 additions & 2 deletions odmtools/controller/pageExisting.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

########################################################################
class pageExisting(wiz.WizardPageSimple):
def __init__(self, parent, title, service_man, site):
def __init__(self, parent, title, series_service , site):
"""Constructor"""
wiz.WizardPageSimple.__init__(self, parent)

Expand All @@ -30,7 +30,7 @@ def __init__(self, parent, title, service_man, site):
#pos=wx.Point(536, 285), size=wx.Size(439, 357),
#style=wx.TAB_TRAVERSAL)#, sm = service_man, series = series)
self.sizer.Add(self.pnlExisting, 85, wx.ALL, 5)
self._init_data(service_man.get_series_service(), site.id)
self._init_data(series_service, site.id)


self.pnlExisting.olvSeriesList.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnOLVItemSelected)
Expand Down
3 changes: 2 additions & 1 deletion odmtools/gui/frmFlagValues.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ def __init__(self, parent, series_service, choices, isNew=False):

self.qualchoices = choices

#len choices added in cases where ther are no flags in the database- still needs to be tested.

#len choices added in cases where ther are no flags in the database
#desired functionality is to automatically select creation of new flag
if isNew or len(choices) ==0:
self.selectedValue = NEW
Expand Down
1 change: 1 addition & 0 deletions odmtools/gui/frmODMTools.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@ def stopEdit(self, event):
self.dataTable.stopEdit()
self.pnlPlot.stopEdit()
Publisher.sendMessage("toggleEdit", checked=False)
self.memDB.reset_edit()
self.record_service = None
self._ribbon.toggleEditButtons(False)

Expand Down
42 changes: 4 additions & 38 deletions odmtools/gui/mnuPlotToolbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def __init__(self, plotCanvas, multPlots=False, allowselect=False):

self.msg = wx.StaticText(self, -1, "")
self.AddControl(self.msg)
self.canvas.mpl_connect('scroll_event', self.on_scroll_zoom)

self.Realize()

def editSeries(self, xys, edit):
Expand All @@ -149,6 +149,8 @@ def stopEdit(self):
self.xys = None
self.editCurve = None
self.lassoAction = None
# untoggle select button
self.ToggleTool(self.select_tool.Id, False)
# disable select button
self.select_tool.Enable(False)
self.zoom_to_data.Enable(False)
Expand All @@ -157,7 +159,7 @@ def stopEdit(self):
#self.ToggleTool(self.select_tool.Id, False)


# pan the graph to the left
# pan the graph to the left
def _on_custom_pan_left(self, evt):
ONE_SCREEN = 7 # we default to 1 week
axes = self.canvas.figure.axes[0]
Expand Down Expand Up @@ -248,8 +250,6 @@ def on_toggle_zoom_data_tool(self, event):
self.canvas.draw()




#must add these methods for mac functionality
def release_zoom(self, event):
super(self.__class__, self).release_zoom(event)
Expand All @@ -266,37 +266,3 @@ def forward(self, event):
def home(self, event):
super(self.__class__, self).home(event)
self.canvas.draw()




def on_scroll_zoom(self, event):
axes = self.canvas.figure.axes[0]
base_scale = 1.2
# get the current x and y limits
cur_xlim = axes.get_xlim()
cur_ylim = axes.get_ylim()
cur_xrange = (cur_xlim[1] - cur_xlim[0])*.5
cur_yrange = (cur_ylim[1] - cur_ylim[0])*.5
xdata = event.xdata # get event x location
ydata = event.ydata # get event y location
if event.button == 'up':
# deal with zoom in
scale_factor = 1/base_scale
elif event.button == 'down':
# deal with zoom out
scale_factor = base_scale
else:
# deal with something that should never happen
scale_factor = 1
print event.button
# set new limits
axes.set_xlim([xdata - cur_xrange*scale_factor,
xdata + cur_xrange*scale_factor])
axes.set_ylim([ydata - cur_yrange*scale_factor,
ydata + cur_yrange*scale_factor])
self.canvas.draw() # force re-draw

# fig = ax.get_figure() # get the figure of interest
# attach the call back

13 changes: 7 additions & 6 deletions odmtools/gui/pageMethod.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ def _init_ctrls(self, prnt):



def __init__(self, parent, id, pos, size, style, name, sm, method):
self.series_service = sm.get_series_service()
def __init__(self, parent, id, pos, size, style, name, ss, method):
self.series_service = ss
self.prev_val = method
self._init_ctrls(parent)

Expand Down Expand Up @@ -112,10 +112,10 @@ def getMethod(self):
m = Method()
if self.rbGenerate.Value:
genmethod = "Values derived from ODM Tools Python"

try:
m= self.series_service.get_method_by_description(genmethod)
except:
m= self.series_service.get_method_by_description(genmethod)
if m is None:
logger.debug("assigning new method description")
m = Method()
m.description = genmethod

elif self.rbSelect.Value:
Expand All @@ -128,5 +128,6 @@ def getMethod(self):


elif self.rbCreateNew.Value:
logger.debug("assigning new method description")
m.description = self.txtMethodDescrip.GetValue()
return m
4 changes: 2 additions & 2 deletions odmtools/gui/pageQCL.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ def _init_ctrls(self, prnt):
label=u'Explanation:', name=u'lblExplanation', parent=self,
pos=wx.Point(16, 248), size=wx.Size(61, 13), style=0)

def __init__(self, parent, id, pos, size, style, name, sm, qcl):
self.series_service = sm.get_series_service()
def __init__(self, parent, id, pos, size, style, name, ss, qcl):
self.series_service = ss
self.prev_val = qcl
self._init_ctrls(parent)

Expand Down
4 changes: 2 additions & 2 deletions odmtools/gui/pageSummary.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ def _init_ctrls(self, prnt):

self._init_sizers()

def __init__(self, parent, id, size, style, name, sm, pos= (0,0)):
self.series_service = sm.get_series_service()
def __init__(self, parent, id, size, style, name, ss, pos= (0,0)):
self.series_service = ss
self._init_ctrls(parent)


Expand Down
1 change: 1 addition & 0 deletions odmtools/gui/plotHistogram.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ def _createPlot(self, oneSeries, rows, cols, index):
ax = self.figure.add_subplot(repr(rows) + repr(cols) + repr(index))

logger.debug("HISTOGRAM: %s"% ax)
logger.debut("rows: %s cols: %s, index: %s"%(rows, cols, index))

# oneSeries.filteredData.hist(ax= ax, color='k', alpha=0.5, bins=50)

Expand Down
5 changes: 3 additions & 2 deletions odmtools/gui/pnlPlot.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,12 @@ def redrawPlots(self):
logger.debug("Plot Boxwhisker")
self.pltBox.Plot(self._seriesPlotInfo)

logger.debug("Plot Timeseries")
self.pltTS.Plot(self._seriesPlotInfo)

logger.debug("Plot Histogram")
self.pltHist.Plot(self._seriesPlotInfo)

logger.debug("Plot Timeseries")
self.pltTS.Plot(self._seriesPlotInfo)

self.onShowLegend(event=None, isVisible=self.legendVisible)
maxStart, maxEnd, currStart, currEnd = self._seriesPlotInfo.getDates()
Expand Down
Loading