PaIRS-UniNa 0.2.5__cp313-cp313-win_amd64.whl

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