dataobject.py 1.56 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# copyright 2016 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr -- mailto:contact@logilab.fr
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the Free
# Software Foundation, either version 2.1 of the License, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
# details.
#
# You should have received a copy of the GNU Lesser General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
"""cubicweb-seda views for data objects (BinaryDataObject / PhysicalDataObject)"""

from cubicweb.web import formwidgets as fw
from cubicweb.web.views import uicfg

from cubes.relationwidget import views as rwdg


affk = uicfg.autoform_field_kwargs
pvdc = uicfg.primaryview_display_ctrl

for etype in ('SEDABinaryDataObject', 'SEDAPhysicalDataObject'):
28
29
    affk.set_fields_order(etype, ('id', 'user_cardinality', 'user_annotation'))
    pvdc.set_fields_order(etype, ('id', 'user_cardinality', 'user_annotation'))
30
31
32
33
34
35

affk.set_field_kwargs('*', 'id', widget=fw.TextInput({'size': 80}))

for rtype in ('seda_mime_type_to', 'seda_encoding_to', 'seda_format_id_to', 'seda_algorithm'):
    affk.tag_subject_of(('*', rtype, '*'),
                        {'widget': rwdg.RelationFacetWidget(dialog_options={'width': 800})})