Plugin Extention

Introduction

MoilApp V4.0 is an application with an MVC (Model-View-Controller) architecture design. However, in the current MoilApp V4.1 version, MoilApp has implemented a slightly different MVC model using the Plugin model type. This new model can be used to control other application plugins. For instance, Plugin Model 1 can control Plugins 1, 2, and 3, whereas Plugin Model 2 can only control Plugins 2, 3, and N. Similarly, Plugin Model N can only control Plugins 3 and N. This implementation was done because the plugin concept is independent, and each plugin can have its own specific requirements or models. However, the MoilApp dashboard can still control multiple plugins based on the requirements or models used for a particular application plugin. In this way, MoilApp can provide better flexibility and control to the user while maintaining the overall architecture design. To summarize, MoilApp V4.1 now utilizes a Plugin model type, which allows for better control and flexibility over the various application plugins, while still preserving the overall MVC architecture design.

alternate text

Design the MoilApp plugin architecture

Prerequisites

Before proceeding with this guide, make sure that:

  • You have a basic understanding of Python and PyQt.

  • You have installed the Qt Designer tool.

  • You have installed the PyQt5 library.

  • You have cloned the MoilApp repository from GitHub.

Action Plugin

The MoilApp program includes a plugin notion that is integrated into its design, featuring a menu bar and a button. Containers that are dedicated to managing the plugin application. The interface is depicted in the following illustration:

- Adding a plugin app
To include your own plugin application, access the app's folder from the controller in the plugin and add your app. If your app adheres to the specified format and is successfully added, it will be accessible through the plugin and can be executed.

- Installing the app
You can use the plugin store icon to install the provided application.

- Opening the plugin application
You can open the plugin you have installed by selecting it in the combo box and clicking the Open Plugins button.

- Deleting a plugin app
To remove a plugin application from the MoilApp program, you need to access the plugin controller container and Click on the "Delete" button. This action will prompt a confirmation dialog to ensure that you want to proceed with the deletion.  If you confirm the deletion, the plugin application will be removed from the list of available applications in the combo box.

GitHub Operation

To publish the new application from the local branch to the repository group, the user must first create a fork on their own GitHub account. After that, they can use the MoilApp plugin to create a new application.

Do Fork Repository

Making a note of the name of the repository you wish to share on your GitHub account is the first step. You can click the "Fork" button in the top right corner of the screen once you have arrived at the repository's GitHub page.  The repository will be duplicated in your personal GitHub account as a result.
To make sure that just the main branch of the repository is cloned, it is crucial to select "Copy Main Only." option when creating the fork. The confirmation window that opens when you click the "Fork" button typically has this option.  You may be sure that any alterations or updates you make to the repository will take effect by simply duplicating the main branch.

Forking the Repository

Fork the repository

Do Create New Branch

To avoid conflicts between your changes and the updates made to the original MoilApp repository, it is recommended that You create a new branch under the "develop" branch after cloning the MoilApp repository. This way, you can work on your changes in isolation without affecting the original codebase or interfering with updates to the develop branch in the original repository.

Creating your own branch

Create new branch on your branch

Create Plugin Application

To build an application with an API, you need to create a program that can interact with the API to exchange data and perform functions.  APIs provide protocols and tools that enable different software applications to communicate with each other.

Design User Interface

To develop an application, you start by designing the user interface using Qt Designer. If you don't have this tool, installed on your computer, install it first. Once you have designed the interface, you need to convert the *.ui file to a *.py file, which can be done as follows:

Creating a UI

Create User Interface

Plugin Interface (API)

A plugin interface is an API that connects the main application with the plugin widget. It allows you to create custom user interfaces and use models from the main application without starting from scratch.

Plugin Interface

Plugin Interface (API)

The purpose of this class is to define an interface that can be implemented by plugins in various applications. By default, the description attribute of the object's init method is set to UNKNOWN. These are the methods that concrete subclasses of the Plugin class:

  • Set_plugin_widget: This method should establish a plugin widget based on a Model object that is passed in as input.

  • Set_icon_apps: This method should determine the plugin application’s icon.

  • Change_stylesheet: This method should modify the plugin applications’s CSS.

By default, the always_pop_up method of the Plugin class returns the boolean value False, meaning that the plugin does not always pop up.

How to Add an Icon on MoilApp Plugin

In the code, we import the PluginInterface and define a class MyPlugin that inherits from PluginInterface. We then define the set_icon_apps function, which simply returns the name of the icon file that we want to use. You can replace "my_icon_file.png" with the name of your own icon file.

Adding an icon to Moilapp

Add icon on MoilApp

How to Open Image on User Interface

Import Ui_form so that the Python file that you have converted from *.ui to *.py can be integrated into a Python function such as the class attribute integrated in the Python function below.

To load an Image using Push Botton

Add action push button to load image

Showing on User Interface (Hello World)

Once the program is running, you should be able to interact with the user interface as designed and test its functionality. If any issue or errors arise, you may need to review the code and make adjustments as necessary, as shown in the user interface below.

User Interface Image

Show in user interface

Publish Your Project

Refer to the User Operation section to understand in detail about the repository project.

Push your Project to GitHub

To upload your project, you first need to convert it to "*.zip" format and ensure that it does not contain unwanted files like PyCache, Ideas, etc. The User also executes a few commands in the terminal to complete the uploading process.

git add .
git commit -m "commit your project"
git push -u origin "your branch"

After making the required changes, you can submit a pull request to merge your changes into the original repository. The project management team will review your changes and then decides whether to approve them for merging or request further revisions.

Pushing the project to the repository

Push your project on repository

Tutorial Develop Apps use MoilApp

MoilApp is an open-source software which is designed in a way to develop applications using the Python programming language. It provides a set of tools and libraries that allow developers to create desktop applications with graphical user interface (GUIs) quickly and easily. Here's a tutorial on how to develop application using MoilApp.

Note Information

  • To create your own plugin application, follow the tutorial in section 6.2.

  • A tutorial on how to use MoilApp: https://youtu.be/ExeY8Q6QNf8

  • If you come across any issues or want to contribute to this project, you can raise an issue in GitHub repository and can ask for pull request.