Пример #1
0
    def folderitem(self, obj, item, index):
        """Service triggered each time an item is iterated in folderitems.

        The use of this service prevents the extra-loops in child objects.

        :obj: the instance of the class to be foldered
        :item: dict containing the properties of the object to be used by
            the template
        :index: current index of the item
        """
        nitem = BaseView.folderitem(self, obj, item, index)
        service = api.get_object(obj)

        nitem["minpanic"] = ""
        nitem["maxpanic"] = ""
        nitem["calculation"] = ""
        keyword = service.getKeyword()
        if keyword in self.specsresults:
            specsresults = self.specsresults[keyword]
            nitem["minpanic"] = specsresults.get("minpanic", "")
            nitem["maxpanic"] = specsresults.get("maxpanic", "")
            nitem["calculation"] = specsresults.get("calculation", "")
        nitem["choices"]["calculation"] = self.get_calculations_choices()
        nitem["allow_edit"].extend(["minpanic", "maxpanic", "calculation"])
        return nitem
Пример #2
0
    def __init__(self, context, request, fieldvalue=[], allow_edit=True):
        BaseView.__init__(self,
                          context,
                          request,
                          fieldvalue=fieldvalue,
                          allow_edit=allow_edit)

        # Add "min panic" and "max panic" fields.
        min_panic = {"title": _("Min panic"), "sortable": False}
        self.add_column('minpanic', min_panic, before='warn_min')

        max_panic = {"title": _("Max panic"), "sortable": False}
        self.add_column('maxpanic', max_panic, after='warn_max')

        calculation = {
            "title": _("Specification Calculation"),
            "sortable": False,
            "type": "choices"
        }
        self.add_column("calculation", calculation, after='hidemax')
Пример #3
0
    def __init__(self, context, request, fieldvalue=[], allow_edit=True):
        BaseView.__init__(self, context, request, fieldvalue=fieldvalue,
                          allow_edit=allow_edit)

        # Add "min panic" and "max panic" fields.
        min_panic = {"title": _("Min panic"), "sortable": False}
        self.add_column('minpanic', min_panic, before='warn_min')

        max_panic = {"title": _("Max panic"), "sortable": False}
        self.add_column('maxpanic', max_panic, after='warn_max')

        # Add Grade ranges fields
        for grade in GRADES_KEYS:
            grade_label = grade.replace("_", " ")
            grade_item = {"title": _(grade_label), "sortable": False}
            self.add_column(grade, grade_item, before="hidemax")

        # Add spec calculation column
        calculation = {"title": _("Specification Calculation"),
                       "sortable": False, "type": "choices"}
        self.add_column("calculation", calculation, after='hidemax')
 def folderitems(self):
     items = BaseView.folderitems(self)
     for i in range(len(items)):
         keyword = items[i]['keyword']
         if keyword in self.specsresults:
             res = self.specsresults[keyword]
             items[i]['minpanic'] = res.get('minpanic', '')
             items[i]['maxpanic'] = res.get('maxpanic', '')
         else:
             items[i]['minpanic'] = ''
             items[i]['maxpanic'] = ''
         items[i]['allow_edit'] += ['minpanic', 'maxpanic']
     return items
 def folderitems(self):
     items = BaseView.folderitems(self)
     for i in range(len(items)):
         keyword = items[i]['keyword']
         if keyword in self.specsresults:
             res = self.specsresults[keyword]
             items[i]['minpanic'] = res.get('minpanic', '')
             items[i]['maxpanic'] = res.get('maxpanic', '')
         else:
             items[i]['minpanic'] = ''
             items[i]['maxpanic'] = ''
         items[i]['allow_edit'] += ['minpanic', 'maxpanic']
     return items
    def __init__(self, context, request, fieldvalue, allow_edit):
        BaseView.__init__(self, context, request, fieldvalue, allow_edit)

        self.columns['minpanic'] = {'title': _('Min panic'), 'sortable': False}
        self.columns['maxpanic'] = {'title': _('Max panic'), 'sortable': False}
        self.review_states[0]['columns'] += ['minpanic', 'maxpanic']
    def __init__(self, context, request, fieldvalue, allow_edit):
        BaseView.__init__(self, context, request, fieldvalue, allow_edit)

        self.columns['minpanic'] = {'title': _('Min panic'), 'sortable': False}
        self.columns['maxpanic'] = {'title': _('Max panic'), 'sortable': False}
        self.review_states[0]['columns'] += ['minpanic', 'maxpanic']