bec-widgets 0.46.3__tar.gz → 0.46.5__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. {bec_widgets-0.46.3 → bec_widgets-0.46.5}/PKG-INFO +1 -1
  2. {bec_widgets-0.46.3 → bec_widgets-0.46.5}/bec_widgets/cli/client.py +72 -73
  3. {bec_widgets-0.46.3 → bec_widgets-0.46.5}/bec_widgets/cli/client_utils.py +2 -1
  4. {bec_widgets-0.46.3 → bec_widgets-0.46.5}/bec_widgets/cli/server.py +2 -2
  5. bec_widgets-0.46.5/bec_widgets/examples/jupyter_console/jupyter_console_window.py +102 -0
  6. {bec_widgets-0.46.3 → bec_widgets-0.46.5}/bec_widgets/utils/bec_connector.py +19 -1
  7. {bec_widgets-0.46.3 → bec_widgets-0.46.5}/bec_widgets/utils/bec_dispatcher.py +2 -1
  8. {bec_widgets-0.46.3 → bec_widgets-0.46.5}/bec_widgets/widgets/figure/figure.py +5 -160
  9. {bec_widgets-0.46.3 → bec_widgets-0.46.5}/bec_widgets/widgets/plots/image.py +24 -5
  10. {bec_widgets-0.46.3 → bec_widgets-0.46.5}/bec_widgets/widgets/plots/motor_map.py +14 -1
  11. {bec_widgets-0.46.3 → bec_widgets-0.46.5}/bec_widgets/widgets/plots/plot_base.py +1 -1
  12. {bec_widgets-0.46.3 → bec_widgets-0.46.5}/bec_widgets/widgets/plots/waveform.py +2 -2
  13. {bec_widgets-0.46.3 → bec_widgets-0.46.5}/bec_widgets.egg-info/PKG-INFO +1 -1
  14. {bec_widgets-0.46.3 → bec_widgets-0.46.5}/bec_widgets.egg-info/SOURCES.txt +27 -24
  15. {bec_widgets-0.46.3 → bec_widgets-0.46.5}/setup.py +1 -1
  16. bec_widgets-0.46.5/tests/unit_tests/__init__.py +0 -0
  17. bec_widgets-0.46.5/tests/unit_tests/conftest.py +14 -0
  18. bec_widgets-0.46.5/tests/unit_tests/test_msgs/__init__.py +0 -0
  19. {bec_widgets-0.46.3/tests → bec_widgets-0.46.5/tests/unit_tests}/test_scan_control.py +1 -4
  20. bec_widgets-0.46.3/tests/conftest.py +0 -36
  21. {bec_widgets-0.46.3 → bec_widgets-0.46.5}/LICENSE +0 -0
  22. {bec_widgets-0.46.3 → bec_widgets-0.46.5}/README.md +0 -0
  23. {bec_widgets-0.46.3 → bec_widgets-0.46.5}/bec_widgets/__init__.py +0 -0
  24. {bec_widgets-0.46.3 → bec_widgets-0.46.5}/bec_widgets/cli/__init__.py +0 -0
  25. {bec_widgets-0.46.3 → bec_widgets-0.46.5}/bec_widgets/cli/generate_cli.py +0 -0
  26. {bec_widgets-0.46.3 → bec_widgets-0.46.5}/bec_widgets/examples/__init__.py +0 -0
  27. {bec_widgets-0.46.3 → bec_widgets-0.46.5}/bec_widgets/examples/eiger_plot/__init__.py +0 -0
  28. {bec_widgets-0.46.3 → bec_widgets-0.46.5}/bec_widgets/examples/eiger_plot/eiger_plot.py +0 -0
  29. {bec_widgets-0.46.3 → bec_widgets-0.46.5}/bec_widgets/examples/eiger_plot/eiger_plot.ui +0 -0
  30. {bec_widgets-0.46.3/bec_widgets/examples/mca_readout → bec_widgets-0.46.5/bec_widgets/examples/jupyter_console}/__init__.py +0 -0
  31. /bec_widgets-0.46.3/bec_widgets/widgets/figure/figure_debug_minimal.ui → /bec_widgets-0.46.5/bec_widgets/examples/jupyter_console/jupyter_console_window.ui +0 -0
  32. {bec_widgets-0.46.3/bec_widgets/examples/stream_plot → bec_widgets-0.46.5/bec_widgets/examples/mca_readout}/__init__.py +0 -0
  33. {bec_widgets-0.46.3 → bec_widgets-0.46.5}/bec_widgets/examples/mca_readout/mca_plot.py +0 -0
  34. {bec_widgets-0.46.3 → bec_widgets-0.46.5}/bec_widgets/examples/mca_readout/mca_sim.py +0 -0
  35. {bec_widgets-0.46.3 → bec_widgets-0.46.5}/bec_widgets/examples/motor_movement/__init__.py +0 -0
  36. {bec_widgets-0.46.3 → bec_widgets-0.46.5}/bec_widgets/examples/motor_movement/config_example.yaml +0 -0
  37. {bec_widgets-0.46.3 → bec_widgets-0.46.5}/bec_widgets/examples/motor_movement/csax_bec_config.yaml +0 -0
  38. {bec_widgets-0.46.3 → bec_widgets-0.46.5}/bec_widgets/examples/motor_movement/csaxs_config.yaml +0 -0
  39. {bec_widgets-0.46.3 → bec_widgets-0.46.5}/bec_widgets/examples/motor_movement/motor_control_compilations.py +0 -0
  40. {bec_widgets-0.46.3 → bec_widgets-0.46.5}/bec_widgets/examples/motor_movement/motor_controller.ui +0 -0
  41. {bec_widgets-0.46.3 → bec_widgets-0.46.5}/bec_widgets/examples/motor_movement/motor_example.py +0 -0
  42. {bec_widgets-0.46.3/bec_widgets/simulations → bec_widgets-0.46.5/bec_widgets/examples/stream_plot}/__init__.py +0 -0
  43. {bec_widgets-0.46.3 → bec_widgets-0.46.5}/bec_widgets/examples/stream_plot/line_plot.ui +0 -0
  44. {bec_widgets-0.46.3 → bec_widgets-0.46.5}/bec_widgets/examples/stream_plot/stream_plot.py +0 -0
  45. {bec_widgets-0.46.3/tests → bec_widgets-0.46.5/bec_widgets/simulations}/__init__.py +0 -0
  46. {bec_widgets-0.46.3 → bec_widgets-0.46.5}/bec_widgets/utils/__init__.py +0 -0
  47. {bec_widgets-0.46.3 → bec_widgets-0.46.5}/bec_widgets/utils/bec_table.py +0 -0
  48. {bec_widgets-0.46.3 → bec_widgets-0.46.5}/bec_widgets/utils/colors.py +0 -0
  49. {bec_widgets-0.46.3 → bec_widgets-0.46.5}/bec_widgets/utils/crosshair.py +0 -0
  50. {bec_widgets-0.46.3 → bec_widgets-0.46.5}/bec_widgets/utils/ctrl_c.py +0 -0
  51. {bec_widgets-0.46.3 → bec_widgets-0.46.5}/bec_widgets/utils/entry_validator.py +0 -0
  52. {bec_widgets-0.46.3 → bec_widgets-0.46.5}/bec_widgets/utils/rpc_decorator.py +0 -0
  53. {bec_widgets-0.46.3 → bec_widgets-0.46.5}/bec_widgets/utils/validator_delegate.py +0 -0
  54. {bec_widgets-0.46.3 → bec_widgets-0.46.5}/bec_widgets/utils/widget_io.py +0 -0
  55. {bec_widgets-0.46.3 → bec_widgets-0.46.5}/bec_widgets/utils/yaml_dialog.py +0 -0
  56. {bec_widgets-0.46.3 → bec_widgets-0.46.5}/bec_widgets/validation/__init__.py +0 -0
  57. {bec_widgets-0.46.3 → bec_widgets-0.46.5}/bec_widgets/validation/monitor_config_validator.py +0 -0
  58. {bec_widgets-0.46.3 → bec_widgets-0.46.5}/bec_widgets/widgets/__init__.py +0 -0
  59. {bec_widgets-0.46.3 → bec_widgets-0.46.5}/bec_widgets/widgets/editor/__init__.py +0 -0
  60. {bec_widgets-0.46.3 → bec_widgets-0.46.5}/bec_widgets/widgets/editor/editor.py +0 -0
  61. {bec_widgets-0.46.3 → bec_widgets-0.46.5}/bec_widgets/widgets/figure/__init__.py +0 -0
  62. {bec_widgets-0.46.3 → bec_widgets-0.46.5}/bec_widgets/widgets/monitor/__init__.py +0 -0
  63. {bec_widgets-0.46.3 → bec_widgets-0.46.5}/bec_widgets/widgets/monitor/config_dialog.py +0 -0
  64. {bec_widgets-0.46.3 → bec_widgets-0.46.5}/bec_widgets/widgets/monitor/config_dialog.ui +0 -0
  65. {bec_widgets-0.46.3 → bec_widgets-0.46.5}/bec_widgets/widgets/monitor/monitor.py +0 -0
  66. {bec_widgets-0.46.3 → bec_widgets-0.46.5}/bec_widgets/widgets/monitor/tab_template.ui +0 -0
  67. {bec_widgets-0.46.3 → bec_widgets-0.46.5}/bec_widgets/widgets/motor_control/__init__.py +0 -0
  68. {bec_widgets-0.46.3 → bec_widgets-0.46.5}/bec_widgets/widgets/motor_control/motor_control.py +0 -0
  69. {bec_widgets-0.46.3 → bec_widgets-0.46.5}/bec_widgets/widgets/motor_control/motor_control_absolute.ui +0 -0
  70. {bec_widgets-0.46.3 → bec_widgets-0.46.5}/bec_widgets/widgets/motor_control/motor_control_relative.ui +0 -0
  71. {bec_widgets-0.46.3 → bec_widgets-0.46.5}/bec_widgets/widgets/motor_control/motor_control_selection.ui +0 -0
  72. {bec_widgets-0.46.3 → bec_widgets-0.46.5}/bec_widgets/widgets/motor_control/motor_control_table.ui +0 -0
  73. {bec_widgets-0.46.3 → bec_widgets-0.46.5}/bec_widgets/widgets/motor_map/__init__.py +0 -0
  74. {bec_widgets-0.46.3 → bec_widgets-0.46.5}/bec_widgets/widgets/motor_map/motor_map.py +0 -0
  75. {bec_widgets-0.46.3 → bec_widgets-0.46.5}/bec_widgets/widgets/plots/__init__.py +0 -0
  76. {bec_widgets-0.46.3 → bec_widgets-0.46.5}/bec_widgets/widgets/scan_control/__init__.py +0 -0
  77. {bec_widgets-0.46.3 → bec_widgets-0.46.5}/bec_widgets/widgets/scan_control/scan_control.py +0 -0
  78. {bec_widgets-0.46.3 → bec_widgets-0.46.5}/bec_widgets/widgets/toolbar/__init__.py +0 -0
  79. {bec_widgets-0.46.3 → bec_widgets-0.46.5}/bec_widgets/widgets/toolbar/toolbar.py +0 -0
  80. {bec_widgets-0.46.3 → bec_widgets-0.46.5}/bec_widgets.egg-info/dependency_links.txt +0 -0
  81. {bec_widgets-0.46.3 → bec_widgets-0.46.5}/bec_widgets.egg-info/requires.txt +0 -0
  82. {bec_widgets-0.46.3 → bec_widgets-0.46.5}/bec_widgets.egg-info/top_level.txt +0 -0
  83. {bec_widgets-0.46.3 → bec_widgets-0.46.5}/setup.cfg +0 -0
  84. {bec_widgets-0.46.3/tests/test_msgs → bec_widgets-0.46.5/tests}/__init__.py +0 -0
  85. {bec_widgets-0.46.3/tests → bec_widgets-0.46.5/tests/unit_tests}/client_mocks.py +0 -0
  86. {bec_widgets-0.46.3/tests → bec_widgets-0.46.5/tests/unit_tests}/test_bec_connector.py +0 -0
  87. {bec_widgets-0.46.3/tests → bec_widgets-0.46.5/tests/unit_tests}/test_bec_dispatcher.py +0 -0
  88. {bec_widgets-0.46.3/tests → bec_widgets-0.46.5/tests/unit_tests}/test_bec_figure.py +0 -0
  89. {bec_widgets-0.46.3/tests → bec_widgets-0.46.5/tests/unit_tests}/test_bec_monitor.py +0 -0
  90. {bec_widgets-0.46.3/tests → bec_widgets-0.46.5/tests/unit_tests}/test_bec_motor_map.py +0 -0
  91. {bec_widgets-0.46.3/tests → bec_widgets-0.46.5/tests/unit_tests}/test_config_dialog.py +0 -0
  92. {bec_widgets-0.46.3/tests → bec_widgets-0.46.5/tests/unit_tests}/test_crosshair.py +0 -0
  93. {bec_widgets-0.46.3/tests → bec_widgets-0.46.5/tests/unit_tests}/test_editor.py +0 -0
  94. {bec_widgets-0.46.3/tests → bec_widgets-0.46.5/tests/unit_tests}/test_eiger_plot.py +0 -0
  95. {bec_widgets-0.46.3/tests → bec_widgets-0.46.5/tests/unit_tests}/test_generate_cli_client.py +0 -0
  96. {bec_widgets-0.46.3/tests → bec_widgets-0.46.5/tests/unit_tests}/test_motor_control.py +0 -0
  97. {bec_widgets-0.46.3/tests → bec_widgets-0.46.5/tests/unit_tests}/test_motor_map.py +0 -0
  98. {bec_widgets-0.46.3/tests → bec_widgets-0.46.5/tests/unit_tests}/test_msgs/available_scans_message.py +0 -0
  99. {bec_widgets-0.46.3/tests → bec_widgets-0.46.5/tests/unit_tests}/test_plot_base.py +0 -0
  100. {bec_widgets-0.46.3/tests → bec_widgets-0.46.5/tests/unit_tests}/test_stream_plot.py +0 -0
  101. {bec_widgets-0.46.3/tests → bec_widgets-0.46.5/tests/unit_tests}/test_validator_errors.py +0 -0
  102. {bec_widgets-0.46.3/tests → bec_widgets-0.46.5/tests/unit_tests}/test_waveform1d.py +0 -0
  103. {bec_widgets-0.46.3/tests → bec_widgets-0.46.5/tests/unit_tests}/test_widget_io.py +0 -0
  104. {bec_widgets-0.46.3/tests → bec_widgets-0.46.5/tests/unit_tests}/test_yaml_dialog.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: bec_widgets
3
- Version: 0.46.3
3
+ Version: 0.46.5
4
4
  Summary: BEC Widgets
5
5
  Home-page: https://gitlab.psi.ch/bec/bec-widgets
6
6
  Project-URL: Bug Tracker, https://gitlab.psi.ch/bec/bec-widgets/issues
@@ -6,14 +6,13 @@ from bec_widgets.cli.client_utils import BECFigureClientMixin, RPCBase, rpc_call
6
6
 
7
7
 
8
8
  class BECPlotBase(RPCBase):
9
+ @property
9
10
  @rpc_call
10
- def get_config(self, dict_output: "bool" = True) -> "dict | BaseModel":
11
+ def config_dict(self) -> "dict":
11
12
  """
12
13
  Get the configuration of the widget.
13
- Args:
14
- dict_output(bool): If True, return the configuration as a dictionary. If False, return the configuration as a pydantic model.
15
14
  Returns:
16
- dict: The configuration of the plot widget.
15
+ dict: The configuration of the widget.
17
16
  """
18
17
 
19
18
  @rpc_call
@@ -137,6 +136,15 @@ class BECPlotBase(RPCBase):
137
136
 
138
137
 
139
138
  class BECWaveform(RPCBase):
139
+ @property
140
+ @rpc_call
141
+ def config_dict(self) -> "dict":
142
+ """
143
+ Get the configuration of the widget.
144
+ Returns:
145
+ dict: The configuration of the widget.
146
+ """
147
+
140
148
  @rpc_call
141
149
  def add_curve_scan(
142
150
  self,
@@ -258,16 +266,6 @@ class BECWaveform(RPCBase):
258
266
  dict | pd.DataFrame: Data of all curves in the specified format.
259
267
  """
260
268
 
261
- @rpc_call
262
- def get_config(self, dict_output: "bool" = True) -> "dict | BaseModel":
263
- """
264
- Get the configuration of the widget.
265
- Args:
266
- dict_output(bool): If True, return the configuration as a dictionary. If False, return the configuration as a pydantic model.
267
- Returns:
268
- dict: The configuration of the plot widget.
269
- """
270
-
271
269
  @rpc_call
272
270
  def set(self, **kwargs) -> "None":
273
271
  """
@@ -389,6 +387,15 @@ class BECWaveform(RPCBase):
389
387
 
390
388
 
391
389
  class BECFigure(RPCBase, BECFigureClientMixin):
390
+ @property
391
+ @rpc_call
392
+ def config_dict(self) -> "dict":
393
+ """
394
+ Get the configuration of the widget.
395
+ Returns:
396
+ dict: The configuration of the widget.
397
+ """
398
+
392
399
  @property
393
400
  @rpc_call
394
401
  def axes(self) -> "list[BECPlotBase]":
@@ -607,18 +614,17 @@ class BECFigure(RPCBase, BECFigureClientMixin):
607
614
  Clear all widgets from the figure and reset to default state
608
615
  """
609
616
 
617
+
618
+ class BECCurve(RPCBase):
619
+ @property
610
620
  @rpc_call
611
- def get_config(self, dict_output: "bool" = True) -> "dict | BaseModel":
621
+ def config_dict(self) -> "dict":
612
622
  """
613
623
  Get the configuration of the widget.
614
- Args:
615
- dict_output(bool): If True, return the configuration as a dictionary. If False, return the configuration as a pydantic model.
616
624
  Returns:
617
- dict: The configuration of the plot widget.
625
+ dict: The configuration of the widget.
618
626
  """
619
627
 
620
-
621
- class BECCurve(RPCBase):
622
628
  @rpc_call
623
629
  def set(self, **kwargs):
624
630
  """
@@ -705,18 +711,17 @@ class BECCurve(RPCBase):
705
711
  tuple[np.ndarray,np.ndarray]: X and Y data of the curve.
706
712
  """
707
713
 
714
+
715
+ class BECImageShow(RPCBase):
716
+ @property
708
717
  @rpc_call
709
- def get_config(self, dict_output: "bool" = True) -> "dict | BaseModel":
718
+ def config_dict(self) -> "dict":
710
719
  """
711
720
  Get the configuration of the widget.
712
- Args:
713
- dict_output(bool): If True, return the configuration as a dictionary. If False, return the configuration as a pydantic model.
714
721
  Returns:
715
- dict: The configuration of the plot widget.
722
+ dict: The configuration of the widget.
716
723
  """
717
724
 
718
-
719
- class BECImageShow(RPCBase):
720
725
  @rpc_call
721
726
  def add_image_by_config(self, config: "ImageItemConfig | dict") -> "BECImageItem":
722
727
  """
@@ -740,14 +745,6 @@ class BECImageShow(RPCBase):
740
745
  ImageItemConfig|dict: The configuration of the image.
741
746
  """
742
747
 
743
- @rpc_call
744
- def get_image_list(self) -> "list[BECImageItem]":
745
- """
746
- Get the list of images.
747
- Returns:
748
- list[BECImageItem]: The list of images.
749
- """
750
-
751
748
  @rpc_call
752
749
  def get_image_dict(self) -> "dict[str, dict[str, BECImageItem]]":
753
750
  """
@@ -756,16 +753,6 @@ class BECImageShow(RPCBase):
756
753
  dict[str, dict[str, BECImageItem]]: The dictionary of images.
757
754
  """
758
755
 
759
- @rpc_call
760
- def get_config(self, dict_output: "bool" = True) -> "dict | BaseModel":
761
- """
762
- Get the configuration of the widget.
763
- Args:
764
- dict_output(bool): If True, return the configuration as a dictionary. If False, return the configuration as a pydantic model.
765
- Returns:
766
- dict: The configuration of the plot widget.
767
- """
768
-
769
756
  @rpc_call
770
757
  def add_monitor_image(
771
758
  self,
@@ -919,16 +906,6 @@ class BECImageShow(RPCBase):
919
906
  use_threading(bool): Whether to use threading.
920
907
  """
921
908
 
922
- @rpc_call
923
- def get_config(self, dict_output: "bool" = True) -> "dict | BaseModel":
924
- """
925
- Get the configuration of the widget.
926
- Args:
927
- dict_output(bool): If True, return the configuration as a dictionary. If False, return the configuration as a pydantic model.
928
- Returns:
929
- dict: The configuration of the plot widget.
930
- """
931
-
932
909
  @rpc_call
933
910
  def set(self, **kwargs) -> "None":
934
911
  """
@@ -1048,20 +1025,37 @@ class BECImageShow(RPCBase):
1048
1025
  Remove the plot widget from the figure.
1049
1026
  """
1050
1027
 
1028
+ @property
1029
+ @rpc_call
1030
+ def images(self) -> "list[BECImageItem]":
1031
+ """
1032
+ Get the list of images.
1033
+ Returns:
1034
+ list[BECImageItem]: The list of images.
1035
+ """
1036
+
1051
1037
 
1052
1038
  class BECConnector(RPCBase):
1039
+ @property
1053
1040
  @rpc_call
1054
- def get_config(self, dict_output: "bool" = True) -> "dict | BaseModel":
1041
+ def config_dict(self) -> "dict":
1055
1042
  """
1056
1043
  Get the configuration of the widget.
1057
- Args:
1058
- dict_output(bool): If True, return the configuration as a dictionary. If False, return the configuration as a pydantic model.
1059
1044
  Returns:
1060
- dict: The configuration of the plot widget.
1045
+ dict: The configuration of the widget.
1061
1046
  """
1062
1047
 
1063
1048
 
1064
1049
  class BECImageItem(RPCBase):
1050
+ @property
1051
+ @rpc_call
1052
+ def config_dict(self) -> "dict":
1053
+ """
1054
+ Get the configuration of the widget.
1055
+ Returns:
1056
+ dict: The configuration of the widget.
1057
+ """
1058
+
1065
1059
  @rpc_call
1066
1060
  def set(self, **kwargs):
1067
1061
  """
@@ -1164,17 +1158,24 @@ class BECImageItem(RPCBase):
1164
1158
  """
1165
1159
 
1166
1160
  @rpc_call
1167
- def get_config(self, dict_output: "bool" = True) -> "dict | BaseModel":
1161
+ def get_data(self) -> "np.ndarray":
1168
1162
  """
1169
- Get the configuration of the widget.
1170
- Args:
1171
- dict_output(bool): If True, return the configuration as a dictionary. If False, return the configuration as a pydantic model.
1163
+ Get the data of the image.
1172
1164
  Returns:
1173
- dict: The configuration of the plot widget.
1165
+ np.ndarray: The data of the image.
1174
1166
  """
1175
1167
 
1176
1168
 
1177
1169
  class BECMotorMap(RPCBase):
1170
+ @property
1171
+ @rpc_call
1172
+ def config_dict(self) -> "dict":
1173
+ """
1174
+ Get the configuration of the widget.
1175
+ Returns:
1176
+ dict: The configuration of the widget.
1177
+ """
1178
+
1178
1179
  @rpc_call
1179
1180
  def change_motors(
1180
1181
  self,
@@ -1194,16 +1195,6 @@ class BECMotorMap(RPCBase):
1194
1195
  validate_bec(bool, optional): If True, validate the signal with BEC. Defaults to True.
1195
1196
  """
1196
1197
 
1197
- @rpc_call
1198
- def get_config(self, dict_output: "bool" = True) -> "dict | BaseModel":
1199
- """
1200
- Get the configuration of the widget.
1201
- Args:
1202
- dict_output(bool): If True, return the configuration as a dictionary. If False, return the configuration as a pydantic model.
1203
- Returns:
1204
- dict: The configuration of the plot widget.
1205
- """
1206
-
1207
1198
  @rpc_call
1208
1199
  def set_max_points(self, max_points: "int") -> "None":
1209
1200
  """
@@ -1243,3 +1234,11 @@ class BECMotorMap(RPCBase):
1243
1234
  Args:
1244
1235
  scatter_size(int): Size of the scatter points.
1245
1236
  """
1237
+
1238
+ @rpc_call
1239
+ def get_data(self) -> "dict":
1240
+ """
1241
+ Get the data of the motor map.
1242
+ Returns:
1243
+ dict: Data of the motor map.
1244
+ """
@@ -82,8 +82,9 @@ def update_script(figure: BECFigure, msg):
82
82
  print(f"Scan {scan_number} is running")
83
83
  dev_x = scan_report_devices[0]
84
84
  dev_y = scan_report_devices[1]
85
+ dev_z = get_selected_device(monitored_devices, figure.selected_device)
85
86
  figure.clear_all()
86
- plt = figure.plot(dev_x, dev_y, label=f"Scan {scan_number}")
87
+ plt = figure.plot(dev_x, dev_y, dev_z, label=f"Scan {scan_number}")
87
88
  plt.set(title=f"Scan {scan_number}", x_label=dev_x, y_label=dev_y)
88
89
  elif scan_report_devices:
89
90
  dev_x = scan_report_devices[0]
@@ -12,9 +12,9 @@ from bec_widgets.widgets.plots import BECCurve, BECImageShow, BECWaveform
12
12
  class BECWidgetsCLIServer:
13
13
  WIDGETS = [BECWaveform, BECFigure, BECCurve, BECImageShow]
14
14
 
15
- def __init__(self, gui_id: str = None, dispatcher: BECDispatcher = None) -> None:
15
+ def __init__(self, gui_id: str = None, dispatcher: BECDispatcher = None, client=None) -> None:
16
16
  self.dispatcher = BECDispatcher() if dispatcher is None else dispatcher
17
- self.client = self.dispatcher.client
17
+ self.client = self.dispatcher.client if client is None else client
18
18
  self.client.start()
19
19
  self.gui_id = gui_id
20
20
  self.fig = BECFigure(gui_id=self.gui_id)
@@ -0,0 +1,102 @@
1
+ import os
2
+
3
+ import numpy as np
4
+ import pyqtgraph as pg
5
+ from pyqtgraph.Qt import uic
6
+ from qtconsole.inprocess import QtInProcessKernelManager
7
+ from qtconsole.rich_jupyter_widget import RichJupyterWidget
8
+ from qtpy.QtWidgets import QApplication, QVBoxLayout, QWidget
9
+
10
+ from bec_widgets.utils import BECDispatcher
11
+ from bec_widgets.widgets import BECFigure
12
+
13
+
14
+ class JupyterConsoleWidget(RichJupyterWidget): # pragma: no cover:
15
+ def __init__(self):
16
+ super().__init__()
17
+
18
+ self.kernel_manager = QtInProcessKernelManager()
19
+ self.kernel_manager.start_kernel(show_banner=False)
20
+ self.kernel_client = self.kernel_manager.client()
21
+ self.kernel_client.start_channels()
22
+
23
+ self.kernel_manager.kernel.shell.push({"np": np, "pg": pg})
24
+ # self.set_console_font_size(70)
25
+
26
+ def shutdown_kernel(self):
27
+ self.kernel_client.stop_channels()
28
+ self.kernel_manager.shutdown_kernel()
29
+
30
+
31
+ class JupyterConsoleWindow(QWidget): # pragma: no cover:
32
+ """A widget that contains a Jupyter console linked to BEC Widgets with full API access (contains Qt and pyqtgraph API)."""
33
+
34
+ def __init__(self, parent=None):
35
+ super().__init__(parent)
36
+
37
+ current_path = os.path.dirname(__file__)
38
+ uic.loadUi(os.path.join(current_path, "jupyter_console_window.ui"), self)
39
+
40
+ self._init_ui()
41
+
42
+ self.splitter.setSizes([200, 100])
43
+ self.safe_close = False
44
+ # self.figure.clean_signal.connect(self.confirm_close)
45
+
46
+ # console push
47
+ self.console.kernel_manager.kernel.shell.push(
48
+ {
49
+ "fig": self.figure,
50
+ "w1": self.w1,
51
+ "w2": self.w2,
52
+ "w3": self.w3,
53
+ "bec": self.figure.client,
54
+ "scans": self.figure.client.scans,
55
+ "dev": self.figure.client.device_manager.devices,
56
+ }
57
+ )
58
+
59
+ def _init_ui(self):
60
+ # Plotting window
61
+ self.glw_1_layout = QVBoxLayout(self.glw) # Create a new QVBoxLayout
62
+ self.figure = BECFigure(parent=self, gui_id="remote") # Create a new BECDeviceMonitor
63
+ self.glw_1_layout.addWidget(self.figure) # Add BECDeviceMonitor to the layout
64
+
65
+ # add stuff to figure
66
+ self._init_figure()
67
+
68
+ self.console_layout = QVBoxLayout(self.widget_console)
69
+ self.console = JupyterConsoleWidget()
70
+ self.console_layout.addWidget(self.console)
71
+ self.console.set_default_style("linux")
72
+
73
+ def _init_figure(self):
74
+ self.figure.plot("samx", "bpm4d")
75
+ self.figure.motor_map("samx", "samy")
76
+ self.figure.image("eiger", color_map="viridis", vrange=(0, 100))
77
+
78
+ self.figure.change_layout(2, 2)
79
+
80
+ self.w1 = self.figure[0, 0]
81
+ self.w2 = self.figure[0, 1]
82
+ self.w3 = self.figure[1, 0]
83
+
84
+ # curves for w1
85
+ self.w1.add_curve_scan("samx", "samy", "bpm4i", pen_style="dash")
86
+ self.w1.add_curve_scan("samx", "samy", "bpm3a", pen_style="dash")
87
+ self.c1 = self.w1.get_config()
88
+
89
+
90
+ if __name__ == "__main__": # pragma: no cover
91
+ import sys
92
+
93
+ bec_dispatcher = BECDispatcher()
94
+ client = bec_dispatcher.client
95
+ client.start()
96
+
97
+ app = QApplication(sys.argv)
98
+ app.setApplicationName("Jupyter Console")
99
+ win = JupyterConsoleWindow()
100
+ win.show()
101
+
102
+ sys.exit(app.exec_())
@@ -31,7 +31,7 @@ class ConnectionConfig(BaseModel):
31
31
  class BECConnector:
32
32
  """Connection mixin class for all BEC widgets, to handle BEC client and device manager"""
33
33
 
34
- USER_ACCESS = ["get_config"]
34
+ USER_ACCESS = ["config_dict"]
35
35
 
36
36
  def __init__(self, client=None, config: ConnectionConfig = None, gui_id: str = None):
37
37
  # BEC related connections
@@ -54,6 +54,24 @@ class BECConnector:
54
54
  else:
55
55
  self.gui_id = self.config.gui_id
56
56
 
57
+ @property
58
+ def config_dict(self) -> dict:
59
+ """
60
+ Get the configuration of the widget.
61
+ Returns:
62
+ dict: The configuration of the widget.
63
+ """
64
+ return self.config.model_dump()
65
+
66
+ @config_dict.setter
67
+ def config_dict(self, config: BaseModel) -> None:
68
+ """
69
+ Get the configuration of the widget.
70
+ Returns:
71
+ dict: The configuration of the widget.
72
+ """
73
+ self.config = config
74
+
57
75
  @pyqtSlot(str)
58
76
  def set_gui_id(self, gui_id: str) -> None:
59
77
  """
@@ -82,8 +82,9 @@ class BECDispatcher:
82
82
  return
83
83
 
84
84
  self._slots = collections.defaultdict(set)
85
+ self.client = client
85
86
 
86
- if client is None:
87
+ if self.client is None:
87
88
  self.client = BECClient(connector_cls=QtRedisConnector, forced=True)
88
89
  else:
89
90
  if self.client.started:
@@ -97,6 +97,7 @@ class WidgetHandler:
97
97
 
98
98
  class BECFigure(BECConnector, pg.GraphicsLayoutWidget):
99
99
  USER_ACCESS = [
100
+ "config_dict",
100
101
  "axes",
101
102
  "widgets",
102
103
  "add_plot",
@@ -109,7 +110,6 @@ class BECFigure(BECConnector, pg.GraphicsLayoutWidget):
109
110
  "change_layout",
110
111
  "change_theme",
111
112
  "clear_all",
112
- "get_config",
113
113
  ]
114
114
 
115
115
  clean_signal = pyqtSignal()
@@ -227,7 +227,7 @@ class BECFigure(BECConnector, pg.GraphicsLayoutWidget):
227
227
  y_entry=y_entry,
228
228
  z_entry=z_entry,
229
229
  color=color,
230
- color_map=color_map_z,
230
+ color_map_z=color_map_z,
231
231
  label=label,
232
232
  validate=validate,
233
233
  )
@@ -313,7 +313,7 @@ class BECFigure(BECConnector, pg.GraphicsLayoutWidget):
313
313
  y_entry=y_entry,
314
314
  z_entry=z_entry,
315
315
  color=color,
316
- color_map=color_map_z,
316
+ color_map_z=color_map_z,
317
317
  label=label,
318
318
  validate=validate,
319
319
  )
@@ -787,8 +787,8 @@ class BECFigure(BECConnector, pg.GraphicsLayoutWidget):
787
787
 
788
788
  def clear_all(self):
789
789
  """Clear all widgets from the figure and reset to default state"""
790
- for widget in self._widgets.values():
791
- widget.cleanup()
790
+ # for widget in self._widgets.values():
791
+ # widget.cleanup()
792
792
  self.clear()
793
793
  self._widgets = defaultdict(dict)
794
794
  self.grid = []
@@ -796,158 +796,3 @@ class BECFigure(BECConnector, pg.GraphicsLayoutWidget):
796
796
  self.config = FigureConfig(
797
797
  widget_class=self.__class__.__name__, gui_id=self.gui_id, theme=theme
798
798
  )
799
-
800
-
801
- ##################################################
802
- ##################################################
803
- # Debug window
804
- ##################################################
805
- ##################################################
806
-
807
- from qtconsole.inprocess import QtInProcessKernelManager
808
- from qtconsole.rich_jupyter_widget import RichJupyterWidget
809
-
810
-
811
- class JupyterConsoleWidget(RichJupyterWidget): # pragma: no cover:
812
- def __init__(self):
813
- super().__init__()
814
-
815
- self.kernel_manager = QtInProcessKernelManager()
816
- self.kernel_manager.start_kernel(show_banner=False)
817
- self.kernel_client = self.kernel_manager.client()
818
- self.kernel_client.start_channels()
819
-
820
- self.kernel_manager.kernel.shell.push({"np": np, "pg": pg})
821
- # self.set_console_font_size(70)
822
-
823
- def shutdown_kernel(self):
824
- self.kernel_client.stop_channels()
825
- self.kernel_manager.shutdown_kernel()
826
-
827
-
828
- class DebugWindow(QWidget): # pragma: no cover:
829
- """Debug window for BEC widgets"""
830
-
831
- def __init__(self, parent=None):
832
- super().__init__(parent)
833
-
834
- current_path = os.path.dirname(__file__)
835
- uic.loadUi(os.path.join(current_path, "figure_debug_minimal.ui"), self)
836
-
837
- self._init_ui()
838
-
839
- self.splitter.setSizes([200, 100])
840
- self.safe_close = False
841
- # self.figure.clean_signal.connect(self.confirm_close)
842
-
843
- # console push
844
- self.console.kernel_manager.kernel.shell.push(
845
- {
846
- "fig": self.figure,
847
- "w1": self.w1,
848
- "w2": self.w2,
849
- "w3": self.w3,
850
- "w4": self.w4,
851
- "bec": self.figure.client,
852
- "scans": self.figure.client.scans,
853
- "dev": self.figure.client.device_manager.devices,
854
- }
855
- )
856
-
857
- def _init_ui(self):
858
- # Plotting window
859
- self.glw_1_layout = QVBoxLayout(self.glw) # Create a new QVBoxLayout
860
- self.figure = BECFigure(parent=self, gui_id="remote") # Create a new BECDeviceMonitor
861
- self.glw_1_layout.addWidget(self.figure) # Add BECDeviceMonitor to the layout
862
-
863
- # add stuff to figure
864
- self._init_figure()
865
-
866
- self.console_layout = QVBoxLayout(self.widget_console)
867
- self.console = JupyterConsoleWidget()
868
- self.console_layout.addWidget(self.console)
869
- self.console.set_default_style("linux")
870
-
871
- def _init_figure(self):
872
- # self.figure.add_widget(widget_type="Waveform1D", row=0, col=0, title="Widget 1")
873
- self.figure.plot("samx", "bpm4d")
874
- self.figure.add_widget(widget_type="Waveform1D", row=0, col=1, title="Widget 2")
875
- self.figure.add_image(
876
- title="Image", row=1, col=0, color_map="viridis", color_bar="simple", vrange=(0, 100)
877
- )
878
- self.figure.add_image(title="Image", row=1, col=1, vrange=(0, 100))
879
-
880
- self.w1 = self.figure[0, 0]
881
- self.w2 = self.figure[0, 1]
882
- self.w3 = self.figure[1, 0]
883
- self.w4 = self.figure[1, 1]
884
-
885
- # curves for w1
886
- self.w1.add_curve_scan("samx", "samy", "bpm4i", pen_style="dash")
887
- self.w1.add_curve_scan("samx", "samy", "bpm3a", pen_style="dash")
888
-
889
- # self.w1.add_curve_custom(
890
- # x=[1, 2, 3, 4, 5],
891
- # y=[1, 2, 3, 4, 5],
892
- # label="curve-custom",
893
- # color="blue",
894
- # pen_style="dashdot",
895
- # )
896
- self.c1 = self.w1.get_config()
897
-
898
- # curves for w2
899
- self.w2.add_curve_scan("samx", "bpm3a", pen_style="solid")
900
- self.w2.add_curve_scan("samx", "bpm4d", pen_style="dot")
901
- self.w2.add_curve_custom(
902
- x=[1, 2, 3, 4, 5], y=[5, 4, 3, 2, 1], color="red", pen_style="dashdot"
903
- )
904
-
905
- # curves for w3
906
- # self.w3.add_curve_scan("samx", "bpm4i", pen_style="dash")
907
- # self.w3.add_curve_custom(
908
- # x=[1, 2, 3, 4, 5],
909
- # y=[1, 2, 3, 4, 5],
910
- # label="curve-custom",
911
- # color="blue",
912
- # pen_style="dashdot",
913
- # )
914
-
915
- # curves for w4
916
- # self.w4.add_curve_scan("samx", "bpm4i", pen_style="dash")
917
- # self.w4.add_curve_custom(
918
- # x=[1, 2, 3, 4, 5],
919
- # y=[1, 2, 3, 4, 5],
920
- # label="curve-custom",
921
- # color="blue",
922
- # pen_style="dashdot",
923
- # )
924
-
925
- # Image setting for w3
926
-
927
- self.w3.add_monitor_image("eiger", vrange=(0, 100), color_bar="full")
928
-
929
- # Image setting for w4
930
- self.w4.add_monitor_image("eiger", vrange=(0, 100), color_map="viridis")
931
-
932
- # def confirm_close(self):
933
- # self.safe_close = True
934
- #
935
- # def closeEvent(self, event):
936
- # self.figure.cleanup()
937
- # if self.safe_close == True:
938
- # print("Safe close")
939
- # event.accept()
940
-
941
-
942
- if __name__ == "__main__": # pragma: no cover
943
- import sys
944
-
945
- bec_dispatcher = BECDispatcher()
946
- client = bec_dispatcher.client
947
- client.start()
948
-
949
- app = QApplication(sys.argv)
950
- win = DebugWindow()
951
- win.show()
952
-
953
- sys.exit(app.exec_())