PaIRS-UniNa 0.1.13__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.
- PaIRS_UniNa/Calibration_Tab.py +331 -0
- PaIRS_UniNa/Changes.txt +134 -2
- PaIRS_UniNa/Custom_Top.py +299 -299
- PaIRS_UniNa/Explorer.py +3136 -0
- PaIRS_UniNa/FolderLoop.py +562 -0
- PaIRS_UniNa/Input_Tab.py +831 -0
- PaIRS_UniNa/Input_Tab_CalVi.py +786 -0
- PaIRS_UniNa/Input_Tab_tools.py +3025 -0
- PaIRS_UniNa/Log_Tab.py +57 -14
- PaIRS_UniNa/Output_Tab.py +922 -0
- PaIRS_UniNa/PaIRS_PIV.py +111 -18
- PaIRS_UniNa/PaIRS_pypacks.py +698 -140
- PaIRS_UniNa/Process_Tab.py +1221 -1402
- PaIRS_UniNa/Process_Tab_CalVi.py +137 -262
- PaIRS_UniNa/Process_Tab_Disp.py +163 -0
- PaIRS_UniNa/Process_Tab_Min.py +120 -0
- PaIRS_UniNa/Saving_tools.py +296 -0
- PaIRS_UniNa/TabTools.py +863 -543
- PaIRS_UniNa/Vis_Tab.py +1898 -1315
- PaIRS_UniNa/Vis_Tab_CalVi.py +484 -356
- PaIRS_UniNa/Whatsnew.py +59 -10
- PaIRS_UniNa/_PaIRS_PIV.pyd +0 -0
- PaIRS_UniNa/__init__.py +4 -3
- PaIRS_UniNa/addwidgets_ps.py +326 -56
- PaIRS_UniNa/calib.py +19 -12
- PaIRS_UniNa/calibView.py +48 -25
- PaIRS_UniNa/gPaIRS.py +3902 -3461
- PaIRS_UniNa/gPalette.py +189 -170
- PaIRS_UniNa/icons/align_all.png +0 -0
- PaIRS_UniNa/icons/announcement.png +0 -0
- PaIRS_UniNa/icons/automatic_levels_off.png +0 -0
- PaIRS_UniNa/icons/automatic_levels_on.png +0 -0
- PaIRS_UniNa/icons/automatic_off.png +0 -0
- PaIRS_UniNa/icons/automatic_on.png +0 -0
- PaIRS_UniNa/icons/automatic_size_off.png +0 -0
- PaIRS_UniNa/icons/automatic_size_on.png +0 -0
- PaIRS_UniNa/icons/bin_off.png +0 -0
- PaIRS_UniNa/icons/bin_on.png +0 -0
- PaIRS_UniNa/icons/brush_cursor.png +0 -0
- PaIRS_UniNa/icons/bugfix.png +0 -0
- PaIRS_UniNa/icons/cal_proc.png +0 -0
- PaIRS_UniNa/icons/cal_proc_off.png +0 -0
- PaIRS_UniNa/icons/cal_step.png +0 -0
- PaIRS_UniNa/icons/cal_step_off.png +0 -0
- PaIRS_UniNa/icons/calibration_logo.png +0 -0
- PaIRS_UniNa/icons/change_folder.png +0 -0
- PaIRS_UniNa/icons/change_folder_off.png +0 -0
- PaIRS_UniNa/icons/close_all.png +0 -0
- PaIRS_UniNa/icons/close_workspace.png +0 -0
- PaIRS_UniNa/icons/colormap.png +0 -0
- PaIRS_UniNa/icons/colormaps/Accent.png +0 -0
- PaIRS_UniNa/icons/colormaps/BrBG.png +0 -0
- PaIRS_UniNa/icons/colormaps/Dark2.png +0 -0
- PaIRS_UniNa/icons/colormaps/PRGn.png +0 -0
- PaIRS_UniNa/icons/colormaps/Paired.png +0 -0
- PaIRS_UniNa/icons/colormaps/Pastel1.png +0 -0
- PaIRS_UniNa/icons/colormaps/Pastel2.png +0 -0
- PaIRS_UniNa/icons/colormaps/PiYG.png +0 -0
- PaIRS_UniNa/icons/colormaps/PuOr.png +0 -0
- PaIRS_UniNa/icons/colormaps/RdBu.png +0 -0
- PaIRS_UniNa/icons/colormaps/RdGy.png +0 -0
- PaIRS_UniNa/icons/colormaps/RdYlBu.png +0 -0
- PaIRS_UniNa/icons/colormaps/RdYlGn.png +0 -0
- PaIRS_UniNa/icons/colormaps/Set1.png +0 -0
- PaIRS_UniNa/icons/colormaps/Set2.png +0 -0
- PaIRS_UniNa/icons/colormaps/Set3.png +0 -0
- PaIRS_UniNa/icons/colormaps/Spectral.png +0 -0
- PaIRS_UniNa/icons/colormaps/Wistia.png +0 -0
- PaIRS_UniNa/icons/colormaps/afmhot.png +0 -0
- PaIRS_UniNa/icons/colormaps/autumn.png +0 -0
- PaIRS_UniNa/icons/colormaps/binary.png +0 -0
- PaIRS_UniNa/icons/colormaps/blackVector.png +0 -0
- PaIRS_UniNa/icons/colormaps/blueVector.png +0 -0
- PaIRS_UniNa/icons/colormaps/bone.png +0 -0
- PaIRS_UniNa/icons/colormaps/brg.png +0 -0
- PaIRS_UniNa/icons/colormaps/bwr.png +0 -0
- PaIRS_UniNa/icons/colormaps/cividis.png +0 -0
- PaIRS_UniNa/icons/colormaps/cool.png +0 -0
- PaIRS_UniNa/icons/colormaps/coolwarm.png +0 -0
- PaIRS_UniNa/icons/colormaps/copper.png +0 -0
- PaIRS_UniNa/icons/colormaps/cubehelix.png +0 -0
- PaIRS_UniNa/icons/colormaps/cyanVector.png +0 -0
- PaIRS_UniNa/icons/colormaps/flag.png +0 -0
- PaIRS_UniNa/icons/colormaps/gist_heat.png +0 -0
- PaIRS_UniNa/icons/colormaps/gray.png +0 -0
- PaIRS_UniNa/icons/colormaps/greenVector.png +0 -0
- PaIRS_UniNa/icons/colormaps/hot.png +0 -0
- PaIRS_UniNa/icons/colormaps/hsv.png +0 -0
- PaIRS_UniNa/icons/colormaps/inferno.png +0 -0
- PaIRS_UniNa/icons/colormaps/jet.png +0 -0
- PaIRS_UniNa/icons/colormaps/magentaVector.png +0 -0
- PaIRS_UniNa/icons/colormaps/magma.png +0 -0
- PaIRS_UniNa/icons/colormaps/ocean.png +0 -0
- PaIRS_UniNa/icons/colormaps/pink.png +0 -0
- PaIRS_UniNa/icons/colormaps/plasma.png +0 -0
- PaIRS_UniNa/icons/colormaps/prism.png +0 -0
- PaIRS_UniNa/icons/colormaps/rainbow.png +0 -0
- PaIRS_UniNa/icons/colormaps/redVector.png +0 -0
- PaIRS_UniNa/icons/colormaps/seismic.png +0 -0
- PaIRS_UniNa/icons/colormaps/spring.png +0 -0
- PaIRS_UniNa/icons/colormaps/summer.png +0 -0
- PaIRS_UniNa/icons/colormaps/tab10.png +0 -0
- PaIRS_UniNa/icons/colormaps/tab20.png +0 -0
- PaIRS_UniNa/icons/colormaps/tab20b.png +0 -0
- PaIRS_UniNa/icons/colormaps/tab20c.png +0 -0
- PaIRS_UniNa/icons/colormaps/terrain.png +0 -0
- PaIRS_UniNa/icons/colormaps/twilight.png +0 -0
- PaIRS_UniNa/icons/colormaps/viridis.png +0 -0
- PaIRS_UniNa/icons/colormaps/whiteVector.png +0 -0
- PaIRS_UniNa/icons/colormaps/winter.png +0 -0
- PaIRS_UniNa/icons/colormaps/yellowVector.png +0 -0
- PaIRS_UniNa/icons/common_region.png +0 -0
- PaIRS_UniNa/icons/common_region_off.png +0 -0
- PaIRS_UniNa/icons/completed.png +0 -0
- PaIRS_UniNa/icons/contourf_off.png +0 -0
- PaIRS_UniNa/icons/contourf_on.png +0 -0
- PaIRS_UniNa/icons/copy.png +0 -0
- PaIRS_UniNa/icons/copy_process.png +0 -0
- PaIRS_UniNa/icons/copy_process_off.png +0 -0
- PaIRS_UniNa/icons/cut.png +0 -0
- PaIRS_UniNa/icons/cut_warnings.png +0 -0
- PaIRS_UniNa/icons/darkmode.png +0 -0
- PaIRS_UniNa/icons/disp_step.png +0 -0
- PaIRS_UniNa/icons/disp_step_off.png +0 -0
- PaIRS_UniNa/icons/edit_list.png +0 -0
- PaIRS_UniNa/icons/example_list.png +0 -0
- PaIRS_UniNa/icons/flaticon_PaIRS_beta.png +0 -0
- PaIRS_UniNa/icons/flaticon_PaIRS_download_warning.png +0 -0
- PaIRS_UniNa/icons/flip_y_off.png +0 -0
- PaIRS_UniNa/icons/flip_y_on.png +0 -0
- PaIRS_UniNa/icons/folder_loop_cleanup.png +0 -0
- PaIRS_UniNa/icons/folder_loop_cleanup_off.png +0 -0
- PaIRS_UniNa/icons/gear.gif +0 -0
- PaIRS_UniNa/icons/gear.png +0 -0
- PaIRS_UniNa/icons/import_set.png +0 -0
- PaIRS_UniNa/icons/information.png +0 -0
- PaIRS_UniNa/icons/input_logo.png +0 -0
- PaIRS_UniNa/icons/issue.png +0 -0
- PaIRS_UniNa/icons/laser_NTR.png +0 -0
- PaIRS_UniNa/icons/laser_TR_double.png +0 -0
- PaIRS_UniNa/icons/laser_TR_single.png +0 -0
- PaIRS_UniNa/icons/link.png +0 -0
- PaIRS_UniNa/icons/linked.png +0 -0
- PaIRS_UniNa/icons/log_logo.png +0 -0
- PaIRS_UniNa/icons/logo_opaco.png +0 -0
- PaIRS_UniNa/icons/measure.png +0 -0
- PaIRS_UniNa/icons/measure_off.png +0 -0
- PaIRS_UniNa/icons/min_proc.png +0 -0
- PaIRS_UniNa/icons/min_proc_off.png +0 -0
- PaIRS_UniNa/icons/min_step.png +0 -0
- PaIRS_UniNa/icons/min_step_off.png +0 -0
- PaIRS_UniNa/icons/new_workspace.png +0 -0
- PaIRS_UniNa/icons/open_image.png +0 -0
- PaIRS_UniNa/icons/open_new_window.png +0 -0
- PaIRS_UniNa/icons/open_result.png +0 -0
- PaIRS_UniNa/icons/open_workspace.png +0 -0
- PaIRS_UniNa/icons/output_logo.png +0 -0
- PaIRS_UniNa/icons/paste_above.png +0 -0
- PaIRS_UniNa/icons/paste_below.png +0 -0
- PaIRS_UniNa/icons/paused.png +0 -0
- PaIRS_UniNa/icons/piv_proc.png +0 -0
- PaIRS_UniNa/icons/piv_proc_off.png +0 -0
- PaIRS_UniNa/icons/piv_step.png +0 -0
- PaIRS_UniNa/icons/piv_step_off.png +0 -0
- PaIRS_UniNa/icons/process_logo.png +0 -0
- PaIRS_UniNa/icons/process_loop.png +0 -0
- PaIRS_UniNa/icons/project.png +0 -0
- PaIRS_UniNa/icons/pylog.png +0 -0
- PaIRS_UniNa/icons/python_warning.png +0 -0
- PaIRS_UniNa/icons/queue.png +0 -0
- PaIRS_UniNa/icons/read.png +0 -0
- PaIRS_UniNa/icons/read_list.png +0 -0
- PaIRS_UniNa/icons/reset.png +0 -0
- PaIRS_UniNa/icons/reset_levels.png +0 -0
- PaIRS_UniNa/icons/restore_undo.png +0 -0
- PaIRS_UniNa/icons/running.gif +0 -0
- PaIRS_UniNa/icons/running.png +0 -0
- PaIRS_UniNa/icons/running_warn.png +0 -0
- PaIRS_UniNa/icons/save_and_stop.png +0 -0
- PaIRS_UniNa/icons/save_cfg.png +0 -0
- PaIRS_UniNa/icons/saveas_workspace.png +0 -0
- PaIRS_UniNa/icons/scale_all.png +0 -0
- PaIRS_UniNa/icons/scale_down.png +0 -0
- PaIRS_UniNa/icons/scale_up.png +0 -0
- PaIRS_UniNa/icons/scan_list.png +0 -0
- PaIRS_UniNa/icons/scan_path.png +0 -0
- PaIRS_UniNa/icons/scan_path_loop.png +0 -0
- PaIRS_UniNa/icons/scan_path_loop_off.png +0 -0
- PaIRS_UniNa/icons/search.png +0 -0
- PaIRS_UniNa/icons/showIW_off.png +0 -0
- PaIRS_UniNa/icons/showIW_on.png +0 -0
- PaIRS_UniNa/icons/show_all.png +0 -0
- PaIRS_UniNa/icons/sort.png +0 -0
- PaIRS_UniNa/icons/sort_reversed.png +0 -0
- PaIRS_UniNa/icons/spiv_proc.png +0 -0
- PaIRS_UniNa/icons/spiv_proc_off.png +0 -0
- PaIRS_UniNa/icons/star.png +0 -0
- PaIRS_UniNa/icons/step_inheritance.png +0 -0
- PaIRS_UniNa/icons/subMIN_off.png +0 -0
- PaIRS_UniNa/icons/subMIN_on.png +0 -0
- PaIRS_UniNa/icons/unedited.png +0 -0
- PaIRS_UniNa/icons/uninitialized.png +0 -0
- PaIRS_UniNa/icons/unlink.png +0 -0
- PaIRS_UniNa/icons/unwrap_items.png +0 -0
- PaIRS_UniNa/icons/vectorColor.png +0 -0
- PaIRS_UniNa/icons/view.png +0 -0
- PaIRS_UniNa/icons/view_off.png +0 -0
- PaIRS_UniNa/icons/vis_logo.png +0 -0
- PaIRS_UniNa/icons/warning_circle.png +0 -0
- PaIRS_UniNa/icons/window.png +0 -0
- PaIRS_UniNa/icons/workspace.png +0 -0
- PaIRS_UniNa/icons/wrap_items.png +0 -0
- PaIRS_UniNa/icons/write_list.png +0 -0
- PaIRS_UniNa/listLib.py +303 -0
- PaIRS_UniNa/mtfPIV.py +8 -8
- PaIRS_UniNa/parForMulti.py +7 -5
- PaIRS_UniNa/parForWorkers.py +370 -31
- PaIRS_UniNa/pivParFor.py +233 -229
- PaIRS_UniNa/plt_util.py +141 -141
- PaIRS_UniNa/preProcParFor.py +153 -148
- PaIRS_UniNa/procTools.py +631 -178
- PaIRS_UniNa/readcfg.py +31 -1
- PaIRS_UniNa/rqrdpckgs.txt +9 -0
- PaIRS_UniNa/stereoPivParFor.py +227 -0
- PaIRS_UniNa/tAVarie.py +215 -215
- PaIRS_UniNa/tabSplitter.py +612 -0
- PaIRS_UniNa/ui_Calibration_Tab.py +545 -0
- PaIRS_UniNa/ui_Custom_Top.py +5 -5
- PaIRS_UniNa/ui_Input_Tab.py +1101 -0
- PaIRS_UniNa/{ui_Import_Tab_CalVi.py → ui_Input_Tab_CalVi.py} +1282 -1275
- PaIRS_UniNa/ui_Log_Tab.py +262 -257
- PaIRS_UniNa/{ui_Export_Tab.py → ui_Output_Tab.py} +2361 -1778
- PaIRS_UniNa/ui_Process_Tab.py +3809 -3758
- PaIRS_UniNa/ui_Process_Tab_CalVi.py +1547 -1546
- PaIRS_UniNa/ui_Process_Tab_Disp.py +1141 -0
- PaIRS_UniNa/ui_Process_Tab_Min.py +437 -0
- PaIRS_UniNa/ui_Vis_Tab.py +1626 -1208
- PaIRS_UniNa/ui_Vis_Tab_CalVi.py +1249 -1249
- PaIRS_UniNa/ui_Whatsnew.py +131 -131
- PaIRS_UniNa/ui_gPairs.py +876 -950
- PaIRS_UniNa/ui_infoPaIRS.py +550 -425
- PaIRS_UniNa/whatsnew.txt +6 -4
- {PaIRS_UniNa-0.1.13.dist-info → pairs_unina-0.2.8.dist-info}/METADATA +69 -51
- pairs_unina-0.2.8.dist-info/RECORD +329 -0
- {PaIRS_UniNa-0.1.13.dist-info → pairs_unina-0.2.8.dist-info}/WHEEL +1 -1
- PaIRS_UniNa/CalVi.py +0 -18
- PaIRS_UniNa/Export_Tab.py +0 -574
- PaIRS_UniNa/Import_Tab.py +0 -657
- PaIRS_UniNa/Import_Tab_CalVi.py +0 -861
- PaIRS_UniNa/Import_Tab_tools.py +0 -598
- PaIRS_UniNa/Tree_Tab.py +0 -543
- PaIRS_UniNa/gCalVi.py +0 -2024
- PaIRS_UniNa/icons/add.png +0 -0
- PaIRS_UniNa/icons/cancelled.png +0 -0
- PaIRS_UniNa/icons/chain.png +0 -0
- PaIRS_UniNa/icons/chain_broken.png +0 -0
- PaIRS_UniNa/icons/default_sizes.png +0 -0
- PaIRS_UniNa/icons/dock_tabs.png +0 -0
- PaIRS_UniNa/icons/done.png +0 -0
- PaIRS_UniNa/icons/down_arrow.png +0 -0
- PaIRS_UniNa/icons/export_logo.png +0 -0
- PaIRS_UniNa/icons/fast_delete.png +0 -0
- PaIRS_UniNa/icons/flip_y.png +0 -0
- PaIRS_UniNa/icons/ganci.png +0 -0
- PaIRS_UniNa/icons/import_blue.png +0 -0
- PaIRS_UniNa/icons/import_logo.png +0 -0
- PaIRS_UniNa/icons/missing.png +0 -0
- PaIRS_UniNa/icons/process_icon.png +0 -0
- PaIRS_UniNa/icons/processing.png +0 -0
- PaIRS_UniNa/icons/restart.png +0 -0
- PaIRS_UniNa/icons/right_arrow.png +0 -0
- PaIRS_UniNa/icons/run_piv.png +0 -0
- PaIRS_UniNa/icons/terminal.png +0 -0
- PaIRS_UniNa/icons/undock_tabs.png +0 -0
- PaIRS_UniNa/icons/vect_field.png +0 -0
- PaIRS_UniNa/icons/w0.png +0 -0
- PaIRS_UniNa/icons/w1.png +0 -0
- PaIRS_UniNa/icons/w2.png +0 -0
- PaIRS_UniNa/icons/w3.png +0 -0
- PaIRS_UniNa/icons/w4.png +0 -0
- PaIRS_UniNa/icons/w5.png +0 -0
- PaIRS_UniNa/run_CalVi.py +0 -14
- PaIRS_UniNa/run_gcalvi.py +0 -5
- PaIRS_UniNa/ui_Import_Tab.py +0 -1077
- PaIRS_UniNa/ui_Tree_Tab.py +0 -684
- PaIRS_UniNa/ui_gCalVi.py +0 -640
- PaIRS_UniNa/ui_infoCalVi.py +0 -428
- PaIRS_UniNa-0.1.13.dist-info/LICENSE +0 -19
- PaIRS_UniNa-0.1.13.dist-info/RECORD +0 -174
- /PaIRS_UniNa/icons/{clean_queue.png → clean.png} +0 -0
- /PaIRS_UniNa/icons/{waiting_c.png → sandglass.png} +0 -0
- {PaIRS_UniNa-0.1.13.dist-info → pairs_unina-0.2.8.dist-info}/top_level.txt +0 -0
PaIRS_UniNa/gCalVi.py
DELETED
|
@@ -1,2024 +0,0 @@
|
|
|
1
|
-
import PySide6.QtGui
|
|
2
|
-
from .ui_gCalVi import *
|
|
3
|
-
from .ui_infoCalVi import *
|
|
4
|
-
from .TabTools import *
|
|
5
|
-
#from procTools import *
|
|
6
|
-
|
|
7
|
-
from .Import_Tab_CalVi import *
|
|
8
|
-
from .Process_Tab_CalVi import *
|
|
9
|
-
from .Vis_Tab_CalVi import *
|
|
10
|
-
from .Log_Tab import *
|
|
11
|
-
from .Whatsnew import *
|
|
12
|
-
|
|
13
|
-
from .gPalette import darkPalette,lightPalette
|
|
14
|
-
|
|
15
|
-
import concurrent.futures
|
|
16
|
-
|
|
17
|
-
from .__init__ import __version__,__subversion__,__year__,__mail__,__website__
|
|
18
|
-
|
|
19
|
-
version=__version__
|
|
20
|
-
year=__year__
|
|
21
|
-
mail=__mail__
|
|
22
|
-
website=__website__
|
|
23
|
-
uicfg_version='0.0.0'
|
|
24
|
-
w_button_min_size=680
|
|
25
|
-
Flag_fullDEBUG=True
|
|
26
|
-
Flag_ResetScaleOnChanges=False
|
|
27
|
-
Flag_DEBUG_CleanLaunch=False
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
#********************************************* Additional windows
|
|
31
|
-
class FloatingObject(QMainWindow):
|
|
32
|
-
def closeEvent(self, event):
|
|
33
|
-
if not self.gui.CALpar.FlagUndocked:
|
|
34
|
-
self.hide()
|
|
35
|
-
else:
|
|
36
|
-
self.gui.close_tab(self.tab)
|
|
37
|
-
#self.button.setChecked(False)
|
|
38
|
-
#setattr(self.gui.CALpar,'Flag'+self.name,False)
|
|
39
|
-
#ind=self.gui.opwidnames.index(self.name)
|
|
40
|
-
#if ind<3:
|
|
41
|
-
# self.gui.CALpar.prevTab=self.gui.CALpar.lastTab
|
|
42
|
-
# self.gui.CALpar.lastTab=ind
|
|
43
|
-
#self.hide()
|
|
44
|
-
|
|
45
|
-
def __init__(self,parent,tab):
|
|
46
|
-
super().__init__()
|
|
47
|
-
self.gui:gCalVi=parent
|
|
48
|
-
self.name=''
|
|
49
|
-
self.button=None
|
|
50
|
-
self.tab=tab
|
|
51
|
-
self.setup()
|
|
52
|
-
|
|
53
|
-
def setup(self):
|
|
54
|
-
tab=self.tab
|
|
55
|
-
if type(tab)==CollapsibleBox:
|
|
56
|
-
self.setWindowTitle(tab.toggle_button.text())
|
|
57
|
-
self.setWindowIcon(self.gui.windowIcon())
|
|
58
|
-
parent=tab
|
|
59
|
-
elif type(tab) in (Import_Tab_CalVi,Process_Tab_CalVi,Vis_Tab_CalVi):
|
|
60
|
-
self.name=tab.ui.name_tab.text().replace(' ','')
|
|
61
|
-
self.setWindowTitle(tab.ui.name_tab.text())
|
|
62
|
-
self.setWindowIcon(tab.ui.icon.pixmap())
|
|
63
|
-
parent=tab.parent()
|
|
64
|
-
else:
|
|
65
|
-
self.setWindowTitle(self.gui.windowTitle())
|
|
66
|
-
self.setWindowIcon(self.gui.windowIcon())
|
|
67
|
-
parent=tab
|
|
68
|
-
if type(parent.parent()) in (QSplitter,QLayout,myQSplitter):
|
|
69
|
-
self.lay:QLayout=parent.parent()
|
|
70
|
-
else:
|
|
71
|
-
self.lay:QLayout=parent.parent().layout()
|
|
72
|
-
self.pa=parent
|
|
73
|
-
self.index=self.lay.indexOf(parent)
|
|
74
|
-
#self.setCentralWidget(parent)
|
|
75
|
-
|
|
76
|
-
self.setBaseSize(parent.baseSize())
|
|
77
|
-
self.setAutoFillBackground(False)
|
|
78
|
-
self.setMinimumSize(parent.minimumSize())
|
|
79
|
-
self.setMaximumSize(parent.maximumSize())
|
|
80
|
-
|
|
81
|
-
#pri.Info.magenta(f'{self.name} Sizes: min {parent.minimumSize()}, max {parent.maximumSize()},'+\
|
|
82
|
-
# f' min {self.minimumSize()}, max {self.maximumSize()}')
|
|
83
|
-
|
|
84
|
-
if self.name:
|
|
85
|
-
self.button=getattr(self.gui.ui,'button_'+self.name)
|
|
86
|
-
|
|
87
|
-
def setFloat(self):
|
|
88
|
-
self.setCentralWidget(self.pa)
|
|
89
|
-
self.centralWidget().setMinimumSize(self.pa.minimumSize())
|
|
90
|
-
self.centralWidget().setMaximumSize(self.pa.maximumSize())
|
|
91
|
-
|
|
92
|
-
class FloatingWidget(FloatingObject):
|
|
93
|
-
def closeEvent(self, event):
|
|
94
|
-
index=min([self.index,self.lay.count()-1])
|
|
95
|
-
self.lay.insertWidget(index,self.pa)
|
|
96
|
-
self.close()
|
|
97
|
-
i=self.gui.floatw.index(self)
|
|
98
|
-
self.gui.floatw.pop(i)
|
|
99
|
-
self.gui.undockTabs()
|
|
100
|
-
|
|
101
|
-
def __init__(self,parent,tab):
|
|
102
|
-
super().__init__(parent,tab)
|
|
103
|
-
|
|
104
|
-
geo=self.pa.geometry()
|
|
105
|
-
geoP=self.gui.geometry()
|
|
106
|
-
x=geoP.x()+int(geoP.width()*0.5)-int(geo.width()*0.5)
|
|
107
|
-
y=geoP.y()+int(geoP.height()*0.5)-int(geo.height()*0.5)
|
|
108
|
-
self.setGeometry(x,y,geo.width(),geo.height())
|
|
109
|
-
self.setFloat()
|
|
110
|
-
self.show()
|
|
111
|
-
|
|
112
|
-
class infoCalVi(QMainWindow):
|
|
113
|
-
def __init__(self,gui):
|
|
114
|
-
super().__init__()
|
|
115
|
-
ui=Ui_InfoCalVi()
|
|
116
|
-
ui.setupUi(self)
|
|
117
|
-
self.ui=ui
|
|
118
|
-
setupWid(self)
|
|
119
|
-
|
|
120
|
-
infotext=self.ui.info.text().replace('#.#.#',version)
|
|
121
|
-
infotext=infotext.replace('yyyy',year)
|
|
122
|
-
mailString=f'<a href="mailto:{mail}"><span style=" text-decoration: underline; color:#0000ff; font-size:11pt">{mail}</a>'
|
|
123
|
-
infotext=infotext.replace('mmmm',mailString)
|
|
124
|
-
websiteString=f'<a href="{website}"><span style=" text-decoration: underline; color:#0000ff; font-size:11pt">{website}</a>'
|
|
125
|
-
infotext=infotext.replace('wwww',websiteString)
|
|
126
|
-
self.ui.info.setText(infotext)
|
|
127
|
-
|
|
128
|
-
self.fontPixelSize=gui.CALpar.fontPixelSize
|
|
129
|
-
self.setFontSizeText()
|
|
130
|
-
|
|
131
|
-
self.gui=gui
|
|
132
|
-
for w in self.findChildren(QObject):
|
|
133
|
-
if hasattr(w,'keyPressEvent'):
|
|
134
|
-
def createKeyPressFun(w):
|
|
135
|
-
def KeyPressFun(e):
|
|
136
|
-
if w.hasFocus():
|
|
137
|
-
#pri.Info.yellow(w)
|
|
138
|
-
type(w).keyPressEvent(w,e)
|
|
139
|
-
if not e.key() in self.gui.blockedKeys:
|
|
140
|
-
self.gui.keyPressEvent(e)
|
|
141
|
-
return KeyPressFun
|
|
142
|
-
w.keyPressEvent=createKeyPressFun(w)
|
|
143
|
-
|
|
144
|
-
def setFontSizeText(self):
|
|
145
|
-
fPixSize=self.fontPixelSize
|
|
146
|
-
setFontPixelSize(self,fPixSize)
|
|
147
|
-
setFontSizeText(self.ui.info,[fPixSize+6,fPixSize*2])
|
|
148
|
-
setFontSizeText(self.ui.info_uni,[fPixSize+4])
|
|
149
|
-
setFontSizeText(self.ui.ger_cv,[fPixSize+1])
|
|
150
|
-
setFontSizeText(self.ui.tom_cv,[fPixSize+1])
|
|
151
|
-
setFontSizeText(self.ui.list_ref,[fPixSize+1])
|
|
152
|
-
|
|
153
|
-
#********************************************* GCalVi
|
|
154
|
-
class CALpar(TABpar):
|
|
155
|
-
def __init__(self):
|
|
156
|
-
#attributes in fields
|
|
157
|
-
self.setup()
|
|
158
|
-
fields=[f for f,_ in self.__dict__.items()]
|
|
159
|
-
|
|
160
|
-
#attributes out of fields
|
|
161
|
-
super().__init__()
|
|
162
|
-
self.fields=fields
|
|
163
|
-
self.name='CALpar'
|
|
164
|
-
self.surname='gCalVi'
|
|
165
|
-
self.unchecked_fields+=[]
|
|
166
|
-
|
|
167
|
-
def setup(self):
|
|
168
|
-
self.FlagUndocked = False
|
|
169
|
-
self.prevTab = 0
|
|
170
|
-
self.lastTab = 0
|
|
171
|
-
self.FlagInput = True
|
|
172
|
-
self.FlagProcess = True
|
|
173
|
-
self.FlagVis = True
|
|
174
|
-
|
|
175
|
-
self.Geometry = 0
|
|
176
|
-
self.SplitterSizes = [[],[],[]]
|
|
177
|
-
self.ScrollAreaValues = []
|
|
178
|
-
|
|
179
|
-
self.FloatingsGeom = []
|
|
180
|
-
self.FloatingsVis = []
|
|
181
|
-
self.FScrollAreaValues = []
|
|
182
|
-
|
|
183
|
-
self.FlagButtLabel = True
|
|
184
|
-
self.paletteType = 2 #-1,2=standard, 0=light, 1=dark
|
|
185
|
-
self.printTypes = printTypes
|
|
186
|
-
self.fontPixelSize = fontPixelSize
|
|
187
|
-
|
|
188
|
-
self.FlagOutDated = 0
|
|
189
|
-
self.currentVersion = __version__
|
|
190
|
-
self.latestVersion = ''
|
|
191
|
-
|
|
192
|
-
class gCalVi(QMainWindow):
|
|
193
|
-
|
|
194
|
-
def keyboardShortcut(self,sc):
|
|
195
|
-
if sc=='Ctrl+W':
|
|
196
|
-
return
|
|
197
|
-
elif sc in ('Ctrl+0','Ctrl+Shift+0'):
|
|
198
|
-
self.CALpar.fontPixelSize=fontPixelSize
|
|
199
|
-
self.app.processEvents()
|
|
200
|
-
self.setFontPixelSize()
|
|
201
|
-
elif sc in ('Ctrl+1','Ctrl+Minus'):
|
|
202
|
-
if self.CALpar.fontPixelSize>fontPixelSize_lim[0]:
|
|
203
|
-
self.CALpar.fontPixelSize-=1
|
|
204
|
-
self.app.processEvents()
|
|
205
|
-
self.setFontPixelSize()
|
|
206
|
-
elif sc in ('Ctrl+Shift+1','Ctrl+Shift+Minus'):
|
|
207
|
-
self.CALpar.fontPixelSize=fontPixelSize_lim[0]
|
|
208
|
-
self.app.processEvents()
|
|
209
|
-
self.setFontPixelSize()
|
|
210
|
-
elif sc in ('Ctrl+9','Ctrl+Plus'):
|
|
211
|
-
if self.CALpar.fontPixelSize<fontPixelSize_lim[1]:
|
|
212
|
-
self.CALpar.fontPixelSize+=1
|
|
213
|
-
self.app.processEvents()
|
|
214
|
-
self.setFontPixelSize()
|
|
215
|
-
elif sc in ('Ctrl+Shift+9','Ctrl+Shift+Plus'):
|
|
216
|
-
self.CALpar.fontPixelSize=fontPixelSize_lim[1]
|
|
217
|
-
self.app.processEvents()
|
|
218
|
-
self.setFontPixelSize()
|
|
219
|
-
|
|
220
|
-
def paintEvent(self,event):
|
|
221
|
-
#pri.General.yellow('***painting')
|
|
222
|
-
super().paintEvent(event)
|
|
223
|
-
|
|
224
|
-
if not self.FlagUndocking:
|
|
225
|
-
self.setOpButtonLabel()
|
|
226
|
-
|
|
227
|
-
def resizeEvent(self,event):
|
|
228
|
-
if self.flagGeometryInit:
|
|
229
|
-
self.flagGeometryInit=False
|
|
230
|
-
return
|
|
231
|
-
self.setFontPixelSize()
|
|
232
|
-
super().resizeEvent(event)
|
|
233
|
-
#self.updateCALparGeom()
|
|
234
|
-
|
|
235
|
-
def closeEvent(self,event):
|
|
236
|
-
''' This event handler is called with the given event when Qt receives a window close request for a top-level widget '''
|
|
237
|
-
if self.FlagRun and not self.FlagClosing[0]:
|
|
238
|
-
flagYes=self.questionDialog('CalVi is currently running on a process. If you close the application now, processing will be stopped. Are you sure you want to quit?')
|
|
239
|
-
if not flagYes:
|
|
240
|
-
event.ignore()
|
|
241
|
-
return
|
|
242
|
-
self.hide()
|
|
243
|
-
for f in self.floatings+self.floatw+[self.aboutDialog]:
|
|
244
|
-
if f: f.hide()
|
|
245
|
-
print('\nClosing CalVi...')
|
|
246
|
-
if self.FlagRun:
|
|
247
|
-
self.button_Abort_callback()
|
|
248
|
-
self.correctClose()
|
|
249
|
-
|
|
250
|
-
def correctClose(self):
|
|
251
|
-
if self.cfgname!=lastcfgname_CalVi:
|
|
252
|
-
self.saveas_uicfg(self.cfgname)
|
|
253
|
-
self.save_lastcfg()
|
|
254
|
-
PrintTA.flagPriority=PrintTAPriority.always
|
|
255
|
-
self.closeAll()
|
|
256
|
-
self.close()
|
|
257
|
-
self.app.processEvents()
|
|
258
|
-
self.app.SecondaryThreads=self.SecondaryThreads
|
|
259
|
-
self.app.quit()
|
|
260
|
-
|
|
261
|
-
def closeAll(self):
|
|
262
|
-
if hasattr(self,"floatings"):
|
|
263
|
-
for w in self.floatings:
|
|
264
|
-
w.close()
|
|
265
|
-
if hasattr(self,"floatw"):
|
|
266
|
-
for w in self.floatw:
|
|
267
|
-
w.close()
|
|
268
|
-
self.w_Vis.close() #***** ?????
|
|
269
|
-
|
|
270
|
-
class gCalVi_signals(QObject):
|
|
271
|
-
guiInit=Signal()
|
|
272
|
-
killOrResetParForWorker=Signal(bool)#used to kill or reset he parForWorker
|
|
273
|
-
setImg=Signal()
|
|
274
|
-
run=Signal()
|
|
275
|
-
printOutDated=Signal(bool)
|
|
276
|
-
|
|
277
|
-
def __init__(self,flagDebug=False,app=None):
|
|
278
|
-
self.app:QApplication=app
|
|
279
|
-
self.name='CalVi'
|
|
280
|
-
activateFlagDebug(flagDebug)
|
|
281
|
-
self.PIVvers=PaIRS_lib.Version(PaIRS_lib.MOD_PIV).split('\n')[0]
|
|
282
|
-
pri.Time.blue(2,f'gCalVi init PaIRS-PIV {self.PIVvers}')
|
|
283
|
-
super().__init__()
|
|
284
|
-
|
|
285
|
-
#------------------------------------- Launching Parallel Pool
|
|
286
|
-
self.previousPlotTime=time() #previous time for plotting
|
|
287
|
-
self.signals=self.gCalVi_signals()
|
|
288
|
-
self.flagGeometryInit=True
|
|
289
|
-
|
|
290
|
-
self.FlagGuiInit=False
|
|
291
|
-
self.signals=self.gCalVi_signals()
|
|
292
|
-
self.signals.guiInit.connect(self.show)
|
|
293
|
-
#self.numUsedThreadsPIV=NUMTHREADS_PIV
|
|
294
|
-
#self.FlagParPoolInit=False
|
|
295
|
-
#self.launchParPool(NUMTHREADS_PIV_MAX)
|
|
296
|
-
self.SecondaryThreads=[]
|
|
297
|
-
|
|
298
|
-
#------------------------------------- Graphical interface: widgets
|
|
299
|
-
ui=Ui_gCalVi()
|
|
300
|
-
ui.setupUi(self)
|
|
301
|
-
self.ui=ui
|
|
302
|
-
|
|
303
|
-
self.defineTabs()
|
|
304
|
-
self.cfgname=lastcfgname_CalVi
|
|
305
|
-
self.w_Vis.setRunButtonText=self.setRunButtonText
|
|
306
|
-
|
|
307
|
-
self.FlagHappyLogo=False
|
|
308
|
-
self.setupLogo()
|
|
309
|
-
|
|
310
|
-
setupWid(self) #---------------- IMPORTANT
|
|
311
|
-
self.setTabFontPixelSize(fontPixelSize)
|
|
312
|
-
#for the keyboard shortcut
|
|
313
|
-
self.FlagKeyCallbackExec=False
|
|
314
|
-
self.blockedKeys=[Qt.Key.Key_Up,Qt.Key.Key_Down,Qt.Key.Key_Left,Qt.Key.Key_Right]
|
|
315
|
-
for w in self.findChildren(QObject):
|
|
316
|
-
if hasattr(w,'keyPressEvent'):
|
|
317
|
-
def createKeyPressFun(w):
|
|
318
|
-
def KeyPressFun(e):
|
|
319
|
-
if w.hasFocus():
|
|
320
|
-
#pri.Info.yellow(w)
|
|
321
|
-
if not self.FlagKeyCallbackExec:
|
|
322
|
-
self.FlagKeyCallbackExec=True
|
|
323
|
-
type(w).keyPressEvent(w,e)
|
|
324
|
-
if not e.key() in self.blockedKeys:
|
|
325
|
-
self.keyPressEvent(e)
|
|
326
|
-
self.FlagKeyCallbackExec=False
|
|
327
|
-
return KeyPressFun
|
|
328
|
-
w.keyPressEvent=createKeyPressFun(w)
|
|
329
|
-
self.w_Vis.setLogFont(fontPixelSize-dfontLog)
|
|
330
|
-
|
|
331
|
-
#for positioning and resizing
|
|
332
|
-
window=QWindow()
|
|
333
|
-
window.setTitle("title")
|
|
334
|
-
window.showMaximized()
|
|
335
|
-
self.MaxGeo=window.geometry()
|
|
336
|
-
self.MaxFrameGeo=window.frameGeometry()
|
|
337
|
-
window.close()
|
|
338
|
-
|
|
339
|
-
self.secondary_splitter=ui.secondary_splitter
|
|
340
|
-
self.Vis_maxWidth=self.w_Vis.maximumWidth()
|
|
341
|
-
self.fVis_maxWidth=self.ui.f_VisTab.maximumWidth()
|
|
342
|
-
self.minW=self.minimumWidth()
|
|
343
|
-
self.maxW=self.maximumWidth()
|
|
344
|
-
margins=self.ui.Clayout.contentsMargins()
|
|
345
|
-
self.minW_ManTabs=self.minimumWidth()-margins.left()-margins.right()
|
|
346
|
-
|
|
347
|
-
#------------------------------------- Graphical interface: miscellanea
|
|
348
|
-
self.icon_dock_tabs = QIcon()
|
|
349
|
-
self.icon_dock_tabs.addFile(u""+ icons_path +"dock_tabs.png", QSize(), QIcon.Normal, QIcon.Off)
|
|
350
|
-
self.icon_undock_tabs = QIcon()
|
|
351
|
-
self.icon_undock_tabs.addFile(u""+ icons_path +"undock_tabs.png", QSize(), QIcon.Normal, QIcon.Off)
|
|
352
|
-
self.icon_play = QIcon()
|
|
353
|
-
self.icon_play.addFile(u""+ icons_path +"play.png", QSize(), QIcon.Normal, QIcon.Off) #"down_arrow.png"/"menu_vert.png"
|
|
354
|
-
self.icon_pause = QIcon()
|
|
355
|
-
self.icon_pause.addFile(u""+ icons_path +"pause.png", QSize(), QIcon.Normal, QIcon.Off) #"right_arrow.png"/"menu_docked.png"
|
|
356
|
-
|
|
357
|
-
self.animation = QVariantAnimation(self.ui.scrollArea)
|
|
358
|
-
|
|
359
|
-
self.updating_import_gif = QMovie(u""+ icons_path +"updating_import.gif")
|
|
360
|
-
self.updating_import_gif.setScaledSize(self.ui.label_updating_import.size())
|
|
361
|
-
#self.ui.label_updating_import.setScaledContents(True)
|
|
362
|
-
self.updating_import_gif.start()
|
|
363
|
-
self.ui.label_updating_import.setMovie(self.updating_import_gif)
|
|
364
|
-
self.ui.label_updating_import.setVisible(False)
|
|
365
|
-
|
|
366
|
-
self.updating_pairs_gif = QMovie(u""+ icons_path +"updating_pairs.gif")
|
|
367
|
-
self.updating_pairs_gif.setScaledSize(self.ui.label_updating_pairs.size())
|
|
368
|
-
#self.ui.label_updating_pairs.setScaledContents(True)
|
|
369
|
-
self.updating_pairs_gif.start()
|
|
370
|
-
self.ui.label_updating_pairs.setMovie(self.updating_pairs_gif)
|
|
371
|
-
self.ui.label_updating_pairs.setVisible(False)
|
|
372
|
-
|
|
373
|
-
self.FlagUndocking=False
|
|
374
|
-
self.FlagButtLabel=None
|
|
375
|
-
self.palettes=[lightPalette(),darkPalette(),None]
|
|
376
|
-
self.paletteNames=['Light','Dark','System']
|
|
377
|
-
#self.ui.logo.contextMenuEvent=self.paletteContextMenuEvent
|
|
378
|
-
self.ui.logo.mousePressEvent=self.paletteContextMenuEvent
|
|
379
|
-
cursor_lamp_pixmap=QtGui.QPixmap(''+ icons_path +'cursor_lamp.png').scaled(QSize(24,24), Qt.KeepAspectRatio)
|
|
380
|
-
cursor_lamp = QtGui.QCursor(cursor_lamp_pixmap,-1,-1)
|
|
381
|
-
self.ui.logo.setCursor(cursor_lamp)
|
|
382
|
-
|
|
383
|
-
self.aboutDialog=None
|
|
384
|
-
self.logChanges=None
|
|
385
|
-
|
|
386
|
-
self.fontPixelSize=fontPixelSize
|
|
387
|
-
self.ui.button_PaIRS_download.setCursor(Qt.CursorShape.PointingHandCursor)
|
|
388
|
-
self.signals.printOutDated.connect(lambda flagOutDated: self.ui.button_PaIRS_download.setVisible(flagOutDated))
|
|
389
|
-
|
|
390
|
-
#------------------------------------- Declaration of parameters
|
|
391
|
-
self.CALpar_base=CALpar()
|
|
392
|
-
self.CALpar_old=CALpar()
|
|
393
|
-
self.CALpar=CALpar()
|
|
394
|
-
self.TABpar=self.CALpar
|
|
395
|
-
|
|
396
|
-
self.FlagFirstShow=True
|
|
397
|
-
self.FlagRun=False
|
|
398
|
-
self.procWorkers=[]
|
|
399
|
-
self.contProc=self.nProc=0
|
|
400
|
-
self.FlagProcInit=False
|
|
401
|
-
self.FlagProcPlot=False
|
|
402
|
-
self.procFields=['numProcOrErrTot','Log','list_print','list_pim','numCallBackTotOk','numFinalized','flagRun','flagParForCompleted']
|
|
403
|
-
|
|
404
|
-
self.floatings=[]
|
|
405
|
-
self.defineFloatings()
|
|
406
|
-
self.floatw=[]
|
|
407
|
-
|
|
408
|
-
self.menuDebug=None
|
|
409
|
-
|
|
410
|
-
#------------------------------------- Callbacks
|
|
411
|
-
self.setupCallbacks()
|
|
412
|
-
|
|
413
|
-
self.w_Vis.FlagAddPrev=False
|
|
414
|
-
|
|
415
|
-
gPaIRS_Tab.indTreeGlob=0
|
|
416
|
-
gPaIRS_Tab.indItemGlob=0
|
|
417
|
-
gPaIRS_Tab.FlagGlob=True
|
|
418
|
-
|
|
419
|
-
self.w_Import.FlagDisplayControls=True
|
|
420
|
-
self.w_Process.FlagDisplayControls=False
|
|
421
|
-
self.w_Vis.FlagDisplayControls=False
|
|
422
|
-
|
|
423
|
-
self.moveBFbuttons()
|
|
424
|
-
|
|
425
|
-
#shortcuts
|
|
426
|
-
scs=['Ctrl+W','Ctrl+0','Ctrl+Shift+0','Ctrl+1','Ctrl+Minus','Ctrl+Shift+1','Ctrl+Shift+Minus','Ctrl+9','Ctrl+Plus','Ctrl+Shift+9','Ctrl+Shift+Plus']
|
|
427
|
-
self.keyboardQShortcuts=[]
|
|
428
|
-
for sc in scs:
|
|
429
|
-
kQSc=QShortcut(QKeySequence(sc), self)
|
|
430
|
-
kQSc.activated.connect(lambda sc=sc: self.keyboardShortcut(sc))
|
|
431
|
-
self.keyboardQShortcuts.append(kQSc)
|
|
432
|
-
|
|
433
|
-
self.w_Import.signals.list_selection.connect(self.selectImgFromImport)
|
|
434
|
-
self.w_Vis.updateGCalVi=self.setRunningState
|
|
435
|
-
|
|
436
|
-
#------------------------------------- Initialization
|
|
437
|
-
from .PaIRS_pypacks import basefold
|
|
438
|
-
basefold=myStandardPath(basefold)
|
|
439
|
-
from .PaIRS_pypacks import basefold
|
|
440
|
-
basefold=myStandardPath(basefold)
|
|
441
|
-
if os.path.exists(lastcfgname_CalVi) and not Flag_DEBUG_CleanLaunch:
|
|
442
|
-
WarningMessage='Error with loading the last configuration file.\n'
|
|
443
|
-
Flag,var=self.import_uicfg(lastcfgname_CalVi,WarningMessage)
|
|
444
|
-
if not Flag:
|
|
445
|
-
os.remove(lastcfgname_CalVi)
|
|
446
|
-
self.initialize()
|
|
447
|
-
else:
|
|
448
|
-
try:
|
|
449
|
-
CALpar_prev=var[1]
|
|
450
|
-
self.CALpar.copyfrom(CALpar_prev)
|
|
451
|
-
self.setCALpar()
|
|
452
|
-
except Exception as inst:
|
|
453
|
-
warningDialog(self,WarningMessage,flagScreenCenter=True)
|
|
454
|
-
pri.Error.red(f'{WarningMessage}:\n{traceback.print_exc()}\n\n{inst}')
|
|
455
|
-
os.remove(lastcfgname_CalVi)
|
|
456
|
-
self.initialize()
|
|
457
|
-
else:
|
|
458
|
-
self.initialize()
|
|
459
|
-
self.CALpar_old.copyfrom(self.CALpar)
|
|
460
|
-
|
|
461
|
-
#------------------------------------- Debug
|
|
462
|
-
self.addDebugMenu()
|
|
463
|
-
self.menuDebug.setFont(self.ui.menuFile.font())
|
|
464
|
-
self.menuDebug.menuAction().setVisible(Flag_DEBUG)
|
|
465
|
-
self.userDebugShortcut = QShortcut(QKeySequence('Shift+Alt+D'), self)
|
|
466
|
-
self.userDebugShortcut.activated.connect(self.userDebugMode)
|
|
467
|
-
self.developerDebugShortcut = QShortcut(QKeySequence('Alt+D, Alt+E, Alt+B, Alt+Return'), self)
|
|
468
|
-
self.developerDebugShortcut.activated.connect(lambda:self.setDebugMode(True))
|
|
469
|
-
#self.exitDebugShortcut = QShortcut(QKeySequence('Shift+Alt+D'), self)
|
|
470
|
-
#self.exitDebugShortcut.activated.connect(lambda:self.setDebugMode(False))
|
|
471
|
-
self.setDebugMode(flagDebug)# should be put not upper than here
|
|
472
|
-
self.w_Process.Flag_CYLINDERCAL_option=self.ui.aCyl
|
|
473
|
-
|
|
474
|
-
pri.Time.blue(0,'dopo setupUi')
|
|
475
|
-
self.FlagClosing=[False]
|
|
476
|
-
self.w_Import.setPathCompleter()
|
|
477
|
-
|
|
478
|
-
self.load_gif = QMovie(u""+ icons_path +"loading_2.gif")
|
|
479
|
-
self.load_gif.start()
|
|
480
|
-
self.loaded_map=QPixmap(u""+ icons_path + "loaded.png")
|
|
481
|
-
self.w_Import.ui.button_back.hide()
|
|
482
|
-
self.w_Import.ui.button_forward.hide()
|
|
483
|
-
|
|
484
|
-
self.FlagGuiInit=True
|
|
485
|
-
pri.Time.blue(0,'fine di tutto init')
|
|
486
|
-
|
|
487
|
-
def initialize(self):
|
|
488
|
-
pri.Info.yellow('||| Initializing gCalVi |||')
|
|
489
|
-
#necessary to initialize sizes in both configurations
|
|
490
|
-
self.CALpar.FlagUndocked=True
|
|
491
|
-
self.DefaultSize() #undocked
|
|
492
|
-
self.CALpar.FlagUndocked=False
|
|
493
|
-
self.DefaultSize() #docked
|
|
494
|
-
self.w_Import.initialize()
|
|
495
|
-
self.w_Process.initialize()
|
|
496
|
-
self.w_Vis.calibView.hide()
|
|
497
|
-
#self.w_Vis.initialize()
|
|
498
|
-
self.setCALpar()
|
|
499
|
-
|
|
500
|
-
def moveBFbuttons(self):
|
|
501
|
-
self.w_Import.ui.bfLayout.removeWidget(self.w_Import.ui.label_number)
|
|
502
|
-
self.w_Import.ui.bfLayout.removeItem(self.w_Import.ui.hs_bf)
|
|
503
|
-
self.w_Import.ui.bfLayout.removeWidget(self.w_Import.ui.button_back)
|
|
504
|
-
self.w_Import.ui.bfLayout.removeWidget(self.w_Import.ui.button_forward)
|
|
505
|
-
self.ui.bfLayout.addWidget(self.w_Import.ui.label_number)
|
|
506
|
-
self.ui.bfLayout.addItem(self.w_Import.ui.hs_bf)
|
|
507
|
-
self.ui.bfLayout.addWidget(self.w_Import.ui.button_back)
|
|
508
|
-
self.ui.bfLayout.addWidget(self.w_Import.ui.button_forward)
|
|
509
|
-
|
|
510
|
-
def defineFloatings(self):
|
|
511
|
-
self.floatings=[]
|
|
512
|
-
for i,wn in enumerate(self.opwidnames):
|
|
513
|
-
wname="w_"+wn
|
|
514
|
-
wid=getattr(self,wname)
|
|
515
|
-
self.floatings.append(FloatingObject(self,wid))
|
|
516
|
-
for f in self.floatings:
|
|
517
|
-
self.CALpar.FloatingsGeom.append(f.geometry())
|
|
518
|
-
self.CALpar.FloatingsVis.append(f.isVisible())
|
|
519
|
-
geo=self.floatings[self.CALpar.prevTab].geometry()
|
|
520
|
-
for k in range(3): self.CALpar.FloatingsGeom[k]=geo
|
|
521
|
-
self.CALpar.FloatingsGeom.append(self.geometry())
|
|
522
|
-
self.CALpar.FloatingsVis.append(self.isVisible())
|
|
523
|
-
|
|
524
|
-
def setupCallbacks(self):
|
|
525
|
-
#------------------------------------- Main Window buttons
|
|
526
|
-
for j,wn in enumerate(self.optabnames):
|
|
527
|
-
setattr(self.CALpar,"Flag"+wn,True)
|
|
528
|
-
"""
|
|
529
|
-
self.ui.button_Input.clicked.connect(self.w_Tree.addParWrapper(lambda: self.button_Tab_callback('Input'),'gCalVi') )
|
|
530
|
-
self.ui.button_Output.clicked.connect(self.w_Tree.addParWrapper(lambda: self.button_Tab_callback('Output'),'gCalVi') )
|
|
531
|
-
self.ui.button_Process.clicked.connect(self.w_Tree.addParWrapper(lambda: self.button_Tab_callback('Process'),'gCalVi') )
|
|
532
|
-
self.ui.button_Log.clicked.connect(self.w_Tree.addParWrapper(lambda: self.button_Tab_callback('Log'),'gCalVi') )
|
|
533
|
-
self.ui.button_Vis.clicked.connect(self.w_Tree.addParWrapper(lambda: self.button_Tab_callback('Vis'),'gCalVi') )
|
|
534
|
-
self.ui.button_default_sizes.clicked.connect(self.w_Tree.addParWrapper(self.button_default_sizes_callback,'gCalVi'))
|
|
535
|
-
self.ui.button_dock.clicked.connect(self.w_Tree.addParWrapper(self.button_dock_callback,'gCalVi'))
|
|
536
|
-
self.ui.button_Shape.clicked.connect(self.w_Tree.addParWrapper(self.button_Shape_callback,'gCalVi'))
|
|
537
|
-
"""
|
|
538
|
-
self.ui.button_Input.clicked.connect(lambda: self.button_Tab_callback('Input'))
|
|
539
|
-
self.ui.button_Process.clicked.connect(lambda: self.button_Tab_callback('Process'))
|
|
540
|
-
self.ui.button_Vis.clicked.connect(lambda: self.button_Tab_callback('Vis'))
|
|
541
|
-
for k,wn in enumerate(self.opwidnames):
|
|
542
|
-
def setClosedCallback(wn):
|
|
543
|
-
w=getattr(self,'w_'+wn)
|
|
544
|
-
w.ui.button_close_tab.clicked.connect(lambda: self.close_tab(w))
|
|
545
|
-
setClosedCallback(wn)
|
|
546
|
-
self.secondary_splitter.addfuncout['setScrollAreaWidth']=self.setScrollAreaWidth
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
self.ui.button_default_sizes.clicked.connect(self.button_default_sizes_callback)
|
|
550
|
-
self.ui.button_dock.clicked.connect(self.button_dock_callback)
|
|
551
|
-
|
|
552
|
-
self.ui.button_Run.clicked.connect(self.w_Vis.addParWrapper(self.run,'gCalVi'))
|
|
553
|
-
self.button_Abort_callback=self.w_Vis.addParWrapper(self.abort,'gCalVi')
|
|
554
|
-
self.ui.button_Abort.clicked.connect(self.button_Abort_callback)
|
|
555
|
-
self.ui.button_import.clicked.connect(self.importProc)
|
|
556
|
-
|
|
557
|
-
#------------------------------------- Menu
|
|
558
|
-
self.ui.actionPaIRS_Run.triggered.connect(lambda: runPaIRS(self,))
|
|
559
|
-
self.ui.actionPaIRS_Clean_run.triggered.connect(lambda: runPaIRS(self,'-c'))
|
|
560
|
-
self.ui.actionPaIRS_Debug_run.triggered.connect(lambda: runPaIRS(self,'-d'))
|
|
561
|
-
self.ui.actionCalVi_Run.triggered.connect(lambda: runPaIRS(self,'-calvi'))
|
|
562
|
-
self.ui.actionCalVi_Clean_run.triggered.connect(lambda: runPaIRS(self,'-calvi -c'))
|
|
563
|
-
self.ui.actionCalVi_Debug_run.triggered.connect(lambda: runPaIRS(self,'-calvi -d'))
|
|
564
|
-
#self.ui.actionCalVI.triggered.connect(self.runCalVi)
|
|
565
|
-
self.ui.actionNew.triggered.connect(self.new_uicfg)
|
|
566
|
-
self.ui.actionLoad.triggered.connect(self.load_uicfg)
|
|
567
|
-
self.ui.actionSave.triggered.connect(self.save_uicfg)
|
|
568
|
-
self.ui.actionSave_as.triggered.connect(self.saveas_uicfg)
|
|
569
|
-
self.ui.actionClose.triggered.connect(self.close_uicfg)
|
|
570
|
-
self.ui.aExit.triggered.connect(self.close)
|
|
571
|
-
self.showChanges=lambda: changes(self,Log_Tab,fileChanges)
|
|
572
|
-
self.ui.actionChanges.triggered.connect(self.showChanges)
|
|
573
|
-
self.ui.actionAbout.triggered.connect(self.about)
|
|
574
|
-
self.ui.actionGuide.triggered.connect(self.guide)
|
|
575
|
-
self.ui.button_PaIRS_download.clicked.connect(lambda: button_download_PaIRS_callback(self,self.app))
|
|
576
|
-
|
|
577
|
-
#------------------------------------- Animations
|
|
578
|
-
self.animation.valueChanged.connect(self.moveToColumn)
|
|
579
|
-
|
|
580
|
-
def setFontPixelSize(self):
|
|
581
|
-
if self.fontPixelSize==self.CALpar.fontPixelSize: return
|
|
582
|
-
fPixSize=self.CALpar.fontPixelSize
|
|
583
|
-
font=QFont()
|
|
584
|
-
font.setFamily(fontName)
|
|
585
|
-
font.setPixelSize(fPixSize)
|
|
586
|
-
if self.app: self.app.setFont(font)
|
|
587
|
-
setFontPixelSize(self,fPixSize)
|
|
588
|
-
self.setTabFontPixelSize(fPixSize)
|
|
589
|
-
for tn in self.optabnames:
|
|
590
|
-
self.setOpButtonText(tn)
|
|
591
|
-
if self.aboutDialog:
|
|
592
|
-
self.aboutDialog.fontPixelSize=self.CALpar.fontPixelSize
|
|
593
|
-
self.aboutDialog.setFontSizeText()
|
|
594
|
-
if self.logChanges: self.logChanges.setFontPixelSize(fPixSize)
|
|
595
|
-
if self.menuDebug: self.menuDebug.setFont(self.ui.menuFile.font())
|
|
596
|
-
self.fontPixelSize=fPixSize
|
|
597
|
-
|
|
598
|
-
def setTabFontPixelSize(self,fPixSize):
|
|
599
|
-
fPixSize_TabNames=min([fPixSize*2,30])
|
|
600
|
-
for tn,wn in zip(self.optabnames,self.opwidnames):
|
|
601
|
-
w=getattr(self,'w_'+wn)
|
|
602
|
-
setFontPixelSize(w,fPixSize)
|
|
603
|
-
qlabels=self.findChildren(QLabel)
|
|
604
|
-
labs=[l for l in qlabels if 'name_tab' in l.objectName()]
|
|
605
|
-
for lab in labs:
|
|
606
|
-
lab:QLabel #=self.ui.name_tab
|
|
607
|
-
font=lab.font()
|
|
608
|
-
font.setPixelSize(fPixSize_TabNames)
|
|
609
|
-
lab.setFont(font)
|
|
610
|
-
button:RichTextPushButton=getattr(self.ui,f"button_{tn}")
|
|
611
|
-
font=button.font()
|
|
612
|
-
font.setPixelSize(fPixSize+1)
|
|
613
|
-
button.setFont(font)
|
|
614
|
-
button.lbl.setFont(font)
|
|
615
|
-
for tn in ('Run','Abort'):
|
|
616
|
-
button:RichTextPushButton=getattr(self.ui,f"button_{tn}")
|
|
617
|
-
font=button.font()
|
|
618
|
-
font.setPixelSize(fPixSize+1)
|
|
619
|
-
button.setFont(font)
|
|
620
|
-
button.lbl.setFont(font)
|
|
621
|
-
self.w_Vis.setLogFont(fPixSize-dfontLog)
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
#********************************************* TAB definitions
|
|
625
|
-
def defineTabs(self):
|
|
626
|
-
self.optabnames=['Input','Process','Vis']
|
|
627
|
-
self.opwidnames=['Import','Process','Vis'] #+'Tab'
|
|
628
|
-
wclasses=[Import_Tab_CalVi,Process_Tab_CalVi,Vis_Tab_CalVi]
|
|
629
|
-
|
|
630
|
-
for k,tname in enumerate(self.opwidnames):
|
|
631
|
-
wname='w_'+tname
|
|
632
|
-
setattr(self,wname,wclasses[k](self,False))
|
|
633
|
-
w=getattr(self,wname)
|
|
634
|
-
lay=getattr(self.ui,'f'+tname+'_lay')
|
|
635
|
-
lay.addWidget(w)
|
|
636
|
-
#w.show()
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
self.w_Import:Import_Tab_CalVi
|
|
640
|
-
self.w_Process:Process_Tab_CalVi
|
|
641
|
-
self.w_Vis:Vis_Tab_CalVi
|
|
642
|
-
|
|
643
|
-
self.TABnames=['Import','Process','Vis']
|
|
644
|
-
self.TABParDataNames=['INP','PRO','VIS']
|
|
645
|
-
|
|
646
|
-
self.defineTABbridges()
|
|
647
|
-
|
|
648
|
-
def defineTABbridges(self):
|
|
649
|
-
for tname in self.TABnames:
|
|
650
|
-
w: gPaIRS_Tab
|
|
651
|
-
self.defineTAB_setParBridge(tname)
|
|
652
|
-
self.defineTAB_addParBridge(tname)
|
|
653
|
-
wname='w_'+tname
|
|
654
|
-
w=getattr(self,wname)
|
|
655
|
-
w.TABname=tname
|
|
656
|
-
w.fUpdatingTabs=self.setRunningState
|
|
657
|
-
|
|
658
|
-
def defineTAB_addParBridge(self,tname):
|
|
659
|
-
w: gPaIRS_Tab
|
|
660
|
-
wname='w_'+tname
|
|
661
|
-
w=getattr(self,wname)
|
|
662
|
-
fadd_par_copy=[]
|
|
663
|
-
w2=[]
|
|
664
|
-
for tname2 in self.TABnames:
|
|
665
|
-
if tname2!=tname:
|
|
666
|
-
wname2='w_'+tname2
|
|
667
|
-
w2.append(getattr(self,wname2))
|
|
668
|
-
fadd_par_copy.append(w2[-1].add_TABpar_copy)
|
|
669
|
-
def add_par_bridge(tip,indTree,indItem,ind):
|
|
670
|
-
w2j: gPaIRS_Tab
|
|
671
|
-
#self.w_Tree.TABpar=dataTreePar()
|
|
672
|
-
for f,w2j in zip(fadd_par_copy,w2):
|
|
673
|
-
w2j.TABpar.freset_par=wname
|
|
674
|
-
f(tip)
|
|
675
|
-
w.add_TABpar_bridge=add_par_bridge
|
|
676
|
-
|
|
677
|
-
def defineTAB_setParBridge(self,tname):
|
|
678
|
-
w: gPaIRS_Tab
|
|
679
|
-
wname='w_'+tname
|
|
680
|
-
w=getattr(self,wname)
|
|
681
|
-
fset_par=[]
|
|
682
|
-
fset_par_prev=[]
|
|
683
|
-
w2=[]
|
|
684
|
-
for tname2 in self.TABnames:
|
|
685
|
-
if tname2!=tname:
|
|
686
|
-
wname2='w_'+tname2
|
|
687
|
-
w2.append(getattr(self,wname2))
|
|
688
|
-
fset_par.append(w2[-1].setTABpar)
|
|
689
|
-
fset_par_prev.append(w2[-1].setTABpar_prev)
|
|
690
|
-
def set_par_bridge():
|
|
691
|
-
fw=self.focusWidget()
|
|
692
|
-
self.actualBridge(tname,-1,-1,-1)
|
|
693
|
-
for f in fset_par:
|
|
694
|
-
f(False) #setting parameters without bridge (False=without bridge)
|
|
695
|
-
if fw: fw.setFocus()
|
|
696
|
-
def set_par_bridge_prev(indTree,indItem,ind):
|
|
697
|
-
fw=self.focusWidget()
|
|
698
|
-
self.actualBridge(tname,indTree,indItem,ind)
|
|
699
|
-
for f in fset_par_prev:
|
|
700
|
-
f(indTree,indItem,ind,False) #setting previous parameters without bridge (False=without bridge)
|
|
701
|
-
if fw: fw.setFocus()
|
|
702
|
-
w.defineTABbridge(set_par_bridge,set_par_bridge_prev)
|
|
703
|
-
|
|
704
|
-
def actualBridge(self,tname,indTree,indItem,ind):
|
|
705
|
-
if ind>-1:
|
|
706
|
-
pri.Callback.green(f' --- gCalVi bridge_prev {[indTree]}{[indItem]}{[ind]}')
|
|
707
|
-
INP:INPpar_CalVi=self.w_Import.TABpar_prev[indTree][indItem][ind]
|
|
708
|
-
PRO:PROpar_CalVi=self.w_Process.TABpar_prev[indTree][indItem][ind]
|
|
709
|
-
VIS:VISpar_CalVi=self.w_Vis.TABpar_prev[indTree][indItem][ind]
|
|
710
|
-
else:
|
|
711
|
-
INP=self.w_Import.TABpar
|
|
712
|
-
PRO=self.w_Process.TABpar
|
|
713
|
-
VIS=self.w_Vis.TABpar
|
|
714
|
-
|
|
715
|
-
INP.FlagReadCalib=PRO.CalibProcType>=2
|
|
716
|
-
if tname=='Import':
|
|
717
|
-
self.initDataAndSetImgFromGui(INP,PRO)
|
|
718
|
-
indTree,indItem,ind=self.w_Import.INPpar.indexes()
|
|
719
|
-
if ind:
|
|
720
|
-
flagResetLevels=self.w_Import.TABpar_prev[indTree][indItem][ind-1].isDifferentFrom(self.w_Import.TABpar,[],['path'],True) or len(self.w_Import.TABpar_prev[indTree][indItem][ind-1].filenames)==0
|
|
721
|
-
flagResetZoom=self.w_Import.TABpar_prev[indTree][indItem][ind-1].isDifferentFrom(self.w_Import.TABpar,[],['x','y','w','h','W','H'],True) or len(self.w_Import.TABpar_prev[indTree][indItem][ind-1].filenames)==0
|
|
722
|
-
else:
|
|
723
|
-
flagResetLevels=flagResetZoom=True
|
|
724
|
-
self.w_Vis.calib2VIS(flagResetLevels=flagResetLevels,flagResetZoom=flagResetZoom)
|
|
725
|
-
pass
|
|
726
|
-
if tname=='Process':
|
|
727
|
-
self.w_Import.INPpar.FlagOptPlane=self.w_Process.PROpar.CalibProcType>0
|
|
728
|
-
if len(self.w_Import.INPpar.plapar):
|
|
729
|
-
if self.w_Import.INPpar.FlagOptPlane:
|
|
730
|
-
for k,p in enumerate(self.w_Import.INPpar.plapar):
|
|
731
|
-
if len(p)==1:
|
|
732
|
-
self.w_Import.INPpar.plapar[k]=[float(0)]*5+[p[0]]
|
|
733
|
-
else:
|
|
734
|
-
for k,p in enumerate(self.w_Import.INPpar.plapar):
|
|
735
|
-
if len(p)>1:
|
|
736
|
-
self.w_Import.INPpar.plapar[k]=[p[-1]]
|
|
737
|
-
self.initDataAndSetImgFromGui(INP,PRO)
|
|
738
|
-
indTree,indItem,ind=self.w_Process.PROpar.indexes()
|
|
739
|
-
self.w_Vis.calib2VIS(flagResetLevels=False,flagResetZoom=False)
|
|
740
|
-
pass
|
|
741
|
-
if tname=='Vis':
|
|
742
|
-
INP.row=VIS.plane
|
|
743
|
-
pass
|
|
744
|
-
return
|
|
745
|
-
|
|
746
|
-
def initDataAndSetImgFromGui(self,INP,PRO):
|
|
747
|
-
self.w_Vis.initDataFromGui(INP,PRO)
|
|
748
|
-
inddel=self.w_Vis.setImgFromGui()
|
|
749
|
-
if len(inddel): #todo GP: migliorare? (setto due volte le immagini e faccio in calib il check)
|
|
750
|
-
Message=f'The following image files have sizes not compatible with the first image file of the list ({self.w_Import.INPpar.filenames[0]}):\n'
|
|
751
|
-
for k in inddel:
|
|
752
|
-
if k==inddel[-1]: colon='.'
|
|
753
|
-
else: colon=';'
|
|
754
|
-
Message+=f'- {self.w_Import.INPpar.filenames[k]}{colon}\n'
|
|
755
|
-
Message+='They will not be added to the list.'
|
|
756
|
-
self.warningDialog(Message)
|
|
757
|
-
for i in range(len(inddel)-1,-1,-1):
|
|
758
|
-
k=inddel[i]
|
|
759
|
-
self.w_Import.INPpar.filenames.pop(k)
|
|
760
|
-
self.w_Import.INPpar.plapar.pop(k)
|
|
761
|
-
self.w_Import.adjust_list_images()
|
|
762
|
-
self.w_Import.setINPpar()
|
|
763
|
-
self.w_Vis.initDataFromGui(INP,PRO)
|
|
764
|
-
inddel=self.w_Vis.setImgFromGui()
|
|
765
|
-
|
|
766
|
-
@Slot()
|
|
767
|
-
def selectImgFromImport(self):
|
|
768
|
-
r=self.w_Import.ui.list_images.currentRow()
|
|
769
|
-
self.w_Vis.VISpar.plane=r
|
|
770
|
-
self.w_Vis.setTABpar(False)
|
|
771
|
-
|
|
772
|
-
def setRunningState(self):
|
|
773
|
-
flag=self.w_Vis.calibView.flagCurrentTask!=CalibTasks.stop
|
|
774
|
-
self.ui.label_updating_pairs.setVisible(flag)
|
|
775
|
-
pass
|
|
776
|
-
|
|
777
|
-
#*************************************************** Run
|
|
778
|
-
|
|
779
|
-
def run(self):
|
|
780
|
-
self.FlagRun=self.w_Vis.VISpar.FlagRun=not self.w_Vis.VISpar.FlagRun
|
|
781
|
-
|
|
782
|
-
self.setFlagRun()
|
|
783
|
-
if self.w_Vis.VISpar.FlagRun:
|
|
784
|
-
#indTree,indItem,ind=self.w_Import.INPpar.indexes()
|
|
785
|
-
#self.actualBridge('Import',indTree,indItem,ind)
|
|
786
|
-
self.initDataAndSetImgFromGui(self.w_Import.INPpar,self.w_Process.PROpar)
|
|
787
|
-
if self.w_Import.INPpar.errorMessage:
|
|
788
|
-
warningDialog(self,self.w_Import.INPpar.errorMessage)
|
|
789
|
-
self.abort()
|
|
790
|
-
return
|
|
791
|
-
if self.w_Vis.VISpar.errorMessage:
|
|
792
|
-
warningDialog(self,self.w_Vis.VISpar.errorMessage)
|
|
793
|
-
self.abort()
|
|
794
|
-
return
|
|
795
|
-
self.button_Tab_callback('Vis')
|
|
796
|
-
pri.Info.cyan(f'Running calibration FlagRestart={self.w_Vis.FlagResume}')
|
|
797
|
-
if self.w_Vis.FlagResume>-1:
|
|
798
|
-
self.w_Vis.FlagSettingNewCalib=not bool(self.w_Vis.FlagResume)
|
|
799
|
-
#self.w_Vis.VISpar_old.FlagRun=bool(self.w_Vis.FlagResume) #riesuma lo zoom ma non la posizione
|
|
800
|
-
self.w_Vis.runCalVi(flagMod=bool(self.w_Vis.FlagResume))
|
|
801
|
-
else:
|
|
802
|
-
flagYes=self.questionDialog('A calibration result file already exists in the current output path. Do you want to overwrite it?')
|
|
803
|
-
if flagYes:
|
|
804
|
-
self.w_Vis.FlagResume=0
|
|
805
|
-
self.w_Vis.runCalVi(flagMod=False)
|
|
806
|
-
else:
|
|
807
|
-
self.run()
|
|
808
|
-
else:
|
|
809
|
-
if self.w_Vis.FlagResume>-1:
|
|
810
|
-
self.saveCal()
|
|
811
|
-
if (self.w_Import.INPpar.FlagOptPlane or self.w_Process.PROpar.CamMod==4) and self.w_Vis.calibView.calib.FlagCalibration:
|
|
812
|
-
if self.w_Import.INPpar.FlagOptPlane: self.savePlanePar()
|
|
813
|
-
self.updateIPpar()
|
|
814
|
-
self.saveCal('_Mod')
|
|
815
|
-
#indTree,indItem,ind=self.w_Import.INPpar.indexes()
|
|
816
|
-
#self.actualBridge('Import',indTree,indItem,ind)
|
|
817
|
-
self.initDataAndSetImgFromGui(self.w_Import.INPpar,self.w_Process.PROpar)
|
|
818
|
-
self.w_Vis.stopCalVi()
|
|
819
|
-
|
|
820
|
-
def abort(self):
|
|
821
|
-
self.w_Vis.FlagResume=-1
|
|
822
|
-
self.run()
|
|
823
|
-
|
|
824
|
-
def updateIPpar(self):
|
|
825
|
-
if self.w_Import.INPpar.FlagOptPlane:
|
|
826
|
-
costPlanes=self.w_Vis.calibView.calib.cal.vect.costPlanes
|
|
827
|
-
for i in range(len(self.w_Import.INPpar.filenames)):
|
|
828
|
-
self.w_Import.INPpar.plapar[i]=[round(p,3) for p in costPlanes[i]]
|
|
829
|
-
if self.w_Process.PROpar.CamMod==4:
|
|
830
|
-
cost=self.w_Vis.calibView.calib.cal.vect.cost[0]
|
|
831
|
-
self.w_Process.PROpar.CylRad=cost[21]
|
|
832
|
-
self.w_Process.PROpar.CylThick=cost[22]
|
|
833
|
-
self.w_Process.PROpar.CylNRatio=cost[23]
|
|
834
|
-
VIS=self.w_Vis.VISpar
|
|
835
|
-
self.w_Vis.TABpar_prev[VIS.indTree][VIS.indItem][VIS.ind].copyfrom(VIS)
|
|
836
|
-
self.w_Import.add_TABpar('Completed process')
|
|
837
|
-
self.w_Import.setTABpar(True) #setting parameters with bridge
|
|
838
|
-
|
|
839
|
-
def saveCal(self,add_str=''):
|
|
840
|
-
VIS=self.w_Vis.VISpar
|
|
841
|
-
data=self.w_Vis.calibView.calib.cal.data
|
|
842
|
-
calVect=self.w_Vis.calibView.calib.cal.vect
|
|
843
|
-
VIS.orPosAndShift=[]
|
|
844
|
-
VIS.angAndMask=[]
|
|
845
|
-
VIS.spotDistAndRemoval=[]
|
|
846
|
-
for c in range(data.NCam):
|
|
847
|
-
for p1 in range(data.Numpiani_PerCam):
|
|
848
|
-
p=p1+c*data.Numpiani_PerCam
|
|
849
|
-
VIS.orPosAndShift.append([])
|
|
850
|
-
VIS.angAndMask.append([])
|
|
851
|
-
VIS.spotDistAndRemoval.append([])
|
|
852
|
-
|
|
853
|
-
VIS.orPosAndShift[p].append(calVect.XOr[p] - data.ColPart)
|
|
854
|
-
VIS.orPosAndShift[p].append(calVect.YOr[p] - data.RigaPart)
|
|
855
|
-
VIS.orPosAndShift[p].append(calVect.xOrShift[p])
|
|
856
|
-
VIS.orPosAndShift[p].append(calVect.yOrShift[p])
|
|
857
|
-
|
|
858
|
-
VIS.angAndMask[p].append(calVect.angCol[p])
|
|
859
|
-
VIS.angAndMask[p].append(calVect.angRow[p])
|
|
860
|
-
for i in self.w_Vis.calibView.calib.cal.getPuTrovaCC(p):
|
|
861
|
-
VIS.angAndMask[p].append(i)
|
|
862
|
-
|
|
863
|
-
VIS.spotDistAndRemoval[p].append(calVect.dColPix[p])
|
|
864
|
-
VIS.spotDistAndRemoval[p].append(calVect.dRigPix[p])
|
|
865
|
-
VIS.spotDistAndRemoval[p].append(calVect.remPointsUp[p])
|
|
866
|
-
VIS.spotDistAndRemoval[p].append(calVect.remPointsDo[p])
|
|
867
|
-
VIS.spotDistAndRemoval[p].append(calVect.remPointsLe[p])
|
|
868
|
-
VIS.spotDistAndRemoval[p].append(calVect.remPointsRi[p])
|
|
869
|
-
|
|
870
|
-
INP=self.w_Import.INPpar
|
|
871
|
-
if len(INP.cams)==1: camString=f'_cam{INP.cams[0]}'
|
|
872
|
-
else: camString=''
|
|
873
|
-
varName=f'{data.percorsoOut}{data.NomeFileOut}{camString}{add_str}{outExt.cal}'
|
|
874
|
-
var=[INP,self.w_Process.PROpar,VIS,myStandardPath(os.path.dirname(varName))]
|
|
875
|
-
with open(varName,'wb') as file:
|
|
876
|
-
pickle.dump(var,file)
|
|
877
|
-
pri.Info.blue(f'>>> Saving calibration process file {varName}')
|
|
878
|
-
return
|
|
879
|
-
|
|
880
|
-
def savePlanePar(self):
|
|
881
|
-
data=self.w_Vis.calibView.calib.cal.data
|
|
882
|
-
calVect=self.w_Vis.calibView.calib.cal.vect
|
|
883
|
-
INP=self.w_Import.INPpar
|
|
884
|
-
if len(INP.cams)==1: camString=f'_cam{INP.cams[0]}'
|
|
885
|
-
else: camString=''
|
|
886
|
-
plaparRad=f'{data.percorsoOut}{data.NomeFileOut}{camString}_plane'
|
|
887
|
-
plapar_names=['beta (°)','alpha (°)','gamma (°)','x (mm)','y (mm)','z (mm)']
|
|
888
|
-
for i,c in enumerate(calVect.costPlanes):
|
|
889
|
-
dp={}
|
|
890
|
-
for p,v in zip(plapar_names,c):
|
|
891
|
-
dp[p]=v
|
|
892
|
-
plaparName=plaparRad+f"{i+1:d}_z{dp['z (mm)']:.2f}{outExt.pla}"
|
|
893
|
-
with open(plaparName,'w') as file:
|
|
894
|
-
file.write(str(dp).replace('{','{\n ').replace(',',',\n').replace('}','\n}'))
|
|
895
|
-
pri.Info.blue(f' Saving plane data file {plaparName}')
|
|
896
|
-
|
|
897
|
-
def importProc(self):
|
|
898
|
-
varName, _ = QFileDialog.getOpenFileName(self,\
|
|
899
|
-
"Select a CalVi result file", filter=f'*{outExt.cal}',\
|
|
900
|
-
dir=self.w_Import.INPpar.path,\
|
|
901
|
-
options=optionNativeDialog)
|
|
902
|
-
if not varName: return
|
|
903
|
-
try:
|
|
904
|
-
if os.path.exists(varName):
|
|
905
|
-
with open(varName, 'rb') as file:
|
|
906
|
-
var=pickle.load(file)
|
|
907
|
-
except:
|
|
908
|
-
WarningMessage=f'Error with loading the file: {varName}\n'
|
|
909
|
-
self.warningDialog(WarningMessage)
|
|
910
|
-
else:
|
|
911
|
-
FlagErr=False
|
|
912
|
-
if len(var)>=3:
|
|
913
|
-
if type(var[0])==type(self.w_Import.INPpar) and type(var[1])==type(self.w_Process.PROpar):
|
|
914
|
-
INP:INPpar_CalVi=var[0]
|
|
915
|
-
if len(var)>3:
|
|
916
|
-
self.adjust_INPpath(INP,'path',varName,var[3])
|
|
917
|
-
self.adjust_INPpath(INP,'pathout',varName,var[3])
|
|
918
|
-
self.w_Import.INPpar.copyfrom(INP,TABpar().fields)
|
|
919
|
-
self.w_Import.adjust_list_images()
|
|
920
|
-
self.w_Process.PROpar.copyfrom(var[1],TABpar().fields)
|
|
921
|
-
VIS=self.w_Vis.VISpar
|
|
922
|
-
self.w_Vis.TABpar_prev[VIS.indTree][VIS.indItem][VIS.ind].copyfrom(VIS)
|
|
923
|
-
self.w_Import.add_TABpar('Imported process')
|
|
924
|
-
self.w_Import.setTABpar(True) #setting parameters with bridge
|
|
925
|
-
else: FlagErr=True
|
|
926
|
-
else: FlagErr=True
|
|
927
|
-
if FlagErr:
|
|
928
|
-
WarningMessage=f'Error with setting the process file: {varName}\n'
|
|
929
|
-
self.warningDialog(WarningMessage)
|
|
930
|
-
|
|
931
|
-
def adjust_INPpath(self,INP,pathField,varName,path_old):
|
|
932
|
-
if not os.path.exists(getattr(INP,pathField)):
|
|
933
|
-
path_new=myStandardPath(os.path.dirname(varName))
|
|
934
|
-
inpPath=myStandardPath(os.path.abspath(path_new+os.path.relpath(INP.path,path_old)))
|
|
935
|
-
if os.path.exists(inpPath):
|
|
936
|
-
setattr(INP,pathField,inpPath)
|
|
937
|
-
|
|
938
|
-
#*************************************************** Warnings
|
|
939
|
-
def warningDialog(self,Message,time_milliseconds=0,flagScreenCenter=False):
|
|
940
|
-
warningDialog(self,Message,time_milliseconds,flagScreenCenter)
|
|
941
|
-
|
|
942
|
-
def questionDialog(self,Message):
|
|
943
|
-
flagYes=questionDialog(self,Message)
|
|
944
|
-
return flagYes
|
|
945
|
-
|
|
946
|
-
#*************************************************** Menus
|
|
947
|
-
def setGCalViTitle(self):
|
|
948
|
-
if self.cfgname==lastcfgname_CalVi:
|
|
949
|
-
cfgString=''
|
|
950
|
-
self.ui.actionClose.setEnabled(False)
|
|
951
|
-
else:
|
|
952
|
-
cfgString=f': {self.cfgname}'
|
|
953
|
-
self.ui.actionClose.setEnabled(True)
|
|
954
|
-
if Flag_DEBUG:#TA per non incasinarmi
|
|
955
|
-
windowTitle=f'CalVi (v{version}.{__subversion__}) -- cfg v{uicfg_version} -- PIV {self.PIVvers} -- {platform.system()}'
|
|
956
|
-
else:
|
|
957
|
-
windowTitle=f'CalVi (v{version})'
|
|
958
|
-
windowTitle+=cfgString
|
|
959
|
-
self.setWindowTitle(windowTitle)
|
|
960
|
-
|
|
961
|
-
#********************* File
|
|
962
|
-
def pauseQuestion(self,taskDescription='continuing',task=None):
|
|
963
|
-
FlagPause=self.FlagRun
|
|
964
|
-
if self.FlagRun:
|
|
965
|
-
if self.questionDialog(f'CalVi is currently running on a process. Do you want to abort it before {taskDescription}?'):
|
|
966
|
-
self.button_Abort_callback()
|
|
967
|
-
task()
|
|
968
|
-
return FlagPause
|
|
969
|
-
|
|
970
|
-
def new_uicfg(self):
|
|
971
|
-
if self.pauseQuestion('creating a new project',lambda: self.new_uicfg()): return
|
|
972
|
-
if self.cfgname!=lastcfgname_CalVi:
|
|
973
|
-
FlagYes=True
|
|
974
|
-
self.saveas_uicfg(self.cfgname)
|
|
975
|
-
else:
|
|
976
|
-
Question="The current project is unsaved. Would you like to save it before starting a new one?"
|
|
977
|
-
FlagYes=questionDialog(self,Question)
|
|
978
|
-
if FlagYes:
|
|
979
|
-
self.save_uicfg()
|
|
980
|
-
self.reconfigure()
|
|
981
|
-
self.saveas_uicfg('',"Select location and name of the new project")
|
|
982
|
-
|
|
983
|
-
def close_uicfg(self):
|
|
984
|
-
if self.pauseQuestion('closing the current project',lambda: self.close_uicfg()): return
|
|
985
|
-
self.save_uicfg()
|
|
986
|
-
self.reconfigure()
|
|
987
|
-
|
|
988
|
-
def reconfigure(self):
|
|
989
|
-
self.cfgname=lastcfgname_CalVi
|
|
990
|
-
self.setGCalViTitle()
|
|
991
|
-
pathCompleter=self.w_Import.INPpar.pathCompleter
|
|
992
|
-
for tname in self.TABnames:
|
|
993
|
-
w:gPaIRS_Tab=getattr(self,"w_"+tname)
|
|
994
|
-
w.TABpar.copyfrom(w.ParClass())
|
|
995
|
-
w.TABpar_prev=[[[w.ParClass()]],[],[]]
|
|
996
|
-
w.FlagAddingPar=[[[False]],[],[]]
|
|
997
|
-
w.FlagAsyncCall=[[[False]],[],[]]
|
|
998
|
-
from .PaIRS_pypacks import basefold
|
|
999
|
-
self.w_Import.INPpar.pathCompleter=pathCompleter
|
|
1000
|
-
self.w_Import.FlagAddPrev=False
|
|
1001
|
-
self.w_Import.set_currpath(basefold)
|
|
1002
|
-
self.w_Import.edit_path_callback() #setTABpar_prev(0,0,0,True) #with bridge
|
|
1003
|
-
self.w_Import.FlagAddPrev=True
|
|
1004
|
-
|
|
1005
|
-
def getCurrentCfgVar(self):
|
|
1006
|
-
self.updateCALparGeom()
|
|
1007
|
-
info=['uicfg-gCalVi',uicfg_version,__version__, __subversion__, __year__]
|
|
1008
|
-
geom = self.CALpar.duplicate()
|
|
1009
|
-
WIDnames=[]
|
|
1010
|
-
prevs=[]
|
|
1011
|
-
FlagAddingPar=[]
|
|
1012
|
-
FlagAsyncCall=[]
|
|
1013
|
-
for tname in self.TABnames:
|
|
1014
|
-
w: gPaIRS_Tab
|
|
1015
|
-
wname='w_'+tname
|
|
1016
|
-
w=getattr(self,wname)
|
|
1017
|
-
WIDnames.append(wname)
|
|
1018
|
-
prevs.append(w.TABpar_prev)
|
|
1019
|
-
FlagAddingPar.append(w.FlagAddingPar)
|
|
1020
|
-
FlagAsyncCall.append(w.FlagAsyncCall)
|
|
1021
|
-
var=[info]+[geom]+[None]+[WIDnames]+[prevs]+[FlagAddingPar]+[FlagAsyncCall]
|
|
1022
|
-
return var
|
|
1023
|
-
|
|
1024
|
-
def setCfgVar(self,var):
|
|
1025
|
-
#var=info+geom+tree_var+WIDnames+prevs
|
|
1026
|
-
#self.ui.centralwidget.hide()
|
|
1027
|
-
info=var[0] #['uicfg-gCalVi',uicfg_version,__version__, __subversion__, __year__]
|
|
1028
|
-
if info[0]!='uicfg-gCalVi':
|
|
1029
|
-
WarningMessage='The file is not a valid CalVi configuration file!'
|
|
1030
|
-
return False, WarningMessage
|
|
1031
|
-
else:
|
|
1032
|
-
ver=[int(i) for i in info[1].split('.')]
|
|
1033
|
-
cfgver=[int(i) for i in uicfg_version.split('.')]
|
|
1034
|
-
if not all([ver[k]>=cfgver[k] for k in range(len(ver))]):
|
|
1035
|
-
WarningMessage=f'The file is out-of-date (v{ver}) and not compatible with the current version (v{cfgver})!'
|
|
1036
|
-
return False, WarningMessage
|
|
1037
|
-
geom=var[1]
|
|
1038
|
-
WIDnames=var[3]
|
|
1039
|
-
prevs=var[4]
|
|
1040
|
-
FlagAddingPar=var[5]
|
|
1041
|
-
FlagAsyncCall=var[6]
|
|
1042
|
-
for k,wname in enumerate(WIDnames):
|
|
1043
|
-
w:gPaIRS_Tab=getattr(self,wname)
|
|
1044
|
-
w.TABpar_prev=prevs[k]
|
|
1045
|
-
iterateList(FlagAddingPar[k],False)
|
|
1046
|
-
w.FlagAddingPar=FlagAddingPar[k]
|
|
1047
|
-
iterateList(FlagAsyncCall[k],False)
|
|
1048
|
-
w.FlagAsyncCall=FlagAsyncCall[k]
|
|
1049
|
-
w.TABpar.copyfrom(prevs[k][0][0][-1])
|
|
1050
|
-
w.TABpar.indTree=0
|
|
1051
|
-
w.TABpar.indItem=0
|
|
1052
|
-
w.TABpar.ind=len(prevs[k][0][0])-1
|
|
1053
|
-
VISpar_curr=self.w_Vis.VISpar.duplicate()
|
|
1054
|
-
VISpar_curr.FlagRun=False
|
|
1055
|
-
self.w_Import.setTABpar(True)
|
|
1056
|
-
self.w_Vis.VISpar_old.copyfrom(VISpar_curr)
|
|
1057
|
-
self.w_Vis.TABpar_prev[0][0][0].copyfrom(VISpar_curr)
|
|
1058
|
-
self.w_Vis.TABpar.copyfrom(VISpar_curr)
|
|
1059
|
-
self.w_Vis.setTABpar(True)
|
|
1060
|
-
return True,''
|
|
1061
|
-
|
|
1062
|
-
def save_uicfg(self,filename='',Title="Select location and name of the project file to save"):
|
|
1063
|
-
if self.cfgname==lastcfgname_CalVi:
|
|
1064
|
-
self.saveas_uicfg(filename,Title)
|
|
1065
|
-
else:
|
|
1066
|
-
self.saveas_uicfg(self.cfgname,Title)
|
|
1067
|
-
|
|
1068
|
-
def saveas_uicfg(self,filename='',Title="Select location and name of the project file to save"):
|
|
1069
|
-
if self.pauseQuestion('saving the current project',lambda: self.saveas_uicfg(filename,Title)): return
|
|
1070
|
-
if filename=='':
|
|
1071
|
-
filename, _ = QFileDialog.getSaveFileName(self,Title,
|
|
1072
|
-
dir=self.w_Import.INPpar.path+"uicfg", filter=f'*{outExt.cfg_calvi}',\
|
|
1073
|
-
options=optionNativeDialog)
|
|
1074
|
-
if filename[-4:]=='.cfg': filename=filename[:-4] #per adattarlo al mac
|
|
1075
|
-
filename=myStandardRoot('{}'.format(str(filename)))
|
|
1076
|
-
if not filename: return
|
|
1077
|
-
if not outExt.cfg_calvi in filename:
|
|
1078
|
-
filename=filename+outExt.cfg_calvi
|
|
1079
|
-
if filename:
|
|
1080
|
-
var=self.getCurrentCfgVar()
|
|
1081
|
-
filename=myStandardRoot(filename)
|
|
1082
|
-
try:
|
|
1083
|
-
with open(filename, 'wb') as file:
|
|
1084
|
-
pickle.dump(var, file)
|
|
1085
|
-
pri.Info.white(f'>>>>> Saving ui configuration file:\t{filename}')
|
|
1086
|
-
self.cfgname=filename
|
|
1087
|
-
self.setGCalViTitle()
|
|
1088
|
-
except Exception as inst:
|
|
1089
|
-
warningDialog(self,f'Error while saving the configuration file {filename}!\nPlease, retry.')
|
|
1090
|
-
return
|
|
1091
|
-
|
|
1092
|
-
def save_lastcfg(self,*args):
|
|
1093
|
-
if len(args): var=args[0]
|
|
1094
|
-
else: var=self.getCurrentCfgVar()
|
|
1095
|
-
prevs=var[4]
|
|
1096
|
-
FlagAddingPar=var[5]
|
|
1097
|
-
FlagAsyncCall=var[6]
|
|
1098
|
-
last_prevs=[]
|
|
1099
|
-
last_FlagAddingPar=[]
|
|
1100
|
-
last_FlagAsyncCall=[]
|
|
1101
|
-
for k in range(len(prevs)):
|
|
1102
|
-
last_prevs.append([])
|
|
1103
|
-
last_FlagAddingPar.append([])
|
|
1104
|
-
last_FlagAsyncCall.append([])
|
|
1105
|
-
for indTree in range(len(prevs[k])):
|
|
1106
|
-
last_prevs[k].append([])
|
|
1107
|
-
last_FlagAddingPar[k].append([])
|
|
1108
|
-
last_FlagAsyncCall[k].append([])
|
|
1109
|
-
for indItem in range(len(prevs[k][indTree])):
|
|
1110
|
-
p=prevs[k][indTree][indItem][-1].duplicate()
|
|
1111
|
-
p.ind=0
|
|
1112
|
-
fadd=FlagAddingPar[k][indTree][indItem][-1]
|
|
1113
|
-
fasy=FlagAsyncCall[k][indTree][indItem][-1]
|
|
1114
|
-
last_prevs[k][indTree].append([p])
|
|
1115
|
-
last_FlagAddingPar[k][indTree].append([fadd])
|
|
1116
|
-
last_FlagAsyncCall[k][indTree].append([fasy])
|
|
1117
|
-
var2=var[:4]+[last_prevs,last_FlagAddingPar,last_FlagAsyncCall]
|
|
1118
|
-
with open(lastcfgname_CalVi, 'wb') as file:
|
|
1119
|
-
pickle.dump(var2, file)
|
|
1120
|
-
pri.Info.white(f' >>>>> Saving last ui configuration to file:\t{lastcfgname_CalVi}')
|
|
1121
|
-
return
|
|
1122
|
-
|
|
1123
|
-
def load_uicfg(self):
|
|
1124
|
-
if self.pauseQuestion('opening an old project',lambda: self.load_uicfg()): return
|
|
1125
|
-
filename, _ = QFileDialog.getOpenFileName(self,\
|
|
1126
|
-
"Select a CalVi configuration file", filter=f'*{outExt.cfg_calvi}',\
|
|
1127
|
-
dir=self.w_Import.INPpar.path,\
|
|
1128
|
-
options=optionNativeDialog)
|
|
1129
|
-
if not filename: return
|
|
1130
|
-
WarningMessage=f'Error with loading the file: {filename}\n'
|
|
1131
|
-
self.import_uicfg(filename,WarningMessage)
|
|
1132
|
-
|
|
1133
|
-
def import_uicfg(self,filename,WarningMessage):
|
|
1134
|
-
var=[]
|
|
1135
|
-
try:
|
|
1136
|
-
with open(filename, 'rb') as file:
|
|
1137
|
-
var = pickle.load(file)
|
|
1138
|
-
Flag,WarningMessage2=self.setCfgVar(var)
|
|
1139
|
-
if Flag:
|
|
1140
|
-
self.cfgname=filename
|
|
1141
|
-
self.setGCalViTitle()
|
|
1142
|
-
else:
|
|
1143
|
-
warningDialog(self,WarningMessage+WarningMessage2)
|
|
1144
|
-
except Exception as inst:
|
|
1145
|
-
warningDialog(self,WarningMessage)
|
|
1146
|
-
pri.Error.red(f'{WarningMessage}:\n{traceback.print_exc()}\n\n{inst}')
|
|
1147
|
-
Flag=False
|
|
1148
|
-
return Flag,var
|
|
1149
|
-
|
|
1150
|
-
#********************* Help
|
|
1151
|
-
def guide(self):
|
|
1152
|
-
url = QUrl("https://www.pairs.unina.it/web/CalVi-Guide.pdf")
|
|
1153
|
-
QDesktopServices.openUrl(url)
|
|
1154
|
-
|
|
1155
|
-
def about(self):
|
|
1156
|
-
if self.aboutDialog:
|
|
1157
|
-
self.aboutDialog.hide()
|
|
1158
|
-
self.aboutDialog.show()
|
|
1159
|
-
else:
|
|
1160
|
-
self.aboutDialog=infoCalVi(self)
|
|
1161
|
-
self.aboutDialog.show()
|
|
1162
|
-
|
|
1163
|
-
#********************* Debug
|
|
1164
|
-
def addDebugMenu(self):
|
|
1165
|
-
global Flag_fullDEBUG, pri
|
|
1166
|
-
menubar=self.ui.menubar
|
|
1167
|
-
self.menuDebug=menubar.addMenu("Debug")
|
|
1168
|
-
|
|
1169
|
-
#--------------------------- new ui cfg
|
|
1170
|
-
self.menuDebug.addSeparator()
|
|
1171
|
-
self.ui.aNew = self.menuDebug.addAction("New")
|
|
1172
|
-
self.ui.aNew.triggered.connect(self.reconfigure)
|
|
1173
|
-
|
|
1174
|
-
#--------------------------- last ui cfg
|
|
1175
|
-
self.menuDebug.addSeparator()
|
|
1176
|
-
self.ui.aSaveLastCfg = self.menuDebug.addAction("Save lastuicfg"+outExt.cfg_calvi)
|
|
1177
|
-
self.ui.aSaveLastCfg.triggered.connect(self.save_lastcfg)
|
|
1178
|
-
|
|
1179
|
-
self.ui.aDeleteLastCfg = self.menuDebug.addAction("Delete lastuicfg"+outExt.cfg_calvi)
|
|
1180
|
-
def delete_lastcfg():
|
|
1181
|
-
if os.path.exists(lastcfgname_CalVi):
|
|
1182
|
-
os.remove(lastcfgname_CalVi)
|
|
1183
|
-
pri.Info.white(f' xxxxx Deleting last ui configuration file:\t{lastcfgname_CalVi}')
|
|
1184
|
-
self.delete_lastcfg=delete_lastcfg
|
|
1185
|
-
self.ui.aDeleteLastCfg.triggered.connect(delete_lastcfg)
|
|
1186
|
-
|
|
1187
|
-
#--------------------------- printings
|
|
1188
|
-
self.menuDebug.addSeparator()
|
|
1189
|
-
self.ui.printMenu=self.menuDebug.addMenu('Print')
|
|
1190
|
-
printTypes_list=list(self.CALpar.printTypes)
|
|
1191
|
-
printActions=[]
|
|
1192
|
-
def setPrint(name,act,k):
|
|
1193
|
-
flag=act.isChecked()
|
|
1194
|
-
self.CALpar.printTypes[name]=flag
|
|
1195
|
-
flagTime=getattr(getattr(pri,name),'flagTime')
|
|
1196
|
-
faceStd=getattr(getattr(pri,name),'faceStd')
|
|
1197
|
-
if flag:
|
|
1198
|
-
setattr(pri,name,ColorPrint(flagTime=flagTime,prio=PrintTAPriority.medium,faceStd=faceStd))
|
|
1199
|
-
else:
|
|
1200
|
-
setattr(pri,name,ColorPrint(flagTime=flagTime,prio=PrintTAPriority.never,faceStd=faceStd))
|
|
1201
|
-
#print(f'{name} {flag}')
|
|
1202
|
-
#pri.Callback.white(f'pri.Callback.white(): setPrint')
|
|
1203
|
-
return
|
|
1204
|
-
def genCallback(name,act,k):
|
|
1205
|
-
n=name
|
|
1206
|
-
a=act
|
|
1207
|
-
j=k
|
|
1208
|
-
return lambda: setPrint(n,a,j)
|
|
1209
|
-
for k,name in enumerate(printTypes_list):
|
|
1210
|
-
flagFullDebug=getattr(getattr(pri,name),'flagFullDebug')
|
|
1211
|
-
if flagFullDebug and not Flag_fullDEBUG: continue
|
|
1212
|
-
act=self.ui.printMenu.addAction(name)
|
|
1213
|
-
printActions.append(act)
|
|
1214
|
-
act.setCheckable(True)
|
|
1215
|
-
flag=self.CALpar.printTypes[name]
|
|
1216
|
-
act.setChecked(flag)
|
|
1217
|
-
setPrint(name,act,k)
|
|
1218
|
-
act.triggered.connect(genCallback(name,act,k))
|
|
1219
|
-
|
|
1220
|
-
#--------------------------- operation
|
|
1221
|
-
self.menuDebug.addSeparator()
|
|
1222
|
-
self.ui.aCyl = self.menuDebug.addAction("Activate cylinder cal.")
|
|
1223
|
-
if Flag_fullDEBUG:
|
|
1224
|
-
self.w_Process.Flag_CYLINDERCAL=True
|
|
1225
|
-
self.ui.aCyl.setCheckable(True)
|
|
1226
|
-
self.ui.aCyl.setChecked(self.w_Process.Flag_CYLINDERCAL)
|
|
1227
|
-
def aCyl():
|
|
1228
|
-
#from PaIRS_pypacks import Flag_CYLINDERCAL
|
|
1229
|
-
self.w_Process.Flag_CYLINDERCAL=self.ui.aCyl.isChecked()
|
|
1230
|
-
self.w_Process.setPROpar()
|
|
1231
|
-
self.ui.aCyl.triggered.connect(aCyl)
|
|
1232
|
-
aCyl()
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
if Flag_fullDEBUG:
|
|
1236
|
-
self.menuDebug.addSeparator()
|
|
1237
|
-
self.ui.aShowDownload = self.menuDebug.addAction("Show/hide download button")
|
|
1238
|
-
def aShowDownload():
|
|
1239
|
-
self.ui.button_PaIRS_download.setVisible(not self.ui.button_PaIRS_download.isVisible())
|
|
1240
|
-
self.ui.aShowDownload.triggered.connect(aShowDownload)
|
|
1241
|
-
|
|
1242
|
-
self.ui.aResetFlagOutDated = self.menuDebug.addAction("Reset FlagOutDated")
|
|
1243
|
-
def aResetFlagOutDated():
|
|
1244
|
-
self.GPApar.FlagOutDated=0 if self.GPApar.currentVersion==self.GPApar.latestVersion else 1
|
|
1245
|
-
packageName='PaIRS-UniNa'
|
|
1246
|
-
currentVersion=self.GPApar.currentVersion
|
|
1247
|
-
latestVersion=self.GPApar.latestVersion
|
|
1248
|
-
if self.GPApar.FlagOutDated==1:
|
|
1249
|
-
sOut=f'{packageName} the current version ({currentVersion}) of {packageName} is obsolete! Please, install the latest version: {latestVersion} by using:\npython -m pip install --upgrade {packageName}'
|
|
1250
|
-
else:
|
|
1251
|
-
sOut=f'{packageName} The current version ({currentVersion}) of {packageName} is up-to-date! Enjoy it!'
|
|
1252
|
-
pri.Info.yellow(f'[{self.GPApar.FlagOutDated}] '+sOut)
|
|
1253
|
-
self.ui.aResetFlagOutDated.triggered.connect(aResetFlagOutDated)
|
|
1254
|
-
|
|
1255
|
-
self.ui.aCheckOutDated = self.menuDebug.addAction("Check for new packages")
|
|
1256
|
-
def aCheckOutDated():
|
|
1257
|
-
self.GPApar.FlagOutDated=0
|
|
1258
|
-
self.ui.button_PaIRS_download.hide()
|
|
1259
|
-
checkLatestVersion(self,__version__,self.app,splash=None)
|
|
1260
|
-
self.ui.aCheckOutDated.triggered.connect(aCheckOutDated)
|
|
1261
|
-
|
|
1262
|
-
self.menuDebug.addSeparator()
|
|
1263
|
-
self.ui.aResetWhatsNew = self.menuDebug.addAction("Reset whatsnew.txt")
|
|
1264
|
-
def aResetWhatsNew():
|
|
1265
|
-
if os.path.exists(fileWhatsNew[1]):
|
|
1266
|
-
try:
|
|
1267
|
-
os.rename(fileWhatsNew[1],fileWhatsNew[0])
|
|
1268
|
-
except Exception as inst:
|
|
1269
|
-
pri.Error.red(f'There was a problem while renaming the file {fileWhatsNew[1]}:\n{inst}')
|
|
1270
|
-
self.ui.aResetWhatsNew.triggered.connect(aResetWhatsNew)
|
|
1271
|
-
|
|
1272
|
-
self.ui.aShowWhatsNew = self.menuDebug.addAction("Show What's new window")
|
|
1273
|
-
def aShowWhatsNew():
|
|
1274
|
-
whatsNew(self)
|
|
1275
|
-
self.ui.aShowWhatsNew.triggered.connect(aShowWhatsNew)
|
|
1276
|
-
|
|
1277
|
-
self.menuDebug.addSeparator()
|
|
1278
|
-
self.ui.aFocusWid = self.menuDebug.addAction("Print widget with focus")
|
|
1279
|
-
def aFocusWid():
|
|
1280
|
-
pri.General.yellow(f"The widget with focus is: {self.focusWidget()}")
|
|
1281
|
-
self.aCheckConnections=aFocusWid
|
|
1282
|
-
self.ui.aFocusWid.triggered.connect(aFocusWid)
|
|
1283
|
-
|
|
1284
|
-
self.ui.aPrintListImages = self.menuDebug.addAction("Print list of image pairs")
|
|
1285
|
-
def aPrintListImages():
|
|
1286
|
-
|
|
1287
|
-
for i,f in enumerate(self.w_Import.INPpar.filenames):
|
|
1288
|
-
pri.General.white(f"{f}:")
|
|
1289
|
-
for fc in self.w_Import.INPpar.list_Image_Files[i]:
|
|
1290
|
-
pri.General.white(f" {fc}")
|
|
1291
|
-
self.aPrintListImages=aPrintListImages
|
|
1292
|
-
self.ui.aPrintListImages.triggered.connect(aPrintListImages)
|
|
1293
|
-
|
|
1294
|
-
#--------------------------- Save PIV cfg
|
|
1295
|
-
self.menuDebug.addSeparator()
|
|
1296
|
-
self.ui.aSaveCfgCalVi=self.menuDebug.addAction("Save CalVi cfg")
|
|
1297
|
-
def aSaveCfgCalVi():
|
|
1298
|
-
return
|
|
1299
|
-
self.aSaveCfgCalVi=aSaveCfgCalVi
|
|
1300
|
-
self.ui.aSaveCfgCalVi.triggered.connect(aSaveCfgCalVi)
|
|
1301
|
-
|
|
1302
|
-
#--------------------------- graphics
|
|
1303
|
-
if Flag_fullDEBUG:
|
|
1304
|
-
self.menuDebug.addSeparator()
|
|
1305
|
-
|
|
1306
|
-
self.ui.aUndock = self.menuDebug.addAction("Undock a widget")
|
|
1307
|
-
self.ui.aUndock.triggered.connect(self.extractWidget)
|
|
1308
|
-
|
|
1309
|
-
self.ui.aLogo = self.menuDebug.addAction("Change CalVi logo")
|
|
1310
|
-
self.ui.aLogo.triggered.connect(self.happyLogo)
|
|
1311
|
-
|
|
1312
|
-
self.ui.aGifs = self.menuDebug.addAction("Show/hide gifs")
|
|
1313
|
-
def showGifs():
|
|
1314
|
-
flag=not self.ui.label_updating_import.isVisible()
|
|
1315
|
-
self.ui.label_updating_import.setVisible(flag)
|
|
1316
|
-
self.ui.label_updating_pairs.setVisible(flag)
|
|
1317
|
-
self.ui.aGifs.triggered.connect(showGifs)
|
|
1318
|
-
|
|
1319
|
-
#--------------------------- exit
|
|
1320
|
-
self.menuDebug.addSeparator()
|
|
1321
|
-
|
|
1322
|
-
self.ui.aExitDebug = self.menuDebug.addAction("Exit debug mode")
|
|
1323
|
-
self.ui.aExitDebug.triggered.connect(lambda:self.setDebugMode(False))
|
|
1324
|
-
|
|
1325
|
-
def extractWidget(self):
|
|
1326
|
-
title="Undock a widget"
|
|
1327
|
-
label="Enter the widget name:"
|
|
1328
|
-
words = ["self.w_Import",
|
|
1329
|
-
"self.w_Process",
|
|
1330
|
-
"self.w_Process.ui.CollapBox_Target",
|
|
1331
|
-
"self.w_Process.ui.CollapBox_Calibration",
|
|
1332
|
-
"self.w_Vis",
|
|
1333
|
-
"self.ui.w_Buttons_Run",
|
|
1334
|
-
]
|
|
1335
|
-
|
|
1336
|
-
ok,text=inputDialog(self,title,label,completer_list=words,width=500)
|
|
1337
|
-
if ok:
|
|
1338
|
-
try:
|
|
1339
|
-
ts=text.split('.')
|
|
1340
|
-
parent=".".join(ts[:-1])
|
|
1341
|
-
child=ts[-1]
|
|
1342
|
-
tab=getattr(eval(parent),child)
|
|
1343
|
-
self.floatw.append(FloatingWidget(self,tab))
|
|
1344
|
-
pass
|
|
1345
|
-
except:
|
|
1346
|
-
pass
|
|
1347
|
-
|
|
1348
|
-
def userDebugMode(self):
|
|
1349
|
-
if not Flag_DEBUG:
|
|
1350
|
-
self.inputDebugMode()
|
|
1351
|
-
else:
|
|
1352
|
-
self.setDebugMode(False)
|
|
1353
|
-
|
|
1354
|
-
def inputDebugMode(self):
|
|
1355
|
-
_,text=inputDialog(self,'Debug','Insert password for debug mode:',width=300,flagScreenCenter=not self.isVisible())
|
|
1356
|
-
if text==pwddbg:
|
|
1357
|
-
self.setDebugMode(True)
|
|
1358
|
-
else:
|
|
1359
|
-
warningDialog(self,'Password for debug mode is wrong!\nPaIRS will stay in normal mode.',time_milliseconds=5000)
|
|
1360
|
-
self.setDebugMode(False)
|
|
1361
|
-
|
|
1362
|
-
def setDebugMode(self,Flag):
|
|
1363
|
-
global Flag_DEBUG
|
|
1364
|
-
Flag_DEBUG=Flag
|
|
1365
|
-
activateFlagDebug(Flag_DEBUG)
|
|
1366
|
-
self.setGCalViTitle()
|
|
1367
|
-
self.menuDebug.menuAction().setVisible(Flag)
|
|
1368
|
-
|
|
1369
|
-
#*************************************************** Graphical interface appearence
|
|
1370
|
-
def setCALpar(self):
|
|
1371
|
-
self.undockTabs()
|
|
1372
|
-
self.setTabLayout()
|
|
1373
|
-
self.ui.button_PaIRS_download.setVisible(self.CALpar.currentVersion!=self.CALpar.latestVersion and bool(self.CALpar.latestVersion))
|
|
1374
|
-
self.setRunButtonText()
|
|
1375
|
-
self.setGCalViTitle()
|
|
1376
|
-
self.setFontPixelSize()
|
|
1377
|
-
self.app.processEvents()
|
|
1378
|
-
self.setFlagRun()
|
|
1379
|
-
|
|
1380
|
-
def setFlagRun(self):
|
|
1381
|
-
self.setRunButtonText()
|
|
1382
|
-
self.ui.button_Abort.setVisible(self.w_Vis.VISpar.FlagRun)
|
|
1383
|
-
self.ui.button_Run.setShortcut(QCoreApplication.translate("gCalVi", u"Ctrl+Return", None))
|
|
1384
|
-
self.ui.button_import.setEnabled(not self.w_Vis.VISpar.FlagRun)
|
|
1385
|
-
self.w_Import.FlagDisplayControls=not self.w_Vis.VISpar.FlagRun
|
|
1386
|
-
self.w_Import.ui.button_back.setVisible(not self.w_Vis.VISpar.FlagRun)
|
|
1387
|
-
self.w_Import.ui.button_forward.setVisible(not self.w_Vis.VISpar.FlagRun)
|
|
1388
|
-
self.w_Import.ui.scrollArea.setEnabled(not self.w_Vis.VISpar.FlagRun)
|
|
1389
|
-
self.w_Import.ui.w_OutputFold_Button.setEnabled(not self.w_Vis.VISpar.FlagRun)
|
|
1390
|
-
self.w_Process.ui.scrollArea.setEnabled(not self.w_Vis.VISpar.FlagRun)
|
|
1391
|
-
#self.ui.centralwidget.show()
|
|
1392
|
-
|
|
1393
|
-
def setTabLayout(self,*args):
|
|
1394
|
-
if len(args): itab=args[0]
|
|
1395
|
-
else: itab=range(5)
|
|
1396
|
-
#self.update()
|
|
1397
|
-
self.setButtonLayout()
|
|
1398
|
-
self.adjustGeometry(itab)
|
|
1399
|
-
if not self.CALpar.FlagUndocked and self.FlagGuiInit:
|
|
1400
|
-
self.updateCALparGeom()
|
|
1401
|
-
|
|
1402
|
-
def setButtonLayout(self):
|
|
1403
|
-
widname=self.optabnames[self.CALpar.lastTab]
|
|
1404
|
-
for k,tn in enumerate(self.optabnames):
|
|
1405
|
-
flag=getattr(self.CALpar,f"Flag{tn}")
|
|
1406
|
-
setattr(self.CALpar,f"Flag{tn}",flag)
|
|
1407
|
-
|
|
1408
|
-
button:RichTextPushButton=getattr(self.ui,f"button_{tn}")
|
|
1409
|
-
wid:gPaIRS_Tab=getattr(self,'w_'+self.opwidnames[k])
|
|
1410
|
-
button.setChecked(flag)
|
|
1411
|
-
self.CALpar.FloatingsVis[k]=flag
|
|
1412
|
-
|
|
1413
|
-
if self.CALpar.FlagUndocked:
|
|
1414
|
-
wid.ui.w_button_close_tab.hide()
|
|
1415
|
-
else:
|
|
1416
|
-
wid.ui.w_button_close_tab.show()
|
|
1417
|
-
|
|
1418
|
-
self.setOpButtonText(tn)
|
|
1419
|
-
|
|
1420
|
-
if self.CALpar.FlagUndocked:
|
|
1421
|
-
self.ui.button_dock.setIcon(self.icon_dock_tabs)
|
|
1422
|
-
tipDock="Dock tabs"+' ('+self.ui.button_dock.shortcut().toString(QKeySequence.NativeText)+')'
|
|
1423
|
-
else:
|
|
1424
|
-
self.ui.button_dock.setIcon(self.icon_undock_tabs)
|
|
1425
|
-
tipDock="Undock tabs"+' ('+self.ui.button_dock.shortcut().toString(QKeySequence.NativeText)+')'
|
|
1426
|
-
self.ui.button_dock.setToolTip(tipDock)
|
|
1427
|
-
self.ui.button_dock.setStatusTip(tipDock)
|
|
1428
|
-
|
|
1429
|
-
def setOpButtonLabel(self,*args):
|
|
1430
|
-
if len(args):
|
|
1431
|
-
self.CALpar.FlagButtLabel=args[0]
|
|
1432
|
-
else:
|
|
1433
|
-
if self.CALpar.FlagUndocked:
|
|
1434
|
-
self.CALpar.FlagButtLabel=self.ui.w_Buttons_Run.width()>w_button_min_size
|
|
1435
|
-
else:
|
|
1436
|
-
if all([not getattr(self.CALpar,'Flag'+tn) for tn in self.optabnames]):
|
|
1437
|
-
s=self.ui.w_Buttons_Run.width() #s=max([self.main_splitter.sizes()[0],self.minW_ManTabs])
|
|
1438
|
-
self.CALpar.FlagButtLabel=s>w_button_min_size
|
|
1439
|
-
else:
|
|
1440
|
-
self.CALpar.FlagButtLabel=self.ui.w_Buttons_Run.width()>w_button_min_size
|
|
1441
|
-
if self.CALpar.FlagButtLabel==self.FlagButtLabel: return
|
|
1442
|
-
self.FlagButtLabel=self.CALpar.FlagButtLabel
|
|
1443
|
-
for tn in self.optabnames:
|
|
1444
|
-
self.setOpButtonText(tn)
|
|
1445
|
-
self.setRunButtonText()
|
|
1446
|
-
self.setAbortButtonText()
|
|
1447
|
-
return
|
|
1448
|
-
|
|
1449
|
-
def setOpButtonText(self,tabname):
|
|
1450
|
-
button:RichTextPushButton=getattr(self.ui,f"button_{tabname}")
|
|
1451
|
-
flag=getattr(self.CALpar,f"Flag{tabname}")
|
|
1452
|
-
if flag:
|
|
1453
|
-
s=''
|
|
1454
|
-
else:
|
|
1455
|
-
fPixSize=button.font().pixelSize()
|
|
1456
|
-
s=f'<sup><span style=" font-size:{fPixSize-2}px"> 🔒</span></sup>'
|
|
1457
|
-
if self.CALpar.FlagButtLabel:
|
|
1458
|
-
button.setText(tabname+s)
|
|
1459
|
-
else:
|
|
1460
|
-
button.setText(s)
|
|
1461
|
-
|
|
1462
|
-
def setRunButtonText(self):
|
|
1463
|
-
button=self.ui.button_Run
|
|
1464
|
-
if not self.w_Vis.VISpar.FlagRun:
|
|
1465
|
-
flag=bool(self.w_Vis.VISpar.errorMessage) or bool(self.w_Import.INPpar.errorMessage)
|
|
1466
|
-
if flag:
|
|
1467
|
-
fPixSize=button.font().pixelSize()
|
|
1468
|
-
s=f'<sup><span style=" font-size:{fPixSize-2}px"> ⚠</span></sup>'
|
|
1469
|
-
else:
|
|
1470
|
-
s=''
|
|
1471
|
-
text='Run'
|
|
1472
|
-
button.setIcon(self.icon_play)
|
|
1473
|
-
else:
|
|
1474
|
-
s=''
|
|
1475
|
-
text='Stop'
|
|
1476
|
-
button.setIcon(self.icon_pause)
|
|
1477
|
-
if self.CALpar.FlagButtLabel:
|
|
1478
|
-
button.setText(text+s)
|
|
1479
|
-
else:
|
|
1480
|
-
button.setText(s)
|
|
1481
|
-
|
|
1482
|
-
def setAbortButtonText(self):
|
|
1483
|
-
button=self.ui.button_Abort
|
|
1484
|
-
if self.CALpar.FlagButtLabel:
|
|
1485
|
-
button.setText('Abort')
|
|
1486
|
-
else:
|
|
1487
|
-
button.setText('')
|
|
1488
|
-
|
|
1489
|
-
def adjustGeometry(self,*args):
|
|
1490
|
-
if len(args): itab=args[0]
|
|
1491
|
-
else: itab=range(5)
|
|
1492
|
-
pri.Geometry.yellow(f'{"<>"*5} Adjusting geometry {"<>"*5}')
|
|
1493
|
-
if self.CALpar.FlagUndocked:
|
|
1494
|
-
for k,f in enumerate(self.floatings):
|
|
1495
|
-
if self.CALpar.FloatingsGeom[k]:
|
|
1496
|
-
f.setGeometry(self.CALpar.FloatingsGeom[k])
|
|
1497
|
-
if self.CALpar.FloatingsVis[k] and self.FlagGuiInit:
|
|
1498
|
-
f.show()
|
|
1499
|
-
f.pa.show()
|
|
1500
|
-
else:
|
|
1501
|
-
f.hide()
|
|
1502
|
-
setattr(self.CALpar,'Flag'+self.optabnames[k],self.CALpar.FloatingsVis[k])
|
|
1503
|
-
"""
|
|
1504
|
-
for k in itab:
|
|
1505
|
-
f=self.floatings[k]
|
|
1506
|
-
if self.CALpar.FloatingsVis[k]:
|
|
1507
|
-
f.setWindowFlags(f.windowFlags() | QtCore.Qt.WindowStaysOnTopHint)
|
|
1508
|
-
f.show()
|
|
1509
|
-
f.setWindowFlags(f.windowFlags() & ~ QtCore.Qt.WindowStaysOnTopHint)
|
|
1510
|
-
f.show()
|
|
1511
|
-
else: f.hide()
|
|
1512
|
-
"""
|
|
1513
|
-
self.setMaximumHeight(self.ui.w_Buttons_Run.maximumHeight())
|
|
1514
|
-
self.setGeometry(self.CALpar.FloatingsGeom[-1])
|
|
1515
|
-
self.CALpar.FloatingsVis[-1]=True
|
|
1516
|
-
for k,wn in enumerate(self.opwidnames[:-1]):
|
|
1517
|
-
w=getattr(self,'w_'+wn)
|
|
1518
|
-
w.ui.scrollArea.verticalScrollBar().setValue(self.CALpar.FScrollAreaValues[k])
|
|
1519
|
-
pri.Geometry.yellow(f'*** Undocked configuration:\n Floatings Geometry={self.CALpar.FloatingsGeom}\n Floatings Vis={self.CALpar.FloatingsVis}')
|
|
1520
|
-
else:
|
|
1521
|
-
cont=0
|
|
1522
|
-
for k,wn in enumerate(self.optabnames):
|
|
1523
|
-
tabname="f_"+self.opwidnames[k]+"Tab"
|
|
1524
|
-
tab=getattr(self.ui,tabname)
|
|
1525
|
-
flag=getattr(self.CALpar,'Flag'+wn)
|
|
1526
|
-
tab.setVisible(flag)
|
|
1527
|
-
cont+=flag
|
|
1528
|
-
Flag=cont>0
|
|
1529
|
-
self.hideOpTabs(not Flag)
|
|
1530
|
-
if not Flag:
|
|
1531
|
-
self.ui.w_Operating_Tabs.hide()
|
|
1532
|
-
self.setMaximumHeight(self.ui.w_Buttons_Run.maximumHeight())
|
|
1533
|
-
else:
|
|
1534
|
-
self.ui.w_Operating_Tabs.show()
|
|
1535
|
-
self.setMaximumHeight(int(2**16))
|
|
1536
|
-
self.setGeometry(self.CALpar.Geometry)
|
|
1537
|
-
if Flag:
|
|
1538
|
-
#self.main_splitter.setSizes(self.CALpar.SplitterSizes[0])
|
|
1539
|
-
splitterSizes=self.CALpar.SplitterSizes[1]
|
|
1540
|
-
self.setSecondarySplitterSizes(splitterSizes)
|
|
1541
|
-
self.ui.scrollArea.horizontalScrollBar().setValue(self.CALpar.ScrollAreaValues[0])
|
|
1542
|
-
for k,wn in enumerate(self.opwidnames[:-1]):
|
|
1543
|
-
w=getattr(self,'w_'+wn)
|
|
1544
|
-
w.ui.scrollArea.verticalScrollBar().setValue(self.CALpar.ScrollAreaValues[k+1])
|
|
1545
|
-
pri.Geometry.yellow(f'*** Docked configuration:\n Geom={self.CALpar.Geometry}\n Main Spiltter Sizes={self.CALpar.SplitterSizes[0]}\n Secondary Spiltter Sizes={self.CALpar.SplitterSizes[1]}')
|
|
1546
|
-
if self.FlagGuiInit:
|
|
1547
|
-
self.show()
|
|
1548
|
-
if self.FlagFirstShow:
|
|
1549
|
-
self.FlagFirstShow=False
|
|
1550
|
-
#self.w_Vis.button_restore_callback()
|
|
1551
|
-
#self.w_Vis.resetScaleFactor()
|
|
1552
|
-
self.w_Vis.resetScaleFactor()
|
|
1553
|
-
self.w_Vis.plotPlane()
|
|
1554
|
-
self.w_Vis.calibView.show()
|
|
1555
|
-
else:
|
|
1556
|
-
if Flag_ResetScaleOnChanges: pass#self.w_Vis.ui.plot.resetScaleFactor()
|
|
1557
|
-
|
|
1558
|
-
def setSecondarySplitterSizes(self,splitterSizes):
|
|
1559
|
-
self.OpWidth=self.OpMaxWidth=0
|
|
1560
|
-
for k,tname in enumerate(self.opwidnames):
|
|
1561
|
-
flagname="Flag"+self.optabnames[k]
|
|
1562
|
-
flag=getattr(self.CALpar,flagname)
|
|
1563
|
-
tabname=f"f_"+tname+"Tab"
|
|
1564
|
-
tab=getattr(self.ui,tabname)
|
|
1565
|
-
if flag:
|
|
1566
|
-
if not splitterSizes[k]:
|
|
1567
|
-
splitterSizes[k]=self.CALpar.SplitterSizes[2][k]
|
|
1568
|
-
else:
|
|
1569
|
-
splitterSizes[k]=max([splitterSizes[k],tab.minimumWidth()])
|
|
1570
|
-
self.OpWidth+=splitterSizes[k]+self.secondary_splitter.handleWidth()
|
|
1571
|
-
self.OpMaxWidth+=tab.maximumWidth()+self.secondary_splitter.handleWidth()
|
|
1572
|
-
else:
|
|
1573
|
-
splitterSizes[k]=0
|
|
1574
|
-
if self.OpWidth==self.OpMaxWidth:
|
|
1575
|
-
w_f_empty=0
|
|
1576
|
-
else:
|
|
1577
|
-
w_f_empty=min([f_empty_width, self.OpMaxWidth-self.OpWidth])
|
|
1578
|
-
widthOpTab=self.ui.w_Operating_Tabs.width()
|
|
1579
|
-
dw=widthOpTab-self.OpWidth
|
|
1580
|
-
if dw>0: w_f_empty=dw
|
|
1581
|
-
self.ui.scrollAreaWidgetContents.setMinimumWidth(self.OpWidth+w_f_empty)
|
|
1582
|
-
self.ui.secondary_splitter.setMinimumWidth(self.OpWidth+w_f_empty)
|
|
1583
|
-
self.ui.scrollAreaWidgetContents.resize(self.OpWidth+w_f_empty,self.ui.scrollAreaWidgetContents.height())
|
|
1584
|
-
self.ui.secondary_splitter.resize(self.OpWidth+w_f_empty,self.ui.secondary_splitter.height())
|
|
1585
|
-
splitterSizes[-1]=w_f_empty
|
|
1586
|
-
self.ui.secondary_splitter.setSizes(splitterSizes)
|
|
1587
|
-
|
|
1588
|
-
def setScrollAreaWidth(self):
|
|
1589
|
-
self.updateCALparGeom()
|
|
1590
|
-
self.setTabLayout()
|
|
1591
|
-
self.setFontPixelSize()
|
|
1592
|
-
|
|
1593
|
-
def close_tab(self,w:gPaIRS_Tab):
|
|
1594
|
-
w.parent().hide()
|
|
1595
|
-
setattr(self.CALpar,'Flag'+w.name_tab,False)
|
|
1596
|
-
self.updateCALparGeom()
|
|
1597
|
-
if self.CALpar.FlagUndocked:
|
|
1598
|
-
self.setButtonLayout()
|
|
1599
|
-
else:
|
|
1600
|
-
self.setTabLayout()
|
|
1601
|
-
|
|
1602
|
-
def updateCALparGeom(self):
|
|
1603
|
-
pri.Geometry.green(f"{'-'*10} Updating geometry {'-'*10}")
|
|
1604
|
-
if self.CALpar.FlagUndocked:
|
|
1605
|
-
for i,f in enumerate(self.floatings):
|
|
1606
|
-
self.CALpar.FloatingsGeom[i]=f.geometry()
|
|
1607
|
-
self.CALpar.FloatingsVis[i]=f.isVisible()
|
|
1608
|
-
#geo=self.floatings[self.CALpar.prevTab].geometry()
|
|
1609
|
-
#for k in range(3): self.CALpar.FloatingsGeom[k]=geo
|
|
1610
|
-
self.CALpar.FloatingsGeom[i+1]=self.geometry()
|
|
1611
|
-
self.CALpar.FloatingsVis[i+1]=self.isVisible()
|
|
1612
|
-
for k,wn in enumerate(self.opwidnames):
|
|
1613
|
-
if wn!='Vis':
|
|
1614
|
-
w=getattr(self,'w_'+wn)
|
|
1615
|
-
self.CALpar.FScrollAreaValues[k]=w.ui.scrollArea.verticalScrollBar().value()
|
|
1616
|
-
pri.Geometry.green(f'*** Undocked configuration:\n Floatings Geometry={self.CALpar.FloatingsGeom}\n Floatings Vis={self.CALpar.FloatingsVis}')
|
|
1617
|
-
else:
|
|
1618
|
-
self.CALpar.Geometry=self.geometry()
|
|
1619
|
-
self.CALpar.SplitterSizes[0]=None
|
|
1620
|
-
self.CALpar.SplitterSizes[1]=splitterSizes=self.secondary_splitter.sizes()
|
|
1621
|
-
self.CALpar.ScrollAreaValues[0]=self.ui.scrollArea.horizontalScrollBar().value()
|
|
1622
|
-
for k,wn in enumerate(self.opwidnames):
|
|
1623
|
-
if splitterSizes[k]:
|
|
1624
|
-
self.CALpar.SplitterSizes[2][k]=splitterSizes[k]
|
|
1625
|
-
for k,wn in enumerate(self.opwidnames):
|
|
1626
|
-
if wn!='Vis':
|
|
1627
|
-
w=getattr(self,'w_'+wn)
|
|
1628
|
-
self.CALpar.ScrollAreaValues[k+1]=w.ui.scrollArea.verticalScrollBar().value()
|
|
1629
|
-
pri.Geometry.green(f'*** Docked configuration:\n Geom={self.CALpar.Geometry}\n Main Spiltter Sizes={self.CALpar.SplitterSizes[0]}\n Secondary Spiltter Sizes={self.CALpar.SplitterSizes[1]}')
|
|
1630
|
-
|
|
1631
|
-
def button_Tab_callback(self,name):
|
|
1632
|
-
b:QPushButton=getattr(self.ui,"button_"+name)
|
|
1633
|
-
flagname="Flag"+name
|
|
1634
|
-
FlagVisible=getattr(self.CALpar,flagname)
|
|
1635
|
-
if b.isCheckable():
|
|
1636
|
-
setattr(self.CALpar,flagname,b.isChecked())
|
|
1637
|
-
else:
|
|
1638
|
-
setattr(self.CALpar,flagname,True)
|
|
1639
|
-
itab=self.optabnames.index(name)
|
|
1640
|
-
self.CALpar.prevTab=self.CALpar.lastTab
|
|
1641
|
-
if itab<3: self.CALpar.lastTab=itab
|
|
1642
|
-
self.updateCALparGeom()
|
|
1643
|
-
self.setTabLayout([itab])
|
|
1644
|
-
if not self.CALpar.FlagUndocked:
|
|
1645
|
-
if getattr(self.CALpar,flagname):
|
|
1646
|
-
#self.update()
|
|
1647
|
-
wTab=self.ui.w_Operating_Tabs.width() #self.CALpar.SplitterSizes[0][2]-self.secondary_splitter.handleWidth()
|
|
1648
|
-
if self.CALpar.SplitterSizes[1][itab]>wTab:
|
|
1649
|
-
self.CALpar.SplitterSizes[1][itab]=wTab
|
|
1650
|
-
self.adjustGeometry()
|
|
1651
|
-
self.moveToTab(name)
|
|
1652
|
-
tab=getattr(self,'w_'+self.opwidnames[itab])
|
|
1653
|
-
w=self.focusWidget()
|
|
1654
|
-
if w: w.clearFocus()
|
|
1655
|
-
if name !='Vis':
|
|
1656
|
-
tab:Import_Tab_CalVi
|
|
1657
|
-
tab.ui.scrollArea.setFocus()
|
|
1658
|
-
|
|
1659
|
-
def moveToTab(self,name,finished=lambda: None):
|
|
1660
|
-
i=self.optabnames.index(name)
|
|
1661
|
-
if not self.CALpar.FlagUndocked:
|
|
1662
|
-
hbar = self.ui.scrollArea.horizontalScrollBar()
|
|
1663
|
-
s=self.secondary_splitter.sizes()
|
|
1664
|
-
|
|
1665
|
-
f=sum([sk>0 for sk in s[:i]])
|
|
1666
|
-
Xin=sum(s[:i])+(f)*self.secondary_splitter.handleWidth()
|
|
1667
|
-
v=min([Xin,hbar.maximum()])
|
|
1668
|
-
self.startAnimation(v,finished)
|
|
1669
|
-
else:
|
|
1670
|
-
f=self.floatings[i]
|
|
1671
|
-
f.setWindowFlags(f.windowFlags() | QtCore.Qt.WindowStaysOnTopHint)
|
|
1672
|
-
f.show()
|
|
1673
|
-
f.setWindowFlags(f.windowFlags() & ~ QtCore.Qt.WindowStaysOnTopHint)
|
|
1674
|
-
f.show()
|
|
1675
|
-
|
|
1676
|
-
#@Slot()
|
|
1677
|
-
def startAnimation(self,v,finished=lambda: None):
|
|
1678
|
-
self.animation.stop()
|
|
1679
|
-
self.animation.setStartValue(self.ui.scrollArea.horizontalScrollBar().value())
|
|
1680
|
-
self.animation.setEndValue(v)
|
|
1681
|
-
self.animation.setDuration(time_ScrollBar)
|
|
1682
|
-
self.animation.finished.connect(finished)
|
|
1683
|
-
self.animation.start()
|
|
1684
|
-
|
|
1685
|
-
#@Slot(QVariant)
|
|
1686
|
-
def moveToColumn(self, i):
|
|
1687
|
-
self.ui.scrollArea.horizontalScrollBar().setValue(i)
|
|
1688
|
-
|
|
1689
|
-
def button_Tab_action(self,name):
|
|
1690
|
-
flagname="Flag"+name
|
|
1691
|
-
flag=getattr(self.CALpar,flagname)
|
|
1692
|
-
tabname="f_"+self.opwidnames[self.optabnames.index(name)]+"Tab"
|
|
1693
|
-
tab=getattr(self.ui,tabname)
|
|
1694
|
-
if flag:
|
|
1695
|
-
tab.show()
|
|
1696
|
-
self.OpWidth+=tab.geometry().width()+self.secondary_splitter.handleWidth()
|
|
1697
|
-
self.OpMaxWidth+=tab.maximumWidth()+self.secondary_splitter.handleWidth()
|
|
1698
|
-
else:
|
|
1699
|
-
tab.hide()
|
|
1700
|
-
|
|
1701
|
-
def button_dock_callback(self):
|
|
1702
|
-
self.FlagUndocking=True
|
|
1703
|
-
self.updateCALparGeom()
|
|
1704
|
-
#self.hide()
|
|
1705
|
-
self.CALpar.FlagUndocked= not self.CALpar.FlagUndocked
|
|
1706
|
-
self.undockTabs()
|
|
1707
|
-
if Flag_RESIZEONRUN:
|
|
1708
|
-
if self.FlagRun:
|
|
1709
|
-
self.BSizeCallbacks[4]()
|
|
1710
|
-
else:
|
|
1711
|
-
self.setTabLayout()
|
|
1712
|
-
if self.CALpar.FlagLog: self.moveToTab('Log')
|
|
1713
|
-
elif self.CALpar.FlagVis: self.moveToTab('Vis')
|
|
1714
|
-
else:
|
|
1715
|
-
self.setTabLayout()
|
|
1716
|
-
#self.show()
|
|
1717
|
-
self.FlagUndocking=False
|
|
1718
|
-
|
|
1719
|
-
def undockTabs(self):
|
|
1720
|
-
if self.CALpar.FlagUndocked:
|
|
1721
|
-
for i,wn in enumerate(self.opwidnames):
|
|
1722
|
-
self.floatings[i].setFloat()
|
|
1723
|
-
if wn=='Vis':
|
|
1724
|
-
self.floatings[i].setMaximumWidth(self.maxW)
|
|
1725
|
-
self.ui.f_VisTab.setMaximumWidth(self.maxW)
|
|
1726
|
-
self.w_Vis.setMaximumWidth(self.maxW)
|
|
1727
|
-
else:
|
|
1728
|
-
for i,wn in enumerate(self.opwidnames):
|
|
1729
|
-
tabname="f_"+wn+"Tab"
|
|
1730
|
-
tab=getattr(self.ui,tabname)
|
|
1731
|
-
self.secondary_splitter.addWidget(tab)
|
|
1732
|
-
self.secondary_splitter.setCollapsible(i,False)
|
|
1733
|
-
self.secondary_splitter.addWidget(self.ui.f_empty)
|
|
1734
|
-
self.secondary_splitter.setCollapsible(i+1,False)
|
|
1735
|
-
for i in range(len(self.floatings)):
|
|
1736
|
-
self.floatings[i].close()
|
|
1737
|
-
#self.floatings=[]
|
|
1738
|
-
self.ui.f_VisTab.setMaximumWidth(self.fVis_maxWidth)
|
|
1739
|
-
self.w_Vis.setMaximumWidth(self.Vis_maxWidth)
|
|
1740
|
-
self.hideOpTabs(self.CALpar.FlagUndocked)
|
|
1741
|
-
|
|
1742
|
-
def hideOpTabs(self,flagUndocked):
|
|
1743
|
-
dpix=20
|
|
1744
|
-
if flagUndocked:
|
|
1745
|
-
#self.ui.manlay.insertWidget(1,self.ui.w_Buttons)
|
|
1746
|
-
#self.ui.main_sep.hide()
|
|
1747
|
-
self.ui.w_Operating_Tabs.hide()
|
|
1748
|
-
self.centralWidget().setMaximumWidth(self.ui.w_Buttons_Run.maximumWidth())
|
|
1749
|
-
self.centralWidget().setMinimumWidth(self.ui.w_Buttons_Run.minimumWidth()+dpix)
|
|
1750
|
-
self.setMaximumWidth(self.ui.w_Buttons_Run.maximumWidth())
|
|
1751
|
-
self.setMinimumWidth(self.ui.w_Buttons_Run.minimumWidth()+dpix)
|
|
1752
|
-
else:
|
|
1753
|
-
self.ui.w_Operating_Tabs.show()
|
|
1754
|
-
self.centralWidget().setMaximumWidth(self.maxW)
|
|
1755
|
-
self.centralWidget().setMinimumWidth(self.minW)
|
|
1756
|
-
self.setMaximumWidth(self.maxW)
|
|
1757
|
-
self.setMinimumWidth(self.minW)
|
|
1758
|
-
size=self.size()
|
|
1759
|
-
newSize=QSize(min([size.width(),self.maxW]),size.height())
|
|
1760
|
-
self.resize(newSize)
|
|
1761
|
-
|
|
1762
|
-
"""
|
|
1763
|
-
if flagUndocked:
|
|
1764
|
-
self.CALpar.FlagButtLabel=self.CALpar.FloatingsGeom[-1].width()>w_button_min_size
|
|
1765
|
-
else:
|
|
1766
|
-
if all([not getattr(self.CALpar,'Flag'+tn) for tn in self.optabnames]):
|
|
1767
|
-
margins=self.ui.Clayout.contentsMargins()
|
|
1768
|
-
s=max([self.CALpar.SplitterSizes[0][0],self.minimumWidth()-margins.left()-margins.right()])
|
|
1769
|
-
self.CALpar.FlagButtLabel=s>w_button_min_size
|
|
1770
|
-
else:
|
|
1771
|
-
self.CALpar.FlagButtLabel=self.CALpar.SplitterSizes[0][-1]>w_button_min_size
|
|
1772
|
-
self.setOpButtonLabel(self.CALpar.FlagButtLabel)
|
|
1773
|
-
"""
|
|
1774
|
-
|
|
1775
|
-
def button_default_sizes_callback(self):
|
|
1776
|
-
self.DefaultSize()
|
|
1777
|
-
self.setTabLayout()
|
|
1778
|
-
return
|
|
1779
|
-
|
|
1780
|
-
def DefaultSize(self):
|
|
1781
|
-
geo=self.MaxGeo
|
|
1782
|
-
x0=geo.x()
|
|
1783
|
-
y0=geo.y()
|
|
1784
|
-
w=geo.width()
|
|
1785
|
-
h=geo.height()
|
|
1786
|
-
|
|
1787
|
-
pri.Geometry.blue(f'{"°"*10} Setting sizes {"°"*10}')
|
|
1788
|
-
if not self.CALpar.FlagUndocked:
|
|
1789
|
-
|
|
1790
|
-
handleWidth2=self.secondary_splitter.handleWidth()
|
|
1791
|
-
dpix=[100,75]
|
|
1792
|
-
Geometry=QRect(int(dpix[0])+x0,int(dpix[1])+y0,int(w-2*dpix[0]),int(h-2*dpix[1]))
|
|
1793
|
-
wp=Geometry.width()
|
|
1794
|
-
#hp=Geometry.height()
|
|
1795
|
-
nw=3
|
|
1796
|
-
wt=int(wp/nw)
|
|
1797
|
-
SecondarySplitterSizes=[wt+handleWidth2]*2+[1000]+[f_empty_width]
|
|
1798
|
-
self.CALpar.Geometry=Geometry
|
|
1799
|
-
self.CALpar.SplitterSizes[0]=None
|
|
1800
|
-
self.CALpar.SplitterSizes[1]=copy.deepcopy(SecondarySplitterSizes)
|
|
1801
|
-
self.CALpar.SplitterSizes[2]=copy.deepcopy(SecondarySplitterSizes)
|
|
1802
|
-
self.CALpar.ScrollAreaValues=[0]*3
|
|
1803
|
-
|
|
1804
|
-
self.CALpar.FlagInput=self.CALpar.FlagProcess=self.CALpar.FlagVis=True
|
|
1805
|
-
pri.Geometry.blue(f'--> Docked configuration:\n Geom={self.CALpar.Geometry}\n Main Spiltter Sizes={self.CALpar.SplitterSizes[0]}\n Secondary Spiltter Sizes={self.CALpar.SplitterSizes[1]}')
|
|
1806
|
-
else:
|
|
1807
|
-
dx=self.MaxFrameGeo.width()-w
|
|
1808
|
-
dy=self.MaxFrameGeo.height()-h
|
|
1809
|
-
m=self.ui.Clayout.contentsMargins()
|
|
1810
|
-
wMain=self.ui.w_Buttons_Run.minimumWidth()+m.left()+m.right()
|
|
1811
|
-
hMain=self.ui.w_Buttons_Run.minimumHeight()+m.top()+m.bottom()+int(self.FlagHappyLogo)*(self.ui.lab_happy_days.height()+self.ui.Clayout.spacing())
|
|
1812
|
-
hSBM=self.ui.statusbar.minimumHeight()+self.ui.menubar.minimumHeight()
|
|
1813
|
-
wpf=wMain
|
|
1814
|
-
wIOP=self.w_Import.minimumWidth()
|
|
1815
|
-
if wpf>wIOP: wIOP=wpf
|
|
1816
|
-
wVis=w-wIOP-dx
|
|
1817
|
-
hIO=self.w_Import.minimumWidth()
|
|
1818
|
-
if int(h*0.5>hIO): hIO=int(h*0.5)
|
|
1819
|
-
hP=h-hMain-hSBM-hIO-2*dy
|
|
1820
|
-
FGeometry_main=QRect(x0,y0,wIOP,hMain)
|
|
1821
|
-
FGeometry_IO=QRect(x0,y0+hMain+hSBM+dy,wIOP,hIO)
|
|
1822
|
-
FGeometry_Pro=QRect(x0,y0+hMain+hSBM+hIO+2*dy,wIOP,hP)
|
|
1823
|
-
FGeometry_Vis=QRect(x0+wIOP+dx,y0,wVis,h)
|
|
1824
|
-
self.CALpar.FloatingsGeom=[FGeometry_IO]+[FGeometry_Pro]+[FGeometry_Vis]+[FGeometry_main]
|
|
1825
|
-
self.CALpar.FloatingsVis=[True]*4
|
|
1826
|
-
self.CALpar.FScrollAreaValues=[0]*4 #***** ?????
|
|
1827
|
-
pri.Geometry.blue(f'--> Undocked configuration:\n Floatings Geometry={self.CALpar.FloatingsGeom}\n Floatings Vis={self.CALpar.FloatingsVis}')
|
|
1828
|
-
|
|
1829
|
-
#*************************************************** Greetings
|
|
1830
|
-
def setupLogo(self):
|
|
1831
|
-
today = datetime.date.today()
|
|
1832
|
-
d=today.strftime("%d/%m/%Y")
|
|
1833
|
-
happy_days=[
|
|
1834
|
-
#[d, 'Happy birthday to CalVi! 🎈🎂🍾'], #to test
|
|
1835
|
-
['20/12/1991', 'Happy birthday to Gerardo! 🎈🎂🍾'],
|
|
1836
|
-
['05/02/1969', 'Happy birthday to Tommaso! 🎈🎂🍾'],
|
|
1837
|
-
['11/07/1987', 'Happy birthday to Carlo! 🎈🎂🍾'],
|
|
1838
|
-
['19/09/1963', 'Happy birthday to Gennaro! 🎈🎂🍾'],
|
|
1839
|
-
['18/10/1985', 'Happy birthday to Stefano! 🎈🎂🍾'],
|
|
1840
|
-
['13/08/1985', 'Happy birthday to Andrea! 🎈🎂🍾'],
|
|
1841
|
-
['22/12/1988', 'Happy birthday to Gioacchino! 🎈🎂🍾'],
|
|
1842
|
-
['03/09/1991', 'Happy birthday to Giusy! 🎈🎂🍾'],
|
|
1843
|
-
['03/11/1989', 'Happy birthday to Massimo! 🎈🎂🍾'],
|
|
1844
|
-
['15/06/1991', 'Happy birthday to Mattia! 🎈🎂🍾'],
|
|
1845
|
-
['14/07/1993', 'Happy birthday to Mirko! 🎈🎂🍾'],
|
|
1846
|
-
['01/01', 'Happy New Year! 🎊🧨'],
|
|
1847
|
-
['25/12', 'Merry Christmas! 🎄✨'],
|
|
1848
|
-
['31/10', 'Happy Halloween! 🎃👻'],
|
|
1849
|
-
['22/06', 'Hello, Summer! 🌞🌊'],
|
|
1850
|
-
]
|
|
1851
|
-
|
|
1852
|
-
i=-1
|
|
1853
|
-
for j,l in enumerate(happy_days):
|
|
1854
|
-
if l[0][:6]==d[:6]:
|
|
1855
|
-
i=j
|
|
1856
|
-
break
|
|
1857
|
-
|
|
1858
|
-
if i>-1:
|
|
1859
|
-
self.FlagHappyLogo=True
|
|
1860
|
-
self.ui.logo.setPixmap(QPixmap(u""+ icons_path +"logo_CalVi_party.png"))
|
|
1861
|
-
self.ui.lab_happy_days.setText(happy_days[i][1])
|
|
1862
|
-
else:
|
|
1863
|
-
self.FlagHappyLogo=False
|
|
1864
|
-
self.ui.logo.setPixmap(QPixmap(u""+ icons_path +"logo_CalVi.png"))
|
|
1865
|
-
self.ui.lab_happy_days.setText('')
|
|
1866
|
-
|
|
1867
|
-
def happyLogo(self):
|
|
1868
|
-
self.FlagHappyLogo=not self.FlagHappyLogo
|
|
1869
|
-
if self.FlagHappyLogo:
|
|
1870
|
-
self.ui.logo.setPixmap(QPixmap(u""+ icons_path +"logo_CalVi_party.png"))
|
|
1871
|
-
self.ui.lab_happy_days.setText('Greetings! Today is a great day! 🎈🎉')
|
|
1872
|
-
else:
|
|
1873
|
-
self.ui.logo.setPixmap(QPixmap(u""+ icons_path +"logo_CalVi.png"))
|
|
1874
|
-
self.ui.lab_happy_days.setText('')
|
|
1875
|
-
|
|
1876
|
-
#*************************************************** Palette
|
|
1877
|
-
def setGPaIRSPalette(self):
|
|
1878
|
-
setAppGuiPalette(self,self.palettes[self.CALpar.paletteType])
|
|
1879
|
-
|
|
1880
|
-
def paletteContextMenuEvent(self, event):
|
|
1881
|
-
contextMenu = QMenu(self)
|
|
1882
|
-
act=[]
|
|
1883
|
-
for n in self.paletteNames:
|
|
1884
|
-
act.append(contextMenu.addAction(f"{n} mode"))
|
|
1885
|
-
act[self.CALpar.paletteType].setCheckable(True)
|
|
1886
|
-
act[self.CALpar.paletteType].setChecked(True)
|
|
1887
|
-
userAct = contextMenu.exec(event.globalPosition().toPoint())
|
|
1888
|
-
for k,a in enumerate(act):
|
|
1889
|
-
if a==userAct:
|
|
1890
|
-
self.CALpar.paletteType=k
|
|
1891
|
-
self.setGPaIRSPalette()
|
|
1892
|
-
|
|
1893
|
-
def launchCalVi(flagDebug=False,flagInputDebug=False):
|
|
1894
|
-
print('\n'+CalVi_Header+'Starting the interface...')
|
|
1895
|
-
app=QApplication.instance()
|
|
1896
|
-
if not app:app = QApplication(sys.argv)
|
|
1897
|
-
app.setStyle('Fusion')
|
|
1898
|
-
font=QFont()
|
|
1899
|
-
font.setFamily(fontName)
|
|
1900
|
-
font.setPixelSize(fontPixelSize)
|
|
1901
|
-
app.setFont(font)
|
|
1902
|
-
app.pyicon=app.windowIcon()
|
|
1903
|
-
icon=QIcon()
|
|
1904
|
-
icon.addFile(''+ icons_path +'icon_CalVi.png',QSize(), QIcon.Normal, QIcon.Off)
|
|
1905
|
-
app.setWindowIcon(icon)
|
|
1906
|
-
try:
|
|
1907
|
-
if (platform.system() == "Windows"):
|
|
1908
|
-
import ctypes
|
|
1909
|
-
ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID('CalVi')
|
|
1910
|
-
except:
|
|
1911
|
-
pri.General.red('It was not possible to set the application icon')
|
|
1912
|
-
|
|
1913
|
-
if not flagDebug or Flag_SHOWSPLASH:
|
|
1914
|
-
splash=showSplash(filename=''+ icons_path +'logo_CalVi_completo.png')
|
|
1915
|
-
app.processEvents()
|
|
1916
|
-
else:
|
|
1917
|
-
splash=None
|
|
1918
|
-
|
|
1919
|
-
standardPalette=app.style().standardPalette()
|
|
1920
|
-
global Flag_fullDEBUG
|
|
1921
|
-
Flag_fullDEBUG=flagDebug
|
|
1922
|
-
for n in printTypes:
|
|
1923
|
-
p:ColorPrint=getattr(pri,n)
|
|
1924
|
-
if p.flagFullDebug and not Flag_fullDEBUG:
|
|
1925
|
-
p.prio=PrintTAPriority.never
|
|
1926
|
-
p.setPrints()
|
|
1927
|
-
|
|
1928
|
-
if flagInputDebug:
|
|
1929
|
-
_,text=inputDialog(None,'Debug','Insert password for debug mode:',icon=icon,palette=standardPalette,width=300)
|
|
1930
|
-
flagDebug=text==pwddbg
|
|
1931
|
-
if not flagDebug:
|
|
1932
|
-
warningDialog(None,'Password for debug mode is wrong!\nPaIRS will be started in normal mode.',icon=icon,time_milliseconds=5000)
|
|
1933
|
-
gui=gCalVi(flagDebug,app)
|
|
1934
|
-
gui.palettes[2]=standardPalette
|
|
1935
|
-
gui.setGPaIRSPalette()
|
|
1936
|
-
|
|
1937
|
-
currentVersion=__version__ #if __subversion__=='0' else __version__+'.'+__subversion__
|
|
1938
|
-
flagStopAndDownload=checkLatestVersion(gui,currentVersion,app,splash)
|
|
1939
|
-
if flagStopAndDownload:
|
|
1940
|
-
gui.correctClose()
|
|
1941
|
-
runPaIRS(gui,command='-calvi',flagQuestion=False)
|
|
1942
|
-
return [app,gui,False]
|
|
1943
|
-
|
|
1944
|
-
gui.splash=splash
|
|
1945
|
-
#warningDlg.setModal(True)
|
|
1946
|
-
if splash:
|
|
1947
|
-
splash.setWindowFlags(splash.windowFlags()|Qt.WindowStaysOnTopHint)
|
|
1948
|
-
splash.show()
|
|
1949
|
-
app.processEvents()
|
|
1950
|
-
|
|
1951
|
-
if splash:
|
|
1952
|
-
gui.ui.logo.hide()
|
|
1953
|
-
gui.adjustGeometry()
|
|
1954
|
-
gui.setFontPixelSize()
|
|
1955
|
-
if splash:
|
|
1956
|
-
splashAnimation(splash,gui.ui.logo)
|
|
1957
|
-
#QTimer.singleShot(time_showSplashOnTop,splash.hide)
|
|
1958
|
-
print('\nWelcome to CalVi!\nEnjoy it!')
|
|
1959
|
-
if os.path.exists(fileWhatsNew[0]): whatsNew(gui)
|
|
1960
|
-
app.exec()
|
|
1961
|
-
return [app,gui,True]
|
|
1962
|
-
|
|
1963
|
-
def splashAnimation(self:QLabel,logo:QLabel):
|
|
1964
|
-
margin=23
|
|
1965
|
-
ml=logo.width()/self.width()*margin
|
|
1966
|
-
wl=logo.width()+2*ml
|
|
1967
|
-
hl=wl/self.width()*self.height()
|
|
1968
|
-
|
|
1969
|
-
self.anim = QPropertyAnimation(self, b"pos")
|
|
1970
|
-
pos=logo.mapToGlobal(logo.geometry().topLeft())
|
|
1971
|
-
pos.setX(pos.x()-ml)
|
|
1972
|
-
self.anim.setEndValue(pos)
|
|
1973
|
-
self.anim.setDuration(time_showSplashOnTop)
|
|
1974
|
-
self.anim_2 = QPropertyAnimation(self, b"size")
|
|
1975
|
-
|
|
1976
|
-
self.anim_2.setEndValue(QSize(wl, hl))
|
|
1977
|
-
self.anim_2.setDuration(time_showSplashOnTop)
|
|
1978
|
-
self.anim_group = QParallelAnimationGroup()
|
|
1979
|
-
self.anim_group.addAnimation(self.anim)
|
|
1980
|
-
self.anim_group.addAnimation(self.anim_2)
|
|
1981
|
-
self.anim_group.finished.connect(self.hide)
|
|
1982
|
-
self.anim_group.finished.connect(logo.show)
|
|
1983
|
-
self.anim_group.start()
|
|
1984
|
-
|
|
1985
|
-
def quitCalVi(app:QApplication,flagPrint=True):
|
|
1986
|
-
app.setWindowIcon(app.pyicon)
|
|
1987
|
-
app.quit()
|
|
1988
|
-
if flagPrint: print('\nCalVi closed.\nSee you soon!')
|
|
1989
|
-
if hasattr(app,'SecondaryThreads'):
|
|
1990
|
-
if len(app.SecondaryThreads):
|
|
1991
|
-
while any([s.isRunning for s in app.SecondaryThreads]):
|
|
1992
|
-
timesleep(.1)
|
|
1993
|
-
pass
|
|
1994
|
-
app=None
|
|
1995
|
-
return
|
|
1996
|
-
|
|
1997
|
-
def setAppGuiPalette(self:gCalVi,palette:QPalette):
|
|
1998
|
-
if self.app: self.app.setPalette(palette)
|
|
1999
|
-
if self.focusWidget():
|
|
2000
|
-
self.focusWidget().clearFocus()
|
|
2001
|
-
for f in set([self]+self.floatings+self.floatw+self.findChildren(QDialog)+[self.aboutDialog]+[self.logChanges]):
|
|
2002
|
-
if f:
|
|
2003
|
-
f.setPalette(palette)
|
|
2004
|
-
for c in f.findChildren(QObject):
|
|
2005
|
-
if hasattr(c,'setPalette') and not type(c) in (MplCanvas, mplFigure, QStatusBar):
|
|
2006
|
-
c.setPalette(palette)
|
|
2007
|
-
if hasattr(c,'initialStyle'):
|
|
2008
|
-
c.setStyleSheet(c.initialStyle)
|
|
2009
|
-
for c in f.findChildren(QObject):
|
|
2010
|
-
c:MyQLineEdit
|
|
2011
|
-
if hasattr(c,'setup'):
|
|
2012
|
-
c.initFlag=False
|
|
2013
|
-
c.styleFlag=False
|
|
2014
|
-
c.setup()
|
|
2015
|
-
for c in f.findChildren(QObject):
|
|
2016
|
-
if hasattr(c,'setup2'):
|
|
2017
|
-
c.initFlag2=False
|
|
2018
|
-
c.setup2()
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
if __name__ == "__main__":
|
|
2022
|
-
gui:gCalVi
|
|
2023
|
-
app,gui,flagPrint=launchCalVi(True)
|
|
2024
|
-
quitCalVi(app,flagPrint)
|