# Path: albow/dialogs.py
# class Dialog(Modal, Widget):
# 
#     click_outside_response = None
# 
#     def __init__(self, client=None, responses=None,
#             default=0, cancel=-1, **kwds):
#         Widget.__init__(self, **kwds)
#         if client or responses:
#             rows = []
#             w1 = 0
#             w2 = 0
#             if client:
#                 rows.append(client)
#                 w1 = client.width
#             if responses:
#                 buttons = Row([
#                     Button(text, action=lambda t=text: self.dismiss(t))
#                         for text in responses])
#                 rows.append(buttons)
#                 w2 = buttons.width
#             if w1 < w2:
#                 a = 'l'
#             else:
#                 a = 'r'
#             contents = Column(rows, align=a)
#             m = self.margin
#             contents.topleft = (m, m)
#             self.add(contents)
#             self.shrink_wrap()
#         if responses and default is not None:
#             self.enter_response = responses[default]
#         if responses and cancel is not None:
#             self.cancel_response = responses[cancel]
# 
#     def mouse_down(self, e):
#         if not e in self:
#             response = self.click_outside_response
#             if response is not None:
#                 self.dismiss(response)
# 
# Path: editortools/thumbview.py
# class ThumbView(GLPerspective):
# class BlockThumbView(Widget):
#     def __init__(self, sch, **kw):
#     def setup_modelview(self):
#     def gl_draw_tex(self):
#     def clear(self):
#     def gl_draw(self):
#     def gl_draw_thumb(self):
#     def __init__(self, materials, blockInfo=None, **kw):
#     def blockInfo(self):
#     def blockInfo(self, b):
# 
# Path: editortools/blockview.py
# class BlockView(GLOrtho):
# class BlockButton(ButtonBase, Panel):
#     def __init__(self, materials, blockInfo=None):
#     def gl_draw(self):
#     def _gl_draw(self):
#     def tooltipText(self):
#     def __init__(self, materials, blockInfo=None, ref=None, recentBlocks=None, *a, **kw):
#     def blockInfo(self):
#     def blockInfo(self, bi):
#     def labelText(self):
#     def createRecentBlockView(self):
#         def makeBlockView(bi):
#             def action(evt):
#     def updateRecentBlockView(self):
#     def tooltipText(self):
#     def action(self):
# 
# Path: glbackground.py
# 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: mceutils.py
# def CheckBoxLabel(title, *args, **kw):
#     tooltipText = kw.pop('tooltipText', None)
# 
#     cb = CheckBox(*args, **kw)
#     lab = Label(title, fg_color=cb.fg_color)
#     lab.mouse_down = cb.mouse_down
# 
#     if tooltipText:
#         cb.tooltipText = tooltipText
#         lab.tooltipText = tooltipText
# 
#     class CBRow(Row):
#         margin = 0
# 
#         @property
#         def value(self):
#             return self.checkbox.value
# 
#         @value.setter
#         def value(self, val):
#             self.checkbox.value = val
# 
#     row = CBRow((lab, cb))
#     row.checkbox = cb
#     return row


from albow import Label, TextField, Row, TableView, TableColumn, Column, Widget, Button, AttrRef
from albow.dialogs import Dialog
from editortools import thumbview
from editortools import blockview
from glbackground import GLBackground
from mceutils import CheckBoxLabel
from pymclevel import materials
from pymclevel.materials import Block


def anySubtype(self):
    bl = Block(self.materials, self.ID, self.blockData)
    bl.wildcard = True
    return bl

Block.anySubtype = anySubtype
Block.wildcard = False  # True if


class BlockPicker(Dialog):
    is_gl_container = True

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

# Path: albow/dialogs.py
# class Dialog(Modal, Widget):
# 
#     click_outside_response = None
# 
#     def __init__(self, client=None, responses=None,
#             default=0, cancel=-1, **kwds):
#         Widget.__init__(self, **kwds)
#         if client or responses:
#             rows = []
#             w1 = 0
#             w2 = 0
#             if client:
#                 rows.append(client)
#                 w1 = client.width
#             if responses:
#                 buttons = Row([
#                     Button(text, action=lambda t=text: self.dismiss(t))
#                         for text in responses])
#                 rows.append(buttons)
#                 w2 = buttons.width
#             if w1 < w2:
#                 a = 'l'
#             else:
#                 a = 'r'
#             contents = Column(rows, align=a)
#             m = self.margin
#             contents.topleft = (m, m)
#             self.add(contents)
#             self.shrink_wrap()
#         if responses and default is not None:
#             self.enter_response = responses[default]
#         if responses and cancel is not None:
#             self.cancel_response = responses[cancel]
# 
#     def mouse_down(self, e):
#         if not e in self:
#             response = self.click_outside_response
#             if response is not None:
#                 self.dismiss(response)
# 
# Path: editortools/thumbview.py
# class ThumbView(GLPerspective):
# class BlockThumbView(Widget):
#     def __init__(self, sch, **kw):
#     def setup_modelview(self):
#     def gl_draw_tex(self):
#     def clear(self):
#     def gl_draw(self):
#     def gl_draw_thumb(self):
#     def __init__(self, materials, blockInfo=None, **kw):
#     def blockInfo(self):
#     def blockInfo(self, b):
# 
# Path: editortools/blockview.py
# class BlockView(GLOrtho):
# class BlockButton(ButtonBase, Panel):
#     def __init__(self, materials, blockInfo=None):
#     def gl_draw(self):
#     def _gl_draw(self):
#     def tooltipText(self):
#     def __init__(self, materials, blockInfo=None, ref=None, recentBlocks=None, *a, **kw):
#     def blockInfo(self):
#     def blockInfo(self, bi):
#     def labelText(self):
#     def createRecentBlockView(self):
#         def makeBlockView(bi):
#             def action(evt):
#     def updateRecentBlockView(self):
#     def tooltipText(self):
#     def action(self):
# 
# Path: glbackground.py
# 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: mceutils.py
# def CheckBoxLabel(title, *args, **kw):
#     tooltipText = kw.pop('tooltipText', None)
# 
#     cb = CheckBox(*args, **kw)
#     lab = Label(title, fg_color=cb.fg_color)
#     lab.mouse_down = cb.mouse_down
# 
#     if tooltipText:
#         cb.tooltipText = tooltipText
#         lab.tooltipText = tooltipText
# 
#     class CBRow(Row):
#         margin = 0
# 
#         @property
#         def value(self):
#             return self.checkbox.value
# 
#         @value.setter
#         def value(self, val):
#             self.checkbox.value = val
# 
#     row = CBRow((lab, cb))
#     row.checkbox = cb
#     return row


# Path: editortools/blockpicker.py
from albow import Label, TextField, Row, TableView, TableColumn, Column, Widget, Button, AttrRef
from albow.dialogs import Dialog
from editortools import thumbview
from editortools import blockview
from glbackground import GLBackground
from mceutils import CheckBoxLabel
from pymclevel import materials
from pymclevel.materials import Block



def anySubtype(self):
    bl = Block(self.materials, self.ID, self.blockData)
    bl.wildcard = True
    return bl

Block.anySubtype = anySubtype
Block.wildcard = False  # True if


class BlockPicker(Dialog):
    is_gl_container = True

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

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