Skip to content

Commit 50c53a0

Browse files
author
stephanie
committed
retain plotting series after saving
1 parent adaffe5 commit 50c53a0

File tree

2 files changed

+36
-6
lines changed

2 files changed

+36
-6
lines changed

odmtools/controller/frmSeriesSelector.py

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,10 @@ def refreshTableSeries(self, db):
8484
8585
:return:
8686
"""
87+
88+
chcklist= self.tblSeries.GetCheckedObjects()
89+
90+
8791
self.memDB.set_series_service(db)
8892
object = self.series_service.get_all_series()
8993
#checkedObjs = self.tblSeries.GetCheckedObjects()
@@ -93,6 +97,10 @@ def refreshTableSeries(self, db):
9397
if x.id not in idList:
9498
self.tblSeries.AddObject(x)
9599

100+
101+
for c in chcklist:
102+
self.tblSeries.SetCheckState(c, True)
103+
96104
#for x in checkedObjs:
97105
# super(FastObjectListView, self.tblSeries).SetCheckState(x, True)
98106

@@ -101,10 +109,18 @@ def refreshSeries(self):
101109
102110
:return:
103111
"""
112+
chcklist= self.tblSeries.GetCheckedObjects()
104113
self.series_service = None
114+
105115
self.series_service = self.parent.Parent.createService()
106116
#self.refreshTableSeries(self.dbservice)
107117
self.resetDB(self.series_service)
118+
for c in chcklist:
119+
for val in self.tblSeries.GetObjects():
120+
if c == val:
121+
self.tblSeries.SetCheckState(val, True)
122+
break
123+
108124
logger.debug("Repopulate Series Selector")
109125

110126
def initSVBoxes(self):
@@ -560,13 +576,11 @@ def stopEdit(self):
560576
"""
561577

562578
self.isEditing = False
563-
if self.tblSeries.editingObject in self.tblSeries.GetCheckedObjects():
564-
ischecked =True
565-
else:
566-
ischecked = False
579+
chcklist= self.tblSeries.GetCheckedObjects()
580+
567581
self.tblSeries.RefreshObject(self.tblSeries.editingObject)
568-
if ischecked and self.tblSeries.editingObject not in self.tblSeries.GetCheckedObjects():
569-
self.tblSeries.ToggleCheck(self.tblSeries.editingObject)
582+
for c in chcklist:
583+
self.tblSeries.SetCheckState(c, True)
570584

571585
self.memDB.stopEdit()
572586

odmtools/odmdata/series.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,22 @@ class Series(Base):
9696
def __repr__(self):
9797
return "<Series('%s', '%s', '%s', '%s')>" % (self.id, self.site_name, self.variable_code, self.variable_name)
9898

99+
def __eq__(self, other) :
100+
# return self.__dict__ == other.__dict__
101+
return [self.id, self.site_id, self.site_code, self.site_name, self.variable_id, self.variable_code,
102+
self.variable_name, self.speciation, self.variable_units_id, self.variable_units_name,
103+
self.sample_medium, self.value_type, self.time_support, self.time_units_id, self.time_units_name,
104+
self.data_type, self.general_category, self.method_id, self.method_description,
105+
self.source_id, self.source_description, self.organization, self.citation,
106+
self.quality_control_level_id, self.quality_control_level_code, self.begin_date_time,
107+
self.end_date_time, self.begin_date_time_utc, self.end_date_time_utc, self.value_count] ==\
108+
[other.id, other.site_id, other.site_code, other.site_name, other.variable_id, other.variable_code,
109+
other.variable_name, other.speciation, other.variable_units_id, other.variable_units_name,
110+
other.sample_medium, other.value_type, other.time_support, other.time_units_id, other.time_units_name,
111+
other.data_type, other.general_category, other.method_id, other.method_description,
112+
other.source_id, other.source_description, other.organization, other.citation,
113+
other.quality_control_level_id, other.quality_control_level_code, other.begin_date_time,
114+
other.end_date_time, other.begin_date_time_utc, other.end_date_time_utc, other.value_count]
99115

100116
def get_table_columns(self):
101117
return self.__table__.columns.keys()

0 commit comments

Comments
 (0)