diff -Nru pybik-3.1~alpha1~bzr4417~ubuntu16.04.1/buildlib/utils.py pybik-3.1~alpha1~bzr4434~ubuntu16.04.1/buildlib/utils.py --- pybik-3.1~alpha1~bzr4417~ubuntu16.04.1/buildlib/utils.py 2017-11-02 03:33:54.000000000 +0000 +++ pybik-3.1~alpha1~bzr4434~ubuntu16.04.1/buildlib/utils.py 2017-11-07 23:31:17.000000000 +0000 @@ -106,6 +106,7 @@ {'id': 'es2', 'name': 'OpenGLES2', 'group': 'glvariant', 'type': 'enum'}, {'id': 'd', 'name': 'debug OpenGL/ES', 'group': 'gldebug', 'type': 'bool'}, {'id': 'os', 'name': 'offscreen', 'group': 'offscreen', 'type': 'bool'}, + {'id': 'a', 'name': 'android', 'group': 'android', 'type': 'bool'}, {'id': 'all', 'name': 'all variants', 'type': None}, ) Binary files /tmp/tmpsLICw6/WoJ_1CPRl5/pybik-3.1~alpha1~bzr4417~ubuntu16.04.1/data/ui/qt/images/new-random.png and /tmp/tmpsLICw6/pcWW2rFOYM/pybik-3.1~alpha1~bzr4434~ubuntu16.04.1/data/ui/qt/images/new-random.png differ Binary files /tmp/tmpsLICw6/WoJ_1CPRl5/pybik-3.1~alpha1~bzr4417~ubuntu16.04.1/data/ui/qt/images/new-solved.png and /tmp/tmpsLICw6/pcWW2rFOYM/pybik-3.1~alpha1~bzr4434~ubuntu16.04.1/data/ui/qt/images/new-solved.png differ Binary files /tmp/tmpsLICw6/WoJ_1CPRl5/pybik-3.1~alpha1~bzr4417~ubuntu16.04.1/data/ui/qt/images_x2/new-random.png and /tmp/tmpsLICw6/pcWW2rFOYM/pybik-3.1~alpha1~bzr4434~ubuntu16.04.1/data/ui/qt/images_x2/new-random.png differ Binary files /tmp/tmpsLICw6/WoJ_1CPRl5/pybik-3.1~alpha1~bzr4417~ubuntu16.04.1/data/ui/qt/images_x2/new-solved.png and /tmp/tmpsLICw6/pcWW2rFOYM/pybik-3.1~alpha1~bzr4434~ubuntu16.04.1/data/ui/qt/images_x2/new-solved.png differ Binary files /tmp/tmpsLICw6/WoJ_1CPRl5/pybik-3.1~alpha1~bzr4417~ubuntu16.04.1/data/ui/qt/images_x2/select-model.png and /tmp/tmpsLICw6/pcWW2rFOYM/pybik-3.1~alpha1~bzr4434~ubuntu16.04.1/data/ui/qt/images_x2/select-model.png differ diff -Nru pybik-3.1~alpha1~bzr4417~ubuntu16.04.1/debian/bzr-builder.manifest pybik-3.1~alpha1~bzr4434~ubuntu16.04.1/debian/bzr-builder.manifest --- pybik-3.1~alpha1~bzr4417~ubuntu16.04.1/debian/bzr-builder.manifest 2017-11-02 03:33:56.000000000 +0000 +++ pybik-3.1~alpha1~bzr4434~ubuntu16.04.1/debian/bzr-builder.manifest 2017-11-07 23:31:18.000000000 +0000 @@ -1,3 +1,3 @@ -# bzr-builder format 0.3 deb-version {debupstream}~bzr4417 -lp:pybik revid:barcc@gmx.de-20171101180535-huuxzb80q3l1qhe0 +# bzr-builder format 0.3 deb-version {debupstream}~bzr4434 +lp:pybik revid:barcc@gmx.de-20171105161918-c0qzgznojql2trxq nest thumbnails lp:~barcc/pybik/thumbnails data/ui/thumbnails revid:barcc@gmx.de-20170708224739-pllkh1e9kfkmww5n diff -Nru pybik-3.1~alpha1~bzr4417~ubuntu16.04.1/debian/changelog pybik-3.1~alpha1~bzr4434~ubuntu16.04.1/debian/changelog --- pybik-3.1~alpha1~bzr4417~ubuntu16.04.1/debian/changelog 2017-11-02 03:33:56.000000000 +0000 +++ pybik-3.1~alpha1~bzr4434~ubuntu16.04.1/debian/changelog 2017-11-07 23:31:18.000000000 +0000 @@ -1,8 +1,8 @@ -pybik (3.1~alpha1~bzr4417~ubuntu16.04.1) xenial; urgency=low +pybik (3.1~alpha1~bzr4434~ubuntu16.04.1) xenial; urgency=low * Auto build. - -- B. Clausius Thu, 02 Nov 2017 03:33:56 +0000 + -- B. Clausius Tue, 07 Nov 2017 23:31:18 +0000 pybik (3.1~alpha1-0~ppa1) UNRELEASED; urgency=medium diff -Nru pybik-3.1~alpha1~bzr4417~ubuntu16.04.1/pybiklib/application.py pybik-3.1~alpha1~bzr4434~ubuntu16.04.1/pybiklib/application.py --- pybik-3.1~alpha1~bzr4417~ubuntu16.04.1/pybiklib/application.py 2017-11-02 03:33:54.000000000 +0000 +++ pybik-3.1~alpha1~bzr4434~ubuntu16.04.1/pybiklib/application.py 2017-11-07 23:31:17.000000000 +0000 @@ -108,8 +108,13 @@ demo = importlib.import_module(opts.demo) demo.run(self) + #XXX + if sys.platform == 'android': + settings['draw.selection'] = 2 + def cb_before_mainloop(self): qt.create_window(self) + qt.load_cursors(os.path.join(config.UI_DIR, 'cursors', 'mouse_{}.png')) # UI fixedshaders = self.gl_read_shader('pick.vert'), self.gl_read_shader('pick.frag') if DEBUG_DRAW: @@ -456,8 +461,7 @@ if DEBUG_MSG or DEBUG_LIVESHADER: print('Loading shader:', filename) filename = os.path.join(config.SHADER_DIR, filename) - with open(filename, 'rb') as sfile: - source = sfile.read() + source = qt.read_file(filename) return source @classmethod diff -Nru pybik-3.1~alpha1~bzr4417~ubuntu16.04.1/pybiklib/config.py pybik-3.1~alpha1~bzr4434~ubuntu16.04.1/pybiklib/config.py --- pybik-3.1~alpha1~bzr4417~ubuntu16.04.1/pybiklib/config.py 2017-11-02 03:33:54.000000000 +0000 +++ pybik-3.1~alpha1~bzr4434~ubuntu16.04.1/pybiklib/config.py 2017-11-07 23:31:17.000000000 +0000 @@ -16,7 +16,7 @@ # along with this program. If not, see . -import os +import sys, os N_ = lambda s: s try: @@ -44,6 +44,8 @@ # The following two lines are replaced by "setup.py install" data_dir = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'data') appdata_dir = data_dir +if sys.platform == 'android': + appdata_dir = data_dir = 'assets:/data' # The following line is replaced by "setup.py sdist" RELEASE_DATE = 'unreleased' diff -Nru pybik-3.1~alpha1~bzr4417~ubuntu16.04.1/pybiklib/ext/_debug_es2.pxd pybik-3.1~alpha1~bzr4434~ubuntu16.04.1/pybiklib/ext/_debug_es2.pxd --- pybik-3.1~alpha1~bzr4417~ubuntu16.04.1/pybiklib/ext/_debug_es2.pxd 2017-11-02 03:33:54.000000000 +0000 +++ pybik-3.1~alpha1~bzr4434~ubuntu16.04.1/pybiklib/ext/_debug_es2.pxd 2017-11-07 23:31:17.000000000 +0000 @@ -27,6 +27,9 @@ GL_INVALID_OPERATION = 0x0502 GL_OUT_OF_MEMORY = 0x0505 GL_CCW = 0x0901 + GL_DEPTH_RANGE = 0x0B70 + GL_DEPTH_WRITEMASK = 0x0B72 + GL_DEPTH_FUNC = 0x0B74 GL_MAX_TEXTURE_SIZE = 0x0D33 GL_SAMPLE_BUFFERS = 0x80A8 GL_SAMPLES = 0x80A9 diff -Nru pybik-3.1~alpha1~bzr4417~ubuntu16.04.1/pybiklib/ext/_debug_es2.pyx pybik-3.1~alpha1~bzr4434~ubuntu16.04.1/pybiklib/ext/_debug_es2.pyx --- pybik-3.1~alpha1~bzr4417~ubuntu16.04.1/pybiklib/ext/_debug_es2.pyx 2017-11-02 03:33:54.000000000 +0000 +++ pybik-3.1~alpha1~bzr4434~ubuntu16.04.1/pybiklib/ext/_debug_es2.pyx 2017-11-07 23:31:17.000000000 +0000 @@ -1,8 +1,22 @@ # generated from pybiklib/ext/gl_es2.pxd - -from libc.stdio cimport printf, puts cimport gl_[[GLVARIANT]] as gl +#FIXME: works on android only +#XXX: duplicate code +DEF _NB = 256 +cdef char _sb[_NB] +from libc.stdio cimport snprintf +##pxm>IF '[[ANDROID]]' != 'a' +#from libc.stdio cimport puts +##pxm>IF '[[ANDROID]]' == 'a' +cdef extern from "":# + void __android_log_write(int, const char*, const char*) nogil + enum: ANDROID_LOG_DEBUG +cdef void puts(const char* text) nogil: + __android_log_write(ANDROID_LOG_DEBUG, 'pybik', text) +##pxm>IF_END +#XXX: end duplicate code + print('Importing module:', __name__) print(' GL-type: [[GLVARIANT]]') @@ -24,7 +38,7 @@ elif err == gl.GL_OUT_OF_MEMORY: puts('glerror: GL_OUT_OF_MEMORY') else: - printf('gl unknown: %x\n', err) + snprintf(_sb,_NB, 'gl unknown: %x', err); puts(_sb) err = gl.glGetError() diff -Nru pybik-3.1~alpha1~bzr4417~ubuntu16.04.1/pybiklib/ext/_debug_ogl.pxd pybik-3.1~alpha1~bzr4434~ubuntu16.04.1/pybiklib/ext/_debug_ogl.pxd --- pybik-3.1~alpha1~bzr4417~ubuntu16.04.1/pybiklib/ext/_debug_ogl.pxd 2017-11-02 03:33:54.000000000 +0000 +++ pybik-3.1~alpha1~bzr4434~ubuntu16.04.1/pybiklib/ext/_debug_ogl.pxd 2017-11-07 23:31:17.000000000 +0000 @@ -18,6 +18,9 @@ GL_BACK = 0x0405 GL_CULL_FACE = 0x0B44 GL_DEPTH_TEST = 0x0B71 + GL_DEPTH_FUNC = 0x0B74 + GL_DEPTH_RANGE = 0x0B70 + GL_DEPTH_WRITEMASK = 0x0B72 GL_RGB = 0x1907 GL_RGBA = 0x1908 GL_MAX_TEXTURE_SIZE = 0x0D33 diff -Nru pybik-3.1~alpha1~bzr4417~ubuntu16.04.1/pybiklib/ext/_debug_ogl.pyx pybik-3.1~alpha1~bzr4434~ubuntu16.04.1/pybiklib/ext/_debug_ogl.pyx --- pybik-3.1~alpha1~bzr4417~ubuntu16.04.1/pybiklib/ext/_debug_ogl.pyx 2017-11-02 03:33:54.000000000 +0000 +++ pybik-3.1~alpha1~bzr4434~ubuntu16.04.1/pybiklib/ext/_debug_ogl.pyx 2017-11-07 23:31:17.000000000 +0000 @@ -1,8 +1,21 @@ # generated from pybiklib/ext/gl_ogl.pxd - -from libc.stdio cimport printf, puts cimport gl_[[GLVARIANT]] as gl +#XXX: duplicate code +DEF _NB = 256 +cdef char _sb[_NB] +from libc.stdio cimport snprintf +##pxm>IF '[[ANDROID]]' != 'a' +from libc.stdio cimport puts +##pxm>IF '[[ANDROID]]' == 'a' +#cdef extern from "":# +# void __android_log_write(int, const char*, const char*) nogil +# enum: ANDROID_LOG_DEBUG +#cdef void puts(const char* text) nogil: +# __android_log_write(ANDROID_LOG_DEBUG, 'pybik', text) +##pxm>IF_END +#XXX: end duplicate code + print('Importing module:', __name__) print(' GL-type: [[GLVARIANT]]') @@ -24,7 +37,7 @@ elif err == gl.GL_OUT_OF_MEMORY: puts('glerror: GL_OUT_OF_MEMORY') else: - printf('gl unknown: %x\n', err) + snprintf(_sb,_NB, 'gl unknown: %x', err); puts(_sb) err = gl.glGetError() diff -Nru pybik-3.1~alpha1~bzr4417~ubuntu16.04.1/pybiklib/ext/glarea.py pybik-3.1~alpha1~bzr4434~ubuntu16.04.1/pybiklib/ext/glarea.py --- pybik-3.1~alpha1~bzr4417~ubuntu16.04.1/pybiklib/ext/glarea.py 2017-11-02 03:33:54.000000000 +0000 +++ pybik-3.1~alpha1~bzr4434~ubuntu16.04.1/pybiklib/ext/glarea.py 2017-11-07 23:31:17.000000000 +0000 @@ -33,9 +33,9 @@ #px/from libc.math cimport cos, sin, tan, atan2, sqrt, M_PI, fabs from math import cos, sin, tan, atan2, sqrt, pi as M_PI, fabs -#pxm>IF '[[GLDEBUG]]' == 'gldebug' +#pxm>IF '[[GLDEBUG]]' == 'd' #px+from [[_debug_VARIANT]] cimport * -#pxm>IF '[[GLDEBUG]]' != 'gldebug' +#pxm>IF '[[GLDEBUG]]' != 'd' #px+from gl_[[GLVARIANT]] cimport * #pxm>IF_END #px+cimport [[_gldraw_VARIANT]] as gldraw @@ -47,10 +47,27 @@ from OpenGL.GL.ARB.vertex_shader import glGetActiveAttribARB as glGetActiveAttrib #px. -#px/from libc.stdio cimport printf -def printf(fmt, *args): print(fmt % args, end='') +#XXX: duplicate code +#px+DEF _NB = 256 +#px+cdef char _sb[_NB] +#px+from libc.stdio cimport snprintf +#px: +def snprintf(buf, size, fmt, *args): + global _nb + assert buf is _nb + _nb = fmt % args +#px. +#pxm>IF '[[ANDROID]]' != 'a' #px/from libc.stdio cimport puts puts = print +#pxm>IF '[[ANDROID]]' == 'a' +#px+cdef extern from "":# + #px+void __android_log_write(int, const char*, const char*) nogil + #px+enum: ANDROID_LOG_DEBUG +#px+cdef void puts(const char* text) nogil: + #px+__android_log_write(ANDROID_LOG_DEBUG, 'pybik', text) +#pxm>IF_END +#XXX: end duplicate code #px/cdef enum: # if True: @@ -636,29 +653,36 @@ #pxm-FUNC P nogil def _gl_print_string(msg:'char *', name:'GLenum'): - #px/printf('%s %s\n', msg, glGetString(name)) - printf('%s %s\n', msg, glGetString(name)) + #px/snprintf(_sb,_NB, '%s %s', msg, glGetString(name)); puts(_sb) + print('%s %s' % (msg, glGetString(name))) #pxm-FUNC P nogil def _gl_print_float(msg:'char *', name:'GLenum'): #px+cdef GLfloat i #px/glGetFloatv(name, &i) i = glGetFloatv(name) - printf('%s %f\n', msg, i) + snprintf(_sb,_NB, '%s %f', msg, i); puts(_sb) + +#pxm-FUNC P nogil +def _gl_print_float2(msg:'char *', name:'GLenum'): + #px+cdef GLfloat v[2] + #px/glGetFloatv(name, v) + v = glGetFloatv(name) + snprintf(_sb,_NB, '%s %f %f', msg, v[0], v[1]); puts(_sb) #pxm-FUNC P nogil def _gl_print_integer(msg:'char *', name:'GLenum'): #px+cdef GLint i #px/glGetIntegerv(name, &i) i = glGetIntegerv(name) - printf('%s %d\n', msg, i) + snprintf(_sb,_NB, '%s %d', msg, i); puts(_sb) #pxm-FUNC P nogil def _gl_print_bool(msg:'char *', name:'GLenum'): #px+cdef GLboolean i #px+glGetBooleanv(name, &i) - #px/printf('%s %d\n', msg, i) - printf('%s %d\n', msg, glGetBooleanv(name)) + #px/snprintf(_sb,_NB, '%s %d', msg, i); puts(_sb) + print('%s %d' % (msg, glGetBooleanv(name))) #pxm-FUNC PD nogil def gl_init(): @@ -675,11 +699,16 @@ _gl_print_integer(' GL_SAMPLES:', GL_SAMPLES) #px/IF '[[GLVARIANT]]' == 'ogl': if True: - printf(' GL_MULTISAMPLE: %d\n', glIsEnabled(GL_MULTISAMPLE)) + snprintf(_sb,_NB, ' GL_MULTISAMPLE: %d', glIsEnabled(GL_MULTISAMPLE)); puts(_sb) #print(' GL_SAMPLE_ALPHA_TO_COVERAGE:', glIsEnabled(GL_SAMPLE_ALPHA_TO_COVERAGE)) #print(' GL_SAMPLE_COVERAGE:', glIsEnabled(GL_SAMPLE_COVERAGE)) _gl_print_integer(' GL_MAX_VERTEX_ATTRIBS:', GL_MAX_VERTEX_ATTRIBS) _gl_print_integer(' GL_MAX_TEXTURE_SIZE:', GL_MAX_TEXTURE_SIZE) + _gl_print_bool(' GL_DEPTH_TEST:', GL_DEPTH_TEST) + _gl_print_bool(' GL_DEPTH_WRITEMASK:', GL_DEPTH_WRITEMASK) + _gl_print_integer(' GL_DEPTH_FUNC:', GL_DEPTH_FUNC) + _gl_print_float2(' GL_DEPTH_RANGE:', GL_DEPTH_RANGE) + gldraw.gl_init_buffers() if debug & DEBUG_DRAW: gl_create_hud_program() @@ -914,7 +943,8 @@ puts('==== shader info log:') #px/glGetShaderInfoLog(shader, 1023, &length, log) log = glGetShaderInfoLog(shader).decode('utf-8') - printf('%s', log) + #px+if length and log[length-1] == b'\n': log[length-1] = 0 + puts(log) puts('====') else: puts('==== empty shader info log') @@ -930,7 +960,8 @@ puts('==== program info log:') #px/glGetProgramInfoLog(program, 1023, &length, log) log = glGetProgramInfoLog(program).decode('utf-8') - printf('%s', log) + #px+if length and log[length-1] == b'\n': log[length-1] = 0 + puts(log) puts('====') else: puts('==== empty program info log') @@ -952,7 +983,7 @@ if debug & DEBUG_MSGGL: #px/glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &compile_status) compile_status = glGetShaderiv(shader, GL_INFO_LOG_LENGTH) - printf('GL_INFO_LOG_LENGTH %d\n', compile_status) + snprintf(_sb,_NB, 'GL_INFO_LOG_LENGTH %d', compile_status); puts(_sb) compile_status = compile_status <= 1 if compile_status: #px/glGetShaderiv(shader, GL_COMPILE_STATUS, &compile_status) @@ -980,37 +1011,39 @@ #px+cdef GLenum atype #px+cdef char aname[1024] - printf('shader program info %d\n', program) + snprintf(_sb,_NB, 'shader program info %d', program); puts(_sb) glValidateProgram(program) - printf(' delete status %d\n', _get_program_iv(program, GL_DELETE_STATUS)) + snprintf(_sb,_NB, ' delete status %d', _get_program_iv(program, GL_DELETE_STATUS)); puts(_sb) link_status = _get_program_iv(program, GL_LINK_STATUS) - printf(' link status %d\n', link_status) - printf(' validate status %d\n', _get_program_iv(program, GL_VALIDATE_STATUS)) + snprintf(_sb,_NB, ' link status %d', link_status); puts(_sb) + snprintf(_sb,_NB, ' validate status %d', _get_program_iv(program, GL_VALIDATE_STATUS)); puts(_sb) info_log_length = _get_program_iv(program, GL_INFO_LOG_LENGTH) - printf(' info log length %d\n', info_log_length) - printf(' attached shaders %d\n',_get_program_iv(program, GL_ATTACHED_SHADERS)) + snprintf(_sb,_NB, ' info log length %d', info_log_length); puts(_sb) + snprintf(_sb,_NB, ' attached shaders %d',_get_program_iv(program, GL_ATTACHED_SHADERS)); puts(_sb) aaml = _get_program_iv(program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH) - printf(' active attribute max length %d\n', aaml) + snprintf(_sb,_NB, ' active attribute max length %d', aaml); puts(_sb) auml = _get_program_iv(program, GL_ACTIVE_UNIFORM_MAX_LENGTH) - printf(' active uniform max length %d\n', auml) + snprintf(_sb,_NB, ' active uniform max length %d', auml); puts(_sb) #px/glGetProgramiv(program, GL_ACTIVE_ATTRIBUTES, ¶m) param = glGetProgramiv(program, GL_ACTIVE_ATTRIBUTES) - printf('active attributes %d:\n', param) + snprintf(_sb,_NB, 'active attributes %d:', param); puts(_sb) for i in range(param): #px/glGetActiveAttrib(program, i, 1023, &alength, &asize, &atype, aname) aname, asize, atype = glGetActiveAttrib(program, i); alength = len(aname) location = glGetAttribLocation(program, aname) - printf(' %d %-*s length=%d size=%d type=%d location=%d\n', i, aaml+3, aname, alength, asize, atype, location) + snprintf(_sb,_NB, ' %d %-*s length=%d size=%d type=%d location=%d', i, aaml+3, aname, alength, asize, atype, location) + puts(_sb) #px/glGetProgramiv(program, GL_ACTIVE_UNIFORMS, ¶m) param = glGetProgramiv(program, GL_ACTIVE_UNIFORMS) - printf('active uniforms %d:\n', param) + snprintf(_sb,_NB, 'active uniforms %d:', param); puts(_sb) for i in range(param): #px/glGetActiveUniform(program, i, 1023, &alength, &asize, &atype, aname) aname, asize, atype = glGetActiveUniform(program, i); alength = len(aname) location = glGetUniformLocation(program, aname) - printf(' %d %-*s length=%d size=%d type=%d location=%d\n', i, auml+3, aname, alength, asize, atype, location) + snprintf(_sb,_NB, ' %d %-*s length=%d size=%d type=%d location=%d', i, auml+3, aname, alength, asize, atype, location) + puts(_sb) return link_status and info_log_length <= 1 #pxm-FUNC P nogil @@ -1039,7 +1072,7 @@ #px/glGetProgramiv(program, GL_LINK_STATUS, &link_status) link_status = glGetProgramiv(program, GL_LINK_STATUS) if not link_status: - printf('link status %d\n', link_status) + snprintf(_sb,_NB, 'link status %d', link_status); puts(_sb) _gl_print_program_log(program) if vertex_shader: glDetachShader(program, vertex_shader) diff -Nru pybik-3.1~alpha1~bzr4417~ubuntu16.04.1/pybiklib/ext/gldraw.py pybik-3.1~alpha1~bzr4434~ubuntu16.04.1/pybiklib/ext/gldraw.py --- pybik-3.1~alpha1~bzr4417~ubuntu16.04.1/pybiklib/ext/gldraw.py 2017-11-02 03:33:54.000000000 +0000 +++ pybik-3.1~alpha1~bzr4434~ubuntu16.04.1/pybiklib/ext/gldraw.py 2017-11-07 23:31:17.000000000 +0000 @@ -28,9 +28,9 @@ #px/from libc.math cimport M_PI, cos, sin from math import radians, cos, sin -#pxm>IF '[[GLDEBUG]]' == 'gldebug' +#pxm>IF '[[GLDEBUG]]' == 'd' #pxd+from [[_debug_VARIANT]] cimport * -#pxm>IF '[[GLDEBUG]]' != 'gldebug' +#pxm>IF '[[GLDEBUG]]' != 'd' #pxd+from gl_[[GLVARIANT]] cimport * #pxm>IF_END diff -Nru pybik-3.1~alpha1~bzr4417~ubuntu16.04.1/pybiklib/ext/gl_es2.pxd pybik-3.1~alpha1~bzr4434~ubuntu16.04.1/pybiklib/ext/gl_es2.pxd --- pybik-3.1~alpha1~bzr4417~ubuntu16.04.1/pybiklib/ext/gl_es2.pxd 2017-11-02 03:33:54.000000000 +0000 +++ pybik-3.1~alpha1~bzr4434~ubuntu16.04.1/pybiklib/ext/gl_es2.pxd 2017-11-07 23:31:17.000000000 +0000 @@ -27,6 +27,9 @@ enum: GL_INVALID_OPERATION enum: GL_OUT_OF_MEMORY enum: GL_CCW + enum: GL_DEPTH_RANGE + enum: GL_DEPTH_WRITEMASK + enum: GL_DEPTH_FUNC enum: GL_MAX_TEXTURE_SIZE enum: GL_SAMPLE_BUFFERS enum: GL_SAMPLES diff -Nru pybik-3.1~alpha1~bzr4417~ubuntu16.04.1/pybiklib/ext/gl_ogl.pxd pybik-3.1~alpha1~bzr4434~ubuntu16.04.1/pybiklib/ext/gl_ogl.pxd --- pybik-3.1~alpha1~bzr4417~ubuntu16.04.1/pybiklib/ext/gl_ogl.pxd 2017-11-02 03:33:54.000000000 +0000 +++ pybik-3.1~alpha1~bzr4434~ubuntu16.04.1/pybiklib/ext/gl_ogl.pxd 2017-11-07 23:31:17.000000000 +0000 @@ -18,6 +18,9 @@ enum: GL_BACK enum: GL_CULL_FACE enum: GL_DEPTH_TEST + enum: GL_DEPTH_FUNC + enum: GL_DEPTH_RANGE + enum: GL_DEPTH_WRITEMASK enum: GL_RGB enum: GL_RGBA enum: GL_MAX_TEXTURE_SIZE diff -Nru pybik-3.1~alpha1~bzr4417~ubuntu16.04.1/pybiklib/ext/qtexec.py pybik-3.1~alpha1~bzr4434~ubuntu16.04.1/pybiklib/ext/qtexec.py --- pybik-3.1~alpha1~bzr4417~ubuntu16.04.1/pybiklib/ext/qtexec.py 2017-11-02 03:33:54.000000000 +0000 +++ pybik-3.1~alpha1~bzr4434~ubuntu16.04.1/pybiklib/ext/qtexec.py 2017-11-07 23:31:17.000000000 +0000 @@ -33,11 +33,6 @@ #px/cimport qt as Qt from .debug_purepython import * -#px/from libc.stdio cimport printf -def printf(fmt, *args): print(fmt % args, end='') -#px/from libc.stdio cimport puts -puts = print - #px/cdef enum: # if True: DEBUG_MSG = 0x0002 diff -Nru pybik-3.1~alpha1~bzr4417~ubuntu16.04.1/pybiklib/ext/qt.pxd pybik-3.1~alpha1~bzr4434~ubuntu16.04.1/pybiklib/ext/qt.pxd --- pybik-3.1~alpha1~bzr4417~ubuntu16.04.1/pybiklib/ext/qt.pxd 2017-11-02 03:33:54.000000000 +0000 +++ pybik-3.1~alpha1~bzr4434~ubuntu16.04.1/pybiklib/ext/qt.pxd 2017-11-07 23:31:17.000000000 +0000 @@ -75,6 +75,23 @@ const char *data() nogil const int size() nogil const +#QDir +cdef extern from "": + cdef cppclass QDir: + QDir() + QDir(const QString &path) + cbool exists() const + void setFilter(Filters filters) + void setSorting(SortFlags sort) + QFileInfoList entryInfoList() const +cdef extern from "" namespace "QDir": + cdef enum Filters: + QDir_Files 'QDir::Files', QDir_Readable 'QDir::Readable', + QDir_Files_Readable 'QDir::Files | QDir::Readable' + cdef enum SortFlags: + QDir_Name 'QDir::Name', QDir_IgnoreCase 'QDir::IgnoreCase', + QDir_Name_IgnoreCase 'QDir::Name | QDir::IgnoreCase' + #QElapsedTimer cdef extern from "": cdef cppclass QElapsedTimer: @@ -88,6 +105,24 @@ cdef cppclass QEvent: pass +#QFile +cdef extern from "": + cdef cppclass QFile: + QFile() + void setFileName(const QString &name) + cbool open(OpenMode mode) + #QIODevice + QByteArray readAll() +cdef extern from "" namespace "QIODevice": + cdef enum OpenMode: + ReadOnly + +#QFileInfo +cdef extern from "": + cdef cppclass QFileInfo: + QString filePath() const + QString suffix() const + #QFileSystemWatcher cdef extern from "": cdef cppclass QFileSystemWatcher: @@ -111,6 +146,13 @@ void reserve(int size) nogil void append(const QObject *t) nogil +#QFileInfoList +cdef extern from "": + cdef cppclass QFileInfoList: + QFileInfoList() + int size() nogil const + const QFileInfo& at(int i) const + #QList[QOpenGLDebugMessage] cdef extern from "": cdef cppclass OpenGLDebugMessageList "QList": @@ -348,6 +390,8 @@ QIcon(const QPixmap &pixmap) QIcon(const QString &fileName) void addFile(const QString &fileName) + QString name() const + cbool isNull() const #QImage cdef extern from "" namespace "QImage": @@ -542,6 +586,7 @@ cdef cppclass QSurfaceFormat: QSurfaceFormat() nogil int depthBufferSize() nogil const + void setDepthBufferSize(int size) nogil int stencilBufferSize() nogil const int redBufferSize() nogil const int greenBufferSize() nogil const diff -Nru pybik-3.1~alpha1~bzr4417~ubuntu16.04.1/pybiklib/ext/qt.py pybik-3.1~alpha1~bzr4434~ubuntu16.04.1/pybiklib/ext/qt.py --- pybik-3.1~alpha1~bzr4417~ubuntu16.04.1/pybiklib/ext/qt.py 2017-11-02 03:33:54.000000000 +0000 +++ pybik-3.1~alpha1~bzr4434~ubuntu16.04.1/pybiklib/ext/qt.py 2017-11-07 23:31:17.000000000 +0000 @@ -78,11 +78,6 @@ #pxd>cdef extern from "[[_qt_VARIANT]]_moc.h":# #pxm>DINDENT -#px/from libc.stdio cimport printf -def printf(fmt, *args): print(fmt % args, end='') -#px/from libc.stdio cimport puts -puts = print - #px/cdef enum: # if True: DEBUG_MSG = 0x0002 @@ -113,6 +108,35 @@ if module.DEBUG_SIM: debug |= DEBUG_SIM if module.DEBUG_NOCONTROLS: debug |= DEBUG_NOCONTROLS +#XXX: duplicate code +#px+DEF _NB = 256 +#px+cdef char _sb[_NB] +#px+from libc.stdio cimport snprintf +#px: +def snprintf(buf, size, fmt, *args): + global _nb + assert buf is _nb + _nb = fmt % args +#px. +#pxm>IF '[[ANDROID]]' != 'a' +#px/from libc.stdio cimport puts +puts = print +#pxm>IF '[[ANDROID]]' == 'a' +#px+cdef extern from "":# + #px+void __android_log_write(int, const char*, const char*) nogil + #px+enum: ANDROID_LOG_DEBUG +#px+cdef void puts(const char* text) nogil: + #px+__android_log_write(ANDROID_LOG_DEBUG, 'pybik', text) +#pxm>IF_END +#XXX: end duplicate code + +#pxm>IF '[[ANDROID]]' != 'a' +#px+def alog(text): + #px+text = b'alog: ' + text + #px+puts(text) +#pxm>IF '[[ANDROID]]' == 'a' +#px+def alog(text): puts(text) +#pxm>IF_END # Workaround to compile on xenial: # error: calls to overloaded operators cannot appear in a constant-expression @@ -364,8 +388,8 @@ #px+ this.offscreen_image(renderdata.offscreenbuffer.toImage()) #pxm-FUNC PHD nogil def slot_on_messageLogged(self, msg:'const QOpenGLDebugMessage &'): - #px/printf('GL%05x: %s\n', msg.id(), msg.message().toUtf8().data()) - printf('GL%05x: %s\n', msg.id(), msg.message()) + #px/snprintf(_sb,_NB, 'GL%05x: %s', msg.id(), msg.message().toUtf8().data()); puts(_sb) + print('GL%05x:'%msg.id(), msg.message()) #pxh> #pxm:Q_SIGNAL picking_result = pyqtSignal(int) @@ -436,7 +460,8 @@ #pxm>IF '[[QTVARIANT]]' == 'qtq' uidata.mainwindow.setRenderTarget(renderdata.offscreenbuffer) #pxm>IF_END - #px+printf('offscreenbuffer samples=%d (%d)\n', renderdata.offscreenbuffer.format().samples(), format.samples()) + #px+snprintf(_sb,_NB, 'offscreenbuffer samples=%d (%d)', renderdata.offscreenbuffer.format().samples(), format.samples()) + #px+puts(_sb) #pxm-FUNC P nogil def render_init(): @@ -502,8 +527,9 @@ renderdata.renderer.connect_gldebuglogger(renderdata.gldebuglogger) renderdata.gldebuglogger.startLogging(SynchronousLogging) messages = renderdata.gldebuglogger.loggedMessages() - #px/printf('QOpenGLDebugLogger successfully initialized and started (%d initial messages)\n', messages.size()) - printf('QOpenGLDebugLogger successfully initialized and started (%d initial messages)\n', len(messages)) + #px+snprintf(_sb,_NB, 'QOpenGLDebugLogger successfully initialized and started (%d initial messages)', messages.size()) + #px/puts(_sb) + print('QOpenGLDebugLogger successfully initialized and started (%d initial messages)' % len(messages)) #px/for i in range(messages.size()): for message in messages: #px+message = messages.at(i) @@ -511,16 +537,26 @@ #pxm-FUNC P nogil def _pfmt(name:'char *', f:int, rf:int, df:int): - printf(' %s: %d', name, f) - if f != rf: printf(' (%d)', rf) - if rf != df: printf(' [%d]', df) - puts('') + #px+cdef int n + #px/n = snprintf(_sb,_NB, ' %s: %d', name, f) + _sb = ' %s: %d' % (name, f) + #px/if f != rf: n += snprintf(_sb+n,_NB-n, ' (%d)', rf) + if f != rf: _sb += ' (%d)' % rf + #px/if rf != df: n += snprintf(_sb+n,_NB-n, ' [%d]', df) + if rf != df: _sb += ' [%d]' % df + puts(_sb) #pxm-FUNC P nogil def _pfmt2(name:'char *', f1:int, f2:int, rf1:int, rf2:int, df1:int, df2:int): - printf(' %s: %d.%d', name, f1, f2) - if f1 != rf1 or f2 != rf2: printf(' (%d.%d)', rf1, rf2) - if rf1 != df1 or rf2 != df2: printf(' [%d.%d]', df1, df2) - puts('') + #px+cdef int n + #px/n = snprintf(_sb,_NB, ' %s: %d.%d', name, f1, f2) + _sb = ' %s: %d.%d' % (name, f1, f2) + if f1 != rf1 or f2 != rf2: + #px/n += snprintf(_sb+n,_NB-n, ' (%d.%d)', rf1, rf2) + _sb += ' (%d.%d)' % (rf1, rf2) + if rf1 != df1 or rf2 != df2: + #px/n += snprintf(_sb+n,_NB-n, ' [%d.%d]', df1, df2) + _sb += ' [%d.%d]' % (df1, df2) + puts(_sb) #pxm-FUNC P nogil def print_surface_info(): @@ -554,7 +590,7 @@ elif i == LibGLES: puts(' module type: LibGLES') else: - printf(' unknown module type: %d\n', i) + snprintf(_sb,_NB, ' unknown module type: %d', i); puts(_sb) i = glcontext.isOpenGLES() if glcontext.isOpenGLES(): puts(' isOpenGLES: True') @@ -569,7 +605,7 @@ #px+cdef QOpenGLFunctions *glFuncs = glcontext.functions() # needed for clang #px+cdef int features = glFuncs.openGLFeatures() - #px+printf(' features: 0x%0x\n', features) + #px+snprintf(_sb,_NB, ' features: 0x%0x', features); puts(_sb) #### ui: communicate with render-thread #### @@ -588,6 +624,7 @@ #px/cdef QSurfaceFormat glformat glformat = QSurfaceFormat() #px+cdef int samples + glformat.setDepthBufferSize(8) samples = settings['draw.samples'] if samples > 0: glformat.setSamples(2**samples) @@ -950,19 +987,19 @@ mo = qtobj.metaObject() - printf('==== %s\n', msg) - #printf('Object-Name: %s\n', q2charp(qtobj.objectName())) - printf('Class-Name: %s\n', mo.className()) + snprintf(_sb,_NB, '==== %s', msg); puts(_sb) + #snprintf(_sb,_NB, 'Object-Name: %s', q2charp(qtobj.objectName())); puts(_sb) + snprintf(_sb,_NB, 'Class-Name: %s', mo.className()); puts(_sb) if 0 < mo.propertyCount(): - printf('Properties: %d (%d inherited)\n', mo.propertyCount(), mo.propertyOffset()) + snprintf(_sb,_NB, 'Properties: %d (%d inherited)', mo.propertyCount(), mo.propertyOffset()); puts(_sb) for i in range(mo.propertyCount()): p = mo.property(i) - printf(' %d %s %s\n', i, p.typeName(), p.name()) + snprintf(_sb,_NB, ' %d %s %s', i, p.typeName(), p.name()); puts(_sb) if 0 < mo.methodCount(): - printf('Methods: %d (%d inherited)\n', mo.methodCount(), mo.methodOffset()) + snprintf(_sb,_NB, 'Methods: %d (%d inherited)', mo.methodCount(), mo.methodOffset()); puts(_sb) for i in range(mo.methodCount()): m = mo.method(i) - printf(' %d %s %s\n', i, m.typeName(), m.methodSignature().data()) + snprintf(_sb,_NB, ' %d %s %s', i, m.typeName(), m.methodSignature().data()); puts(_sb) #pxm>IF '[[QTVARIANT]]' == 'qtq' #pxm-FUNC P with gil @@ -1929,6 +1966,34 @@ #### misc qt #### +def list_dir(dirname): + #px+cdef QDir qdir + qdir = QDir(str2q(dirname)) + if not qdir.exists(): + yield None, None + return + qdir.setFilter(QDir_Files_Readable) + qdir.setSorting(QDir_Name_IgnoreCase) + #px+cdef QFileInfoList qlist + qlist = qdir.entryInfoList() + #px+cdef QFileInfo qfi + for i in range(qlist.size()): + qfi = qlist.at(i) + yield q2str(qfi.filePath()), q2str(qfi.suffix()) + +def read_file(filename): + #XXX: QFile.open is needed on android + # but maybe use the python open function on other platforms, + # because the python functions are better for excption handling + #px+cdef QFile file + #px+file.setFileName(str2q(filename)) + #px+if not file.open(ReadOnly): + #px+print('cannot open', filename) + #px+return None + #px+cdef QByteArray data = file.readAll() + #px/return data.data()[:data.size()] + return b'' + def parse_color(name): #px/cdef QColor color color = QColor() @@ -2154,7 +2219,6 @@ uidata.animate_timer = NULL #pxm>IF_END -#pxm-FUNC P def load_cursors(filepattern): #px/cdef QImage images[17] images = [None]*17 @@ -2277,7 +2341,6 @@ #pxm>IF_END animation_init() settings_timer_create() - load_cursors(os.path.join(config_.UI_DIR, 'cursors', 'mouse_{}.png')) def destroy_window(): destroy_cursors() diff -Nru pybik-3.1~alpha1~bzr4417~ubuntu16.04.1/pybiklib/ext/qtui.py pybik-3.1~alpha1~bzr4434~ubuntu16.04.1/pybiklib/ext/qtui.py --- pybik-3.1~alpha1~bzr4417~ubuntu16.04.1/pybiklib/ext/qtui.py 2017-11-02 03:33:54.000000000 +0000 +++ pybik-3.1~alpha1~bzr4434~ubuntu16.04.1/pybiklib/ext/qtui.py 2017-11-07 23:31:17.000000000 +0000 @@ -54,11 +54,6 @@ #pxc>#include "qtui_p.h" #pxc> -#px/from libc.stdio cimport printf -def printf(fmt, *args): print(fmt % args, end='') -#px/from libc.stdio cimport puts -puts = print - #px/cdef enum: # if True: DEBUG_MSGEXT = 0x1 diff -Nru pybik-3.1~alpha1~bzr4417~ubuntu16.04.1/pybiklib/main.py pybik-3.1~alpha1~bzr4434~ubuntu16.04.1/pybiklib/main.py --- pybik-3.1~alpha1~bzr4417~ubuntu16.04.1/pybiklib/main.py 2017-11-02 03:33:54.000000000 +0000 +++ pybik-3.1~alpha1~bzr4434~ubuntu16.04.1/pybiklib/main.py 2017-11-07 23:31:17.000000000 +0000 @@ -51,6 +51,36 @@ self.file.close() +def setup_alog(): + import io + class ALog (io.TextIOBase): + def __init__(self): + self.logfunc = None + self.buffer = '' + def set_logfunc(self, logfunc): + self.logfunc = logfunc + self.write('') + def flush(self): + if self.logfunc is None: + return + self.write('') + if self.buffer: + self.logfunc(self.buffer.encode('utf-8')) + self.buffer = '' + writable = lambda self: True + def write(self, text): + self.buffer += text + if self.logfunc is not None: + while True: + buf = self.buffer.split('\n', 1) + if len(buf) <= 1: + break + line, self.buffer = buf + self.logfunc(line.encode('utf-8')) + return len(text) + sys.stderr = sys.stdout = ALog() + + class Options: test_arg_names = ['write-y', 'write-yes', 'write-n', 'write-no', 'write-e', 'write-error', 'log-widgets', 'notime'] @@ -192,7 +222,25 @@ self.root_dir = root_dir self.opts = Options() - self.opts.parse(sys.argv) + if sys.platform == 'android': + stdout, stderr = sys.stdout, sys.stderr + setup_alog() + try: + self.run() + except: + sys.excepthook(*sys.exc_info()) + finally: + sys.stdout.flush() + sys.stdout, sys.stderr = stdout, stderr + else: + self.run() + + def run(self): + args = sys.argv + if sys.platform == 'android': + #TODO: load args from file + args = sys.argv[:1] + '--debug=msgall,import --variant=da'.split() + self.opts.parse(args) from .debug import DEBUG, DEBUG_QSGINFO, DEBUG_BASICRENDERER, DEBUG_PUREPYTHON, DEBUG_PHONE, DEBUG_CLOCALE if DEBUG: @@ -264,6 +312,9 @@ def load_gllib(self): from .debug import DEBUG_IMPORT + if sys.platform == 'android': + #XXX: skip load_gllib, no ctypes on android + return #XXX: Workaround for lp:941826, "dlopen(libGL.so) resolves to mesa rather than nvidia" # Was: "PyQt cannot compile shaders with Ubuntu's Nvidia drivers" # https://bugs.launchpad.net/ubuntu/+source/python-qt4/+bug/941826 @@ -327,6 +378,8 @@ t.install(names=['ngettext']) from pybiklib.ext import qt + if sys.platform == 'android': + sys.stdout.set_logfunc(qt.alog) qt.app_post_create(_) def cb_run_app(self): diff -Nru pybik-3.1~alpha1~bzr4417~ubuntu16.04.1/pybiklib/model.py pybik-3.1~alpha1~bzr4434~ubuntu16.04.1/pybiklib/model.py --- pybik-3.1~alpha1~bzr4417~ubuntu16.04.1/pybiklib/model.py 2017-11-02 03:33:54.000000000 +0000 +++ pybik-3.1~alpha1~bzr4434~ubuntu16.04.1/pybiklib/model.py 2017-11-07 23:31:17.000000000 +0000 @@ -18,6 +18,7 @@ import sys, os +import io import re import pickle from array import array @@ -28,6 +29,7 @@ DEBUG_NOCACHE, DEBUG_MODELFAST, DEBUG_CACHEUPDATE) from .config import MODELS_DIR from .utils import filebyteorder, epsilon, get_texcoords_range, Vector +from .ext import qt try: _ @@ -130,8 +132,7 @@ return indexfilename = os.path.join(MODELS_DIR, 'f00index' if DEBUG_MODELFAST else 'd00index') debug('loading model index:', indexfilename) - with open(indexfilename, 'rb') as indexfile: - cls.cache_index = pickle.load(indexfile) + cls.cache_index = pickle.loads(qt.read_file(indexfilename)) @staticmethod def read_vectors(datafile): @@ -169,9 +170,9 @@ return _data, _vectors filename = os.path.join(MODELS_DIR, filename) debug('loading model data:', filename) - with open(filename, 'rb') as datafile: - data = pickle.load(datafile) - vectors = list(self.isplit3_vectors(self.read_vectors(datafile))) + datafile = io.BytesIO(qt.read_file(filename)) + data = pickle.load(datafile) + vectors = list(self.isplit3_vectors(self.read_vectors(datafile))) return data, vectors def load_data(self, filename): diff -Nru pybik-3.1~alpha1~bzr4417~ubuntu16.04.1/pybiklib/pluginlib.py pybik-3.1~alpha1~bzr4434~ubuntu16.04.1/pybiklib/pluginlib.py --- pybik-3.1~alpha1~bzr4417~ubuntu16.04.1/pybiklib/pluginlib.py 2017-11-02 03:33:54.000000000 +0000 +++ pybik-3.1~alpha1~bzr4434~ubuntu16.04.1/pybiklib/pluginlib.py 2017-11-07 23:31:17.000000000 +0000 @@ -25,6 +25,8 @@ from . import config from . import model +from .ext import qt + FILE_FORMAT = 'Pybik Plugins Collection - Version 2.0' FILE_SIG = 'Format: ' + FILE_FORMAT @@ -61,9 +63,7 @@ self.parse() def load(self, filename): - debug('loading plugin-file', repr(filename)) - with open(filename, 'rt', encoding='utf-8') as fp: - lines = fp.readlines() + lines = qt.read_file(filename).decode('utf-8').splitlines() # parse file para = {} @@ -307,27 +307,25 @@ '\n'.join([' • ' + m for m in all_models]) ) - def load_plugins_from_directory(self, dirname): - if DEBUG_MSG or DEBUG_LIVEPLUGINS: - print('loading plugins from', repr(dirname)) - for filename in sorted(os.listdir(dirname), key=str.lower): - unused_name, ext = os.path.splitext(filename) - if ext != '.plugins': - continue - if DEBUG_ALG: debug(' plugins:', filename) - try: - self.load_plugins_from_file(os.path.join(dirname, filename)) - except Exception: - sys.excepthook(*sys.exc_info()) + def _load_plugins(self): + for dirname in [config.PLUGINS_DIR, config.get_data_home(config.PACKAGE, 'plugins')]: + if DEBUG_MSG or DEBUG_LIVEPLUGINS: + print('loading plugins from', repr(dirname)) + for filename, suffix in qt.list_dir(dirname): + if filename is None: + debug(' plugins path does not exist:', dirname) + elif suffix == 'plugins': + debug(' plugins:', filename) + try: + self.load_plugins_from_file(filename) + except Exception: + sys.excepthook(*sys.exc_info()) + else: + debug(' not a plugins-file:', filename) def load_plugins(self): self.scripts.clear() - for dirname in [config.PLUGINS_DIR, config.get_data_home(config.PACKAGE, 'plugins')]: - if os.path.isdir(dirname): - debug('Found plugins path:', dirname) - self.load_plugins_from_directory(dirname) - else: - debug('Plugins path does not exist:', dirname) + self._load_plugins() if DEBUG_ALG: debug('found', len(self.scripts)) return [(path, i) for i, path in enumerate(self.scripts.keys())] diff -Nru pybik-3.1~alpha1~bzr4417~ubuntu16.04.1/setup.py pybik-3.1~alpha1~bzr4434~ubuntu16.04.1/setup.py --- pybik-3.1~alpha1~bzr4417~ubuntu16.04.1/setup.py 2017-11-02 03:33:54.000000000 +0000 +++ pybik-3.1~alpha1~bzr4434~ubuntu16.04.1/setup.py 2017-11-07 23:31:17.000000000 +0000 @@ -1159,9 +1159,9 @@ variantgroups_by_module = { '_debug': ('glvariant',), '_gldraw': ('glvariant', 'gldebug'), - '_glarea': ('glvariant', 'gldebug', 'offscreen'), + '_glarea': ('glvariant', 'gldebug', 'offscreen', 'android'), '_qtui': (), - '_qt': ('qtvariant', 'glvariant', 'gldebug', 'offscreen'), + '_qt': ('qtvariant', 'glvariant', 'gldebug', 'offscreen', 'android'), '_qtexec': (), } diff -Nru pybik-3.1~alpha1~bzr4417~ubuntu16.04.1/tools/create-gl-pxd.py pybik-3.1~alpha1~bzr4434~ubuntu16.04.1/tools/create-gl-pxd.py --- pybik-3.1~alpha1~bzr4417~ubuntu16.04.1/tools/create-gl-pxd.py 2017-11-02 03:33:54.000000000 +0000 +++ pybik-3.1~alpha1~bzr4434~ubuntu16.04.1/tools/create-gl-pxd.py 2017-11-07 23:31:17.000000000 +0000 @@ -61,7 +61,7 @@ for match in re.finditer(r'^\#define[ \t]+(GL_\w+)(.*?)$', source, re.MULTILINE | re.DOTALL): sym = match.group(1) ssym = sym.split('_') - if code and re.search(r'\b%s\b' % re.escape(sym), code) is None: + if code and re.search(r'\n[^#]*\b%s\b' % re.escape(sym), code) is None: continue if sym.upper() != sym or ssym[-1] in vendors: continue @@ -86,7 +86,7 @@ sym = match.group(3) unused_lineno, glversion, glesversion = find_lineno(hlines[relpath], match.start()) if (glversion, glesversion, sym) not in symbols: - if code and re.search(r'\b%s\b' % re.escape(sym), code) is None: + if code and re.search(r'\n[^#]*\b%s\b' % re.escape(sym), code) is None: continue symbols.append((glversion, glesversion, sym)) print('.', end='', file=sys.stderr, flush=True) @@ -101,7 +101,7 @@ empty = True for type in types.split(): consttype = 'const_{0}_ptr'.format(type) - if code and re.search(r'\b%s\b' % re.escape(consttype), code) is None: + if code and re.search(r'\n[^#]*\b%s\b' % re.escape(consttype), code) is None: continue print('.', end='', file=sys.stderr, flush=True) if empty: @@ -127,7 +127,7 @@ elif err == gl.GL_OUT_OF_MEMORY: puts('glerror: GL_OUT_OF_MEMORY') else: - printf('gl unknown: %x\n', err) + snprintf(_sb,_NB, 'gl unknown: %x', err); puts(_sb) err = gl.glGetError()''' for abspath, relpath, source in headers: @@ -167,7 +167,7 @@ sym = match.group(2).strip() unused_lineno, glversion, glesversion = find_lineno(hlines[relpath], match.start()) if (glversion, glesversion, sym) not in symbols: - if code and re.search(r'\b%s\b' % re.escape(sym), code) is None: + if code and re.search(r'\n[^#]*\b%s\b' % re.escape(sym), code) is None: continue symbols.append((glversion, glesversion, sym)) print('.', end='', file=sys.stderr, flush=True) @@ -182,9 +182,24 @@ print(file=sys.stderr) def convert_symbols(headers, code, print_symbols=False): - yield '\nfrom libc.stddef cimport ptrdiff_t', None, '\nfrom libc.stdio cimport printf, puts' + yield '\nfrom libc.stddef cimport ptrdiff_t', None, '' yield 'from libc.stdint cimport int32_t, intptr_t, int8_t, uint8_t', None, '''cimport gl_[[GLVARIANT]] as gl +#XXX: duplicate code +DEF _NB = 256 +cdef char _sb[_NB] +from libc.stdio cimport snprintf +##pxm>IF '[[ANDROID]]' != 'a' +#from libc.stdio cimport puts +##pxm>IF '[[ANDROID]]' == 'a' +cdef extern from "":# + void __android_log_write(int, const char*, const char*) nogil + enum: ANDROID_LOG_DEBUG +cdef void puts(const char* text) nogil: + __android_log_write(ANDROID_LOG_DEBUG, 'pybik', text) +##pxm>IF_END +#XXX: end duplicate code + print('Importing module:', __name__) print(' GL-type: [[GLVARIANT]]') diff -Nru pybik-3.1~alpha1~bzr4417~ubuntu16.04.1/tools/demos/mkicons.py pybik-3.1~alpha1~bzr4434~ubuntu16.04.1/tools/demos/mkicons.py --- pybik-3.1~alpha1~bzr4417~ubuntu16.04.1/tools/demos/mkicons.py 2017-11-02 03:33:54.000000000 +0000 +++ pybik-3.1~alpha1~bzr4434~ubuntu16.04.1/tools/demos/mkicons.py 2017-11-07 23:31:17.000000000 +0000 @@ -17,15 +17,17 @@ import os from contextlib import suppress +from subprocess import check_call from pybiklib import config from pybiklib.settings import settings from pybiklib.model import Model from pybiklib.utils import exc_end +from pybiklib.cubestate import CubeState from pybiklib.ext import qt def irun(app): - wsize = (128, 128) + wsize = (256, 256) settings['window.size'] = wsize yield 100 settings['window.size'] = wsize @@ -33,6 +35,9 @@ dirname = os.path.join(config.UI_DIR, 'qt', 'images') with suppress(FileExistsError): os.mkdir(dirname) + dirname += '_x2' + with suppress(FileExistsError): + os.mkdir(dirname) print() mtype, size = app.ui_load_game('Cube', (3,)) @@ -43,21 +48,28 @@ yield 100 print(' solved') - filename = os.path.join(dirname, 'new-solved-tmp.png') - qt.save_screenshot(filename) - print(' screenshot:', filename) + filename_solved = os.path.join(dirname, 'new-solved-tmp.png') + qt.save_screenshot(filename_solved) + print(' screenshot:', filename_solved) yield 0 print(' random') + CubeState.rand.seed(134) app.ui_new_game(solved=False) yield 100 - filename = os.path.join(dirname, 'new-random-tmp.png') - qt.save_screenshot(filename) - print(' screenshot:', filename) + filename_random = os.path.join(dirname, 'new-random-tmp.png') + qt.save_screenshot(filename_random) + print(' screenshot:', filename_random) yield 100 qt.close_mainwindow() + for fnt in filename_solved, filename_random: + fn = fnt.replace('-tmp','') + check_call(['convert', fnt, '-crop', '128x128+62+68', fn]) + os.remove(fnt) + check_call(['convert', str(fn), '-resize', '64x64', fn.replace('_x2','')]) + def run(app): it = irun(app) @exc_end diff -Nru pybik-3.1~alpha1~bzr4417~ubuntu16.04.1/tools/demos/mkicons.sh pybik-3.1~alpha1~bzr4434~ubuntu16.04.1/tools/demos/mkicons.sh --- pybik-3.1~alpha1~bzr4417~ubuntu16.04.1/tools/demos/mkicons.sh 2017-11-02 03:33:54.000000000 +0000 +++ pybik-3.1~alpha1~bzr4434~ubuntu16.04.1/tools/demos/mkicons.sh 2017-11-07 23:31:17.000000000 +0000 @@ -3,7 +3,6 @@ set -e tools/demos/run-demo.sh os mkicons +optipng data/ui/qt/images/* +optipng data/ui/qt/images_x2/* -convert data/ui/qt/images/new-solved-tmp.png -crop 64x64+31+34 data/ui/qt/images/new-solved.png -convert data/ui/qt/images/new-random-tmp.png -crop 64x64+31+34 data/ui/qt/images/new-random.png -rm data/ui/qt/images/new-solved-tmp.png data/ui/qt/images/new-random-tmp.png