Ejemplo n.º 1
0
 def model(self):
     cfg = defaults.Keyboard().retrieve()
     kbd = utils.system.Keyboard()
     model = {}
     model["keyboard.layout"] = cfg["layout"] or ""
     model["keyboard.layout_name"] = kbd.get_current_name() or "None"
     return model
Ejemplo n.º 2
0
        def prepare(self):
            cfg = self.config

            # Data size get's a special handling because it grabs the
            # remaining space
            data_size = cfg.get("storage.data_size", "-1")
            data_size = data_size if int(data_size) >= 0 else "-1"
            self.logger.debug("Using a data_size of %s" % data_size)

            model = defaults.Installation()

            model.install_on(init=[cfg["boot.device.current"]] +
                             cfg["installation.devices"],
                             root_size=cfg["storage.root_size"],
                             efi_size=cfg["storage.efi_size"],
                             swap_size=cfg["storage.swap_size"],
                             logging_size=cfg["storage.logging_size"],
                             config_size=cfg["storage.config_size"],
                             data_size=data_size)

            kbd = defaults.Keyboard()
            kbd.update(self.config["keyboard.layout"])

            vercfg = defaults.ConfigVersion()
            vercfg.set_to_current()
 def commit(self):
     try:
         model = defaults.Keyboard()
         model.update(layout=OVIRT_VARS["OVIRT_KEYBOARD_LAYOUT"])
         tx = model.transaction()
         tx()
     except:
         logger.warning("Unknown keyboard layout: %s" % \
                        OVIRT_VARS["OVIRT_KEYBOARD_LAYOUT"])
Ejemplo n.º 4
0
        def prepare(self):
            # Update/Write the config file
            cfg = self.config
            model = defaults.Installation()

            model.install_on(init=[cfg["boot.device"]] +
                             cfg["installation.devices"],
                             root_size=cfg["storage.root_size"],
                             efi_size=cfg["storage.efi_size"],
                             swap_size=cfg["storage.swap_size"],
                             logging_size=cfg["storage.logging_size"],
                             config_size=cfg["storage.config_size"],
                             data_size=cfg["storage.data_size"])

            kbd = defaults.Keyboard()
            kbd.update(self.config["keyboard.layout"])
Ejemplo n.º 5
0
    def on_merge(self, effective_changes):
        self.logger.debug("Saving keyboard page")
        changes = Changeset(self.pending_changes(False))
        effective_model = Changeset(self.model())
        effective_model.update(effective_changes)

        self.logger.debug("Changes: %s" % changes)
        self.logger.debug("Effective Model: %s" % effective_model)

        layout_keys = ["keyboard.layout"]

        txs = utils.Transaction("Updating keyboard related configuration")

        if changes.contains_any(layout_keys):
            model = defaults.Keyboard()
            model.update(*effective_model.values_for(layout_keys))
            txs += model.transaction()

        progress_dialog = ui.TransactionProgressDialog("dialog.txs", txs, self)
        progress_dialog.run()
Ejemplo n.º 6
0
 def model(self):
     cfg = defaults.Keyboard().retrieve()
     model = {}
     model["keyboard.layout"] = cfg["layout"] or ""
     return model
Ejemplo n.º 7
0
 def commit(self):
     model = defaults.Keyboard()
     model.update(layout=self.kbd_layout)
     tx = model.transaction()
     tx()