Ejemplo n.º 1
0
    def _show_custom_ui(self):
        if self.shader_error is None:
            return

        imgui.dummy(1, 5)
        imgui.text_colored("Shader error. (?)", 1.0, 0.0, 0.0)
        if imgui.is_item_hovered():
            imgui.set_tooltip(self.shader_error)
Ejemplo n.º 2
0
 def _show(self, value, read_only):
     imgui.push_item_width(self.width)
     changed, v = imgui.input_text("", value.value, 255,
                                   imgui.INPUT_TEXT_ENTER_RETURNS_TRUE)
     if imgui.is_item_hovered() and not imgui.is_item_active():
         imgui.set_tooltip(value.value)
     if changed:
         value.value = v
Ejemplo n.º 3
0
 def _show_custom_ui(self):
     imgui.push_item_width(widget.WIDGET_WIDTH)
     if self.duplicate:
         imgui.push_style_color(imgui.COLOR_TEXT, 1.0, 0.0, 0.0)
     changed, v = imgui.input_text("", self.get("name"), 255, imgui.INPUT_TEXT_ENTER_RETURNS_TRUE)
     if self.duplicate:
         imgui.pop_style_color()
         if imgui.is_item_hovered():
             imgui.set_tooltip("Name is a duplicate!")
     if changed:
         self.name = v
Ejemplo n.º 4
0
def text_tooltip(text, widget):
    """Display a text tooltip on hover"""
    while True:
        try:
            imgui.begin_group()
            next(widget)
        except StopIteration as e:
            return e.value
        finally:
            imgui.end_group()
        if imgui.is_item_hovered():
            imgui.set_tooltip(text)
        yield
Ejemplo n.º 5
0
    def _show(self, value, read_only):
        imgui.push_item_width(self.width)
        changed, v = imgui.input_text("", value.value, 255,
                                      imgui.INPUT_TEXT_ENTER_RETURNS_TRUE)
        if imgui.is_item_hovered() and not imgui.is_item_active():
            imgui.set_tooltip(value.value)
        if changed:
            value.value = v
            return
        imgui.push_item_width(self.width)
        if imgui.button("Select file"):
            imgui.open_popup("select_file")

        path = imgui_pick_file("select_file",
                               assets.ASSET_PATH + "/" + self.prefix)
        if path is not None:
            value.value = os.path.relpath(path, assets.ASSET_PATH)
Ejemplo n.º 6
0
    def _show_custom_ui(self):
        imgui.dummy(1, 5)
        imgui.text("lambda x:")
        imgui.push_item_width(208)
        changed, text = imgui.input_text("", self.get("lambda"), 255,
                                         imgui.INPUT_TEXT_ENTER_RETURNS_TRUE)
        if changed:
            self.get_input("lambda").value = text

        if self.compile_error is not None:
            imgui.text_colored("Compilation error. (?)", 1.0, 0.0, 0.0)
            if imgui.is_item_hovered():
                imgui.set_tooltip(self.compile_error)
        elif self.run_error is not None:
            imgui.text_colored("Runtime error. (?)", 1.0, 0.0, 0.0)
            if imgui.is_item_hovered():
                imgui.set_tooltip(self.run_error)
        else:
            imgui.text("Lambda compiled.")
Ejemplo n.º 7
0
 def _show_custom_ui(self):
     if self.status:
         imgui.dummy(1, 5)
         imgui.text_colored("Error. (?)", 1.0, 0.0, 0.0)
         if imgui.is_item_hovered():
             imgui.set_tooltip(self.status)
Ejemplo n.º 8
0
 def _show_custom_ui(self):
     if self.filter_status is not None:
         imgui.dummy(1, 5)
         imgui.text_colored("Filter error. (?)", 1.0, 0.0, 0.0)
         if imgui.is_item_hovered():
             imgui.set_tooltip(self.filter_status)