当前位置: 首页>>代码示例>>Python>>正文


Python AnalysesView.folderitems方法代码示例

本文整理汇总了Python中bika.lims.browser.analyses.AnalysesView.folderitems方法的典型用法代码示例。如果您正苦于以下问题:Python AnalysesView.folderitems方法的具体用法?Python AnalysesView.folderitems怎么用?Python AnalysesView.folderitems使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在bika.lims.browser.analyses.AnalysesView的用法示例。


在下文中一共展示了AnalysesView.folderitems方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: folderitems

# 需要导入模块: from bika.lims.browser.analyses import AnalysesView [as 别名]
# 或者: from bika.lims.browser.analyses.AnalysesView import folderitems [as 别名]
 def folderitems(self):
     self.contentsMethod = self.context.getAnalyses
     items = AnalysesView.folderitems(self)
     for x in range(len(items)):
         if not items[x].has_key('obj'):
             continue
         obj = items[x]['obj']
         ar = obj.aq_parent
         items[x]['replace']['Request'] = "<a href='%s'>%s</a>"%(ar.absolute_url(), ar.Title())
     return items
开发者ID:udithap,项目名称:Bika-LIMS,代码行数:12,代码来源:sample.py

示例2: folderitems

# 需要导入模块: from bika.lims.browser.analyses import AnalysesView [as 别名]
# 或者: from bika.lims.browser.analyses.AnalysesView import folderitems [as 别名]
 def folderitems(self):
     self.contentsMethod = self.context.getAnalyses
     items = AnalysesView.folderitems(self)
     for x in range(len(items)):
         if not items[x].has_key("obj"):
             continue
         obj = items[x]["obj"]
         ar = obj.aq_parent
         items[x]["replace"]["Request"] = "<a href='%s'>%s</a>" % (ar.absolute_url(), ar.Title())
         items[x]["replace"]["Priority"] = " "  # TODO this space is required for it to work
     return items
开发者ID:bikalabs,项目名称:bika.lims,代码行数:13,代码来源:analyses.py

示例3: folderitems

# 需要导入模块: from bika.lims.browser.analyses import AnalysesView [as 别名]
# 或者: from bika.lims.browser.analyses.AnalysesView import folderitems [as 别名]
    def folderitems(self):
        items = AnalysesView.folderitems(self)
        items.sort(key=itemgetter('CaptureDate'), reverse=True)
        for i in range(len(items)):
            obj = items[i]['obj']
            imgtype = ""
            if obj.portal_type == 'ReferenceAnalysis':
                antype = QCANALYSIS_TYPES.getValue(obj.getReferenceType())
                if obj.getReferenceType() == 'c':
                    imgtype = "<img title='%s' src='%s/++resource++bika.lims.images/control.png'/>&nbsp;" % (antype, self.context.absolute_url())
                if obj.getReferenceType() == 'b':
                    imgtype = "<img title='%s' src='%s/++resource++bika.lims.images/blank.png'/>&nbsp;" % (antype, self.context.absolute_url())
                items[i]['replace']['Partition'] = "<a href='%s'>%s</a>" % (obj.aq_parent.absolute_url(), obj.aq_parent.id)
            elif obj.portal_type == 'DuplicateAnalysis':
                antype = QCANALYSIS_TYPES.getValue('d')
                imgtype = "<img title='%s' src='%s/++resource++bika.lims.images/duplicate.png'/>&nbsp;" % (antype, self.context.absolute_url())
                items[i]['sortcode'] = '%s_%s' % (obj.getSample().id, obj.getService().getKeyword())
            else:
                items[i]['sortcode'] = '%s_%s' % (obj.getSample().id, obj.getService().getKeyword())

            items[i]['before']['Service'] = imgtype

            # Get retractions field
            pdf = obj.getRetractedAnalysesPdfReport()
            title = ''
            anchor = ''
            try:
                if pdf:
                    filesize = 0
                    title = _('Retractions')
                    anchor = "<a class='pdf' target='_blank' href='%s/at_download/RetractedAnalysesPdfReport'>%s</a>" % \
                             (obj.absolute_url(), _("Retractions"))
                    filesize = pdf.get_size()
                    filesize = filesize / 1024 if filesize > 0 else 0
            except:
                # POSKeyError: 'No blob file'
                # Show the record, but not the link
                title = _('Retraction report unavailable')
                anchor = title
            items[i]['Retractions'] = title
            items[i]['replace']['Retractions'] = anchor


            # Create json
            qcid = obj.aq_parent.id;
            serviceref = "%s (%s)" % (items[i]['Service'], items[i]['Keyword'])
            trows = self.anjson.get(serviceref, {});
            anrows = trows.get(qcid, []);
            anid = '%s.%s' % (items[i]['getReferenceAnalysesGroupID'],
                              items[i]['id'])

            rr = obj.aq_parent.getResultsRangeDict()
            uid = obj.getServiceUID()
            if uid in rr:
                specs = rr[uid];
                try:
                    smin  = float(specs.get('min', 0))
                    smax = float(specs.get('max', 0))
                    error  = float(specs.get('error', 0))
                    target = float(specs.get('result', 0))
                    result = float(items[i]['Result'])
                    error_amount = ((target / 100) * error) if target > 0 else 0
                    upper  = smax + error_amount
                    lower   = smin - error_amount

                    anrow = { 'date': items[i]['CaptureDate'],
                              'min': smin,
                              'max': smax,
                              'target': target,
                              'error': error,
                              'erroramount': error_amount,
                              'upper': upper,
                              'lower': lower,
                              'result': result,
                              'unit': items[i]['Unit'],
                              'id': items[i]['uid'] }
                    anrows.append(anrow);
                    trows[qcid] = anrows;
                    self.anjson[serviceref] = trows
                except:
                    pass

        return items
开发者ID:Ammy2,项目名称:Bika-LIMS,代码行数:85,代码来源:instrument.py

示例4: folderitems

# 需要导入模块: from bika.lims.browser.analyses import AnalysesView [as 别名]
# 或者: from bika.lims.browser.analyses.AnalysesView import folderitems [as 别名]
    def folderitems(self):
        self.analyst = self.context.getAnalyst().strip()
        self.instrument = self.context.getInstrument()
        self.contentsMethod = self.context.getFolderContents
        items = AnalysesView.folderitems(self)
        layout = self.context.getLayout()
        highest_position = 0
        for x, item in enumerate(items):
            obj = item['obj']
            pos = [int(slot['position']) for slot in layout if
                   slot['analysis_uid'] == obj.UID()][0]
            highest_position = max(highest_position, pos)
            items[x]['Pos'] = pos
            items[x]['colspan'] = {'Pos':1}
            service = obj.getService()
            method = service.getMethod()
            items[x]['Service'] = service.Title()
            items[x]['Method'] = method and method.Title() or ''
            items[x]['class']['Service'] = 'service_title'
            items[x]['Category'] = service.getCategory().Title()
            if obj.portal_type == "ReferenceAnalysis":
                items[x]['DueDate'] = ''
            else:
                items[x]['DueDate'] = self.ulocalized_time(obj.getDueDate())

            items[x]['Order'] = ''

        # insert placeholder row items in the gaps
        empties = []
        used = [int(slot['position']) for slot in layout]
        for pos in range(1, highest_position + 1):
            if pos not in used:
                empties.append(pos)
                item = {}
                item.update({
                    'obj': self.context,
                    'id': self.context.id,
                    'uid': self.context.UID(),
                    'title': self.context.Title(),
                    'type_class': 'blank-worksheet-row',
                    'url': self.context.absolute_url(),
                    'relative_url': self.context.absolute_url(),
                    'view_url': self.context.absolute_url(),
                    'path': "/".join(self.context.getPhysicalPath()),
                    'before': {},
                    'after': {},
                    'choices': {},
                    'class': {},
                    'state_class': 'state-empty',
                    'allow_edit': [],
                    'colspan': {'Pos':len(self.columns) + len(self.interim_fields)},
                    'rowspan': {'Pos':1},
                    'Pos': pos,
                    'Service': '',
                    'Attachments': '',
                    'state_title': 's'})
                item['replace'] = {
                    'Pos': "<table width='100%' cellpadding='0' cellspacing='0'>" + \
                            "<tr><td class='pos'>%s</td>" % pos + \
                            "<td align='right'>&nbsp;</td></tr></table>",
                    'select_column': '',
                    }
                items.append(item)

        items = sorted(items, key = itemgetter('Service'))
        items = sorted(items, key = itemgetter('Pos'))

        slot_items = {} # pos:[item_nrs]
        for x in range(len(items)):
            p = items[x]['Pos']
            if p in slot_items:
                slot_items[p].append(x)
            else:
                slot_items[p] = [x, ]
        actual_table_position = -1
        # The first item in items[this position] gets a rowspan for it's
        # "Position" column, which spans all other table rows in this position.
        for pos, pos_items in slot_items.items():
            actual_table_position += 1
            x = pos_items[0]
            if pos in empties:
                continue

            # set Pos column for this row, to have a rowspan
            items[x]['rowspan'] = {'Pos': len(pos_items)}

            # fill the rowspan with a little table
            obj = items[x]['obj']
            # parent is either an AR, a Worksheet, or a
            # ReferenceSample (analysis parent).
            parent = obj.aq_parent
            if parent.aq_parent.portal_type == "WorksheetFolder":
                # we're a duplicate; get original object's client
                client = obj.getAnalysis().aq_parent.aq_parent
            elif parent.aq_parent.portal_type == "ReferenceSupplier":
                # we're a reference sample; get reference definition
                client = obj.getReferenceDefinition()
            else:
                client = parent.aq_parent
            pos_text = "<table class='worksheet-position' width='100%%' cellpadding='0' cellspacing='0' style='padding-bottom:5px;'><tr>" + \
#.........这里部分代码省略.........
开发者ID:RaulKite,项目名称:Bika-LIMS,代码行数:103,代码来源:worksheet.py

示例5: folderitems

# 需要导入模块: from bika.lims.browser.analyses import AnalysesView [as 别名]
# 或者: from bika.lims.browser.analyses.AnalysesView import folderitems [as 别名]
    def folderitems(self):
        self.analyst = self.context.getAnalyst().strip()
        self.instrument = self.context.getInstrument()
        self.contentsMethod = self.context.getFolderContents
        items = BaseView.folderitems(self)
        layout = self.context.getLayout()
        highest_position = 0
        new_items = []
        for x, item in enumerate(items):
            obj = item['obj']
            pos = [slot['position'] for slot in layout if
                   slot['analysis_uid'] == obj.UID()][0]

            # compensate for possible bad data (dbw#104)
            if type(pos) in (list, tuple):
                pos = pos[0]
                if pos == 'new':
                    continue
            pos = int(pos)

            highest_position = max(highest_position, pos)
            items[x]['Pos'] = pos
            items[x]['colspan'] = {'Pos':1}
            service = obj.getService()
            method = service.getMethod()
            items[x]['Service'] = service.Title()
            items[x]['Priority'] = ''
            #items[x]['Method'] = method and method.Title() or ''
            items[x]['class']['Service'] = 'service_title'
            items[x]['Category'] = service.getCategory() and service.getCategory().Title() or ''
            if obj.portal_type == "ReferenceAnalysis":
                items[x]['DueDate'] = self.ulocalized_time(obj.aq_parent.getExpiryDate(), long_format=0)
            else:
                items[x]['DueDate'] = self.ulocalized_time(obj.getDueDate())

            items[x]['Order'] = ''
            instrument = obj.getInstrument()
            #items[x]['Instrument'] = instrument and instrument.Title() or ''

            new_items.append(item)
        items = new_items

        # insert placeholder row items in the gaps
        # This is done badly to compensate for possible bad data (dbw#104)
        empties = []
        used = []
        for slot in layout:
            position = slot['position']
            if type(position) in (list, tuple):
                position = position[0]
                if position == 'new':
                    continue
            position = int(position)
            used.append(position)

        for pos in range(1, highest_position + 1):
            if pos not in used:
                empties.append(pos)
                item = {}
                item.update({
                    'obj': self.context,
                    'id': self.context.id,
                    'uid': self.context.UID(),
                    'title': self.context.Title(),
                    'type_class': 'blank-worksheet-row',
                    'url': self.context.absolute_url(),
                    'relative_url': self.context.absolute_url(),
                    'view_url': self.context.absolute_url(),
                    'path': "/".join(self.context.getPhysicalPath()),
                    'before': {},
                    'after': {},
                    'choices': {},
                    'class': {},
                    'state_class': 'state-empty',
                    'allow_edit': [],
                    'colspan': {'Pos':len(self.columns) + len(self.interim_fields)},
                    'rowspan': {'Pos':1},
                    'Pos': pos,
                    'Service': '',
                    'Attachments': '',
                    'state_title': 's',})
                item['replace'] = {
                    'Pos': "<table width='100%' cellpadding='0' cellspacing='0'>" + \
                            "<tr><td class='pos'>%s</td>" % pos + \
                            "<td align='right'>&nbsp;</td></tr></table>",
                    'select_column': '',
                    }
                items.append(item)

        items = sorted(items, key = itemgetter('Service'))
        try:
            items = sorted(items, key = itemgetter('Pos'))
        except:
            pass

        slot_items = {} # pos:[item_nrs]
        for x in range(len(items)):
            p = items[x]['Pos']
            if p in slot_items:
                slot_items[p].append(x)
#.........这里部分代码省略.........
开发者ID:151706061,项目名称:bika.lims,代码行数:103,代码来源:analyses.py


注:本文中的bika.lims.browser.analyses.AnalysesView.folderitems方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。