Skip to content

WilliamBonilla62/GUIPythonEncodeur

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GUIPythonEncodeur

This project is a graphical user interface (GUI) to automate the control of the encoder.

This GUI was developped with Python3 and Qt5.


Table of content

1-Installation procedure

Before starting this procedure make sure the you have installed the lib_global_python and have read the readme file of this repo.

1.1-Get the code

To install the software on raspbian virtual Desktop:

  • open terminal with Ctrl+Alt+T
  • go in the local folder where you want to install
cd /PATH

example of PATH /home/pi/Documents

git clone https://github.com/WilliamBonilla62/GUIPythonEncodeur.git --recursive

the --recursive command is important it makes a direct link between the repo and all the submodules inside. If you don't put the command or download the file directly all the submodules will be empty.

Also if you want to be sure to have the last version of the submodule use this command:

git submodule update --remote --recursive
git branch -a
git checkout -b Rasp-Dev-Final origin/Rasp-Dev-Final

1.2-Libraries

1.2.1-Needed Libraries

  • library pyqt5

1.2.2-Install Libraries

library phidget installation

Open a terminal write down these two command :

sudo apt-get install python3-pyqt5
sudo apt-get install python3-pyqt5.qtsql
pip3 pysintaller

1.3-Software

1.3.1-Needed Software

  • Qt5 assitant
  • Qt5 Designer
  • Qt5 Linguist

1.3.2-Install Software

Open a terminal write down this :

sudo apt-get install qttools5-dev-tools

1.4-Modify the Graphical User Interface

1.4.1-Qt Design

Open the file with Qt5 Designer Encoder_Control_GUI.ui in the submodule GUI_QT_ONLY inside the QT folder. Do the modification needed and save the file.

1.4.2-Translate .UI to .PY

Before converting your .ui into .py be sure to save your old .py. Use this command to be able to copy-paste your old gui (Encoder_Control_GUI.py) in a copy named CodeForFunctions.py.

cp Encoder_Control_GUI.py CodeForFunctions.py

Now all the functions of the old GUI will be saved in CodeForFunctions.py and you will have to add them to the new GUI.

Then copy the Encoder_Control_GUI.ui inside the /GUI directory and then proceed to the convertion.

To convert a .ui to a .py you will to run this command:

pyuic5 -x Encoder_Control_GUI.ui -o Encoder_Control_GUI.py

By converting the .ui into a .py you are now able to add code (functions) to the GUI you have designed/modified.

1.5-Modify the software

This section talks about on how modify the code and the good procedures.

1.5.1-Functions with or without arguments

When you add function to the code it is important to link it with a possible action for the user.

Here is a link that explains the basics between functions and object on the GUI. Tutorial: Buttons with functions

If your new funtion or your newly modified functions

1.5.2-Computer to Raspberry PI

When you develop the code on a computer be sure to test it on Raspberry PI.

1.6-Troubleshooting

This section talks about some know problem with their solution.

1.6.2-Empty submodule

Even though you did the the right git command sometimes the submodule is empty. This problem can be easily solve.

Go to the repo/file of the submodule. Open a terminal there with the command Ctrl+Alt+T.
Then run :

git checkout main
git pull
ls

This way will be able to verify if the repo/file is still empty.

1.6.2-libEGL warning

If you see this warning :

libEGL warning: DRI2: failed to authenticate

Please run these commands:

sudo raspi-config

Then pick :

Advanced Options
GL Driver
GL (Fake KMS)

1.6.3-Consider adding this directory to PATH

After running the pip3 you might this warning :

WARNING: The script pysintaller is installed in /home/pi/.local/bin which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.

Simply run this command to add the directory to path:

echo "export PATH=\"/home/pi/.local/bin:\$PATH\"" >> ~/.bashrc && source ~/.bashrc

1.7-Create Desktop App

This section is about creating or modifying a desktop app for the GUI.

First, verify the first line of the code is:

##!/usr/bin/env python3

If it is add it.

Then,open a terminal in the folder that contains the GUI code with Ctrl+Alt+T.
Run the following command :

chmod +x  Encoder_Control_GUI.py ./Encoder_Control_GUI.py

Now you should be able to run the file with the command

./Encoder_Control_GUI.py

Instead of :

python3 Encoder_Control_GUI.py

Now go to your desktop and create a file with the extension .desktop.

Exemple : Gui.desktop

Open the file with a text editor and write the folling lines:

[Desktop Entry]
Version=1.0
Exec=/PathToGui/Encoder_Control_GUI.py
Icon=/PathtoIcon/Cirris.jpeg
Type=Application

Save the changes and close the text editor.

Now you can run by double clicking the Gui.desktop file.

Here is link to a tutorial. Tutorial: Make a Python Program Executable in Linux

1.8-Create an executable

Open a terminal in the GUI directory.

pyinstaller -F Encoder_Control_GUI.py

Now you show see a new directory named dist.

A file Encoder_Control_GUI.exe will be inside.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages