Skip to content

Commit 6c0137a

Browse files
author
Francisco Arrieta
committed
Added the action form to the wizard and created a get all affiliations
1 parent 2c26bb1 commit 6c0137a

4 files changed

Lines changed: 100 additions & 4 deletions

File tree

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import wx
2+
from odmtools.view.WizardActionView import WizardActionView
3+
from wx.wizard import WizardPageSimple
4+
5+
6+
class WizardActionController(WizardPageSimple):
7+
def __init__(self, parent, affiliations):
8+
WizardPageSimple.__init__(self, parent)
9+
self.action_view = WizardActionView(self)
10+
self.affiliations = affiliations
11+
12+
master_sizer = wx.BoxSizer(wx.VERTICAL)
13+
master_sizer.Add(self.action_view, 1, wx.EXPAND | wx.RIGHT, 0)
14+
self.SetSizer(master_sizer)
15+
16+
if self.affiliations is None:
17+
return
18+
# Populate table with the affiliations
19+
20+
21+
if __name__ == '__main__':
22+
app = wx.App(False)
23+
controller = WizardActionController(None, None)
24+
controller.Show()
25+
app.MainLoop()

odmtools/gui/wizSave.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ def fill_summary(self):
207207
from odmtools.controller.WizardMethodController import WizardMethodController
208208
from odmtools.controller.WizardProcessLevelController import WizardProcessLevelController
209209
from odmtools.controller.WizardVariableController import WizardVariableController
210+
from odmtools.controller.WizardActionController import WizardActionController
210211

211212

212213
class wizSave(wx.wizard.Wizard):
@@ -269,6 +270,11 @@ def __init__(self, parent, service_manager, record_service):
269270
current_variable=self.currSeries.VariableObj)
270271
self.pgExisting = pageExisting.pageExisting(self, "Existing Series", self.series_service,
271272
self.currSeries.FeatureActionObj.SamplingFeatureObj)
273+
274+
affiliations = self.series_service.get_all_affiliations()
275+
276+
self.action_page = WizardActionController(self, affiliations=affiliations)
277+
272278
self.pgSummary = SummaryPage(self, "Summary", self.series_service)
273279

274280
self.FitToPage(self.pgIntro)
@@ -277,7 +283,6 @@ def __init__(self, parent, service_manager, record_service):
277283
self.pgIntro.SetNext(self.pgSummary)
278284
self.pgSummary.SetPrev(self.pgIntro)
279285

280-
281286
#SaveAs Pages
282287
self.pgMethod.SetPrev(self.pgIntro)
283288
self.pgMethod.SetNext(self.pgQCL)
@@ -286,7 +291,10 @@ def __init__(self, parent, service_manager, record_service):
286291
self.pgQCL.SetNext(self.pgVariable)
287292

288293
self.pgVariable.SetPrev(self.pgQCL)
289-
self.pgVariable.SetNext(self.pgSummary)
294+
self.pgVariable.SetNext(self.action_page)
295+
296+
self.action_page.SetPrev(self.pgVariable)
297+
self.action_page.SetNext(self.pgSummary)
290298

291299
#Save existing page
292300
self.pgExisting.SetPrev(self.pgIntro)
@@ -308,7 +316,7 @@ def on_page_changing(self, event):
308316

309317
elif self.pgIntro.pnlIntroduction.rbSaveAs.GetValue():
310318
self.pgIntro.SetNext(self.pgMethod)
311-
self.pgSummary.SetPrev(self.pgVariable)
319+
self.pgSummary.SetPrev(self.action_page)
312320

313321
else:
314322
self.pgIntro.SetNext(self.pgExisting)

odmtools/odmservices/series_service.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1074,4 +1074,7 @@ def get_all_annotations(self):
10741074
return self.read.getAnnotations(type=None)
10751075

10761076
def get_aggregation_statistic(self):
1077-
return self.read.getCVs(type="aggregationstatistic")
1077+
return self.read.getCVs(type="aggregationstatistic")
1078+
1079+
def get_all_affiliations(self):
1080+
return self.read.getAffiliations(ids=None, personfirst=None, personlast=None, orgcode=None)

odmtools/view/WizardActionView.py

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
import wx
2+
from odmtools.view.CustomListCtrl import CustomListCtrl
3+
import wx.lib.scrolledpanel
4+
5+
6+
class WizardActionView(wx.lib.scrolledpanel.ScrolledPanel):
7+
def __init__(self, parent):
8+
wx.lib.scrolledpanel.ScrolledPanel.__init__(self, parent)
9+
10+
# Header
11+
header_text = wx.StaticText(self, label="Action")
12+
static_line = wx.StaticLine(self, size=(-1, 12))
13+
14+
font = wx.Font(18, wx.SWISS, wx.NORMAL, wx.BOLD)
15+
header_text.SetFont(font)
16+
17+
# REQUIRED FIELDS
18+
required_static_box_sizer = wx.StaticBoxSizer(box=wx.StaticBox(self, label="Required Fields"), orient=wx.VERTICAL)
19+
affiliations_text = wx.StaticText(self, label="Affiliations")
20+
self.affiliations_table = CustomListCtrl(self)
21+
22+
row_sizer = wx.BoxSizer(wx.HORIZONTAL)
23+
row_sizer.Add(affiliations_text, 0, wx.EXPAND)
24+
required_static_box_sizer.Add(row_sizer, 0, wx.EXPAND | wx.ALL, 5)
25+
26+
row_sizer = wx.BoxSizer(wx.HORIZONTAL)
27+
row_sizer.Add(self.affiliations_table, 1, wx.EXPAND)
28+
required_static_box_sizer.Add(row_sizer, 0, wx.EXPAND | wx.ALL, 5)
29+
30+
# OPTIONAL FIELDS
31+
optional_static_box_sizer = wx.StaticBoxSizer(box=wx.StaticBox(self, label="Optional Fields"), orient=wx.VERTICAL)
32+
action_file_link_text = wx.StaticText(self, label="Action File Link")
33+
action_file_link_text_box = wx.TextCtrl(self)
34+
description_text = wx.StaticText(self, label="Description")
35+
description_text_box = wx.TextCtrl(self, style=wx.TE_MULTILINE)
36+
role_description_text = wx.StaticText(self, label="Role Description")
37+
role_description_text_box = wx.TextCtrl(self, style=wx.TE_MULTILINE)
38+
39+
flex_grid_sizer = wx.FlexGridSizer(rows=3, cols=2, vgap=9, hgap=25)
40+
41+
flex_grid_sizer.AddMany([(action_file_link_text), (action_file_link_text_box, 1, wx.EXPAND),
42+
(description_text), (description_text_box, 1, wx.EXPAND),
43+
(role_description_text), (role_description_text_box, 1, wx.EXPAND)
44+
])
45+
46+
flex_grid_sizer.AddGrowableRow(1, 1)
47+
flex_grid_sizer.AddGrowableCol(1, 1)
48+
49+
row_sizer = wx.BoxSizer(wx.HORIZONTAL)
50+
row_sizer.Add(flex_grid_sizer, 1, wx.EXPAND)
51+
optional_static_box_sizer.Add(row_sizer, 0, wx.EXPAND | wx.ALL, 5)
52+
53+
master_sizer = wx.BoxSizer(wx.VERTICAL)
54+
master_sizer.Add(header_text, 0, wx.ALIGN_CENTER | wx.ALL, 5)
55+
master_sizer.Add(static_line, 0, wx.EXPAND | wx.TOP, 5)
56+
master_sizer.Add(required_static_box_sizer, 0, wx.EXPAND | wx.TOP, 5)
57+
master_sizer.Add(optional_static_box_sizer, 0, wx.EXPAND | wx.TOP, 5)
58+
59+
self.SetSizer(master_sizer)
60+
# master_sizer.Fit(self)

0 commit comments

Comments
 (0)