Skip to content

rnk-industries/Chemical-PFD

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Chemical PFD Tool

Repository for a Process Flow Diagram Software

                                     Python version python-mixedCase-style Dependencies License

Screenshots

Main window

Tech/framework used

Built with

Features

  1. Drag and Drop symbols from toolbar to scene
  2. Undo Redo action
  3. Save and Load files
  4. Connect symbols with lines, and add labels
  5. Create stream table
  6. Use various paper sizes
  7. Work on multiple diagrams and file at once
  8. View diagrams side by side
  9. Zoom In/out on the scene

Code overview

src/main/python/main.py

main application entry point, defines the main window and runs it.

src/main/python/shapes

Contains the shape and line definitions and logic.

src/main/python/utils

contains the sub window definitions along with various utility methods.

Installation

clone this repository by running

git clone https://github.com/FOSSEE/Chemical-PFD.git

or by simply pressing the Clone or Download button and using your own preferred way of obtaining a working copy of the repository

requirements can be installed using (PIP should be up-to-date! tested on 20.0.2)

pip install --upgrade pip
pip install -r requirements.txt

Then run using

fbs run

or

python3 build.py run

additionally, if fbs doesnt work, you can manually run the program as

python3 ./src/main/python/main.py

that is run the main.py file located in ./src/main/python/main.py any output generated when run this way would be saved in ./src/main/python/

Building

There are two methods of doing this,

Manually

Compiling the resources

Using pyrcc5, the resource.qrc can be compiled to a python file

pyrcc5 -o src/main/python/resources/resources.py src/main/ui/resources.rcc

Building binaries

Using fbs's freeze feature.

fbs freeze

Releasing

One can now build installer using fbs,

fbs release

note: Windows user will need nsis installed on their system and added to env path. Additionally multiple things might need to be done, follow the onscreen instruction.

Build.py script

Resource compilation and building binaries

can be done, by using build.py build

python3 build.py build

TODO

Adding symbols

The process of adding symbols, is simple.

Obtain svg for symbol

It is necessary that the symbol is in svg format. One can use any of the many svg tools out there. We recommend Inkscape

Preparing class entries

Class definition

Under src/main/python/shapes/shape.py, using the following as an example, one can create his own class definition for the symbol. The grip list is the percentage position of the grip item object along with the parent's width and height, the third value is its position and the fourth value if specified is the width/height if the grip is a line grip item.

class HorizontalVessel(NodeItem):
    def __init__(self):
        super(HorizontalVessel, self).__init__("svg/Process Vessels/Horizontal Vessel")
        self.grips = [
            [50, 100, "top", 87.08554680344],
            [0, 50, "left"],
            [100, 50, "right"],
            [50, 0, "bottom", 87.08554680344]
        ]

Items.json Entry

The items.json is present in src/main/resources/base/config/items.json Once the class name and category has been decided, an items.json entry can be configured as follows,

{
    "Process Vessels": {
        "Horizontal Vessel": {
            "name": "Horizontal Vessel",
            "icon": ".\\Process Vessels\\Horizontal Vessel.png",
            "class": "Process Vessels",
            "object": "HorizontalVessel",
            "args": []
        },
    }
}

Toolbar icon

A 64x64 toolbar icon as a png needs to be prepared to be shown in the toolbar. It needs to be placed in src/main/resources/base/toolbar/ in the corresponding folder in the json file.

Automating

Most of the above process can be automated, following are a few procedures one can use

Python Script(For making icons and items.json entries for multiple svgs)

You can find the script here

Using the symbol generator (For class + items.json)

You can launch the tool while running the app, by clicking Add new Symbols in the edit menu. Or by directly launching the edit symbol menu using build.py

python3 build.py symbolGen

API Reference

The QtForPython docs were used to implement the program, one can reference them here

  • QtForPython The docs for Qt for C++ library can be found here
  • Qt

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%