bec-widgets 0.46.4__py3-none-any.whl → 0.46.5__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.
@@ -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]
File without changes
@@ -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_())
@@ -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,103 +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
- "bec": self.figure.client,
851
- "scans": self.figure.client.scans,
852
- "dev": self.figure.client.device_manager.devices,
853
- }
854
- )
855
-
856
- def _init_ui(self):
857
- # Plotting window
858
- self.glw_1_layout = QVBoxLayout(self.glw) # Create a new QVBoxLayout
859
- self.figure = BECFigure(parent=self, gui_id="remote") # Create a new BECDeviceMonitor
860
- self.glw_1_layout.addWidget(self.figure) # Add BECDeviceMonitor to the layout
861
-
862
- # add stuff to figure
863
- self._init_figure()
864
-
865
- self.console_layout = QVBoxLayout(self.widget_console)
866
- self.console = JupyterConsoleWidget()
867
- self.console_layout.addWidget(self.console)
868
- self.console.set_default_style("linux")
869
-
870
- def _init_figure(self):
871
- self.figure.plot("samx", "bpm4d")
872
- self.figure.motor_map("samx", "samy")
873
- self.figure.image("eiger", color_map="viridis", vrange=(0, 100))
874
-
875
- self.figure.change_layout(2, 2)
876
-
877
- self.w1 = self.figure[0, 0]
878
- self.w2 = self.figure[0, 1]
879
- self.w3 = self.figure[1, 0]
880
-
881
- # curves for w1
882
- self.w1.add_curve_scan("samx", "samy", "bpm4i", pen_style="dash")
883
- self.w1.add_curve_scan("samx", "samy", "bpm3a", pen_style="dash")
884
- self.c1 = self.w1.get_config()
885
-
886
-
887
- if __name__ == "__main__": # pragma: no cover
888
- import sys
889
-
890
- bec_dispatcher = BECDispatcher()
891
- client = bec_dispatcher.client
892
- client.start()
893
-
894
- app = QApplication(sys.argv)
895
- win = DebugWindow()
896
- win.show()
897
-
898
- sys.exit(app.exec_())
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: bec-widgets
3
- Version: 0.46.4
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
@@ -1,13 +1,16 @@
1
1
  bec_widgets/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  bec_widgets/cli/__init__.py,sha256=yFyAmDteCcndbReunhnrfDib6JujQ7-BKWeVvuU0Ylw,30
3
3
  bec_widgets/cli/client.py,sha256=4QedDVBgkCOnRQFYQcAabyAsl5UQ0aRwwLwk1OR5M1k,37882
4
- bec_widgets/cli/client_utils.py,sha256=KpC9rSwXO3gQMTTxtuvnFPSOq3IvLw-sryqxVGt7Xqw,10437
4
+ bec_widgets/cli/client_utils.py,sha256=bZoXF6-qoOGe_N7pThOvKgZ6YHMoHwON1UTdPh3hI-c,10523
5
5
  bec_widgets/cli/generate_cli.py,sha256=JLqUlUgfz_f_4KHPRUAN-Xli-K7uNOc8-F-LkAC7Scw,4004
6
6
  bec_widgets/cli/server.py,sha256=OMWnl99RrSTKK1EVEyu3MFjkJ54bWfh_fpg38b-bres,4760
7
7
  bec_widgets/examples/__init__.py,sha256=WWQ0cu7m8sA4Ehy-DWdTIqSISjaHsbxhsNmNrMnhDZU,202
8
8
  bec_widgets/examples/eiger_plot/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
9
  bec_widgets/examples/eiger_plot/eiger_plot.py,sha256=Uxl2Usf8jEzaX7AT8zVqa1x8ZIEgI1HmazSlb-tRFWE,10359
10
10
  bec_widgets/examples/eiger_plot/eiger_plot.ui,sha256=grHfnO3OG_lelJhdRsnA0badCvRdDunPrIMIyNQ5N-w,5809
11
+ bec_widgets/examples/jupyter_console/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
+ bec_widgets/examples/jupyter_console/jupyter_console_window.py,sha256=MW9PCM4-UileXxMMDV2LxUsdxdTf2zPavhA4QxqoBxk,3323
13
+ bec_widgets/examples/jupyter_console/jupyter_console_window.ui,sha256=GodXBvBvs5QAUsHbo3pcxR4o51Tvce4DTqpTluk3hOs,742
11
14
  bec_widgets/examples/mca_readout/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
15
  bec_widgets/examples/mca_readout/mca_plot.py,sha256=do7mSK_nzHtojRiMi8JoN_Rckg9yfjYYWz2S_Nl3xbE,5079
13
16
  bec_widgets/examples/mca_readout/mca_sim.py,sha256=yiX_3sOgDZIbAYA4D2BGmOgLMBWbQMOej0hSP4cQd0o,754
@@ -40,8 +43,7 @@ bec_widgets/widgets/__init__.py,sha256=GptryTiWJ4yWZZVBG_03guISJabSOzVpOMRkgW0Ld
40
43
  bec_widgets/widgets/editor/__init__.py,sha256=5mBdFYi_IpygCz81kbLEZUWhd1b6oqiO3nASejuV_ug,30
41
44
  bec_widgets/widgets/editor/editor.py,sha256=pIIYLPqqqhXqT11Xj10cyGEiy-ieNGE4ZujN5lf0e68,15110
42
45
  bec_widgets/widgets/figure/__init__.py,sha256=3hGx_KOV7QHCYAV06aNuUgKq4QIYCjUTad-DrwkUaBM,44
43
- bec_widgets/widgets/figure/figure.py,sha256=wG4nSl_SPezpKuLKFLTF-Ucmm9zsFru6X9g--9ivE7M,32487
44
- bec_widgets/widgets/figure/figure_debug_minimal.ui,sha256=GodXBvBvs5QAUsHbo3pcxR4o51Tvce4DTqpTluk3hOs,742
46
+ bec_widgets/widgets/figure/figure.py,sha256=jqCGT7Abri74Da_4lEbUyDh4-CltiGLuM-2nu82ibDQ,29335
45
47
  bec_widgets/widgets/monitor/__init__.py,sha256=afXuZcBOxNAuYdCkIQXX5J60R5A3Q_86lNEW2vpFtPI,32
46
48
  bec_widgets/widgets/monitor/config_dialog.py,sha256=Z1a4WRIVlfEGdwC-QG25kba2EHCZWi5J843tBVZlWiI,20275
47
49
  bec_widgets/widgets/monitor/config_dialog.ui,sha256=ISMcF7CLTAMXhfZh2Yv5yezzAjMtb9fxY1pmX4B_jCg,5932
@@ -89,8 +91,8 @@ tests/unit_tests/test_widget_io.py,sha256=FeL3ZYSBQnRt6jxj8VGYw1cmcicRQyHKleahw7
89
91
  tests/unit_tests/test_yaml_dialog.py,sha256=HNrqferkdg02-9ieOhhI2mr2Qvt7GrYgXmQ061YCTbg,5794
90
92
  tests/unit_tests/test_msgs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
91
93
  tests/unit_tests/test_msgs/available_scans_message.py,sha256=m_z97hIrjHXXMa2Ex-UvsPmTxOYXfjxyJaGkIY6StTY,46532
92
- bec_widgets-0.46.4.dist-info/LICENSE,sha256=YRKe85CBRyP7UpEAWwU8_qSIyuy5-l_9C-HKg5Qm8MQ,1511
93
- bec_widgets-0.46.4.dist-info/METADATA,sha256=uahRMbNnY6SHjDVtXPrrsxICHZdsTayTZLeyUUu1u9w,3714
94
- bec_widgets-0.46.4.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
95
- bec_widgets-0.46.4.dist-info/top_level.txt,sha256=EXCwhJYmXmd1DjYYL3hrGsddX-97IwYSiIHrf27FFVk,18
96
- bec_widgets-0.46.4.dist-info/RECORD,,
94
+ bec_widgets-0.46.5.dist-info/LICENSE,sha256=YRKe85CBRyP7UpEAWwU8_qSIyuy5-l_9C-HKg5Qm8MQ,1511
95
+ bec_widgets-0.46.5.dist-info/METADATA,sha256=iWP05xhMNUwjhOrLk3AlFXFMunpi6TbRXzSqWl3x5SE,3714
96
+ bec_widgets-0.46.5.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
97
+ bec_widgets-0.46.5.dist-info/top_level.txt,sha256=EXCwhJYmXmd1DjYYL3hrGsddX-97IwYSiIHrf27FFVk,18
98
+ bec_widgets-0.46.5.dist-info/RECORD,,