PaIRS-UniNa 0.1.13__cp310-cp310-win_amd64.whl → 0.2.8__cp310-cp310-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (292) hide show
  1. PaIRS_UniNa/Calibration_Tab.py +331 -0
  2. PaIRS_UniNa/Changes.txt +134 -2
  3. PaIRS_UniNa/Custom_Top.py +299 -299
  4. PaIRS_UniNa/Explorer.py +3136 -0
  5. PaIRS_UniNa/FolderLoop.py +562 -0
  6. PaIRS_UniNa/Input_Tab.py +831 -0
  7. PaIRS_UniNa/Input_Tab_CalVi.py +786 -0
  8. PaIRS_UniNa/Input_Tab_tools.py +3025 -0
  9. PaIRS_UniNa/Log_Tab.py +57 -14
  10. PaIRS_UniNa/Output_Tab.py +922 -0
  11. PaIRS_UniNa/PaIRS_PIV.py +111 -18
  12. PaIRS_UniNa/PaIRS_pypacks.py +698 -140
  13. PaIRS_UniNa/Process_Tab.py +1221 -1402
  14. PaIRS_UniNa/Process_Tab_CalVi.py +137 -262
  15. PaIRS_UniNa/Process_Tab_Disp.py +163 -0
  16. PaIRS_UniNa/Process_Tab_Min.py +120 -0
  17. PaIRS_UniNa/Saving_tools.py +296 -0
  18. PaIRS_UniNa/TabTools.py +863 -543
  19. PaIRS_UniNa/Vis_Tab.py +1898 -1315
  20. PaIRS_UniNa/Vis_Tab_CalVi.py +484 -356
  21. PaIRS_UniNa/Whatsnew.py +59 -10
  22. PaIRS_UniNa/_PaIRS_PIV.pyd +0 -0
  23. PaIRS_UniNa/__init__.py +4 -3
  24. PaIRS_UniNa/addwidgets_ps.py +326 -56
  25. PaIRS_UniNa/calib.py +19 -12
  26. PaIRS_UniNa/calibView.py +48 -25
  27. PaIRS_UniNa/gPaIRS.py +3902 -3461
  28. PaIRS_UniNa/gPalette.py +189 -170
  29. PaIRS_UniNa/icons/align_all.png +0 -0
  30. PaIRS_UniNa/icons/announcement.png +0 -0
  31. PaIRS_UniNa/icons/automatic_levels_off.png +0 -0
  32. PaIRS_UniNa/icons/automatic_levels_on.png +0 -0
  33. PaIRS_UniNa/icons/automatic_off.png +0 -0
  34. PaIRS_UniNa/icons/automatic_on.png +0 -0
  35. PaIRS_UniNa/icons/automatic_size_off.png +0 -0
  36. PaIRS_UniNa/icons/automatic_size_on.png +0 -0
  37. PaIRS_UniNa/icons/bin_off.png +0 -0
  38. PaIRS_UniNa/icons/bin_on.png +0 -0
  39. PaIRS_UniNa/icons/brush_cursor.png +0 -0
  40. PaIRS_UniNa/icons/bugfix.png +0 -0
  41. PaIRS_UniNa/icons/cal_proc.png +0 -0
  42. PaIRS_UniNa/icons/cal_proc_off.png +0 -0
  43. PaIRS_UniNa/icons/cal_step.png +0 -0
  44. PaIRS_UniNa/icons/cal_step_off.png +0 -0
  45. PaIRS_UniNa/icons/calibration_logo.png +0 -0
  46. PaIRS_UniNa/icons/change_folder.png +0 -0
  47. PaIRS_UniNa/icons/change_folder_off.png +0 -0
  48. PaIRS_UniNa/icons/close_all.png +0 -0
  49. PaIRS_UniNa/icons/close_workspace.png +0 -0
  50. PaIRS_UniNa/icons/colormap.png +0 -0
  51. PaIRS_UniNa/icons/colormaps/Accent.png +0 -0
  52. PaIRS_UniNa/icons/colormaps/BrBG.png +0 -0
  53. PaIRS_UniNa/icons/colormaps/Dark2.png +0 -0
  54. PaIRS_UniNa/icons/colormaps/PRGn.png +0 -0
  55. PaIRS_UniNa/icons/colormaps/Paired.png +0 -0
  56. PaIRS_UniNa/icons/colormaps/Pastel1.png +0 -0
  57. PaIRS_UniNa/icons/colormaps/Pastel2.png +0 -0
  58. PaIRS_UniNa/icons/colormaps/PiYG.png +0 -0
  59. PaIRS_UniNa/icons/colormaps/PuOr.png +0 -0
  60. PaIRS_UniNa/icons/colormaps/RdBu.png +0 -0
  61. PaIRS_UniNa/icons/colormaps/RdGy.png +0 -0
  62. PaIRS_UniNa/icons/colormaps/RdYlBu.png +0 -0
  63. PaIRS_UniNa/icons/colormaps/RdYlGn.png +0 -0
  64. PaIRS_UniNa/icons/colormaps/Set1.png +0 -0
  65. PaIRS_UniNa/icons/colormaps/Set2.png +0 -0
  66. PaIRS_UniNa/icons/colormaps/Set3.png +0 -0
  67. PaIRS_UniNa/icons/colormaps/Spectral.png +0 -0
  68. PaIRS_UniNa/icons/colormaps/Wistia.png +0 -0
  69. PaIRS_UniNa/icons/colormaps/afmhot.png +0 -0
  70. PaIRS_UniNa/icons/colormaps/autumn.png +0 -0
  71. PaIRS_UniNa/icons/colormaps/binary.png +0 -0
  72. PaIRS_UniNa/icons/colormaps/blackVector.png +0 -0
  73. PaIRS_UniNa/icons/colormaps/blueVector.png +0 -0
  74. PaIRS_UniNa/icons/colormaps/bone.png +0 -0
  75. PaIRS_UniNa/icons/colormaps/brg.png +0 -0
  76. PaIRS_UniNa/icons/colormaps/bwr.png +0 -0
  77. PaIRS_UniNa/icons/colormaps/cividis.png +0 -0
  78. PaIRS_UniNa/icons/colormaps/cool.png +0 -0
  79. PaIRS_UniNa/icons/colormaps/coolwarm.png +0 -0
  80. PaIRS_UniNa/icons/colormaps/copper.png +0 -0
  81. PaIRS_UniNa/icons/colormaps/cubehelix.png +0 -0
  82. PaIRS_UniNa/icons/colormaps/cyanVector.png +0 -0
  83. PaIRS_UniNa/icons/colormaps/flag.png +0 -0
  84. PaIRS_UniNa/icons/colormaps/gist_heat.png +0 -0
  85. PaIRS_UniNa/icons/colormaps/gray.png +0 -0
  86. PaIRS_UniNa/icons/colormaps/greenVector.png +0 -0
  87. PaIRS_UniNa/icons/colormaps/hot.png +0 -0
  88. PaIRS_UniNa/icons/colormaps/hsv.png +0 -0
  89. PaIRS_UniNa/icons/colormaps/inferno.png +0 -0
  90. PaIRS_UniNa/icons/colormaps/jet.png +0 -0
  91. PaIRS_UniNa/icons/colormaps/magentaVector.png +0 -0
  92. PaIRS_UniNa/icons/colormaps/magma.png +0 -0
  93. PaIRS_UniNa/icons/colormaps/ocean.png +0 -0
  94. PaIRS_UniNa/icons/colormaps/pink.png +0 -0
  95. PaIRS_UniNa/icons/colormaps/plasma.png +0 -0
  96. PaIRS_UniNa/icons/colormaps/prism.png +0 -0
  97. PaIRS_UniNa/icons/colormaps/rainbow.png +0 -0
  98. PaIRS_UniNa/icons/colormaps/redVector.png +0 -0
  99. PaIRS_UniNa/icons/colormaps/seismic.png +0 -0
  100. PaIRS_UniNa/icons/colormaps/spring.png +0 -0
  101. PaIRS_UniNa/icons/colormaps/summer.png +0 -0
  102. PaIRS_UniNa/icons/colormaps/tab10.png +0 -0
  103. PaIRS_UniNa/icons/colormaps/tab20.png +0 -0
  104. PaIRS_UniNa/icons/colormaps/tab20b.png +0 -0
  105. PaIRS_UniNa/icons/colormaps/tab20c.png +0 -0
  106. PaIRS_UniNa/icons/colormaps/terrain.png +0 -0
  107. PaIRS_UniNa/icons/colormaps/twilight.png +0 -0
  108. PaIRS_UniNa/icons/colormaps/viridis.png +0 -0
  109. PaIRS_UniNa/icons/colormaps/whiteVector.png +0 -0
  110. PaIRS_UniNa/icons/colormaps/winter.png +0 -0
  111. PaIRS_UniNa/icons/colormaps/yellowVector.png +0 -0
  112. PaIRS_UniNa/icons/common_region.png +0 -0
  113. PaIRS_UniNa/icons/common_region_off.png +0 -0
  114. PaIRS_UniNa/icons/completed.png +0 -0
  115. PaIRS_UniNa/icons/contourf_off.png +0 -0
  116. PaIRS_UniNa/icons/contourf_on.png +0 -0
  117. PaIRS_UniNa/icons/copy.png +0 -0
  118. PaIRS_UniNa/icons/copy_process.png +0 -0
  119. PaIRS_UniNa/icons/copy_process_off.png +0 -0
  120. PaIRS_UniNa/icons/cut.png +0 -0
  121. PaIRS_UniNa/icons/cut_warnings.png +0 -0
  122. PaIRS_UniNa/icons/darkmode.png +0 -0
  123. PaIRS_UniNa/icons/disp_step.png +0 -0
  124. PaIRS_UniNa/icons/disp_step_off.png +0 -0
  125. PaIRS_UniNa/icons/edit_list.png +0 -0
  126. PaIRS_UniNa/icons/example_list.png +0 -0
  127. PaIRS_UniNa/icons/flaticon_PaIRS_beta.png +0 -0
  128. PaIRS_UniNa/icons/flaticon_PaIRS_download_warning.png +0 -0
  129. PaIRS_UniNa/icons/flip_y_off.png +0 -0
  130. PaIRS_UniNa/icons/flip_y_on.png +0 -0
  131. PaIRS_UniNa/icons/folder_loop_cleanup.png +0 -0
  132. PaIRS_UniNa/icons/folder_loop_cleanup_off.png +0 -0
  133. PaIRS_UniNa/icons/gear.gif +0 -0
  134. PaIRS_UniNa/icons/gear.png +0 -0
  135. PaIRS_UniNa/icons/import_set.png +0 -0
  136. PaIRS_UniNa/icons/information.png +0 -0
  137. PaIRS_UniNa/icons/input_logo.png +0 -0
  138. PaIRS_UniNa/icons/issue.png +0 -0
  139. PaIRS_UniNa/icons/laser_NTR.png +0 -0
  140. PaIRS_UniNa/icons/laser_TR_double.png +0 -0
  141. PaIRS_UniNa/icons/laser_TR_single.png +0 -0
  142. PaIRS_UniNa/icons/link.png +0 -0
  143. PaIRS_UniNa/icons/linked.png +0 -0
  144. PaIRS_UniNa/icons/log_logo.png +0 -0
  145. PaIRS_UniNa/icons/logo_opaco.png +0 -0
  146. PaIRS_UniNa/icons/measure.png +0 -0
  147. PaIRS_UniNa/icons/measure_off.png +0 -0
  148. PaIRS_UniNa/icons/min_proc.png +0 -0
  149. PaIRS_UniNa/icons/min_proc_off.png +0 -0
  150. PaIRS_UniNa/icons/min_step.png +0 -0
  151. PaIRS_UniNa/icons/min_step_off.png +0 -0
  152. PaIRS_UniNa/icons/new_workspace.png +0 -0
  153. PaIRS_UniNa/icons/open_image.png +0 -0
  154. PaIRS_UniNa/icons/open_new_window.png +0 -0
  155. PaIRS_UniNa/icons/open_result.png +0 -0
  156. PaIRS_UniNa/icons/open_workspace.png +0 -0
  157. PaIRS_UniNa/icons/output_logo.png +0 -0
  158. PaIRS_UniNa/icons/paste_above.png +0 -0
  159. PaIRS_UniNa/icons/paste_below.png +0 -0
  160. PaIRS_UniNa/icons/paused.png +0 -0
  161. PaIRS_UniNa/icons/piv_proc.png +0 -0
  162. PaIRS_UniNa/icons/piv_proc_off.png +0 -0
  163. PaIRS_UniNa/icons/piv_step.png +0 -0
  164. PaIRS_UniNa/icons/piv_step_off.png +0 -0
  165. PaIRS_UniNa/icons/process_logo.png +0 -0
  166. PaIRS_UniNa/icons/process_loop.png +0 -0
  167. PaIRS_UniNa/icons/project.png +0 -0
  168. PaIRS_UniNa/icons/pylog.png +0 -0
  169. PaIRS_UniNa/icons/python_warning.png +0 -0
  170. PaIRS_UniNa/icons/queue.png +0 -0
  171. PaIRS_UniNa/icons/read.png +0 -0
  172. PaIRS_UniNa/icons/read_list.png +0 -0
  173. PaIRS_UniNa/icons/reset.png +0 -0
  174. PaIRS_UniNa/icons/reset_levels.png +0 -0
  175. PaIRS_UniNa/icons/restore_undo.png +0 -0
  176. PaIRS_UniNa/icons/running.gif +0 -0
  177. PaIRS_UniNa/icons/running.png +0 -0
  178. PaIRS_UniNa/icons/running_warn.png +0 -0
  179. PaIRS_UniNa/icons/save_and_stop.png +0 -0
  180. PaIRS_UniNa/icons/save_cfg.png +0 -0
  181. PaIRS_UniNa/icons/saveas_workspace.png +0 -0
  182. PaIRS_UniNa/icons/scale_all.png +0 -0
  183. PaIRS_UniNa/icons/scale_down.png +0 -0
  184. PaIRS_UniNa/icons/scale_up.png +0 -0
  185. PaIRS_UniNa/icons/scan_list.png +0 -0
  186. PaIRS_UniNa/icons/scan_path.png +0 -0
  187. PaIRS_UniNa/icons/scan_path_loop.png +0 -0
  188. PaIRS_UniNa/icons/scan_path_loop_off.png +0 -0
  189. PaIRS_UniNa/icons/search.png +0 -0
  190. PaIRS_UniNa/icons/showIW_off.png +0 -0
  191. PaIRS_UniNa/icons/showIW_on.png +0 -0
  192. PaIRS_UniNa/icons/show_all.png +0 -0
  193. PaIRS_UniNa/icons/sort.png +0 -0
  194. PaIRS_UniNa/icons/sort_reversed.png +0 -0
  195. PaIRS_UniNa/icons/spiv_proc.png +0 -0
  196. PaIRS_UniNa/icons/spiv_proc_off.png +0 -0
  197. PaIRS_UniNa/icons/star.png +0 -0
  198. PaIRS_UniNa/icons/step_inheritance.png +0 -0
  199. PaIRS_UniNa/icons/subMIN_off.png +0 -0
  200. PaIRS_UniNa/icons/subMIN_on.png +0 -0
  201. PaIRS_UniNa/icons/unedited.png +0 -0
  202. PaIRS_UniNa/icons/uninitialized.png +0 -0
  203. PaIRS_UniNa/icons/unlink.png +0 -0
  204. PaIRS_UniNa/icons/unwrap_items.png +0 -0
  205. PaIRS_UniNa/icons/vectorColor.png +0 -0
  206. PaIRS_UniNa/icons/view.png +0 -0
  207. PaIRS_UniNa/icons/view_off.png +0 -0
  208. PaIRS_UniNa/icons/vis_logo.png +0 -0
  209. PaIRS_UniNa/icons/warning_circle.png +0 -0
  210. PaIRS_UniNa/icons/window.png +0 -0
  211. PaIRS_UniNa/icons/workspace.png +0 -0
  212. PaIRS_UniNa/icons/wrap_items.png +0 -0
  213. PaIRS_UniNa/icons/write_list.png +0 -0
  214. PaIRS_UniNa/listLib.py +303 -0
  215. PaIRS_UniNa/mtfPIV.py +8 -8
  216. PaIRS_UniNa/parForMulti.py +7 -5
  217. PaIRS_UniNa/parForWorkers.py +370 -31
  218. PaIRS_UniNa/pivParFor.py +233 -229
  219. PaIRS_UniNa/plt_util.py +141 -141
  220. PaIRS_UniNa/preProcParFor.py +153 -148
  221. PaIRS_UniNa/procTools.py +631 -178
  222. PaIRS_UniNa/readcfg.py +31 -1
  223. PaIRS_UniNa/rqrdpckgs.txt +9 -0
  224. PaIRS_UniNa/stereoPivParFor.py +227 -0
  225. PaIRS_UniNa/tAVarie.py +215 -215
  226. PaIRS_UniNa/tabSplitter.py +612 -0
  227. PaIRS_UniNa/ui_Calibration_Tab.py +545 -0
  228. PaIRS_UniNa/ui_Custom_Top.py +5 -5
  229. PaIRS_UniNa/ui_Input_Tab.py +1101 -0
  230. PaIRS_UniNa/{ui_Import_Tab_CalVi.py → ui_Input_Tab_CalVi.py} +1282 -1275
  231. PaIRS_UniNa/ui_Log_Tab.py +262 -257
  232. PaIRS_UniNa/{ui_Export_Tab.py → ui_Output_Tab.py} +2361 -1778
  233. PaIRS_UniNa/ui_Process_Tab.py +3809 -3758
  234. PaIRS_UniNa/ui_Process_Tab_CalVi.py +1547 -1546
  235. PaIRS_UniNa/ui_Process_Tab_Disp.py +1141 -0
  236. PaIRS_UniNa/ui_Process_Tab_Min.py +437 -0
  237. PaIRS_UniNa/ui_Vis_Tab.py +1626 -1208
  238. PaIRS_UniNa/ui_Vis_Tab_CalVi.py +1249 -1249
  239. PaIRS_UniNa/ui_Whatsnew.py +131 -131
  240. PaIRS_UniNa/ui_gPairs.py +876 -950
  241. PaIRS_UniNa/ui_infoPaIRS.py +550 -425
  242. PaIRS_UniNa/whatsnew.txt +6 -4
  243. {PaIRS_UniNa-0.1.13.dist-info → pairs_unina-0.2.8.dist-info}/METADATA +69 -51
  244. pairs_unina-0.2.8.dist-info/RECORD +329 -0
  245. {PaIRS_UniNa-0.1.13.dist-info → pairs_unina-0.2.8.dist-info}/WHEEL +1 -1
  246. PaIRS_UniNa/CalVi.py +0 -18
  247. PaIRS_UniNa/Export_Tab.py +0 -574
  248. PaIRS_UniNa/Import_Tab.py +0 -657
  249. PaIRS_UniNa/Import_Tab_CalVi.py +0 -861
  250. PaIRS_UniNa/Import_Tab_tools.py +0 -598
  251. PaIRS_UniNa/Tree_Tab.py +0 -543
  252. PaIRS_UniNa/gCalVi.py +0 -2024
  253. PaIRS_UniNa/icons/add.png +0 -0
  254. PaIRS_UniNa/icons/cancelled.png +0 -0
  255. PaIRS_UniNa/icons/chain.png +0 -0
  256. PaIRS_UniNa/icons/chain_broken.png +0 -0
  257. PaIRS_UniNa/icons/default_sizes.png +0 -0
  258. PaIRS_UniNa/icons/dock_tabs.png +0 -0
  259. PaIRS_UniNa/icons/done.png +0 -0
  260. PaIRS_UniNa/icons/down_arrow.png +0 -0
  261. PaIRS_UniNa/icons/export_logo.png +0 -0
  262. PaIRS_UniNa/icons/fast_delete.png +0 -0
  263. PaIRS_UniNa/icons/flip_y.png +0 -0
  264. PaIRS_UniNa/icons/ganci.png +0 -0
  265. PaIRS_UniNa/icons/import_blue.png +0 -0
  266. PaIRS_UniNa/icons/import_logo.png +0 -0
  267. PaIRS_UniNa/icons/missing.png +0 -0
  268. PaIRS_UniNa/icons/process_icon.png +0 -0
  269. PaIRS_UniNa/icons/processing.png +0 -0
  270. PaIRS_UniNa/icons/restart.png +0 -0
  271. PaIRS_UniNa/icons/right_arrow.png +0 -0
  272. PaIRS_UniNa/icons/run_piv.png +0 -0
  273. PaIRS_UniNa/icons/terminal.png +0 -0
  274. PaIRS_UniNa/icons/undock_tabs.png +0 -0
  275. PaIRS_UniNa/icons/vect_field.png +0 -0
  276. PaIRS_UniNa/icons/w0.png +0 -0
  277. PaIRS_UniNa/icons/w1.png +0 -0
  278. PaIRS_UniNa/icons/w2.png +0 -0
  279. PaIRS_UniNa/icons/w3.png +0 -0
  280. PaIRS_UniNa/icons/w4.png +0 -0
  281. PaIRS_UniNa/icons/w5.png +0 -0
  282. PaIRS_UniNa/run_CalVi.py +0 -14
  283. PaIRS_UniNa/run_gcalvi.py +0 -5
  284. PaIRS_UniNa/ui_Import_Tab.py +0 -1077
  285. PaIRS_UniNa/ui_Tree_Tab.py +0 -684
  286. PaIRS_UniNa/ui_gCalVi.py +0 -640
  287. PaIRS_UniNa/ui_infoCalVi.py +0 -428
  288. PaIRS_UniNa-0.1.13.dist-info/LICENSE +0 -19
  289. PaIRS_UniNa-0.1.13.dist-info/RECORD +0 -174
  290. /PaIRS_UniNa/icons/{clean_queue.png → clean.png} +0 -0
  291. /PaIRS_UniNa/icons/{waiting_c.png → sandglass.png} +0 -0
  292. {PaIRS_UniNa-0.1.13.dist-info → pairs_unina-0.2.8.dist-info}/top_level.txt +0 -0
PaIRS_UniNa/Custom_Top.py CHANGED
@@ -1,303 +1,303 @@
1
1
  from .PaIRS_pypacks import*
2
2
  from .ui_Custom_Top import *
3
3
  from .TabTools import *
4
- if __name__ == "__main__":
5
- from .Process_Tab import PROpar
6
-
7
-
8
- class Custom_Top(QDialog):
9
-
10
- def __init__(self,custom_list=None):
11
- super().__init__()
12
- ui=Ui_Custom_Top()
13
- ui.setupUi(self)
14
- self.ui=ui
15
- setupWid(self)
16
- self.itemSize=QSize(500,20)
17
- ui.tree.FlagArrowKeysNormal=True
18
-
19
- self.custom_list_file=pro_path+custom_list_file
20
-
21
- self.queue=[]
22
- ui.tree.clear()
23
- if custom_list==None:
24
- self.custom_list=[os.path.basename(f)[:-10] for f in glob.glob(pro_path+outExt.pro)]
25
- else:
26
- self.custom_list=custom_list
27
- self.custom_list=setCustomList(lambda var,name: self.createItemInTree(ui.tree,self.queue,name,name,QIcon()))
28
- self.deleted=[]
29
- self.added=[]
30
-
31
- self.setupCallbacks()
32
- self.FlagAdjusting=False
33
- self.setButtons()
34
-
35
- def setupCallbacks(self):
36
- self.ui.tree.itemSelectionChanged.connect(self.setButtons)
37
- self.ui.tree.itemChanged.connect(self.adjustText)
38
-
39
- button_up_callback=lambda: self.moveupdown(-1)
40
- button_down_callback=lambda: self.moveupdown(+1)
41
- self.ui.button_up.clicked.connect(button_up_callback)
42
- self.ui.button_down.clicked.connect(button_down_callback)
43
- self.ui.button_edit.clicked.connect(self.editItem)
44
- self.ui.button_undo.clicked.connect(self.undo)
45
- self.ui.button_restore.clicked.connect(self.restoreItem)
46
- self.ui.button_delete.clicked.connect(self.removeItem)
47
- self.ui.button_import.clicked.connect(self.loadPastProc)
48
-
49
- self.ui.button_done.clicked.connect(self.save_and_close)
50
- self.ui.button_cancel.clicked.connect(lambda: self.done(0))
51
-
52
- def moveupdown(self,d):
53
- tree: QTreeWidget
54
- tree=self.ui.tree
55
- queue=self.queue
56
- item=tree.currentItem()
57
- indItem=tree.indexOfTopLevelItem(item)
58
- tree.takeTopLevelItem(indItem)
59
- tree.insertTopLevelItem(indItem+d,item)
60
- queue.insert(indItem+d,queue.pop(indItem))
61
- self.custom_list.insert(indItem+d,self.custom_list.pop(indItem))
62
-
63
- tree.setCurrentItem(item)
64
- self.setButtons()
65
-
66
- def createItemInTree(self,tree,queue,name,idata,icon):
67
- currentItem=QTreeWidgetItem(tree)
68
- tree.addTopLevelItem(currentItem)
69
- tree.setCurrentItem(currentItem)
70
- queue.append(currentItem)
71
- currentItem.setText(0,name)
72
- currentItem.setSizeHint(0,self.itemSize)
73
- currentItem.setIcon(0,icon)
74
- currentItem.setToolTip(0,name)
75
- currentItem.setStatusTip(0,name)
76
- currentItem.setFlags(currentItem.flags() | Qt.ItemIsEditable)
77
- currentItem.setData(0,Qt.UserRole,idata)
78
- return currentItem
79
-
80
- def setButtons(self,*args):
81
- tree: QTreeWidget
82
- tree=self.ui.tree
83
- if len(args):
84
- item=args[0]
85
- i=tree.indexFromItem(item)
86
- c=args[1]
87
- else:
88
- i=tree.currentIndex().row()
89
- item=tree.currentItem()
90
- c=0
91
- if item==None:
92
- self.ui.button_down.setEnabled(False)
93
- self.ui.button_up.setEnabled(False)
94
- self.ui.button_undo.setVisible(False)
95
- self.ui.button_delete.setVisible(False)
96
- self.ui.button_edit.setVisible(False)
97
- self.ui.button_restore.setVisible(False)
98
- return
99
- indItem=tree.indexOfTopLevelItem(tree.currentItem())
100
- isItemFirst=indItem==0
101
- isItemLast=indItem==tree.topLevelItemCount()-1
102
- self.ui.button_down.setEnabled(not isItemLast)
103
- self.ui.button_up.setEnabled(not isItemFirst)
104
- flagDeleted=item.font(c).strikeOut()
105
- self.ui.button_undo.setVisible(item.data(0,Qt.UserRole)!=item.text(0) and not flagDeleted)
106
- self.ui.button_delete.setVisible(not flagDeleted)
107
- self.ui.button_edit.setVisible(not flagDeleted)
108
- self.ui.button_restore.setVisible(flagDeleted)
109
-
110
- def editItem(self):
111
- item=self.ui.tree.currentItem()
112
- self.ui.tree.edit(self.ui.tree.indexFromItem(item))
113
-
114
- def adjustText(self):
115
- if self.FlagAdjusting: return
116
- self.FlagAdjusting=True
117
- item=self.ui.tree.currentItem()
118
- newName=item.text(0)
119
- for i in self.queue:
120
- if i==item: continue
121
- if i.data(0,Qt.UserRole)==newName:
122
- WarningMessage=f'The chosen name "{newName}" is already associated with a custom process. Please, indicate a different name!'
123
- warningDialog(self,WarningMessage)
124
- item.setText(0,item.data(0,Qt.UserRole))
125
- if item.data(0,Qt.UserRole) and item.data(0,Qt.UserRole)!=item.text(0):
126
- item.setIcon(0,self.ui.button_edit.icon())
127
- else:
128
- item.setIcon(0,QIcon())
129
- self.setButtons()
130
- self.FlagAdjusting=False
131
-
132
- def undo(self):
133
- self.FlagAdjusting=True
134
- item=self.ui.tree.currentItem()
135
- item.setText(0,item.data(0,Qt.UserRole))
136
- item.setIcon(0,QIcon())
137
- self.setButtons()
138
- self.FlagAdjusting=False
139
-
140
- def restoreItem(self):
141
- self.FlagAdjusting=True
142
- item=self.ui.tree.currentItem()
143
- f = item.font(0)
144
- f.setStrikeOut(False)
145
- item.setFont(0,f)
146
- item.setFlags(item.flags() | Qt.ItemIsEditable)
147
- self.deleted.pop(self.deleted.index(item))
148
- item.setData(0,Qt.UserRole,item.text(0))
149
- item.setIcon(0,QIcon())
150
- self.setButtons()
151
- self.FlagAdjusting=False
152
-
153
- def removeItem(self):
154
- self.FlagAdjusting=True
155
- item=self.ui.tree.currentItem()
156
- #item.setFlags(item.flags() | ~Qt.ItemIsEditable)
157
- f = item.font(0)
158
- f.setStrikeOut(True)
159
- item.setFont(0,f)
160
- item.setText(0,item.data(0,Qt.UserRole))
161
- item.setData(0,Qt.UserRole,'')
162
- item.setIcon(0,QIcon())
163
- item.setFlags(item.flags() & ~QtCore.Qt.ItemIsEditable)
164
- self.deleted.append(item)
165
- self.setButtons()
166
- self.FlagAdjusting=False
167
-
168
- def save_and_close(self):
169
- if len(self.deleted):
170
- WarningMessage="Some items were deleted from the list. The corresponding files will be removed from the disk. This operation is irreversible.\n"+\
171
- "Do you want to continue?"
172
- flag=questionDialog(self,WarningMessage)
173
- else:
174
- flag=True
175
- if flag:
176
- self.FlagAdjusting=True
177
- for item in self.deleted:
178
- self.deleteItem(item)
179
- i=self.queue.index(item)
180
- self.custom_list.pop(i)
181
- self.queue.pop(i)
182
- for item in self.queue:
183
- self.renameItem(item)
184
- self.custom_list[self.queue.index(item)]=item.text(0)
185
- self.saveCustomList()
186
- self.FlagAdjusting=False
187
- self.done(1)
188
-
189
- def deleteItem(self,item):
190
- filename=pro_path+item.text(0)+outExt.pro
191
- if os.path.exists(filename):
192
- os.remove(filename)
193
-
194
- def renameItem(self,item):
195
- if item.text(0)==item.data(0,Qt.UserRole) and item.data(0,Qt.UserRole)!='': return
196
-
197
- filename=pro_path+item.text(0)+outExt.pro
198
- if not os.path.exists(filename):
199
- dummyfilename=pro_path+item.text(0)+outExt.dum
200
- try:
201
- open(dummyfilename,'w')
202
- except:
203
- FlagValidRoot=False
204
- else:
205
- FlagValidRoot=True
206
- finally:
207
- if os.path.exists(dummyfilename):
208
- os.remove(dummyfilename)
209
- else: FlagValidRoot=True
210
-
211
- if not FlagValidRoot: return
212
- filename_old=pro_path+item.data(0,Qt.UserRole)+outExt.pro
213
- if os.path.exists(filename_old):
214
- os.rename(filename_old,filename)
215
- item.setData(0,Qt.UserRole,item.text(0))
216
-
217
- def saveCustomList(self):
218
- with open(self.custom_list_file,'w') as file:
219
- for c in self.custom_list:
220
- file.write(c+'\n')
221
- file.close()
222
-
223
-
224
- def loadPastProc(self,*args):
225
- if len(args): inpath=args[0]
226
- else: inpath='./'
227
- ext_pro=f'*{outExt.min}; *{outExt.piv}; *.cfg'
228
- filename, _ = QFileDialog.getOpenFileName(self,\
229
- "Select an image file of the sequence", filter=ext_pro,\
230
- dir=inpath,\
231
- options=optionNativeDialog)
232
- if not filename: return
233
-
234
- ext='.'+filename.split('.')[-1]
235
- if ext in (outExt.min,outExt.piv):
236
- try:
237
- with open(filename, 'rb') as file:
238
- data=pickle.load(file)
239
- PROpar=data.PRO
240
- except Exception as inst:
241
- pri.Error.red(f'Error while loading past process:\n{traceback.print_exc()}\n\n{inst}\n')
242
- WarningMessage=f'Error while importing {filename}. Perhaps, the file is corrupted.'
243
- warningDialog(self,WarningMessage)
244
- return
245
- elif filename[-4:]=='.cfg':
246
- try:
247
- p=PaIRS_lib.PIV()
248
- p.readCfgProc(filename)
249
- except Exception as inst:
250
- pri.Error.red(f'Error while loading the cfg file {filename}:\n{traceback.print_exc()}\n\n{inst}\n')
251
- errPIVlib='\n'.join(str(inst.args[0]).split('\n')[3:]) #str(inst.__cause__).split('\n')[3] #solved
252
- WarningMessage=f'Error while importing {filename}:\n{errPIVlib}'
253
- warningDialog(self,WarningMessage)
254
- return
255
- try:
4
+
5
+ class Custom_Top(QDialog):
6
+
7
+ def __init__(self,custom_list=None):
8
+ super().__init__()
9
+ ui=Ui_Custom_Top()
10
+ ui.setupUi(self)
11
+ self.ui=ui
12
+ setupWid(self)
13
+ self.itemSize=QSize(500,20)
14
+ ui.tree.FlagArrowKeysNormal=True
15
+
16
+ self.custom_list_file=pro_path+custom_list_file
17
+
18
+ self.queue=[]
19
+ ui.tree.clear()
20
+ if custom_list==None:
21
+ self.custom_list=[os.path.basename(f)[:-10] for f in glob.glob(pro_path+outExt.pro)]
22
+ else:
23
+ self.custom_list=custom_list
24
+ self.custom_list=setCustomList(lambda var,name: self.createItemInTree(ui.tree,self.queue,name,name,QIcon()))
25
+ self.deleted=[]
26
+ self.added=[]
27
+
28
+ self.setupCallbacks()
29
+ self.FlagAdjusting=False
30
+ self.setButtons()
31
+
32
+ def setupCallbacks(self):
33
+ self.ui.tree.itemSelectionChanged.connect(self.setButtons)
34
+ self.ui.tree.itemChanged.connect(self.adjustText)
35
+
36
+ button_up_callback=lambda: self.moveupdown(-1)
37
+ button_down_callback=lambda: self.moveupdown(+1)
38
+ self.ui.button_up.clicked.connect(button_up_callback)
39
+ self.ui.button_down.clicked.connect(button_down_callback)
40
+ self.ui.button_edit.clicked.connect(self.editItem)
41
+ self.ui.button_undo.clicked.connect(self.undo)
42
+ self.ui.button_restore.clicked.connect(self.restoreItem)
43
+ self.ui.button_delete.clicked.connect(self.removeItem)
44
+ self.ui.button_import.clicked.connect(self.loadPastProc)
45
+
46
+ self.ui.button_done.clicked.connect(self.save_and_close)
47
+ self.ui.button_cancel.clicked.connect(lambda: self.done(0))
48
+
49
+ def moveupdown(self,d):
50
+ tree: QTreeWidget
51
+ tree=self.ui.tree
52
+ queue=self.queue
53
+ item=tree.currentItem()
54
+ indItem=tree.indexOfTopLevelItem(item)
55
+ tree.takeTopLevelItem(indItem)
56
+ tree.insertTopLevelItem(indItem+d,item)
57
+ queue.insert(indItem+d,queue.pop(indItem))
58
+ self.custom_list.insert(indItem+d,self.custom_list.pop(indItem))
59
+
60
+ tree.setCurrentItem(item)
61
+ self.setButtons()
62
+
63
+ def createItemInTree(self,tree,queue,name,idata,icon):
64
+ currentItem=QTreeWidgetItem(tree)
65
+ tree.addTopLevelItem(currentItem)
66
+ tree.setCurrentItem(currentItem)
67
+ queue.append(currentItem)
68
+ currentItem.setText(0,name)
69
+ currentItem.setSizeHint(0,self.itemSize)
70
+ currentItem.setIcon(0,icon)
71
+ currentItem.setToolTip(0,name)
72
+ currentItem.setStatusTip(0,name)
73
+ currentItem.setFlags(currentItem.flags() | Qt.ItemIsEditable)
74
+ currentItem.setData(0,Qt.UserRole,idata)
75
+ return currentItem
76
+
77
+ def setButtons(self,*args):
78
+ tree: QTreeWidget
79
+ tree=self.ui.tree
80
+ if len(args):
81
+ item=args[0]
82
+ i=tree.indexFromItem(item)
83
+ c=args[1]
84
+ else:
85
+ i=tree.currentIndex().row()
86
+ item=tree.currentItem()
87
+ c=0
88
+ if item==None:
89
+ self.ui.button_down.setEnabled(False)
90
+ self.ui.button_up.setEnabled(False)
91
+ self.ui.button_undo.setVisible(False)
92
+ self.ui.button_delete.setVisible(False)
93
+ self.ui.button_edit.setVisible(False)
94
+ self.ui.button_restore.setVisible(False)
95
+ return
96
+ indItem=tree.indexOfTopLevelItem(tree.currentItem())
97
+ isItemFirst=indItem==0
98
+ isItemLast=indItem==tree.topLevelItemCount()-1
99
+ self.ui.button_down.setEnabled(not isItemLast)
100
+ self.ui.button_up.setEnabled(not isItemFirst)
101
+ flagDeleted=item.font(c).strikeOut()
102
+ self.ui.button_undo.setVisible(item.data(0,Qt.UserRole)!=item.text(0) and not flagDeleted)
103
+ self.ui.button_delete.setVisible(not flagDeleted)
104
+ self.ui.button_edit.setVisible(not flagDeleted)
105
+ self.ui.button_restore.setVisible(flagDeleted)
106
+
107
+ def editItem(self):
108
+ item=self.ui.tree.currentItem()
109
+ self.ui.tree.edit(self.ui.tree.indexFromItem(item))
110
+
111
+ def adjustText(self):
112
+ if self.FlagAdjusting: return
113
+ self.FlagAdjusting=True
114
+ item=self.ui.tree.currentItem()
115
+ newName=item.text(0)
116
+ for i in self.queue:
117
+ if i==item: continue
118
+ if i.data(0,Qt.UserRole)==newName:
119
+ WarningMessage=f'The chosen name "{newName}" is already associated with a custom process. Please, indicate a different name!'
120
+ warningDialog(self,WarningMessage)
121
+ item.setText(0,item.data(0,Qt.UserRole))
122
+ if item.data(0,Qt.UserRole) and item.data(0,Qt.UserRole)!=item.text(0):
123
+ item.setIcon(0,self.ui.button_edit.icon())
124
+ else:
125
+ item.setIcon(0,QIcon())
126
+ self.setButtons()
127
+ self.FlagAdjusting=False
128
+
129
+ def undo(self):
130
+ self.FlagAdjusting=True
131
+ item=self.ui.tree.currentItem()
132
+ item.setText(0,item.data(0,Qt.UserRole))
133
+ item.setIcon(0,QIcon())
134
+ self.setButtons()
135
+ self.FlagAdjusting=False
136
+
137
+ def restoreItem(self):
138
+ self.FlagAdjusting=True
139
+ item=self.ui.tree.currentItem()
140
+ f = item.font(0)
141
+ f.setStrikeOut(False)
142
+ item.setFont(0,f)
143
+ item.setFlags(item.flags() | Qt.ItemIsEditable)
144
+ self.deleted.pop(self.deleted.index(item))
145
+ item.setData(0,Qt.UserRole,item.text(0))
146
+ item.setIcon(0,QIcon())
147
+ self.setButtons()
148
+ self.FlagAdjusting=False
149
+
150
+ def removeItem(self):
151
+ self.FlagAdjusting=True
152
+ item=self.ui.tree.currentItem()
153
+ #item.setFlags(item.flags() | ~Qt.ItemIsEditable)
154
+ f = item.font(0)
155
+ f.setStrikeOut(True)
156
+ item.setFont(0,f)
157
+ item.setText(0,item.data(0,Qt.UserRole))
158
+ item.setData(0,Qt.UserRole,'')
159
+ item.setIcon(0,QIcon())
160
+ item.setFlags(item.flags() & ~QtCore.Qt.ItemIsEditable)
161
+ self.deleted.append(item)
162
+ self.setButtons()
163
+ self.FlagAdjusting=False
164
+
165
+ def save_and_close(self):
166
+ if len(self.deleted):
167
+ WarningMessage="Some items were deleted from the list. The corresponding files will be removed from the disk. This operation is irreversible.\n"+\
168
+ "Do you want to continue?"
169
+ flag=questionDialog(self,WarningMessage)
170
+ else:
171
+ flag=True
172
+ if flag:
173
+ self.FlagAdjusting=True
174
+ for item in self.deleted:
175
+ self.deleteItem(item)
176
+ i=self.queue.index(item)
177
+ self.custom_list.pop(i)
178
+ self.queue.pop(i)
179
+ for item in self.queue:
180
+ self.renameItem(item)
181
+ self.custom_list[self.queue.index(item)]=item.text(0)
182
+ self.saveCustomList()
183
+ self.FlagAdjusting=False
184
+ self.done(1)
185
+
186
+ def deleteItem(self,item):
187
+ filename=pro_path+item.text(0)+outExt.pro
188
+ if os.path.exists(filename):
189
+ os.remove(filename)
190
+
191
+ def renameItem(self,item):
192
+ if item.text(0)==item.data(0,Qt.UserRole) and item.data(0,Qt.UserRole)!='': return
193
+
194
+ filename=pro_path+item.text(0)+outExt.pro
195
+ if not os.path.exists(filename):
196
+ dummyfilename=pro_path+item.text(0)+outExt.dum
197
+ try:
198
+ open(dummyfilename,'w')
199
+ except:
200
+ OptionValidRoot=False
201
+ else:
202
+ OptionValidRoot=True
203
+ finally:
204
+ if os.path.exists(dummyfilename):
205
+ os.remove(dummyfilename)
206
+ else: OptionValidRoot=True
207
+
208
+ if not OptionValidRoot: return
209
+ filename_old=pro_path+item.data(0,Qt.UserRole)+outExt.pro
210
+ if os.path.exists(filename_old):
211
+ os.rename(filename_old,filename)
212
+ item.setData(0,Qt.UserRole,item.text(0))
213
+
214
+ def saveCustomList(self):
215
+ try:
216
+ with open(self.custom_list_file,'w') as file:
217
+ for c in self.custom_list:
218
+ file.write(c+'\n')
219
+ file.close()
220
+ except:
221
+ pri.Error.red(f'Error while trying to save the custom process list: {self.custom_list_file}.\n{traceback.format_exc()}\n')
222
+
223
+
224
+ def loadPastProc(self,*args):
225
+ if len(args): inpath=args[0]
226
+ else: inpath='./'
227
+ ext_pro=f'*{outExt.min} *{outExt.piv} *.cfg'
228
+ filename, _ = QFileDialog.getOpenFileName(self,\
229
+ "Select an image file of the sequence", filter=ext_pro,\
230
+ dir=inpath,\
231
+ options=optionNativeDialog)
232
+ if not filename: return
233
+
234
+ ext='.'+filename.split('.')[-1]
235
+ if ext in (outExt.min,outExt.piv):
236
+ try:
237
+ with open(filename, 'rb') as file:
238
+ data=pickle.load(file)
239
+ PROpar=data.PRO
240
+ except Exception as inst:
241
+ pri.Error.red(f'Error while loading past process:\n{traceback.format_exc()}\n\n{inst}\n')
242
+ WarningMessage=f'Error while importing {filename}. Perhaps, the file is corrupted.'
243
+ warningDialog(self,WarningMessage)
244
+ return
245
+ elif filename[-4:]=='.cfg':
246
+ try:
247
+ p=PaIRS_lib.PIV()
248
+ p.readCfgProc(filename)
249
+ except Exception as inst:
250
+ pri.Error.red(f'Error while loading the cfg file {filename}:\n{traceback.format_exc()}\n\n{inst}\n')
251
+ errPIVlib='\n'.join(str(inst.args[0]).split('\n')[3:]) #str(inst.__cause__).split('\n')[3] #solved
252
+ WarningMessage=f'Error while importing {filename}:\n{errPIVlib}'
253
+ warningDialog(self,WarningMessage)
254
+ return
255
+ try:
256
256
  from .procTools import PIV2Pro
257
- PROpar=PIV2Pro(p)
258
- for f in PROpar.fields:
259
- a=getattr(PROpar,f)
260
- if type(a)==float:
261
- setattr(PROpar,f,round(a,4))
262
- except Exception as inst:
263
- pri.Error.red(f'Error while loading the cfg file {filename}:\n{traceback.print_exc()}\n\n{inst}\n')
264
- WarningMessage=f'Error while importing {filename}. Perhaps, the .cfg file does not correspond to a valid PIV process or the file is corrupted.'
265
- warningDialog(self,WarningMessage)
266
- return
267
- else:
268
- WarningMessage=f'Invalid selected file format ({ext})! Please select one of the following extentions:\n{ext_pro}'
269
- warningDialog(self,WarningMessage)
270
- return
271
-
272
-
273
- name=os.path.basename(filename).split('.')[0]
274
- filename=pro_path+name+outExt.pro
275
- i=0
276
- while os.path.exists(filename):
277
- filename=pro_path+name+f'_{i}{outExt.pro}'
278
- i+=1
279
- if i: name+=f'_{i-1}'
280
-
281
- PROpar.top='custom'
282
- PROpar.FlagCustom=False
283
- PROpar.name=name
284
- try:
285
- with open(filename,'wb') as file:
286
- pickle.dump(PROpar,file)
287
- pri.Info.blue(f'Saving custom process file {filename}')
288
- self.createItemInTree(self.ui.tree,self.queue,name,name,QIcon())
289
- self.custom_list.append(name)
290
- except Exception as inst:
291
- pri.Error.red(f'Error while saving custom process file {filename}:\n{traceback.print_exc}\n\n{inst}')
292
-
293
-
294
-
295
-
296
- if __name__ == "__main__":
297
- import sys
298
- app=QApplication.instance()
299
- if not app:app = QApplication(sys.argv)
300
- app.setStyle('Fusion')
301
- object = Custom_Top()
302
- object.exec()
303
- #app.exec()
257
+ PROpar=PIV2Pro(p)
258
+ for f in PROpar.fields:
259
+ a=getattr(PROpar,f)
260
+ if type(a)==float:
261
+ setattr(PROpar,f,round(a,4))
262
+ except Exception as inst:
263
+ pri.Error.red(f'Error while loading the cfg file {filename}:\n{traceback.format_exc()}\n\n{inst}\n')
264
+ WarningMessage=f'Error while importing {filename}. Perhaps, the .cfg file does not correspond to a valid PIV process or the file is corrupted.'
265
+ warningDialog(self,WarningMessage)
266
+ return
267
+ else:
268
+ WarningMessage=f'Invalid selected file format ({ext})! Please select one of the following extentions:\n{ext_pro}'
269
+ warningDialog(self,WarningMessage)
270
+ return
271
+
272
+
273
+ name=os.path.basename(filename).split('.')[0]
274
+ filename=pro_path+name+outExt.pro
275
+ i=0
276
+ while os.path.exists(filename):
277
+ filename=pro_path+name+f'_{i}{outExt.pro}'
278
+ i+=1
279
+ if i: name+=f'_{i-1}'
280
+
281
+ PROpar.top=0
282
+ PROpar.FlagCustom=False
283
+ PROpar.name=name
284
+ try:
285
+ with open(filename,'wb') as file:
286
+ pickle.dump(PROpar,file)
287
+ pri.Info.blue(f'Saving custom process file {filename}')
288
+ self.createItemInTree(self.ui.tree,self.queue,name,name,QIcon())
289
+ self.custom_list.append(name)
290
+ except Exception as inst:
291
+ pri.Error.red(f'Error while saving custom process file {filename}:\n{traceback.format_exc()}\n\n{inst}')
292
+
293
+
294
+
295
+
296
+ if __name__ == "__main__":
297
+ import sys
298
+ app=QApplication.instance()
299
+ if not app:app = QApplication(sys.argv)
300
+ app.setStyle('Fusion')
301
+ object = Custom_Top()
302
+ object.exec()
303
+ #app.exec()