pymodaq 4.2.3__py3-none-any.whl → 5.0.0__py3-none-any.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.

Potentially problematic release.


This version of pymodaq might be problematic. Click here for more details.

Files changed (399) hide show
  1. pymodaq/__init__.py +30 -23
  2. pymodaq/control_modules/daq_move.py +27 -14
  3. pymodaq/control_modules/daq_move_ui.py +33 -16
  4. pymodaq/control_modules/daq_viewer.py +38 -28
  5. pymodaq/control_modules/daq_viewer_ui.py +6 -6
  6. pymodaq/control_modules/mocks.py +1 -1
  7. pymodaq/control_modules/move_utility_classes.py +19 -10
  8. pymodaq/control_modules/utils.py +18 -12
  9. pymodaq/control_modules/viewer_utility_classes.py +13 -4
  10. pymodaq/dashboard.py +166 -118
  11. pymodaq/examples/custom_app.py +13 -16
  12. pymodaq/examples/custom_viewer.py +7 -7
  13. pymodaq/examples/function_plotter.py +13 -12
  14. pymodaq/examples/parameter_ex.py +50 -25
  15. pymodaq/examples/tcp_client.py +1 -1
  16. pymodaq/extensions/__init__.py +1 -1
  17. pymodaq/extensions/bayesian/bayesian_optimisation.py +15 -12
  18. pymodaq/extensions/bayesian/utils.py +10 -10
  19. pymodaq/extensions/console.py +10 -13
  20. pymodaq/extensions/{daq_logger.py → daq_logger/daq_logger.py} +36 -56
  21. pymodaq/{utils/db/db_logger → extensions/daq_logger/db}/db_logger.py +16 -15
  22. pymodaq/{utils/db/db_logger → extensions/daq_logger/db}/db_logger_models.py +2 -0
  23. pymodaq/{utils/h5modules → extensions/daq_logger}/h5logging.py +7 -8
  24. pymodaq/extensions/daq_scan.py +153 -247
  25. pymodaq/extensions/daq_scan_ui.py +11 -9
  26. pymodaq/extensions/h5browser.py +8 -8
  27. pymodaq/extensions/pid/__init__.py +6 -3
  28. pymodaq/extensions/pid/daq_move_PID.py +4 -2
  29. pymodaq/extensions/pid/pid_controller.py +15 -12
  30. pymodaq/extensions/pid/utils.py +10 -5
  31. pymodaq/extensions/utils.py +5 -3
  32. pymodaq/post_treatment/load_and_plot.py +10 -7
  33. pymodaq/resources/preset_default.xml +1 -1
  34. pymodaq/utils/array_manipulation.py +4 -384
  35. pymodaq/utils/calibration_camera.py +12 -9
  36. pymodaq/utils/chrono_timer.py +7 -5
  37. pymodaq/utils/config.py +3 -450
  38. pymodaq/utils/daq_utils.py +6 -664
  39. pymodaq/utils/data.py +9 -2774
  40. pymodaq/utils/exceptions.py +0 -4
  41. pymodaq/utils/gui_utils/__init__.py +8 -8
  42. pymodaq/utils/gui_utils/loader_utils.py +38 -0
  43. pymodaq/utils/gui_utils/utils.py +6 -138
  44. pymodaq/utils/h5modules/__init__.py +0 -4
  45. pymodaq/utils/h5modules/module_saving.py +15 -8
  46. pymodaq/utils/leco/__init__.py +2 -2
  47. pymodaq/utils/leco/daq_move_LECODirector.py +2 -2
  48. pymodaq/utils/leco/daq_xDviewer_LECODirector.py +2 -2
  49. pymodaq/utils/leco/director_utils.py +2 -2
  50. pymodaq/utils/leco/leco_director.py +3 -3
  51. pymodaq/utils/leco/pymodaq_listener.py +2 -2
  52. pymodaq/utils/leco/utils.py +1 -1
  53. pymodaq/utils/logger.py +4 -76
  54. pymodaq/utils/managers/batchscan_manager.py +16 -19
  55. pymodaq/utils/managers/modules_manager.py +10 -7
  56. pymodaq/utils/managers/overshoot_manager.py +3 -5
  57. pymodaq/utils/managers/preset_manager.py +37 -15
  58. pymodaq/utils/managers/preset_manager_utils.py +11 -9
  59. pymodaq/utils/managers/remote_manager.py +12 -10
  60. pymodaq/utils/math_utils.py +4 -572
  61. pymodaq/utils/parameter/__init__.py +4 -11
  62. pymodaq/utils/parameter/utils.py +4 -299
  63. pymodaq/utils/scanner/scan_config.py +1 -1
  64. pymodaq/utils/scanner/scan_factory.py +16 -12
  65. pymodaq/utils/{plotting → scanner}/scan_selector.py +19 -20
  66. pymodaq/utils/scanner/scanner.py +10 -8
  67. pymodaq/utils/scanner/scanners/_1d_scanners.py +8 -5
  68. pymodaq/utils/scanner/scanners/_2d_scanners.py +5 -5
  69. pymodaq/utils/scanner/scanners/sequential.py +8 -8
  70. pymodaq/utils/scanner/scanners/tabular.py +9 -9
  71. pymodaq/utils/scanner/utils.py +6 -4
  72. pymodaq/utils/svg/svg_viewer2D.py +3 -4
  73. pymodaq/utils/tcp_ip/serializer.py +64 -16
  74. pymodaq/utils/tcp_ip/tcp_server_client.py +10 -8
  75. {pymodaq-4.2.3.dist-info → pymodaq-5.0.0.dist-info}/METADATA +5 -3
  76. pymodaq-5.0.0.dist-info/RECORD +123 -0
  77. {pymodaq-4.2.3.dist-info → pymodaq-5.0.0.dist-info}/WHEEL +1 -1
  78. pymodaq/post_treatment/process_to_scalar.py +0 -263
  79. pymodaq/resources/QtDesigner_Ressources/Icon_Library/1d.png +0 -0
  80. pymodaq/resources/QtDesigner_Ressources/Icon_Library/2d.png +0 -0
  81. pymodaq/resources/QtDesigner_Ressources/Icon_Library/3d.png +0 -0
  82. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Add2.png +0 -0
  83. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Add_Step.png +0 -0
  84. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Approve.png +0 -0
  85. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Approve_All.png +0 -0
  86. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Browse_Dir_Path.png +0 -0
  87. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Calculator.png +0 -0
  88. pymodaq/resources/QtDesigner_Ressources/Icon_Library/ChnGroup.png +0 -0
  89. pymodaq/resources/QtDesigner_Ressources/Icon_Library/ChnNum.png +0 -0
  90. pymodaq/resources/QtDesigner_Ressources/Icon_Library/ChnText.png +0 -0
  91. pymodaq/resources/QtDesigner_Ressources/Icon_Library/ChnTime.png +0 -0
  92. pymodaq/resources/QtDesigner_Ressources/Icon_Library/ChnWave.png +0 -0
  93. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Close3.png +0 -0
  94. pymodaq/resources/QtDesigner_Ressources/Icon_Library/CollapseAll.png +0 -0
  95. pymodaq/resources/QtDesigner_Ressources/Icon_Library/CollapseAll_32.png +0 -0
  96. pymodaq/resources/QtDesigner_Ressources/Icon_Library/ColorPicker.png +0 -0
  97. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Contract.png +0 -0
  98. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Create.png +0 -0
  99. pymodaq/resources/QtDesigner_Ressources/Icon_Library/DeleteLayer.png +0 -0
  100. pymodaq/resources/QtDesigner_Ressources/Icon_Library/EditOpen.png +0 -0
  101. pymodaq/resources/QtDesigner_Ressources/Icon_Library/EditRedo.png +0 -0
  102. pymodaq/resources/QtDesigner_Ressources/Icon_Library/EditUndo.png +0 -0
  103. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Ellipse.png +0 -0
  104. pymodaq/resources/QtDesigner_Ressources/Icon_Library/EllipseFilled.png +0 -0
  105. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Error.png +0 -0
  106. pymodaq/resources/QtDesigner_Ressources/Icon_Library/ErrorMessage.png +0 -0
  107. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Error_16.png +0 -0
  108. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Exit.png +0 -0
  109. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Expand.png +0 -0
  110. pymodaq/resources/QtDesigner_Ressources/Icon_Library/ExpandAll.png +0 -0
  111. pymodaq/resources/QtDesigner_Ressources/Icon_Library/ExpandAll_32.png +0 -0
  112. pymodaq/resources/QtDesigner_Ressources/Icon_Library/FFT.png +0 -0
  113. pymodaq/resources/QtDesigner_Ressources/Icon_Library/HLM.ico +0 -0
  114. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Help.png +0 -0
  115. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Help_32.png +0 -0
  116. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Histogram.png +0 -0
  117. pymodaq/resources/QtDesigner_Ressources/Icon_Library/LUT_LookUpTable.png +0 -0
  118. pymodaq/resources/QtDesigner_Ressources/Icon_Library/MagnifyingGlass.png +0 -0
  119. pymodaq/resources/QtDesigner_Ressources/Icon_Library/MagnifyingGlass_24.png +0 -0
  120. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Marker.png +0 -0
  121. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Math.png +0 -0
  122. pymodaq/resources/QtDesigner_Ressources/Icon_Library/MeasurementStudio_32.png +0 -0
  123. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Move.png +0 -0
  124. pymodaq/resources/QtDesigner_Ressources/Icon_Library/MoveDown.png +0 -0
  125. pymodaq/resources/QtDesigner_Ressources/Icon_Library/MoveUp.png +0 -0
  126. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Multiply.png +0 -0
  127. pymodaq/resources/QtDesigner_Ressources/Icon_Library/NewFile.png +0 -0
  128. pymodaq/resources/QtDesigner_Ressources/Icon_Library/NewLayer.png +0 -0
  129. pymodaq/resources/QtDesigner_Ressources/Icon_Library/New_File.png +0 -0
  130. pymodaq/resources/QtDesigner_Ressources/Icon_Library/New_Folder.png +0 -0
  131. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Open.png +0 -0
  132. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Open_1D.png +0 -0
  133. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Open_2D.png +0 -0
  134. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Open_File.png +0 -0
  135. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Open_File_32.png +0 -0
  136. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Open_sim.png +0 -0
  137. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Options.png +0 -0
  138. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Oscilloscope.png +0 -0
  139. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Oscilloscope_16.png +0 -0
  140. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Pass.png +0 -0
  141. pymodaq/resources/QtDesigner_Ressources/Icon_Library/RGB.png +0 -0
  142. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Rectangle.png +0 -0
  143. pymodaq/resources/QtDesigner_Ressources/Icon_Library/RectangleFilled.png +0 -0
  144. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Redo.png +0 -0
  145. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Refresh.png +0 -0
  146. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Refresh2.png +0 -0
  147. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Refresh_32.png +0 -0
  148. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Region.png +0 -0
  149. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Rendezvous.png +0 -0
  150. pymodaq/resources/QtDesigner_Ressources/Icon_Library/SELECT.png +0 -0
  151. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Save.png +0 -0
  152. pymodaq/resources/QtDesigner_Ressources/Icon_Library/SaveAll.png +0 -0
  153. pymodaq/resources/QtDesigner_Ressources/Icon_Library/SaveAll_32.png +0 -0
  154. pymodaq/resources/QtDesigner_Ressources/Icon_Library/SaveAs.png +0 -0
  155. pymodaq/resources/QtDesigner_Ressources/Icon_Library/SaveAs_32.png +0 -0
  156. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Save_24.png +0 -0
  157. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Save_32.png +0 -0
  158. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Search.png +0 -0
  159. pymodaq/resources/QtDesigner_Ressources/Icon_Library/SelectPolygon.png +0 -0
  160. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Select_24.png +0 -0
  161. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Settings.png +0 -0
  162. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Snap&Save.png +0 -0
  163. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Snapshot.png +0 -0
  164. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Snapshot2.png +0 -0
  165. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Snapshot2_16.png +0 -0
  166. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Snapshot2_32.png +0 -0
  167. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Spreadsheet.png +0 -0
  168. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Statistics.png +0 -0
  169. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Statistics2.png +0 -0
  170. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Status.png +0 -0
  171. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Subtract.png +0 -0
  172. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Vision.png +0 -0
  173. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Volts.png +0 -0
  174. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Wait2.png +0 -0
  175. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Zoom_1_1.png +0 -0
  176. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Zoom_in.png +0 -0
  177. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Zoom_out.png +0 -0
  178. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Zoom_to_Selection.png +0 -0
  179. pymodaq/resources/QtDesigner_Ressources/Icon_Library/abort.png +0 -0
  180. pymodaq/resources/QtDesigner_Ressources/Icon_Library/advanced2.png +0 -0
  181. pymodaq/resources/QtDesigner_Ressources/Icon_Library/autoscale.png +0 -0
  182. pymodaq/resources/QtDesigner_Ressources/Icon_Library/b_icon.png +0 -0
  183. pymodaq/resources/QtDesigner_Ressources/Icon_Library/back.png +0 -0
  184. pymodaq/resources/QtDesigner_Ressources/Icon_Library/bg_icon.png +0 -0
  185. pymodaq/resources/QtDesigner_Ressources/Icon_Library/camera.png +0 -0
  186. pymodaq/resources/QtDesigner_Ressources/Icon_Library/camera_snap.png +0 -0
  187. pymodaq/resources/QtDesigner_Ressources/Icon_Library/cartesian.png +0 -0
  188. pymodaq/resources/QtDesigner_Ressources/Icon_Library/clear2.png +0 -0
  189. pymodaq/resources/QtDesigner_Ressources/Icon_Library/clear_ROI.png +0 -0
  190. pymodaq/resources/QtDesigner_Ressources/Icon_Library/close2.png +0 -0
  191. pymodaq/resources/QtDesigner_Ressources/Icon_Library/cluster2.png +0 -0
  192. pymodaq/resources/QtDesigner_Ressources/Icon_Library/color.png +0 -0
  193. pymodaq/resources/QtDesigner_Ressources/Icon_Library/color2.png +0 -0
  194. pymodaq/resources/QtDesigner_Ressources/Icon_Library/continuous.png +0 -0
  195. pymodaq/resources/QtDesigner_Ressources/Icon_Library/data.png +0 -0
  196. pymodaq/resources/QtDesigner_Ressources/Icon_Library/delay.png +0 -0
  197. pymodaq/resources/QtDesigner_Ressources/Icon_Library/download.png +0 -0
  198. pymodaq/resources/QtDesigner_Ressources/Icon_Library/download2.png +0 -0
  199. pymodaq/resources/QtDesigner_Ressources/Icon_Library/error2.png +0 -0
  200. pymodaq/resources/QtDesigner_Ressources/Icon_Library/ethernet.png +0 -0
  201. pymodaq/resources/QtDesigner_Ressources/Icon_Library/exit2.png +0 -0
  202. pymodaq/resources/QtDesigner_Ressources/Icon_Library/fan.png +0 -0
  203. pymodaq/resources/QtDesigner_Ressources/Icon_Library/filter2.png +0 -0
  204. pymodaq/resources/QtDesigner_Ressources/Icon_Library/g_icon.png +0 -0
  205. pymodaq/resources/QtDesigner_Ressources/Icon_Library/gear2.png +0 -0
  206. pymodaq/resources/QtDesigner_Ressources/Icon_Library/go_to.png +0 -0
  207. pymodaq/resources/QtDesigner_Ressources/Icon_Library/go_to_1.png +0 -0
  208. pymodaq/resources/QtDesigner_Ressources/Icon_Library/go_to_2.png +0 -0
  209. pymodaq/resources/QtDesigner_Ressources/Icon_Library/grab.png +0 -0
  210. pymodaq/resources/QtDesigner_Ressources/Icon_Library/graph.png +0 -0
  211. pymodaq/resources/QtDesigner_Ressources/Icon_Library/greenLight2.png +0 -0
  212. pymodaq/resources/QtDesigner_Ressources/Icon_Library/greenLight2_32.png +0 -0
  213. pymodaq/resources/QtDesigner_Ressources/Icon_Library/green_light.png +0 -0
  214. pymodaq/resources/QtDesigner_Ressources/Icon_Library/grey_icon.png +0 -0
  215. pymodaq/resources/QtDesigner_Ressources/Icon_Library/greyscale.png +0 -0
  216. pymodaq/resources/QtDesigner_Ressources/Icon_Library/help1.png +0 -0
  217. pymodaq/resources/QtDesigner_Ressources/Icon_Library/help1_32.png +0 -0
  218. pymodaq/resources/QtDesigner_Ressources/Icon_Library/home2.png +0 -0
  219. pymodaq/resources/QtDesigner_Ressources/Icon_Library/information2.png +0 -0
  220. pymodaq/resources/QtDesigner_Ressources/Icon_Library/ini.png +0 -0
  221. pymodaq/resources/QtDesigner_Ressources/Icon_Library/integrator.png +0 -0
  222. pymodaq/resources/QtDesigner_Ressources/Icon_Library/joystick.png +0 -0
  223. pymodaq/resources/QtDesigner_Ressources/Icon_Library/light_green.png +0 -0
  224. pymodaq/resources/QtDesigner_Ressources/Icon_Library/light_green_16.png +0 -0
  225. pymodaq/resources/QtDesigner_Ressources/Icon_Library/light_red.png +0 -0
  226. pymodaq/resources/QtDesigner_Ressources/Icon_Library/light_red_16.png +0 -0
  227. pymodaq/resources/QtDesigner_Ressources/Icon_Library/light_yellow.png +0 -0
  228. pymodaq/resources/QtDesigner_Ressources/Icon_Library/light_yellow_16.png +0 -0
  229. pymodaq/resources/QtDesigner_Ressources/Icon_Library/limiter.png +0 -0
  230. pymodaq/resources/QtDesigner_Ressources/Icon_Library/load_ROI.png +0 -0
  231. pymodaq/resources/QtDesigner_Ressources/Icon_Library/meshPlot.png +0 -0
  232. pymodaq/resources/QtDesigner_Ressources/Icon_Library/meter.png +0 -0
  233. pymodaq/resources/QtDesigner_Ressources/Icon_Library/meter2.png +0 -0
  234. pymodaq/resources/QtDesigner_Ressources/Icon_Library/meter_32.png +0 -0
  235. pymodaq/resources/QtDesigner_Ressources/Icon_Library/move_contour.png +0 -0
  236. pymodaq/resources/QtDesigner_Ressources/Icon_Library/move_straight_line.png +0 -0
  237. pymodaq/resources/QtDesigner_Ressources/Icon_Library/movie.png +0 -0
  238. pymodaq/resources/QtDesigner_Ressources/Icon_Library/multi_point.png +0 -0
  239. pymodaq/resources/QtDesigner_Ressources/Icon_Library/multiplexer.png +0 -0
  240. pymodaq/resources/QtDesigner_Ressources/Icon_Library/new.png +0 -0
  241. pymodaq/resources/QtDesigner_Ressources/Icon_Library/openArrow.png +0 -0
  242. pymodaq/resources/QtDesigner_Ressources/Icon_Library/openTree.png +0 -0
  243. pymodaq/resources/QtDesigner_Ressources/Icon_Library/oscilloscope2.png +0 -0
  244. pymodaq/resources/QtDesigner_Ressources/Icon_Library/oscilloscope3.png +0 -0
  245. pymodaq/resources/QtDesigner_Ressources/Icon_Library/overlay.png +0 -0
  246. pymodaq/resources/QtDesigner_Ressources/Icon_Library/pass2.png +0 -0
  247. pymodaq/resources/QtDesigner_Ressources/Icon_Library/pass2_16.png +0 -0
  248. pymodaq/resources/QtDesigner_Ressources/Icon_Library/pass_32.png +0 -0
  249. pymodaq/resources/QtDesigner_Ressources/Icon_Library/pause.png +0 -0
  250. pymodaq/resources/QtDesigner_Ressources/Icon_Library/permute.png +0 -0
  251. pymodaq/resources/QtDesigner_Ressources/Icon_Library/phase.png +0 -0
  252. pymodaq/resources/QtDesigner_Ressources/Icon_Library/play.png +0 -0
  253. pymodaq/resources/QtDesigner_Ressources/Icon_Library/polar.png +0 -0
  254. pymodaq/resources/QtDesigner_Ressources/Icon_Library/pole_zero.png +0 -0
  255. pymodaq/resources/QtDesigner_Ressources/Icon_Library/powerMeter.png +0 -0
  256. pymodaq/resources/QtDesigner_Ressources/Icon_Library/powerSwitch.png +0 -0
  257. pymodaq/resources/QtDesigner_Ressources/Icon_Library/powerSwitch_16.png +0 -0
  258. pymodaq/resources/QtDesigner_Ressources/Icon_Library/print2.png +0 -0
  259. pymodaq/resources/QtDesigner_Ressources/Icon_Library/print2_32.png +0 -0
  260. pymodaq/resources/QtDesigner_Ressources/Icon_Library/properties.png +0 -0
  261. pymodaq/resources/QtDesigner_Ressources/Icon_Library/r_icon.png +0 -0
  262. pymodaq/resources/QtDesigner_Ressources/Icon_Library/radiocontrolbutton.png +0 -0
  263. pymodaq/resources/QtDesigner_Ressources/Icon_Library/read2.png +0 -0
  264. pymodaq/resources/QtDesigner_Ressources/Icon_Library/red_light.png +0 -0
  265. pymodaq/resources/QtDesigner_Ressources/Icon_Library/remove.png +0 -0
  266. pymodaq/resources/QtDesigner_Ressources/Icon_Library/reset.png +0 -0
  267. pymodaq/resources/QtDesigner_Ressources/Icon_Library/rgb_icon.png +0 -0
  268. pymodaq/resources/QtDesigner_Ressources/Icon_Library/robot.png +0 -0
  269. pymodaq/resources/QtDesigner_Ressources/Icon_Library/rotation2.png +0 -0
  270. pymodaq/resources/QtDesigner_Ressources/Icon_Library/run2.png +0 -0
  271. pymodaq/resources/QtDesigner_Ressources/Icon_Library/run_all.png +0 -0
  272. pymodaq/resources/QtDesigner_Ressources/Icon_Library/saturation.png +0 -0
  273. pymodaq/resources/QtDesigner_Ressources/Icon_Library/saveTree.png +0 -0
  274. pymodaq/resources/QtDesigner_Ressources/Icon_Library/save_ROI.png +0 -0
  275. pymodaq/resources/QtDesigner_Ressources/Icon_Library/scale_horizontally.png +0 -0
  276. pymodaq/resources/QtDesigner_Ressources/Icon_Library/scale_vertically.png +0 -0
  277. pymodaq/resources/QtDesigner_Ressources/Icon_Library/search2.png +0 -0
  278. pymodaq/resources/QtDesigner_Ressources/Icon_Library/select2.png +0 -0
  279. pymodaq/resources/QtDesigner_Ressources/Icon_Library/select_all.png +0 -0
  280. pymodaq/resources/QtDesigner_Ressources/Icon_Library/select_all2.png +0 -0
  281. pymodaq/resources/QtDesigner_Ressources/Icon_Library/select_none.png +0 -0
  282. pymodaq/resources/QtDesigner_Ressources/Icon_Library/sequence.png +0 -0
  283. pymodaq/resources/QtDesigner_Ressources/Icon_Library/sequence2.png +0 -0
  284. pymodaq/resources/QtDesigner_Ressources/Icon_Library/snap.png +0 -0
  285. pymodaq/resources/QtDesigner_Ressources/Icon_Library/sort_ascend.png +0 -0
  286. pymodaq/resources/QtDesigner_Ressources/Icon_Library/spectrumAnalyzer.png +0 -0
  287. pymodaq/resources/QtDesigner_Ressources/Icon_Library/start.png +0 -0
  288. pymodaq/resources/QtDesigner_Ressources/Icon_Library/status_cancelled.png +0 -0
  289. pymodaq/resources/QtDesigner_Ressources/Icon_Library/stop.png +0 -0
  290. pymodaq/resources/QtDesigner_Ressources/Icon_Library/stop2.png +0 -0
  291. pymodaq/resources/QtDesigner_Ressources/Icon_Library/stop3.png +0 -0
  292. pymodaq/resources/QtDesigner_Ressources/Icon_Library/stop_all.png +0 -0
  293. pymodaq/resources/QtDesigner_Ressources/Icon_Library/sum.png +0 -0
  294. pymodaq/resources/QtDesigner_Ressources/Icon_Library/surfacePlot.png +0 -0
  295. pymodaq/resources/QtDesigner_Ressources/Icon_Library/tree.png +0 -0
  296. pymodaq/resources/QtDesigner_Ressources/Icon_Library/updateTree.png +0 -0
  297. pymodaq/resources/QtDesigner_Ressources/Icon_Library/utility2.png +0 -0
  298. pymodaq/resources/QtDesigner_Ressources/Icon_Library/utility_small.png +0 -0
  299. pymodaq/resources/QtDesigner_Ressources/Icon_Library/vector.png +0 -0
  300. pymodaq/resources/QtDesigner_Ressources/Icon_Library/verify.png +0 -0
  301. pymodaq/resources/QtDesigner_Ressources/Icon_Library/video.png +0 -0
  302. pymodaq/resources/QtDesigner_Ressources/Icon_Library/wait.png +0 -0
  303. pymodaq/resources/QtDesigner_Ressources/Icon_Library/waterfallPlot.png +0 -0
  304. pymodaq/resources/QtDesigner_Ressources/Icon_Library/watershed.png +0 -0
  305. pymodaq/resources/QtDesigner_Ressources/Icon_Library/yellow_light.png +0 -0
  306. pymodaq/resources/QtDesigner_Ressources/Icon_Library/zip_file.png +0 -0
  307. pymodaq/resources/QtDesigner_Ressources/Icon_Library/zoomAuto.png +0 -0
  308. pymodaq/resources/QtDesigner_Ressources/Icon_Library/zoomReset.png +0 -0
  309. pymodaq/resources/QtDesigner_Ressources/QtDesigner_ressources.bat +0 -2
  310. pymodaq/resources/QtDesigner_Ressources/QtDesigner_ressources.qrc +0 -234
  311. pymodaq/resources/QtDesigner_Ressources/QtDesigner_ressources_rc.py +0 -127150
  312. pymodaq/resources/QtDesigner_Ressources/icons.svg +0 -142
  313. pymodaq/resources/VERSION +0 -1
  314. pymodaq/resources/config_template.toml +0 -90
  315. pymodaq/resources/triangulation_data.npy +0 -0
  316. pymodaq/utils/abstract/__init__.py +0 -48
  317. pymodaq/utils/db/__init__.py +0 -0
  318. pymodaq/utils/db/db_logger/__init__.py +0 -0
  319. pymodaq/utils/enums.py +0 -76
  320. pymodaq/utils/factory.py +0 -82
  321. pymodaq/utils/gui_utils/custom_app.py +0 -133
  322. pymodaq/utils/gui_utils/dock.py +0 -107
  323. pymodaq/utils/gui_utils/file_io.py +0 -93
  324. pymodaq/utils/gui_utils/layout.py +0 -34
  325. pymodaq/utils/gui_utils/list_picker.py +0 -38
  326. pymodaq/utils/gui_utils/widgets/__init__.py +0 -5
  327. pymodaq/utils/gui_utils/widgets/label.py +0 -24
  328. pymodaq/utils/gui_utils/widgets/lcd.py +0 -111
  329. pymodaq/utils/gui_utils/widgets/push.py +0 -149
  330. pymodaq/utils/gui_utils/widgets/qled.py +0 -62
  331. pymodaq/utils/gui_utils/widgets/spinbox.py +0 -24
  332. pymodaq/utils/gui_utils/widgets/table.py +0 -263
  333. pymodaq/utils/gui_utils/widgets/tree_layout.py +0 -188
  334. pymodaq/utils/gui_utils/widgets/tree_toml.py +0 -102
  335. pymodaq/utils/h5modules/backends.py +0 -1022
  336. pymodaq/utils/h5modules/browsing.py +0 -625
  337. pymodaq/utils/h5modules/data_saving.py +0 -1101
  338. pymodaq/utils/h5modules/exporter.py +0 -119
  339. pymodaq/utils/h5modules/exporters/__init__.py +0 -0
  340. pymodaq/utils/h5modules/exporters/base.py +0 -111
  341. pymodaq/utils/h5modules/exporters/flimj.py +0 -63
  342. pymodaq/utils/h5modules/exporters/hyperspy.py +0 -143
  343. pymodaq/utils/h5modules/saving.py +0 -866
  344. pymodaq/utils/h5modules/utils.py +0 -115
  345. pymodaq/utils/managers/action_manager.py +0 -489
  346. pymodaq/utils/managers/parameter_manager.py +0 -282
  347. pymodaq/utils/managers/roi_manager.py +0 -726
  348. pymodaq/utils/messenger.py +0 -66
  349. pymodaq/utils/parameter/ioxml.py +0 -542
  350. pymodaq/utils/parameter/pymodaq_ptypes/__init__.py +0 -38
  351. pymodaq/utils/parameter/pymodaq_ptypes/bool.py +0 -31
  352. pymodaq/utils/parameter/pymodaq_ptypes/date.py +0 -126
  353. pymodaq/utils/parameter/pymodaq_ptypes/filedir.py +0 -143
  354. pymodaq/utils/parameter/pymodaq_ptypes/itemselect.py +0 -265
  355. pymodaq/utils/parameter/pymodaq_ptypes/led.py +0 -44
  356. pymodaq/utils/parameter/pymodaq_ptypes/list.py +0 -150
  357. pymodaq/utils/parameter/pymodaq_ptypes/numeric.py +0 -18
  358. pymodaq/utils/parameter/pymodaq_ptypes/pixmap.py +0 -175
  359. pymodaq/utils/parameter/pymodaq_ptypes/slide.py +0 -145
  360. pymodaq/utils/parameter/pymodaq_ptypes/table.py +0 -135
  361. pymodaq/utils/parameter/pymodaq_ptypes/tableview.py +0 -149
  362. pymodaq/utils/parameter/pymodaq_ptypes/text.py +0 -142
  363. pymodaq/utils/plotting/__init__.py +0 -0
  364. pymodaq/utils/plotting/data_viewers/__init__.py +0 -10
  365. pymodaq/utils/plotting/data_viewers/base.py +0 -286
  366. pymodaq/utils/plotting/data_viewers/viewer.py +0 -274
  367. pymodaq/utils/plotting/data_viewers/viewer0D.py +0 -298
  368. pymodaq/utils/plotting/data_viewers/viewer1D.py +0 -820
  369. pymodaq/utils/plotting/data_viewers/viewer1Dbasic.py +0 -231
  370. pymodaq/utils/plotting/data_viewers/viewer2D.py +0 -1118
  371. pymodaq/utils/plotting/data_viewers/viewer2D_basic.py +0 -146
  372. pymodaq/utils/plotting/data_viewers/viewerND.py +0 -800
  373. pymodaq/utils/plotting/gant_chart.py +0 -123
  374. pymodaq/utils/plotting/image_viewer.py +0 -97
  375. pymodaq/utils/plotting/items/__init__.py +0 -0
  376. pymodaq/utils/plotting/items/axis_scaled.py +0 -93
  377. pymodaq/utils/plotting/items/crosshair.py +0 -94
  378. pymodaq/utils/plotting/items/image.py +0 -388
  379. pymodaq/utils/plotting/navigator.py +0 -353
  380. pymodaq/utils/plotting/plotter/plotter.py +0 -94
  381. pymodaq/utils/plotting/plotter/plotters/__init__.py +0 -0
  382. pymodaq/utils/plotting/plotter/plotters/matplotlib_plotters.py +0 -134
  383. pymodaq/utils/plotting/plotter/plotters/qt_plotters.py +0 -78
  384. pymodaq/utils/plotting/utils/__init__.py +0 -0
  385. pymodaq/utils/plotting/utils/axes_viewer.py +0 -88
  386. pymodaq/utils/plotting/utils/filter.py +0 -585
  387. pymodaq/utils/plotting/utils/lineout.py +0 -226
  388. pymodaq/utils/plotting/utils/plot_utils.py +0 -579
  389. pymodaq/utils/plotting/utils/signalND.py +0 -1347
  390. pymodaq/utils/plotting/widgets.py +0 -76
  391. pymodaq/utils/qvariant.py +0 -12
  392. pymodaq/utils/slicing.py +0 -63
  393. pymodaq/utils/units.py +0 -216
  394. pymodaq-4.2.3.dist-info/RECORD +0 -438
  395. /pymodaq/{post_treatment/daq_analysis → extensions/daq_logger}/__init__.py +0 -0
  396. /pymodaq/{utils/abstract/logger.py → extensions/daq_logger/abstract.py} +0 -0
  397. /pymodaq/{resources/QtDesigner_Ressources → extensions/daq_logger/db}/__init__.py +0 -0
  398. {pymodaq-4.2.3.dist-info → pymodaq-5.0.0.dist-info}/entry_points.txt +0 -0
  399. {pymodaq-4.2.3.dist-info → pymodaq-5.0.0.dist-info}/licenses/LICENSE +0 -0
@@ -1,115 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- """
3
- Created the 19/01/2023
4
-
5
- @author: Sebastien Weber and N Tappy
6
- """
7
- # Standard imports
8
- from collections import OrderedDict
9
- from typing import List, Dict
10
- from pathlib import Path
11
- from importlib import import_module
12
- from ..daq_utils import get_entrypoints
13
-
14
- # 3rd party imports
15
- import numpy as np
16
-
17
-
18
- def register_exporter(parent_module_name: str = 'pymodaq.utils.h5modules'):
19
- exporters = []
20
- try:
21
- exporter_module = import_module(f'{parent_module_name}.exporters')
22
-
23
- exporter_path = Path(exporter_module.__path__[0])
24
-
25
- for file in exporter_path.iterdir():
26
- if file.is_file() and 'py' in file.suffix and file.stem != '__init__':
27
- try:
28
- exporters.append(import_module(f'.{file.stem}', exporter_module.__name__))
29
- except ModuleNotFoundError:
30
- pass
31
- except ModuleNotFoundError:
32
- pass
33
- finally:
34
- return exporters
35
-
36
-
37
- def register_exporters() -> list:
38
- exporters = register_exporter('pymodaq.utils.h5modules')
39
- discovered_exporter_plugins = get_entrypoints('pymodaq.h5exporters')
40
- for entry in discovered_exporter_plugins:
41
- exporters.extend(register_exporter(entry.value))
42
- return exporters
43
-
44
-
45
- def find_scan_node(scan_node):
46
- """
47
- utility function to find the parent node of "scan" type, meaning some of its children (DAQ_scan case)
48
- or co-nodes (daq_logger case) are navigation axes
49
- Parameters
50
- ----------
51
- scan_node: (pytables node)
52
- data node from where this function look for its navigation axes if any
53
- Returns
54
- -------
55
- node: the parent node of 'scan' type
56
- list: the data nodes of type 'navigation_axis' corresponding to the initial data node
57
-
58
-
59
- """
60
- try:
61
- while True:
62
- if scan_node.attrs['type'] == 'scan':
63
- break
64
- else:
65
- scan_node = scan_node.parent_node
66
- children = list(scan_node.children().values()) # for data saved using daq_scan
67
- children.extend([scan_node.parent_node.children()[child] for child in
68
- scan_node.parent_node.children_name()]) # for data saved using the daq_logger
69
- nav_children = []
70
- for child in children:
71
- if 'type' in child.attrs.attrs_name:
72
- if child.attrs['type'] == 'navigation_axis':
73
- nav_children.append(child)
74
- return scan_node, nav_children
75
- except Exception:
76
- return None, []
77
-
78
-
79
- def get_h5_attributes(self, node_path):
80
- """
81
- """
82
- node = self.get_node(node_path)
83
- attrs_names = node.attrs.attrs_name
84
- attr_dict = OrderedDict([])
85
- for attr in attrs_names:
86
- # if attr!='settings':
87
- attr_dict[attr] = node.attrs[attr]
88
-
89
- settings = None
90
- scan_settings = None
91
- if 'settings' in attrs_names:
92
- if node.attrs['settings'] != '':
93
- settings = node.attrs['settings']
94
-
95
- if 'scan_settings' in attrs_names:
96
- if node.attrs['scan_settings'] != '':
97
- scan_settings = node.attrs['scan_settings']
98
- pixmaps = []
99
- for attr in attrs_names:
100
- if 'pixmap' in attr:
101
- pixmaps.append(node.attrs[attr])
102
-
103
- return attr_dict, settings, scan_settings, pixmaps
104
-
105
-
106
- def get_h5_data_from_node():
107
- pass
108
-
109
-
110
- def extract_axis():
111
- pass
112
-
113
-
114
- def verify_axis_data_uniformity():
115
- pass
@@ -1,489 +0,0 @@
1
- import warnings
2
-
3
- import pymodaq.utils.messenger
4
- from multipledispatch import dispatch
5
- from typing import Union, Callable, List
6
-
7
- from qtpy import QtGui, QtWidgets, QtCore
8
- from qtpy.QtWidgets import QAction
9
-
10
- from pymodaq.resources.QtDesigner_Ressources import QtDesigner_ressources_rc
11
- from pathlib import Path
12
-
13
-
14
- def create_icon(icon_name: str):
15
- icon = QtGui.QIcon()
16
- if Path(icon_name).is_file():
17
- icon.addPixmap(QtGui.QPixmap(icon_name), QtGui.QIcon.Normal,
18
- QtGui.QIcon.Off)
19
- else:
20
- icon.addPixmap(QtGui.QPixmap(f":/icons/Icon_Library/{icon_name}.png"), QtGui.QIcon.Normal,
21
- QtGui.QIcon.Off)
22
- return icon
23
-
24
-
25
- class QAction(QAction):
26
- """
27
- QAction subclass to mimic signals as pushbuttons. Done to be sure of backcompatibility when I moved from
28
- pushbuttons to QAction
29
- """
30
- def __init__(self, *args, **kwargs):
31
- super().__init__(*args, **kwargs)
32
-
33
- def click(self):
34
- pymodaq.utils.messenger.deprecation_msg("click for PyMoDAQ's QAction is deprecated, use *trigger*",
35
- stacklevel=3)
36
- self.trigger()
37
-
38
- @property
39
- def clicked(self):
40
- pymodaq.utils.messenger.deprecation_msg("clicked for PyMoDAQ's QAction is deprecated, use *trigger*",
41
- stacklevel=3)
42
- return self.triggered
43
-
44
- def connect_to(self, slot):
45
- self.triggered.connect(slot)
46
-
47
- def set_icon(self, icon_name: str):
48
- self.setIcon(create_icon(icon_name))
49
-
50
-
51
- def addaction(name: str = '', icon_name: str = '', tip='', checkable=False, checked=False,
52
- slot: Callable = None, toolbar: QtWidgets.QToolBar = None,
53
- menu: QtWidgets.QMenu = None, visible=True, shortcut=None,
54
- enabled=True):
55
- """Create a new action and add it eventually to a toolbar and a menu
56
-
57
- Parameters
58
- ----------
59
- name: str
60
- Displayed name if should be displayed (for instance in menus)
61
- icon_name: str
62
- png file name to produce the icon
63
- tip: str
64
- a tooltip to be displayed when hovering above the action
65
- checkable: bool
66
- set the checkable state of the action
67
- checked: bool
68
- set the current state of the action
69
- slot: callable
70
- Method or function that will be called when the action is triggered
71
- toolbar: QToolBar
72
- a toolbar where action should be added.
73
- menu: QMenu
74
- a menu where action should be added.
75
- visible: bool
76
- display or not the action in the toolbar/menu
77
- shortcut: str
78
- a string defining a shortcut for this action
79
- enabled: bool
80
- set the enabled state
81
- """
82
- if icon_name != '':
83
- action = QAction(create_icon(icon_name), name, None)
84
- else:
85
- action = QAction(name)
86
-
87
- if slot is not None:
88
- action.connect_to(slot)
89
- action.setCheckable(checkable)
90
- if checkable:
91
- action.setChecked(checked)
92
- action.setToolTip(tip)
93
- if toolbar is not None:
94
- toolbar.addAction(action)
95
- if menu is not None:
96
- menu.addAction(action)
97
- if shortcut is not None:
98
- action.setShortcut(shortcut)
99
- action.setVisible(visible)
100
- action.setEnabled(enabled)
101
- return action
102
-
103
-
104
- def addwidget(klass: Union[str, QtWidgets.QWidget], *args, tip='', toolbar: QtWidgets.QToolBar = None, visible=True,
105
- signal_str=None, slot: Callable=None, setters = {}, **kwargs):
106
- """Create and eventually add a widget to a toolbar
107
-
108
- Parameters
109
- ----------
110
- klass: str or QWidget
111
- should be a custom widget class or the name of a standard widget of QWidgets
112
- args: list
113
- variable arguments passed as is to the widget constructor
114
- tip: str
115
- a tooltip to be displayed when hovering above the widget
116
- toolbar: QToolBar
117
- a toolbar where the widget should be added.
118
- visible: bool
119
- display or not the action in the toolbar/menu
120
- signal_str: str
121
- an attribute of type Signal of the widget
122
- slot: Callable
123
- a callable connected to the signal
124
- kwargs: dict
125
- variable named arguments used as is in the widget constructor
126
- setters: dict
127
- method/value pair of the widget (for instance setMaximumWidth)
128
- Returns
129
- -------
130
- QtWidgets.QWidget
131
- """
132
- if isinstance(klass, str):
133
- if hasattr(QtWidgets, klass):
134
- widget: QtWidgets.QWidget = getattr(QtWidgets, klass)(*args)
135
- else:
136
- return None
137
- else:
138
- try:
139
- widget = klass(*args, **kwargs)
140
- except:
141
- return None
142
- widget.setVisible(visible)
143
- widget.setToolTip(tip)
144
- if toolbar is not None:
145
- toolbar.addWidget(widget)
146
- if isinstance(signal_str, str) and slot is not None:
147
- if hasattr(widget, signal_str):
148
- getattr(widget, signal_str).connect(slot)
149
-
150
- for setter in setters:
151
- if hasattr(widget, setter):
152
- getattr(widget, setter)(setters[setter])
153
-
154
- return widget
155
-
156
-
157
- class ActionManager:
158
- """MixIn Class to be used by all UserInterface to manage their QActions and the action they are connected to
159
-
160
- Parameters
161
- ----------
162
- toolbar: QToolbar, optional
163
- The toolbar to use as default
164
- menu: QMenu, option
165
- The menu to use as default
166
- """
167
- def __init__(self, toolbar=None, menu=None):
168
- self._actions = dict([])
169
- self._toolbar = toolbar
170
- self._menu = menu
171
-
172
- #self.setup_actions()
173
-
174
- def setup_actions(self):
175
- """Method where to create actions to be subclassed. Mandatory
176
-
177
- Examples
178
- --------
179
- >>> self.add_action('Quit', 'close2', "Quit program")
180
- >>> self.add_action('Grab', 'camera', "Grab from camera", checkable=True)
181
- >>> self.add_action('Load', 'Open', "Load target file (.h5, .png, .jpg) or data from camera", checkable=False)
182
- >>> self.add_action('Save', 'SaveAs', "Save current data", checkable=False)
183
-
184
- See Also
185
- --------
186
- ActionManager.add_action
187
- """
188
- raise NotImplementedError(f'You have to define actions here in the following form:'
189
- f'{self.setup_actions.__doc__}')
190
-
191
- def add_action(self, short_name: str = '', name: str = '', icon_name: str = '', tip='',
192
- checkable=False,
193
- checked=False, toolbar=None, menu=None,
194
- visible=True, shortcut=None, auto_toolbar=True, auto_menu=True,
195
- enabled=True):
196
- """Create a new action and add it to toolbar and menu
197
-
198
- Parameters
199
- ----------
200
- short_name: str
201
- the name as referenced in the dict self.actions
202
- name: str
203
- Displayed name if should be displayed in
204
- icon_name: str
205
- png file name to produce the icon
206
- tip: str
207
- a tooltip to be displayed when hovering above the action
208
- checkable: bool
209
- set the checkable state of the action
210
- checked: bool
211
- set the current state of the action
212
- toolbar: QToolBar
213
- a toolbar where action should be added. Actions can also be added later see *affect_to*
214
- menu: QMenu
215
- a menu where action should be added. Actions can also be added later see *affect_to*
216
- visible: bool
217
- display or not the action in the toolbar/menu
218
- auto_toolbar: bool
219
- if True add this action to the defined toolbar
220
- auto_menu: bool
221
- if True add this action to the defined menu
222
- enabled: bool
223
- set the enabled state of this action
224
- See Also
225
- --------
226
- affect_to, pymodaq.resources.QtDesigner_Ressources.Icon_Library,
227
- pymodaq.utils.managers.action_manager.add_action
228
- """
229
- if auto_toolbar:
230
- if toolbar is None:
231
- toolbar = self._toolbar
232
- if auto_menu:
233
- if menu is None:
234
- menu = self._menu
235
- self._actions[short_name] = addaction(name, icon_name, tip, checkable=checkable,
236
- checked=checked, toolbar=toolbar, menu=menu,
237
- visible=visible, shortcut=shortcut, enabled=enabled)
238
-
239
- def add_widget(self, short_name, klass: Union[str, QtWidgets.QWidget], *args, tip='',
240
- toolbar: QtWidgets.QToolBar = None, visible=True, signal_str=None, slot: Callable=None, **kwargs):
241
- """Create and add a widget to a toolbar
242
-
243
- Parameters
244
- ----------
245
- short_name: str
246
- the name as referenced in the dict self.actions
247
- klass: str or QWidget
248
- should be a custom widget class or the name of a standard widget of QWidgets
249
- args: list
250
- variable arguments passed as is to the widget constructor
251
- tip: str
252
- a tooltip to be displayed when hovering above the widget
253
- toolbar: QToolBar
254
- a toolbar where the widget should be added.
255
- visible: bool
256
- display or not the action in the toolbar/menu
257
- signal_str: str
258
- an attribute of type Signal of the widget
259
- slot: Callable
260
- a callable connected to the signal
261
- kwargs: dict
262
- variable named arguments passed as is to the widget constructor
263
- Returns
264
- -------
265
- QtWidgets.QWidget
266
- """
267
- if toolbar is None:
268
- toolbar = self._toolbar
269
- widget = addwidget(klass, *args, tip=tip, toolbar=toolbar, visible=visible, signal_str=signal_str,
270
- slot=slot, **kwargs)
271
- if widget is not None:
272
- self._actions[short_name] = widget
273
- else:
274
- warnings.warn(UserWarning(f'Impossible to add the widget {short_name} and type {klass} to the toolbar'))
275
-
276
- def set_toolbar(self, toolbar):
277
- """affect a toolbar to self
278
-
279
- Parameters
280
- ----------
281
- toolbar:
282
- QtWidgets.QToolBar
283
- """
284
- self._toolbar = toolbar
285
-
286
- def set_menu(self, menu):
287
- """affect a menu to self
288
-
289
- Parameters
290
- ----------
291
- menu:
292
- QtWidgets.QMenu
293
- """
294
- self._menu = menu
295
-
296
- def set_action_text(self, action_name: str, text: str):
297
- """Convenience method to set the displayed text on an action
298
-
299
- Parameters
300
- ----------
301
- action_name: str
302
- The action name as defined in setup_actions
303
- text: str
304
- The text to display
305
- """
306
- self.get_action(action_name).setText(text)
307
-
308
- @property
309
- def actions(self) -> List[QAction]:
310
- return list(self._actions.values())
311
-
312
- def get_action(self, name) -> QAction:
313
- """Getter of a given action
314
-
315
- Parameters
316
- ----------
317
- name: str
318
- The action name as defined in setup_actions
319
-
320
- Returns
321
- -------
322
- QAction
323
- """
324
- if self.has_action(name):
325
- return self._actions[name]
326
- else:
327
- raise KeyError(f'The action with name: {name} is not referenced'
328
- f' in the view actions: {self._actions.keys()}')
329
-
330
- def has_action(self, action_name) -> bool:
331
- """Check if an action has been defined
332
- Parameters
333
- ----------
334
- action_name: str
335
- The action name as defined in setup_actions
336
-
337
- Returns
338
- -------
339
- bool: True if the action exists, False otherwise
340
- """
341
- return action_name in self._actions
342
-
343
- @property
344
- def toolbar(self):
345
- """Get the default toolbar"""
346
- return self._toolbar
347
-
348
- @property
349
- def menu(self):
350
- """Get the default menu"""
351
- return self._menu
352
-
353
- def affect_to(self, action_name, obj: Union[QtWidgets.QToolBar, QtWidgets.QMenu]):
354
- """Affect action to an object either a toolbar or a menu
355
-
356
- Parameters
357
- ----------
358
- action_name: str
359
- The action name as defined in setup_actions
360
- obj: QToolbar or QMenu
361
- The object where to add the action
362
- """
363
- if isinstance(obj, QtWidgets.QToolBar) or isinstance(obj, QtWidgets.QMenu):
364
- obj.addAction(self._actions[action_name])
365
-
366
- def connect_action(self, name, slot, connect=True, signal_name=''):
367
- """Connect (or disconnect) the action referenced by name to the given slot
368
-
369
- Parameters
370
- ----------
371
- name: str
372
- key of the action as referenced in the self._actions dict
373
- slot: method
374
- a method/function
375
- connect: bool
376
- if True connect the trigger signal of the action to the defined slot else disconnect it
377
- signal_name: str
378
- try to use it as a signal (for widgets added...) otherwise use the *triggered* signal
379
- """
380
- signal = 'triggered'
381
- if name in self._actions:
382
- if hasattr(self._actions[name], signal_name):
383
- signal = signal_name
384
- if connect:
385
- getattr(self._actions[name], signal).connect(slot)
386
- else:
387
- try:
388
- getattr(self._actions[name], signal).disconnect()
389
- except (TypeError,) as e:
390
- pass # the action was not connected
391
- else:
392
- raise KeyError(f'The action with name: {name} is not referenced'
393
- f' in the view actions: {self._actions.keys()}')
394
-
395
- @dispatch(str)
396
- def is_action_visible(self, action_name: str):
397
- """Check the visibility of a given action or the list of an action"""
398
- if action_name in self._actions:
399
- return self._actions[action_name].isVisible()
400
- else:
401
- raise KeyError(f'The action with name: {action_name} is not referenced'
402
- f' in the actions list: {self._actions}')
403
-
404
- @dispatch(list)
405
- def is_action_visible(self, actions_name: list):
406
- """Check the visibility of a given action or the list of an action"""
407
- isvisible = False
408
- for action_name in actions_name:
409
- isvisible = isvisible and self.is_action_visible(action_name)
410
- return isvisible
411
-
412
- @dispatch(str)
413
- def is_action_checked(self, action_name: str):
414
- """Get the CheckState of a given action or a list of actions"""
415
- if action_name in self._actions:
416
- return self._actions[action_name].isChecked()
417
- else:
418
- raise KeyError(f'The action with name: {action_name} is not referenced'
419
- f' in the actions list: {self._actions}')
420
-
421
- @dispatch(list)
422
- def is_action_checked(self, actions_name: list):
423
- """Get the CheckState of a given action or a list of actions"""
424
- ischecked = False
425
- for action_name in actions_name:
426
- ischecked = ischecked and self.is_action_checked(action_name)
427
- return ischecked
428
-
429
- @dispatch(str, bool)
430
- def set_action_visible(self, action_name: str, visible=True):
431
- """Set the visibility of a given action or a list of an action"""
432
- if action_name in self._actions:
433
- self._actions[action_name].setVisible(visible)
434
- else:
435
- raise KeyError(f'The action with name: {action_name} is not referenced'
436
- f' in the actions list: {self._actions}')
437
-
438
- @dispatch(list, bool)
439
- def set_action_visible(self, actions_name: list, visible=True):
440
- """Set the visibility of a given action or a list of an action"""
441
- for action_name in actions_name:
442
- self.set_action_visible(action_name, visible)
443
-
444
- @dispatch(str, bool)
445
- def set_action_checked(self, action_name: str, checked=True):
446
- """Set the CheckedState of a given action or a list of actions"""
447
- if action_name in self._actions:
448
- self._actions[action_name].setChecked(checked)
449
- else:
450
- raise KeyError(f'The action with name: {action_name} is not referenced'
451
- f' in the actions list: {self._actions}')
452
-
453
- @dispatch(list, bool)
454
- def set_action_checked(self, actions_name: list, checked=True):
455
- """Set the CheckedState of a given action or a list of actions"""
456
- for action_name in actions_name:
457
- self.set_action_checked(action_name, checked)
458
-
459
- @dispatch(str, bool)
460
- def set_action_enabled(self, action_name: str, enabled=True):
461
- """Set the EnabledState of a given action or a list of actions"""
462
- if action_name in self._actions:
463
- self._actions[action_name].setEnabled(enabled)
464
- else:
465
- raise KeyError(f'The action with name: {action_name} is not referenced'
466
- f' in the actions list: {self._actions}')
467
-
468
- @dispatch(list, bool)
469
- def set_action_enabled(self, actions_name: list, enabled=True):
470
- """Set the EnabledState of a given action or a list of actions"""
471
- for action_name in actions_name:
472
- self.set_action_enabled(action_name, enabled)
473
-
474
- @dispatch(str)
475
- def is_action_enabled(self, action_name: str):
476
- """Get the EnabledState of a given action or a list of actions"""
477
- if action_name in self._actions:
478
- return self._actions[action_name].isEnabled()
479
- else:
480
- raise KeyError(f'The action with name: {action_name} is not referenced'
481
- f' in the actions list: {self._actions}')
482
-
483
- @dispatch(list)
484
- def is_action_checked(self, actions_name: list):
485
- """Get the EnabledState of a given action or a list of actions"""
486
- is_enabled = False
487
- for action_name in actions_name:
488
- is_enabled = is_enabled and self.is_action_enabled(action_name)
489
- return is_enabled