11from bec_lib .endpoints import MessageEndpoints
22from bec_lib .logger import bec_logger
3+ from bec_qthemes import material_icon
34from bec_server .scan_server .procedures .helper import FrontendProcedureHelper
4- from PySide6 .QtWidgets import QLabel
5+ from PySide6 .QtWidgets import QComboBox , QHBoxLayout , QLabel , QToolButton
56from qtpy .QtGui import QFont
67from qtpy .QtWidgets import QSizePolicy , QTextEdit , QVBoxLayout , QWidget
78
@@ -19,11 +20,38 @@ def __init__(self, parent=None, client=None, config=None, gui_id: str | None = N
1920 super ().__init__ (parent = parent , client = client , config = config , gui_id = gui_id , ** kwargs )
2021 self ._conn = self .bec_dispatcher .client .connector
2122 self ._queue : str | None = None
23+ self ._available_streams = self ._get_available_streams ()
2224 self ._setup_ui ()
2325
26+ def _get_available_streams (self ):
27+ # TODO get from redis
28+ return ["primary" ]
29+
30+ def _update_selection_box (self ):
31+ self ._selection_box .clear ()
32+ self ._selection_box .addItems (self ._available_streams )
33+
2434 def _setup_ui (self ):
2535 self ._layout = QVBoxLayout ()
2636 self .setLayout (self ._layout )
37+ self ._setup_tools ()
38+ self ._setup_display ()
39+
40+ def _setup_tools (self ):
41+ self .tools = QWidget (self )
42+ self ._tools_layout = QHBoxLayout ()
43+ self .tools .setLayout (self ._tools_layout )
44+ self ._selection_box = QComboBox ()
45+ self ._update_selection_box ()
46+ self ._selection_box .currentTextChanged .connect (self .set_queue )
47+ self ._refresh_button = QToolButton ()
48+ self ._refresh_button .setIcon (material_icon ("refresh" , convert_to_pixmap = False ))
49+ self ._tools_layout .addWidget (QLabel ("Select logs stream: " ))
50+ self ._tools_layout .addWidget (self ._selection_box )
51+ self ._tools_layout .addWidget (self ._refresh_button )
52+ self ._layout .addWidget (self .tools )
53+
54+ def _setup_display (self ):
2755 self .widget = QTextEdit (lineWrapMode = QTextEdit .LineWrapMode .NoWrap , readOnly = True )
2856 font = QFont ("Courier New" )
2957 font .setStyleHint (QFont .StyleHint .Monospace )
0 commit comments