|
8 | 8 | from PySide6 import QtWidgets
|
9 | 9 | from PySide6.QtWidgets import QMessageBox
|
10 | 10 | from PySide6.QtCore import Signal
|
11 |
| -from PySide6.QtGui import QIcon |
| 11 | +from PySide6.QtGui import QIcon,QPixmap |
12 | 12 | import matplotlib.pyplot as plt
|
13 | 13 | from matplotlib.colors import rgb_to_hsv
|
14 | 14 | from matplotlib.widgets import RectangleSelector
|
@@ -36,13 +36,14 @@ def __init__(self):
|
36 | 36 | self.testing = False
|
37 | 37 |
|
38 | 38 | # Set the application icon
|
39 |
| - self.logo_path = os.path.join( |
| 39 | + self.logo_white_path = os.path.join( |
40 | 40 | Path(__file__).parent.absolute(), "logo/arcjetCV_logo_white.png"
|
41 | 41 | )
|
| 42 | + self.logo_path = os.path.join(Path(__file__).parent.absolute(), "logo/arcjetCV_logo_.png") |
42 | 43 | self.setWindowIcon(QIcon(self.logo_path))
|
43 | 44 |
|
44 | 45 | # Load and process the application logo
|
45 |
| - self.rgb_frame = cv.imread(self.logo_path) |
| 46 | + self.rgb_frame = cv.imread(self.logo_white_path) |
46 | 47 | self.rgb_frame = cv.cvtColor(self.rgb_frame, cv.COLOR_BGR2RGB)
|
47 | 48 |
|
48 | 49 | # Initialize frame and plotting windows
|
@@ -549,10 +550,9 @@ def load_outputs(self):
|
549 | 550 |
|
550 | 551 | except Exception as e:
|
551 | 552 | if self.testing:
|
552 |
| - print("!!! File loading failed !!!:\n" + str(e)) |
| 553 | + print("! File loading failed !:\n" + str(e)) |
553 | 554 | else:
|
554 |
| - QMessageBox.warning( |
555 |
| - None, "Warning", "!!! File loading failed !!!:\n" + str(e) |
| 555 | + self.arcjetcv_message_box("Warning", "! File loading failed !:\n" + str(e) |
556 | 556 | )
|
557 | 557 |
|
558 | 558 | self.plot_outputs()
|
@@ -812,20 +812,18 @@ def plot_outputs(self):
|
812 | 812 | if self.testing:
|
813 | 813 | print("Not enough data to plot")
|
814 | 814 | else:
|
815 |
| - QMessageBox.warning( |
816 |
| - None, |
| 815 | + self.arcjetcv_message_box( |
817 | 816 | "Warning",
|
818 |
| - "!!! Not enough data to plot !!!: only %i points" |
819 |
| - % len(self.raw_outputs), |
| 817 | + "! Not enough data to plot !: only %i points" |
| 818 | + % len(self.raw_outputs) |
820 | 819 | )
|
821 | 820 |
|
822 | 821 | except Exception as e:
|
823 |
| - self.ui.basebar.setText("!!! Plotting failed !!!") |
| 822 | + self.ui.basebar.setText("! Plotting failed !") |
824 | 823 | if self.testing:
|
825 |
| - print("Warning", "!!! Plotting failed !!!:\n" + str(e)) |
| 824 | + print("Warning", "! Plotting failed !:\n" + str(e)) |
826 | 825 | else:
|
827 |
| - QMessageBox.warning( |
828 |
| - None, "Warning", "!!! Plotting failed !!!:\n" + str(e) |
| 826 | + self.arcjetcv_message_box("Warning", "! Plotting failed !:\n" + str(e) |
829 | 827 | )
|
830 | 828 |
|
831 | 829 | self.ui.Window1.repaint()
|
@@ -872,12 +870,11 @@ def save_plots(self, name):
|
872 | 870 | plt.close(fig)
|
873 | 871 |
|
874 | 872 | except Exception as e:
|
875 |
| - self.ui.basebar.setText("!!! Plot saving failed !!!") |
| 873 | + self.ui.basebar.setText("! Plot saving failed !") |
876 | 874 | if self.testing:
|
877 |
| - print("Warning", "!!! Plot saving failed !!!:\n" + str(e)) |
| 875 | + print("Warning", "! Plot saving failed !:\n" + str(e)) |
878 | 876 | else:
|
879 |
| - QMessageBox.warning( |
880 |
| - None, "Warning", "!!! Plot saving failed !!!:\n" + str(e) |
| 877 | + self.arcjetcv_message_box("Warning", "! Plot saving failed !:\n" + str(e) |
881 | 878 | )
|
882 | 879 |
|
883 | 880 | def export_to_csv(self):
|
@@ -931,12 +928,11 @@ def export_to_csv(self):
|
931 | 928 | df.to_csv(csv_file_path, index=False)
|
932 | 929 |
|
933 | 930 | except Exception as e:
|
934 |
| - self.ui.basebar.setText("!!! CSV export failed !!!") |
| 931 | + self.ui.basebar.setText("! CSV export failed !") |
935 | 932 | if self.testing:
|
936 |
| - print("Warning", "!!! CSV export failed !!!:\n" + str(e)) |
| 933 | + print("Warning", "! CSV export failed !:\n" + str(e)) |
937 | 934 | else:
|
938 |
| - QMessageBox.warning( |
939 |
| - None, "Warning", "!!! CSV export failed !!!:\n" + str(e) |
| 935 | + self.arcjetcv_message_box("Warning", "! CSV export failed !:\n" + str(e) |
940 | 936 | )
|
941 | 937 |
|
942 | 938 | def fit_data(self):
|
@@ -994,10 +990,17 @@ def fit_data(self):
|
994 | 990 | self.fit_dict = fit_dict
|
995 | 991 |
|
996 | 992 | except Exception as e:
|
997 |
| - self.ui.basebar.setText("!!! Fitting failed !!!") |
| 993 | + self.ui.basebar.setText("! Fitting failed !") |
998 | 994 | if self.testing:
|
999 |
| - print("Warning", "!!! Fitting failed !!!:\n" + str(e)) |
| 995 | + print("Warning", "! Fitting failed !:\n" + str(e)) |
1000 | 996 | else:
|
1001 |
| - QMessageBox.warning( |
1002 |
| - None, "Warning", "!!! Fitting failed !!!:\n" + str(e) |
1003 |
| - ) |
| 997 | + self.arcjetcv_message_box("Warning", "! Fitting failed !:\n" + str(e)) |
| 998 | + |
| 999 | + def arcjetcv_message_box(self,title,message): |
| 1000 | + |
| 1001 | + msg_box = QMessageBox() |
| 1002 | + msg_box.setIconPixmap(QPixmap(self.logo_path)) |
| 1003 | + msg_box.setWindowTitle(title) |
| 1004 | + msg_box.setText(message) |
| 1005 | + msg_box.setStandardButtons(QMessageBox.Ok) |
| 1006 | + msg_box.exec_() |
0 commit comments