Skip to content

Design Code Iteration

Alejandro Autalán edited this page Mar 31, 2022 · 7 revisions

Overview

Rapid Application Development, RAD, is an iterative approach to software development intended for applications with Graphical User Interface, a GUI. Notice in the diagram that UserDesign and Construction overlap; the pygubu-designer fills that gap. The first step to starting a new version of an application is to redo Requirements Planning.

RADModel

Sourced from the RAD page link above.

There are many other software development processes, where pygubu-designer can be helpful, so don't hesitate to try it.

Design-Code Iteration

Many times, your designer and programmer will collaborate to satisfy another requirement. Despite what you see in some examples, please do not edit the *.py file generated by pyguby-designer because it will get overwritten. The programmer should use inheritance to prevent the designer from overwriting custom code.

myappbase.py, generated code from pygubu-designer:

#!/usr/bin/python3
import pathlib
import pygubu

PROJECT_PATH = pathlib.Path(__file__).parent
PROJECT_UI = PROJECT_PATH / "myapp.ui"


class MyappBase:
    def __init__(self, master=None):
        self.builder = builder = pygubu.Builder()
        builder.add_resource_path(PROJECT_PATH)
        builder.add_from_file(PROJECT_UI)
        self.mainwindow = builder.get_object("mainwindow", master)
        builder.connect_callbacks(self)

    def run(self):
        self.mainwindow.mainloop()

    def on_action1_clicked(self):
        pass


if __name__ == "__main__":
    app = MyappBase()
    app.run()

myapp.py, custom code from the programmer:

#!/usr/bin/python3
from myappbase import MyappBase

class Myapp(MyappBase):

    def on_action1_clicked(self):
        # Write your code here.
        print('Button action 1 clicked.')


if __name__ == "__main__":
    app = Myapp()
    app.run()
Clone this wiki locally