Commit 74be3c39 by Celine Mercier

Cython: Views: JSON formatted comments and history handling

parent c6ee0bad
......@@ -103,6 +103,10 @@ cdef extern from "obiview.h" nogil:
int obi_view_create_column_alias(Obiview_p view, const_char_p current_name, const_char_p alias)
int obi_view_write_comments(Obiview_p view, const_char_p comments)
int obi_view_add_comment(Obiview_p view, const_char_p key, const_char_p value)
int obi_save_and_close_view(Obiview_p view)
int obi_clean_unfinished_views(OBIDMS_p dms)
......
......@@ -12,12 +12,13 @@ from obitools3.dms.dms cimport DMS
from obitools3.dms.capi.obitypes cimport index_t
from obitools3.utils cimport tobytes, bytes2str
from obitools3.utils cimport tobytes, bytes2str, str2bytes
from obitools3.dms.capi.obidms cimport OBIDMS_p
from obitools3.dms.object cimport OBIWrapper
import json
cdef class View_NUC_SEQS(View):
......@@ -25,7 +26,7 @@ cdef class View_NUC_SEQS(View):
@staticmethod
def new(DMS dms,
object view_name,
object comments=None,
dict comments={},
bint quality=False):
cdef bytes view_name_b = tobytes(view_name)
......@@ -35,10 +36,7 @@ cdef class View_NUC_SEQS(View):
cdef View_NUC_SEQS view
if comments is not None:
comments_b = tobytes(comments)
else:
comments_b = b''
comments_b = str2bytes(json.dumps(comments))
pointer = <void*>obi_new_view_nuc_seqs(<OBIDMS_p>dms._pointer,
view_name_b,
......
......@@ -38,6 +38,10 @@ cdef class View(OBIWrapper):
list lines=*)
cdef class View_comments(dict):
cdef View _view
cdef class Line_selection(list):
cdef View _view
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment