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
@@ -20,12 +20,12 @@ spin_tips={
20
20
  'cam' : 'Camera number',
21
21
  'LMin' : 'Minimum intensity level',
22
22
  'LMax' : 'Maximum intensity level',
23
- #'yOriOff' : 'Origin y shift',
24
- #'xOriOff' : 'Origin x shift',
25
- #'yp' : 'Maximum y limit',
26
- #'ym' : 'Minimum y limit',
27
- #'xp' : 'Maximum x limit',
28
- #'xm' : 'Minimum x limit',
23
+ 'yOriOff' : 'Origin y shift',
24
+ 'xOriOff' : 'Origin x shift',
25
+ 'yp' : 'Maximum y limit',
26
+ 'ym' : 'Minimum y limit',
27
+ 'xp' : 'Maximum x limit',
28
+ 'xm' : 'Minimum x limit',
29
29
  }
30
30
  check_tips={}
31
31
  radio_tips={
@@ -72,9 +72,10 @@ class VISpar_CalVi(TABpar):
72
72
  self.scrollBarValues = [0,0]
73
73
  self.LLim = 0
74
74
  self.LMin = 0
75
- self.LMax = 0
75
+ self.LMax = 1
76
76
 
77
77
  self.MaskType = 0
78
+ self.DotDiam = 0
78
79
  self.FlagShowMask = True
79
80
  self.FlagPlotMask = False
80
81
 
@@ -102,6 +103,17 @@ class Vis_Tab_CalVi(gPaIRS_Tab):
102
103
  class VIS_Tab_Signals(gPaIRS_Tab.Tab_Signals):
103
104
  run=Signal(bool)
104
105
  pass
106
+
107
+ def showEvent(self, event: QShowEvent) -> None:
108
+ super().showEvent(event)
109
+ if not self.FlagInitVIS:
110
+ self.FlagInitVIS=True
111
+ S=self.scrollArea.size()
112
+ s=self.calibView.pixmap().size()
113
+ self.VISpar.scaleFactor = self.calibView.scaleFactor =min([S.width()/s.width() if s.width() else S.width(), S.height()/s.height() if s.height() else S.height()])
114
+ self.calibView.resize(self.VISpar.scaleFactor * self.calibView.pixmap().size())
115
+ return
116
+
105
117
  def closeEvent(self,event):
106
118
  ''' called when closing
107
119
  I had to add this to be sure that calib was destroyed'''
@@ -152,6 +164,7 @@ class Vis_Tab_CalVi(gPaIRS_Tab):
152
164
  self.VISpar_old:VISpar_CalVi=self.TABpar_old
153
165
 
154
166
  #------------------------------------- Callbacks
167
+ self.FlagInitVIS=False
155
168
  self.defineWidgets()
156
169
  self.setupWid() #---------------- IMPORTANT
157
170
 
@@ -210,8 +223,10 @@ class Vis_Tab_CalVi(gPaIRS_Tab):
210
223
  def stopCalVi(self):
211
224
  self.calibView.executeCalibTask(CalibTasks.stop)
212
225
  self.setTaskButtonsText()
226
+ self.gui.ui.button_Run_CalVi.setVisible(True)
213
227
  self.setTABlayout()
214
- self.FlagBridge=True
228
+ self.FlagBridge=True
229
+ self.adjustTABparInd()
215
230
 
216
231
  def show(self):
217
232
  super().show()
@@ -285,10 +300,17 @@ class Vis_Tab_CalVi(gPaIRS_Tab):
285
300
  def adjustVISpar(self):
286
301
  self.calibView.hide()
287
302
 
288
- FlagNewRun=self.VISpar.isDifferentFrom(self.VISpar_old,fields=['FlagRunning']) or not self.VISpar.FlagInit
303
+ FlagNewRun=self.VISpar.isDifferentFrom(self.VISpar_old,fields=['FlagRunning'])
289
304
  if FlagNewRun:
290
305
  self.defaultSplitterSize()
291
306
 
307
+ FlagNewSet=False
308
+ INP_CalVi:INPpar_CalVi = self.gui.w_Input_CalVi.TABpar
309
+ PRO_CalVi:PROpar_CalVi = self.gui.w_Process_CalVi.TABpar
310
+ if PRO_CalVi.isDifferentFrom(self.gui.w_Process_CalVi.PROpar_old,exceptions=['ind']) or INP_CalVi.isDifferentFrom(self.gui.w_Input_CalVi.INPpar_old,exceptions=['ind']) or not self.FlagInitData:
311
+ FlagNewSet=True
312
+ self.gui.initDataAndSetImgFromGui(INP_CalVi,PRO_CalVi)
313
+
292
314
  #***Data
293
315
  c=self.calibView.calib
294
316
  self.VISpar.nPlane=c.nPlanesPerCam
@@ -300,9 +322,10 @@ class Vis_Tab_CalVi(gPaIRS_Tab):
300
322
 
301
323
  self.VISpar.MaskType=abs(self.calibView.calib.cal.data.FlagPos)
302
324
  if self.VISpar.MaskType in (2,3):
303
- self.VISpar.FlagShowMask=False
325
+ #self.VISpar.FlagShowMask=False
304
326
  self.VISpar.FlagPlotMask=False
305
327
  #if not self.VISpar.FlagShowMask: self.VISpar.FlagPlotMask=False
328
+ self.VISpar.DotDiam=abs(self.calibView.calib.cal.data.raggioInizialeRicerca)
306
329
  self.calibView.calib.flagShowMask=self.VISpar.FlagShowMask
307
330
  self.calibView.calib.flagPlotMask=self.VISpar.FlagPlotMask
308
331
 
@@ -312,12 +335,12 @@ class Vis_Tab_CalVi(gPaIRS_Tab):
312
335
  if FlagPlotMask:
313
336
  FlagPlot=True
314
337
  self.plotPlane()
315
- if self.VISpar.FlagResetLevels or FlagNewRun: #or FlagPlotMask:
338
+ if self.VISpar.FlagResetLevels or FlagNewRun or FlagNewSet: #or FlagPlotMask:
316
339
  if not FlagPlot:
317
340
  FlagPlot=True
318
341
  self.plotPlane()
319
342
  self.restoreLevels()
320
- self.VISpar.FlagResetLevels=True
343
+ #self.VISpar.FlagResetLevels=False
321
344
  self.VISpar.LLim=c.LLim
322
345
  if self.VISpar.FlagResetLevels:
323
346
  self.VISpar.LMin=c.LMin
@@ -330,7 +353,7 @@ class Vis_Tab_CalVi(gPaIRS_Tab):
330
353
  self.VISpar.FlagResetLevels=False
331
354
 
332
355
  #***Zoom
333
- if self.VISpar.FlagResetZoom or FlagNewRun or FlagPlotMask:
356
+ if self.VISpar.FlagResetZoom or FlagNewRun or FlagPlotMask or FlagNewSet:
334
357
  if not FlagPlot:
335
358
  FlagPlot=True
336
359
  self.plotPlane()
@@ -376,21 +399,29 @@ class Vis_Tab_CalVi(gPaIRS_Tab):
376
399
  self.calibView.calib.LMax=self.VISpar.LMax
377
400
  self.calibView.calib.flagShowMask=self.VISpar.FlagShowMask
378
401
  self.calibView.calib.flagPlotMask=self.VISpar.FlagPlotMask
379
-
380
- if self.VISpar.plane and self.VISpar.cam:
402
+
403
+ FlagNoImage=True
404
+ if self.VISpar.cam>0 and self.VISpar.plane>0:
405
+ if self.VISpar.nCam==len(self.VISpar.imEx):
406
+ TargetType=self.gui.w_Process_CalVi.PROpar.TargetType
407
+ nPlane=self.VISpar.nPlane/(1+TargetType)
408
+ if nPlane==len(self.VISpar.imEx[0]):
409
+ plane=int( (self.VISpar.plane+TargetType)/(1+TargetType) )
410
+ if self.VISpar.imEx[self.VISpar.cam-1][plane-1]:
411
+ FlagNoImage=False
412
+ if FlagNoImage:
413
+ self.ui.status_R.setText('')
414
+ self.ui.status_L.setText('')
415
+ self.calibView.hide()
416
+ else:
381
417
  if self.VISpar_old.FlagRunning!=self.VISpar.FlagRunning or (self.VISpar.nPlane>0 and self.VISpar_old.nPlane==0):
382
418
  self.plotPlane()
383
- self.resetScaleFactor()
384
419
  self.button_zoom_equal_action()
385
420
  self.setZoom()
386
421
  self.plotPlane()
387
422
  self.calibView.show()
388
423
  if not self.VISpar.FlagInit:
389
424
  self.button_zoom_equal_action()
390
- else:
391
- self.ui.status_R.setText('')
392
- self.ui.status_L.setText('')
393
- self.calibView.hide()
394
425
  self.setRunButtonText()
395
426
  return
396
427
 
@@ -594,6 +625,7 @@ class Vis_Tab_CalVi(gPaIRS_Tab):
594
625
  b.setEnabled(flagEnab)
595
626
  for b in self.buttonsToDisableNotCalibrated:
596
627
  b.setEnabled(self.calibView.calib.cal.flagCalibrated)
628
+ self.setRunCalViButtonLayout()
597
629
  #for b in self.functionButtons: b.setEnabled(flagEnab)
598
630
  #pri.Callback.green('-----abcde----- TaskButtonsText -----abcde-----')
599
631
 
@@ -618,37 +650,58 @@ class Vis_Tab_CalVi(gPaIRS_Tab):
618
650
  calib.ccMask=[]
619
651
  flagFirstImage=True
620
652
  npType=np.uint16
653
+
654
+ data=calib.cal.data
655
+ Him=data.ImgH
656
+ Wim=data.ImgW
621
657
  if self.VISpar.imList: #only used to read the first image and fix the img dimensions
622
658
  for imListc,imExc in zip(self.VISpar.imList,self.VISpar.imEx):
623
659
  for k,f in enumerate(imListc):
624
660
  ex=imExc[k]=os.path.exists(f)
625
661
  if ex:
626
662
  if f not in self.bufferImg:
627
- im=Image.open(f)
628
- self.bufferImg[f]=da=np.array(im,dtype=npType)
663
+ try:
664
+ im=Image.open(f)
665
+ da=np.array(im,dtype=npType)
666
+ if len(da.shape)!=2:
667
+ self.bufferImg[f]=da=None
668
+ raise(f'Error: the image file: {f} seems not to be grayscale!')
669
+ else:
670
+ self.bufferImg[f]=da
671
+ except:
672
+ pri.Error.red(f'Error while opening the image file: {f}.\n{traceback.format_exc()}\n')
673
+ self.bufferImg[f]=da=None
629
674
  else:
630
675
  da=self.bufferImg[f]
631
- if flagFirstImage:
676
+ if flagFirstImage and da is not None:
632
677
  Him,Wim=da.shape
633
678
  flagFirstImage=False
634
679
  break
635
- if not flagFirstImage: break
636
- data=calib.cal.data
637
- if flagFirstImage:
638
- Him=data.ImgH
639
- Wim=data.ImgW
680
+ if not flagFirstImage: break
640
681
  if self.VISpar.imList: #reading the images
641
682
  for imListc,imExc in zip(self.VISpar.imList,self.VISpar.imEx):
683
+ k=-1
642
684
  for f,ex in zip(imListc,imExc):
685
+ k+=1
643
686
  if f not in self.bufferImg:
644
687
  if ex:
645
- im=Image.open(f)
646
- da=np.array(im,dtype=npType)
688
+ try:
689
+ im=Image.open(f)
690
+ da=np.array(im,dtype=npType)
691
+ if len(da.shape)!=2:
692
+ da=None
693
+ raise(f'Error: the image file: {f} seems not to be grayscale!')
694
+ except:
695
+ pri.Error.red(f'Error while opening the image file: {f}.\n{traceback.format_exc()}\n')
696
+ da=None
647
697
  else:
648
698
  da=np.zeros((Him,Wim),dtype=npType)
649
699
  self.bufferImg[f]=da
650
700
  else:
651
701
  da=self.bufferImg[f]
702
+ if da is None:
703
+ inddel.append(k)
704
+ continue
652
705
  h,w=da.shape
653
706
  if (Wim,Him)!=(w,h):
654
707
  inddel.append(k)
@@ -660,7 +713,8 @@ class Vis_Tab_CalVi(gPaIRS_Tab):
660
713
  self.bufferSize=0
661
714
  for f in self.bufferImg:#deleting buffer if to big
662
715
  a:np.ndarray=self.bufferImg[f]
663
- self.bufferSize+=a.size*a.itemsize
716
+ if a is not None:
717
+ self.bufferSize+=a.size*a.itemsize
664
718
  if self.bufferSize>bufferSizeLimit:
665
719
  imgList=list(self.bufferImg)
666
720
  k=0
@@ -690,7 +744,7 @@ class Vis_Tab_CalVi(gPaIRS_Tab):
690
744
  #-------------------------------------- %
691
745
  # Not in cfg %
692
746
  # --------------------------------------%
693
-
747
+
694
748
  data=calib.cal.data
695
749
  calVect=calib.cal.vect
696
750
  data.PercErrMax = 0.1 # 0.10 Percentuale massima per errore in posizioneTom da modificare
@@ -701,7 +755,7 @@ class Vis_Tab_CalVi(gPaIRS_Tab):
701
755
  # --------------------------------------%
702
756
  data.percorso = INP.path #percorso file di input
703
757
  data.EstensioneIn = INP.ext #estensione in (b16 o tif)
704
- data.FlagCam=0 if not INP.FlagCam else 1
758
+ data.FlagCam=0 if INP.FlagCam else 1
705
759
  data.percorsoOut = INP.path_out # percorso file di output
706
760
  data.NomeFileOut = INP.root_out # nome file di output
707
761
 
@@ -715,19 +769,23 @@ class Vis_Tab_CalVi(gPaIRS_Tab):
715
769
  data.NCam = len(cams) if INP.FlagCam else 1 # Numero di elementi nel vettore cam (numero di camere da calibrare)
716
770
 
717
771
  if self.VISpar.FlagRunning:
718
- varName=f'{data.percorsoOut}{data.NomeFileOut}{camString}{outExt.cal}'
772
+ varName=f'{data.percorsoOut}{data.NomeFileOut}{camString}{outExt.calvi}'
719
773
  if os.path.exists(varName):
720
- with open(varName, 'rb') as file:
721
- try:
722
- var=pickle.load(file)
723
- except:
724
- self.FlagResume=-1
725
- else:
726
- self.FlagResume=1 if INP.isEqualTo(var[0],exceptions=TABpar().fields,fields=['cams','filenames','x','y','w','h','W','H']) else -1
727
- INP.printDifferences(var[0])
728
- #PRO.printDifferences(var[1])
729
- if self.FlagResume>0:
730
- self.VISpar.copyfrom(var[2],TABpar().fields+['FlagRunning'])
774
+ try:
775
+ with open(varName, 'rb') as file:
776
+ try:
777
+ var=pickle.load(file)
778
+ except:
779
+ self.FlagResume=-1
780
+ else:
781
+ self.FlagResume=1 if INP.isEqualTo(var[0],exceptions=TABpar().fields,fields=['cams','filenames','x','y','w','h','W','H']) else -1
782
+ INP.printDifferences(var[0])
783
+ #PRO.printDifferences(var[1])
784
+ if self.FlagResume>0:
785
+ self.VISpar.copyfrom(var[2],TABpar().fields+['FlagRunning'])
786
+ except:
787
+ self.FlagResume=-1
788
+ pri.Error.red(f'Error while restoring the previous calibration process file: {varName}.\n{traceback.format_exc()}\n')
731
789
 
732
790
  #-------------------------------------- %
733
791
  # Distance between spots %
@@ -895,12 +953,23 @@ class Vis_Tab_CalVi(gPaIRS_Tab):
895
953
  calib.nCams=calib.cal.data.NCam
896
954
  calib.cams=calib.cal.getCams()
897
955
  calib.nPlanes=calib.cal.data.Numpiani
956
+
898
957
  calib.nPlanesPerCam=calib.cal.data.Numpiani_PerCam
899
958
  self.VISpar.nPlane=calib.nPlanesPerCam
900
959
  self.VISpar.nCam=calib.nCams
901
960
  self.FlagInitData=True
902
961
  return
903
962
 
963
+ def setRunCalViButtonLayout(self):
964
+ if self.gui:
965
+ FlagVisible=True
966
+ calib=self.calibView.calib
967
+ calVect=calib.cal.vect
968
+ FlagVisible=all([not bool(p) for p in calVect.flagPlane[:-1]])
969
+ self.gui.ui.button_Run_CalVi.setVisible(FlagVisible)
970
+
971
+
972
+
904
973
 
905
974
  if __name__ == "__main__":
906
975
  import sys
PaIRS_UniNa/Whatsnew.py CHANGED
@@ -1,6 +1,7 @@
1
1
  from .PaIRS_pypacks import*
2
2
  from .ui_Whatsnew import Ui_Whatsnew
3
- from .__init__ import __version__
3
+ from .__init__ import __version__,__subversion__
4
+ import unicodedata
4
5
 
5
6
  #from TabTools import setupWid,setFontPixelSize,setFontSizeText
6
7
  class Whatsnew(QMainWindow):
@@ -13,6 +14,7 @@ class Whatsnew(QMainWindow):
13
14
  if Message:
14
15
  self.ui.info.setText(Message)
15
16
  self.ui.info.setWordWrap(True)
17
+ self.ui.info.setFont(gui.font())
16
18
  if title:
17
19
  self.setWindowTitle(title)
18
20
 
@@ -31,9 +33,9 @@ class Whatsnew(QMainWindow):
31
33
  if hasattr(c,'setFont'):
32
34
  c.setFont(font)
33
35
 
34
- self.show()
36
+
35
37
  self.resize(QSize(w,self.gui.maximumGeometry.height()))
36
- self.update()
38
+ self.show()
37
39
  hinfo=self.ui.info.height()
38
40
  h=hinfo+self.ui.w_Ok.height()+self.ui.mainLay.verticalSpacing()+self.ui.mainLay.contentsMargins().bottom()*2+self.ui.mainLay.contentsMargins().top()*2
39
41
  self.setFixedSize(QSize(w,h))
@@ -48,8 +50,10 @@ class Whatsnew(QMainWindow):
48
50
  self.ui.button_Ok.clicked.connect(self.close)
49
51
 
50
52
  def whatsNew(self):
53
+ FlagCheckWhatWasNew=False
51
54
  if os.path.exists(fileWhatsNew[0]):
52
55
  filename=fileWhatsNew[0]
56
+ FlagCheckWhatWasNew=True
53
57
  elif os.path.exists(fileWhatsNew[1]):
54
58
  filename=fileWhatsNew[1]
55
59
  else:
@@ -60,15 +64,46 @@ def whatsNew(self):
60
64
  content = file.read().decode("utf-8")
61
65
  file.close()
62
66
  except Exception as inst:
63
- pri.Error.red(f'There was a problem while reading the file {filename}:\n{inst}')
67
+ pri.Error.red(f'There was a problem while reading the file {filename}:\n{inst}.\n{traceback.format_exc()}\n')
64
68
  try:
65
- splittedContent=content.replace('\r','').replace('\n','').split('*')[1:]
66
- star='<span style="font-size:100%;color:#e2b112;">&#9733;</span>' #⭐,&#9733;
67
- news='<br/><br/>'.join([star+' '+c for c in splittedContent])
68
69
  dfontPixelSize=6
69
70
  fontPixelSize=self.TABpar.fontPixelSize-2+dfontPixelSize
70
- Message=f'<span style=" font-size: {fontPixelSize+dfontPixelSize}px; font-weight:600;">'+f"What's new in PaIRS-UniNa {__version__}"+'</span><br/><br/>'+news+'<br/><br/>Go to the menu "? -> Changes" for further information.'
71
- self.whatsnew=Whatsnew(self,Message,f'Updates of version {__version__}',dfontPixelSize)
71
+ """
72
+ warn=f'<br/><br/><span style="font-size:{fontPixelSize+3}px;color:#e2b112;">&#9888;</span>'
73
+ star=f'<br/><br/><span style="font-size:{fontPixelSize+3}px;color:#e2b112;">&#128226;</span>' #⭐ &#9733; &#128264;
74
+ news=content.replace('\r','').replace('\n','').replace('$',warn).replace('*',star)
75
+ news=news.replace('<br/><br/>','',1)
76
+ """
77
+ if FlagCheckWhatWasNew and os.path.exists(fileWhatsNew[1]):
78
+ file_old = open(fileWhatsNew[1], "rb")
79
+ content_old = file_old.read().decode("utf-8")
80
+ file_old.close()
81
+ if content_old==content:
82
+ os.remove(fileWhatsNew[1])
83
+ os.rename(fileWhatsNew[0],fileWhatsNew[1])
84
+ return
85
+
86
+ splitted_news=content.splitlines()
87
+ for k, text in enumerate(splitted_news):
88
+ if not text: continue
89
+ if text[0]=='#': splitted_news[k]=''
90
+ elif text[0]=='!':
91
+ splitted_news[k]=formatBullet(icons_path+"warning.png",text[1:])
92
+ elif text[0]=='%':
93
+ splitted_news[k]=formatBullet(icons_path+"bugfix.png",text[1:])
94
+ elif text[0]=='&':
95
+ splitted_news[k]=formatBullet(icons_path+"announcement.png",text[1:])
96
+ elif text[0]=='*':
97
+ splitted_news[k]=formatBullet(icons_path+"star.png",text[1:])
98
+ elif text[0]=='§':
99
+ splitted_news[k]=formatBullet(icons_path+"pylog.png",text[1:])
100
+ elif text[0]=='£':
101
+ splitted_news[k]= f'<br/><span style="font-weight: 600; font-size: {fontPixelSize}px;">{text[1:]}</span><br/>'
102
+ news="".join(splitted_news)
103
+
104
+ subversion_string=f'(.{__subversion__})' if int(__subversion__) else ''
105
+ Message=f'<span style=" font-size: {fontPixelSize+dfontPixelSize}px; font-weight: 600;">'+f"What's new in PaIRS-UniNa {__version__}{subversion_string}"+'</span><br/><br/>'+news+'<br/>Go to the menu "? -> Changes" for further information.'
106
+ self.whatsnew=Whatsnew(self,Message,f'Updates of version {__version__}{subversion_string}',dfontPixelSize)
72
107
  #warningDialog(self,Message,pixmap=''+ icons_path +'news.png',title=f'Updates of version {__version__}',flagRichText=True)
73
108
  except Exception as inst:
74
109
  pri.Error.red(f"There was a problem while launching the What's new dialog box:\n{inst}")
@@ -79,3 +114,17 @@ def whatsNew(self):
79
114
  except Exception as inst:
80
115
  pri.Error.red(f'There was a problem while renaming the file {fileWhatsNew[0]}:\n{inst}')
81
116
  return
117
+
118
+
119
+ def formatBullet(icon_path,text):
120
+ html_text=f"""
121
+ <table>
122
+ <tr>
123
+ <td> <img src="{icon_path}" width="48" height="48" style="margin-right: 0px;"></td>
124
+ <td>&nbsp;&nbsp;</td>
125
+ <td>{text}<br/></td>
126
+ </tr>
127
+ </table>
128
+ """ if text else ""
129
+ return html_text
130
+
Binary file
PaIRS_UniNa/__init__.py CHANGED
@@ -1,5 +1,6 @@
1
- __version__="0.2.0"
1
+ __version__="0.2.8"
2
2
  __subversion__="0"
3
- __year__='2024'
3
+ __year__='2025'
4
+ __date__='2025.11.14'
4
5
  __mail__='etfd@unina.it'
5
- __website__='https://pairs.unina.it'
6
+ __website__='https://pairs.unina.it'