Esempio n. 1
0
    def __init__(self,
                 entries_info,
                 source,
                 rpc_operation,
                 targets_list,
                 target=None):
        sanitize_domain_name(source, assert_sanitized=True)
        sanitize_service_name(source, assert_sanitized=True)

        self._gtk_builder = Gtk.Builder()
        self._gtk_builder.add_from_file(self._source_file)
        self._rpc_window = self._gtk_builder.get_object(
            self._source_id['window'])
        self._rpc_ok_button = self._gtk_builder.get_object(
            self._source_id['ok'])
        self._rpc_cancel_button = self._gtk_builder.get_object(
            self._source_id['cancel'])
        self._rpc_label = self._gtk_builder.get_object(
            self._source_id['rpc_label'])
        self._source_entry = self._gtk_builder.get_object(
            self._source_id['source'])
        self._rpc_combo_box = self._gtk_builder.get_object(
            self._source_id['target'])
        self._error_bar = self._gtk_builder.get_object(
            self._source_id['error_bar'])
        self._error_message = self._gtk_builder.get_object(
            self._source_id['error_message'])
        self._target_name = None

        self._focus_helper = self._new_focus_stealing_helper()

        self._rpc_label.set_markup(
            self._escape_and_format_rpc_text(rpc_operation))

        self._entries_info = entries_info
        list_modeler = self._new_vm_list_modeler()

        list_modeler.apply_model(
            self._rpc_combo_box,
            targets_list,
            selection_trigger=self._update_ok_button_sensitivity,
            activation_trigger=self._clicked_ok)

        self._source_entry.set_text(source)
        list_modeler.apply_icon(self._source_entry, source)

        self._confirmed = None

        self._set_initial_target(source, target)

        self._connect_events()
    def __init__(self, entries_info, source, rpc_operation, targets_list,
            target=None):
        sanitize_domain_name(source, assert_sanitized=True)
        sanitize_service_name(source, assert_sanitized=True)

        self._gtk_builder = Gtk.Builder()
        self._gtk_builder.add_from_file(self._source_file)
        self._rpc_window = self._gtk_builder.get_object(
                                            self._source_id['window'])
        self._rpc_ok_button = self._gtk_builder.get_object(
                                            self._source_id['ok'])
        self._rpc_cancel_button = self._gtk_builder.get_object(
                                            self._source_id['cancel'])
        self._rpc_label = self._gtk_builder.get_object(
                                            self._source_id['rpc_label'])
        self._source_entry = self._gtk_builder.get_object(
                                            self._source_id['source'])
        self._rpc_combo_box = self._gtk_builder.get_object(
                                            self._source_id['target'])
        self._error_bar = self._gtk_builder.get_object(
                                            self._source_id['error_bar'])
        self._error_message = self._gtk_builder.get_object(
                                            self._source_id['error_message'])
        self._target_name = None

        self._focus_helper = self._new_focus_stealing_helper()

        self._rpc_label.set_markup(
                    self._escape_and_format_rpc_text(rpc_operation))

        self._entries_info = entries_info
        list_modeler = self._new_vm_list_modeler()

        list_modeler.apply_model(self._rpc_combo_box, targets_list,
                    selection_trigger=self._update_ok_button_sensitivity,
                    activation_trigger=self._clicked_ok)

        self._source_entry.set_text(source)
        list_modeler.apply_icon(self._source_entry, source)

        self._confirmed = None

        self._set_initial_target(source, target)

        self._connect_events()
Esempio n. 3
0
    def _create_entries(self):
        for name, vm in self._domains_info.items():
            if name.startswith('@dispvm:'):
                vm_name = name[len('@dispvm:'):]
                dispvm = True
            else:
                vm_name = name
                dispvm = False
            sanitize_domain_name(vm_name, assert_sanitized=True)

            icon = self._get_icon(vm.get('icon', None))

            if dispvm:
                display_name = 'Disposable VM ({})'.format(vm_name)
            else:
                display_name = vm_name
            self._entries[display_name] = {
                                   'api_name': name,
                                   'icon': icon,
                                   'vm': vm}