From 10b22f79da8434d6ad56370f61e625ee58f41281 Mon Sep 17 00:00:00 2001 From: Celine Mercier Date: Fri, 12 Aug 2016 17:39:19 +0200 Subject: [PATCH] The cython subclass is now correctly chosen when cloning a view --- python/obitools3/obidms/_obidms.pyx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/python/obitools3/obidms/_obidms.pyx b/python/obitools3/obidms/_obidms.pyx index 1824385..cbf73ad 100644 --- a/python/obitools3/obidms/_obidms.pyx +++ b/python/obitools3/obidms/_obidms.pyx @@ -694,14 +694,20 @@ cdef class OBIDMS : cdef object view_class + # Get right subclass depending on view type if view_type is not None : if view_type == bytes2str(VIEW_TYPE_NUC_SEQS) : view_class = OBIView_NUC_SEQS else : view_class = OBIView + # Check the type of the view to clone if there is one # TODO make generic for future other view types + if view_to_clone is not None and \ + ((type(view_to_clone) == str and self.read_view_infos(view_to_clone)["view_type"] == VIEW_TYPE_NUC_SEQS) or \ + isinstance(view_to_clone, OBIView_NUC_SEQS)) : + view_class = OBIView_NUC_SEQS return view_class(self, view_name, new=True, view_to_clone=view_to_clone, line_selection=line_selection, comments=comments) - + cpdef dict read_view_infos(self, str view_name) :