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
PaIRS_UniNa/TabTools.py CHANGED
@@ -27,10 +27,10 @@ class TABpar:
27
27
  self.flagRun=0 #0:not launched yet, 1:completed, -1:interrupted, -2:running
28
28
  self.link=[]
29
29
 
30
+ self.parFields=[f for f,_ in self.__dict__.items() if f not in self.uiFields ]
30
31
  self.uncopied_fields=['tip']
31
32
  self.unchecked_fields=['name','surname','parentTab']+self.uncopied_fields
32
- self.parFields=[f for f,_ in self.__dict__.items() if f not in self.uiFields ]
33
-
33
+
34
34
  self.OptionDone=1
35
35
  self.warningMessage=''
36
36
 
@@ -76,7 +76,7 @@ class TABpar:
76
76
  else:
77
77
  self.copyfromfields(newist,self.fields,exceptions)
78
78
 
79
- def copyfromfields(self,newist,fields,exceptions=None):
79
+ def copyfromfields(self,newist,fields=None,exceptions=None):
80
80
  """
81
81
  exceptions=[] --> no exceptions
82
82
  """
@@ -136,9 +136,9 @@ class TABpar:
136
136
  break
137
137
  if FlagPrint:
138
138
  if Flag:
139
- pri.Callback.red(f'{self.name} is different in {f}:\t {b} --> {a}')
139
+ pri.TABparDiff.red(f'{self.name} is different in {f}:\t {b} --> {a}')
140
140
  else:
141
- pri.Callback.green(f'{self.name} is unchanged')
141
+ pri.TABparDiff.green(f'{self.name} is unchanged')
142
142
  return Flag
143
143
 
144
144
  def isEqualTo(self,v,exceptions=[],fields=[],FlagStrictDiff=False,FlagPrint=False):
@@ -151,7 +151,8 @@ class TABpar:
151
151
  fields=self.fields
152
152
  else:
153
153
  [exceptions.remove(f) for f in fields if f in exceptions]
154
- df=''
154
+ printing=''
155
+ df=[]
155
156
  for f in fields:
156
157
  if f in exceptions: continue
157
158
  if not hasattr(self,f):
@@ -176,11 +177,13 @@ class TABpar:
176
177
  else:
177
178
  if a!=b: Flag=True
178
179
  if Flag:
179
- if not df: df=f'{self.name} differences in:'
180
- df=df+f'\n*\t{f}:\t {str(a)[:100]} --> {str(b)[:100]}'
181
- if not df: df=f'{self.name} no differences!'
182
- pri.Info.magenta(df)
183
-
180
+ df.append(f)
181
+ if not printing: printing=f'{self.name} differences in:'
182
+ printing=printing+f'\n*\t{f}:\t {str(a)[:100]} --> {str(b)[:100]}'
183
+ if not printing: printing=f'{self.name} no differences!'
184
+ pri.Info.magenta(printing)
185
+ return df
186
+
184
187
  def hasIndexOf(self,d):
185
188
  """ check if the indexes are the same """
186
189
  return self.ind==d.ind
@@ -198,7 +201,15 @@ class gPaIRS_Tab(QWidget):
198
201
 
199
202
  def __init__(self,parent=None,UiClass=None,ParClass=TABpar):
200
203
  super().__init__()
201
-
204
+ from .gPaIRS import gPaIRS
205
+ if parent is None:
206
+ self.gui=self.window()
207
+ else:
208
+ if hasattr(parent,'gui'):
209
+ self.gui:gPaIRS=parent.gui
210
+ else:
211
+ self.gui:gPaIRS=parent.window()
212
+
202
213
  self.TABname='Tab'
203
214
  self.signals=self.Tab_Signals(self)
204
215
  self.father=parent
@@ -223,6 +234,8 @@ class gPaIRS_Tab(QWidget):
223
234
 
224
235
  self.adjustTABpar=lambda: None
225
236
  self.setTABlayout=lambda: None
237
+ self.checkTABpar=lambda ind: None
238
+ self.setTABwarn=lambda ind: None
226
239
  self.setTABpar_bridge=lambda fLagAdjustPar, flagCallback: None
227
240
  self.add_TABpar_bridge=lambda tip, ind: None
228
241
 
@@ -240,6 +253,11 @@ class gPaIRS_Tab(QWidget):
240
253
  else:
241
254
  self.name_tab=''
242
255
 
256
+
257
+ #------------------------------------- Graphical interface: miscellanea
258
+ self.pixmap_warnc = QPixmap(u""+ icons_path +"warning_circle.png")
259
+ self.pixmap_done = QPixmap(u""+ icons_path +"completed.png")
260
+
243
261
  self.undo_icon=QIcon()
244
262
  self.undo_icon.addFile(u""+ icons_path +"undo.png", QSize(), QIcon.Normal, QIcon.Off)
245
263
  self.redo_icon=QIcon()
@@ -252,6 +270,8 @@ class gPaIRS_Tab(QWidget):
252
270
  setattr(self.ui,'button_forward',QPushButton(self))
253
271
  else:
254
272
  self.ui.button_forward.contextMenuEvent=lambda e: self.bfContextMenu(+1,e)
273
+ if not hasattr(self.ui,'button_restore_undo'):
274
+ setattr(self.ui,'button_restore_undo',QPushButton(self))
255
275
  if not hasattr(self.ui,'label_number'):
256
276
  setattr(self.ui,'label_number',QLabel(self))
257
277
  if hasattr(self.ui,'button_close_tab'):
@@ -259,12 +279,14 @@ class gPaIRS_Tab(QWidget):
259
279
  b.setCursor(Qt.CursorShape.PointingHandCursor)
260
280
  self.onlyReadLabel:QLabel=None
261
281
  self.button_reset_step:QPushButton=None
282
+ self.button_step_inherit:QPushButton=None
262
283
  self.button_copy_step:QPushButton=None
263
284
  self.button_link_step:QPushButton=None
264
285
 
265
286
  self.FlagDisplayControls=True #if False, undo and redo buttons are hidden and so not usable
266
287
  self.ui.button_forward.hide()
267
288
  self.ui.button_back.hide()
289
+ self.ui.button_restore_undo.hide()
268
290
  self.ui.button_back.clicked.connect(self.button_back_action)
269
291
  self.ui.button_forward.clicked.connect(self.button_forward_action)
270
292
  self.ui.label_number.setText('')
@@ -277,8 +299,8 @@ class gPaIRS_Tab(QWidget):
277
299
 
278
300
  self.spins_valueChanged=[]
279
301
 
280
- self.nullCallback=lambda f='Null Callback':self.wrappedCallback(f,lambda: True)()
281
- self.fullCallback=self.wrappedCallback('Full Callback',lambda: None)
302
+ self.nullCallback=lambda f='Null Callback': self.wrappedCallback(f,lambda: True)()
303
+ self.fullCallback=lambda f='Full Callback': self.wrappedCallback(f,lambda: None)()
282
304
 
283
305
  #*************************************************** Widgets
284
306
  def defineWidgets(self):
@@ -293,7 +315,7 @@ class gPaIRS_Tab(QWidget):
293
315
  'spin': wDict([MyQSpin,MyQDoubleSpin],['addfuncout','addfuncreturn']),
294
316
  'check': wDict([QCheckBox],['toggled']),
295
317
  'radio': wDict([QRadioButton],['toggled']),
296
- 'line_edit': wDict([QLineEdit,MyQLineEdit,MyQLineEditNumber],['returnPressed']),
318
+ 'line_edit': wDict([QLineEdit,MyQLineEdit,MyQLineEditNumber],['addfuncout','returnPressed']),
297
319
  'button' : wDict([QPushButton,QToolButton,MyToolButton],['clicked']),
298
320
  'combo' : wDict([QComboBox],['activated']),
299
321
  }
@@ -478,25 +500,63 @@ class gPaIRS_Tab(QWidget):
478
500
  try:
479
501
  TABpar_ind=self.TABpar_at(self.TABpar.ind)
480
502
  if TABpar_ind and self.TABpar.isEqualTo(TABpar_ind,FlagStrictDiff=True): return
481
- FlagNewPar=self.isNewPar() and self.FlagAddPrev
482
- if FlagNewPar and (self.TABpar.flagRun!=0 or len(self.TABpar.link)>0):
503
+ FlagNewPar=self.isNewPar()
504
+ flagRun=self.TABpar_at(self.TABpar.ind).flagRun
505
+ if FlagNewPar and (flagRun!=0 or len(self.TABpar.link)>0):
483
506
  #FlagNewPar=not self.FlagAddPrev
484
- self.TABpar.copyfrom(TABpar_ind)
485
- originalStyleSheet=self.window().styleSheet()
486
- self.window().setStyleSheet(f'background: {self.palette().color(QPalette.ColorRole.Text).name()} ;') #dcdcdc
487
- self.repaint()
488
- try:
489
- self.setTABpar(FlagAdjustPar=False,FlagBridge=False,FlagCallback=True)
490
- finally:
491
- self.window().setStyleSheet(originalStyleSheet)
507
+ if len(self.TABpar.link)>0:
508
+ ITE0_master=self.gui.ui.Explorer.ITEsfromInd(self.TABpar.link)[0]
509
+ linkInfo=f'{ITE0_master.ind[2]+1}: {ITE0_master.name}'
510
+ Messagge=f'This process step is linked to process {linkInfo}. To modify it, you need to unlink the process step.'
511
+ if flagRun!=0 or ITE0_master.flagRun!=0:
512
+ Messagge+=' After unlinking the process will be reset!'
513
+ def unlink_pars_online():
514
+ TABpar_ind.copyfrom(self.TABpar)
515
+ self.gui.unlink_pars(self.TABpar.ind)
516
+ if self.TABpar.flagRun!=0 or ITE0_master.flagRun!=0:
517
+ self.gui.reset_step(self.TABpar.ind)
518
+ warningDialog(self.gui,Messagge,addButton={'Unlink step!': unlink_pars_online})
519
+ elif flagRun==-10:
520
+ Messagge='This process step is in the queue for process execution. To modify it, you need to stop processing and then reset it and all the subsequent steps.'
521
+ warningDialog(self.gui,Messagge)
522
+ elif flagRun==-2:
523
+ Messagge='This process step is currently in execution. To modify it, you need to stop processing and then reset it and all the subsequent steps.'
524
+ warningDialog(self.gui,Messagge)
525
+ elif flagRun!=0:
526
+ if self.gui.FlagRun:
527
+ Messagge='This process step has already been executed. To modify it, you need to stop processing and then reset it and all the subsequent steps.'
528
+ warningDialog(self.gui,Messagge)
529
+ else:
530
+ Messagge='This process step has already been executed. To modify it, you need to reset the current step and all the subsequent ones.'
531
+ def reset_step_online():
532
+ TABpar_ind.copyfrom(self.TABpar)
533
+ self.gui.reset_step(self.TABpar.ind)
534
+ return
535
+ warningDialog(self.gui,Messagge,addButton={'Reset step!': reset_step_online})
536
+
537
+
538
+ if flagRun!=0 or len(self.TABpar.link)>0:
539
+ self.TABpar.copyfrom(TABpar_ind)
540
+ originalStyleSheet=self.gui.styleSheet()
541
+ self.gui.setStyleSheet(f'background: {self.palette().color(QPalette.ColorRole.Text).name()} ;') #dcdcdc
542
+ self.repaint()
543
+ try:
544
+ self.setTABpar(FlagAdjustPar=False,FlagBridge=False,FlagCallback=False)
545
+ finally:
546
+ timesleep(.01)
547
+ self.gui.setStyleSheet(originalStyleSheet)
548
+ else:
549
+ return
492
550
  else:
493
551
  self.setTABpar(FlagAdjustPar=True,FlagBridge=self.FlagBridge,FlagCallback=True)
494
552
  except:
495
553
  pri.Error.red(f'Error in callback2_end ({tip}):\n |-> Error in setting the parameters')
554
+ pri.Error.red(f'{traceback.format_exc()}')
496
555
  printException()
497
556
  else:
498
557
  try:
499
- self.add_TABpar(tip, FlagNewPar and not FlagPreventAddPrev and self.TABpar.flagRun==0 and len(self.TABpar.link)==0)
558
+ FlagNewPar=FlagNewPar and not FlagPreventAddPrev and self.TABpar.flagRun==0 and len(self.TABpar.link)==0
559
+ self.add_TABpar(tip,FlagNewPar)
500
560
  except:
501
561
  pri.Error.red(f'Error in callback2_end ({tip}):\n |-> Error in adding parameters to redos/undos {tip}')
502
562
  printException()
@@ -594,26 +654,35 @@ class gPaIRS_Tab(QWidget):
594
654
  self.TABsettings[-1]()
595
655
  c.focusOutEvent=focusOutEvent
596
656
 
597
-
598
- def setTABpar(self,FlagAdjustPar=True,FlagBridge=True,FlagCallback=False):
599
- if self.TABpar.FlagNone: return
657
+ def setTABpar(self,FlagAdjustPar=True,FlagBridge=True,FlagCallback=False,FlagDisplayControls=None):
658
+ if self.TABpar.FlagNone and self.TABpar_at(self.TABpar.ind) is None: return
600
659
  pri.Coding.magenta(f' --- setting {self.TABpar.name} {self.TABpar.ind}')
660
+
601
661
  self.FlagSettingPar=True
662
+ FlagSettingPar=TABpar.FlagSettingPar
663
+ TABpar.FlagSettingPar=True
664
+
602
665
  if FlagAdjustPar:
603
666
  self.adjustTABpar()
604
667
 
605
668
  self.setTABlayout()
606
669
  for f in self.TABsettings:
607
670
  f()
671
+ #self.TABpar_old.copyfrom(self.TABpar)
608
672
  self.TABpar.FlagInit=True
609
- FlagSettingPar=TABpar.FlagSettingPar
610
- TABpar.FlagSettingPar=True
673
+
611
674
  if FlagBridge:
612
675
  self.setTABpar_bridge(FlagAdjustPar,FlagCallback)
613
- TABpar.FlagSettingPar=FlagSettingPar
676
+
614
677
  self.TABpar_old.copyfrom(self.TABpar)
615
- self.display_controls()
678
+
679
+ if FlagDisplayControls is None: FlagDisplayControls=not FlagBridge
680
+ if FlagDisplayControls:
681
+ self.display_controls()
682
+
683
+ TABpar.FlagSettingPar=FlagSettingPar
616
684
  self.FlagSettingPar=False
685
+
617
686
  if not FlagCallback:
618
687
  self.adjustTABparInd()
619
688
 
@@ -636,6 +705,11 @@ class gPaIRS_Tab(QWidget):
636
705
  font.setPixelSize(fPixSize_TabNames)
637
706
  lab.setFont(font)
638
707
 
708
+ def setTABWarnLabel(self):
709
+ self.ui.name_tab.setFixedWidth(self.ui.name_tab.sizeHint().width())
710
+ self.ui.label_done.setPixmap(self.pixmap_done if self.TABpar.OptionDone==1 else self.pixmap_warnc)
711
+ self.ui.label_done.setToolTip(self.TABpar.warningMessage)
712
+
639
713
  #*************************************************** Undo/redo
640
714
  def adjustTABparInd(self):
641
715
  TABpar_ind=self.TABpar_at(self.TABpar.ind)
@@ -694,7 +768,7 @@ class gPaIRS_Tab(QWidget):
694
768
 
695
769
  def TABpar_at(self,ind):
696
770
  if ind[0]<len(self.TABpar_prev):
697
- p=self.TABpar_prev[ind[0]]
771
+ p:TABpar=self.TABpar_prev[ind[0]]
698
772
  else:
699
773
  p=None
700
774
  if p:
@@ -707,18 +781,26 @@ class gPaIRS_Tab(QWidget):
707
781
  return p
708
782
 
709
783
  def TABpar_prev_at(self,ind):
710
- p:TABpar=self.TABpar_prev[ind[0]]
711
- for i in range(1,len(ind)-1):
712
- p=p[ind[i]]
713
- return p
784
+ if len(self.TABpar_prev)-1<ind[0]:
785
+ return []
786
+ else:
787
+ p:TABpar=self.TABpar_prev[ind[0]]
788
+ for i in range(1,len(ind)-1):
789
+ if len(p)-1<ind[i]:
790
+ p=[]
791
+ break
792
+ else:
793
+ p=p[ind[i]]
794
+ return p
714
795
 
715
796
  def isNewPar(self):
716
797
  ind=self.TABpar.ind
717
798
  TABpar_prev=self.TABpar_prev_at(ind)
718
799
  if len(TABpar_prev)>0:
719
- FlagNewPar=not self.FlagAddPrev or self.TABpar.isDifferentFrom(TABpar_prev[-1],exceptions=self.TABpar.unchecked_fields+['ind']) #see below
800
+ FlagNewPar=self.FlagAddPrev and self.TABpar.isDifferentFrom(TABpar_prev[-1],exceptions=self.TABpar.unchecked_fields+['ind']) #see below
801
+ self.TABpar.printDifferences(TABpar_prev[-1],exceptions=self.TABpar.unchecked_fields+['ind'])
720
802
  else:
721
- FlagNewPar=not self.FlagAddPrev
803
+ FlagNewPar=self.FlagAddPrev
722
804
  return FlagNewPar
723
805
 
724
806
  def add_TABpar(self,tip,FlagNewPar=True):
@@ -739,6 +821,7 @@ class gPaIRS_Tab(QWidget):
739
821
  p:TABpar
740
822
  p.copyfrom(TABpar_prev[self.TABpar.ind[-1]],exceptions=['ind','tip'])
741
823
  #pri.Time.blue('Propagation par end')
824
+ return ind
742
825
 
743
826
  def add_TABpar_copy(self,name,ind):
744
827
  TABpar_prev:list=self.TABpar_prev_at(ind)
@@ -763,33 +846,68 @@ class gPaIRS_Tab(QWidget):
763
846
 
764
847
  def display_controls(self):
765
848
  if not self.FlagDisplayControls: return
766
- self.ui.button_back.setVisible(self.TABpar.flagRun==0 and len(self.TABpar.link)==0)
767
- self.ui.button_forward.setVisible(self.TABpar.flagRun==0 and len(self.TABpar.link)==0)
849
+ FlagVisible=self.TABpar.flagRun==0 and len(self.TABpar.link)==0
850
+ self.ui.button_restore_undo.setVisible(FlagVisible)
851
+ self.ui.button_back.setVisible(FlagVisible)
852
+ self.ui.button_forward.setVisible(FlagVisible)
853
+ lprev=len(self.TABpar_prev_at(self.TABpar.ind))
768
854
  if self.onlyReadLabel:
769
855
  if len(self.TABpar.link)==0:
770
- self.onlyReadLabel.setText('Read-only')
771
- self.button_link_step.setToolTip('Link current process step to another in the same project.')
856
+ if lprev:
857
+ ITE0=self.gui.ui.Explorer.ITEsfromInd(self.TABpar.ind)[0]
858
+ if ITE0.flagRun==0:
859
+ self.onlyReadLabel.setText('')
860
+ else:
861
+ self.onlyReadLabel.setText('read-only')
862
+ else:
863
+ self.onlyReadLabel.setText('')
864
+ self.button_link_step.setToolTip('Link current process step to another in the same project')
865
+ self.button_link_step.setIcon(self.icon_link)
866
+ self.gui.RCLbar.buttonData[3]['name']='Link step to...'
772
867
  else:
773
- if hasattr(self.window(),'ui') and hasattr(self.window().ui,'Explorer'):
774
- ITE0_master=self.window().ui.Explorer.ITEsfromInd(self.TABpar.link)[0]
775
- linkInfo=f'Linked to {ITE0_master.name} (process # {ITE0_master.ind[2]+1})'
868
+ if hasattr(self.gui,'ui') and hasattr(self.gui.ui,'Explorer'):
869
+ ITE0_master=self.gui.ui.Explorer.ITEsfromInd(self.TABpar.link)[0]
870
+ linkInfo=f'linked to {ITE0_master.ind[2]+1}: {ITE0_master.name}'
776
871
  self.onlyReadLabel.setText(linkInfo)
777
872
  else:
778
- self.onlyReadLabel.setText('Read-only')
779
- self.button_link_step.setToolTip('Unlink current process.')
873
+ self.onlyReadLabel.setText('')
874
+ self.button_link_step.setToolTip('Unlink current process step')
875
+ self.button_link_step.setIcon(self.icon_unlink)
876
+ self.gui.RCLbar.buttonData[3]['name']='Unlink step'
780
877
  self.button_link_step.setStatusTip(self.button_link_step.toolTip())
781
878
  self.button_link_step.setChecked(len(self.TABpar.link)!=0)
782
- if self.onlyReadLabel:
783
- self.onlyReadLabel.setVisible(self.TABpar.flagRun!=0 or len(self.TABpar.link)>0)
784
- self.button_reset_step.setVisible(self.TABpar.flagRun not in (0,-2) and len(self.TABpar.link)==0)
785
- self.button_copy_step.setVisible(self.TABpar.flagRun==0 and len(self.TABpar.link)==0)
786
- self.button_link_step.setVisible(self.TABpar.flagRun==0)
879
+
880
+ if self.gui.ui.Explorer.TREpar.step is None:
881
+ FlagProcessTree=False
882
+ else:
883
+ FlagProcessTree=self.gui.ui.Explorer.currentTree==self.gui.ui.Explorer.processTree and self.gui.ui.Explorer.TREpar.step>0
884
+ FlagLabel=(self.TABpar.flagRun!=0 and len(self.TABpar.link)==0) or len(self.TABpar.link)>0
885
+ FlagReset=self.TABpar.flagRun!=0 and len(self.TABpar.link)==0
886
+ FlagInherit=self.TABpar.flagRun==0 and len(self.TABpar.link)==0 and len(self.gui.IOVheritableSteps())>0
887
+ FlagCopy=self.TABpar.flagRun==0 and len(self.TABpar.link)==0 and len(self.gui.linkableSteps(FlagExcludeLinked=True))>0
888
+ FlagLink=(len(self.TABpar.link)==0 and self.TABpar.flagRun==0 and len(self.gui.linkableSteps(FlagExcludeLinked=True))>0) or len(self.TABpar.link)>0
889
+ if FlagProcessTree and (FlagLabel or FlagReset or FlagInherit or FlagCopy or FlagLink):
890
+ self.gui.w_RCL.setVisible(True)
891
+ self.onlyReadLabel.setVisible(FlagLabel)
892
+ self.button_reset_step.setVisible(FlagReset)
893
+ self.button_step_inherit.setVisible(FlagInherit)
894
+ self.button_copy_step.setVisible(FlagCopy)
895
+ self.button_link_step.setVisible(FlagLink)
896
+ else:
897
+ self.gui.w_RCL.setVisible(False)
898
+ FlagEnabled = not self.gui.FlagRun
899
+ self.button_reset_step.setEnabled(FlagEnabled)
900
+ self.button_step_inherit.setEnabled(FlagEnabled)
901
+ self.button_copy_step.setEnabled(FlagEnabled)
902
+ self.button_link_step.setEnabled(FlagEnabled)
903
+
787
904
  if self.TABpar.flagRun or len(self.TABpar.link)>0: return
788
905
 
789
- lprev=len(self.TABpar_prev_at(self.TABpar.ind))
790
906
  i=self.TABpar.ind[-1]
907
+ self.ui.button_restore_undo.setVisible(lprev>1)
791
908
  self.ui.button_forward.setVisible(lprev>1)
792
909
  self.ui.button_back.setVisible(lprev>1)
910
+ self.ui.button_restore_undo.setEnabled(not (i==lprev-1 or i==-1))
793
911
  self.ui.button_forward.setEnabled(not (i==lprev-1 or i==-1))
794
912
  self.ui.button_back.setEnabled(i!=0)
795
913
  if self.ui.label_number.isVisible():
@@ -1012,14 +1130,13 @@ def setFontPixelSize(self,fPixSize):
1012
1130
  font.setPixelSize(fPixSize+3)
1013
1131
  w.lbl.setFont(font)
1014
1132
 
1015
-
1016
1133
  def setFontSizeText(lab:QLabel,fPixSizes):
1017
1134
  text=lab.text()
1018
- text=re.sub("font-size:\d+pt",f"font-size:{fPixSizes[0]}px",text)
1019
- text=re.sub("font-size:\d+px",f"font-size:{fPixSizes[0]}px",text)
1135
+ text=re.sub(r"font-size:\d+pt",f"font-size:{fPixSizes[0]}px",text)
1136
+ text=re.sub(r"font-size:\d+px",f"font-size:{fPixSizes[0]}px",text)
1020
1137
  if len(fPixSizes)>1:
1021
1138
  for k in range(len(fPixSizes)-1,0,-1):
1022
- text=re.sub("font-size:\d+px",f"font-size:{fPixSizes[k]}px",text,k)
1139
+ text=re.sub(r"font-size:\d+px",f"font-size:{fPixSizes[k]}px",text,k)
1023
1140
  lab.setText(text)
1024
1141
  font=lab.font()
1025
1142
  font.setPixelSize(fPixSizes[0])