pymodaq 4.2.4__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 +28 -12
  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 +164 -115
  11. pymodaq/examples/custom_app.py +13 -16
  12. pymodaq/examples/custom_viewer.py +6 -6
  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 -708
  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.4.dist-info → pymodaq-5.0.0.dist-info}/METADATA +5 -3
  76. pymodaq-5.0.0.dist-info/RECORD +123 -0
  77. pymodaq/post_treatment/process_to_scalar.py +0 -263
  78. pymodaq/resources/QtDesigner_Ressources/Icon_Library/1d.png +0 -0
  79. pymodaq/resources/QtDesigner_Ressources/Icon_Library/2d.png +0 -0
  80. pymodaq/resources/QtDesigner_Ressources/Icon_Library/3d.png +0 -0
  81. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Add2.png +0 -0
  82. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Add_Step.png +0 -0
  83. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Approve.png +0 -0
  84. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Approve_All.png +0 -0
  85. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Browse_Dir_Path.png +0 -0
  86. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Calculator.png +0 -0
  87. pymodaq/resources/QtDesigner_Ressources/Icon_Library/ChnGroup.png +0 -0
  88. pymodaq/resources/QtDesigner_Ressources/Icon_Library/ChnNum.png +0 -0
  89. pymodaq/resources/QtDesigner_Ressources/Icon_Library/ChnText.png +0 -0
  90. pymodaq/resources/QtDesigner_Ressources/Icon_Library/ChnTime.png +0 -0
  91. pymodaq/resources/QtDesigner_Ressources/Icon_Library/ChnWave.png +0 -0
  92. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Close3.png +0 -0
  93. pymodaq/resources/QtDesigner_Ressources/Icon_Library/CollapseAll.png +0 -0
  94. pymodaq/resources/QtDesigner_Ressources/Icon_Library/CollapseAll_32.png +0 -0
  95. pymodaq/resources/QtDesigner_Ressources/Icon_Library/ColorPicker.png +0 -0
  96. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Contract.png +0 -0
  97. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Create.png +0 -0
  98. pymodaq/resources/QtDesigner_Ressources/Icon_Library/DeleteLayer.png +0 -0
  99. pymodaq/resources/QtDesigner_Ressources/Icon_Library/EditOpen.png +0 -0
  100. pymodaq/resources/QtDesigner_Ressources/Icon_Library/EditRedo.png +0 -0
  101. pymodaq/resources/QtDesigner_Ressources/Icon_Library/EditUndo.png +0 -0
  102. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Ellipse.png +0 -0
  103. pymodaq/resources/QtDesigner_Ressources/Icon_Library/EllipseFilled.png +0 -0
  104. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Error.png +0 -0
  105. pymodaq/resources/QtDesigner_Ressources/Icon_Library/ErrorMessage.png +0 -0
  106. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Error_16.png +0 -0
  107. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Exit.png +0 -0
  108. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Expand.png +0 -0
  109. pymodaq/resources/QtDesigner_Ressources/Icon_Library/ExpandAll.png +0 -0
  110. pymodaq/resources/QtDesigner_Ressources/Icon_Library/ExpandAll_32.png +0 -0
  111. pymodaq/resources/QtDesigner_Ressources/Icon_Library/FFT.png +0 -0
  112. pymodaq/resources/QtDesigner_Ressources/Icon_Library/HLM.ico +0 -0
  113. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Help.png +0 -0
  114. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Help_32.png +0 -0
  115. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Histogram.png +0 -0
  116. pymodaq/resources/QtDesigner_Ressources/Icon_Library/LUT_LookUpTable.png +0 -0
  117. pymodaq/resources/QtDesigner_Ressources/Icon_Library/MagnifyingGlass.png +0 -0
  118. pymodaq/resources/QtDesigner_Ressources/Icon_Library/MagnifyingGlass_24.png +0 -0
  119. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Marker.png +0 -0
  120. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Math.png +0 -0
  121. pymodaq/resources/QtDesigner_Ressources/Icon_Library/MeasurementStudio_32.png +0 -0
  122. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Move.png +0 -0
  123. pymodaq/resources/QtDesigner_Ressources/Icon_Library/MoveDown.png +0 -0
  124. pymodaq/resources/QtDesigner_Ressources/Icon_Library/MoveUp.png +0 -0
  125. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Multiply.png +0 -0
  126. pymodaq/resources/QtDesigner_Ressources/Icon_Library/NewFile.png +0 -0
  127. pymodaq/resources/QtDesigner_Ressources/Icon_Library/NewLayer.png +0 -0
  128. pymodaq/resources/QtDesigner_Ressources/Icon_Library/New_File.png +0 -0
  129. pymodaq/resources/QtDesigner_Ressources/Icon_Library/New_Folder.png +0 -0
  130. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Open.png +0 -0
  131. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Open_1D.png +0 -0
  132. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Open_2D.png +0 -0
  133. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Open_File.png +0 -0
  134. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Open_File_32.png +0 -0
  135. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Open_sim.png +0 -0
  136. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Options.png +0 -0
  137. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Oscilloscope.png +0 -0
  138. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Oscilloscope_16.png +0 -0
  139. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Pass.png +0 -0
  140. pymodaq/resources/QtDesigner_Ressources/Icon_Library/RGB.png +0 -0
  141. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Rectangle.png +0 -0
  142. pymodaq/resources/QtDesigner_Ressources/Icon_Library/RectangleFilled.png +0 -0
  143. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Redo.png +0 -0
  144. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Refresh.png +0 -0
  145. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Refresh2.png +0 -0
  146. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Refresh_32.png +0 -0
  147. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Region.png +0 -0
  148. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Rendezvous.png +0 -0
  149. pymodaq/resources/QtDesigner_Ressources/Icon_Library/SELECT.png +0 -0
  150. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Save.png +0 -0
  151. pymodaq/resources/QtDesigner_Ressources/Icon_Library/SaveAll.png +0 -0
  152. pymodaq/resources/QtDesigner_Ressources/Icon_Library/SaveAll_32.png +0 -0
  153. pymodaq/resources/QtDesigner_Ressources/Icon_Library/SaveAs.png +0 -0
  154. pymodaq/resources/QtDesigner_Ressources/Icon_Library/SaveAs_32.png +0 -0
  155. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Save_24.png +0 -0
  156. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Save_32.png +0 -0
  157. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Search.png +0 -0
  158. pymodaq/resources/QtDesigner_Ressources/Icon_Library/SelectPolygon.png +0 -0
  159. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Select_24.png +0 -0
  160. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Settings.png +0 -0
  161. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Snap&Save.png +0 -0
  162. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Snapshot.png +0 -0
  163. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Snapshot2.png +0 -0
  164. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Snapshot2_16.png +0 -0
  165. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Snapshot2_32.png +0 -0
  166. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Spreadsheet.png +0 -0
  167. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Statistics.png +0 -0
  168. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Statistics2.png +0 -0
  169. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Status.png +0 -0
  170. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Subtract.png +0 -0
  171. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Vision.png +0 -0
  172. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Volts.png +0 -0
  173. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Wait2.png +0 -0
  174. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Zoom_1_1.png +0 -0
  175. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Zoom_in.png +0 -0
  176. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Zoom_out.png +0 -0
  177. pymodaq/resources/QtDesigner_Ressources/Icon_Library/Zoom_to_Selection.png +0 -0
  178. pymodaq/resources/QtDesigner_Ressources/Icon_Library/abort.png +0 -0
  179. pymodaq/resources/QtDesigner_Ressources/Icon_Library/advanced2.png +0 -0
  180. pymodaq/resources/QtDesigner_Ressources/Icon_Library/autoscale.png +0 -0
  181. pymodaq/resources/QtDesigner_Ressources/Icon_Library/b_icon.png +0 -0
  182. pymodaq/resources/QtDesigner_Ressources/Icon_Library/back.png +0 -0
  183. pymodaq/resources/QtDesigner_Ressources/Icon_Library/bg_icon.png +0 -0
  184. pymodaq/resources/QtDesigner_Ressources/Icon_Library/camera.png +0 -0
  185. pymodaq/resources/QtDesigner_Ressources/Icon_Library/camera_snap.png +0 -0
  186. pymodaq/resources/QtDesigner_Ressources/Icon_Library/cartesian.png +0 -0
  187. pymodaq/resources/QtDesigner_Ressources/Icon_Library/clear2.png +0 -0
  188. pymodaq/resources/QtDesigner_Ressources/Icon_Library/clear_ROI.png +0 -0
  189. pymodaq/resources/QtDesigner_Ressources/Icon_Library/close2.png +0 -0
  190. pymodaq/resources/QtDesigner_Ressources/Icon_Library/cluster2.png +0 -0
  191. pymodaq/resources/QtDesigner_Ressources/Icon_Library/color.png +0 -0
  192. pymodaq/resources/QtDesigner_Ressources/Icon_Library/color2.png +0 -0
  193. pymodaq/resources/QtDesigner_Ressources/Icon_Library/continuous.png +0 -0
  194. pymodaq/resources/QtDesigner_Ressources/Icon_Library/data.png +0 -0
  195. pymodaq/resources/QtDesigner_Ressources/Icon_Library/delay.png +0 -0
  196. pymodaq/resources/QtDesigner_Ressources/Icon_Library/download.png +0 -0
  197. pymodaq/resources/QtDesigner_Ressources/Icon_Library/download2.png +0 -0
  198. pymodaq/resources/QtDesigner_Ressources/Icon_Library/error2.png +0 -0
  199. pymodaq/resources/QtDesigner_Ressources/Icon_Library/ethernet.png +0 -0
  200. pymodaq/resources/QtDesigner_Ressources/Icon_Library/exit2.png +0 -0
  201. pymodaq/resources/QtDesigner_Ressources/Icon_Library/fan.png +0 -0
  202. pymodaq/resources/QtDesigner_Ressources/Icon_Library/filter2.png +0 -0
  203. pymodaq/resources/QtDesigner_Ressources/Icon_Library/g_icon.png +0 -0
  204. pymodaq/resources/QtDesigner_Ressources/Icon_Library/gear2.png +0 -0
  205. pymodaq/resources/QtDesigner_Ressources/Icon_Library/go_to.png +0 -0
  206. pymodaq/resources/QtDesigner_Ressources/Icon_Library/go_to_1.png +0 -0
  207. pymodaq/resources/QtDesigner_Ressources/Icon_Library/go_to_2.png +0 -0
  208. pymodaq/resources/QtDesigner_Ressources/Icon_Library/grab.png +0 -0
  209. pymodaq/resources/QtDesigner_Ressources/Icon_Library/graph.png +0 -0
  210. pymodaq/resources/QtDesigner_Ressources/Icon_Library/greenLight2.png +0 -0
  211. pymodaq/resources/QtDesigner_Ressources/Icon_Library/greenLight2_32.png +0 -0
  212. pymodaq/resources/QtDesigner_Ressources/Icon_Library/green_light.png +0 -0
  213. pymodaq/resources/QtDesigner_Ressources/Icon_Library/grey_icon.png +0 -0
  214. pymodaq/resources/QtDesigner_Ressources/Icon_Library/greyscale.png +0 -0
  215. pymodaq/resources/QtDesigner_Ressources/Icon_Library/help1.png +0 -0
  216. pymodaq/resources/QtDesigner_Ressources/Icon_Library/help1_32.png +0 -0
  217. pymodaq/resources/QtDesigner_Ressources/Icon_Library/home2.png +0 -0
  218. pymodaq/resources/QtDesigner_Ressources/Icon_Library/information2.png +0 -0
  219. pymodaq/resources/QtDesigner_Ressources/Icon_Library/ini.png +0 -0
  220. pymodaq/resources/QtDesigner_Ressources/Icon_Library/integrator.png +0 -0
  221. pymodaq/resources/QtDesigner_Ressources/Icon_Library/joystick.png +0 -0
  222. pymodaq/resources/QtDesigner_Ressources/Icon_Library/light_green.png +0 -0
  223. pymodaq/resources/QtDesigner_Ressources/Icon_Library/light_green_16.png +0 -0
  224. pymodaq/resources/QtDesigner_Ressources/Icon_Library/light_red.png +0 -0
  225. pymodaq/resources/QtDesigner_Ressources/Icon_Library/light_red_16.png +0 -0
  226. pymodaq/resources/QtDesigner_Ressources/Icon_Library/light_yellow.png +0 -0
  227. pymodaq/resources/QtDesigner_Ressources/Icon_Library/light_yellow_16.png +0 -0
  228. pymodaq/resources/QtDesigner_Ressources/Icon_Library/limiter.png +0 -0
  229. pymodaq/resources/QtDesigner_Ressources/Icon_Library/load_ROI.png +0 -0
  230. pymodaq/resources/QtDesigner_Ressources/Icon_Library/meshPlot.png +0 -0
  231. pymodaq/resources/QtDesigner_Ressources/Icon_Library/meter.png +0 -0
  232. pymodaq/resources/QtDesigner_Ressources/Icon_Library/meter2.png +0 -0
  233. pymodaq/resources/QtDesigner_Ressources/Icon_Library/meter_32.png +0 -0
  234. pymodaq/resources/QtDesigner_Ressources/Icon_Library/move_contour.png +0 -0
  235. pymodaq/resources/QtDesigner_Ressources/Icon_Library/move_straight_line.png +0 -0
  236. pymodaq/resources/QtDesigner_Ressources/Icon_Library/movie.png +0 -0
  237. pymodaq/resources/QtDesigner_Ressources/Icon_Library/multi_point.png +0 -0
  238. pymodaq/resources/QtDesigner_Ressources/Icon_Library/multiplexer.png +0 -0
  239. pymodaq/resources/QtDesigner_Ressources/Icon_Library/new.png +0 -0
  240. pymodaq/resources/QtDesigner_Ressources/Icon_Library/openArrow.png +0 -0
  241. pymodaq/resources/QtDesigner_Ressources/Icon_Library/openTree.png +0 -0
  242. pymodaq/resources/QtDesigner_Ressources/Icon_Library/oscilloscope2.png +0 -0
  243. pymodaq/resources/QtDesigner_Ressources/Icon_Library/oscilloscope3.png +0 -0
  244. pymodaq/resources/QtDesigner_Ressources/Icon_Library/overlay.png +0 -0
  245. pymodaq/resources/QtDesigner_Ressources/Icon_Library/pass2.png +0 -0
  246. pymodaq/resources/QtDesigner_Ressources/Icon_Library/pass2_16.png +0 -0
  247. pymodaq/resources/QtDesigner_Ressources/Icon_Library/pass_32.png +0 -0
  248. pymodaq/resources/QtDesigner_Ressources/Icon_Library/pause.png +0 -0
  249. pymodaq/resources/QtDesigner_Ressources/Icon_Library/permute.png +0 -0
  250. pymodaq/resources/QtDesigner_Ressources/Icon_Library/phase.png +0 -0
  251. pymodaq/resources/QtDesigner_Ressources/Icon_Library/play.png +0 -0
  252. pymodaq/resources/QtDesigner_Ressources/Icon_Library/polar.png +0 -0
  253. pymodaq/resources/QtDesigner_Ressources/Icon_Library/pole_zero.png +0 -0
  254. pymodaq/resources/QtDesigner_Ressources/Icon_Library/powerMeter.png +0 -0
  255. pymodaq/resources/QtDesigner_Ressources/Icon_Library/powerSwitch.png +0 -0
  256. pymodaq/resources/QtDesigner_Ressources/Icon_Library/powerSwitch_16.png +0 -0
  257. pymodaq/resources/QtDesigner_Ressources/Icon_Library/print2.png +0 -0
  258. pymodaq/resources/QtDesigner_Ressources/Icon_Library/print2_32.png +0 -0
  259. pymodaq/resources/QtDesigner_Ressources/Icon_Library/properties.png +0 -0
  260. pymodaq/resources/QtDesigner_Ressources/Icon_Library/r_icon.png +0 -0
  261. pymodaq/resources/QtDesigner_Ressources/Icon_Library/radiocontrolbutton.png +0 -0
  262. pymodaq/resources/QtDesigner_Ressources/Icon_Library/read2.png +0 -0
  263. pymodaq/resources/QtDesigner_Ressources/Icon_Library/red_light.png +0 -0
  264. pymodaq/resources/QtDesigner_Ressources/Icon_Library/remove.png +0 -0
  265. pymodaq/resources/QtDesigner_Ressources/Icon_Library/reset.png +0 -0
  266. pymodaq/resources/QtDesigner_Ressources/Icon_Library/rgb_icon.png +0 -0
  267. pymodaq/resources/QtDesigner_Ressources/Icon_Library/robot.png +0 -0
  268. pymodaq/resources/QtDesigner_Ressources/Icon_Library/rotation2.png +0 -0
  269. pymodaq/resources/QtDesigner_Ressources/Icon_Library/run2.png +0 -0
  270. pymodaq/resources/QtDesigner_Ressources/Icon_Library/run_all.png +0 -0
  271. pymodaq/resources/QtDesigner_Ressources/Icon_Library/saturation.png +0 -0
  272. pymodaq/resources/QtDesigner_Ressources/Icon_Library/saveTree.png +0 -0
  273. pymodaq/resources/QtDesigner_Ressources/Icon_Library/save_ROI.png +0 -0
  274. pymodaq/resources/QtDesigner_Ressources/Icon_Library/scale_horizontally.png +0 -0
  275. pymodaq/resources/QtDesigner_Ressources/Icon_Library/scale_vertically.png +0 -0
  276. pymodaq/resources/QtDesigner_Ressources/Icon_Library/search2.png +0 -0
  277. pymodaq/resources/QtDesigner_Ressources/Icon_Library/select2.png +0 -0
  278. pymodaq/resources/QtDesigner_Ressources/Icon_Library/select_all.png +0 -0
  279. pymodaq/resources/QtDesigner_Ressources/Icon_Library/select_all2.png +0 -0
  280. pymodaq/resources/QtDesigner_Ressources/Icon_Library/select_none.png +0 -0
  281. pymodaq/resources/QtDesigner_Ressources/Icon_Library/sequence.png +0 -0
  282. pymodaq/resources/QtDesigner_Ressources/Icon_Library/sequence2.png +0 -0
  283. pymodaq/resources/QtDesigner_Ressources/Icon_Library/snap.png +0 -0
  284. pymodaq/resources/QtDesigner_Ressources/Icon_Library/sort_ascend.png +0 -0
  285. pymodaq/resources/QtDesigner_Ressources/Icon_Library/spectrumAnalyzer.png +0 -0
  286. pymodaq/resources/QtDesigner_Ressources/Icon_Library/start.png +0 -0
  287. pymodaq/resources/QtDesigner_Ressources/Icon_Library/status_cancelled.png +0 -0
  288. pymodaq/resources/QtDesigner_Ressources/Icon_Library/stop.png +0 -0
  289. pymodaq/resources/QtDesigner_Ressources/Icon_Library/stop2.png +0 -0
  290. pymodaq/resources/QtDesigner_Ressources/Icon_Library/stop3.png +0 -0
  291. pymodaq/resources/QtDesigner_Ressources/Icon_Library/stop_all.png +0 -0
  292. pymodaq/resources/QtDesigner_Ressources/Icon_Library/sum.png +0 -0
  293. pymodaq/resources/QtDesigner_Ressources/Icon_Library/surfacePlot.png +0 -0
  294. pymodaq/resources/QtDesigner_Ressources/Icon_Library/tree.png +0 -0
  295. pymodaq/resources/QtDesigner_Ressources/Icon_Library/updateTree.png +0 -0
  296. pymodaq/resources/QtDesigner_Ressources/Icon_Library/utility2.png +0 -0
  297. pymodaq/resources/QtDesigner_Ressources/Icon_Library/utility_small.png +0 -0
  298. pymodaq/resources/QtDesigner_Ressources/Icon_Library/vector.png +0 -0
  299. pymodaq/resources/QtDesigner_Ressources/Icon_Library/verify.png +0 -0
  300. pymodaq/resources/QtDesigner_Ressources/Icon_Library/video.png +0 -0
  301. pymodaq/resources/QtDesigner_Ressources/Icon_Library/wait.png +0 -0
  302. pymodaq/resources/QtDesigner_Ressources/Icon_Library/waterfallPlot.png +0 -0
  303. pymodaq/resources/QtDesigner_Ressources/Icon_Library/watershed.png +0 -0
  304. pymodaq/resources/QtDesigner_Ressources/Icon_Library/yellow_light.png +0 -0
  305. pymodaq/resources/QtDesigner_Ressources/Icon_Library/zip_file.png +0 -0
  306. pymodaq/resources/QtDesigner_Ressources/Icon_Library/zoomAuto.png +0 -0
  307. pymodaq/resources/QtDesigner_Ressources/Icon_Library/zoomReset.png +0 -0
  308. pymodaq/resources/QtDesigner_Ressources/QtDesigner_ressources.bat +0 -2
  309. pymodaq/resources/QtDesigner_Ressources/QtDesigner_ressources.qrc +0 -234
  310. pymodaq/resources/QtDesigner_Ressources/QtDesigner_ressources_rc.py +0 -127150
  311. pymodaq/resources/QtDesigner_Ressources/icons.svg +0 -142
  312. pymodaq/resources/VERSION +0 -1
  313. pymodaq/resources/config_template.toml +0 -94
  314. pymodaq/resources/triangulation_data.npy +0 -0
  315. pymodaq/utils/abstract/__init__.py +0 -48
  316. pymodaq/utils/db/__init__.py +0 -0
  317. pymodaq/utils/db/db_logger/__init__.py +0 -0
  318. pymodaq/utils/enums.py +0 -76
  319. pymodaq/utils/factory.py +0 -82
  320. pymodaq/utils/gui_utils/custom_app.py +0 -133
  321. pymodaq/utils/gui_utils/dock.py +0 -107
  322. pymodaq/utils/gui_utils/file_io.py +0 -93
  323. pymodaq/utils/gui_utils/layout.py +0 -34
  324. pymodaq/utils/gui_utils/list_picker.py +0 -38
  325. pymodaq/utils/gui_utils/widgets/__init__.py +0 -5
  326. pymodaq/utils/gui_utils/widgets/label.py +0 -24
  327. pymodaq/utils/gui_utils/widgets/lcd.py +0 -111
  328. pymodaq/utils/gui_utils/widgets/push.py +0 -149
  329. pymodaq/utils/gui_utils/widgets/qled.py +0 -62
  330. pymodaq/utils/gui_utils/widgets/spinbox.py +0 -24
  331. pymodaq/utils/gui_utils/widgets/table.py +0 -263
  332. pymodaq/utils/gui_utils/widgets/tree_layout.py +0 -188
  333. pymodaq/utils/gui_utils/widgets/tree_toml.py +0 -102
  334. pymodaq/utils/h5modules/backends.py +0 -1022
  335. pymodaq/utils/h5modules/browsing.py +0 -625
  336. pymodaq/utils/h5modules/data_saving.py +0 -1105
  337. pymodaq/utils/h5modules/exporter.py +0 -119
  338. pymodaq/utils/h5modules/exporters/__init__.py +0 -0
  339. pymodaq/utils/h5modules/exporters/base.py +0 -111
  340. pymodaq/utils/h5modules/exporters/flimj.py +0 -63
  341. pymodaq/utils/h5modules/exporters/hyperspy.py +0 -143
  342. pymodaq/utils/h5modules/saving.py +0 -866
  343. pymodaq/utils/h5modules/utils.py +0 -115
  344. pymodaq/utils/managers/action_manager.py +0 -489
  345. pymodaq/utils/managers/parameter_manager.py +0 -282
  346. pymodaq/utils/managers/roi_manager.py +0 -726
  347. pymodaq/utils/messenger.py +0 -66
  348. pymodaq/utils/parameter/ioxml.py +0 -542
  349. pymodaq/utils/parameter/pymodaq_ptypes/__init__.py +0 -38
  350. pymodaq/utils/parameter/pymodaq_ptypes/bool.py +0 -31
  351. pymodaq/utils/parameter/pymodaq_ptypes/date.py +0 -126
  352. pymodaq/utils/parameter/pymodaq_ptypes/filedir.py +0 -143
  353. pymodaq/utils/parameter/pymodaq_ptypes/itemselect.py +0 -265
  354. pymodaq/utils/parameter/pymodaq_ptypes/led.py +0 -44
  355. pymodaq/utils/parameter/pymodaq_ptypes/list.py +0 -150
  356. pymodaq/utils/parameter/pymodaq_ptypes/numeric.py +0 -18
  357. pymodaq/utils/parameter/pymodaq_ptypes/pixmap.py +0 -175
  358. pymodaq/utils/parameter/pymodaq_ptypes/slide.py +0 -145
  359. pymodaq/utils/parameter/pymodaq_ptypes/table.py +0 -135
  360. pymodaq/utils/parameter/pymodaq_ptypes/tableview.py +0 -149
  361. pymodaq/utils/parameter/pymodaq_ptypes/text.py +0 -142
  362. pymodaq/utils/plotting/__init__.py +0 -0
  363. pymodaq/utils/plotting/data_viewers/__init__.py +0 -10
  364. pymodaq/utils/plotting/data_viewers/base.py +0 -286
  365. pymodaq/utils/plotting/data_viewers/viewer.py +0 -274
  366. pymodaq/utils/plotting/data_viewers/viewer0D.py +0 -298
  367. pymodaq/utils/plotting/data_viewers/viewer1D.py +0 -826
  368. pymodaq/utils/plotting/data_viewers/viewer1Dbasic.py +0 -231
  369. pymodaq/utils/plotting/data_viewers/viewer2D.py +0 -1118
  370. pymodaq/utils/plotting/data_viewers/viewer2D_basic.py +0 -146
  371. pymodaq/utils/plotting/data_viewers/viewerND.py +0 -800
  372. pymodaq/utils/plotting/gant_chart.py +0 -123
  373. pymodaq/utils/plotting/image_viewer.py +0 -97
  374. pymodaq/utils/plotting/items/__init__.py +0 -0
  375. pymodaq/utils/plotting/items/axis_scaled.py +0 -93
  376. pymodaq/utils/plotting/items/crosshair.py +0 -94
  377. pymodaq/utils/plotting/items/image.py +0 -388
  378. pymodaq/utils/plotting/navigator.py +0 -353
  379. pymodaq/utils/plotting/plotter/plotter.py +0 -94
  380. pymodaq/utils/plotting/plotter/plotters/__init__.py +0 -0
  381. pymodaq/utils/plotting/plotter/plotters/matplotlib_plotters.py +0 -134
  382. pymodaq/utils/plotting/plotter/plotters/qt_plotters.py +0 -78
  383. pymodaq/utils/plotting/utils/__init__.py +0 -0
  384. pymodaq/utils/plotting/utils/axes_viewer.py +0 -88
  385. pymodaq/utils/plotting/utils/filter.py +0 -585
  386. pymodaq/utils/plotting/utils/lineout.py +0 -226
  387. pymodaq/utils/plotting/utils/plot_utils.py +0 -579
  388. pymodaq/utils/plotting/utils/signalND.py +0 -1347
  389. pymodaq/utils/plotting/widgets.py +0 -76
  390. pymodaq/utils/qvariant.py +0 -12
  391. pymodaq/utils/slicing.py +0 -63
  392. pymodaq/utils/units.py +0 -216
  393. pymodaq-4.2.4.dist-info/RECORD +0 -438
  394. /pymodaq/{post_treatment/daq_analysis → extensions/daq_logger}/__init__.py +0 -0
  395. /pymodaq/{utils/abstract/logger.py → extensions/daq_logger/abstract.py} +0 -0
  396. /pymodaq/{resources/QtDesigner_Ressources → extensions/daq_logger/db}/__init__.py +0 -0
  397. {pymodaq-4.2.4.dist-info → pymodaq-5.0.0.dist-info}/WHEEL +0 -0
  398. {pymodaq-4.2.4.dist-info → pymodaq-5.0.0.dist-info}/entry_points.txt +0 -0
  399. {pymodaq-4.2.4.dist-info → pymodaq-5.0.0.dist-info}/licenses/LICENSE +0 -0
@@ -1,66 +0,0 @@
1
- import warnings
2
- from qtpy import QtWidgets, QtCore
3
-
4
-
5
- def deprecation_msg(message, stacklevel=2):
6
- warnings.warn(message, DeprecationWarning, stacklevel=stacklevel)
7
-
8
-
9
- def user_warning(message, stacklevel=3):
10
- warnings.warn(message, UserWarning, stacklevel=stacklevel)
11
-
12
-
13
- MESSAGE_SEVERITIES = ['critical', 'information', 'question', 'warning']
14
-
15
-
16
- def messagebox(severity='warning', title='this is a title', text='blabla'):
17
- """
18
- Display a popup messagebox with a given severity
19
- Parameters
20
- ----------
21
- severity: (str) one in ['critical', 'information', 'question', 'warning']
22
- title: (str) the displayed popup title
23
- text: (str) the displayed text in the message
24
-
25
- Returns
26
- -------
27
- bool: True if the user clicks on Ok
28
- """
29
- assert severity in MESSAGE_SEVERITIES
30
- messbox = getattr(QtWidgets.QMessageBox, severity)
31
- ret = messbox(None, title, text)
32
- return ret == QtWidgets.QMessageBox.Ok
33
-
34
-
35
- def dialog(title='', message='', widget=None):
36
- dlg = QtWidgets.QDialog()
37
- dlg.setWindowTitle(title)
38
- dlg.setLayout(QtWidgets.QVBoxLayout())
39
- label = QtWidgets.QLabel(message)
40
- label.setAlignment(QtCore.Qt.AlignCenter)
41
- dlg.layout().addWidget(label)
42
- dlg.layout().addWidget(widget)
43
- button_box = QtWidgets.QDialogButtonBox(QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel)
44
- dlg.layout().addWidget(button_box)
45
- button_box.accepted.connect(dlg.accept)
46
- button_box.rejected.connect(dlg.reject)
47
- ret = dlg.exec()
48
- return ret
49
-
50
-
51
- def show_message(message="blabla", title="Error"):
52
- DeprecationWarning('Using show_message is deprecated, please use messagebox in daq_utils.messenger module')
53
- messagebox('Warning', title=title, text=message)
54
-
55
-
56
- if __name__ == '__main__':
57
- import sys
58
- from pymodaq.utils.plotting.data_viewers.viewer1D import Viewer1D
59
- app = QtWidgets.QApplication([])
60
- widget = QtWidgets.QWidget()
61
- viewer = Viewer1D(widget)
62
- ret = dialog('my dialog', 'this is a dialog do you want to proceed', widget)
63
- print(ret)
64
- sys.exit(app.exec_())
65
-
66
-
@@ -1,542 +0,0 @@
1
- from typing import Union
2
- from pathlib import Path
3
-
4
- import importlib
5
- import json
6
- from pathlib import Path
7
- from xml.etree import ElementTree as ET
8
- from collections import OrderedDict
9
- from qtpy import QtGui
10
- from qtpy.QtCore import QDateTime
11
- from pymodaq.utils.parameter import Parameter
12
-
13
- from pyqtgraph.parametertree.Parameter import PARAM_TYPES, PARAM_NAMES
14
-
15
- def walk_parameters_to_xml(parent_elt=None, param=None):
16
- """
17
- To convert a parameter object (and children) to xml data tree.
18
-
19
- =============== ================================ ==================================
20
- **Parameters** **Type** **Description**
21
-
22
- *parent_elt* XML element the root element
23
- *param* instance of pyqtgraph parameter Parameter object to be converted
24
- =============== ================================ ==================================
25
-
26
- Returns
27
- -------
28
- XML element : parent_elt
29
- XML element with subelements from Parameter object
30
-
31
- See Also
32
- --------
33
- add_text_to_elt, walk_parameters_to_xml, dict_from_param
34
-
35
- """
36
-
37
- if type(param) is None:
38
- raise TypeError('No valid param input')
39
-
40
- if parent_elt is None:
41
- opts = dict_from_param(param)
42
- parent_elt = ET.Element(param.name(), **opts)
43
- param_type = str(param.type())
44
- if 'group' not in param_type: # covers 'group', custom 'groupmove', 'groupai' ...
45
- add_text_to_elt(parent_elt, param)
46
-
47
- params_list = param.children()
48
- for param in params_list:
49
-
50
- opts = dict_from_param(param)
51
- elt = ET.Element(param.name(), **opts)
52
- param_type = str(param.type())
53
- if 'group' not in param_type: # covers 'group', custom 'groupmove'...
54
- add_text_to_elt(elt, param)
55
- else:
56
- walk_parameters_to_xml(elt, param)
57
-
58
- parent_elt.append(elt)
59
- return parent_elt
60
-
61
-
62
- def add_text_to_elt(elt, param):
63
- """Add a text filed in a xml element corresponding to the parameter value
64
-
65
- Parameters
66
- ----------
67
- elt: XML elt
68
- param: Parameter
69
-
70
- See Also
71
- --------
72
- add_text_to_elt, walk_parameters_to_xml, dict_from_param
73
- """
74
- param_type = str(param.type())
75
- if 'bool' in param_type or 'led' in param_type:
76
- if param.value():
77
- text = '1'
78
- else:
79
- text = '0'
80
- elif param_type == 'itemselect':
81
- if param.value() is not None:
82
- elt.set('all_items',
83
- str(param.value()['all_items'])) # use list(eval(val_str[1:-1])) to get back a list of strings
84
- text = str(param.value()['selected']) # use list(eval(val_str[1:-1])) to get back a list of strings
85
- else:
86
- text = str(None)
87
- elif param_type == 'color':
88
- text = str([param.value().red(), param.value().green(), param.value().blue(), param.value().alpha()])
89
- elif param_type == 'list':
90
- if isinstance(param.value(), str):
91
- text = "str('{}')".format(param.value())
92
- elif isinstance(param.value(), int):
93
- text = 'int({})'.format(param.value())
94
- elif isinstance(param.value(), float):
95
- text = 'float({})'.format(param.value())
96
- else:
97
- text = str(param.value())
98
- elif param_type == 'int':
99
- if param.value() is True: # known bug is True should be clearly specified here
100
- val = 1
101
- else:
102
- val = param.value()
103
- text = str(val)
104
- elif param_type == 'date_time':
105
- text = str(param.value().toMSecsSinceEpoch())
106
- elif param_type == 'date':
107
- text = str(QDateTime(param.value()).toMSecsSinceEpoch())
108
- elif param_type == 'table_view':
109
- try:
110
- data = dict(classname=param.value().__class__.__name__,
111
- module=param.value().__class__.__module__,
112
- data=param.value().get_data_all(),
113
- header=param.value().header)
114
- text = json.dumps(data)
115
- except Exception:
116
- text = ''
117
- else:
118
- text = str(param.value())
119
- elt.text = text
120
-
121
-
122
- def dict_from_param(param):
123
- """Get Parameter properties as a dictionary
124
-
125
- Parameters
126
- ----------
127
- param: Parameter
128
-
129
- Returns
130
- -------
131
- opts: dict
132
-
133
- See Also
134
- --------
135
- add_text_to_elt, walk_parameters_to_xml, dict_from_param
136
- """
137
- opts = dict([])
138
- param_type = str(param.type())
139
- opts.update(dict(type=param_type))
140
- title = param.opts['title']
141
- if title is None:
142
- title = param.name()
143
- opts.update(dict(title=title))
144
-
145
- visible = '1'
146
- if 'visible' in param.opts:
147
- if param.opts['visible']:
148
- visible = '1'
149
- else:
150
- visible = '0'
151
-
152
- opts.update(dict(visible=visible))
153
-
154
- removable = '1'
155
- if 'removable' in param.opts:
156
- if param.opts['removable']:
157
- removable = '1'
158
- else:
159
- removable = '0'
160
- opts.update(dict(removable=removable))
161
-
162
- readonly = '0'
163
- if 'readonly' in param.opts:
164
- if param.opts['readonly']:
165
- readonly = '1'
166
- else:
167
- readonly = '0'
168
- opts.update(dict(readonly=readonly))
169
-
170
- # if 'limits' in param.opts:
171
- # values = str(param.opts['limits'])
172
- # opts.update(dict(values=values))
173
-
174
- if 'limits' in param.opts:
175
- limits = str(param.opts['limits'])
176
- opts.update(dict(limits=limits))
177
- # opts.update(dict(values=limits))
178
-
179
- if 'addList' in param.opts:
180
- addList = str(param.opts['addList'])
181
- opts.update(dict(addList=addList))
182
-
183
- if 'addText' in param.opts:
184
- addText = str(param.opts['addText'])
185
- opts.update(dict(addText=addText))
186
-
187
- if 'detlist' in param.opts:
188
- detlist = str(param.opts['detlist'])
189
- opts.update(dict(detlist=detlist))
190
-
191
- if 'movelist' in param.opts:
192
- movelist = str(param.opts['movelist'])
193
- opts.update(dict(movelist=movelist))
194
-
195
- if 'show_pb' in param.opts:
196
- if param.opts['show_pb']:
197
- show_pb = '1'
198
- else:
199
- show_pb = '0'
200
- opts.update(dict(show_pb=show_pb))
201
-
202
- if 'filetype' in param.opts:
203
- if param.opts['filetype']:
204
- filetype = '1'
205
- else:
206
- filetype = '0'
207
- opts.update(dict(filetype=filetype))
208
-
209
- return opts
210
-
211
-
212
- def elt_to_dict(el):
213
- """Convert xml element attributes to a dictionnary
214
-
215
- Parameters
216
- ----------
217
- el
218
-
219
- Returns
220
- -------
221
-
222
- """
223
- param = dict([])
224
-
225
- # name=el.tag, title=title, type=param_type, value=param_value, values=[param_value],
226
- # visible=visible, removable=removable, readonly=readonly, show_pb=show_pb)
227
- param.update(dict(name=el.tag))
228
- param_type = el.get('type')
229
- param.update(dict(type=param_type))
230
-
231
- title = el.get('title')
232
- if title == 'None':
233
- title = el.tag
234
- param.update(dict(title=title))
235
-
236
- if 'visible' not in el.attrib.keys():
237
- visible = True
238
- else:
239
- visible = bool(int(el.get('visible')))
240
- param.update(dict(visible=visible))
241
-
242
- if 'removable' not in el.attrib.keys():
243
- removable = False
244
- else:
245
- removable = bool(int(el.get('removable')))
246
- param.update(dict(removable=removable))
247
-
248
- if 'readonly' not in el.attrib.keys():
249
- readonly = False
250
- else:
251
- readonly = bool(int(el.get('readonly')))
252
- param.update(dict(readonly=readonly))
253
-
254
- if 'show_pb' in el.attrib.keys():
255
- show_pb = bool(int(el.get('show_pb')))
256
- else:
257
- show_pb = False
258
- param.update(dict(show_pb=show_pb))
259
-
260
- if 'filetype' in el.attrib.keys():
261
- filetype = bool(int(el.get('filetype')))
262
- param.update(dict(filetype=filetype))
263
-
264
- if 'detlist' in el.attrib.keys():
265
- detlist = eval(el.get('detlist'))
266
- param.update(dict(detlist=detlist))
267
-
268
- if 'movelist' in el.attrib.keys():
269
- movelist = eval(el.get('movelist'))
270
- param.update(dict(movelist=movelist))
271
-
272
- if 'addList' in el.attrib.keys():
273
- addList = eval(el.get('addList'))
274
- param.update(dict(addList=addList))
275
-
276
- if 'addText' in el.attrib.keys():
277
- addText = str(el.get('addText'))
278
- param.update(dict(addText=addText))
279
-
280
- # if 'limits' in el.attrib.keys():
281
- # try:
282
- # values = list(eval(el.get('limits'))) # make sure the evaluated values are returned as list (in case another
283
- # # iterator type has been used
284
- # param.update(dict(values=values))
285
- # except:
286
- # pass
287
-
288
- if 'limits' in el.attrib.keys():
289
- try:
290
- limits = eval(el.get('limits'))
291
- param.update(dict(limits=limits))
292
- except:
293
- pass
294
-
295
- return param
296
-
297
-
298
- def parameter_to_xml_string(param):
299
- """ Convert a Parameter to a XML string.
300
-
301
- Parameters
302
- ----------
303
- param: Parameter
304
-
305
- Returns
306
- -------
307
- str: XMl string
308
-
309
- See Also
310
- --------
311
- add_text_to_elt, walk_parameters_to_xml, dict_from_param
312
-
313
- Examples
314
- --------
315
- >>> from pyqtgraph.parametertree import Parameter
316
- >>> #Create an instance of Parameter
317
- >>> settings=Parameter(name='settings')
318
- >>> converted_xml=parameter_to_xml_string(settings)
319
- >>> # The converted Parameter
320
- >>> print(converted_xml)
321
- b'<settings title="settings" type="None" />'
322
- """
323
- xml_elt = walk_parameters_to_xml(param=param)
324
- return ET.tostring(xml_elt)
325
-
326
-
327
- def parameter_to_xml_file(param, filename: Union[str, Path]):
328
- """
329
- Convert the given parameter to XML element and update the given XML file.
330
-
331
- =============== ================================= ================================
332
- **Parameters** **Type** **Description**
333
- *param* instance of pyqtgraph parameter the parameter to be added
334
- *filename* string the filename of the XML file
335
- =============== ================================= ================================
336
-
337
- See Also
338
- --------
339
- walk_parameters_to_xml
340
-
341
- Examples
342
- --------
343
- """
344
- if not isinstance(filename, Path):
345
- filename = Path(filename)
346
- parent = filename.parent
347
- filename = filename.stem
348
- fname = parent.joinpath(filename + ".xml") # forcing the right extension on the filename
349
- xml_elt = walk_parameters_to_xml(param=param)
350
- tree = ET.ElementTree(xml_elt)
351
- tree.write(str(fname))
352
-
353
-
354
- def walk_xml_to_parameter(params=[], XML_elt=None):
355
- """ To convert an XML element (and children) to list of dict enabling creation of parameter object.
356
-
357
- =============== ================== =======================================
358
- **Parameters** **Type** **Description**
359
-
360
- *params* dictionnary list the list to create parameter object
361
- *XML_elt* XML object the XML object to be converted
362
- =============== ================== =======================================
363
-
364
- Returns
365
- -------
366
- params : dictionnary list
367
- list of dict to create parameter object
368
-
369
- Examples
370
- -------
371
- >>> from pyqtgraph.parametertree import Parameter, ParameterItem
372
- >>> import xml.etree.ElementTree as ET
373
- >>> tree = ET.parse('text_bis.xml')
374
- >>> root = tree.getroot()
375
- >>> params=walk_xml_to_parameter(XML_elt=root)
376
- >>> settings_xml=Parameter.create(name='Settings XML', type='group', children=params)
377
- >>> settings=Parameter.create(name='Settings', type='group', children=params)
378
-
379
- See Also
380
- --------
381
- walk_parameters_to_xml
382
- """
383
- try:
384
- if type(XML_elt) is not ET.Element:
385
- raise TypeError('not valid XML element')
386
-
387
- if len(XML_elt) == 0:
388
- param_dict = elt_to_dict(XML_elt)
389
- param_type = XML_elt.get('type')
390
-
391
- if 'group' not in param_type: # covers 'group', custom 'groupmove'...
392
- set_txt_from_elt(XML_elt, param_dict)
393
- params.append(param_dict)
394
-
395
- for el in XML_elt:
396
- param_dict = elt_to_dict(el)
397
- param_type = el.get('type')
398
-
399
- if 'group' not in param_type: # covers 'group', custom 'groupmove'...
400
- set_txt_from_elt(el, param_dict)
401
- else:
402
- if param_type not in PARAM_TYPES:
403
- param_dict['type'] = 'group' # in case the custom group has been defined somewhere but not
404
- # registered again in this session
405
- if len(el) == 0:
406
- children = []
407
- else:
408
- subparams = []
409
- children = walk_xml_to_parameter(subparams, el)
410
- param_dict['children'] = children
411
-
412
- param_dict['name'] = el.tag
413
-
414
- params.append(param_dict)
415
- except Exception as e: # to be able to debug when there's an issue
416
- raise e
417
- return params
418
-
419
-
420
- def set_txt_from_elt(el, param_dict):
421
- """
422
- get the value of the parameter from the text value of the xml element
423
- Parameters
424
- ----------
425
- el: xml element
426
- param_dict: dictionnary from which the parameter will be constructed
427
-
428
- """
429
- val_text = el.text
430
- param_type = el.get('type')
431
- if val_text is not None:
432
- if param_type == 'float':
433
- param_value = float(val_text)
434
- elif param_type == 'int':
435
- param_value = int(float(val_text))
436
- elif param_type == 'slide':
437
- param_value = float(val_text)
438
- elif param_type == 'itemselect':
439
- if val_text == 'None':
440
- param_value = dict(all_items=[], selected=[])
441
- else:
442
- param_value = dict(all_items=eval(el.get('all_items', val_text)), selected=eval(val_text))
443
- elif 'bool' in param_type or 'led' in param_type: # covers 'bool' 'bool_push', 'led' and 'led_push'types
444
- param_value = bool(int(val_text))
445
- elif param_type == 'date_time':
446
- param_value = QDateTime.fromMSecsSinceEpoch(int(val_text))
447
- elif param_type == 'date':
448
- param_value = QDateTime.fromMSecsSinceEpoch(int(val_text)).date()
449
- elif param_type == 'table':
450
- param_value = eval(val_text)
451
- elif param_type == 'color':
452
- param_value = QtGui.QColor(*eval(val_text))
453
- elif param_type == 'list':
454
- try:
455
- param_value = eval(val_text)
456
- except Exception:
457
- param_value = val_text # for back compatibility
458
- elif param_type == 'table_view':
459
- data_dict = json.loads(val_text)
460
- mod = importlib.import_module(data_dict['module'])
461
- _cls = getattr(mod, data_dict['classname'])
462
- param_value = _cls(data_dict['data'], header=data_dict['header'])
463
- elif param_type == 'action':
464
- if val_text == 'None':
465
- param_value = None
466
- else:
467
- param_value = val_text
468
- param_dict.update(dict(value=param_value))
469
- else:
470
- if param_type == 'str':
471
- param_dict.update(dict(value=''))
472
-
473
-
474
- def XML_file_to_parameter(file_name: Union[str, Path]) -> list:
475
- """ Convert a xml file into pyqtgraph parameter object.
476
-
477
- Returns
478
- -------
479
- params : list of dictionary
480
- a list of dictionary defining a Parameter object and its children
481
-
482
- See Also
483
- --------
484
- walk_parameters_to_xml
485
-
486
- Examples
487
- --------
488
- """
489
- tree = ET.parse(str(file_name))
490
-
491
- root = tree.getroot()
492
- params = walk_xml_to_parameter(params=[], XML_elt=root)
493
- return params
494
-
495
-
496
- def XML_string_to_parameter(xml_string):
497
- """
498
- Convert a xml string into a list of dict for initialize pyqtgraph parameter object.
499
-
500
- =============== =========== ================================
501
- **Parameters** **Type** **Description**
502
-
503
- xml_string string the xml string to be converted
504
- =============== =========== ================================
505
-
506
- Returns
507
- -------
508
- params: a parameter list of dict to init a parameter
509
-
510
- See Also
511
- --------
512
- walk_parameters_to_xml
513
-
514
- Examples
515
- --------
516
- """
517
- root = ET.fromstring(xml_string)
518
- tree = ET.ElementTree(root)
519
-
520
- # tree.write('test.xml')
521
- params = walk_xml_to_parameter(params=[], XML_elt=root)
522
-
523
- return params
524
-
525
-
526
- def XML_string_to_pobject(xml_string) -> Parameter:
527
- """
528
- return a Parameter object from its *translated* version as a XML string
529
- Parameters
530
- ----------
531
- xml_string: (str) string representation of a Parameter Object
532
-
533
- Returns
534
- -------
535
- Parameter
536
-
537
- See Also
538
- --------
539
- parameter_to_xml_string
540
- """
541
- return Parameter.create(name='settings', type='group',
542
- children=XML_string_to_parameter(xml_string))
@@ -1,38 +0,0 @@
1
- from pyqtgraph.parametertree.parameterTypes.basetypes import (SimpleParameter, GroupParameter,
2
- GroupParameterItem)
3
- from .bool import BoolPushParameter
4
- from .pixmap import PixmapParameter, PixmapCheckParameter
5
- from .slide import SliderSpinBox, SliderParameter
6
- from .led import LedPushParameter, LedParameter
7
- from .date import DateParameter, DateTimeParameter, TimeParameter
8
- from .list import ListParameter
9
- from .table import TableParameter
10
- from .tableview import TableViewParameter, TableViewCustom
11
- from .itemselect import ItemSelectParameter
12
- from .filedir import FileDirParameter
13
- from .text import PlainTextPbParameter
14
- from .numeric import NumericParameter
15
-
16
- from pyqtgraph.parametertree.Parameter import registerParameterType, registerParameterItemType, Parameter
17
-
18
- registerParameterType('float', NumericParameter, override=True)
19
- registerParameterType('int', NumericParameter, override=True)
20
- registerParameterType('bool_push', BoolPushParameter, override=True)
21
- registerParameterType('pixmap', PixmapParameter, override=True)
22
- registerParameterType('pixmap_check', PixmapCheckParameter, override=True)
23
-
24
- registerParameterType('slide', SliderParameter, override=True)
25
-
26
- registerParameterType('led', LedParameter, override=True)
27
- registerParameterType('led_push', LedPushParameter, override=True)
28
- registerParameterType('date', DateParameter, override=True)
29
- registerParameterType('date_time', DateTimeParameter, override=True)
30
- registerParameterType('time', TimeParameter, override=True)
31
-
32
- registerParameterType('list', ListParameter, override=True)
33
- registerParameterType('table', TableParameter, override=True)
34
-
35
- registerParameterType('table_view', TableViewParameter, override=True)
36
- registerParameterType('itemselect', ItemSelectParameter, override=True)
37
- registerParameterType('browsepath', FileDirParameter, override=True)
38
- registerParameterType('text_pb', PlainTextPbParameter, override=True)
@@ -1,31 +0,0 @@
1
- from qtpy import QtWidgets
2
- from pyqtgraph.parametertree.parameterTypes.basetypes import WidgetParameterItem, SimpleParameter
3
-
4
-
5
- class BoolPushParameterItem(WidgetParameterItem):
6
- """Registered parameter type which displays a QLineEdit"""
7
-
8
- def makeWidget(self):
9
- opts = self.param.opts
10
- w = QtWidgets.QPushButton()
11
- if 'label' in opts:
12
- w.setText(opts['label'])
13
- elif 'title' in opts:
14
- w.setText(opts['title'])
15
- else:
16
- w.setText(opts['name'])
17
- # w.setMaximumWidth(50)
18
- w.setCheckable(True)
19
- w.sigChanged = w.toggled
20
- w.value = w.isChecked
21
- w.setValue = w.setChecked
22
- w.setEnabled(not opts.get('readonly', False))
23
- self.hideWidget = False
24
- return w
25
-
26
-
27
- class BoolPushParameter(SimpleParameter):
28
- itemClass = BoolPushParameterItem
29
-
30
- def __init__(self, *args, **kwargs):
31
- super().__init__(*args, **kwargs)