Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated env for windows compatibility #36

Merged
merged 2 commits into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified arcjetCV/gui/logo/arcjetCV_logo_white.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
57 changes: 30 additions & 27 deletions arcjetCV/gui/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from PySide6 import QtWidgets
from PySide6.QtWidgets import QMessageBox
from PySide6.QtCore import Signal
from PySide6.QtGui import QIcon
from PySide6.QtGui import QIcon,QPixmap
import matplotlib.pyplot as plt
from matplotlib.colors import rgb_to_hsv
from matplotlib.widgets import RectangleSelector
Expand Down Expand Up @@ -36,13 +36,14 @@ def __init__(self):
self.testing = False

# Set the application icon
self.logo_path = os.path.join(
self.logo_white_path = os.path.join(
Path(__file__).parent.absolute(), "logo/arcjetCV_logo_white.png"
)
self.logo_path = os.path.join(Path(__file__).parent.absolute(), "logo/arcjetCV_logo_.png")
self.setWindowIcon(QIcon(self.logo_path))

# Load and process the application logo
self.rgb_frame = cv.imread(self.logo_path)
self.rgb_frame = cv.imread(self.logo_white_path)
self.rgb_frame = cv.cvtColor(self.rgb_frame, cv.COLOR_BGR2RGB)

# Initialize frame and plotting windows
Expand Down Expand Up @@ -549,10 +550,9 @@ def load_outputs(self):

except Exception as e:
if self.testing:
print("!!! File loading failed !!!:\n" + str(e))
print("! File loading failed !:\n" + str(e))
else:
QMessageBox.warning(
None, "Warning", "!!! File loading failed !!!:\n" + str(e)
self.arcjetcv_message_box("Warning", "! File loading failed !:\n" + str(e)
)

self.plot_outputs()
Expand Down Expand Up @@ -812,20 +812,18 @@ def plot_outputs(self):
if self.testing:
print("Not enough data to plot")
else:
QMessageBox.warning(
None,
self.arcjetcv_message_box(
"Warning",
"!!! Not enough data to plot !!!: only %i points"
% len(self.raw_outputs),
"! Not enough data to plot !: only %i points"
% len(self.raw_outputs)
)

except Exception as e:
self.ui.basebar.setText("!!! Plotting failed !!!")
self.ui.basebar.setText("! Plotting failed !")
if self.testing:
print("Warning", "!!! Plotting failed !!!:\n" + str(e))
print("Warning", "! Plotting failed !:\n" + str(e))
else:
QMessageBox.warning(
None, "Warning", "!!! Plotting failed !!!:\n" + str(e)
self.arcjetcv_message_box("Warning", "! Plotting failed !:\n" + str(e)
)

self.ui.Window1.repaint()
Expand Down Expand Up @@ -872,12 +870,11 @@ def save_plots(self, name):
plt.close(fig)

except Exception as e:
self.ui.basebar.setText("!!! Plot saving failed !!!")
self.ui.basebar.setText("! Plot saving failed !")
if self.testing:
print("Warning", "!!! Plot saving failed !!!:\n" + str(e))
print("Warning", "! Plot saving failed !:\n" + str(e))
else:
QMessageBox.warning(
None, "Warning", "!!! Plot saving failed !!!:\n" + str(e)
self.arcjetcv_message_box("Warning", "! Plot saving failed !:\n" + str(e)
)

def export_to_csv(self):
Expand Down Expand Up @@ -931,12 +928,11 @@ def export_to_csv(self):
df.to_csv(csv_file_path, index=False)

except Exception as e:
self.ui.basebar.setText("!!! CSV export failed !!!")
self.ui.basebar.setText("! CSV export failed !")
if self.testing:
print("Warning", "!!! CSV export failed !!!:\n" + str(e))
print("Warning", "! CSV export failed !:\n" + str(e))
else:
QMessageBox.warning(
None, "Warning", "!!! CSV export failed !!!:\n" + str(e)
self.arcjetcv_message_box("Warning", "! CSV export failed !:\n" + str(e)
)

def fit_data(self):
Expand Down Expand Up @@ -994,10 +990,17 @@ def fit_data(self):
self.fit_dict = fit_dict

except Exception as e:
self.ui.basebar.setText("!!! Fitting failed !!!")
self.ui.basebar.setText("! Fitting failed !")
if self.testing:
print("Warning", "!!! Fitting failed !!!:\n" + str(e))
print("Warning", "! Fitting failed !:\n" + str(e))
else:
QMessageBox.warning(
None, "Warning", "!!! Fitting failed !!!:\n" + str(e)
)
self.arcjetcv_message_box("Warning", "! Fitting failed !:\n" + str(e))

def arcjetcv_message_box(self,title,message):

msg_box = QMessageBox()
msg_box.setIconPixmap(QPixmap(self.logo_path))
msg_box.setWindowTitle(title)
msg_box.setText(message)
msg_box.setStandardButtons(QMessageBox.Ok)
msg_box.exec_()
1 change: 0 additions & 1 deletion env/arcjetCV_env_gpu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ dependencies:
- python
- pip
- pyside6
- ocl-icd-system
- opencv
- matplotlib
- pandas
Expand Down
Loading