本文整理匯總了Python中bika.lims.browser.analyses.AnalysesView類的典型用法代碼示例。如果您正苦於以下問題:Python AnalysesView類的具體用法?Python AnalysesView怎麽用?Python AnalysesView使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了AnalysesView類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
def __init__(self, context, request):
AnalysesView.__init__(self, context, request)
self.icon = "++resource++bika.lims.images/worksheet_big.png"
self.contentFilter = {}
self.show_select_row = False
self.show_sort_column = False
self.allow_edit = True
self.columns = {
'Pos': {'title': _('Position')},
'DueDate': {'title': _('Due date')},
'Category': {'title': _('Category')},
'Service': {'title': _('Analysis')},
'Result': {'title': _('Result')},
'Uncertainty': {'title': _('+-')},
'retested': {'title': _('Retested'), 'type':'boolean'},
## 'Attachments': {'title': _('Attachments')},
'state_title': {'title': _('State')},
}
self.review_states = [
{'title': _('All'), 'id':'all',
'transitions': ['submit', 'verify', 'retract', 'unassign'],
'columns':['Pos',
'Category',
'Service',
'Result',
'Uncertainty',
## 'Attachments',
'DueDate',
'state_title'],
},
]
示例2: __init__
def __init__(self, context, request):
AnalysesView.__init__(self, context, request)
self.contentFilter = {'portal_type':'ReferenceAnalysis',
'path': {'query':"/".join(self.context.getPhysicalPath()),
'level':0}}
self.show_select_row = False
self.show_sort_column = False
self.show_select_column = False
self.allow_edit = False
self.columns = {
'id': {'title': _('ID')},
'Category': {'title': _('Category')},
'Service': {'title': _('Service')},
'Worksheet': {'title': _('Worksheet')},
'Result': {'title': _('Result')},
'Uncertainty': {'title': _('+-')},
'DueDate': {'title': _('Due Date')},
'retested': {'title': _('Retested'), 'type':'boolean'},
'state_title': {'title': _('State')},
}
self.review_states = [
{'id':'all',
'title': _('All'),
'transitions': [],
'columns':['id',
'Category',
'Service',
'Worksheet',
'Result',
'Uncertainty',
'DueDate',
'state_title'],
},
]
示例3: __init__
def __init__(self, context, request, **kwargs):
AnalysesView.__init__(self, context, request)
for k,v in kwargs.items():
self.contentFilter[k] = v
if kwargs.get('getPointOfCapture', '') == 'lab':
self.allow_edit = False
self.columns['Request'] = {'title': _("Request"),
'sortable':False}
# Add Request column
pos = self.review_states[0]['columns'].index('Service') + 1
self.review_states[0]['columns'].insert(pos, 'Request')
示例4: __init__
def __init__(self, context, request):
AnalysesView.__init__(self, context, request)
self.catalog = 'bika_analysis_catalog'
self.contentFilter = {'portal_type':'ReferenceAnalysis',
'path': {'query':"/".join(self.context.getPhysicalPath()),
'level':0}}
self.show_select_row = False
self.show_sort_column = False
self.show_select_column = False
self.allow_edit = False
self.columns = {
'id': {'title': _('ID'), 'toggle':False},
'getReferenceAnalysesGroupID': {'title': _('QC Sample ID'), 'toggle': True},
'Category': {'title': _('Category'), 'toggle':True},
'Service': {'title': _('Service'), 'toggle':True},
'Worksheet': {'title': _('Worksheet'), 'toggle':True},
'Method': {
'title': _('Method'),
'sortable': False,
'toggle': True},
'Instrument': {
'title': _('Instrument'),
'sortable': False,
'toggle': True},
'Result': {'title': _('Result'), 'toggle':True},
'Captured': {'title': _('Captured'), 'toggle':True},
'Uncertainty': {'title': _('+-'), 'toggle':True},
'DueDate': {'title': _('Due Date'),
'index': 'getDueDate',
'toggle':True},
'retested': {'title': _('Retested'), 'type':'boolean', 'toggle':True},
'state_title': {'title': _('State'), 'toggle':True},
}
self.review_states = [
{'id':'default',
'title': _('All'),
'contentFilter':{},
'transitions': [],
'columns':['id',
'getReferenceAnalysesGroupID',
'Category',
'Service',
'Worksheet',
'Method',
'Instrument',
'Result',
'Captured',
'Uncertainty',
'DueDate',
'state_title'],
},
]
self.anjson = {}
示例5: __init__
def __init__(self, context, request, **kwargs):
AnalysesView.__init__(self, context, request)
self.show_select_column = False
self.allow_edit = False
self.show_workflow_action_buttons = False
for k,v in kwargs.items():
self.contentFilter[k] = v
self.columns['Request'] = {'title': _("Request"),
'sortable':False}
# Add Request column
pos = self.review_states[0]['columns'].index('Service') + 1
self.review_states[0]['columns'].insert(pos, 'Request')
示例6: __call__
def __call__(self):
ar = self.context
self.tables = {}
for poc in POINTS_OF_CAPTURE:
if self.context.getAnalyses(getPointOfCapture=poc):
t = AnalysesView(ar,
self.request,
getPointOfCapture = poc)
t.allow_edit = False
t.show_select_column = False
self.tables[POINTS_OF_CAPTURE.getValue(poc)] = t.contents_table()
return self.template()
示例7: __init__
def __init__(self, context, request, **kwargs):
AnalysesView.__init__(self, context, request)
self.show_select_column = False
self.allow_edit = False
self.show_workflow_action_buttons = False
for k, v in kwargs.items():
self.contentFilter[k] = v
self.columns["Request"] = {"title": _("Request"), "sortable": False}
self.columns["Priority"] = {"title": _("Priority"), "sortable": False}
# Add Request and Priority columns
pos = self.review_states[0]["columns"].index("Service") + 1
self.review_states[0]["columns"].insert(pos, "Request")
pos += 1
self.review_states[0]["columns"].insert(pos, "Priority")
示例8: __init__
def __init__(self, context, request, **kwargs):
AnalysesView.__init__(self, context, request)
self.show_workflow_action_buttons = False
for k,v in kwargs.items():
self.contentFilter[k] = v
self.contentFilter['getSampleUID'] = context.UID()
self.columns['Request'] = {
'title': _("Request"),
'attr': 'getParentTitle',
'replace_url': 'getParentURL',
'sortable': False}
# Add Request columns
pos = self.review_states[0]['columns'].index('Service') + 1
self.review_states[0]['columns'].insert(pos, 'Request')
pos += 1
示例9: isItemAllowed
def isItemAllowed(self, obj):
"""
Checks if the passed in Analysis must be displayed in the list. If the
'filtering by department' option is enabled in Bika Setup, this
function checks if the Analysis Service associated to the Analysis
is assigned to any of the currently selected departments (information
stored in a cookie). In addition, the function checks if the Analysis
matches with the filtering criterias set in the advanced filter bar.
If no criteria in the advanced filter bar has been set and the option
'filtering by department' is disblaed, returns True.
:param obj: A single Analysis brain
:type obj: CatalogBrain
:returns: True if the item can be added to the list. Otherwise, False
:rtype: bool
"""
# The isItemAllowed function from the base class AnalysesView already
# takes into account filtering by department
allowed = AnalysesView.isItemAllowed(self, obj)
if not allowed:
return False
if self.filter_bar_enabled:
# Advanced filter bar is enabled. Check if the Analysis matches
# with the filtering criterias.
return self.filter_bar_check_item(obj)
# By default, display the analysis
return True
示例10: folderitems
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
示例11: folderitems
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
示例12: __init__
def __init__(self, context, request, **kwargs):
AnalysesView.__init__(self, context, request, **kwargs)
self.columns['getReferenceAnalysesGroupID'] = {'title': _('QC Sample ID'),
'sortable': False}
self.columns['Partition'] = {'title': _('Reference Sample'),
'sortable': False}
self.columns['Retractions'] = {'title': '',
'sortable': False}
self.review_states[0]['columns'] = ['Service',
'getReferenceAnalysesGroupID',
'Partition',
'Result',
'Uncertainty',
'CaptureDate',
'Retractions']
analyses = self.context.getReferenceAnalyses()
asuids = [an.UID() for an in analyses]
self.catalog = 'bika_analysis_catalog'
self.contentFilter = {'UID': asuids}
self.anjson = {}
示例13: folderitem
def folderitem(self, obj, item, index):
"""
In this case obj should be a brain
"""
item = AnalysesView.folderitem(self, obj, item, index)
if not item:
return None
# Worksheet
item['Worksheet'] = ''
wss = self.worksheet_catalog(getAnalysesUIDs={
"query": obj.UID,
"operator": "or"
})
if wss and len(wss) == 1:
item['Worksheet'] = wss[0].Title
anchor = '<a href="%s">%s</a>' % (wss[0].getURL(), wss[0].Title)
item['replace']['Worksheet'] = anchor
return item
示例14: __init__
def __init__(self, context, request, **kwargs):
AnalysesView.__init__(self, context, request)
self.title = _("Analyses pending")
self.show_select_all_checkbox = False
self.show_categories = False
self.pagesize = 50
# Get temp objects that are too time consuming to obtain every time
self.worksheet_catalog = getToolByName(
context, CATALOG_WORKSHEET_LISTING)
# Check if the filter bar functionality is activated or not
self.filter_bar_enabled =\
self.context.bika_setup.getDisplayAdvancedFilterBarForAnalyses()
# each editable item needs it's own allow_edit
# which is a list of field names.
self.allow_edit = True
self.columns['AnalysisRequest'] = {
'title': _('Analysis Request'),
'attr': 'getRequestID',
'replace_url': 'getRequestURL',
'sortable': False
}
self.columns['Worksheet'] = {
'title': _('Worksheet'),
'sortable': False
}
self.review_states = [
{'id': 'default',
'title': _('Results pending'),
'transitions': [{'id': 'sample'},
{'id': 'submit'},
{'id': 'cancel'},
# {'id': 'assign'}
],
'contentFilter': {'review_state': [
'sample_received', 'assigned', 'attachment_due'],
'cancellation_state': 'active', },
'columns': ['AnalysisRequest',
'Worksheet',
'Service',
'Result',
'Uncertainty',
'Partition',
'Method',
'Instrument',
'Analyst',
'state_title',
]
},
{'id': 'to_be_verified',
'title': _('To be verified'),
'transitions': [{'id': 'verify'},
{'id': 'cancel'}
],
'contentFilter': {
'review_state': ['to_be_verified'],
'cancellation_state': 'active', },
'columns': ['AnalysisRequest',
'Worksheet',
'Service',
'Result',
'Uncertainty',
'Partition',
'Method',
'Instrument',
'Analyst',
'state_title',
]
},
]
示例15: folderitems
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'/> " % (antype, self.context.absolute_url())
if obj.getReferenceType() == 'b':
imgtype = "<img title='%s' src='%s/++resource++bika.lims.images/blank.png'/> " % (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'/> " % (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