1919 QWidget ,
2020 QMessageBox ,
2121 QCheckBox ,
22+ QToolButton ,
2223)
2324from PyQt5 .QtCore import Qt , QMetaObject , QSize , QUrl , pyqtSignal
2425from PyQt5 .QtGui import QDesktopServices , QGuiApplication , QCursor , QFontMetrics
@@ -259,6 +260,21 @@ def __init__(self, server: Server):
259260 )
260261 self ._supported_workloads .setOpenExternalLinks (True )
261262
263+ self ._client_id = QWidget (self ._connection_widget )
264+ client_id_layout = QHBoxLayout (self ._client_id )
265+ client_id_layout .setContentsMargins (0 , 0 , 0 , 0 )
266+ self ._client_id_label = QLabel (self ._client_id )
267+ self ._client_id_label .setStyleSheet (f"font-style: italic; color: { grey } ;" )
268+ self ._client_id_button = QToolButton (self ._client_id )
269+ self ._client_id_button .setToolButtonStyle (Qt .ToolButtonStyle .ToolButtonIconOnly )
270+ self ._client_id_button .setIcon (Krita .instance ().icon ("edit-copy" ))
271+ self ._client_id_button .setToolTip (_ ("Copy to clipboard" ))
272+ self ._client_id_button .setAutoRaise (True )
273+ self ._client_id_button .clicked .connect (self ._copy_client_id )
274+ client_id_layout .addWidget (self ._client_id_label )
275+ client_id_layout .addWidget (self ._client_id_button )
276+ client_id_layout .addStretch ()
277+
262278 anchor = _ ("View log files" )
263279 open_log_button = QLabel (f"<a href='file://{ util .log_dir } '>{ anchor } </a>" , self )
264280 open_log_button .setToolTip (str (util .log_dir ))
@@ -270,6 +286,7 @@ def __init__(self, server: Server):
270286
271287 connection_layout .addLayout (status_layout )
272288 connection_layout .addWidget (self ._supported_workloads )
289+ connection_layout .addWidget (self ._client_id )
273290 connection_layout .addStretch ()
274291
275292 self ._layout .addWidget (self ._server_managed )
@@ -336,9 +353,12 @@ def update_server_status(self):
336353 connection = root .connection
337354 self ._cloud_widget .update_connection_state (connection .state )
338355 self ._connect_button .setEnabled (connection .state != ConnectionState .connecting )
356+ self ._client_id .setVisible (False )
339357 if connection .state == ConnectionState .connected :
340358 self ._connection_status .setText (_ ("Connected" ))
341359 self ._connection_status .setStyleSheet (f"color: { green } ; font-weight:bold" )
360+ self ._client_id_label .setText (f"Client ID: { settings .comfyui_client_id } " )
361+ self ._client_id .setVisible (True )
342362 elif connection .state == ConnectionState .connecting :
343363 self ._connection_status .setText (_ ("Connecting" ))
344364 self ._connection_status .setStyleSheet (f"color: { yellow } ; font-weight:bold" )
@@ -411,6 +431,10 @@ def model_name(id: ResourceId, with_file=False):
411431 self ._supported_workloads .setStyleSheet (style )
412432 self ._supported_workloads .setText (text )
413433
434+ def _copy_client_id (self ):
435+ if clipboard := QGuiApplication .clipboard ():
436+ clipboard .setText (settings .comfyui_client_id )
437+
414438 def _open_logs (self ):
415439 QDesktopServices .openUrl (QUrl .fromLocalFile (str (util .log_dir )))
416440
0 commit comments