def odict(self): """Return the currently selected items as a dictionary. Returns an ODict with the currently selected objects in the order of the selection.names. """ return odict.ODict(zip(self.names, self.check(warn=False)))
def parse_cookie_header(str): """ Parse a Cookie header value. Returns a (possibly empty) ODict object. """ pairs, off = _read_pairs(str) return odict.ODict(pairs)
def __init__(self, title='AMenu', parent=None, before=None, items=None): """Create a menu.""" self._title = title pf.debug("Creating menu %s" % title, pf.DEBUG.MENU) self.parent = parent self.separators = odict.ODict() self._actions_ = [] self._submenus_ = [] if items: self.insertItems(items) if parent and isinstance(parent, BaseMenu): before = parent.action(before) parent.insert_menu(self, before)
def interrogate(item): """Print useful information about item.""" import odict info = odict.ODict() if hasattr(item, '__name__'): info["NAME: "] = item.__name__ if hasattr(item, '__class__'): info["CLASS: "] = item.__class__.__name__ info["ID: "] = id(item) info["TYPE: "] = type(item) info["VALUE: "] = repr(item) info["CALLABLE:"] = callable(item) if hasattr(item, '__doc__'): doc = getattr(item, '__doc__') doc = doc.strip() # Remove leading/trailing whitespace. firstline = doc.split('\n')[0] info["DOC: "] = firstline for i in info.items(): print("%s %s" % i)
drawCurve(curve[0],blue,fill=fill) elif len(curve) == 2: drawCurve2(curve,blue,fill=fill) else: for c in curve: drawCurve(c,blue) return # Initialization # Define some extra font files extra_fonts = odict.ODict([ ('blippo',"/mnt/work/local/share/fonts/blippok.ttf"), ('blimpo',"/home/bene/tmp/Blimpo-Regular.ttf"), ('verdana',"/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType/Verdana.ttf"), ]) fonts = [] def run(): # disabled this example #return global fonts if not fonts: fonts = utils.listFontFiles() + [ f for f in extra_fonts if os.path.exists(f) ]