Esempio n. 1
0
 def signed_markup(self):
     signed = self.signed
     if signed is None:
         return '(empty)'
     if signed in (v for k, v in SIGNED_STATES.items() if k > 0):
         return good(signed)
     return bad(signed)
Esempio n. 2
0
 def check_recommended(self):
     self.summarize()
     prefs_rec = list(self.parse_userjs(self.recommended_source))
     out('%d recommendeded values read.\n' % len(prefs_rec))
     bad_num = 0
     for pref_rec in prefs_rec:
         try:
             pref = next(p for p in self.prefs if p.key == pref_rec.key)
         except StopIteration:
             if self.include_undefined:
                 # Create a fake preference with an undefined value
                 pref = Preference(pref_rec.key, None)
             else:
                 continue
         if pref_rec.value == pref.value:
             if self.bad_only:
                 continue
             markup = good
         else:
             markup = bad
             bad_num += 1
         rec_text = markup(Preference.type_to_repr(pref_rec.value))
         outitem(pref, [('Should', rec_text), ('Reason', pref_rec.info)])
     if bad_num == 0:
         out(good('All preferences seem good.'))
     else:
         out('%d bad values found.' % bad_num)
Esempio n. 3
0
 def walk(node, depth=0):
     if node.type == DIRECTORY_TYPE:
         text = good('[%s]') % node.title
         out('%s%s' % (depth * 4 * ' ', text))
     else:
         out('%s* %s' % (depth * 4 * ' ', node.title))
         out('%s%s' % ((depth + 1) * 4 * ' ', node.url))
     children = [n for n in bmarks if n.parent == node.id]
     for child in children:
         walk(child, depth + 1)
Esempio n. 4
0
 def check(self, addon):
     checks = (
         addon is not None,
         addon_id in self.startup_json.get(startup_key,
                                           {}).get('addons', {}),
         Path(self.ext_dir / ADDON_FILE).is_file(),
     )
     if all(checks):
         out(good('Extension seems installed.'))
     else:
         out(bad('Extension doesn\'t seem (fully) installed.'))
Esempio n. 5
0
def show_profiles():
    profiles = list(read_profiles())
    if not profiles:
        out('No local profiles found. Set a profile path with -p/--profile.')
        return
    out('%d profiles found:' % len(profiles))
    for profile in profiles:
        out('\n%s%s\n%s' % (
            profile.name,
            good(' [default]') if profile.default else '',
            profile.path,
        ))
Esempio n. 6
0
 def visible_markup(self):
     return good('true') if self.visible else bad('false')
Esempio n. 7
0
 def test_colors(self):
     assert 'x' in output.good('x')
     assert 'x' in output.bad('x')
     assert 'x' in output.okay('x')
     assert 'x' in output.disabled('x')