From f4821dcef2ec1f67b22a1505118acb728beabfcf Mon Sep 17 00:00:00 2001 From: Pocco81 Date: Tue, 21 Dec 2021 23:58:53 -0500 Subject: [PATCH] added second python sample --- samples/python2.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 samples/python2.py diff --git a/samples/python2.py b/samples/python2.py new file mode 100644 index 0000000..20ede0b --- /dev/null +++ b/samples/python2.py @@ -0,0 +1,34 @@ +# Simple Python Sample +from __future__ import print_function + +import os +import threading +import sublime + +IS_ST3 = sublime.version().startswith('3') or sublime.version().startswith('4') + +def get_vcs_settings(): + """Returns list of dictionaries""" + if self.config.getboolean("verbose_stamps", fallback=False): + print("Sending command to sample-gtk: " + command) + + # Add a newline because the ui reads per line + command += " \n" + if self.gtk_proc: + # Send the command as bytes + self.gtk_proc.stdin.write(bytearray(command.encode("utf-8"))) + self.gtk_proc.stdin.flush() + try: + constructor = getattr(module, type) + except AttributeError: + print(_("Stamp error: Class {} not found").format(type)) + continue + else + instance = constructor() + instance.verbose = verbose + instance.config = config + +def do_when(conditional, callback, *args, **kwargs): + if conditional(): + return callback(*args, **kwargs) + sublime.set_timeout(functools.partial(do_when, conditional, callback, *args, **kwargs), 50)