當前位置: 首頁>>代碼示例>>Python>>正文


Python POINTS_OF_CAPTURE.keys方法代碼示例

本文整理匯總了Python中bika.lims.config.POINTS_OF_CAPTURE.keys方法的典型用法代碼示例。如果您正苦於以下問題:Python POINTS_OF_CAPTURE.keys方法的具體用法?Python POINTS_OF_CAPTURE.keys怎麽用?Python POINTS_OF_CAPTURE.keys使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在bika.lims.config.POINTS_OF_CAPTURE的用法示例。


在下文中一共展示了POINTS_OF_CAPTURE.keys方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: getServices

# 需要導入模塊: from bika.lims.config import POINTS_OF_CAPTURE [as 別名]
# 或者: from bika.lims.config.POINTS_OF_CAPTURE import keys [as 別名]
    def getServices(self, field, selected_only = False):
        """ Returns a list of Analysis Services keyed by POC and Category
            selected_only - set this to return only checked services (for view widget)

            returns

            {('poc_id', 'Point Of Capture'):
                {('cat_id', 'Category Title'): [('serviceUID','service Title'), ..]
                }
            }
        """
        pc = getToolByName(self, 'portal_catalog')
        allservices = [p.getObject() for p in pc(portal_type = "AnalysisService", sort_on='sortable_title')]
        selectedservices = getattr(field, field.accessor)()
        res = {}
        for poc_id in POINTS_OF_CAPTURE.keys():
            poc_title = POINTS_OF_CAPTURE.getValue(poc_id)
            res[(poc_id, poc_title)] = {}
        if selected_only:
            services = selectedservices
        else:
            services = allservices
        for service in services:
            cat = (service.getCategoryUID(), service.getCategoryName())
            poc = (service.getPointOfCapture(), POINTS_OF_CAPTURE.getValue(service.getPointOfCapture()))
            srv = (service.UID(), service.Title())
            if not res[poc].has_key(cat): res[poc][cat] = []
            res[poc][cat].append(srv)
        return res
開發者ID:lemoene,項目名稱:Bika-LIMS,代碼行數:31,代碼來源:serviceswidget.py


注:本文中的bika.lims.config.POINTS_OF_CAPTURE.keys方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。