# Path: multi_input_box.py
# class MultiInputBox(Popup):
#     ok_text = StringProperty('OK')
#     cancel_text = StringProperty('Cancel')
# 
#     def __init__(self, **kwargs):
#         self.window = Window
#         super(MultiInputBox, self).__init__(**kwargs)
#         self.content = self.ids["content"]
#         self.contentButtons = self.ids["contentButtons"]
#         self.wl = []
# 
#     def _dismiss(self):
#         self.dismiss()
# 
#     def open(self):
#         super(MultiInputBox, self).open()
# 
#     def _ok(self):
#         if self.optionCallBack is not None:
#             opts = {}
#             for x in self.wl:
#                 opts[x[0]] = x[1].text
#             self.optionCallBack(opts)
#         self.dismiss()
# 
#     def on_open(self):
#         if self.wl:
#             self.wl[0][1].focus = True
# 
#     def setOptions(self, options, callBack):
#         self.optionCallBack = callBack
#         self.contentButtons.clear_widgets()
#         self.wl = []
#         for name in options:
#             self.contentButtons.add_widget(Label(text=name, size_hint_y=None, height='30dp', halign='right'))
#             tw = TextInput(multiline=False, write_tab=False, use_bubble=False, use_handles=False)
#             self.contentButtons.add_widget(tw)
#             self.wl.append((name, tw))


import kivy
import configparser
import subprocess
import threading
import select
import re
import os
from kivy.app import App
from kivy.logger import Logger
from kivy.uix.stacklayout import StackLayout
from kivy.config import ConfigParser
from kivy.clock import Clock, mainthread
from kivy.factory import Factory
from multi_input_box import MultiInputBox
from functools import partial
                cmd += name

        if len(cmd) <= 3:
            cmd = ""
        else:
            cmd += "\n"

        return cmd

    @mainthread
    def switch_response(self, name, value):
        # check response and compare state with current state and toggle to match state if necessary
        t = self.toggle_buttons.get(name, None)
        if t is None:
            Logger.error("MacrosWidget: switch_response no toggle button named: {}".format(name))
            return

        if value == '0' and t[4].state != 'normal':
            t[4].state = 'normal'
            t[4].text = t[0]
        elif value == '1' and t[4].state == 'normal':
            t[4].state = 'down'
            t[4].text = t[1]

    def _substitute_args(self, m, arg):
        """ substitute {?prompt}) with prompted value """

        # get arguments to prompt for
        v = [x[2:-1] for x in m]


# Path: multi_input_box.py
# class MultiInputBox(Popup):
#     ok_text = StringProperty('OK')
#     cancel_text = StringProperty('Cancel')
# 
#     def __init__(self, **kwargs):
#         self.window = Window
#         super(MultiInputBox, self).__init__(**kwargs)
#         self.content = self.ids["content"]
#         self.contentButtons = self.ids["contentButtons"]
#         self.wl = []
# 
#     def _dismiss(self):
#         self.dismiss()
# 
#     def open(self):
#         super(MultiInputBox, self).open()
# 
#     def _ok(self):
#         if self.optionCallBack is not None:
#             opts = {}
#             for x in self.wl:
#                 opts[x[0]] = x[1].text
#             self.optionCallBack(opts)
#         self.dismiss()
# 
#     def on_open(self):
#         if self.wl:
#             self.wl[0][1].focus = True
# 
#     def setOptions(self, options, callBack):
#         self.optionCallBack = callBack
#         self.contentButtons.clear_widgets()
#         self.wl = []
#         for name in options:
#             self.contentButtons.add_widget(Label(text=name, size_hint_y=None, height='30dp', halign='right'))
#             tw = TextInput(multiline=False, write_tab=False, use_bubble=False, use_handles=False)
#             self.contentButtons.add_widget(tw)
#             self.wl.append((name, tw))


# Path: macros_widget.py
import kivy
import configparser
import subprocess
import threading
import select
import re
import os
from kivy.app import App
from kivy.logger import Logger
from kivy.uix.stacklayout import StackLayout
from kivy.config import ConfigParser
from kivy.clock import Clock, mainthread
from kivy.factory import Factory
from multi_input_box import MultiInputBox
from functools import partial

                cmd += name

        if len(cmd) <= 3:
            cmd = ""
        else:
            cmd += "\n"

        return cmd

    @mainthread
    def switch_response(self, name, value):
        # check response and compare state with current state and toggle to match state if necessary
        t = self.toggle_buttons.get(name, None)
        if t is None:
            Logger.error("MacrosWidget: switch_response no toggle button named: {}".format(name))
            return

        if value == '0' and t[4].state != 'normal':
            t[4].state = 'normal'
            t[4].text = t[0]
        elif value == '1' and t[4].state == 'normal':
            t[4].state = 'down'
            t[4].text = t[1]

    def _substitute_args(self, m, arg):
        """ substitute {?prompt}) with prompted value """

        # get arguments to prompt for
        v = [x[2:-1] for x in m]


        mb = MultiInputBox(title="Arguments for {}".format(arg))