3535
3636import gettext
3737
38+ from ..widgets .utils import get_boolean_feature
39+
3840t = gettext .translation ("desktop-linux-manager" , fallback = True )
3941_ = t .gettext
4042
@@ -234,6 +236,7 @@ def __init__(
234236 current_value : qubesadmin .vm .QubesVM | str | None = None ,
235237 style_changes : bool = False ,
236238 additional_options : dict [qubesadmin .vm .QubesVM | str | None , str ] | None = None ,
239+ show_internal : bool = False ,
237240 ):
238241 """
239242 :param combobox: target ComboBox object
@@ -254,12 +257,14 @@ def __init__(
254257 applied when combobox value changes
255258 :param additional_options: Dictionary of token: readable name of
256259 additonal options to be added to the combobox
260+ :param show_internal: if True, show qubes with internal feature enabled
257261 """
258262 self .qapp = qapp
259263 self .combo = combobox
260264 self .entry_box = self .combo .get_child ()
261265 self .change_function = event_callback
262266 self .style_changes = style_changes
267+ self .show_internal = show_internal
263268
264269 self ._entries : dict [str , dict [str , Any ]] = {}
265270
@@ -337,9 +342,23 @@ def _create_entries(
337342 "vm" : None ,
338343 }
339344
345+ found_current = False
346+ if current_value and current_value in self .qapp .domains :
347+ found_current = True
348+ domain = self .qapp .domains [current_value ]
349+ icon = self ._get_icon (domain .icon )
350+ vm_name = domain .name
351+ self ._entries [vm_name ] = {
352+ "api_name" : vm_name ,
353+ "icon" : icon ,
354+ "vm" : domain ,
355+ }
356+
340357 for domain in self .qapp .domains :
341358 if filter_function and not filter_function (domain ):
342359 continue
360+ if not self .show_internal and get_boolean_feature (domain , "internal" ):
361+ continue
343362 vm_name = domain .name
344363 icon = self ._get_icon (domain .icon )
345364 display_name = vm_name
@@ -353,8 +372,7 @@ def _create_entries(
353372 "vm" : domain ,
354373 }
355374
356- if current_value :
357- found_current = False
375+ if current_value and not found_current :
358376 for value in self ._entries .values ():
359377 if value ["api_name" ] == current_value :
360378 found_current = True
0 commit comments