@@ -63,6 +63,8 @@ def __init__(self, builder, log, next_button):
6363 self .page : Gtk .Box = self .builder .get_object ("list_page" )
6464 self .stack : Gtk .Stack = self .builder .get_object ("main_stack" )
6565 self .vm_list : Gtk .TreeView = self .builder .get_object ("vm_list" )
66+ self .vm_list .set_has_tooltip (True )
67+ self .vm_list .connect ("query-tooltip" , self .on_query_tooltip )
6668 self .list_store : Optional [ListWrapper ] = None
6769
6870 checkbox_column : Gtk .TreeViewColumn = self .builder .get_object (
@@ -93,6 +95,8 @@ def __init__(self, builder, log, next_button):
9395 "<b>MAYBE</b></span>" ,
9496 OBSOLETE = f'<span foreground="{ label_color_theme ("red" )} ">'
9597 "<b>OBSOLETE</b></span>" ,
98+ PROHIBITED = f'<span foreground="{ label_color_theme ("red" )} ">'
99+ "<b>START PROHIBITED</b></span>" ,
96100 )
97101 )
98102
@@ -307,6 +311,25 @@ def _handle_cli_dom0(dom0, to_update, cliargs):
307311 to_update = to_update .difference ({"dom0" })
308312 return to_update
309313
314+ def on_query_tooltip (self , widget , x , y , keyboard_tip , tooltip ):
315+ """Show appropriate qube tooltip. Currently only for prohibit-start."""
316+ if not widget .get_tooltip_context (x , y , keyboard_tip ):
317+ return False
318+ _ , x , y , model , path , iterator = widget .get_tooltip_context (
319+ x , y , keyboard_tip
320+ )
321+ if path :
322+ status = model [iterator ][4 ]
323+ if status == type (status ).PROHIBITED :
324+ tooltip .set_text (
325+ "Start prohibition rationale:\n {}" .format (
326+ str (model [iterator ][9 ])
327+ )
328+ )
329+ widget .set_tooltip_cell (tooltip , path , None , None )
330+ return True
331+ return False
332+
310333
311334def is_stale (vm , expiration_period ):
312335 if expiration_period is None :
@@ -345,16 +368,20 @@ def __init__(self, list_store, vm, to_update: bool):
345368
346369 icon = load_icon (vm .icon )
347370 name = QubeName (vm .name , str (vm .label ))
371+ prohibit_rationale = vm .features .get ("prohibit-start" , False )
348372
349373 raw_row = [
350374 selected ,
351375 icon ,
352376 name ,
353- UpdatesAvailable .from_features (updates_available , supported ),
377+ UpdatesAvailable .from_features (
378+ updates_available , supported , bool (prohibit_rationale )
379+ ),
354380 Date (last_updates_check ),
355381 Date (last_update ),
356382 0 ,
357383 UpdateStatus .Undefined ,
384+ prohibit_rationale ,
358385 ]
359386
360387 super ().__init__ (list_store , vm , raw_row )
@@ -390,6 +417,7 @@ def updates_available(self):
390417
391418 @updates_available .setter
392419 def updates_available (self , value ):
420+ prohibited = bool (self .vm .features .get ("prohibit-start" , False ))
393421 updates_available = bool (
394422 self .vm .features .get ("updates-available" , False )
395423 )
@@ -398,7 +426,7 @@ def updates_available(self, value):
398426 if value and not updates_available :
399427 updates_available = None
400428 self .raw_row [self ._UPDATES_AVAILABLE ] = UpdatesAvailable .from_features (
401- updates_available , supported
429+ updates_available , supported , prohibited
402430 )
403431
404432 @property
@@ -497,11 +525,16 @@ class UpdatesAvailable(Enum):
497525 MAYBE = 1
498526 NO = 2
499527 EOL = 3
528+ PROHIBITED = 4
500529
501530 @staticmethod
502531 def from_features (
503- updates_available : Optional [bool ], supported : Optional [str ] = None
532+ updates_available : Optional [bool ],
533+ supported : Optional [str ] = None ,
534+ prohibited : Optional [str ] = None ,
504535 ) -> "UpdatesAvailable" :
536+ if prohibited :
537+ return UpdatesAvailable .PROHIBITED
505538 if not supported :
506539 return UpdatesAvailable .EOL
507540 if updates_available :
@@ -512,6 +545,8 @@ def from_features(
512545
513546 @property
514547 def color (self ):
548+ if self is UpdatesAvailable .PROHIBITED :
549+ return label_color_theme ("red" )
515550 if self is UpdatesAvailable .YES :
516551 return label_color_theme ("green" )
517552 if self is UpdatesAvailable .MAYBE :
@@ -522,7 +557,9 @@ def color(self):
522557 return label_color_theme ("red" )
523558
524559 def __str__ (self ):
525- if self is UpdatesAvailable .YES :
560+ if self is UpdatesAvailable .PROHIBITED :
561+ name = "START PROHIBITED"
562+ elif self is UpdatesAvailable .YES :
526563 name = "YES"
527564 elif self is UpdatesAvailable .MAYBE :
528565 name = "MAYBE"
0 commit comments