1. 14
  1.  

  2. 4

    I would love applications to let users redesign/recompose some of their interface at runtime – InterfaceBuilder and NIB, or Glade and the XML UI files, are probably the easiest tool I know to do this, but they don’t embed themselves in some kind of GUI repl. You’re onto something good!

    On a similar topic, there is URWIDE https://github.com/sebastien/urwide, which is a declarative wrapper around URWID, a Python console UI library. In particular, there’s an embedded DSL to define user interfaces with a compact text description that seems to share some ideas with guitktk.

    1. 3

      I would love applications to let users redesign/recompose some of their interface at runtime – InterfaceBuilder and NIB, or Glade and the XML UI files, are probably the easiest tool I know to do this, but they don’t embed themselves in some kind of GUI repl. You’re onto something good!

      Thanks! I remember editing a glade file where I just wanted to reorder some of the UI element and while the edit was pretty quick, I still had to recompile, which involved setting up cross-compilation in that particular case. (I took the opportunity to make some semantic changes too so it wasn’t really a loss.)

      So I thought I’d be nice to have a faster workflow.

      On a similar topic, there is URWIDE https://github.com/sebastien/urwide, which is a declarative wrapper around URWID

      Very cool! I’ve wanted something better for curses-style applications and will be sure to try urwide next time.

      By the way, there’s also a helper DSL for laying out the tree document that I haven’t documented (but its more generic without as much design put in as urwide’s language).

      As a simple example, in Python:

      newnode = Node("path",
                     corners=exr("(`self.topleft.value, `self.botright.value)"),
                     p_topleft=doc["editor.mouse_xy"],
                     p_botright=doc["editor.mouse_xy"] + P(50, 50))
                     topright=exr("topright(`self.corners, (`self.parent).transform)"),
                     botleft=exr("botleft(`self.corners, (`self.parent).transform)"), children = [
          Node("line", start=exr("`self.parent.topleft"),
               end=exr("`self.parent.topright")),
          Node("line", start=exr("`self.parent.topright"),
               end=exr("`self.parent.botright")),
          Node("line", start=exr("`self.parent.botright"),
               end=exr("`self.parent.botleft")),
          Node("line", start=exr("`self.parent.botleft"),
               end=exr("`self.parent.topleft")),
                     ])
      

      In the DSL:

      newnode = tree_lang.parse("""
      path:
        corners=exr('(`self.topleft.value, `self.botright.value)')
        p_topleft=(doc["editor.mouse_xy"])
        p_botright=(doc["editor.mouse_xy"] + P(50, 50)))
        topright=exr('topright(`self.corners, (`self.parent).transform)')
        botleft=exr('botleft(`self.corners, (`self.parent).transform)')
        line: start=exr('`self.parent.topleft') end=exr('`self.parent.topright')
        line: start=exr('`self.parent.topright') end=exr('`self.parent.botright')
        line: start=exr('`self.parent.botright') end=exr('`self.parent.botleft')
        line: start=exr('`self.parent.botleft') end=exr('`self.parent.topleft')
      """, locals=globals())
      
    2. 3

      The GUI grammar is very interesting! This stuff feels pretty powerful, though I haven’t played around with it yet.

      It would be good to see an example of a specific kind of deliverable here. I am having some trouble understanding what the end result is.

      1. 2

        The GUI grammar is very interesting! This stuff feels pretty powerful, though I haven’t played around with it yet.

        Thanks! If you do try it, feel free to tell me what you think.

        It would be good to see an example of a specific kind of deliverable here. I am having some trouble understanding what the end result is.

        Good point. I tried making what I wanted out of it directly which is too large and not entire doable yet: remake a good chunk of tkui as a guitktk program and then make editors using that.

        Any suggestions for an example? I was thinking a primitive audio editor but maybe something more visual with fewer other potential complications would be better.