@@ -63,6 +63,8 @@ def __init__(self, builder, log, next_button):
63
63
self .page : Gtk .Box = self .builder .get_object ("list_page" )
64
64
self .stack : Gtk .Stack = self .builder .get_object ("main_stack" )
65
65
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 )
66
68
self .list_store : Optional [ListWrapper ] = None
67
69
68
70
checkbox_column : Gtk .TreeViewColumn = self .builder .get_object (
@@ -93,6 +95,8 @@ def __init__(self, builder, log, next_button):
93
95
"<b>MAYBE</b></span>" ,
94
96
OBSOLETE = f'<span foreground="{ label_color_theme ("red" )} ">'
95
97
"<b>OBSOLETE</b></span>" ,
98
+ PROHIBITED = f'<span foreground="{ label_color_theme ("red" )} ">'
99
+ "<b>START PROHIBITED</b></span>" ,
96
100
)
97
101
)
98
102
@@ -307,6 +311,25 @@ def _handle_cli_dom0(dom0, to_update, cliargs):
307
311
to_update = to_update .difference ({"dom0" })
308
312
return to_update
309
313
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
+
310
333
311
334
def is_stale (vm , expiration_period ):
312
335
if expiration_period is None :
@@ -345,16 +368,20 @@ def __init__(self, list_store, vm, to_update: bool):
345
368
346
369
icon = load_icon (vm .icon )
347
370
name = QubeName (vm .name , str (vm .label ))
371
+ prohibit_rationale = vm .features .get ("prohibit-start" , False )
348
372
349
373
raw_row = [
350
374
selected ,
351
375
icon ,
352
376
name ,
353
- UpdatesAvailable .from_features (updates_available , supported ),
377
+ UpdatesAvailable .from_features (
378
+ updates_available , supported , bool (prohibit_rationale )
379
+ ),
354
380
Date (last_updates_check ),
355
381
Date (last_update ),
356
382
0 ,
357
383
UpdateStatus .Undefined ,
384
+ prohibit_rationale ,
358
385
]
359
386
360
387
super ().__init__ (list_store , vm , raw_row )
@@ -390,6 +417,7 @@ def updates_available(self):
390
417
391
418
@updates_available .setter
392
419
def updates_available (self , value ):
420
+ prohibited = bool (self .vm .features .get ("prohibit-start" , False ))
393
421
updates_available = bool (
394
422
self .vm .features .get ("updates-available" , False )
395
423
)
@@ -398,7 +426,7 @@ def updates_available(self, value):
398
426
if value and not updates_available :
399
427
updates_available = None
400
428
self .raw_row [self ._UPDATES_AVAILABLE ] = UpdatesAvailable .from_features (
401
- updates_available , supported
429
+ updates_available , supported , prohibited
402
430
)
403
431
404
432
@property
@@ -497,11 +525,16 @@ class UpdatesAvailable(Enum):
497
525
MAYBE = 1
498
526
NO = 2
499
527
EOL = 3
528
+ PROHIBITED = 4
500
529
501
530
@staticmethod
502
531
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 ,
504
535
) -> "UpdatesAvailable" :
536
+ if prohibited :
537
+ return UpdatesAvailable .PROHIBITED
505
538
if not supported :
506
539
return UpdatesAvailable .EOL
507
540
if updates_available :
@@ -512,6 +545,8 @@ def from_features(
512
545
513
546
@property
514
547
def color (self ):
548
+ if self is UpdatesAvailable .PROHIBITED :
549
+ return label_color_theme ("red" )
515
550
if self is UpdatesAvailable .YES :
516
551
return label_color_theme ("green" )
517
552
if self is UpdatesAvailable .MAYBE :
@@ -522,7 +557,9 @@ def color(self):
522
557
return label_color_theme ("red" )
523
558
524
559
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 :
526
563
name = "YES"
527
564
elif self is UpdatesAvailable .MAYBE :
528
565
name = "MAYBE"
0 commit comments