From cb93b405a73e2c9eef55d1ac6f2bbcff2b0b9d6d Mon Sep 17 00:00:00 2001 From: Lewis O'Driscoll Date: Wed, 24 Aug 2016 13:40:16 +0100 Subject: [PATCH] Load invariant state correctly (fixes #615) --- .../sasgui/perspectives/invariant/invariant_panel.py | 10 +++++----- .../sasgui/perspectives/invariant/invariant_state.py | 3 +-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/sas/sasgui/perspectives/invariant/invariant_panel.py b/src/sas/sasgui/perspectives/invariant/invariant_panel.py index 9806b3d942..2c0a514a97 100644 --- a/src/sas/sasgui/perspectives/invariant/invariant_panel.py +++ b/src/sas/sasgui/perspectives/invariant/invariant_panel.py @@ -249,9 +249,9 @@ def set_state(self, state=None, data=None): self.state.file = data.name num = self.state.saved_state['state_num'] - if num > 0: + if int(num) > 0: self._set_undo_flag(True) - if num < len(state.state_list) - 1: + if int(num) < len(state.state_list) - 1: self._set_redo_flag(True) # get bookmarks @@ -1859,7 +1859,7 @@ def _layout_button(self): (self.button_details, 0, wx.ALL, 10), (self.button_calculate, 0, wx.RIGHT | wx.TOP | wx.BOTTOM, 10), - (self.button_help, 0, + (self.button_help, 0, wx.RIGHT | wx.TOP | wx.BOTTOM, 10),]) def _do_layout(self): """ @@ -1881,10 +1881,10 @@ def _do_layout(self): wx.LEFT | wx.RIGHT | wx.BOTTOM, 10)]) self.SetSizer(self.main_sizer) self.SetAutoLayout(True) - + def on_help(self, event): """ - Bring up the Invariant Documentation whenever the HELP button is + Bring up the Invariant Documentation whenever the HELP button is clicked. Calls DocumentationWindow with the path of the location within the diff --git a/src/sas/sasgui/perspectives/invariant/invariant_state.py b/src/sas/sasgui/perspectives/invariant/invariant_state.py index 762144d529..bc3a0fd461 100644 --- a/src/sas/sasgui/perspectives/invariant/invariant_state.py +++ b/src/sas/sasgui/perspectives/invariant/invariant_state.py @@ -425,7 +425,7 @@ def fromXML(self, file=None, node=None): val = str(input_field.text.strip()) if input_field is not None: temp_state[item] = val - self.state_list[ind] = temp_state + self.state_list[str(ind)] = temp_state # Parse current state (ie, saved_state) entry = get_content('ns:state', node) @@ -789,4 +789,3 @@ def write_toXML(self, datainfo=None, state=None): if state is not None: doc = state.toXML(datainfo.name, doc=doc, entry_node=sasentry) return doc -