PaIRS-UniNa 0.2.0__cp310-cp310-win_amd64.whl → 0.2.8__cp310-cp310-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. PaIRS_UniNa/Calibration_Tab.py +39 -23
  2. PaIRS_UniNa/Changes.txt +127 -8
  3. PaIRS_UniNa/Custom_Top.py +12 -9
  4. PaIRS_UniNa/Explorer.py +534 -165
  5. PaIRS_UniNa/FolderLoop.py +562 -0
  6. PaIRS_UniNa/Input_Tab.py +261 -100
  7. PaIRS_UniNa/Input_Tab_CalVi.py +24 -25
  8. PaIRS_UniNa/Input_Tab_tools.py +967 -405
  9. PaIRS_UniNa/Output_Tab.py +324 -130
  10. PaIRS_UniNa/PaIRS_PIV.py +58 -1
  11. PaIRS_UniNa/PaIRS_pypacks.py +1415 -1039
  12. PaIRS_UniNa/Process_Tab.py +15 -19
  13. PaIRS_UniNa/Process_Tab_Disp.py +12 -5
  14. PaIRS_UniNa/Saving_tools.py +27 -13
  15. PaIRS_UniNa/TabTools.py +176 -59
  16. PaIRS_UniNa/Vis_Tab.py +664 -256
  17. PaIRS_UniNa/Vis_Tab_CalVi.py +114 -45
  18. PaIRS_UniNa/Whatsnew.py +58 -9
  19. PaIRS_UniNa/_PaIRS_PIV.pyd +0 -0
  20. PaIRS_UniNa/__init__.py +4 -3
  21. PaIRS_UniNa/addwidgets_ps.py +150 -63
  22. PaIRS_UniNa/calib.py +6 -3
  23. PaIRS_UniNa/calibView.py +19 -6
  24. PaIRS_UniNa/gPaIRS.py +1397 -543
  25. PaIRS_UniNa/icons/align_all.png +0 -0
  26. PaIRS_UniNa/icons/announcement.png +0 -0
  27. PaIRS_UniNa/icons/bugfix.png +0 -0
  28. PaIRS_UniNa/icons/change_folder.png +0 -0
  29. PaIRS_UniNa/icons/change_folder_off.png +0 -0
  30. PaIRS_UniNa/icons/close_all.png +0 -0
  31. PaIRS_UniNa/icons/copy_process_off.png +0 -0
  32. PaIRS_UniNa/icons/flaticon_PaIRS_beta.png +0 -0
  33. PaIRS_UniNa/icons/flaticon_PaIRS_download_warning.png +0 -0
  34. PaIRS_UniNa/icons/folder_loop_cleanup.png +0 -0
  35. PaIRS_UniNa/icons/folder_loop_cleanup_off.png +0 -0
  36. PaIRS_UniNa/icons/linked.png +0 -0
  37. PaIRS_UniNa/icons/logo_opaco.png +0 -0
  38. PaIRS_UniNa/icons/open_image.png +0 -0
  39. PaIRS_UniNa/icons/open_new_window.png +0 -0
  40. PaIRS_UniNa/icons/open_result.png +0 -0
  41. PaIRS_UniNa/icons/process_loop.png +0 -0
  42. PaIRS_UniNa/icons/pylog.png +0 -0
  43. PaIRS_UniNa/icons/python_warning.png +0 -0
  44. PaIRS_UniNa/icons/queue.png +0 -0
  45. PaIRS_UniNa/icons/restore_undo.png +0 -0
  46. PaIRS_UniNa/icons/save_and_stop.png +0 -0
  47. PaIRS_UniNa/icons/scale_all.png +0 -0
  48. PaIRS_UniNa/icons/scale_down.png +0 -0
  49. PaIRS_UniNa/icons/scale_up.png +0 -0
  50. PaIRS_UniNa/icons/scan_path_loop.png +0 -0
  51. PaIRS_UniNa/icons/scan_path_loop_off.png +0 -0
  52. PaIRS_UniNa/icons/show_all.png +0 -0
  53. PaIRS_UniNa/icons/star.png +0 -0
  54. PaIRS_UniNa/icons/step_inheritance.png +0 -0
  55. PaIRS_UniNa/icons/subMIN_on.png +0 -0
  56. PaIRS_UniNa/icons/unedited.png +0 -0
  57. PaIRS_UniNa/icons/uninitialized.png +0 -0
  58. PaIRS_UniNa/icons/window.png +0 -0
  59. PaIRS_UniNa/listLib.py +3 -2
  60. PaIRS_UniNa/parForMulti.py +7 -5
  61. PaIRS_UniNa/parForWorkers.py +174 -140
  62. PaIRS_UniNa/pivParFor.py +9 -11
  63. PaIRS_UniNa/preProcParFor.py +4 -4
  64. PaIRS_UniNa/procTools.py +120 -44
  65. PaIRS_UniNa/rqrdpckgs.txt +9 -0
  66. PaIRS_UniNa/stereoPivParFor.py +16 -22
  67. PaIRS_UniNa/tabSplitter.py +17 -7
  68. PaIRS_UniNa/ui_Input_Tab.py +56 -57
  69. PaIRS_UniNa/ui_Input_Tab_CalVi.py +71 -64
  70. PaIRS_UniNa/ui_Log_Tab.py +8 -6
  71. PaIRS_UniNa/ui_Output_Tab.py +180 -4
  72. PaIRS_UniNa/ui_Process_Tab.py +19 -19
  73. PaIRS_UniNa/ui_Process_Tab_Disp.py +181 -10
  74. PaIRS_UniNa/ui_Vis_Tab.py +332 -196
  75. PaIRS_UniNa/ui_Whatsnew.py +13 -13
  76. PaIRS_UniNa/ui_gPairs.py +140 -71
  77. PaIRS_UniNa/ui_infoPaIRS.py +156 -31
  78. PaIRS_UniNa/whatsnew.txt +6 -4
  79. {PaIRS_UniNa-0.2.0.dist-info → pairs_unina-0.2.8.dist-info}/METADATA +62 -26
  80. {PaIRS_UniNa-0.2.0.dist-info → pairs_unina-0.2.8.dist-info}/RECORD +82 -54
  81. {PaIRS_UniNa-0.2.0.dist-info → pairs_unina-0.2.8.dist-info}/WHEEL +1 -1
  82. PaIRS_UniNa/icons/order.png +0 -0
  83. PaIRS_UniNa/icons/order_reverse.png +0 -0
  84. PaIRS_UniNa/icons/run_piv.png +0 -0
  85. PaIRS_UniNa/stereo.py +0 -685
  86. PaIRS_UniNa/ui_infoCalVi.py +0 -428
  87. PaIRS_UniNa-0.2.0.dist-info/LICENSE +0 -19
  88. {PaIRS_UniNa-0.2.0.dist-info → pairs_unina-0.2.8.dist-info}/top_level.txt +0 -0
@@ -8,6 +8,7 @@ InitCheck=True #False=Collap closed, True=opened
8
8
  #fonts
9
9
  font_italic=True
10
10
  font_weight=QFont.DemiBold
11
+ backgroundcolor_none=" background-color: none;"
11
12
  backgroundcolor_changing=" background-color: rgb(255,230,230);"
12
13
  color_changing="color: rgb(33,33,255); "+backgroundcolor_changing
13
14
  color_changing_black="color: rgb(0,0,0); "+backgroundcolor_changing
@@ -17,7 +18,7 @@ def setSS(b,style):
17
18
  ss=f"{b.metaObject().className()}{'{'+style+'}'}\\nQToolTip{'{'+b.initialStyle+'}'}"
18
19
  return ss
19
20
 
20
- class MyTabLabel(QtWidgets.QLabel):
21
+ class MyTabLabel(QLabel):
21
22
  def __init__(self,parent):
22
23
  super().__init__(parent)
23
24
  #self.setCursor(QCursor(QtCore.Qt.PointingHandCursor))
@@ -27,6 +28,12 @@ class MyTabLabel(QtWidgets.QLabel):
27
28
  for f in self.addfuncclick:
28
29
  self.addfuncclick[f]()
29
30
  return super().mousePressEvent(event)
31
+
32
+ def setCustomCursor(self):
33
+ if self.addfuncclick:
34
+ self.setCursor(QCursor(Qt.CursorShape.PointingHandCursor))
35
+ else:
36
+ self.setCursor(QCursor(Qt.CursorShape.ArrowCursor))
30
37
 
31
38
  #MyQLineEdit=QtWidgets.QLineEdit
32
39
  class MyQLineEdit(QtWidgets.QLineEdit):
@@ -57,7 +64,7 @@ class MyQLineEdit(QtWidgets.QLineEdit):
57
64
  if hasStyleFlag:
58
65
  if b.styleFlag: continue
59
66
  b.flagS=True
60
- b.initialStyle=b.styleSheet()
67
+ b.initialStyle=b.styleSheet()+" "+backgroundcolor_none
61
68
  b.setEnabled(False)
62
69
  b.disabledStyle=b.styleSheet()
63
70
  b.setEnabled(True)
@@ -91,24 +98,32 @@ class MyQLineEdit(QtWidgets.QLineEdit):
91
98
  super().mouseReleaseEvent(event) #to preserve classical behaviour before adding the below
92
99
  self.setCompleterList()
93
100
 
101
+ def enterEvent(self, event):
102
+ super().enterEvent(event)
103
+ if not self.font()==self.font_changing and not self.hasFocus():
104
+ self.setFont(self.font_changing)
105
+
106
+ def leaveEvent(self, event):
107
+ super().leaveEvent(event)
108
+ if self.font()==self.font_changing and not self.hasFocus():
109
+ self.setFont(self.initialFont)
110
+
94
111
  def focusInEvent(self, event):
95
112
  super().focusInEvent(event)
96
113
  for f in self.addfuncin:
97
114
  self.addfuncin[f]()
98
115
  self.focusInFun()
99
-
116
+
100
117
  def setFocus(self):
101
118
  super().setFocus()
102
119
  self.focusInFun()
103
120
 
104
121
  def focusInFun(self):
105
- #self.setCompleterList()
106
- if not self.font()==self.font_changing:
107
- self.setStyleSheet(setSS(self,self.initialStyle+" "+color_changing))
108
- self.setFont(self.font_changing)
109
- for b in self.bros:
110
- if (not b==self) and b.flagS:
111
- b.setStyleSheet(b.initialStyle+" "+color_changing_black)
122
+ self.setStyleSheet(setSS(self,self.initialStyle+" "+color_changing))
123
+ self.setFont(self.font_changing)
124
+ for b in self.bros:
125
+ if (not b==self) and b.flagS:
126
+ b.setStyleSheet(b.initialStyle+" "+color_changing_black)
112
127
 
113
128
  def focusOutEvent(self, event):
114
129
  super().focusOutEvent(event) #to preserve classical behaviour before adding the below
@@ -121,15 +136,14 @@ class MyQLineEdit(QtWidgets.QLineEdit):
121
136
  self.focusOutFun()
122
137
 
123
138
  def focusOutFun(self):
124
- if self.font()==self.font_changing:
125
- for b in self.bros:
126
- if b.flagS:
127
- if hasattr(b,'default_stylesheet'):
128
- b.setStyleSheet(b.default_stylesheet)
129
- else:
130
- b.setStyleSheet(setSS(b,b.initialStyle))
131
- if b.flagF:
132
- b.setFont(b.initialFont)
139
+ for b in self.bros:
140
+ if b.flagS:
141
+ if hasattr(b,'default_stylesheet'):
142
+ b.setStyleSheet(b.default_stylesheet)
143
+ else:
144
+ b.setStyleSheet(setSS(b,b.initialStyle))
145
+ if b.flagF:
146
+ b.setFont(b.initialFont)
133
147
  #self.addlab.clear()
134
148
 
135
149
  def showCompleter(self):
@@ -182,7 +196,7 @@ class MyQSpin(QtWidgets.QSpinBox):
182
196
  self.bros=[self]+self.addwid
183
197
  for b in self.bros:
184
198
  if b.styleFlag: continue
185
- b.initialStyle=b.styleSheet()
199
+ b.initialStyle=b.styleSheet()+" "+backgroundcolor_none
186
200
  b.initialFont=b.font()
187
201
  b.font_changing=font_changing
188
202
  b.styleFlag=True
@@ -276,7 +290,7 @@ class MyQDoubleSpin(QtWidgets.QDoubleSpinBox):
276
290
  self.bros=[self]+self.addwid
277
291
  for b in self.bros:
278
292
  if self.styleFlag: continue
279
- b.initialStyle=b.styleSheet()
293
+ b.initialStyle=b.styleSheet()+" "+backgroundcolor_none
280
294
  b.initialFont=b.font()
281
295
  b.font_changing=font_changing
282
296
  b.styleFlag=True
@@ -332,7 +346,9 @@ class CollapsibleBox(QtWidgets.QWidget):
332
346
  self.dpix=5
333
347
  self.toolMinimumWidth=400
334
348
  self.toolHeight=20
349
+ self.content_area:QGroupBox=None
335
350
  self.toggle_button:QPushButton=None
351
+ self.push_button:MyToolButton=None
336
352
 
337
353
  def setup(self,*args):
338
354
  if not self.initFlag:
@@ -344,15 +360,20 @@ class CollapsibleBox(QtWidgets.QWidget):
344
360
  self.stretch=0
345
361
  self.initFlag=True
346
362
 
363
+ if self.content_area is None:
364
+ self.content_area=self.findChild(QtWidgets.QGroupBox)
365
+ self.content_area.setStyleSheet("QGroupBox{border: 1px solid gray; border-radius: 6px;}")
366
+
347
367
  if self.toggle_button is None:
348
368
  self.toggle_button=self.findChild(QtWidgets.QToolButton)
349
- self.content_area=self.findChild(QtWidgets.QGroupBox)
350
- self.push_button=self.findChild(MyToolButton)
351
-
352
369
  self.toggle_button.setChecked(InitCheck)
353
370
  self.toggle_button.clicked.connect(self.on_click)
371
+ self.toggle_button.setCursor(QtCore.Qt.CursorShape.PointingHandCursor)
372
+ self.toggle_button.setMinimumWidth(self.toolMinimumWidth)
373
+
374
+ if self.push_button is None:
375
+ self.push_button=self.findChild(MyToolButton)
354
376
 
355
- self.content_area.setStyleSheet("QGroupBox{border: 1px solid gray; border-radius: 6px;}")
356
377
  self.OpenStyle=\
357
378
  "QToolButton { border: none; }\n"+\
358
379
  "QToolButton::hover{color: rgba(0,0,255,200);}"+\
@@ -362,8 +383,6 @@ class CollapsibleBox(QtWidgets.QWidget):
362
383
  "QToolButton { border: 1px solid lightgray; border-radius: 6px }\n"+\
363
384
  "QToolButton::hover{ border: 1px solid rgba(0,0,255,200); border-radius: 6px; color: rgba(0,0,255,200);}"+\
364
385
  "QToolButton::focus{ border: 1px solid rgba(0,0,255,200); border-radius: 6px; color: rgba(0,0,255,200);}" #background-color: rgba(0, 0,128,32); }"
365
- self.toggle_button.setCursor(QtCore.Qt.CursorShape.PointingHandCursor)
366
- self.toggle_button.setMinimumWidth(self.toolMinimumWidth)
367
386
 
368
387
  self.heightToogle=self.toggle_button.minimumHeight()
369
388
  self.heightOpened=self.minimumHeight()
@@ -663,13 +682,14 @@ class ClickableLabel(QLabel):
663
682
  def __init__(self, *args):
664
683
  super().__init__(*args)
665
684
 
666
-
667
685
  self.default_stylesheet = self.styleSheet()
668
686
  self.highlight_stylesheet = "background-color: #dcdcdc; border-radius: 3px;"
669
687
 
670
688
  self.timer = QTimer(self)
671
689
  self.timer.timeout.connect(self.resetHighlight)
672
690
  self.timer.setSingleShot(True)
691
+
692
+ self.moviePixmap=None
673
693
 
674
694
  def mousePressEvent(self, event):
675
695
  if event.button() == Qt.LeftButton and self.toolTip():
@@ -678,7 +698,9 @@ class ClickableLabel(QLabel):
678
698
  self.resetHighlight()
679
699
 
680
700
  def showMessageBox(self):
681
- warningDialog(self.window(),Message=self.toolTip(),pixmap=self.pixmap(),title='Info')
701
+ if self.moviePixmap: pixmap=self.moviePixmap
702
+ else: pixmap=self.pixmap()
703
+ warningDialog(self.window(),Message=self.toolTip(),pixmap=pixmap,title='Info')
682
704
 
683
705
  def highlight(self):
684
706
  self.setStyleSheet(self.highlight_stylesheet)
@@ -727,6 +749,46 @@ class CustomLineEdit(QLineEdit):
727
749
  else:
728
750
  super().keyReleaseEvent(event)
729
751
 
752
+ class ResizingLabel(QLabel):
753
+ def __init__(self,*args,**kwargs):
754
+ super().__init__(*args,**kwargs)
755
+ self.complete_text=self.text()
756
+
757
+ def setText(self,text):
758
+ self.complete_text=text
759
+ self.resizeText(text)
760
+ return
761
+
762
+ def resizeEvent(self, event: QResizeEvent) -> None:
763
+ super().resizeEvent(event)
764
+ self.resizeText(self.text())
765
+ return
766
+
767
+ def resizeText(self,text):
768
+ text=self.complete_text
769
+ metrics = QFontMetrics(self.font())
770
+ if self.alignment() & Qt.AlignmentFlag.AlignRight:
771
+ FlagRight=True
772
+ textElideMode=Qt.TextElideMode.ElideLeft
773
+ else:
774
+ FlagRight=False
775
+ textElideMode=Qt.TextElideMode.ElideRight
776
+ if "<span" in text:
777
+ match = re.search(r"<span(.*?)</span>", text)
778
+ html_part = "<span"+match.group(1)+"</span>"
779
+ index = match.start(1)-5
780
+ text_without_bullet=text.replace(html_part,'')
781
+ truncated_text=metrics.elidedText(text_without_bullet, textElideMode, self.width()-5)
782
+ if FlagRight:
783
+ index=len(truncated_text)-3*(int('...' in truncated_text))-len(text_without_bullet[index:])
784
+ if index>0:
785
+ truncated_text=truncated_text[:index]+html_part+truncated_text[index:]
786
+ elif index>len(truncated_text)-3:
787
+ truncated_text=truncated_text[:index]+html_part+truncated_text[index:]
788
+ else:
789
+ truncated_text = metrics.elidedText(text, textElideMode, self.width())
790
+ super().setText(truncated_text)
791
+
730
792
  class EditableLabel(QWidget):
731
793
  def __init__(self, parent=None):
732
794
  super().__init__(parent)
@@ -735,7 +797,7 @@ class EditableLabel(QWidget):
735
797
  self.main_layout.setContentsMargins(0,0,0,0)
736
798
  self.main_layout.setSpacing(0)
737
799
 
738
- self.label = QLabel(self)
800
+ self.label = ResizingLabel(self)
739
801
  self.label.setAlignment(Qt.AlignmentFlag.AlignLeft)
740
802
  self.label.mouseDoubleClickEvent = self.enable_editing
741
803
 
@@ -745,6 +807,7 @@ class EditableLabel(QWidget):
745
807
  self.edit.editingFinished.connect(self.disable_editing)
746
808
  self.edit.cancelEditing.connect(self.disable_editing)
747
809
  self.updateLabel=lambda: None
810
+ self.bullet=''
748
811
 
749
812
  self.installEventFilter(self) # Installare il filtro eventi
750
813
 
@@ -762,7 +825,7 @@ class EditableLabel(QWidget):
762
825
  def enable_editing(self, event):
763
826
  self.label.hide()
764
827
  self.edit.setGeometry(self.label.geometry()) # Assicurati che l'editor prenda la posizione della label
765
- self.edit.setText(self.label.text()) # Assicurati che il testo corrente venga impostato nell'editor
828
+ self.edit.setText(self.label.text().replace(self.bullet,'')) # Assicurati che il testo corrente venga impostato nell'editor
766
829
  self.edit.selectAll()
767
830
  self.edit.show()
768
831
  self.window().setFocus()
@@ -774,7 +837,7 @@ class EditableLabel(QWidget):
774
837
  self.label.show()
775
838
  self.updateLabel()
776
839
 
777
-
840
+
778
841
  #********************************************* Matplotlib
779
842
  import io
780
843
  import matplotlib as mpl
@@ -804,6 +867,17 @@ class MplCanvas(FigureCanvasQTAgg):
804
867
  #clrgb=[int(i*255) for i in color_tuple]
805
868
  self.fig.set_facecolor(color_tuple)
806
869
 
870
+ self.copyIcon=QIcon(icons_path+"copy.png")
871
+ self.openNewWindowIcon=QIcon(icons_path+"open_new_window.png")
872
+ self.scaleDownIcon=QIcon(icons_path+"scale_down.png")
873
+ self.scaleUpIcon=QIcon(icons_path+"scale_up.png")
874
+ self.scaleAllIcon=QIcon(icons_path+"scale_all.png")
875
+ self.showAllIcon=QIcon(icons_path+"show_all.png")
876
+ self.alignAllIcon=QIcon(icons_path+"align_all.png")
877
+ self.closeAllIcon=QIcon(icons_path+"close_all.png")
878
+ self.loadImageIcon=QIcon(icons_path+"open_image.png")
879
+ self.loadResultIcon=QIcon(icons_path+"open_result.png")
880
+
807
881
  super(MplCanvas, self).__init__(self.fig)
808
882
 
809
883
  def mouseReleaseEvent(self, event):
@@ -863,7 +937,7 @@ class MplCanvas(FigureCanvasQTAgg):
863
937
  fig2.scaleFactor=min([fig2.scaleFactor,1.5])
864
938
  fig2.scaleFactor=max([fig2.scaleFactor,0.5])
865
939
  fig2.setFixedSize(s0*fig2.scaleFactor)
866
- lbl.setPixmap(pixmap.scaled(pixmap.size()*fig2.scaleFactor))
940
+ lbl.setPixmap(pixmap.scaled(pixmap.size()*fig2.scaleFactor,mode=Qt.TransformationMode.SmoothTransformation))
867
941
  return
868
942
  fig2.resizeFig2=resizeFig2
869
943
 
@@ -923,7 +997,17 @@ class MplCanvas(FigureCanvasQTAgg):
923
997
  showAll = contextMenu.addAction("Show all ("+QS_showAll.key().toString(QKeySequence.NativeText)+")")
924
998
  alignAll = contextMenu.addAction("Align all ("+QS_alignAll.key().toString(QKeySequence.NativeText)+")")
925
999
  closeAll = contextMenu.addAction("Close all ("+QS_closeAll.key().toString(QKeySequence.NativeText)+")")
1000
+
1001
+ copy2clipboard.setIcon(self.copyIcon)
1002
+ scaleDown.setIcon(self.scaleDownIcon)
1003
+ scaleUp.setIcon(self.scaleUpIcon)
1004
+ scaleAll.setIcon(self.scaleAllIcon)
1005
+ showAll.setIcon(self.showAllIcon)
1006
+ alignAll.setIcon(self.alignAllIcon)
1007
+ closeAll.setIcon(self.closeAllIcon)
1008
+
926
1009
  action = contextMenu.exec(fig2.mapToGlobal(event.pos()))
1010
+
927
1011
  if action == copy2clipboard:
928
1012
  fCopy2clipboard()
929
1013
  elif action == scaleDown:
@@ -1014,33 +1098,36 @@ def setAppGuiPalette(self:QWidget,palette:QPalette=None):
1014
1098
  else:
1015
1099
  applic.setPalette(palette)
1016
1100
 
1017
- if self.focusWidget():
1018
- self.focusWidget().clearFocus()
1019
- widgets=[self]
1020
- if hasattr(self,'FloatingTabs'): widgets+=self.FloatingTabs
1021
- if hasattr(self,'FloatingWindows'): widgets+=self.FloatingWindows
1022
- if hasattr(self,'aboutDialog'): widgets.append(self.aboutDialog)
1023
- if hasattr(self,'logChanges'): widgets.append(self.logChanges)
1024
- widgets+=self.findChildren(QDialog)
1025
- for f in widgets:
1026
- if f:
1027
- f.setPalette(palette)
1028
- for c in f.findChildren(QObject):
1029
- if hasattr(c,'setPalette') and not type(c) in (MplCanvas, mplFigure, QStatusBar):
1030
- c.setPalette(palette)
1031
- if hasattr(c,'initialStyle'):
1032
- c.setStyleSheet(c.initialStyle)
1033
- for c in f.findChildren(QObject):
1034
- c:MyQLineEdit
1035
- if hasattr(c,'setup'):
1036
- c.initFlag=False
1037
- c.styleFlag=False
1038
- c.setup()
1039
- for c in f.findChildren(QObject):
1040
- if hasattr(c,'setup2'):
1041
- c.initFlag2=False
1042
- c.setup2()
1043
- if hasattr(self,'ResizePopup'):
1044
- if self.ResizePopup is not None:
1045
- self.ResizePopup=type(self.ResizePopup)(self.buttonSizeCallbacks) #non riesco a farlo come gli altri
1046
- if hasattr(self,'w_Vis'): self.w_Vis.addPlotToolBar()
1101
+ try:
1102
+ if self.focusWidget():
1103
+ self.focusWidget().clearFocus()
1104
+ widgets=[self]
1105
+ if hasattr(self,'FloatingTabs'): widgets+=self.FloatingTabs
1106
+ if hasattr(self,'FloatingWindows'): widgets+=self.FloatingWindows
1107
+ if hasattr(self,'aboutDialog'): widgets.append(self.aboutDialog)
1108
+ if hasattr(self,'logChanges'): widgets.append(self.logChanges)
1109
+ widgets+=self.findChildren(QDialog)
1110
+ for f in widgets:
1111
+ if f and isinstance(f, QWidget):
1112
+ f.setPalette(palette)
1113
+ for c in f.findChildren(QObject):
1114
+ if hasattr(c,'setPalette') and not isinstance(c, (MplCanvas, mplFigure, QStatusBar)):
1115
+ c.setPalette(palette)
1116
+ if hasattr(c,'initialStyle') and hasattr(c, 'setStyleSheet'):
1117
+ c.setStyleSheet(c.initialStyle)
1118
+ for c in f.findChildren(QObject):
1119
+ c:MyQLineEdit
1120
+ if isinstance(c, MyQLineEdit) and hasattr(c, 'setup'):
1121
+ c.initFlag=False
1122
+ c.styleFlag=False
1123
+ c.setup()
1124
+ for c in f.findChildren(QObject):
1125
+ if hasattr(c,'setup2'):
1126
+ c.initFlag2=False
1127
+ c.setup2()
1128
+ if hasattr(self,'ResizePopup'):
1129
+ if self.ResizePopup is not None:
1130
+ self.ResizePopup=type(self.ResizePopup)(self.buttonSizeCallbacks) #non riesco a farlo come gli altri
1131
+ if hasattr(self,'w_Vis'): self.w_Vis.addPlotToolBar()
1132
+ except:
1133
+ pri.Error.red("***** Error while setting the application palette! *****")
PaIRS_UniNa/calib.py CHANGED
@@ -218,7 +218,7 @@ class Calib(PaIRS_lib.PyFunOutCalib):
218
218
  def findPlaneFrom3Points(self,plane=0,op=0):
219
219
  ''' ask the user to input the 3 points and then finds the spots in the plane'''
220
220
  try:
221
- #pri.General.magenta(plane)
221
+ #pri.Info.magenta(plane)
222
222
  self.resetFindPlane(plane)
223
223
  for i in range (3):
224
224
  self.signals.textFromCalib.emit(f'Select the {self.pointDesc[i]} point')
@@ -285,7 +285,7 @@ class Calib(PaIRS_lib.PyFunOutCalib):
285
285
  if flagPlane:# the points have not been found
286
286
 
287
287
  if flagPlane & CalFlags.PLANE_ORIGIN_NOT_FOUND: # no origin error code
288
- #pri.General.red('getFlagPlane-> searching????')
288
+ #pri.Info.red('getFlagPlane-> searching????')
289
289
  err=-1
290
290
  return err
291
291
  try:
@@ -445,10 +445,13 @@ class Calib(PaIRS_lib.PyFunOutCalib):
445
445
  try:
446
446
  pri.Process.blue ('calibrating ')
447
447
  self.signals.textFromCalib.emit('calibrating ')
448
+ pri.Info.white(f'init calibration {self.cal.flagCalibrated}')
448
449
  self.cal.calibrate(self.funCalib)
450
+
449
451
  while self.cal.flagWorking==2:# and not self.isKilled:
450
452
  timesleep(sleepTimeWorkers)
451
- self.cal.checkCalibration()
453
+ pri.Info.white(f'end calibration {self.cal.flagCalibrated}')
454
+ self.cal.checkCalibration() #needed because use the main thread and may exit with an exception
452
455
  self.FlagCalibration=True
453
456
  self.cal.saveCfg (0,self.cfgName)
454
457
 
PaIRS_UniNa/calibView.py CHANGED
@@ -2,7 +2,7 @@
2
2
  # pylint: disable=pointless-string-statement, too-many-instance-attributes, no-name-in-module, multiple-imports
3
3
  # pylint: disable= import-error
4
4
  # pylint: disable=multiple-statements,c-extension-no-member
5
- import sys #, traceback
5
+ import sys, traceback
6
6
  from typing import Callable
7
7
  from enum import Enum
8
8
  #import faulthandler # per capire da dove vengono gli errori c
@@ -280,7 +280,7 @@ class CalibView(QLabel):
280
280
  if flagPlot and not self.calib.flagPlotMask:
281
281
  self.drawCircles(plane)
282
282
  except Exception as inst:
283
- pri.Error.red(f'plotePlane call: error while plotting image\n{inst}')
283
+ pri.Error.red(f'plotePlane call: error while plotting image\n{traceback.format_exc()}')
284
284
  #XY=self.calib.cal.pointFromCalib([0,0,0],0)
285
285
  #pri.Info.green(f"Punto (x,y,z)=(0,0,0) -> (X,Y)=({XY.x},{XY.y})")
286
286
  #self.outToStatusBarCaller(f'Cam#:{self.calib.plane//self.calib.nPlanesPerCam} Plane:{self.calib.plane%self.calib.nPlanesPerCam}')
@@ -357,6 +357,7 @@ class CalibView(QLabel):
357
357
  LMax=max([min([a.max(),LLim]),-LLim+1])
358
358
  if not LMin:
359
359
  LMin=max([min([a.min(),LMax-1]),-LLim])
360
+ LMin=max([0,LMin])
360
361
  LMax=max([LMin+1,LMax])
361
362
  a[a>LMax]=LMax
362
363
  a[a<LMin]=LMin
@@ -498,6 +499,9 @@ class CalibView(QLabel):
498
499
  ''' draw arrow from x1 to x scaled with l'''
499
500
  dx=(x-x1)*l
500
501
  dy=(y-y1)*l
502
+ if abs(dx)>10**6 or abs(dy)>10**6:
503
+ dx=10**3
504
+ dy=10**3
501
505
  x2=x1+dx
502
506
  y2=y1+dy
503
507
  painter.drawLine(x1,y1,x2,y2)
@@ -531,15 +535,15 @@ class CalibView(QLabel):
531
535
  puOr=Punto(calVect.XOr[p],calVect.YOr[p])
532
536
  ind=0
533
537
  #puOr=Punto(out.X[p,ii], out.Y[p,ii])
534
- #for pp in range (0,self.calib.cal.data.Numpiani): pri.General.green(out.X[pp,ii], out.Y[pp,ii])
535
- #pri.General.green(f'Or=({out.X[p,iOr]}, {out.Y[p,iOr]}) x=({out.X[p,ii]}, {out.Y[p,ii]}) y=({out.X[p,iOr+1]}, {out.Y[p,iOr+1]})')
538
+ #for pp in range (0,self.calib.cal.data.Numpiani): pri.Info.green(out.X[pp,ii], out.Y[pp,ii])
539
+ #pri.Info.green(f'Or=({out.X[p,iOr]}, {out.Y[p,iOr]}) x=({out.X[p,ii]}, {out.Y[p,ii]}) y=({out.X[p,iOr+1]}, {out.Y[p,iOr+1]})')
536
540
 
537
541
 
538
542
  if flagDrawCircles:
539
543
  r=rInpCircle
540
544
  def pCir(X:float, Y:float,r:float):
541
545
  painter.drawRoundedRect(X-r, Y-r,2*r,2*r,r,r)
542
- #pri.General.green(X,Y)
546
+ #pri.Info.green(X,Y)
543
547
  pen.setColor(QtGui.QColor(mainInCircleColors[ind]))
544
548
  painter.setPen(pen)
545
549
  pCir(puOr.x,puOr.y,r)
@@ -621,7 +625,9 @@ class CalibView(QLabel):
621
625
  if self.calib.cal.flagCalibrated:
622
626
  data=self.calib.cal.data
623
627
  for i in indOk:
624
- self.drawArrow(painter,lunFreccia,calVect.X[p,i], calVect.Y[p,i],calVect.Xc[p,i]-data.ColPart, calVect.Yc[p,i]-data.RigaPart)
628
+ x=float(calVect.Xc[p,i]-data.ColPart)
629
+ y=float(calVect.Yc[p,i]-data.RigaPart)
630
+ self.drawArrow(painter,lunFreccia,calVect.X[p,i], calVect.Y[p,i],x,y)
625
631
  if p==data.kMax:
626
632
  pen.setColor(QtGui.QColor(maxErrorCircleColor))
627
633
  painter.setPen(pen)
@@ -723,6 +729,13 @@ class CalibView(QLabel):
723
729
  else:
724
730
  calVect.remPointsDo[p]=Off
725
731
  self.calib.cal.removeBulk()
732
+ if self.calib.cal.flagCalibrated:
733
+ self.calib.cal.checkCalibration() #needed because use the main thread and may exit with an exception
734
+ strPriCalib=self.calib.prettyPrintCalib()
735
+ strPriErrCalib=self.calib.prettyPrintErrCalib()
736
+ pri.Process.blue (strPriErrCalib)
737
+
738
+ self.calib.signals.textFromCalib.emit(strPriErrCalib+'\n'+strPriCalib)
726
739
  self.plotPlane(self.calib.plane)
727
740
 
728
741
  @Slot(int)