Joe SDK

DOWNLOAD
Hello, world. I'm Vinit Jogani, the creator of the Joe SDK, and I'm going to quickly brief you to the Joe SDK, and what you can do with it. Joe SDK is the next big thing in the world of HTML and Python. It is an easy to learn and adapt python software development kit for building excellent GUI desktop applications. You can create a desktop application using python, html, css, javascript or jquery in minutes! Although it is a desktop application sdk, it is web hosted locally. This makes it extremely easy to deploy an application made with the SDK to a web server. The SDK allows you to: - Run pure python code, on any javascript event. - Render result of python function dynamically. - Create HTML User interfaces, using standard HTML, CSS, and Javascript! The SDK is powered by: - Google Chrome apps - Cherrypy Web Framework The target audience for this framework are beginner Python developers for whom the available Python GUI frameworks are tedious and difficult to learn. Python GUI Frameworks basically require long lines of code. This is the primary reason why most of the Python apps are limited to server applications or consoles and do not include very dynamic and interactive GUI. However, the HyperText Markup Language, is very easy and suitable for designing good interfaces and forms quickly! How it works: The way the SDK works, is a very interesting topic. The launcher.pyw file runs the server.pyc file that starts a CherryPy server (for more information about cherrypy, you can go to the CherryPy website). All html files are loaded onto the server. The server also imports all code files from the pycode directory. The server contains two main pages: runpy and execute. The runpy function takes an argument called code, which is the python code that needs to be executed on the server. The execute page takes in two parameters: fid and args. The fid is the function name that you want to be executed, and the args are any arguments you need to supply to the function. The execute page finds the function name from all the python files in the pycode directory and executes it. The sdk.js file is a jquery script which sends GET requests to the server's pages, to execute functions. This acts as a link between the Python code and the HTML code. To add a new page, simply create an html page in the root directory. Then create a new python file, or open an existing one, in the pycode folder and define a method 'main' that taks in an argument 'tools'. The main function will be executed on server start. The tools object is an instance of the ServerTools class in the Joe SDK. The ServerTools class contains a few static methods: - addPage(page_name, page_function) -> adds a page dynamically - url() -> returns the request url - Session(key) -> returns the session value corresponding to the key - Session(key, value) -> changes session value for the key That's it! Any html code in index.html will now be displayed when you run the launcher! The server launches the chrome app module to display the localhost url. Note that the port is written in the port.txt file in the root directory. The server code checks for all open ports and runs it. How to add a new page: to add a new page, you must define another function, that takes atleast one argument - self. The cherrypy framework has an inbuilt support to POST and GET requests, so you can add more parameters needed and supply them from HTML forms or GET requests. Your final code in the Python code file should look like:
            def index(self):
                return file("index.html") #The HTML file that needs to be added. The path is relative to the root directory.
            
            def main(tools):
                tools.addPage('index', index)
            
To get parameters from query string or post requests, you can define a page like this:
            def echo(self, text):
                return "<span>" + text + "</span>" #You can add HTML code directly too!
                
            def index(self):
                return file("index.html") #The HTML file that needs to be added. The path is relative to the root directory.
            
            def main(tools):
                tools.addPage('index', index) #You can add multiple pages too!
                tools.addPage('print', echo) #Page name and the name of the function do not need to be the same
                tools.addPage('echo', echo) #A single page function can be mapped to two urls too!