From b7f0413b82f6818877e4e04182428d45e12b4e89 Mon Sep 17 00:00:00 2001 From: 266-750Balloons <79549730+266-750Balloons@users.noreply.github.com> Date: Sun, 15 Sep 2024 01:15:36 -0700 Subject: [PATCH 01/14] Update readme.md --- readme.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/readme.md b/readme.md index ab42c77..00ca2fc 100644 --- a/readme.md +++ b/readme.md @@ -1,4 +1,13 @@ # Rocket Engine GUI +This branch has the goal of creating an easy executable installer for the liquid_engine_gui. + +## TODO + +- [ ] Change directory structure to conventional Python3 module +- [ ] Create pysetup.toml +- [ ] Remove sdec submodule and update documentation saying that sdec is installed with pip. +- [ ] Setup packaging (perhaps through something as simple as pyinstall to make one EXE, but it could also be an installer that 1. sets up a Python environment, 2. installs SDR software, 3. Installs a .BAT that executes our applications with the installed Python) + ## Getting Started 1) Open cmd / terminal 2) Navigate into the project folder From d38ba44d6d02c1682c811ee23ecef815141e59e6 Mon Sep 17 00:00:00 2001 From: Dexx Stexx Date: Sun, 15 Sep 2024 23:16:51 -0700 Subject: [PATCH 02/14] Restructure directory to work as Python module and make minimum changes for it to still work --- .gitmodules | 3 -- .../Arduino}/serialtest/serialtest.ino | 0 {test => Extras/test}/DAQexperimental.zip | Bin .../test}/DAQexperimental/.DS_Store | Bin .../test}/DAQexperimental/AvTest.py | 0 .../test}/DAQexperimental/DAQexperimental.ino | 0 .../test}/DAQexperimental/DataGUI.py | 0 .../test}/DAQexperimental/Gauge.py | 0 .../test}/DAQexperimental/Gauge.pyc | Bin .../test}/DAQexperimental/SDRlogo5.ico | Bin .../test}/DAQexperimental/Servo.py | 0 .../test}/DAQexperimental/VTC/results.png | Bin .../test}/DAQexperimental/VTC/spice_sim.csv | 0 .../test}/DAQexperimental/VTC/vtc.py | 0 .../test}/DAQexperimental/arduinoCom.py | 0 .../test}/DAQexperimental/convertDAQ.py | 0 .../data/injector_test_700psi.txt | 0 .../test}/DAQexperimental/debug.py | 0 .../test/DAQexperimental/images}/SDRLogo5.png | Bin .../DAQexperimental/images}/SDRlogont2.png | Bin .../test}/DAQexperimental/orificeCalData.txt | 0 main.py => liquid_engine_gui/__main__.py | 28 +++++++++--------- buttons.py => liquid_engine_gui/buttons.py | 0 .../engine_display.py | 20 ++++++------- gauge.py => liquid_engine_gui/gauge.py | 0 .../images/SDRLogo5.png | Bin .../images/SDRlogont2.png | Bin .../images}/engine_gui.png | Bin .../images}/engine_gui_2023.png | Bin {images => liquid_engine_gui/images}/gui.png | Bin .../plumbing}/ball_valve.py | 2 +- .../plumbing}/component_template.py | 0 .../plumbing}/nozzle.py | 2 +- .../plumbing}/orifice.py | 2 +- .../plumbing}/pipe.py | 2 +- .../plumbing}/pressure_sensor.py | 2 +- .../plumbing}/solenoid.py | 2 +- .../plumbing}/tank.py | 2 +- .../plumbing}/temp_sensor.py | 2 +- sensor.py => liquid_engine_gui/sensor.py | 2 +- sequence.py => liquid_engine_gui/sequence.py | 4 +-- valve.py => liquid_engine_gui/valve.py | 2 +- sdec | 1 - 43 files changed, 36 insertions(+), 40 deletions(-) delete mode 100644 .gitmodules rename {Arduino => Extras/Arduino}/serialtest/serialtest.ino (100%) rename {test => Extras/test}/DAQexperimental.zip (100%) rename {test => Extras/test}/DAQexperimental/.DS_Store (100%) rename {test => Extras/test}/DAQexperimental/AvTest.py (100%) rename {test => Extras/test}/DAQexperimental/DAQexperimental.ino (100%) rename {test => Extras/test}/DAQexperimental/DataGUI.py (100%) rename {test => Extras/test}/DAQexperimental/Gauge.py (100%) rename {test => Extras/test}/DAQexperimental/Gauge.pyc (100%) rename {test => Extras/test}/DAQexperimental/SDRlogo5.ico (100%) rename {test => Extras/test}/DAQexperimental/Servo.py (100%) rename {test => Extras/test}/DAQexperimental/VTC/results.png (100%) rename {test => Extras/test}/DAQexperimental/VTC/spice_sim.csv (100%) rename {test => Extras/test}/DAQexperimental/VTC/vtc.py (100%) rename {test => Extras/test}/DAQexperimental/arduinoCom.py (100%) rename {test => Extras/test}/DAQexperimental/convertDAQ.py (100%) rename {test => Extras/test}/DAQexperimental/data/injector_test_700psi.txt (100%) rename {test => Extras/test}/DAQexperimental/debug.py (100%) rename {images => Extras/test/DAQexperimental/images}/SDRLogo5.png (100%) rename {images => Extras/test/DAQexperimental/images}/SDRlogont2.png (100%) rename {test => Extras/test}/DAQexperimental/orificeCalData.txt (100%) rename main.py => liquid_engine_gui/__main__.py (99%) rename buttons.py => liquid_engine_gui/buttons.py (100%) rename engine_display.py => liquid_engine_gui/engine_display.py (97%) rename gauge.py => liquid_engine_gui/gauge.py (100%) rename {test/DAQexperimental => liquid_engine_gui}/images/SDRLogo5.png (100%) rename {test/DAQexperimental => liquid_engine_gui}/images/SDRlogont2.png (100%) rename {images => liquid_engine_gui/images}/engine_gui.png (100%) rename {images => liquid_engine_gui/images}/engine_gui_2023.png (100%) rename {images => liquid_engine_gui/images}/gui.png (100%) rename {plumbing => liquid_engine_gui/plumbing}/ball_valve.py (97%) rename {plumbing => liquid_engine_gui/plumbing}/component_template.py (100%) rename {plumbing => liquid_engine_gui/plumbing}/nozzle.py (97%) rename {plumbing => liquid_engine_gui/plumbing}/orifice.py (98%) rename {plumbing => liquid_engine_gui/plumbing}/pipe.py (99%) rename {plumbing => liquid_engine_gui/plumbing}/pressure_sensor.py (98%) rename {plumbing => liquid_engine_gui/plumbing}/solenoid.py (98%) rename {plumbing => liquid_engine_gui/plumbing}/tank.py (98%) rename {plumbing => liquid_engine_gui/plumbing}/temp_sensor.py (97%) rename sensor.py => liquid_engine_gui/sensor.py (98%) rename sequence.py => liquid_engine_gui/sequence.py (99%) rename valve.py => liquid_engine_gui/valve.py (99%) delete mode 160000 sdec diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 9c14e78..0000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "sdec"] - path = sdec - url = git@github.com:SunDevilRocketry/sdec.git diff --git a/Arduino/serialtest/serialtest.ino b/Extras/Arduino/serialtest/serialtest.ino similarity index 100% rename from Arduino/serialtest/serialtest.ino rename to Extras/Arduino/serialtest/serialtest.ino diff --git a/test/DAQexperimental.zip b/Extras/test/DAQexperimental.zip similarity index 100% rename from test/DAQexperimental.zip rename to Extras/test/DAQexperimental.zip diff --git a/test/DAQexperimental/.DS_Store b/Extras/test/DAQexperimental/.DS_Store similarity index 100% rename from test/DAQexperimental/.DS_Store rename to Extras/test/DAQexperimental/.DS_Store diff --git a/test/DAQexperimental/AvTest.py b/Extras/test/DAQexperimental/AvTest.py similarity index 100% rename from test/DAQexperimental/AvTest.py rename to Extras/test/DAQexperimental/AvTest.py diff --git a/test/DAQexperimental/DAQexperimental.ino b/Extras/test/DAQexperimental/DAQexperimental.ino similarity index 100% rename from test/DAQexperimental/DAQexperimental.ino rename to Extras/test/DAQexperimental/DAQexperimental.ino diff --git a/test/DAQexperimental/DataGUI.py b/Extras/test/DAQexperimental/DataGUI.py similarity index 100% rename from test/DAQexperimental/DataGUI.py rename to Extras/test/DAQexperimental/DataGUI.py diff --git a/test/DAQexperimental/Gauge.py b/Extras/test/DAQexperimental/Gauge.py similarity index 100% rename from test/DAQexperimental/Gauge.py rename to Extras/test/DAQexperimental/Gauge.py diff --git a/test/DAQexperimental/Gauge.pyc b/Extras/test/DAQexperimental/Gauge.pyc similarity index 100% rename from test/DAQexperimental/Gauge.pyc rename to Extras/test/DAQexperimental/Gauge.pyc diff --git a/test/DAQexperimental/SDRlogo5.ico b/Extras/test/DAQexperimental/SDRlogo5.ico similarity index 100% rename from test/DAQexperimental/SDRlogo5.ico rename to Extras/test/DAQexperimental/SDRlogo5.ico diff --git a/test/DAQexperimental/Servo.py b/Extras/test/DAQexperimental/Servo.py similarity index 100% rename from test/DAQexperimental/Servo.py rename to Extras/test/DAQexperimental/Servo.py diff --git a/test/DAQexperimental/VTC/results.png b/Extras/test/DAQexperimental/VTC/results.png similarity index 100% rename from test/DAQexperimental/VTC/results.png rename to Extras/test/DAQexperimental/VTC/results.png diff --git a/test/DAQexperimental/VTC/spice_sim.csv b/Extras/test/DAQexperimental/VTC/spice_sim.csv similarity index 100% rename from test/DAQexperimental/VTC/spice_sim.csv rename to Extras/test/DAQexperimental/VTC/spice_sim.csv diff --git a/test/DAQexperimental/VTC/vtc.py b/Extras/test/DAQexperimental/VTC/vtc.py similarity index 100% rename from test/DAQexperimental/VTC/vtc.py rename to Extras/test/DAQexperimental/VTC/vtc.py diff --git a/test/DAQexperimental/arduinoCom.py b/Extras/test/DAQexperimental/arduinoCom.py similarity index 100% rename from test/DAQexperimental/arduinoCom.py rename to Extras/test/DAQexperimental/arduinoCom.py diff --git a/test/DAQexperimental/convertDAQ.py b/Extras/test/DAQexperimental/convertDAQ.py similarity index 100% rename from test/DAQexperimental/convertDAQ.py rename to Extras/test/DAQexperimental/convertDAQ.py diff --git a/test/DAQexperimental/data/injector_test_700psi.txt b/Extras/test/DAQexperimental/data/injector_test_700psi.txt similarity index 100% rename from test/DAQexperimental/data/injector_test_700psi.txt rename to Extras/test/DAQexperimental/data/injector_test_700psi.txt diff --git a/test/DAQexperimental/debug.py b/Extras/test/DAQexperimental/debug.py similarity index 100% rename from test/DAQexperimental/debug.py rename to Extras/test/DAQexperimental/debug.py diff --git a/images/SDRLogo5.png b/Extras/test/DAQexperimental/images/SDRLogo5.png similarity index 100% rename from images/SDRLogo5.png rename to Extras/test/DAQexperimental/images/SDRLogo5.png diff --git a/images/SDRlogont2.png b/Extras/test/DAQexperimental/images/SDRlogont2.png similarity index 100% rename from images/SDRlogont2.png rename to Extras/test/DAQexperimental/images/SDRlogont2.png diff --git a/test/DAQexperimental/orificeCalData.txt b/Extras/test/DAQexperimental/orificeCalData.txt similarity index 100% rename from test/DAQexperimental/orificeCalData.txt rename to Extras/test/DAQexperimental/orificeCalData.txt diff --git a/main.py b/liquid_engine_gui/__main__.py similarity index 99% rename from main.py rename to liquid_engine_gui/__main__.py index 3f950bb..17409cb 100644 --- a/main.py +++ b/liquid_engine_gui/__main__.py @@ -33,6 +33,7 @@ import sys import datetime import math +from importlib.resources import files # Serial (USB) import serial @@ -54,20 +55,17 @@ sys.path.insert(0, './sdec') # Imports -import solenoid -import gauge as SDR_gauge -import valve as SDR_valve -import engine_display as SDR_engine_display -import sequence as SDR_sequence -import buttons as SDR_buttons -import sensor as SDR_sensor +from liquid_engine_gui.plumbing import solenoid +from liquid_engine_gui import gauge as SDR_gauge +from liquid_engine_gui import valve as SDR_valve +from liquid_engine_gui import engine_display as SDR_engine_display +from liquid_engine_gui import sequence as SDR_sequence +from liquid_engine_gui import buttons as SDR_buttons +from liquid_engine_gui import sensor as SDR_sensor # SDEC -import sdec -import commands -import hw_commands -import sensor_conv -import engineController +import sdec.__main__ as sdec +from sdec import commands, hw_commands, sensor_conv, engineController #################################################################################### @@ -514,8 +512,10 @@ def update_valve_states( valve_states ): ) # Program icon - SDRlogo = tk.PhotoImage(file='images/SDRLogo5.png') - SDRImage = Image.open("images/SDRlogont2.png") + # SDRlogo = tk.PhotoImage(file='images/SDRLogo5.png') + # SDRImage = Image.open("images/SDRlogont2.png") + SDRlogo = tk.PhotoImage(files("liquid_engine_gui").joinpath("images").joinpath("SDRLogo5.png")) + SDRImage = Image.open(files("liquid_engine_gui").joinpath("images").joinpath("SDRlogont2.png")) SDRImage = SDRImage.resize( (int(0.8*140),int(0.8*125)), Image.Resampling.LANCZOS diff --git a/buttons.py b/liquid_engine_gui/buttons.py similarity index 100% rename from buttons.py rename to liquid_engine_gui/buttons.py diff --git a/engine_display.py b/liquid_engine_gui/engine_display.py similarity index 97% rename from engine_display.py rename to liquid_engine_gui/engine_display.py index 670da66..2ca3f85 100644 --- a/engine_display.py +++ b/liquid_engine_gui/engine_display.py @@ -19,16 +19,16 @@ ############################################################### # Project Modules # ############################################################### -import component_template -import solenoid as SDR_solenoid -import ball_valve as SDR_ball_valve -import orifice as SDR_orifice -import pressure_sensor as SDR_pressure_sensor -import temp_sensor as SDR_temp_sensor -import tank as SDR_tank -import pipe as SDR_pipe -import nozzle as SDR_nozzle -import main +from liquid_engine_gui.plumbing import component_template +from liquid_engine_gui.plumbing import solenoid as SDR_solenoid +from liquid_engine_gui.plumbing import ball_valve as SDR_ball_valve +from liquid_engine_gui.plumbing import orifice as SDR_orifice +from liquid_engine_gui.plumbing import pressure_sensor as SDR_pressure_sensor +from liquid_engine_gui.plumbing import temp_sensor as SDR_temp_sensor +from liquid_engine_gui.plumbing import tank as SDR_tank +from liquid_engine_gui.plumbing import pipe as SDR_pipe +from liquid_engine_gui.plumbing import nozzle as SDR_nozzle +# import main ############################################################### diff --git a/gauge.py b/liquid_engine_gui/gauge.py similarity index 100% rename from gauge.py rename to liquid_engine_gui/gauge.py diff --git a/test/DAQexperimental/images/SDRLogo5.png b/liquid_engine_gui/images/SDRLogo5.png similarity index 100% rename from test/DAQexperimental/images/SDRLogo5.png rename to liquid_engine_gui/images/SDRLogo5.png diff --git a/test/DAQexperimental/images/SDRlogont2.png b/liquid_engine_gui/images/SDRlogont2.png similarity index 100% rename from test/DAQexperimental/images/SDRlogont2.png rename to liquid_engine_gui/images/SDRlogont2.png diff --git a/images/engine_gui.png b/liquid_engine_gui/images/engine_gui.png similarity index 100% rename from images/engine_gui.png rename to liquid_engine_gui/images/engine_gui.png diff --git a/images/engine_gui_2023.png b/liquid_engine_gui/images/engine_gui_2023.png similarity index 100% rename from images/engine_gui_2023.png rename to liquid_engine_gui/images/engine_gui_2023.png diff --git a/images/gui.png b/liquid_engine_gui/images/gui.png similarity index 100% rename from images/gui.png rename to liquid_engine_gui/images/gui.png diff --git a/plumbing/ball_valve.py b/liquid_engine_gui/plumbing/ball_valve.py similarity index 97% rename from plumbing/ball_valve.py rename to liquid_engine_gui/plumbing/ball_valve.py index e08ec0c..eeaa961 100644 --- a/plumbing/ball_valve.py +++ b/liquid_engine_gui/plumbing/ball_valve.py @@ -12,7 +12,7 @@ ############################################################### # Standard Imports # ############################################################### -import component_template as SDR_component_template +from liquid_engine_gui.plumbing import component_template as SDR_component_template class Ball_Valve(SDR_component_template.Component): diff --git a/plumbing/component_template.py b/liquid_engine_gui/plumbing/component_template.py similarity index 100% rename from plumbing/component_template.py rename to liquid_engine_gui/plumbing/component_template.py diff --git a/plumbing/nozzle.py b/liquid_engine_gui/plumbing/nozzle.py similarity index 97% rename from plumbing/nozzle.py rename to liquid_engine_gui/plumbing/nozzle.py index bc99d78..1d4bdcc 100644 --- a/plumbing/nozzle.py +++ b/liquid_engine_gui/plumbing/nozzle.py @@ -18,7 +18,7 @@ ############################################################### # Project Imports # ############################################################### -import component_template as SDR_component_template +from liquid_engine_gui.plumbing import component_template as SDR_component_template class Nozzle: diff --git a/plumbing/orifice.py b/liquid_engine_gui/plumbing/orifice.py similarity index 98% rename from plumbing/orifice.py rename to liquid_engine_gui/plumbing/orifice.py index 71e694a..264173d 100644 --- a/plumbing/orifice.py +++ b/liquid_engine_gui/plumbing/orifice.py @@ -12,7 +12,7 @@ ############################################################### # Standard Imports # ############################################################### -import component_template as SDR_component_template +from liquid_engine_gui.plumbing import component_template as SDR_component_template class Orifice(SDR_component_template.Component): diff --git a/plumbing/pipe.py b/liquid_engine_gui/plumbing/pipe.py similarity index 99% rename from plumbing/pipe.py rename to liquid_engine_gui/plumbing/pipe.py index ba7a77e..956184c 100644 --- a/plumbing/pipe.py +++ b/liquid_engine_gui/plumbing/pipe.py @@ -18,7 +18,7 @@ ############################################################### # Project Imports # ############################################################### -import component_template as SDR_component_template +from liquid_engine_gui.plumbing import component_template as SDR_component_template ############################################################### diff --git a/plumbing/pressure_sensor.py b/liquid_engine_gui/plumbing/pressure_sensor.py similarity index 98% rename from plumbing/pressure_sensor.py rename to liquid_engine_gui/plumbing/pressure_sensor.py index c6b0e9d..789ad29 100644 --- a/plumbing/pressure_sensor.py +++ b/liquid_engine_gui/plumbing/pressure_sensor.py @@ -13,7 +13,7 @@ ############################################################### # Standard Imports # ############################################################### -import component_template as SDR_component_template +from liquid_engine_gui.plumbing import component_template as SDR_component_template class PressureSensor(SDR_component_template.Component): diff --git a/plumbing/solenoid.py b/liquid_engine_gui/plumbing/solenoid.py similarity index 98% rename from plumbing/solenoid.py rename to liquid_engine_gui/plumbing/solenoid.py index 83f3e19..cad24cd 100644 --- a/plumbing/solenoid.py +++ b/liquid_engine_gui/plumbing/solenoid.py @@ -12,7 +12,7 @@ ############################################################### # Project Imports # ############################################################### -import component_template as SDR_component_template +from liquid_engine_gui.plumbing import component_template as SDR_component_template class Solenoid(SDR_component_template.Component): diff --git a/plumbing/tank.py b/liquid_engine_gui/plumbing/tank.py similarity index 98% rename from plumbing/tank.py rename to liquid_engine_gui/plumbing/tank.py index 5198e5d..646305d 100644 --- a/plumbing/tank.py +++ b/liquid_engine_gui/plumbing/tank.py @@ -18,7 +18,7 @@ ############################################################### # Project Imports # ############################################################### -import component_template as SDR_component_template +from liquid_engine_gui.plumbing import component_template as SDR_component_template class Tank: diff --git a/plumbing/temp_sensor.py b/liquid_engine_gui/plumbing/temp_sensor.py similarity index 97% rename from plumbing/temp_sensor.py rename to liquid_engine_gui/plumbing/temp_sensor.py index 8c35337..16d95a8 100644 --- a/plumbing/temp_sensor.py +++ b/liquid_engine_gui/plumbing/temp_sensor.py @@ -13,7 +13,7 @@ ############################################################### # Standard Imports # ############################################################### -import component_template as SDR_component_template +from liquid_engine_gui.plumbing import component_template as SDR_component_template class TempSensor(SDR_component_template.Component): diff --git a/sensor.py b/liquid_engine_gui/sensor.py similarity index 98% rename from sensor.py rename to liquid_engine_gui/sensor.py index cc5cdae..2474f88 100644 --- a/sensor.py +++ b/liquid_engine_gui/sensor.py @@ -12,7 +12,7 @@ #################################################################################### # Imports # #################################################################################### -import controller as SDR_controller +from sdec import controller as SDR_controller #################################################################################### diff --git a/sequence.py b/liquid_engine_gui/sequence.py similarity index 99% rename from sequence.py rename to liquid_engine_gui/sequence.py index f09b1d1..5de12d5 100644 --- a/sequence.py +++ b/liquid_engine_gui/sequence.py @@ -19,8 +19,8 @@ #################################################################################### # Project Imports # #################################################################################### -import engineController -import valveController +from sdec import engineController +from sdec import valveController #################################################################################### diff --git a/valve.py b/liquid_engine_gui/valve.py similarity index 99% rename from valve.py rename to liquid_engine_gui/valve.py index 82225ba..3096836 100644 --- a/valve.py +++ b/liquid_engine_gui/valve.py @@ -19,7 +19,7 @@ #################################################################################### # Project Imports # #################################################################################### -import buttons as SDR_buttons +from liquid_engine_gui import buttons as SDR_buttons #################################################################################### diff --git a/sdec b/sdec deleted file mode 160000 index 636abd2..0000000 --- a/sdec +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 636abd2a49019b63bff8d5e5417e6ea5997dceee From b2d10aee4edd2cc410f1f6803ab8ecb424afee1e Mon Sep 17 00:00:00 2001 From: Dexx Stexx Date: Sun, 15 Sep 2024 23:24:01 -0700 Subject: [PATCH 03/14] Update README checklist and docs --- readme.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/readme.md b/readme.md index 00ca2fc..71ac201 100644 --- a/readme.md +++ b/readme.md @@ -3,11 +3,18 @@ This branch has the goal of creating an easy executable installer for the liquid ## TODO -- [ ] Change directory structure to conventional Python3 module +- [x] Change directory structure to conventional Python3 module - [ ] Create pysetup.toml -- [ ] Remove sdec submodule and update documentation saying that sdec is installed with pip. +- [x] Remove sdec submodule and update documentation saying that sdec is installed with pip. - [ ] Setup packaging (perhaps through something as simple as pyinstall to make one EXE, but it could also be an installer that 1. sets up a Python environment, 2. installs SDR software, 3. Installs a .BAT that executes our applications with the installed Python) +## Packing Project getting started +1) Navigate into project folder. +2) Install dependencies, which are Pillow and sdec (technically there are others, but they're all required by sdec as well). ```pip3 install pillow git+https://github.com/SunDevilRocketry/sdec``` +3) Run the GUI with the following command: ```python3 -m liquid_engine_gui``` + +## NOTE: The docs below are very out of date and need updating. + ## Getting Started 1) Open cmd / terminal 2) Navigate into the project folder From 0b0362bf3fe5aedd2f41ba1c883e267440fd2e17 Mon Sep 17 00:00:00 2001 From: Drew Date: Mon, 16 Sep 2024 00:33:03 -0700 Subject: [PATCH 04/14] Add pyproject.toml --- .gitignore | 3 +++ liquid_engine_gui/__init__.py | 0 pyproject.toml | 24 ++++++++++++++++++++++++ readme.md | 2 +- 4 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 liquid_engine_gui/__init__.py create mode 100644 pyproject.toml diff --git a/.gitignore b/.gitignore index 772c9f5..e85edb4 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,6 @@ test/DAQexperimental/__pycache__ # Output data output/* + +build/* +liquid_engine_gui.egg-info \ No newline at end of file diff --git a/liquid_engine_gui/__init__.py b/liquid_engine_gui/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..86af95b --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,24 @@ +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" + +[tool.setuptools.packages] +find = {where=["."], include=["liquid_engine_gui*"], exclude = ["Extras"]} + +[tool.setuptools.package-data] +liquid_engine_gui = ["images/*"] + +[project] +name = "liquid_engine_gui" +authors = [ + {name = "Nitish Chennoju"}, + {name = "Ian Chandra"}, + {name = "Colton Acosta"}, + {name = "Nick Nguyen"} +] +version = "2024.9+packagingdev" +dependencies = [ + "pillow", + "sdec@git+https://github.com/SunDevilRocketry/sdec@pip-packaging" +] +readme = "readme.md" \ No newline at end of file diff --git a/readme.md b/readme.md index 71ac201..5f01991 100644 --- a/readme.md +++ b/readme.md @@ -4,7 +4,7 @@ This branch has the goal of creating an easy executable installer for the liquid ## TODO - [x] Change directory structure to conventional Python3 module -- [ ] Create pysetup.toml +- [x] Create pysetup.toml - [x] Remove sdec submodule and update documentation saying that sdec is installed with pip. - [ ] Setup packaging (perhaps through something as simple as pyinstall to make one EXE, but it could also be an installer that 1. sets up a Python environment, 2. installs SDR software, 3. Installs a .BAT that executes our applications with the installed Python) From 6904dd3b56329c0254e10f81d0ee0b12d1414279 Mon Sep 17 00:00:00 2001 From: Drew Date: Tue, 17 Sep 2024 22:57:11 -0700 Subject: [PATCH 05/14] Create base installer window initialization code --- .../windows/sdr_win_installer/__init__.py | 0 .../windows/sdr_win_installer/__main__.py | 32 +++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 installers/windows/sdr_win_installer/__init__.py create mode 100644 installers/windows/sdr_win_installer/__main__.py diff --git a/installers/windows/sdr_win_installer/__init__.py b/installers/windows/sdr_win_installer/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/installers/windows/sdr_win_installer/__main__.py b/installers/windows/sdr_win_installer/__main__.py new file mode 100644 index 0000000..2c6ab2d --- /dev/null +++ b/installers/windows/sdr_win_installer/__main__.py @@ -0,0 +1,32 @@ +import sys + +from tkinter import * +from tkinter import ttk + +# Standardized window creator, just to make sure window geometry is consistent between both version +def create_root_window(): + root_window = Tk() + root_window.geometry("400x300") + + return root_window + +# Function for running the Windows installation +def installer(admin_access): + installer_root_window = create_root_window() + + installer_root_window.mainloop() + +def uninstaller(): + uninstaller_root_window = create_root_window() + + uninstaller_root_window.mainloop() + +if "--uninstall" in sys.argv: + # Run the uninstaller if it this executable is called in that way. + uninstaller() +elif "--uac" in sys.argv: + # If the app is restarted + installer(True) +else: + installer(False) + From 6f73d305f26da3ed75e89ce97c7b98ff5161f4a6 Mon Sep 17 00:00:00 2001 From: Drew Date: Tue, 17 Sep 2024 23:49:48 -0700 Subject: [PATCH 06/14] Create first installer page --- .../windows/sdr_win_installer/__main__.py | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/installers/windows/sdr_win_installer/__main__.py b/installers/windows/sdr_win_installer/__main__.py index 2c6ab2d..2a98b3e 100644 --- a/installers/windows/sdr_win_installer/__main__.py +++ b/installers/windows/sdr_win_installer/__main__.py @@ -1,4 +1,7 @@ +#Standard Library imports import sys +import os +from pathlib import Path from tkinter import * from tkinter import ttk @@ -10,10 +13,45 @@ def create_root_window(): return root_window +def please_uninstall(installer_root_window): + # Frame with message to uninstall previously-existing SDEC before installing new version + please_uninstall_frame = ttk.Frame(installer_root_window, padding=10) + please_uninstall_frame.grid() + + #Welcome Text + please_uninstall_text = "An existing installation of the Sun Devil Rocketry Liquid Engine GUI and SDEC has been detected. Please uninstall them before running the installer." + please_uninstall_label = ttk.Label(please_uninstall_frame, text=please_uninstall_text, wraplength=380) + please_uninstall_label.grid(column=0, row=0) + +def installer_page_1(installer_root_window): + # Frame with the first installer page + welcome_frame = ttk.Frame(installer_root_window, padding=10) + welcome_frame.grid() + + #Welcome Text + welcome_text = "Welcome to the Sun Devil Rocketry Liquid Engine GUI and SDEC installer for Windows.\n\nPlease choose one of the options below to begin the installation:" + welcome_label = ttk.Label(welcome_frame, text=welcome_text, wraplength=380) + welcome_label.grid(column=0, row=0) + + # System-wide Installation Button + system_installation_button = ttk.Button(welcome_frame, text="System-Wide Installation") + system_installation_button.grid(column=0, row=1) + + # User installation Button + user_installation_button = ttk.Button(welcome_frame, text="User Installation") + user_installation_button.grid(column = 0, row=2) + # Function for running the Windows installation def installer(admin_access): + print("Starting installation") installer_root_window = create_root_window() + # Check if there is an existing installation of SDEC + if not Path("C:/Program Files/Sun Devil Rocketry").exists() and not Path(os.path.expandvars("$APPDATA") + "/Sun Devil Rocketry").exists(): + installer_page_1(installer_root_window) + else: + please_uninstall(installer_root_window) + installer_root_window.mainloop() def uninstaller(): From c3b7842ed31cc0ce032323e21204bcef760e858b Mon Sep 17 00:00:00 2001 From: Drew Date: Wed, 18 Sep 2024 02:32:19 -0700 Subject: [PATCH 07/14] Add installer page 2 and UAC logic --- .../windows/sdr_win_installer/__main__.py | 42 +++++++++++++++++-- 1 file changed, 38 insertions(+), 4 deletions(-) diff --git a/installers/windows/sdr_win_installer/__main__.py b/installers/windows/sdr_win_installer/__main__.py index 2a98b3e..ea2352c 100644 --- a/installers/windows/sdr_win_installer/__main__.py +++ b/installers/windows/sdr_win_installer/__main__.py @@ -1,6 +1,8 @@ #Standard Library imports import sys import os +import ctypes +from re import escape from pathlib import Path from tkinter import * @@ -13,6 +15,22 @@ def create_root_window(): return root_window +def installer_page_2(installer_root_window): # TODO add argument that tells this whether it'll be doing a user or a system install (or maybe just do it based on the --skip flag) + # This page will do the actual install operations. For now, + installing_frame = ttk.Frame(installer_root_window, padding=10) + installing_frame.grid() + + installing_text = "Installing Sun Devil Rocketry Liquid Engine GUI and SDEC..." + installing_label = ttk.Label(installing_frame, text=installing_text, wraplength=380) + installing_label.grid(column=0, row=0) + + install_progress = IntVar() + + installing_progress_bar = ttk.Progressbar(installing_frame, length=380, variable=install_progress) + installing_progress_bar.grid(column=0, row=1) + + install_progress.set(50) + def please_uninstall(installer_root_window): # Frame with message to uninstall previously-existing SDEC before installing new version please_uninstall_frame = ttk.Frame(installer_root_window, padding=10) @@ -33,12 +51,26 @@ def installer_page_1(installer_root_window): welcome_label = ttk.Label(welcome_frame, text=welcome_text, wraplength=380) welcome_label.grid(column=0, row=0) + # Checks if the user is admin. If not, the application is restarted with UAC and flags passed into it. + def check_admin(): + if not ctypes.windll.shell32.IsUserAnAdmin(): + # This checks if the command is actually running in the final executable or the development environment. + # I had to do this crappy workaround because the field for executable flags for this function doesn't support escape sequences properly and my test Windows VM has a space in the username. + if ".exe" in sys.argv[0]: + # Final executable + ctypes.windll.shell32.ShellExecuteW(None, "runas", sys.executable, " --skip", os.getcwd(), 0) + else: + # Development environment + ctypes.windll.shell32.ShellExecuteW(None, "runas", sys.executable, " -m sdr_win_installer --skip", os.getcwd(), 0) + + installer_root_window.destroy() + # System-wide Installation Button - system_installation_button = ttk.Button(welcome_frame, text="System-Wide Installation") + system_installation_button = ttk.Button(welcome_frame, text="System-Wide Installation", command=check_admin) system_installation_button.grid(column=0, row=1) # User installation Button - user_installation_button = ttk.Button(welcome_frame, text="User Installation") + user_installation_button = ttk.Button(welcome_frame, text="User Installation") # TODO Hook up to a function that opens page 2 to do a user install user_installation_button.grid(column = 0, row=2) # Function for running the Windows installation @@ -46,9 +78,11 @@ def installer(admin_access): print("Starting installation") installer_root_window = create_root_window() - # Check if there is an existing installation of SDEC - if not Path("C:/Program Files/Sun Devil Rocketry").exists() and not Path(os.path.expandvars("$APPDATA") + "/Sun Devil Rocketry").exists(): + # Check if there is an existing installation of SDEC/Liquids GUI + if not Path("C:/Program Files/Sun Devil Rocketry").exists() and not Path(os.path.expandvars("$APPDATA") + "/Sun Devil Rocketry").exists() and not "--skip" in sys.argv: installer_page_1(installer_root_window) + elif "--skip" in sys.argv: + installer_page_2(installer_root_window) else: please_uninstall(installer_root_window) From 0cdcce862d59f948cfb3448489a9b80846b9e66e Mon Sep 17 00:00:00 2001 From: Drew Date: Wed, 18 Sep 2024 02:35:15 -0700 Subject: [PATCH 08/14] Add important readme warning --- readme.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 5f01991..1fffdf7 100644 --- a/readme.md +++ b/readme.md @@ -1,12 +1,17 @@ # Rocket Engine GUI This branch has the goal of creating an easy executable installer for the liquid_engine_gui. +## Important Notice +This branch should **NOT** be merged until: +1. The new directory structure has been verified to introduce no new bugs. +2. The Windows installer is functional. + ## TODO - [x] Change directory structure to conventional Python3 module - [x] Create pysetup.toml - [x] Remove sdec submodule and update documentation saying that sdec is installed with pip. -- [ ] Setup packaging (perhaps through something as simple as pyinstall to make one EXE, but it could also be an installer that 1. sets up a Python environment, 2. installs SDR software, 3. Installs a .BAT that executes our applications with the installed Python) +- [ ] (Currently WIP) Setup packaging (perhaps through something as simple as pyinstall to make one EXE, but it could also be an installer that 1. sets up a Python environment, 2. installs SDR software, 3. Installs a .BAT that executes our applications with the installed Python) ## Packing Project getting started 1) Navigate into project folder. From ab393d32d6d902d9a251622798871b2a75bfff33 Mon Sep 17 00:00:00 2001 From: Dexx Stexx Date: Fri, 20 Sep 2024 21:59:39 -0700 Subject: [PATCH 09/14] Fix version to follow project conventions --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 86af95b..0dcc71b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,7 +16,7 @@ authors = [ {name = "Colton Acosta"}, {name = "Nick Nguyen"} ] -version = "2024.9+packagingdev" +version = "2024.9.0+packagingdev" dependencies = [ "pillow", "sdec@git+https://github.com/SunDevilRocketry/sdec@pip-packaging" From 66dd5f7752394d8648456a0d030e0f591bdd84d4 Mon Sep 17 00:00:00 2001 From: Dexx Stexx Date: Fri, 20 Sep 2024 22:20:29 -0700 Subject: [PATCH 10/14] Update readme.md --- readme.md | 40 +++++++++++++++++----------------------- 1 file changed, 17 insertions(+), 23 deletions(-) diff --git a/readme.md b/readme.md index 5f01991..8b37a61 100644 --- a/readme.md +++ b/readme.md @@ -1,26 +1,7 @@ # Rocket Engine GUI -This branch has the goal of creating an easy executable installer for the liquid_engine_gui. +![A screenshot of the sdec gui](liquid_engine_gui/images/engine_gui_2023.png) -## TODO - -- [x] Change directory structure to conventional Python3 module -- [x] Create pysetup.toml -- [x] Remove sdec submodule and update documentation saying that sdec is installed with pip. -- [ ] Setup packaging (perhaps through something as simple as pyinstall to make one EXE, but it could also be an installer that 1. sets up a Python environment, 2. installs SDR software, 3. Installs a .BAT that executes our applications with the installed Python) - -## Packing Project getting started -1) Navigate into project folder. -2) Install dependencies, which are Pillow and sdec (technically there are others, but they're all required by sdec as well). ```pip3 install pillow git+https://github.com/SunDevilRocketry/sdec``` -3) Run the GUI with the following command: ```python3 -m liquid_engine_gui``` - -## NOTE: The docs below are very out of date and need updating. - -## Getting Started -1) Open cmd / terminal -2) Navigate into the project folder -3) Ensure all required libraries are downloaded (pip install -r requirements.txt) -4) Run main program (python SDR_LiquidGUI.py) -5) Connect Arduino running SDR_DataLogger_Analog.ino via USB port +The Liquid Engine GUI is a visual control and monitoring software for the SDR Liquid Engine Valve controller, written in Python using Tk and our [sdec](https://github.com/SunDevilRocketry/sdec) library. The following code on this repository has been designed to control the SDR Liquid Engine Switchbox to: - Automate Rocket Engine Startup @@ -28,6 +9,19 @@ The following code on this repository has been designed to control the SDR Liqui - Log Sensor Data - Have Pre-programmed actions to execute (i.e. Startup) -## GUI Layout - +## Installation +> In the near future, we intend to have an installer application for, at the minimum, Microsoft Windows. For now, the installation process +1. Make sure you have a working Python installation with pip. +2. Install the GUI with pip. + + pip install git+https://github.com/SunDevilRocketry/liquid_engine_gui +3. Run the GUI with the following command: + + python -m liquid_engine_gui +> If you are developing the software, make sure you don't execute this command in the same directory as the repository, or you may experience bugs. + +## Development +The source code is under the directory liquid_engine_gui. The versioning convention is the same as SDEC. + +This project uses Tk and sdec as a library. From 4510f78207d950494579c4dff37a115c630d8851 Mon Sep 17 00:00:00 2001 From: Dexx Stexx Date: Fri, 20 Sep 2024 22:21:05 -0700 Subject: [PATCH 11/14] Update pyproject.toml dependencies --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 0dcc71b..364453d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -19,6 +19,6 @@ authors = [ version = "2024.9.0+packagingdev" dependencies = [ "pillow", - "sdec@git+https://github.com/SunDevilRocketry/sdec@pip-packaging" + "sdec@git+https://github.com/SunDevilRocketry/sdec" ] readme = "readme.md" \ No newline at end of file From 7438568857be22b16a3baf378bb99d0ace614dc1 Mon Sep 17 00:00:00 2001 From: Dexx Stexx Date: Fri, 20 Sep 2024 22:39:01 -0700 Subject: [PATCH 12/14] Revert "Merge branch 'packaging' into pip-packaging" This reverts commit 4c79ecaaa199a7cc18e148ec8c9c1fc7078edae6, reversing changes made to 4510f78207d950494579c4dff37a115c630d8851. --- .../windows/sdr_win_installer/__init__.py | 0 .../windows/sdr_win_installer/__main__.py | 104 ------------------ readme.md | 3 +- 3 files changed, 2 insertions(+), 105 deletions(-) delete mode 100644 installers/windows/sdr_win_installer/__init__.py delete mode 100644 installers/windows/sdr_win_installer/__main__.py diff --git a/installers/windows/sdr_win_installer/__init__.py b/installers/windows/sdr_win_installer/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/installers/windows/sdr_win_installer/__main__.py b/installers/windows/sdr_win_installer/__main__.py deleted file mode 100644 index ea2352c..0000000 --- a/installers/windows/sdr_win_installer/__main__.py +++ /dev/null @@ -1,104 +0,0 @@ -#Standard Library imports -import sys -import os -import ctypes -from re import escape -from pathlib import Path - -from tkinter import * -from tkinter import ttk - -# Standardized window creator, just to make sure window geometry is consistent between both version -def create_root_window(): - root_window = Tk() - root_window.geometry("400x300") - - return root_window - -def installer_page_2(installer_root_window): # TODO add argument that tells this whether it'll be doing a user or a system install (or maybe just do it based on the --skip flag) - # This page will do the actual install operations. For now, - installing_frame = ttk.Frame(installer_root_window, padding=10) - installing_frame.grid() - - installing_text = "Installing Sun Devil Rocketry Liquid Engine GUI and SDEC..." - installing_label = ttk.Label(installing_frame, text=installing_text, wraplength=380) - installing_label.grid(column=0, row=0) - - install_progress = IntVar() - - installing_progress_bar = ttk.Progressbar(installing_frame, length=380, variable=install_progress) - installing_progress_bar.grid(column=0, row=1) - - install_progress.set(50) - -def please_uninstall(installer_root_window): - # Frame with message to uninstall previously-existing SDEC before installing new version - please_uninstall_frame = ttk.Frame(installer_root_window, padding=10) - please_uninstall_frame.grid() - - #Welcome Text - please_uninstall_text = "An existing installation of the Sun Devil Rocketry Liquid Engine GUI and SDEC has been detected. Please uninstall them before running the installer." - please_uninstall_label = ttk.Label(please_uninstall_frame, text=please_uninstall_text, wraplength=380) - please_uninstall_label.grid(column=0, row=0) - -def installer_page_1(installer_root_window): - # Frame with the first installer page - welcome_frame = ttk.Frame(installer_root_window, padding=10) - welcome_frame.grid() - - #Welcome Text - welcome_text = "Welcome to the Sun Devil Rocketry Liquid Engine GUI and SDEC installer for Windows.\n\nPlease choose one of the options below to begin the installation:" - welcome_label = ttk.Label(welcome_frame, text=welcome_text, wraplength=380) - welcome_label.grid(column=0, row=0) - - # Checks if the user is admin. If not, the application is restarted with UAC and flags passed into it. - def check_admin(): - if not ctypes.windll.shell32.IsUserAnAdmin(): - # This checks if the command is actually running in the final executable or the development environment. - # I had to do this crappy workaround because the field for executable flags for this function doesn't support escape sequences properly and my test Windows VM has a space in the username. - if ".exe" in sys.argv[0]: - # Final executable - ctypes.windll.shell32.ShellExecuteW(None, "runas", sys.executable, " --skip", os.getcwd(), 0) - else: - # Development environment - ctypes.windll.shell32.ShellExecuteW(None, "runas", sys.executable, " -m sdr_win_installer --skip", os.getcwd(), 0) - - installer_root_window.destroy() - - # System-wide Installation Button - system_installation_button = ttk.Button(welcome_frame, text="System-Wide Installation", command=check_admin) - system_installation_button.grid(column=0, row=1) - - # User installation Button - user_installation_button = ttk.Button(welcome_frame, text="User Installation") # TODO Hook up to a function that opens page 2 to do a user install - user_installation_button.grid(column = 0, row=2) - -# Function for running the Windows installation -def installer(admin_access): - print("Starting installation") - installer_root_window = create_root_window() - - # Check if there is an existing installation of SDEC/Liquids GUI - if not Path("C:/Program Files/Sun Devil Rocketry").exists() and not Path(os.path.expandvars("$APPDATA") + "/Sun Devil Rocketry").exists() and not "--skip" in sys.argv: - installer_page_1(installer_root_window) - elif "--skip" in sys.argv: - installer_page_2(installer_root_window) - else: - please_uninstall(installer_root_window) - - installer_root_window.mainloop() - -def uninstaller(): - uninstaller_root_window = create_root_window() - - uninstaller_root_window.mainloop() - -if "--uninstall" in sys.argv: - # Run the uninstaller if it this executable is called in that way. - uninstaller() -elif "--uac" in sys.argv: - # If the app is restarted - installer(True) -else: - installer(False) - diff --git a/readme.md b/readme.md index ea437b4..8b37a61 100644 --- a/readme.md +++ b/readme.md @@ -23,4 +23,5 @@ The following code on this repository has been designed to control the SDR Liqui ## Development The source code is under the directory liquid_engine_gui. The versioning convention is the same as SDEC. -This project uses Tk and sdec as a library. \ No newline at end of file +This project uses Tk and sdec as a library. + From d7f0f8cd6eb72d15000f9d77ef87d440c9f592c5 Mon Sep 17 00:00:00 2001 From: Dexx Stexx Date: Sat, 28 Sep 2024 13:19:48 -0700 Subject: [PATCH 13/14] Re-add sdec submodule to improve easy of development --- .gitmodules | 4 ++++ sdec | 1 + 2 files changed, 5 insertions(+) create mode 100644 .gitmodules create mode 160000 sdec diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..e98ef17 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,4 @@ +[submodule "sdec"] + path = sdec + url = https://github.com/SunDevilRocketry/sdec + branch = pip-packaging diff --git a/sdec b/sdec new file mode 160000 index 0000000..46bd532 --- /dev/null +++ b/sdec @@ -0,0 +1 @@ +Subproject commit 46bd5329401687b14dfabc88e3f380a58abc3bdd From b80ea6e6eb86cb9557659bf99b3f1c39b0d27835 Mon Sep 17 00:00:00 2001 From: Dexx Stexx Date: Sat, 28 Sep 2024 13:23:08 -0700 Subject: [PATCH 14/14] Update readme to make development workflow clearer. --- readme.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/readme.md b/readme.md index 8b37a61..3ff18de 100644 --- a/readme.md +++ b/readme.md @@ -23,5 +23,9 @@ The following code on this repository has been designed to control the SDR Liqui ## Development The source code is under the directory liquid_engine_gui. The versioning convention is the same as SDEC. +Normally, sdec is automatically pulled with pip. However, it is also included as a submodule in this repo should you be working on sdec development. To test changes to sdec and/or liquids gui, pull your submodules, then use the repo as the current directory and run: + +```python3 -m liquid_engine_gui``` + This project uses Tk and sdec as a library.