LJ Archive

Listing 1. Mouse Configuration Module

class Mouse(clam.CLAM):
  def __init__(self, ui, name):
    # Base initialization - UI handle,
    # dialog name, NLS name
    clam.CLAM.__init__(self, ui, name,
        "peripherals/mouse")
  def run(self):
    self.mouse = dm.InstanceLookup(
        "peripherals.mouse.device");
    # Create prompt dialog
    d = self.promptDialog("mouse");
    # Add edit fields:
    d.addInstancePrompt(self.mouse,
        "model<15>")
    d.addInstancePrompt(self.mouse,
        "protocol<15>")
    d.addInstancePrompt(self.mouse,
        "deviceFile<15>")
    # Get marker for change log
    marker = self.mouse.getMarker();
    done = 0;
    while not done:
      # Execute dialog
      result = d.execute();
      if result = "true":
        done = self.commit(self.mouse, marker);
      else
        done = self.cancel(self.mouse, marker);
LJ Archive