def start(self):
        while True:
            idx = Dialog().select(tr(30007), WINDOWS.values())
            if idx == -1:
                break
            window = WINDOWS.keys()[idx]

            while True:
                idx = Dialog().select(tr(30008), ACTIONS.keys())
                if idx == -1:
                    break
                category = ACTIONS.keys()[idx]

                while True:
                    curr_keymap = self._current_keymap(window, category)
                    labels = [
                        "%s - %s" % (name, key) for _, key, name in curr_keymap
                    ]
                    idx = Dialog().select(tr(30009), labels)
                    if idx == -1:
                        break
                    action, oldkey, _ = curr_keymap[idx]
                    newkey = self._record_key()

                    old = (window, action, oldkey)
                    new = (window, action, newkey)
                    if old in self.userkeymap:
                        self.userkeymap.remove(old)
                    self.userkeymap.append(new)
                    if old != new:
                        self.dirty = True
 def onInit(self):
     try:
         self.getControl(401).addLabel(tr(30001))
         self.getControl(402).addLabel(tr(30002))
     except:
         self.getControl(401).setLabel(tr(30001))
         self.getControl(402).setLabel(tr(30002))
 def onInit(self):
   try:
     self.getControl(401).addLabel(tr(30001))
     self.getControl(402).addLabel(tr(30002))
   except:
     self.getControl(401).setLabel(tr(30001))
     self.getControl(402).setLabel(tr(30002))
 def start(self):
   while True:
     idx = Dialog().select(tr(30007), WINDOWS.values())
     if idx == -1:
       break
     window = WINDOWS.keys()[idx]
     
     while True:
       idx = Dialog().select(tr(30008), ACTIONS.keys())
       if idx == -1:
         break
       category = ACTIONS.keys()[idx]
       
       while True:
         curr_keymap = self._current_keymap(window, category)
         labels = [ "%s - %s" % (name, key) for _, key, name in curr_keymap ]
         idx = Dialog().select(tr(30009), labels)
         if idx == -1:
           break
         action, oldkey, _ = curr_keymap[idx]
         newkey = self._record_key()
         
         old = (window, action, oldkey)
         new = (window, action, newkey)
         if old in self.userkeymap:
           self.userkeymap.remove(old)
         self.userkeymap.append(new)
         if old != new:
           self.dirty = True
Exemple #5
0
def reset_pin_dialog(side):
    run_xdotool_key(*nav('p'))
    time.sleep(DIALOG_DELAY)  # wait a bit for the dialog to appear
    # Need to actually place pin to set settings.A2
    run_xdotool_key('Tab', 'Tab', *nav('10U'), *(['Tab'] * 4), *nav('4U'),
                    'Tab', *tr('2.54'), *nav('E'))
    time.sleep(DIALOG_DELAY)  # wait a bit for the dialog to appear
    run_xdotool_key(*nav('E' + PIN_DIR[side][1] * 2))
Exemple #6
0
def insert_pins(prefix, numbers, pin_type, side):
    """
    Inserts pins of a certain type on a given side.

    :param prefix: Base name of a pin, e.g. A5 => A
    :param numbers: Pin numbers to add
    :param pin_type: Pin type
    :param side: Pin side (up, left, right, down)
    :return:
    """
    prefix = prefix.upper()
    for i, pin_number in enumerate(numbers):
        pin_name = prefix
        if len(numbers) > 1:
            pin_name += str(i)
        run_xdotool_key(*nav('p'))
        time.sleep(DIALOG_DELAY)  # wait a bit for the dialog to appear
        run_xdotool_key(*tr(pin_name), 'Tab', *tr(pin_number), 'Tab')
        if i == 0:  # Set up pin properties.
            run_xdotool_key(*(['Down'] * PIN_TYPES[pin_type]), *(['Tab'] * 4),
                            *(['Down'] * PIN_DIR[side][0]))
        run_xdotool_key('Tab', 'Tab', *nav('E'))
        time.sleep(DIALOG_DELAY)  # wait a bit for the dialog to disappear
        run_xdotool_key(*nav('E' + PIN_DIR[side][1] * 2))
def main_loop():
  confirm_discard = False
  while True:
    idx = Dialog().select(tr(30000), [tr(30003), tr(30004), tr(30005)])
    if idx == 0:
      confirm_discard = edit()
    elif idx == 1:
      delete()
    elif idx == 2:
      save()
      xbmc.executebuiltin("action(reloadkeymaps)")
      break
    elif idx == -1 and confirm_discard:
      if Dialog().yesno(tr(30000), tr(30006)) == 1:
        break
    else:
      break