Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sublime
- import sublime_plugin
- class ExampleCommand(sublime_plugin.WindowCommand):
- def handle_value(self, key_value, key_list, key_index, output_dict):
- key = key_list[key_index]
- output_dict[key] = key_value
- key_index += 1
- if key_index < len(key_list):
- self.handle_key(key_list, key_index, output_dict)
- else:
- print("Finished with: {}".format(output_dict))
- def handle_key(self, key_list, key_index, output_dict):
- key = key_list[key_index]
- self.window.show_input_panel(
- "Value for {}".format(key),
- output_dict.get(key, "foo"),
- lambda v: self.handle_value(v, key_list, key_index, output_dict),
- None, None)
- def run(self, my_dict):
- keys = list(my_dict.keys())
- if keys:
- self.handle_key(keys, 0, my_dict)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement