PaIRS-UniNa 0.2.9__cp310-cp310-macosx_11_0_universal2.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 +346 -0
- PaIRS_UniNa/Changes.txt +162 -0
- PaIRS_UniNa/Custom_Top.py +303 -0
- PaIRS_UniNa/Explorer.py +3168 -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 +3022 -0
- PaIRS_UniNa/Log_Tab.py +110 -0
- PaIRS_UniNa/Output_Tab.py +922 -0
- PaIRS_UniNa/PaIRS.py +18 -0
- PaIRS_UniNa/PaIRS_PIV.py +873 -0
- PaIRS_UniNa/PaIRS_pypacks.py +1421 -0
- PaIRS_UniNa/Process_Tab.py +1757 -0
- PaIRS_UniNa/Process_Tab_CalVi.py +313 -0
- PaIRS_UniNa/Process_Tab_Disp.py +163 -0
- PaIRS_UniNa/Process_Tab_Min.py +120 -0
- PaIRS_UniNa/ResizePopup.py +55 -0
- PaIRS_UniNa/SPIVCalHelp.py +155 -0
- PaIRS_UniNa/Saving_tools.py +296 -0
- PaIRS_UniNa/TabTools.py +1254 -0
- PaIRS_UniNa/Vis_Tab.py +2169 -0
- PaIRS_UniNa/Vis_Tab_CalVi.py +983 -0
- PaIRS_UniNa/Whatsnew.py +130 -0
- PaIRS_UniNa/_PaIRS_PIV.so +0 -0
- PaIRS_UniNa/__init__.py +6 -0
- PaIRS_UniNa/__main__.py +45 -0
- PaIRS_UniNa/addwidgets_ps.py +1133 -0
- PaIRS_UniNa/calib.py +1488 -0
- PaIRS_UniNa/calibView.py +833 -0
- PaIRS_UniNa/gPaIRS.py +3914 -0
- PaIRS_UniNa/gPalette.py +189 -0
- PaIRS_UniNa/icons/abort.png +0 -0
- PaIRS_UniNa/icons/about.png +0 -0
- 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/axes.png +0 -0
- PaIRS_UniNa/icons/background.png +0 -0
- PaIRS_UniNa/icons/background_vectors.png +0 -0
- PaIRS_UniNa/icons/bin_off.png +0 -0
- PaIRS_UniNa/icons/bin_on.png +0 -0
- PaIRS_UniNa/icons/browse_file_c.png +0 -0
- PaIRS_UniNa/icons/browse_folder_c.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/calibrate.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/checklist.png +0 -0
- PaIRS_UniNa/icons/clean.png +0 -0
- PaIRS_UniNa/icons/clean_run.png +0 -0
- PaIRS_UniNa/icons/close.png +0 -0
- PaIRS_UniNa/icons/close_all.png +0 -0
- PaIRS_UniNa/icons/close_project.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/copygrid.png +0 -0
- PaIRS_UniNa/icons/cursor_lamp.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/debug_run.png +0 -0
- PaIRS_UniNa/icons/delete.png +0 -0
- PaIRS_UniNa/icons/deleteErr.png +0 -0
- PaIRS_UniNa/icons/disp_step.png +0 -0
- PaIRS_UniNa/icons/disp_step_off.png +0 -0
- PaIRS_UniNa/icons/down.png +0 -0
- PaIRS_UniNa/icons/edit_list.png +0 -0
- PaIRS_UniNa/icons/editing.png +0 -0
- PaIRS_UniNa/icons/example_list.png +0 -0
- PaIRS_UniNa/icons/find_all_planes.png +0 -0
- PaIRS_UniNa/icons/find_plane.png +0 -0
- PaIRS_UniNa/icons/flaticon_PaIRS.png +0 -0
- PaIRS_UniNa/icons/flaticon_PaIRS_beta.png +0 -0
- PaIRS_UniNa/icons/flaticon_PaIRS_download.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/focusErrr.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/ger.png +0 -0
- PaIRS_UniNa/icons/greenv.png +0 -0
- PaIRS_UniNa/icons/guide.png +0 -0
- PaIRS_UniNa/icons/icon_CalVi.png +0 -0
- PaIRS_UniNa/icons/icon_PaIRS.png +0 -0
- PaIRS_UniNa/icons/import.png +0 -0
- PaIRS_UniNa/icons/import_set.png +0 -0
- PaIRS_UniNa/icons/information.png +0 -0
- PaIRS_UniNa/icons/information2.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/loaded.png +0 -0
- PaIRS_UniNa/icons/loading_2.gif +0 -0
- PaIRS_UniNa/icons/log_logo.png +0 -0
- PaIRS_UniNa/icons/logo_CalVi.png +0 -0
- PaIRS_UniNa/icons/logo_CalVi_completo.png +0 -0
- PaIRS_UniNa/icons/logo_CalVi_party.png +0 -0
- PaIRS_UniNa/icons/logo_PaIRS.png +0 -0
- PaIRS_UniNa/icons/logo_PaIRS_completo.png +0 -0
- PaIRS_UniNa/icons/logo_PaIRS_download.png +0 -0
- PaIRS_UniNa/icons/logo_PaIRS_party_rect.png +0 -0
- PaIRS_UniNa/icons/logo_PaIRS_rect.png +0 -0
- PaIRS_UniNa/icons/logo_opaco.png +0 -0
- PaIRS_UniNa/icons/mask.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/minus.png +0 -0
- PaIRS_UniNa/icons/mirror_u.png +0 -0
- PaIRS_UniNa/icons/mirror_v.png +0 -0
- PaIRS_UniNa/icons/mirror_x.png +0 -0
- PaIRS_UniNa/icons/mirror_y.png +0 -0
- PaIRS_UniNa/icons/mtplt.png +0 -0
- PaIRS_UniNa/icons/new.png +0 -0
- PaIRS_UniNa/icons/new_workspace.png +0 -0
- PaIRS_UniNa/icons/news.png +0 -0
- PaIRS_UniNa/icons/normal_run.png +0 -0
- PaIRS_UniNa/icons/open.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/pause.png +0 -0
- PaIRS_UniNa/icons/paused.png +0 -0
- PaIRS_UniNa/icons/pencil_bw.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/plane.png +0 -0
- PaIRS_UniNa/icons/play.png +0 -0
- PaIRS_UniNa/icons/plus.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/quit.png +0 -0
- PaIRS_UniNa/icons/read.png +0 -0
- PaIRS_UniNa/icons/read_list.png +0 -0
- PaIRS_UniNa/icons/redo.png +0 -0
- PaIRS_UniNa/icons/redx.png +0 -0
- PaIRS_UniNa/icons/reset.png +0 -0
- PaIRS_UniNa/icons/reset_levels.png +0 -0
- PaIRS_UniNa/icons/resize_icon.png +0 -0
- PaIRS_UniNa/icons/restore.png +0 -0
- PaIRS_UniNa/icons/restore_undo.png +0 -0
- PaIRS_UniNa/icons/rotate_clock.png +0 -0
- PaIRS_UniNa/icons/rotate_counter.png +0 -0
- PaIRS_UniNa/icons/rotate_v_clock.png +0 -0
- PaIRS_UniNa/icons/rotate_v_counter.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/sandglass.png +0 -0
- PaIRS_UniNa/icons/save.png +0 -0
- PaIRS_UniNa/icons/save_and_stop.png +0 -0
- PaIRS_UniNa/icons/save_cfg.png +0 -0
- PaIRS_UniNa/icons/saveas.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/spiv_setup_no.png +0 -0
- PaIRS_UniNa/icons/spiv_setup_ok.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/tom.png +0 -0
- PaIRS_UniNa/icons/trash.png +0 -0
- PaIRS_UniNa/icons/undo.png +0 -0
- PaIRS_UniNa/icons/unedited.png +0 -0
- PaIRS_UniNa/icons/unina_dii.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/up.png +0 -0
- PaIRS_UniNa/icons/updating_import.gif +0 -0
- PaIRS_UniNa/icons/updating_pairs.gif +0 -0
- PaIRS_UniNa/icons/vectorColor.png +0 -0
- PaIRS_UniNa/icons/vettore.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/waiting_circle.png +0 -0
- PaIRS_UniNa/icons/warning.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 +256 -0
- PaIRS_UniNa/parForMulti.py +435 -0
- PaIRS_UniNa/parForWorkers.py +593 -0
- PaIRS_UniNa/pivParFor.py +235 -0
- PaIRS_UniNa/plt_util.py +141 -0
- PaIRS_UniNa/preProcParFor.py +155 -0
- PaIRS_UniNa/procTools.py +1439 -0
- PaIRS_UniNa/readcfg.py +52 -0
- PaIRS_UniNa/rqrdpckgs.txt +9 -0
- PaIRS_UniNa/stereoPivParFor.py +227 -0
- PaIRS_UniNa/tAVarie.py +215 -0
- PaIRS_UniNa/tabSplitter.py +612 -0
- PaIRS_UniNa/ui_Calibration_Tab.py +578 -0
- PaIRS_UniNa/ui_Custom_Top.py +296 -0
- PaIRS_UniNa/ui_Input_Tab.py +1101 -0
- PaIRS_UniNa/ui_Input_Tab_CalVi.py +1283 -0
- PaIRS_UniNa/ui_Log_Tab.py +263 -0
- PaIRS_UniNa/ui_Output_Tab.py +2362 -0
- PaIRS_UniNa/ui_Process_Tab.py +3810 -0
- PaIRS_UniNa/ui_Process_Tab_CalVi.py +1549 -0
- PaIRS_UniNa/ui_Process_Tab_Disp.py +1141 -0
- PaIRS_UniNa/ui_Process_Tab_Min.py +437 -0
- PaIRS_UniNa/ui_ResizePopup.py +204 -0
- PaIRS_UniNa/ui_Vis_Tab.py +1628 -0
- PaIRS_UniNa/ui_Vis_Tab_CalVi.py +1251 -0
- PaIRS_UniNa/ui_Whatsnew.py +132 -0
- PaIRS_UniNa/ui_gPairs.py +877 -0
- PaIRS_UniNa/ui_infoPaIRS.py +551 -0
- PaIRS_UniNa/whatsnew.txt +6 -0
- pairs_unina-0.2.9.dist-info/METADATA +166 -0
- pairs_unina-0.2.9.dist-info/RECORD +333 -0
- pairs_unina-0.2.9.dist-info/WHEEL +5 -0
- pairs_unina-0.2.9.dist-info/top_level.txt +2 -0
|
@@ -0,0 +1,1133 @@
|
|
|
1
|
+
from .PaIRS_pypacks import *
|
|
2
|
+
#from ui_Tree_Tab import Ui_TreeTab
|
|
3
|
+
|
|
4
|
+
QLocale.setDefault(QLocale.Language.English)
|
|
5
|
+
curr_locale = QLocale()
|
|
6
|
+
|
|
7
|
+
InitCheck=True #False=Collap closed, True=opened
|
|
8
|
+
#fonts
|
|
9
|
+
font_italic=True
|
|
10
|
+
font_weight=QFont.DemiBold
|
|
11
|
+
backgroundcolor_none=" background-color: none;"
|
|
12
|
+
backgroundcolor_changing=" background-color: rgb(255,230,230);"
|
|
13
|
+
color_changing="color: rgb(33,33,255); "+backgroundcolor_changing
|
|
14
|
+
color_changing_black="color: rgb(0,0,0); "+backgroundcolor_changing
|
|
15
|
+
|
|
16
|
+
#********************************************* Operating Widgets
|
|
17
|
+
def setSS(b,style):
|
|
18
|
+
ss=f"{b.metaObject().className()}{'{'+style+'}'}\\nQToolTip{'{'+b.initialStyle+'}'}"
|
|
19
|
+
return ss
|
|
20
|
+
|
|
21
|
+
class MyTabLabel(QLabel):
|
|
22
|
+
def __init__(self,parent):
|
|
23
|
+
super().__init__(parent)
|
|
24
|
+
#self.setCursor(QCursor(QtCore.Qt.PointingHandCursor))
|
|
25
|
+
self.addfuncclick={}
|
|
26
|
+
|
|
27
|
+
def mousePressEvent(self, event):
|
|
28
|
+
for f in self.addfuncclick:
|
|
29
|
+
self.addfuncclick[f]()
|
|
30
|
+
return super().mousePressEvent(event)
|
|
31
|
+
|
|
32
|
+
def setCustomCursor(self):
|
|
33
|
+
if self.addfuncclick:
|
|
34
|
+
self.setCursor(QCursor(Qt.CursorShape.PointingHandCursor))
|
|
35
|
+
else:
|
|
36
|
+
self.setCursor(QCursor(Qt.CursorShape.ArrowCursor))
|
|
37
|
+
|
|
38
|
+
#MyQLineEdit=QtWidgets.QLineEdit
|
|
39
|
+
class MyQLineEdit(QtWidgets.QLineEdit):
|
|
40
|
+
def __init__(self,parent):
|
|
41
|
+
super().__init__(parent)
|
|
42
|
+
self.addlab=QtWidgets.QLabel()
|
|
43
|
+
self.addwid=[]
|
|
44
|
+
self.initFlag=False
|
|
45
|
+
self.initFlag2=False
|
|
46
|
+
self.styleFlag=False
|
|
47
|
+
self.addfuncin={}
|
|
48
|
+
self.addfuncout={}
|
|
49
|
+
self.addfuncreturn={}
|
|
50
|
+
self.FlagCompleter=False
|
|
51
|
+
self.FunSetCompleterList=lambda: None
|
|
52
|
+
|
|
53
|
+
def setup(self):
|
|
54
|
+
if not self.initFlag:
|
|
55
|
+
self.initFlag=True
|
|
56
|
+
font_changing = QtGui.QFont(self.font())
|
|
57
|
+
font_changing.setItalic(font_italic)
|
|
58
|
+
font_changing.setWeight(font_weight)
|
|
59
|
+
children=self.parent().children()
|
|
60
|
+
self.bros=children+self.addwid
|
|
61
|
+
for b in self.bros:
|
|
62
|
+
hasStyleFlag=hasattr(b,'styleFlag')
|
|
63
|
+
if hasattr(b,'setStyleSheet'):
|
|
64
|
+
if hasStyleFlag:
|
|
65
|
+
if b.styleFlag: continue
|
|
66
|
+
b.flagS=True
|
|
67
|
+
b.initialStyle=b.styleSheet()+" "+backgroundcolor_none
|
|
68
|
+
b.setEnabled(False)
|
|
69
|
+
b.disabledStyle=b.styleSheet()
|
|
70
|
+
b.setEnabled(True)
|
|
71
|
+
b.setStyleSheet(setSS(b,b.initialStyle))
|
|
72
|
+
else:
|
|
73
|
+
b.flagS=False
|
|
74
|
+
if hasattr(b,'setFont'):
|
|
75
|
+
b.flagF=True
|
|
76
|
+
b.initialFont=b.font()
|
|
77
|
+
b.font_changing=font_changing
|
|
78
|
+
else:
|
|
79
|
+
b.flagF=False
|
|
80
|
+
if hasStyleFlag: b.styleFlag=True
|
|
81
|
+
|
|
82
|
+
def setup2(self):
|
|
83
|
+
if not self.initFlag2:
|
|
84
|
+
self.initFlag2=True
|
|
85
|
+
for b in self.bros:
|
|
86
|
+
if hasattr(b,'bros'):
|
|
87
|
+
for c in b.bros:
|
|
88
|
+
if c not in self.bros:
|
|
89
|
+
self.bros.append(c)
|
|
90
|
+
|
|
91
|
+
def setCompleterList(self):
|
|
92
|
+
if not self.FlagCompleter:
|
|
93
|
+
self.FunSetCompleterList()
|
|
94
|
+
self.FlagCompleter=True
|
|
95
|
+
self.showCompleter()
|
|
96
|
+
|
|
97
|
+
def mouseReleaseEvent(self, event):
|
|
98
|
+
super().mouseReleaseEvent(event) #to preserve classical behaviour before adding the below
|
|
99
|
+
self.setCompleterList()
|
|
100
|
+
|
|
101
|
+
def enterEvent(self, event):
|
|
102
|
+
super().enterEvent(event)
|
|
103
|
+
if not self.font()==self.font_changing and not self.hasFocus():
|
|
104
|
+
self.setFont(self.font_changing)
|
|
105
|
+
|
|
106
|
+
def leaveEvent(self, event):
|
|
107
|
+
super().leaveEvent(event)
|
|
108
|
+
if self.font()==self.font_changing and not self.hasFocus():
|
|
109
|
+
self.setFont(self.initialFont)
|
|
110
|
+
|
|
111
|
+
def focusInEvent(self, event):
|
|
112
|
+
super().focusInEvent(event)
|
|
113
|
+
for f in self.addfuncin:
|
|
114
|
+
self.addfuncin[f]()
|
|
115
|
+
self.focusInFun()
|
|
116
|
+
|
|
117
|
+
def setFocus(self):
|
|
118
|
+
super().setFocus()
|
|
119
|
+
self.focusInFun()
|
|
120
|
+
|
|
121
|
+
def focusInFun(self):
|
|
122
|
+
self.setStyleSheet(setSS(self,self.initialStyle+" "+color_changing))
|
|
123
|
+
self.setFont(self.font_changing)
|
|
124
|
+
for b in self.bros:
|
|
125
|
+
if (not b==self) and b.flagS:
|
|
126
|
+
b.setStyleSheet(b.initialStyle+" "+color_changing_black)
|
|
127
|
+
|
|
128
|
+
def focusOutEvent(self, event):
|
|
129
|
+
super().focusOutEvent(event) #to preserve classical behaviour before adding the below
|
|
130
|
+
for f in self.addfuncout:
|
|
131
|
+
self.addfuncout[f]()
|
|
132
|
+
self.focusOutFun()
|
|
133
|
+
|
|
134
|
+
def clearFocus(self):
|
|
135
|
+
super().clearFocus()
|
|
136
|
+
self.focusOutFun()
|
|
137
|
+
|
|
138
|
+
def focusOutFun(self):
|
|
139
|
+
for b in self.bros:
|
|
140
|
+
if b.flagS:
|
|
141
|
+
if hasattr(b,'default_stylesheet'):
|
|
142
|
+
b.setStyleSheet(b.default_stylesheet)
|
|
143
|
+
else:
|
|
144
|
+
b.setStyleSheet(setSS(b,b.initialStyle))
|
|
145
|
+
if b.flagF:
|
|
146
|
+
b.setFont(b.initialFont)
|
|
147
|
+
#self.addlab.clear()
|
|
148
|
+
|
|
149
|
+
def showCompleter(self):
|
|
150
|
+
if self.completer():
|
|
151
|
+
self.completer().complete()
|
|
152
|
+
|
|
153
|
+
class MyQLineEditNumber(MyQLineEdit):
|
|
154
|
+
def __init__(self,parent):
|
|
155
|
+
super().__init__(parent)
|
|
156
|
+
self.addfuncreturn={}
|
|
157
|
+
|
|
158
|
+
def keyPressEvent(self, event):
|
|
159
|
+
#infoPrint.white(event.key())
|
|
160
|
+
if event.key() in (Qt.Key.Key_Space, #space
|
|
161
|
+
Qt.Key.Key_Comma, #comma
|
|
162
|
+
Qt.Key.Key_Delete, Qt.Key.Key_Backspace, #del, backspace
|
|
163
|
+
Qt.Key.Key_Left,Qt.Key.Key_Right, #left, right
|
|
164
|
+
Qt.Key.Key_Return, Qt.Key.Key_Enter #return
|
|
165
|
+
) \
|
|
166
|
+
or (event.key()>=Qt.Key.Key_0 and event.key()<=Qt.Key.Key_9):
|
|
167
|
+
super().keyPressEvent(event)
|
|
168
|
+
if event.key()==16777220:
|
|
169
|
+
for f in self.addfuncreturn:
|
|
170
|
+
self.addfuncreturn[f]()
|
|
171
|
+
|
|
172
|
+
class MyQCombo(QtWidgets.QComboBox):
|
|
173
|
+
def wheelEvent(self, event):
|
|
174
|
+
event.ignore()
|
|
175
|
+
|
|
176
|
+
#MyQSpin=QtWidgets.QSpinBox
|
|
177
|
+
class MyQSpin(QtWidgets.QSpinBox):
|
|
178
|
+
def __init__(self,parent):
|
|
179
|
+
super().__init__(parent)
|
|
180
|
+
self.addwid=[]
|
|
181
|
+
self.initFlag=False
|
|
182
|
+
self.styleFlag=False
|
|
183
|
+
self.addfuncin={}
|
|
184
|
+
self.addfuncout={}
|
|
185
|
+
self.addfuncreturn={}
|
|
186
|
+
|
|
187
|
+
self.setAccelerated(True)
|
|
188
|
+
self.setGroupSeparatorShown(True)
|
|
189
|
+
|
|
190
|
+
def setup(self):
|
|
191
|
+
if not self.initFlag:
|
|
192
|
+
self.initFlag=True
|
|
193
|
+
font_changing = QtGui.QFont(self.font())
|
|
194
|
+
font_changing.setItalic(font_italic)
|
|
195
|
+
font_changing.setWeight(font_weight)
|
|
196
|
+
self.bros=[self]+self.addwid
|
|
197
|
+
for b in self.bros:
|
|
198
|
+
if b.styleFlag: continue
|
|
199
|
+
b.initialStyle=b.styleSheet()+" "+backgroundcolor_none
|
|
200
|
+
b.initialFont=b.font()
|
|
201
|
+
b.font_changing=font_changing
|
|
202
|
+
b.styleFlag=True
|
|
203
|
+
self.spinFontObj=[]
|
|
204
|
+
for c in self.findChildren(QObject):
|
|
205
|
+
if hasattr(c,'setFont'):
|
|
206
|
+
self.spinFontObj+=[c]
|
|
207
|
+
|
|
208
|
+
def setFocus(self):
|
|
209
|
+
super().setFocus()
|
|
210
|
+
self.focusInFun()
|
|
211
|
+
|
|
212
|
+
def focusInEvent(self, event):
|
|
213
|
+
super().focusInEvent(event) #to preserve classical behaviour before adding the below
|
|
214
|
+
for f in self.addfuncin:
|
|
215
|
+
self.addfuncin[f]()
|
|
216
|
+
self.focusInFun()
|
|
217
|
+
|
|
218
|
+
def focusInFun(self):
|
|
219
|
+
if not self.font()==self.font_changing:
|
|
220
|
+
for b in self.bros:
|
|
221
|
+
b.setStyleSheet(b.initialStyle+" "+color_changing)
|
|
222
|
+
b.setFont(b.font_changing)
|
|
223
|
+
for b in self.spinFontObj:
|
|
224
|
+
b.setFont(self.font_changing)
|
|
225
|
+
|
|
226
|
+
def focusOutEvent(self, event):
|
|
227
|
+
super().focusOutEvent(event) #to preserve classical behaviour before adding the below
|
|
228
|
+
for f in self.addfuncout:
|
|
229
|
+
self.addfuncout[f]()
|
|
230
|
+
if self.font()==self.font_changing:
|
|
231
|
+
for b in self.bros:
|
|
232
|
+
b.setStyleSheet(b.initialStyle)
|
|
233
|
+
b.setFont(b.initialFont)
|
|
234
|
+
for b in self.spinFontObj:
|
|
235
|
+
b.setFont(self.initialFont)
|
|
236
|
+
|
|
237
|
+
def keyPressEvent(self, event):
|
|
238
|
+
super().keyPressEvent(event)
|
|
239
|
+
if event.key() in (Qt.Key.Key_Return,Qt.Key.Key_Enter) and self.hasFocus():
|
|
240
|
+
for f in self.addfuncreturn:
|
|
241
|
+
self.addfuncreturn[f]()
|
|
242
|
+
|
|
243
|
+
def wheelEvent(self, event):
|
|
244
|
+
event.ignore()
|
|
245
|
+
|
|
246
|
+
def textFromValue(self, value):
|
|
247
|
+
return formatNumber(self,value)
|
|
248
|
+
|
|
249
|
+
def formatNumber(self:QWidget,value):
|
|
250
|
+
if Flag_GROUPSEPARATOR:
|
|
251
|
+
text=self.locale().toString(float(value), 'd')
|
|
252
|
+
else:
|
|
253
|
+
text=f"{value:f}"
|
|
254
|
+
return (text).rstrip('0').rstrip(curr_locale.decimalPoint())
|
|
255
|
+
#return ('%f' % value).rstrip('0').rstrip('.')
|
|
256
|
+
|
|
257
|
+
class MyQSpinXW(MyQSpin):
|
|
258
|
+
def __init__(self,parent):
|
|
259
|
+
super().__init__(parent)
|
|
260
|
+
self.Win=-1
|
|
261
|
+
|
|
262
|
+
def focusInEvent(self, event):
|
|
263
|
+
super().focusInEvent(event) #to preserve classical behaviour before adding the below
|
|
264
|
+
if len(self.addwid)>0:
|
|
265
|
+
self.Win=self.addwid[0].value()
|
|
266
|
+
|
|
267
|
+
class MyToolButton(QtWidgets.QToolButton):
|
|
268
|
+
def __init__(self,parent):
|
|
269
|
+
super().__init__(parent)
|
|
270
|
+
|
|
271
|
+
class MyQDoubleSpin(QtWidgets.QDoubleSpinBox):
|
|
272
|
+
def __init__(self,parent):
|
|
273
|
+
super().__init__(parent)
|
|
274
|
+
self.addwid=[]
|
|
275
|
+
self.initFlag=False
|
|
276
|
+
self.styleFlag=False
|
|
277
|
+
self.addfuncin={}
|
|
278
|
+
self.addfuncout={}
|
|
279
|
+
self.addfuncreturn={}
|
|
280
|
+
|
|
281
|
+
self.setAccelerated(True)
|
|
282
|
+
self.setGroupSeparatorShown(True)
|
|
283
|
+
|
|
284
|
+
def setup(self):
|
|
285
|
+
if not self.initFlag:
|
|
286
|
+
self.initFlag=True
|
|
287
|
+
font_changing = QtGui.QFont(self.font())
|
|
288
|
+
font_changing.setItalic(font_italic)
|
|
289
|
+
font_changing.setWeight(font_weight)
|
|
290
|
+
self.bros=[self]+self.addwid
|
|
291
|
+
for b in self.bros:
|
|
292
|
+
if self.styleFlag: continue
|
|
293
|
+
b.initialStyle=b.styleSheet()+" "+backgroundcolor_none
|
|
294
|
+
b.initialFont=b.font()
|
|
295
|
+
b.font_changing=font_changing
|
|
296
|
+
b.styleFlag=True
|
|
297
|
+
self.spinFontObj=[]
|
|
298
|
+
for c in self.findChildren(QObject):
|
|
299
|
+
if hasattr(c,'setFont'):
|
|
300
|
+
self.spinFontObj+=[c]
|
|
301
|
+
|
|
302
|
+
def focusInEvent(self, event):
|
|
303
|
+
super().focusInEvent(event) #to preserve classical behaviour before adding the below
|
|
304
|
+
for f in self.addfuncin:
|
|
305
|
+
self.addfuncin[f]()
|
|
306
|
+
if not self.font()==self.font_changing:
|
|
307
|
+
for b in self.bros:
|
|
308
|
+
b.setStyleSheet(b.initialStyle+" "+color_changing)
|
|
309
|
+
b.setFont(self.font_changing)
|
|
310
|
+
for b in self.spinFontObj:
|
|
311
|
+
b.setFont(self.font_changing)
|
|
312
|
+
|
|
313
|
+
def focusOutEvent(self, event):
|
|
314
|
+
super().focusOutEvent(event) #to preserve classical behaviour before adding the below
|
|
315
|
+
for f in self.addfuncout:
|
|
316
|
+
self.addfuncout[f]()
|
|
317
|
+
if self.font()==self.font_changing:
|
|
318
|
+
for b in self.bros:
|
|
319
|
+
b.setStyleSheet(b.initialStyle)
|
|
320
|
+
b.setFont(b.initialFont)
|
|
321
|
+
for b in self.spinFontObj:
|
|
322
|
+
b.setFont(self.initialFont)
|
|
323
|
+
|
|
324
|
+
def keyPressEvent(self, event):
|
|
325
|
+
super().keyPressEvent(event)
|
|
326
|
+
if event.key() in (Qt.Key.Key_Return,Qt.Key.Key_Enter) and self.hasFocus():
|
|
327
|
+
for f in self.addfuncreturn:
|
|
328
|
+
self.addfuncreturn[f]()
|
|
329
|
+
|
|
330
|
+
def wheelEvent(self, event):
|
|
331
|
+
event.ignore()
|
|
332
|
+
|
|
333
|
+
def textFromValue(self, value):
|
|
334
|
+
if Flag_GROUPSEPARATOR:
|
|
335
|
+
text=self.locale().toString(float(value), 'f', self.decimals())
|
|
336
|
+
else:
|
|
337
|
+
text=f"{value:f}"
|
|
338
|
+
return (text).rstrip('0').rstrip(curr_locale.decimalPoint())
|
|
339
|
+
#return ('%f' % value).rstrip('0').rstrip('.')
|
|
340
|
+
|
|
341
|
+
class CollapsibleBox(QtWidgets.QWidget):
|
|
342
|
+
def __init__(self, parent):
|
|
343
|
+
super().__init__(parent)
|
|
344
|
+
self.initFlag=False
|
|
345
|
+
self.FlagPush=False
|
|
346
|
+
self.dpix=5
|
|
347
|
+
self.toolMinimumWidth=400
|
|
348
|
+
self.toolHeight=20
|
|
349
|
+
self.content_area:QGroupBox=None
|
|
350
|
+
self.toggle_button:QPushButton=None
|
|
351
|
+
self.push_button:MyToolButton=None
|
|
352
|
+
|
|
353
|
+
def setup(self,*args):
|
|
354
|
+
if not self.initFlag:
|
|
355
|
+
if len(args):
|
|
356
|
+
self.ind=args[0]
|
|
357
|
+
self.stretch=args[1]
|
|
358
|
+
else:
|
|
359
|
+
self.ind=-1
|
|
360
|
+
self.stretch=0
|
|
361
|
+
self.initFlag=True
|
|
362
|
+
|
|
363
|
+
if self.content_area is None:
|
|
364
|
+
self.content_area=self.findChild(QtWidgets.QGroupBox)
|
|
365
|
+
self.content_area.setStyleSheet("QGroupBox{border: 1px solid gray; border-radius: 6px;}")
|
|
366
|
+
|
|
367
|
+
if self.toggle_button is None:
|
|
368
|
+
self.toggle_button=self.findChild(QtWidgets.QToolButton)
|
|
369
|
+
self.toggle_button.setChecked(InitCheck)
|
|
370
|
+
self.toggle_button.clicked.connect(self.on_click)
|
|
371
|
+
self.toggle_button.setCursor(QtCore.Qt.CursorShape.PointingHandCursor)
|
|
372
|
+
self.toggle_button.setMinimumWidth(self.toolMinimumWidth)
|
|
373
|
+
|
|
374
|
+
if self.push_button is None:
|
|
375
|
+
self.push_button=self.findChild(MyToolButton)
|
|
376
|
+
|
|
377
|
+
self.OpenStyle=\
|
|
378
|
+
"QToolButton { border: none; }\n"+\
|
|
379
|
+
"QToolButton::hover{color: rgba(0,0,255,200);}"+\
|
|
380
|
+
"QToolButton::focus{color: rgba(0,0,255,200);}"
|
|
381
|
+
#"QToolButton::hover{border: none; border-radius: 6px; background-color: rgba(0, 0,128,32); }"
|
|
382
|
+
self.ClosedStyle=\
|
|
383
|
+
"QToolButton { border: 1px solid lightgray; border-radius: 6px }\n"+\
|
|
384
|
+
"QToolButton::hover{ border: 1px solid rgba(0,0,255,200); border-radius: 6px; color: rgba(0,0,255,200);}"+\
|
|
385
|
+
"QToolButton::focus{ border: 1px solid rgba(0,0,255,200); border-radius: 6px; color: rgba(0,0,255,200);}" #background-color: rgba(0, 0,128,32); }"
|
|
386
|
+
|
|
387
|
+
self.heightToogle=self.toggle_button.minimumHeight()
|
|
388
|
+
self.heightOpened=self.minimumHeight()
|
|
389
|
+
self.heightArea=self.heightOpened-self.toolHeight
|
|
390
|
+
|
|
391
|
+
self.on_click()
|
|
392
|
+
|
|
393
|
+
#@QtCore.pyqtSlot()
|
|
394
|
+
def on_click(self):
|
|
395
|
+
checked = self.toggle_button.isChecked()
|
|
396
|
+
pri.Coding.yellow(f'>>>>> {self.objectName()} {"opening" if checked else "closing"}')
|
|
397
|
+
if self.objectName()=='CollapBox_ImSet' and checked:
|
|
398
|
+
pass
|
|
399
|
+
if self.FlagPush:
|
|
400
|
+
self.push_button.show()
|
|
401
|
+
else:
|
|
402
|
+
self.push_button.hide()
|
|
403
|
+
if checked:
|
|
404
|
+
self.content_area.show()
|
|
405
|
+
self.toggle_button.setArrowType(QtCore.Qt.ArrowType.DownArrow)
|
|
406
|
+
|
|
407
|
+
self.toggle_button.setMinimumHeight(self.heightToogle)
|
|
408
|
+
self.toggle_button.setMaximumHeight(self.heightToogle)
|
|
409
|
+
self.setMinimumHeight(self.heightOpened)
|
|
410
|
+
self.setMaximumHeight(int(self.heightOpened*1.5))
|
|
411
|
+
self.content_area.setMinimumHeight(self.heightArea)
|
|
412
|
+
self.content_area.setMaximumHeight(int(self.heightArea*1.5))
|
|
413
|
+
|
|
414
|
+
self.toggle_button.setSizePolicy(QtWidgets.QSizePolicy.Policy.Preferred, QtWidgets.QSizePolicy.Policy.Preferred)
|
|
415
|
+
self.setSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Maximum)
|
|
416
|
+
self.content_area.setSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Expanding)
|
|
417
|
+
|
|
418
|
+
self.toggle_button.setStyleSheet(self.OpenStyle)
|
|
419
|
+
if self.ind>0:
|
|
420
|
+
self.parent().layout().setStretch(self.ind,self.stretch)
|
|
421
|
+
else:
|
|
422
|
+
self.content_area.hide()
|
|
423
|
+
self.toggle_button.setArrowType(QtCore.Qt.ArrowType.RightArrow)
|
|
424
|
+
|
|
425
|
+
self.toggle_button.setMinimumHeight(self.heightToogle+self.dpix)
|
|
426
|
+
self.toggle_button.setMaximumHeight(self.heightToogle+self.dpix)
|
|
427
|
+
self.setMinimumHeight(self.heightToogle+self.dpix*2)
|
|
428
|
+
self.setMaximumHeight(self.heightToogle+self.dpix*2)
|
|
429
|
+
self.content_area.setMinimumHeight(0)
|
|
430
|
+
self.content_area.setMaximumHeight(0)
|
|
431
|
+
|
|
432
|
+
self.toggle_button.setSizePolicy(QtWidgets.QSizePolicy.Policy.Minimum, QtWidgets.QSizePolicy.Policy.Preferred)
|
|
433
|
+
self.setSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Expanding)
|
|
434
|
+
self.content_area.setSizePolicy(QtWidgets.QSizePolicy.Policy.Minimum, QtWidgets.QSizePolicy.Policy.Minimum)
|
|
435
|
+
|
|
436
|
+
self.toggle_button.setStyleSheet(self.ClosedStyle)
|
|
437
|
+
|
|
438
|
+
if self.ind>0:
|
|
439
|
+
self.parent().layout().setStretch(self.ind,0)
|
|
440
|
+
|
|
441
|
+
# Forza l'aggiornamento dei layout
|
|
442
|
+
self.updateGeometry()
|
|
443
|
+
self.parentWidget().updateGeometry()
|
|
444
|
+
self.parentWidget().adjustSize()
|
|
445
|
+
|
|
446
|
+
def openBox(self):
|
|
447
|
+
self.toggle_button.setChecked(True)
|
|
448
|
+
self.on_click()
|
|
449
|
+
|
|
450
|
+
def closeBox(self):
|
|
451
|
+
self.toggle_button.setChecked(False)
|
|
452
|
+
self.on_click()
|
|
453
|
+
|
|
454
|
+
class myQTreeWidget(QTreeWidget):
|
|
455
|
+
def __init__(self,parent):
|
|
456
|
+
super().__init__(parent)
|
|
457
|
+
self.FlagArrowKeysNormal=False
|
|
458
|
+
self.addfuncin={}
|
|
459
|
+
self.addfuncout={}
|
|
460
|
+
self.addfuncreturn={}
|
|
461
|
+
self.addfuncshift_pressed={}
|
|
462
|
+
self.addfuncshift_released={}
|
|
463
|
+
self.addfuncdel_pressed={}
|
|
464
|
+
self.addfuncarrows_pressed={}
|
|
465
|
+
self.addfuncarrows_released={}
|
|
466
|
+
self.addfunckey_pressed={}
|
|
467
|
+
#self.ui:Ui_TreeTab=None
|
|
468
|
+
self.ui=None
|
|
469
|
+
|
|
470
|
+
def focusInEvent(self, event):
|
|
471
|
+
super().focusInEvent(event) #to preserve classical behaviour before adding the below
|
|
472
|
+
for f in self.addfuncin:
|
|
473
|
+
self.addfuncin[f]()
|
|
474
|
+
|
|
475
|
+
def focusOutEvent(self, event):
|
|
476
|
+
super().focusOutEvent(event) #to preserve classical behaviour before adding the below
|
|
477
|
+
for f in self.addfuncout:
|
|
478
|
+
self.addfuncout[f]()
|
|
479
|
+
|
|
480
|
+
def keyPressEvent(self, event):
|
|
481
|
+
if event.key() == Qt.Key.Key_Shift:
|
|
482
|
+
super().keyPressEvent(event)
|
|
483
|
+
for f in self.addfuncshift_pressed:
|
|
484
|
+
self.addfuncshift_pressed[f]()
|
|
485
|
+
elif event.key() == Qt.Key.Key_Delete or event.key() == Qt.Key.Key_Backspace:
|
|
486
|
+
super().keyPressEvent(event)
|
|
487
|
+
for f in self.addfuncdel_pressed:
|
|
488
|
+
self.addfuncdel_pressed[f]()
|
|
489
|
+
elif event.key() == Qt.Key.Key_Up or event.key() == Qt.Key.Key_Down:
|
|
490
|
+
if self.FlagArrowKeysNormal:
|
|
491
|
+
return super().keyPressEvent(event)
|
|
492
|
+
else:
|
|
493
|
+
Flag=True
|
|
494
|
+
for f in self.addfuncarrows_pressed:
|
|
495
|
+
Flag=Flag and self.addfuncarrows_pressed[f](event.key())
|
|
496
|
+
#if Flag: super().keyPressEvent(event)
|
|
497
|
+
else:
|
|
498
|
+
super().keyPressEvent(event)
|
|
499
|
+
for f in self.addfunckey_pressed:
|
|
500
|
+
self.addfunckey_pressed[f](event.key())
|
|
501
|
+
|
|
502
|
+
def keyReleaseEvent(self, event):
|
|
503
|
+
super().keyReleaseEvent(event)
|
|
504
|
+
if event.key() == QtCore.Qt.Key_Shift:
|
|
505
|
+
for f in self.addfuncshift_released:
|
|
506
|
+
self.addfuncshift_released[f]()
|
|
507
|
+
elif event.key() == QtCore.Qt.Key_Up or event.key() == QtCore.Qt.Key_Down:
|
|
508
|
+
if self.FlagArrowKeysNormal:
|
|
509
|
+
return super().keyReleaseEvent(event)
|
|
510
|
+
else:
|
|
511
|
+
Flag=True
|
|
512
|
+
for f in self.addfuncarrows_released:
|
|
513
|
+
Flag=Flag and self.addfuncarrows_released[f](event.key())
|
|
514
|
+
#if Flag: super().keyPressEvent(event)
|
|
515
|
+
|
|
516
|
+
class ToggleSplitterHandle(QtWidgets.QSplitterHandle):
|
|
517
|
+
def mousePressEvent(self, event):
|
|
518
|
+
super().mousePressEvent(event)
|
|
519
|
+
for f in self.parent().addfuncin:
|
|
520
|
+
self.parent().addfuncin[f]()
|
|
521
|
+
|
|
522
|
+
def mouseReleaseEvent(self, event):
|
|
523
|
+
super().mouseReleaseEvent(event)
|
|
524
|
+
for f in self.parent().addfuncout:
|
|
525
|
+
self.parent().addfuncout[f]()
|
|
526
|
+
|
|
527
|
+
class myQSplitter(QSplitter):
|
|
528
|
+
def __init__(self,parent):
|
|
529
|
+
super().__init__(parent)
|
|
530
|
+
self.OpWidth=0
|
|
531
|
+
self.OpMaxWidth=0
|
|
532
|
+
self.addfuncin={}
|
|
533
|
+
self.addfuncout={}
|
|
534
|
+
self.addfuncreturn={}
|
|
535
|
+
|
|
536
|
+
def createHandle(self):
|
|
537
|
+
return ToggleSplitterHandle(self.orientation(), self)
|
|
538
|
+
|
|
539
|
+
class RichTextPushButton(QPushButton):
|
|
540
|
+
margin=0
|
|
541
|
+
spacing=0
|
|
542
|
+
|
|
543
|
+
def __init__(self, parent=None, text=None):
|
|
544
|
+
if parent is not None:
|
|
545
|
+
super().__init__(parent)
|
|
546
|
+
else:
|
|
547
|
+
super().__init__()
|
|
548
|
+
|
|
549
|
+
self.__lyt = QHBoxLayout()
|
|
550
|
+
self.__lyt.setContentsMargins(self.margin, 0, self.margin, 0)
|
|
551
|
+
self.__lyt.setSpacing(self.spacing)
|
|
552
|
+
self.setLayout(self.__lyt)
|
|
553
|
+
|
|
554
|
+
self.__icon= QLabel(self)
|
|
555
|
+
self.__icon.setSizePolicy(
|
|
556
|
+
QSizePolicy.Preferred,
|
|
557
|
+
QSizePolicy.Expanding,
|
|
558
|
+
)
|
|
559
|
+
self.__icon.setAlignment(QtCore.Qt.AlignCenter | QtCore.Qt.AlignVCenter)
|
|
560
|
+
|
|
561
|
+
self.__lbl = QLabel(self)
|
|
562
|
+
if text is not None:
|
|
563
|
+
self.__lbl.setText(text)
|
|
564
|
+
else:
|
|
565
|
+
self.__lbl.hide()
|
|
566
|
+
self.__lbl.setAttribute(Qt.WA_TranslucentBackground)
|
|
567
|
+
self.__lbl.setAttribute(Qt.WA_TransparentForMouseEvents)
|
|
568
|
+
self.__lbl.setSizePolicy(
|
|
569
|
+
QSizePolicy.Preferred,
|
|
570
|
+
QSizePolicy.Expanding,
|
|
571
|
+
)
|
|
572
|
+
self.__lbl.setTextFormat(Qt.RichText)
|
|
573
|
+
self.__lbl.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
|
|
574
|
+
|
|
575
|
+
self.__lyt.addWidget(self.__icon)
|
|
576
|
+
self.__lyt.addWidget(self.__lbl)
|
|
577
|
+
self.__lyt.setStretch(0,1)
|
|
578
|
+
self.__lyt.setStretch(1,2)
|
|
579
|
+
|
|
580
|
+
self.lyt=self.__lyt
|
|
581
|
+
self.lbl=self.__lbl
|
|
582
|
+
self.icn=None
|
|
583
|
+
return
|
|
584
|
+
|
|
585
|
+
def setText(self, text):
|
|
586
|
+
if text:
|
|
587
|
+
self.__lbl.show()
|
|
588
|
+
self.__lbl.setText(text)
|
|
589
|
+
else: self.__lbl.hide()
|
|
590
|
+
self.updateGeometry()
|
|
591
|
+
return
|
|
592
|
+
|
|
593
|
+
def setIcon(self, icon):
|
|
594
|
+
h=int(self.size().height()/2)
|
|
595
|
+
pixmap = icon.pixmap(QSize(h,h))
|
|
596
|
+
self.__icon.setPixmap(pixmap)
|
|
597
|
+
self.icn=icon
|
|
598
|
+
self.updateGeometry()
|
|
599
|
+
return
|
|
600
|
+
|
|
601
|
+
def setIconSize(self, size:QSize):
|
|
602
|
+
if self.icn: self.__icon.setPixmap(self.icn.pixmap(size))
|
|
603
|
+
self.updateGeometry()
|
|
604
|
+
return
|
|
605
|
+
|
|
606
|
+
def sizeHint(self):
|
|
607
|
+
s = QPushButton.sizeHint(self)
|
|
608
|
+
w_lbl = self.__lbl.sizeHint()
|
|
609
|
+
w_icon = self.__icon.sizeHint()
|
|
610
|
+
s.setWidth(w_lbl.width()+w_icon.width()
|
|
611
|
+
+self.margin*2+self.spacing)
|
|
612
|
+
s.setHeight(w_lbl.height())
|
|
613
|
+
return s
|
|
614
|
+
|
|
615
|
+
class myQTableWidget(QtWidgets.QTableWidget):
|
|
616
|
+
def __init__(self,parent):
|
|
617
|
+
super().__init__(parent)
|
|
618
|
+
self.RowInfo=[]
|
|
619
|
+
self.InfoLabel:QLabel=None
|
|
620
|
+
self.DeleteButton:QPushButton=None
|
|
621
|
+
self.addwid=[]
|
|
622
|
+
self.addfuncreturn={}
|
|
623
|
+
self.addfuncout={}
|
|
624
|
+
#self.itemSelectionChanged.connect(self.resizeInfoLabel)
|
|
625
|
+
|
|
626
|
+
def keyPressEvent(self, event):
|
|
627
|
+
#infoPrint.white(event.key())
|
|
628
|
+
super().keyPressEvent(event)
|
|
629
|
+
if event.key() in (Qt.Key.Key_Return,Qt.Key.Key_Enter): #return
|
|
630
|
+
for f in self.addfuncreturn:
|
|
631
|
+
self.addfuncreturn[f]()
|
|
632
|
+
|
|
633
|
+
def focusInEvent(self, event):
|
|
634
|
+
super().focusInEvent(event)
|
|
635
|
+
#if self.DeleteButton: #and self.currentItem():
|
|
636
|
+
# self.DeleteButton.setEnabled(True)
|
|
637
|
+
|
|
638
|
+
def focusOutEvent(self, event):
|
|
639
|
+
super().focusOutEvent(event)
|
|
640
|
+
for f in self.addfuncout:
|
|
641
|
+
self.addfuncout[f]()
|
|
642
|
+
#if self.InfoLabel:
|
|
643
|
+
# self.InfoLabel.hide()
|
|
644
|
+
# self.InfoLabel.setText('')
|
|
645
|
+
#if self.DeleteButton:
|
|
646
|
+
# self.DeleteButton.setEnabled(False)
|
|
647
|
+
|
|
648
|
+
def resizeEvent(self, event):
|
|
649
|
+
super().resizeEvent(event)
|
|
650
|
+
self.resizeInfoLabel()
|
|
651
|
+
|
|
652
|
+
def resizeInfoLabel(self):
|
|
653
|
+
if self.InfoLabel and (True if not self.addwid else not self.addwid[0].hasFocus()):
|
|
654
|
+
item=self.currentItem()
|
|
655
|
+
if item:
|
|
656
|
+
self.InfoLabel.show()
|
|
657
|
+
if self.RowInfo: rowInfo=self.RowInfo[self.currentRow()]
|
|
658
|
+
else: rowInfo=''
|
|
659
|
+
tip=item.toolTip()
|
|
660
|
+
if not "<br>" in tip:
|
|
661
|
+
fw=lambda t: QtGui.QFontMetrics(self.InfoLabel.font()).size(QtCore.Qt.TextSingleLine,t).width()
|
|
662
|
+
if fw(tip)>self.InfoLabel.width():
|
|
663
|
+
k=0
|
|
664
|
+
while fw(tip[:k])<self.InfoLabel.width():
|
|
665
|
+
k+=1
|
|
666
|
+
tip="<br>".join([tip[:k-1], tip[k-1:2*k]])
|
|
667
|
+
if rowInfo: tip="<br>".join([tip,rowInfo])
|
|
668
|
+
self.InfoLabel.setText(tip)
|
|
669
|
+
else:
|
|
670
|
+
self.InfoLabel.hide()
|
|
671
|
+
self.InfoLabel.setText('')
|
|
672
|
+
|
|
673
|
+
def isfloat(num):
|
|
674
|
+
try:
|
|
675
|
+
float(num)
|
|
676
|
+
return True
|
|
677
|
+
except ValueError:
|
|
678
|
+
return False
|
|
679
|
+
|
|
680
|
+
class ClickableLabel(QLabel):
|
|
681
|
+
pixmap_size=25
|
|
682
|
+
def __init__(self, *args):
|
|
683
|
+
super().__init__(*args)
|
|
684
|
+
|
|
685
|
+
self.default_stylesheet = self.styleSheet()
|
|
686
|
+
self.highlight_stylesheet = "background-color: #dcdcdc; border-radius: 3px;"
|
|
687
|
+
|
|
688
|
+
self.timer = QTimer(self)
|
|
689
|
+
self.timer.timeout.connect(self.resetHighlight)
|
|
690
|
+
self.timer.setSingleShot(True)
|
|
691
|
+
|
|
692
|
+
self.moviePixmap=None
|
|
693
|
+
|
|
694
|
+
def mousePressEvent(self, event):
|
|
695
|
+
if event.button() == Qt.LeftButton and self.toolTip():
|
|
696
|
+
self.highlight()
|
|
697
|
+
self.showMessageBox()
|
|
698
|
+
self.resetHighlight()
|
|
699
|
+
|
|
700
|
+
def showMessageBox(self):
|
|
701
|
+
if self.moviePixmap: pixmap=self.moviePixmap
|
|
702
|
+
else: pixmap=self.pixmap()
|
|
703
|
+
warningDialog(self.window(),Message=self.toolTip(),pixmap=pixmap,title='Info')
|
|
704
|
+
|
|
705
|
+
def highlight(self):
|
|
706
|
+
self.setStyleSheet(self.highlight_stylesheet)
|
|
707
|
+
self.repaint()
|
|
708
|
+
|
|
709
|
+
def resetHighlight(self):
|
|
710
|
+
self.setStyleSheet(self.default_stylesheet)
|
|
711
|
+
|
|
712
|
+
def setToolTip(self,arg__1):
|
|
713
|
+
QLabel.setToolTip(self,arg__1)
|
|
714
|
+
QLabel.setStatusTip(self,arg__1)
|
|
715
|
+
if arg__1:
|
|
716
|
+
self.setCursor(QCursor(Qt.CursorShape.PointingHandCursor))
|
|
717
|
+
else:
|
|
718
|
+
self.setCursor(QCursor(Qt.CursorShape.ArrowCursor))
|
|
719
|
+
|
|
720
|
+
class ClickableEditLabel(ClickableLabel):
|
|
721
|
+
def setup(self):
|
|
722
|
+
line_edit=QLineEdit(self)
|
|
723
|
+
line_edit.setPalette(self.palette())
|
|
724
|
+
line_edit_bg_color_str = line_edit.palette().color(QPalette.ColorRole.Base).name()
|
|
725
|
+
self.default_stylesheet=self.styleSheet()+f"ClickableEditLabel{{background-color: {line_edit_bg_color_str}}};"
|
|
726
|
+
self.setStyleSheet(self.default_stylesheet)
|
|
727
|
+
line_edit.setParent(None)
|
|
728
|
+
|
|
729
|
+
class CustomLineEdit(QLineEdit):
|
|
730
|
+
cancelEditing = Signal()
|
|
731
|
+
|
|
732
|
+
def __init__(self, text, parent=None):
|
|
733
|
+
super().__init__(text, parent)
|
|
734
|
+
self.originalText = text
|
|
735
|
+
|
|
736
|
+
def focusOutEvent(self, event):
|
|
737
|
+
self.cancelEditing.emit()
|
|
738
|
+
super().focusOutEvent(event)
|
|
739
|
+
|
|
740
|
+
def keyPressEvent(self, event):
|
|
741
|
+
if event.key() == Qt.Key.Key_Escape:
|
|
742
|
+
self.cancelEditing.emit()
|
|
743
|
+
else:
|
|
744
|
+
super().keyPressEvent(event)
|
|
745
|
+
|
|
746
|
+
def keyReleaseEvent(self, event):
|
|
747
|
+
if event.key() == Qt.Key.Key_Escape:
|
|
748
|
+
self.cancelEditing.emit()
|
|
749
|
+
else:
|
|
750
|
+
super().keyReleaseEvent(event)
|
|
751
|
+
|
|
752
|
+
class ResizingLabel(QLabel):
|
|
753
|
+
def __init__(self,*args,**kwargs):
|
|
754
|
+
super().__init__(*args,**kwargs)
|
|
755
|
+
self.complete_text=self.text()
|
|
756
|
+
|
|
757
|
+
def setText(self,text):
|
|
758
|
+
self.complete_text=text
|
|
759
|
+
self.resizeText(text)
|
|
760
|
+
return
|
|
761
|
+
|
|
762
|
+
def resizeEvent(self, event: QResizeEvent) -> None:
|
|
763
|
+
super().resizeEvent(event)
|
|
764
|
+
self.resizeText(self.text())
|
|
765
|
+
return
|
|
766
|
+
|
|
767
|
+
def resizeText(self,text):
|
|
768
|
+
text=self.complete_text
|
|
769
|
+
metrics = QFontMetrics(self.font())
|
|
770
|
+
if self.alignment() & Qt.AlignmentFlag.AlignRight:
|
|
771
|
+
FlagRight=True
|
|
772
|
+
textElideMode=Qt.TextElideMode.ElideLeft
|
|
773
|
+
else:
|
|
774
|
+
FlagRight=False
|
|
775
|
+
textElideMode=Qt.TextElideMode.ElideRight
|
|
776
|
+
if "<span" in text:
|
|
777
|
+
match = re.search(r"<span(.*?)</span>", text)
|
|
778
|
+
html_part = "<span"+match.group(1)+"</span>"
|
|
779
|
+
index = match.start(1)-5
|
|
780
|
+
text_without_bullet=text.replace(html_part,'')
|
|
781
|
+
truncated_text=metrics.elidedText(text_without_bullet, textElideMode, self.width()-5)
|
|
782
|
+
if FlagRight:
|
|
783
|
+
index=len(truncated_text)-3*(int('...' in truncated_text))-len(text_without_bullet[index:])
|
|
784
|
+
if index>0:
|
|
785
|
+
truncated_text=truncated_text[:index]+html_part+truncated_text[index:]
|
|
786
|
+
elif index>len(truncated_text)-3:
|
|
787
|
+
truncated_text=truncated_text[:index]+html_part+truncated_text[index:]
|
|
788
|
+
else:
|
|
789
|
+
truncated_text = metrics.elidedText(text, textElideMode, self.width())
|
|
790
|
+
super().setText(truncated_text)
|
|
791
|
+
|
|
792
|
+
class EditableLabel(QWidget):
|
|
793
|
+
def __init__(self, parent=None):
|
|
794
|
+
super().__init__(parent)
|
|
795
|
+
|
|
796
|
+
self.main_layout = QVBoxLayout(self)
|
|
797
|
+
self.main_layout.setContentsMargins(0,0,0,0)
|
|
798
|
+
self.main_layout.setSpacing(0)
|
|
799
|
+
|
|
800
|
+
self.label = ResizingLabel(self)
|
|
801
|
+
self.label.setAlignment(Qt.AlignmentFlag.AlignLeft)
|
|
802
|
+
self.label.mouseDoubleClickEvent = self.enable_editing
|
|
803
|
+
|
|
804
|
+
self.edit = CustomLineEdit(self)
|
|
805
|
+
self.edit.setAlignment(Qt.AlignmentFlag.AlignLeft)
|
|
806
|
+
self.edit.hide()
|
|
807
|
+
self.edit.editingFinished.connect(self.disable_editing)
|
|
808
|
+
self.edit.cancelEditing.connect(self.disable_editing)
|
|
809
|
+
self.updateLabel=lambda: None
|
|
810
|
+
self.bullet=''
|
|
811
|
+
|
|
812
|
+
self.installEventFilter(self) # Installare il filtro eventi
|
|
813
|
+
|
|
814
|
+
self.main_layout.addWidget(self.label)
|
|
815
|
+
self.main_layout.addWidget(self.edit)
|
|
816
|
+
|
|
817
|
+
def setText(self,text):
|
|
818
|
+
self.label.setText(text)
|
|
819
|
+
self.edit.setText(text)
|
|
820
|
+
|
|
821
|
+
def setFont(self,font:QFont):
|
|
822
|
+
self.label.setFont(font)
|
|
823
|
+
self.edit.setFont(font)
|
|
824
|
+
|
|
825
|
+
def enable_editing(self, event):
|
|
826
|
+
self.label.hide()
|
|
827
|
+
self.edit.setGeometry(self.label.geometry()) # Assicurati che l'editor prenda la posizione della label
|
|
828
|
+
self.edit.setText(self.label.text().replace(self.bullet,'')) # Assicurati che il testo corrente venga impostato nell'editor
|
|
829
|
+
self.edit.selectAll()
|
|
830
|
+
self.edit.show()
|
|
831
|
+
self.window().setFocus()
|
|
832
|
+
self.edit.setFocus()
|
|
833
|
+
|
|
834
|
+
def disable_editing(self):
|
|
835
|
+
self.edit.hide()
|
|
836
|
+
self.label.setText(self.edit.text())
|
|
837
|
+
self.label.show()
|
|
838
|
+
self.updateLabel()
|
|
839
|
+
|
|
840
|
+
|
|
841
|
+
#********************************************* Matplotlib
|
|
842
|
+
import io
|
|
843
|
+
import matplotlib as mpl
|
|
844
|
+
mpl.use('Qt5Agg')
|
|
845
|
+
import matplotlib.pyplot as pyplt
|
|
846
|
+
import matplotlib.image as mplimage
|
|
847
|
+
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg, NavigationToolbar2QT as NavigationToolbar
|
|
848
|
+
from matplotlib.figure import Figure as mplFigure
|
|
849
|
+
from mpl_toolkits.axes_grid1 import make_axes_locatable
|
|
850
|
+
|
|
851
|
+
import matplotlib.style as mplstyle
|
|
852
|
+
mplstyle.use('fast')
|
|
853
|
+
#mplstyle.use(['dark_background', 'ggplot', 'fast'])
|
|
854
|
+
|
|
855
|
+
class MplCanvas(FigureCanvasQTAgg):
|
|
856
|
+
def __init__(self, parent=None, width=8, height=8, dpi=100):
|
|
857
|
+
self.inp_width=width
|
|
858
|
+
self.inp_height=height
|
|
859
|
+
self.inp_dpi=dpi
|
|
860
|
+
self.fig = mplFigure(figsize=(width, height), dpi=dpi)
|
|
861
|
+
self.fig2=[]
|
|
862
|
+
self.axes = self.fig.gca() #self.fig.add_subplot(111)
|
|
863
|
+
self.addfuncrelease={}
|
|
864
|
+
mpl.rcParams["font.family"]=fontName
|
|
865
|
+
#mpl.rcParams["font.size"]=12
|
|
866
|
+
color_tuple=(0.95,0.95,0.95,0)
|
|
867
|
+
#clrgb=[int(i*255) for i in color_tuple]
|
|
868
|
+
self.fig.set_facecolor(color_tuple)
|
|
869
|
+
|
|
870
|
+
self.copyIcon=QIcon(icons_path+"copy.png")
|
|
871
|
+
self.openNewWindowIcon=QIcon(icons_path+"open_new_window.png")
|
|
872
|
+
self.scaleDownIcon=QIcon(icons_path+"scale_down.png")
|
|
873
|
+
self.scaleUpIcon=QIcon(icons_path+"scale_up.png")
|
|
874
|
+
self.scaleAllIcon=QIcon(icons_path+"scale_all.png")
|
|
875
|
+
self.showAllIcon=QIcon(icons_path+"show_all.png")
|
|
876
|
+
self.alignAllIcon=QIcon(icons_path+"align_all.png")
|
|
877
|
+
self.closeAllIcon=QIcon(icons_path+"close_all.png")
|
|
878
|
+
self.loadImageIcon=QIcon(icons_path+"open_image.png")
|
|
879
|
+
self.loadResultIcon=QIcon(icons_path+"open_result.png")
|
|
880
|
+
|
|
881
|
+
super(MplCanvas, self).__init__(self.fig)
|
|
882
|
+
|
|
883
|
+
def mouseReleaseEvent(self, event):
|
|
884
|
+
super().mouseReleaseEvent(event)
|
|
885
|
+
if event.button() == Qt.LeftButton:
|
|
886
|
+
for f in self.addfuncrelease:
|
|
887
|
+
self.addfuncrelease[f]()
|
|
888
|
+
|
|
889
|
+
def copy2clipboard(self):
|
|
890
|
+
with io.BytesIO() as buffer:
|
|
891
|
+
self.fig.savefig(buffer)
|
|
892
|
+
QApplication.clipboard().setImage(QImage.fromData(buffer.getvalue()))
|
|
893
|
+
self.showTip(self,'Image copied to clipboard!')
|
|
894
|
+
|
|
895
|
+
def copy2newfig(self,text='Vis'):
|
|
896
|
+
fig2=QMainWindow()
|
|
897
|
+
fig2.setPalette(self.palette())
|
|
898
|
+
fig2.setWindowTitle(text)
|
|
899
|
+
fig2.setStyleSheet("background-color: white;")
|
|
900
|
+
|
|
901
|
+
wid=QWidget(fig2)
|
|
902
|
+
fig2.setCentralWidget(wid)
|
|
903
|
+
lay=QVBoxLayout(wid)
|
|
904
|
+
|
|
905
|
+
lbl=QLabel(fig2)
|
|
906
|
+
lbl.setAlignment(QtCore.Qt.AlignCenter)
|
|
907
|
+
with io.BytesIO() as buffer:
|
|
908
|
+
self.fig.savefig(buffer)
|
|
909
|
+
pixmap = QPixmap(QImage.fromData(buffer.getvalue()))
|
|
910
|
+
lbl.setPixmap(pixmap)
|
|
911
|
+
lbl.setScaledContents(False)
|
|
912
|
+
lbl2=QLabel(text,fig2)
|
|
913
|
+
lbl2.setWordWrap(True)
|
|
914
|
+
lbl2.setStyleSheet("color: black;")
|
|
915
|
+
|
|
916
|
+
lay.setSpacing(0)
|
|
917
|
+
lay.addWidget(lbl)
|
|
918
|
+
lay.addWidget(lbl2)
|
|
919
|
+
|
|
920
|
+
self.fig2.append(fig2)
|
|
921
|
+
|
|
922
|
+
def closeFig2(event):
|
|
923
|
+
type(fig2).closeEvent(fig2,event)
|
|
924
|
+
self.fig2.pop(self.fig2.index(fig2))
|
|
925
|
+
return
|
|
926
|
+
fig2.closeEvent=lambda event: closeFig2(event)
|
|
927
|
+
|
|
928
|
+
|
|
929
|
+
def fCopy2clipboard():
|
|
930
|
+
QApplication.clipboard().setImage(lbl.pixmap().toImage())
|
|
931
|
+
self.showTip(fig2,'Image copied to clipboard!')
|
|
932
|
+
return
|
|
933
|
+
|
|
934
|
+
fig2.scaleFactor=1
|
|
935
|
+
def resizeFig2(scale):
|
|
936
|
+
fig2.scaleFactor=fig2.scaleFactor*scale
|
|
937
|
+
fig2.scaleFactor=min([fig2.scaleFactor,1.5])
|
|
938
|
+
fig2.scaleFactor=max([fig2.scaleFactor,0.5])
|
|
939
|
+
fig2.setFixedSize(s0*fig2.scaleFactor)
|
|
940
|
+
lbl.setPixmap(pixmap.scaled(pixmap.size()*fig2.scaleFactor,mode=Qt.TransformationMode.SmoothTransformation))
|
|
941
|
+
return
|
|
942
|
+
fig2.resizeFig2=resizeFig2
|
|
943
|
+
|
|
944
|
+
sc0=QGuiApplication.primaryScreen().geometry()
|
|
945
|
+
def shiftFig2(dir):
|
|
946
|
+
dpix=10
|
|
947
|
+
geo=fig2.geometry()
|
|
948
|
+
if dir=='u':
|
|
949
|
+
geo.setY(max([geo.y()-dpix,sc0.y()]))
|
|
950
|
+
elif dir=='d':
|
|
951
|
+
geo.setY(min([geo.y()+dpix,sc0.y()+sc0.height()-fig2.height()]))
|
|
952
|
+
elif dir=='l':
|
|
953
|
+
geo.setX(max([geo.x()-dpix,sc0.x()]))
|
|
954
|
+
elif dir=='r':
|
|
955
|
+
geo.setX(min([geo.x()+dpix,sc0.x()+sc0.width()-fig2.width()]))
|
|
956
|
+
fig2.setGeometry(geo)
|
|
957
|
+
return
|
|
958
|
+
|
|
959
|
+
QS_down=QShortcut(QKeySequence('Down'), fig2)
|
|
960
|
+
QS_down.activated.connect(lambda: shiftFig2('d'))
|
|
961
|
+
QS_up=QShortcut(QKeySequence('Up'), fig2)
|
|
962
|
+
QS_up.activated.connect(lambda: shiftFig2('u'))
|
|
963
|
+
QS_right=QShortcut(QKeySequence('Right'), fig2)
|
|
964
|
+
QS_right.activated.connect(lambda: shiftFig2('r'))
|
|
965
|
+
QS_left=QShortcut(QKeySequence('Left'), fig2)
|
|
966
|
+
QS_left.activated.connect(lambda: shiftFig2('l'))
|
|
967
|
+
|
|
968
|
+
QS_copy2clipboard=QShortcut(QKeySequence('Ctrl+C'), fig2)
|
|
969
|
+
QS_copy2clipboard.activated.connect(fCopy2clipboard)
|
|
970
|
+
|
|
971
|
+
fScaleDown=lambda: resizeFig2(0.9)
|
|
972
|
+
QS_scaleDown=QShortcut(QKeySequence('Ctrl+Down'), fig2)
|
|
973
|
+
QS_scaleDown.activated.connect(fScaleDown)
|
|
974
|
+
fScaleUp=lambda: resizeFig2(1.1)
|
|
975
|
+
QS_scaleUp=QShortcut(QKeySequence('Ctrl+Up'), fig2)
|
|
976
|
+
QS_scaleUp.activated.connect(fScaleUp)
|
|
977
|
+
fScaleAll=lambda: self.scaleAll(fig2.scaleFactor)
|
|
978
|
+
QS_scaleAll=QShortcut(QKeySequence('Ctrl+Return'), fig2)
|
|
979
|
+
QS_scaleAll.activated.connect(fScaleAll)
|
|
980
|
+
|
|
981
|
+
QS_showAll=QShortcut(QKeySequence('Ctrl+S'), fig2)
|
|
982
|
+
QS_showAll.activated.connect(self.showAll)
|
|
983
|
+
QS_alignAll=QShortcut(QKeySequence('Ctrl+A'), fig2)
|
|
984
|
+
QS_alignAll.activated.connect(self.alignAll)
|
|
985
|
+
QS_closeAll=QShortcut(QKeySequence('Ctrl+X'), fig2)
|
|
986
|
+
QS_closeAll.activated.connect(self.closeAll)
|
|
987
|
+
|
|
988
|
+
fig2.lbl:QLabel=lbl
|
|
989
|
+
def contextMenuEventFig2(event):
|
|
990
|
+
contextMenu = QMenu()
|
|
991
|
+
copy2clipboard = contextMenu.addAction("Copy to clipboard ("+QS_copy2clipboard.key().toString(QKeySequence.NativeText)+")")
|
|
992
|
+
contextMenu.addSeparator()
|
|
993
|
+
scaleDown = contextMenu.addAction("Scale down ("+QS_scaleDown.key().toString(QKeySequence.NativeText)+")")
|
|
994
|
+
scaleUp = contextMenu.addAction("Scale up ("+QS_scaleUp.key().toString(QKeySequence.NativeText)+")")
|
|
995
|
+
scaleAll = contextMenu.addAction("Scale all ("+QS_scaleAll.key().toString(QKeySequence.NativeText)+")")
|
|
996
|
+
contextMenu.addSeparator()
|
|
997
|
+
showAll = contextMenu.addAction("Show all ("+QS_showAll.key().toString(QKeySequence.NativeText)+")")
|
|
998
|
+
alignAll = contextMenu.addAction("Align all ("+QS_alignAll.key().toString(QKeySequence.NativeText)+")")
|
|
999
|
+
closeAll = contextMenu.addAction("Close all ("+QS_closeAll.key().toString(QKeySequence.NativeText)+")")
|
|
1000
|
+
|
|
1001
|
+
copy2clipboard.setIcon(self.copyIcon)
|
|
1002
|
+
scaleDown.setIcon(self.scaleDownIcon)
|
|
1003
|
+
scaleUp.setIcon(self.scaleUpIcon)
|
|
1004
|
+
scaleAll.setIcon(self.scaleAllIcon)
|
|
1005
|
+
showAll.setIcon(self.showAllIcon)
|
|
1006
|
+
alignAll.setIcon(self.alignAllIcon)
|
|
1007
|
+
closeAll.setIcon(self.closeAllIcon)
|
|
1008
|
+
|
|
1009
|
+
action = contextMenu.exec(fig2.mapToGlobal(event.pos()))
|
|
1010
|
+
|
|
1011
|
+
if action == copy2clipboard:
|
|
1012
|
+
fCopy2clipboard()
|
|
1013
|
+
elif action == scaleDown:
|
|
1014
|
+
fScaleDown()
|
|
1015
|
+
elif action == scaleUp:
|
|
1016
|
+
fScaleUp()
|
|
1017
|
+
elif action == scaleAll:
|
|
1018
|
+
self.scaleAll(fig2.scaleFactor)
|
|
1019
|
+
elif action == showAll:
|
|
1020
|
+
self.showAll()
|
|
1021
|
+
elif action == alignAll:
|
|
1022
|
+
self.alignAll()
|
|
1023
|
+
elif action == closeAll:
|
|
1024
|
+
self.closeAll()
|
|
1025
|
+
|
|
1026
|
+
|
|
1027
|
+
fig2.contextMenuEvent=lambda event: contextMenuEventFig2(event)
|
|
1028
|
+
|
|
1029
|
+
fig2.show()
|
|
1030
|
+
fig2.setFixedSize(fig2.width(), fig2.height())
|
|
1031
|
+
s0=fig2.size()
|
|
1032
|
+
|
|
1033
|
+
self.posWindow(len(self.fig2)-1)
|
|
1034
|
+
"""
|
|
1035
|
+
fgeo = fig2.frameGeometry()
|
|
1036
|
+
centerPoint = QGuiApplication.primaryScreen().availableGeometry().center()
|
|
1037
|
+
fgeo.moveCenter(centerPoint)
|
|
1038
|
+
fig2.move(fgeo.topLeft())
|
|
1039
|
+
"""
|
|
1040
|
+
|
|
1041
|
+
def showTip(self,obj,message):
|
|
1042
|
+
showTip(obj,message)
|
|
1043
|
+
|
|
1044
|
+
def posWindow(self,ind):
|
|
1045
|
+
w=h=0
|
|
1046
|
+
for f in self.fig2:
|
|
1047
|
+
f:QMainWindow
|
|
1048
|
+
w=max([w,f.frameGeometry().width()])
|
|
1049
|
+
h=max([h,f.frameGeometry().height()])
|
|
1050
|
+
geoS=QGuiApplication.primaryScreen().availableGeometry()
|
|
1051
|
+
ncol=int(geoS.width()/w)
|
|
1052
|
+
nrow=int(geoS.height()/h)
|
|
1053
|
+
ntot=ncol*nrow
|
|
1054
|
+
if ind<0: ind=range(len(self.fig2))
|
|
1055
|
+
else: ind=[ind]
|
|
1056
|
+
for kk in ind:
|
|
1057
|
+
k=kk%ntot
|
|
1058
|
+
k=kk
|
|
1059
|
+
i=int(k/ncol)
|
|
1060
|
+
j=k-i*ncol
|
|
1061
|
+
f=self.fig2[kk]
|
|
1062
|
+
fg=f.frameGeometry()
|
|
1063
|
+
fg.moveTopLeft(QPoint(j*w,i*h))
|
|
1064
|
+
f.move(fg.topLeft())
|
|
1065
|
+
|
|
1066
|
+
def scaleAll(self,scale):
|
|
1067
|
+
for f in self.fig2:
|
|
1068
|
+
f:QMainWindow
|
|
1069
|
+
f.scaleFactor=scale
|
|
1070
|
+
f.resizeFig2(1.0)
|
|
1071
|
+
|
|
1072
|
+
def showAll(self):
|
|
1073
|
+
for f in self.fig2:
|
|
1074
|
+
f:QMainWindow
|
|
1075
|
+
f.hide()
|
|
1076
|
+
f.show()
|
|
1077
|
+
|
|
1078
|
+
def closeAll(self):
|
|
1079
|
+
for f in range(len(self.fig2)):
|
|
1080
|
+
f:QMainWindow
|
|
1081
|
+
f=self.fig2[0]
|
|
1082
|
+
f.close()
|
|
1083
|
+
self.fig2=[]
|
|
1084
|
+
|
|
1085
|
+
def alignAll(self):
|
|
1086
|
+
self.posWindow(-1)
|
|
1087
|
+
self.showAll()
|
|
1088
|
+
|
|
1089
|
+
|
|
1090
|
+
def setAppGuiPalette(self:QWidget,palette:QPalette=None):
|
|
1091
|
+
applic:QApplication
|
|
1092
|
+
if hasattr(self,'app'):
|
|
1093
|
+
applic=self.app
|
|
1094
|
+
else:
|
|
1095
|
+
return
|
|
1096
|
+
if palette==None:
|
|
1097
|
+
palette=applic.style().standardPalette()
|
|
1098
|
+
else:
|
|
1099
|
+
applic.setPalette(palette)
|
|
1100
|
+
|
|
1101
|
+
try:
|
|
1102
|
+
if self.focusWidget():
|
|
1103
|
+
self.focusWidget().clearFocus()
|
|
1104
|
+
widgets=[self]
|
|
1105
|
+
if hasattr(self,'FloatingTabs'): widgets+=self.FloatingTabs
|
|
1106
|
+
if hasattr(self,'FloatingWindows'): widgets+=self.FloatingWindows
|
|
1107
|
+
if hasattr(self,'aboutDialog'): widgets.append(self.aboutDialog)
|
|
1108
|
+
if hasattr(self,'logChanges'): widgets.append(self.logChanges)
|
|
1109
|
+
widgets+=self.findChildren(QDialog)
|
|
1110
|
+
for f in widgets:
|
|
1111
|
+
if f and isinstance(f, QWidget):
|
|
1112
|
+
f.setPalette(palette)
|
|
1113
|
+
for c in f.findChildren(QObject):
|
|
1114
|
+
if hasattr(c,'setPalette') and not isinstance(c, (MplCanvas, mplFigure, QStatusBar)):
|
|
1115
|
+
c.setPalette(palette)
|
|
1116
|
+
if hasattr(c,'initialStyle') and hasattr(c, 'setStyleSheet'):
|
|
1117
|
+
c.setStyleSheet(c.initialStyle)
|
|
1118
|
+
for c in f.findChildren(QObject):
|
|
1119
|
+
c:MyQLineEdit
|
|
1120
|
+
if isinstance(c, MyQLineEdit) and hasattr(c, 'setup'):
|
|
1121
|
+
c.initFlag=False
|
|
1122
|
+
c.styleFlag=False
|
|
1123
|
+
c.setup()
|
|
1124
|
+
for c in f.findChildren(QObject):
|
|
1125
|
+
if hasattr(c,'setup2'):
|
|
1126
|
+
c.initFlag2=False
|
|
1127
|
+
c.setup2()
|
|
1128
|
+
if hasattr(self,'ResizePopup'):
|
|
1129
|
+
if self.ResizePopup is not None:
|
|
1130
|
+
self.ResizePopup=type(self.ResizePopup)(self.buttonSizeCallbacks) #non riesco a farlo come gli altri
|
|
1131
|
+
if hasattr(self,'w_Vis'): self.w_Vis.addPlotToolBar()
|
|
1132
|
+
except:
|
|
1133
|
+
pri.Error.red("***** Error while setting the application palette! *****")
|