# Path: albow/openglwidgets.py
# class GLOrtho(GLViewport):
# 
#     def __init__(self, rect=None,
#             xmin=-1, xmax=1, ymin=-1, ymax=1,
#             near=-1, far=1, **kwds):
#         GLViewport.__init__(self, rect, **kwds)
#         self.xmin = xmin
#         self.xmax = xmax
#         self.ymin = ymin
#         self.ymax = ymax
#         self.near = near
#         self.far = far
# 
#     def setup_projection(self):
#         GL.glOrtho(self.xmin, self.xmax, self.ymin, self.ymax,
#             self.near, self.far)
# 
# Path: glbackground.py
# class Panel(GLBackground):
#     pass
# 
# class GLBackground(GLOrtho):
#     margin = 8
#     bg_color = (0.0, 0.0, 0.0, 0.6)
# 
#     #bg_color = (30/255.0,0,255/255.0, 100/255.0)
#     def gl_draw(self):
#         #if hasattr(self, 'highlight_bg_color') and self in self.get_root().find_widget(mouse.get_pos()).all_parents():
#         #    color = self.highlight_bg_color
#         #else:
#         color = tuple(self.bg_color) + (1.0,)
# 
#         glEnable(GL_BLEND)
#         glColor(color[0], color[1], color[2], color[3])
#         glVertexPointer(2, GL_FLOAT, 0, array([-1, -1, -1, 1, 1, 1, 1, -1], dtype='float32'))
#         glDrawArrays(GL_QUADS, 0, 4)
#         glDisable(GL_BLEND)
# 
# Path: glutils.py
# class DisplayList(object):
#     allLists = []
# 
#     def __init__(self, drawFunc=None):
#         self.drawFunc = drawFunc
#         self._list = None
# 
#         def _delete(r):
#             DisplayList.allLists.remove(r)
#         self.allLists.append(weakref.ref(self, _delete))
# 
#     def __del__(self):
#         self.invalidate()
# 
#     @classmethod
#     def invalidateAllLists(self):
#         allLists = []
#         for listref in self.allLists:
#             list = listref()
#             if list:
#                 list.invalidate()
#                 allLists.append(listref)
# 
#         self.allLists = allLists
# 
#     def invalidate(self):
#         if self._list:
#             gl.glDeleteLists(self._list[0], 1)
#             self._list = None
# 
#     def makeList(self, drawFunc):
#         if self._list:
#             return
# 
#         drawFunc = (drawFunc or self.drawFunc)
#         if drawFunc is None:
#             return
# 
#         l = gl.glGenLists(1)
#         GL.glNewList(l, GL.GL_COMPILE)
#         drawFunc()
#         #try:
#         GL.glEndList()
#         #except GL.GLError:
#         #    print "Error while compiling display list. Retrying display list code to pinpoint error"
#         #    self.drawFunc()
# 
#         self._list = numpy.array([l], 'uintc')
# 
#     def getList(self, drawFunc=None):
#         self.makeList(drawFunc)
#         return self._list
# 
#     if "-debuglists" in sys.argv:
#         def call(self, drawFunc=None):
#             drawFunc = (drawFunc or self.drawFunc)
#             if drawFunc is None:
#                 return
#             drawFunc()
#     else:
#         def call(self, drawFunc=None):
#             self.makeList(drawFunc)
#             GL.glCallLists(self._list)


from OpenGL import GL
from numpy import array
from albow import ButtonBase, ValueDisplay, AttrRef, Row
from albow.openglwidgets import GLOrtho
from glbackground import Panel, GLBackground
from glutils import DisplayList
import thumbview
import blockpicker

        GL.glEnableClientState(GL.GL_TEXTURE_COORD_ARRAY)
        GL.glVertexPointer(2, GL.GL_FLOAT, 0, array([-1, -1,
                                 - 1, 1,
                                 1, 1,
                                 1, -1, ], dtype='float32'))
        texOrigin = array(self.materials.blockTextures[blockInfo.ID, blockInfo.blockData, 0])
        texOrigin *= pixelScale

        GL.glTexCoordPointer(2, GL.GL_FLOAT, 0, array([texOrigin[0], texOrigin[1] + texSize,
                                  texOrigin[0], texOrigin[1],
                                  texOrigin[0] + texSize, texOrigin[1],
                                  texOrigin[0] + texSize, texOrigin[1] + texSize], dtype='float32'))

        GL.glDrawArrays(GL.GL_QUADS, 0, 4)

        GL.glDisableClientState(GL.GL_TEXTURE_COORD_ARRAY)
        GL.glDisable(GL.GL_ALPHA_TEST)
        GL.glDisable(GL.GL_TEXTURE_2D)

    @property
    def tooltipText(self):
        return "{0}".format(self.blockInfo.name)


class BlockButton(ButtonBase, Panel):
    _ref = None

    def __init__(self, materials, blockInfo=None, ref=None, recentBlocks=None, *a, **kw):
        self.allowWildcards = False

# Path: albow/openglwidgets.py
# class GLOrtho(GLViewport):
# 
#     def __init__(self, rect=None,
#             xmin=-1, xmax=1, ymin=-1, ymax=1,
#             near=-1, far=1, **kwds):
#         GLViewport.__init__(self, rect, **kwds)
#         self.xmin = xmin
#         self.xmax = xmax
#         self.ymin = ymin
#         self.ymax = ymax
#         self.near = near
#         self.far = far
# 
#     def setup_projection(self):
#         GL.glOrtho(self.xmin, self.xmax, self.ymin, self.ymax,
#             self.near, self.far)
# 
# Path: glbackground.py
# class Panel(GLBackground):
#     pass
# 
# class GLBackground(GLOrtho):
#     margin = 8
#     bg_color = (0.0, 0.0, 0.0, 0.6)
# 
#     #bg_color = (30/255.0,0,255/255.0, 100/255.0)
#     def gl_draw(self):
#         #if hasattr(self, 'highlight_bg_color') and self in self.get_root().find_widget(mouse.get_pos()).all_parents():
#         #    color = self.highlight_bg_color
#         #else:
#         color = tuple(self.bg_color) + (1.0,)
# 
#         glEnable(GL_BLEND)
#         glColor(color[0], color[1], color[2], color[3])
#         glVertexPointer(2, GL_FLOAT, 0, array([-1, -1, -1, 1, 1, 1, 1, -1], dtype='float32'))
#         glDrawArrays(GL_QUADS, 0, 4)
#         glDisable(GL_BLEND)
# 
# Path: glutils.py
# class DisplayList(object):
#     allLists = []
# 
#     def __init__(self, drawFunc=None):
#         self.drawFunc = drawFunc
#         self._list = None
# 
#         def _delete(r):
#             DisplayList.allLists.remove(r)
#         self.allLists.append(weakref.ref(self, _delete))
# 
#     def __del__(self):
#         self.invalidate()
# 
#     @classmethod
#     def invalidateAllLists(self):
#         allLists = []
#         for listref in self.allLists:
#             list = listref()
#             if list:
#                 list.invalidate()
#                 allLists.append(listref)
# 
#         self.allLists = allLists
# 
#     def invalidate(self):
#         if self._list:
#             gl.glDeleteLists(self._list[0], 1)
#             self._list = None
# 
#     def makeList(self, drawFunc):
#         if self._list:
#             return
# 
#         drawFunc = (drawFunc or self.drawFunc)
#         if drawFunc is None:
#             return
# 
#         l = gl.glGenLists(1)
#         GL.glNewList(l, GL.GL_COMPILE)
#         drawFunc()
#         #try:
#         GL.glEndList()
#         #except GL.GLError:
#         #    print "Error while compiling display list. Retrying display list code to pinpoint error"
#         #    self.drawFunc()
# 
#         self._list = numpy.array([l], 'uintc')
# 
#     def getList(self, drawFunc=None):
#         self.makeList(drawFunc)
#         return self._list
# 
#     if "-debuglists" in sys.argv:
#         def call(self, drawFunc=None):
#             drawFunc = (drawFunc or self.drawFunc)
#             if drawFunc is None:
#                 return
#             drawFunc()
#     else:
#         def call(self, drawFunc=None):
#             self.makeList(drawFunc)
#             GL.glCallLists(self._list)


# Path: editortools/blockview.py
from OpenGL import GL
from numpy import array
from albow import ButtonBase, ValueDisplay, AttrRef, Row
from albow.openglwidgets import GLOrtho
from glbackground import Panel, GLBackground
from glutils import DisplayList
import thumbview
import blockpicker


        GL.glEnableClientState(GL.GL_TEXTURE_COORD_ARRAY)
        GL.glVertexPointer(2, GL.GL_FLOAT, 0, array([-1, -1,
                                 - 1, 1,
                                 1, 1,
                                 1, -1, ], dtype='float32'))
        texOrigin = array(self.materials.blockTextures[blockInfo.ID, blockInfo.blockData, 0])
        texOrigin *= pixelScale

        GL.glTexCoordPointer(2, GL.GL_FLOAT, 0, array([texOrigin[0], texOrigin[1] + texSize,
                                  texOrigin[0], texOrigin[1],
                                  texOrigin[0] + texSize, texOrigin[1],
                                  texOrigin[0] + texSize, texOrigin[1] + texSize], dtype='float32'))

        GL.glDrawArrays(GL.GL_QUADS, 0, 4)

        GL.glDisableClientState(GL.GL_TEXTURE_COORD_ARRAY)
        GL.glDisable(GL.GL_ALPHA_TEST)
        GL.glDisable(GL.GL_TEXTURE_2D)

    @property
    def tooltipText(self):
        return "{0}".format(self.blockInfo.name)


class BlockButton(ButtonBase, Panel):
    _ref = None

    def __init__(self, materials, blockInfo=None, ref=None, recentBlocks=None, *a, **kw):
        self.allowWildcards = False

        Panel.__init__(self, *a, **kw)