omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    pyui render - view .pyui files on PC

    Pythonista
    3
    3
    2595
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • JadedTuna
      JadedTuna last edited by

      Hey guys. I was annoyed of not having a tool which allows you to view .pyui files on PC so I thought about creating one :).

      It is a python script, which will parse .pyui file (which is basically json file) and then generate HTML file which can be viewed in the browser such as Firefox, Safari, etc.

      It is still dirty and surely not complete yet. Program supports View, Label and TextField elements (hopefully). Gonna try to add more elements tomorrow after school. Please post your reviews and ideas here or open issues on the github page :].

      Repository: https://github.com/Vik2015/pyui-renderer/

      1 Reply Last reply Reply Quote 0
      • briarfox
        briarfox last edited by

        @ShadowSlayer Very cool, can't wait to check it out.

        1 Reply Last reply Reply Quote 0
        • JonB
          JonB last edited by

          Pprint actually works pretty well. I tend to think of pyuis as just a repr of a dict. You can read pyuis and eval them, and pprint shows the structure well. This can be useful,for, for instance moving a bunch of components into some container, or flattening a view that had subviews.

          
          from pprint import pprint
          
          def showpyui(filename):
              with open(filename) as f:
                  s=f.read()
                  # safe eval.  Pyuis have literals true and false instead of True and False, so we have to fix those by defining appropriate locals
                  pyuidict=eval(s,{'__builtins__':None},{'true':True,'false':False})
                  pprint(pyuidict)
          
          1 Reply Last reply Reply Quote 0
          • First post
            Last post
          Powered by NodeBB Forums | Contributors