--- nmm/xpyb-1.3.1/src/py_client.py 2012-03-23 18:39:23.000000000 -0400 +++ xpyb-1.3.1/src/py_client.py 2014-08-23 22:43:46.821309362 -0400 @@ -58,6 +58,32 @@ ''' return str[-1] +def _pt(str): + ''' + Does Python-name conversion on a type tuple of strings. + ''' + + if len(str) == 1: + return str[0] + + path, ext = str[:-1], str[-1] + path = [ x.lower() for x in path ] + + assert (path[0] == 'xcb') + + # xcbgen doesn't use 'xproto', but python does + if len(path) == 1: + path = ['xcb', 'xproto'] + + # If the module is one currently being generated, no need for namespace. + if path[-1] == module.namespace.header: + path = [] + + # Turns out we want 'xproto.RECTANGLE' and not 'xcb.xproto.RECTANGLE'. + path = path[1:] + + return '.'.join(path + [ext]) + def _n(str): ''' Does Python-name conversion on a single string fragment. @@ -189,6 +215,8 @@ Recurses into child fields and list member types. ''' # Do all the various names in advance + if not (self.is_simple or self.is_pad) and not postfix: + self.py_reftype = _pt(name) + postfix self.py_type = _t(name) + postfix self.py_request_name = _t(name) @@ -326,7 +354,7 @@ _py(' self.%s = xcb.List(parent, offset, %s, %s, %d)', _n(field.field_name), _py_get_expr(field.type.expr), field.py_listtype, field.py_listsize) _py(' offset += len(self.%s.buf())', _n(field.field_name)) elif field.type.is_container and field.type.fixed_size(): - _py(' self.%s = %s(parent, offset, %s)', _n(field.field_name), field.py_type, field.type.size) + _py(' self.%s = %s(parent, offset, %s)', _n(field.field_name), field.type.py_reftype, field.type.size) _py(' offset += %s', field.type.size) else: _py(' self.%s = %s(parent, offset)', _n(field.field_name), field.py_type)