Hi,

could you try the attached patch please?

Benjamin

On Wed, 2016-12-21 at 10:52 +0100, Thomas Fischer wrote:
> Hello,
> 
> I recently conducted a study using SDAPS and now want to check the 
> submitted questionnaires as recognized using the “gui” command of 
> SDAPS.
> However, instead of the graphical user interface, I get the 
> following output in my terminal:
> 
> Traceback (most recent call last):
>   File "/usr/lib/python2.7/site-packages/sdaps/gui/__init__.py", 
> line 364, in page_number_combo_changed_cb
>     self.update_ui()
>   File "/usr/lib/python2.7/site-packages/sdaps/gui/__init__.py", 
> line 306, in update_ui
>     self.provider.survey.questionnaire.widget.sync_state()
>   File "/usr/lib/python2.7/site-packages/sdaps/gui/
> widget_buddies.py", line 98, in sync_state
>     qobject.widget.sync_state()
>   File "/usr/lib/python2.7/site-packages/sdaps/gui/
> widget_buddies.py", line 134, in sync_state
>     box.widget.sync_state()
>   File "/usr/lib/python2.7/site-packages/sdaps/gui/
> widget_buddies.py", line 296, in sync_state
>     self.checkbox.props.active = self.obj.data.state
>   File "/usr/lib/python2.7/site-packages/sdaps/model/
> questionnaire.py", line 36, in get_data
>     self.sheet.data[self.id] = getattr(data, 
> self.__class__.__name__)(self)
>   File "/usr/lib/python2.7/site-packages/sdaps/model/data.py", line 
> 73, in __init__
>     self.text = unicode()
>   File "/usr/lib/python2.7/site-packages/sdaps/model/data.py", line 
> 47, in __setattr__
>     self._parent.question.questionnaire.notify_data_changed(self._par
> ent, 
> self, name, old_value)
>   File "/usr/lib/python2.7/site-packages/sdaps/model/
> questionnaire.py", line 77, in notify_data_changed
>     func(self, qobj, dobj, name, old_value)
>   File "/usr/lib/python2.7/site-packages/sdaps/gui/
> widget_buddies.py", line 51, in data_changed
>     self.sync_state()
>   File "/usr/lib/python2.7/site-packages/sdaps/gui/
> widget_buddies.py", line 98, in sync_state
>     qobject.widget.sync_state()
>   File "/usr/lib/python2.7/site-packages/sdaps/gui/
> widget_buddies.py", line 134, in sync_state
>     box.widget.sync_state()
>   File "/usr/lib/python2.7/site-packages/sdaps/gui/
> widget_buddies.py", line 296, in sync_state
>     self.checkbox.props.active = self.obj.data.state
>   File "/usr/lib/python2.7/site-packages/sdaps/model/
> questionnaire.py", line 36, in get_data
>     self.sheet.data[self.id] = getattr(data, 
> self.__class__.__name__)(self)
>   File "/usr/lib/python2.7/site-packages/sdaps/model/data.py", line 
> 73, in __init__
>     self.text = unicode()
>   File "/usr/lib/python2.7/site-packages/sdaps/model/data.py", line 
> 47, in __setattr__
>     self._parent.question.questionnaire.notify_data_changed(self._par
> ent, 
> self, name, old_value)
>   File "/usr/lib/python2.7/site-packages/sdaps/model/
> questionnaire.py", line 77, in notify_data_changed
>     func(self, qobj, dobj, name, old_value)
>   File "/usr/lib/python2.7/site-packages/sdaps/gui/
> widget_buddies.py", line 51, in data_changed
>     self.sync_state()
>   File "/usr/lib/python2.7/site-packages/sdaps/gui/
> widget_buddies.py", line 98, in sync_state
>     qobject.widget.sync_state()
>   File "/usr/lib/python2.7/site-packages/sdaps/gui/
> widget_buddies.py", line 134, in sync_state
>     box.widget.sync_state()
>   File "/usr/lib/python2.7/site-packages/sdaps/gui/
> widget_buddies.py", line 296, in sync_state
>     self.checkbox.props.active = self.obj.data.state
>   File "/usr/lib/python2.7/site-packages/sdaps/model/
> questionnaire.py", line 36, in get_data
>     self.sheet.data[self.id] = getattr(data, 
> self.__class__.__name__)(self)
>   File "/usr/lib/python2.7/site-packages/sdaps/model/data.py", line 
> 73, in __init__
>     self.text = unicode()
>   File "/usr/lib/python2.7/site-packages/sdaps/model/data.py", line 
> 47, in __setattr__
>     self._parent.question.questionnaire.notify_data_changed(self._par
> ent, 
> self, name, old_value)
>   File "/usr/lib/python2.7/site-packages/sdaps/model/
> questionnaire.py", line 77, in notify_data_changed
>     func(self, qobj, dobj, name, old_value)
> 
> 
> [ about 2000 lines repeating above pattern, omitted here]
> 
>   File "/usr/lib/python2.7/site-packages/sdaps/model/data.py", line 
> 47, in __setattr__
>     self._parent.question.questionnaire.notify_data_changed(self._par
> ent, 
> self, name, old_value)
>   File "/usr/lib/python2.7/site-packages/sdaps/model/
> questionnaire.py", line 77, in notify_data_changed
>     func(self, qobj, dobj, name, old_value)
>   File "/usr/lib/python2.7/site-packages/sdaps/gui/
> widget_buddies.py", line 51, in data_changed
>     self.sync_state()
>   File "/usr/lib/python2.7/site-packages/sdaps/gui/
> widget_buddies.py", line 98, in sync_state
>     qobject.widget.sync_state()
>   File "/usr/lib/python2.7/site-packages/sdaps/gui/
> widget_buddies.py", line 134, in sync_state
>     box.widget.sync_state()
>   File "/usr/lib/python2.7/site-packages/sdaps/gui/
> widget_buddies.py", line 243, in sync_state
>     self.widget.props.active = self.obj.data.state
>   File "/usr/lib/python2.7/site-packages/sdaps/model/
> questionnaire.py", line 35, in get_data
>     if not self.id in self.sheet.data:
>   File "/usr/lib/python2.7/site-packages/sdaps/model/
> questionnaire.py", line 363, in get_sheet
>     return self.question.sheet
>   File "/usr/lib/python2.7/site-packages/sdaps/model/
> questionnaire.py", line 127, in get_sheet
>     return self.questionnaire.sheet
> RuntimeError: maximum recursion depth exceeded
> 
> 
> I am using SDAPS version 1.1.11 on ArchLinux, compiled from source.
> 
> I have patched the source code to avoid warnings from “gi” about a 
> missing statement/configuration which Gtk version to use. The 
> applied patch reads as follows:
> 
> diff -Naur sdaps-1.1.11/sdaps/gui/__init__.py sdaps-1.1.11-gtk3/
> sdaps/gui/__init__.py
> --- sdaps-1.1.11/sdaps/gui/__init__.py  2015-02-14 
> 19:45:36.000000000 +0100
> +++ sdaps-1.1.11-gtk3/sdaps/gui/__init__.py     2016-12-20 
> 17:25:14.132122130 +0100
> @@ -21,7 +21,8 @@
>  possible to manually correct the automatic recognition and do basic 
> debugging.
>  """
>  
> -
> +import gi
> +gi.require_version('Gtk', '3.0')
>  from gi.repository import GObject
>  from gi.repository import GLib
>  from gi.repository import Gtk
> diff -Naur sdaps-1.1.11/sdaps/gui/sheet_widget.py sdaps-1.1.11-gtk3/
> sdaps/gui/sheet_widget.py
> --- sdaps-1.1.11/sdaps/gui/sheet_widget.py      2014-12-20 
> 16:01:30.000000000 +0100
> +++ sdaps-1.1.11-gtk3/sdaps/gui/sheet_widget.py 2016-12-20 
> 17:25:17.515275723 +0100
> @@ -17,6 +17,8 @@
>  # along with this program.  If not, see <http://www.gnu.org/
> licenses/>.
>  
>  import math
> +import gi
> +gi.require_version('Gtk', '3.0')
>  from gi.repository import GObject
>  from gi.repository import Gtk
>  from gi.repository import Gdk
> diff -Naur sdaps-1.1.11/sdaps/gui/widget_buddies.py sdaps-1.1.11-
> gtk3/sdaps/gui/widget_buddies.py
> --- sdaps-1.1.11/sdaps/gui/widget_buddies.py    2015-02-14 
> 19:45:36.000000000 +0100
> +++ sdaps-1.1.11-gtk3/sdaps/gui/widget_buddies.py       2016-12-20 
> 17:25:20.185134273 +0100
> @@ -16,6 +16,8 @@
>  # You should have received a copy of the GNU General Public License
>  # along with this program.  If not, see <http://www.gnu.org/
> licenses/>.
>  
> +import gi
> +gi.require_version('Gtk', '3.0')
>  from gi.repository import Gtk
>  from gi.repository import GLib
>  import cairo
> diff -Naur sdaps-1.1.11/sdaps/utils/paper.py sdaps-1.1.11-gtk3/
> sdaps/utils/paper.py
> --- sdaps-1.1.11/sdaps/utils/paper.py   2015-02-14 
> 19:45:36.000000000 +0100
> +++ sdaps-1.1.11-gtk3/sdaps/utils/paper.py      2016-12-20 
> 17:24:59.522904885 +0100
> @@ -19,6 +19,8 @@
>  
>  def _get_gtk_ppd_papersize(paper=None):
>      try:
> +        import gi
> +        gi.require_version('Gtk', '3.0')
>          from gi.repository import Gtk
>      except:
>          return paper, None
> 
> 
> Anyone has an idea about why there is an endless recursion in the 
> code?
> 
> Looking forward to your answers!
> 
> Bye,
> Thomas Fischer
> 
From b581086f57cb4e7d64c5783901d4d2081c586a2a Mon Sep 17 00:00:00 2001
From: Benjamin Berg <[email protected]>
Date: Wed, 21 Dec 2016 11:24:27 +0100
Subject: [PATCH] model: Fix GUI recursion due to wrong initialization order

This issue has been reported by Thomas Fischer <[email protected]>

Signed-off-by: Benjamin Berg <[email protected]>
---
 sdaps/model/data.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sdaps/model/data.py b/sdaps/model/data.py
index e85a287..994396c 100644
--- a/sdaps/model/data.py
+++ b/sdaps/model/data.py
@@ -68,10 +68,10 @@ class Checkbox(Box):
 class Textbox(Box):
 
     def __init__(self, parent):
-        Box.__init__(self, parent)
-
         self.text = unicode()
 
+        Box.__init__(self, parent)
+
 
 class Additional_Mark(object):
 
-- 
2.11.0

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to