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.


    Graphics Agnostic Python (GAP)

    Pythonista
    3
    6
    5762
    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.
    • Ti Leyon
      Ti Leyon last edited by Ti Leyon

      GAP logo

      Graphics Agnostic Python (GAP)

      GAP is a visual interface designer written in Python that produces complete python scripts with modern graphical interfaces. These scripts may be executed verbatim under all five major computing platforms (MS Windows, OS X, Linux, iOS an Android) with consistent look feel and functionality. GAP is a universal Rapid Application Development (RAD) environment for the Python language. A prospective user needs only grasp rudimentary concepts of modern user interface elements without any idea of the coding involved. The module and its output require kivy or the Pythonista UI in order to function.

      GAP was designed with the utmost emphasis on simplicity. A three line instruction (displayed in the application's window) should be sufficient for a new user to start interacting with the environment then design and generate a full fledge application in minutes if not seconds.

      GAP logo

      GAP is composed of a virtual screen that occupies most of the surface of its window starting at the top left, a few buttons and text fields at the right of that virtual screen and three lines of instruction at the very bottom. The virtual screen is an exact replica of the one generated by its output with all its components properly scaled and positioned. The top five buttons create corresponding components at predefined positions and sizes. These components can be selected and dragged anywhere on the virtual screen. Their positions and sizes can be altered by changing the four text fields to a desired value then clicking or touching the Modify button. A selected component can be removed with the Delete button. The Save button will create a fully functional Python script named "gapout.py" that reflects perfectly the virtual screen and its elements. GAP will automatically define functions that are bound to every button in the interface. Users may modify these functions at will to adapt the script's functionality to their specific needs.

      GAP is built using the UniPAGe.py module. The application reads itself to isolate that module and use it to build its output. Therefore, they may be scaled according to a 4/3 ratio without distortion.

      For more information about UniPAGe refer to its repository or its thread on this forum.

      GAP and UniPAGe are copyrighted materials of Ti Leyon (© 2017).

      They are released under the Creative Commons Attribution-ShareAlike 4.0 International License

      CC by-sa 4.0

      GAP constitutes another step into the unification of Kivy and Pythonista. However, it greatly simplifies, optimizes and accelerates the task of generating a GUI. Users can produce a complete application with a sophisticated interface in seconds from any device in which Kivy or the Pythonista UI is available. Then they can just concentrate in customizing functionality by modifying the predefined functions bound to the buttons. By allowing them to do so GAP totally abstract these users from the intricacies of the underlying code.

      On a technical point of view GAP further demonstrates the extraordinary affinity between Kivy and the Pythonista UI. This is very fortunate for the roaming programmer which seems to be de rigueur these days. I should mention that Scene was not used in Pythonista neither was Scatter in Kivy. The basic touch event was overridden in both systems and the logic implemented from scratch. This project (yes it seems to have evolved into a real project now) has compelled me to investigate realms of Python that otherwise I would not get into. The need to create conditional classes brought me into the technicalities of the superclass. Although that structure could have provided the mechanism for conditional classes, I found its implementation quite awkward, overcomplicated and definitely beyond the grasp of many potential users of the script. Therefore, I opted for the code to detect the operating environment and accordingly submit a specific type to the classes. GAP uses UniPAGe to build its interface and introduces two new classes. The interesting part is that it uses the first one as a parent of the second when using Kivy while it turns it into a custom UI.View for Pythonista to catch the Touch events. That way it implements the exact same algorithm for manipulating the elements created in the virtual screen.

      I do not use comments while coding, because doing so interferes with my concentration, and rarely add them afterward because it becomes a hassle. I understand that the script has grown way more complex than I expected when I started it. Therefore, if the reader has any question about the implementation or its logic do not hesitate to post it on this thread. I will do my best to address the issue. Below is the full implementation of GAP. You may copy it or retrieve it from Github. If you elect to copy it make sure that your first line of code is the first comment line (The one with a lot of dashes). This is because GAP reads itself under whatever name you save the script so it can isolate the UniPAGe portion to generate the output.

      Edit: The script is way too long to be inserted in this post. Please retrieve it from GitHub here.

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

        @tileyon thanks, nice work.
        I would like a full_screen interface, would you consider adding this option? I can easily modify the code to add it in pythonista, but it wont work in kivy, and the size must be adjusted automatically too. And it seems your license does not allow me to change the code (or?).
        Thanks

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

          @jmv38 why do you think you can't change the code? Read https://creativecommons.org/licenses/by-sa/4.0/

          1 Reply Last reply Reply Quote 1
          • jmv38
            jmv38 last edited by

            @zrzka thanks for correcting my mistake.

            1 Reply Last reply Reply Quote 0
            • Ti Leyon
              Ti Leyon last edited by

              @jmv38 the visual interface designer keeps all the screen elements in a variable called widgets. That variable is always defined in the __main__ section of its output (gapout.py) near the end of the script. widgets is a list of tuples that defines the parameters for the constituents of the interface. The first tuple represents the window size in the form of (width, height). You may change these parameters to whatever number you want and all the subviews will be scaled accordingly. Try to keep a 4/3 ratio between the width and the height to avoid distortion. If you set the tuple to (0, 0) GAP will automatically set the window to an optimal size according to the orientation in which you start the script. By the way you can do the same with GAP itself since it is also based on UniPAGe.

              1 Reply Last reply Reply Quote 0
              • Ti Leyon
                Ti Leyon last edited by

                Major enhancements to the Visual Interface Designer’s interface. Now you can change the sizes of a selected object by dragging on it with the mouse or finger. To do so you have to toggle the newly introduced switch buttons to the on state. This will prevent the component from moving and instead its dimensions will change with the dragging according to which switch is turned on. You can also change the name of the output file directly from GAP. The interfaces of files built with GAP can now be loaded and modified. This is almost "programming for the rest of us". Programming for the non techie on the go. If I can spare the time I will try to write a MIT Scratch like Python script to make it fully so.

                Please use gap21.py to get the new features.

                Below is a screenshot with a description of the new features.

                gapinfo

                Although GAP was developed manually using UniPAGe below is a screenshot of the script reading itself in an Android phone.

                gapinfo

                In a further release I will try to introduce a help screen at the first start up in a specific directory since the space for the three lines instruction is now taken.

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post
                Powered by NodeBB Forums | Contributors