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


Python Windows.detect_registry_key方法代码示例

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


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

示例1: handle_section

# 需要导入模块: import Windows [as 别名]
# 或者: from Windows import detect_registry_key [as 别名]
 def handle_section(self, section):
     """Parse a section"""
     def detect_file(rawpath):
         pathname = os.path.expandvars(preexpand(rawpath))
         return os.path.exists(pathname)
     # if simple detection fails then discard the section
     if self.parser.has_option(section, 'detect'):
         key = self.parser.get(section, 'detect')
         if not Windows.detect_registry_key(key):
             return
     if self.parser.has_option(section, 'detectfile'):
         if not detect_file(self.parser.get(section, 'detectfile')):
             return
     if self.parser.has_option(section, 'detectos'):
         required_ver = self.parser.get(section, 'detectos')
         if not detectos(required_ver):
             return
     # in case of multiple detection, discard if none match
     if self.parser.has_option(section, 'detectfile1'):
         matches = 0
         for n in range(1, MAX_DETECT):
             option_id = 'detectfile%d' % n
             if self.parser.has_option(section, option_id):
                 if detect_file(self.parser.get(section, option_id)):
                     matches = matches + 1
         if 0 == matches:
             return
     if self.parser.has_option(section, 'detect1'):
         matches = 0
         for n in range(1, MAX_DETECT):
             option_id = 'detect%d' % n
             if self.parser.has_option(section, option_id):
                 if Windows.detect_registry_key(self.parser.get(section, option_id)):
                     matches = matches + 1
         if 0 == matches:
             return
     # not yet implemented
     if self.parser.has_option(section, 'excludekey'):
         print 'ERROR: ExcludeKey not implemented, section=', section
         return
     # there are two ways to specify sections: langsecref= and section=
     if self.parser.has_option(section, 'langsecref'):
         # verify the langsecref number is known
         # langsecref_num is 3021, games, etc.
         langsecref_num = self.parser.get(section, 'langsecref')
     elif self.parser.has_option(section, 'section'):
         langsecref_num = self.parser.get(section, 'section')
     else:
         print 'ERROR: neither option LangSecRef nor Section found in section %s' % (section)
         return
     # find the BleachBit internal cleaner ID
     lid = self.section_to_cleanerid(langsecref_num)
     self.cleaners[lid].add_option(
         section2option(section), section.replace('*', ''), '')
     for option in self.parser.options(section):
         if option.startswith('filekey'):
             self.handle_filekey(lid, section, option)
         elif option.startswith('regkey'):
             self.handle_regkey(lid, section, option)
         elif option == 'warning':
             self.cleaners[lid].set_warning(
                 section2option(section), self.parser.get(section, 'warning'))
         elif option in ('default', 'detectfile', 'detect', 'langsecref', 'section') \
             or ['detect%d' % x for x in range(1, MAX_DETECT)] \
                 or ['detectfile%d' % x for x in range(1, MAX_DETECT)]:
             pass
         else:
             print 'WARNING: unknown option %s in section %s' % (option, section)
             return
开发者ID:jun-zhang,项目名称:bleachbit,代码行数:71,代码来源:Winapp.py


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