Skip to content

Commit 37a86a4

Browse files
author
sreeder
committed
pass indented time spacing to new results panel #33
1 parent 516a07d commit 37a86a4

File tree

7 files changed

+19
-80
lines changed

7 files changed

+19
-80
lines changed

src/StreamingDataLoaderWizard.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,4 @@
1-
# import os
2-
# import sys
31

4-
# import ObjectListView
5-
# import pyodbc
6-
# import pymysql
7-
# import sqlite3
8-
# sys.path.insert(0,os.path.dirname(os.path.dirname(__file__)))
9-
# from src.wizard.controller.frmMain import MainController
10-
# import wx
11-
# if __name__ == '__main__':
12-
# app = wx.App()
13-
# frame = MainController(None)
14-
# frame.CenterOnScreen()
15-
# frame.Show()
16-
# app.MainLoop()
172

183
import os
194
import sys

src/controllers/Mapper.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,9 +197,7 @@ def _buildTables(self):
197197
# SDL Test Data is just for our testing purposes.
198198
df['QualityCodeCV'] = 'None'
199199
# df['QualityCodeCV'] = 'SDL Test Data'
200-
# TODO add unknown to database.
201-
#df['CensorCodeCV'] = 'Unknown'
202-
# df['CensorCodeCV'] = 'Non-detect'
200+
203201
df['CensorCodeCV'] = 'Not censored'
204202
df['ResultID'] = series['ResultID']
205203
df['ValueDateTimeUTCOffset'] = self.mapping['Settings']['UTCOffset']

src/wizard/controller/WizardDialog.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ def addButtons(self):
6262
self.btnNext.Bind(wx.EVT_BUTTON, self.onFinish)
6363
self.btnPrev.Bind(wx.EVT_BUTTON, self.onPrev)
6464

65-
def addPage(self, pnl):
66-
newPnl = pnl(self, self.existingResult)
65+
def addPage(self, pnl, **kwargs):
66+
newPnl = pnl(self, existing_result= self.existingResult, **kwargs)
6767
newPnl.Hide()
6868
self.pnlList.append(newPnl)
6969
self.pnlSizer.Add(newPnl, 1, wx.ALL|wx.EXPAND, 5)

src/wizard/controller/frmDataConfigPanel.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,9 +340,12 @@ def onSelectUnit(self, event):
340340

341341

342342
def runSeriesSelectDialog(self):
343+
unitid = self.parent.db.getReadSession().getUnits(name = self.choiceUnitID.GetString(self.choiceUnitID.Selection))[0].UnitsID
343344
dlg = SeriesSelectDialog(self,
344345
variable=self.selectedColumn,
345-
database=self.parent.db)
346+
database=self.parent.db,
347+
time_spacing = {"value": self.spinTimeSpacing.Value, "unit": unitid}
348+
)
346349
#dlg.CenterOnParent()
347350
if dlg.ShowModal() == wx.ID_OK:
348351
dlg.selectedResult.variableName = self.selectedColumn

src/wizard/controller/frmResultSummaryPanel.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,20 @@
1010

1111

1212
class ResultSummaryPanel(ResultPageView):
13-
def __init__( self, parent, existing_result=None):
13+
def __init__( self, parent, existing_result=None, **kwargs):
1414
super(ResultSummaryPanel, self).__init__(parent)
1515

1616
self.parent = parent
1717
self.existing_result = existing_result
1818
self.read_session = self.parent.database.getReadSession()
1919
self.length_units = self.read_session.getUnits(type="length")
2020
self.time_units = self.read_session.getUnits(type="time")
21+
if kwargs is not None:
22+
try:
23+
24+
self.time_spacing = kwargs.pop("time_spacing")
25+
except:
26+
pass
2127
self.fontColor = wx.Colour(67, 79, 112)
2228

2329
self.populateFields()
@@ -243,8 +249,8 @@ def createResult(self):
243249
ZLocation=z,
244250
ZLocationUnitsID=zUnit,
245251
SpatialReferenceID=sr,
246-
IntendedTimeSpacing=timeSpacing,
247-
IntendedTimeSpacingUnitsID=timeUnit)
252+
IntendedTimeSpacing=self.time_spacing["value"],
253+
IntendedTimeSpacingUnitsID=self.time_spacing["unit"])
248254
result = write.createResult(tsr)
249255

250256
print result

src/wizard/controller/frmSeriesDialog.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@
1313

1414

1515
class SeriesSelectDialog(CustomDialog):
16-
def __init__(self, parent, variable, database):
16+
def __init__(self, parent, variable, database, time_spacing):
1717
super(SeriesSelectDialog, self).__init__(parent=parent, title="Select Result for %s" % variable, size=wx.Size(700, 500))
1818
self.database = database
19+
self.time_spacing = time_spacing
1920

2021
self.parent = parent
2122
self.read = database.getReadSession()
@@ -72,7 +73,7 @@ def onNew(self, event):
7273
wiz.addPage(UnitSelectPanel)
7374
wiz.addPage(ProcLevelSelectPanel)
7475
wiz.addPage(ActionsSelectPanel)
75-
wiz.addPage(ResultSummaryPanel)
76+
wiz.addPage(ResultSummaryPanel, time_spacing= self.time_spacing)
7677

7778
wiz.CenterOnParent()
7879
if wiz.ShowModal() == wx.ID_OK:
@@ -81,7 +82,6 @@ def onNew(self, event):
8182

8283
r = read.getDetailedResultInfo("Time series coverage",
8384
wiz.result.ResultID)
84-
r_id = r[0].ResultID ###DetailedResult instance has no attribute resultID
8585

8686
r_id = r[0].ResultID
8787

src/wizard/view/clsSeriesSelectPanel.py

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -78,59 +78,6 @@ def __init__(self, parent):
7878
footer_panel_sizer.Add(footer_panel_button_sizer, 0, wx.ALIGN_RIGHT)
7979
footer_panel.SetSizer(footer_panel_sizer)
8080

81-
# A sizer that is oriented vertically.
82-
# fgSizer = wx.BoxSizer(wx.VERTICAL)
83-
# sbSizer = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, "Select or create a time series result."), wx.VERTICAL)
84-
#
85-
# # ObjectListView table.
86-
# self.listCtrl = \
87-
# ObjectListView(sbSizer.GetStaticBox(), id=wx.ID_ANY,
88-
# pos=wx.DefaultPosition,
89-
# size=wx.DefaultSize,
90-
# style=wx.LC_REPORT|wx.SUNKEN_BORDER)
91-
# # Customize the list control's message
92-
# # when it is empty.
93-
# self.listCtrl.oddRowsBackColor = wx.Colour(255, 248, 229)
94-
# self.listCtrl.evenRowsBackColor = wx.Colour(204, 229, 255)
95-
# self.listCtrl.SetEmptyListMsg("No existing time series results.")
96-
# self.listCtrl.SetObjects(None)
97-
#
98-
# columns = [
99-
# 'ResultID', 'SamplingFeatureCode', 'SamplingFeatureName', 'MethodCode', 'MethodName',
100-
# 'VariableCode', 'VariableNameCV', 'ProcessingLevelCode', 'ProcessingLevelDefinition',
101-
# 'UnitsName', 'ValueCount'
102-
# ]
103-
#
104-
# defn = [
105-
# ColumnDefn(title=key, align="left", minimumWidth=100, valueGetter=key,
106-
# stringConverter='%s')
107-
# for key in columns]
108-
#
109-
# self.listCtrl.SetColumns(defn)
110-
# self.editBtn = wx.Button(self, label="Edit Result")
111-
# self.newBtn = wx.Button(self, label="Create New Result")
112-
#
113-
# self.editBtn.Enable(False)
114-
#
115-
# dlgBtnSizer = wx.StdDialogButtonSizer()
116-
# editBtnSizer = wx.BoxSizer(wx.HORIZONTAL)
117-
# self.okBtn = wx.Button(self, wx.ID_OK)
118-
# cancelBtn = wx.Button(self, wx.ID_CANCEL)
119-
#
120-
# editBtnSizer.Add(self.editBtn)
121-
# dlgBtnSizer.AddButton(self.okBtn)
122-
# dlgBtnSizer.AddButton(cancelBtn)
123-
# editBtnSizer.Add(self.newBtn)
124-
# dlgBtnSizer.Realize()
125-
# # Add it to the sizer.
126-
# # The EXPAND flag along with the number 1 will
127-
# # enable the list to fill the panel.
128-
# sbSizer.Add(self.listCtrl, 1, wx.ALL|wx.EXPAND, 5)
129-
# fgSizer.Add(sbSizer, 1, wx.EXPAND, 5)
130-
# fgSizer.Add(editBtnSizer, 0, wx.ALL|wx.ALIGN_RIGHT, 5)
131-
# fgSizer.Add(dlgBtnSizer, 0, wx.ALL|wx.ALIGN_RIGHT, 5)
132-
# # Assign the sizer to the panel.
133-
# self.SetSizer(fgSizer)
13481

13582
master_sizer = wx.BoxSizer(wx.VERTICAL)
13683
master_sizer.Add(top_panel, 0, wx.EXPAND | wx.ALL, 0)

0 commit comments

Comments
 (0)