Python sublime_plugin.WindowCommand() Examples

The following are 4 code examples of sublime_plugin.WindowCommand(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module sublime_plugin , or try the search function .
Example #1
Source File: __init__.py    From tandem with Apache License 2.0 5 votes vote down vote up
def __init__(self, param):
        # no super() call! this would get the references confused
        if isinstance(param, sublime.Window):
            self.window = param
            self._window_command = True  # probably called from build system
            self.typ = WindowCommand
        elif isinstance(param, sublime.View):
            self.view   = param
            self._window_command = False
            self.typ = TextCommand
        else:
            raise TypeError("Something really bad happened and you are responsible")

        self._update_members() 
Example #2
Source File: base.py    From sublime-elasticsearch-client with MIT License 5 votes vote down vote up
def __init__(self, *args, **kwargs):
        self.settings = Settings()
        sublime_plugin.WindowCommand.__init__(self, *args, **kwargs) 
Example #3
Source File: _init.py    From JavaScript-Completions with MIT License 4 votes vote down vote up
def setTimeout(time, func):
  timer = Timer(time, func)
  timer.start()

# class handle_settingCommand(sublime_plugin.WindowCommand) :
#   def run(self, folder_from_package, file_name, extension) :
#     open_setting(folder_from_package, file_name, extension)

#   def is_visible(self, folder_from_package, file_name, extension) :
#     if file_name.find(" (") >= 0 and file_name.find(" ("+PLATFORM+")") >= 0 :
#       return True
#     elif file_name.find(" (") >= 0 and file_name.find(" ("+PLATFORM+")") < 0 :
#       return False
#     return True
    
# def enable_setting(folder_from_package, file_name, extension) :
#   path = os.path.join(PACKAGE_PATH, folder_from_package)
#   file_name_enabled = file_name + "." + extension
#   file_name_disabled = file_name + "_disabled" + "." + extension
#   path_file_enabled = os.path.join(path, file_name_enabled)
#   path_file_disabled = os.path.join(path, file_name_disabled)
#   try :
#     if os.path.isfile(path_file_disabled) :
#       os.rename(path_file_disabled, path_file_enabled)
#   except Exception as e :
#     print("Error: "+traceback.format_exc())

# def disable_setting(folder_from_package, file_name, extension) :
#   path = os.path.join(PACKAGE_PATH, folder_from_package)
#   file_name_enabled = file_name + "." + extension
#   file_name_disabled = file_name + "_disabled" + "." + extension
#   path_file_enabled = os.path.join(path, file_name_enabled)
#   path_file_disabled = os.path.join(path, file_name_disabled)
#   try :
#     if os.path.isfile(path_file_enabled) :
#       os.rename(path_file_enabled, path_file_disabled)
#   except Exception as e :
#     print("Error: "+traceback.format_exc())

# def is_setting_enabled(folder_from_package, file_name, extension) :
#   path = os.path.join(PACKAGE_PATH, folder_from_package)
#   file_name_enabled = file_name + "." + extension
#   path_file_enabled = os.path.join(path, file_name_enabled)
#   return os.path.isfile(path_file_enabled)
      
# def open_setting(folder_from_package, file_name, extension) :
#   path = os.path.join(PACKAGE_PATH, folder_from_package)
#   file_name_enabled = file_name + "." + extension
#   file_name_disabled = file_name + "_disabled" + "." + extension
#   path_file_enabled = os.path.join(path, file_name_enabled)
#   path_file_disabled = os.path.join(path, file_name_disabled)

#   if os.path.isfile(path_file_enabled) :
#     sublime.active_window().open_file(path_file_enabled)
#   elif os.path.isfile(path_file_disabled) :
#     sublime.active_window().open_file(path_file_disabled) 
Example #4
Source File: _generated_2018_02_11_at_20_21_24.py    From JavaScript-Completions with MIT License 4 votes vote down vote up
def setTimeout(time, func):
  timer = Timer(time, func)
  timer.start()

# class handle_settingCommand(sublime_plugin.WindowCommand) :
#   def run(self, folder_from_package, file_name, extension) :
#     open_setting(folder_from_package, file_name, extension)

#   def is_visible(self, folder_from_package, file_name, extension) :
#     if file_name.find(" (") >= 0 and file_name.find(" ("+PLATFORM+")") >= 0 :
#       return True
#     elif file_name.find(" (") >= 0 and file_name.find(" ("+PLATFORM+")") < 0 :
#       return False
#     return True
    
# def enable_setting(folder_from_package, file_name, extension) :
#   path = os.path.join(PACKAGE_PATH, folder_from_package)
#   file_name_enabled = file_name + "." + extension
#   file_name_disabled = file_name + "_disabled" + "." + extension
#   path_file_enabled = os.path.join(path, file_name_enabled)
#   path_file_disabled = os.path.join(path, file_name_disabled)
#   try :
#     if os.path.isfile(path_file_disabled) :
#       os.rename(path_file_disabled, path_file_enabled)
#   except Exception as e :
#     print("Error: "+traceback.format_exc())

# def disable_setting(folder_from_package, file_name, extension) :
#   path = os.path.join(PACKAGE_PATH, folder_from_package)
#   file_name_enabled = file_name + "." + extension
#   file_name_disabled = file_name + "_disabled" + "." + extension
#   path_file_enabled = os.path.join(path, file_name_enabled)
#   path_file_disabled = os.path.join(path, file_name_disabled)
#   try :
#     if os.path.isfile(path_file_enabled) :
#       os.rename(path_file_enabled, path_file_disabled)
#   except Exception as e :
#     print("Error: "+traceback.format_exc())

# def is_setting_enabled(folder_from_package, file_name, extension) :
#   path = os.path.join(PACKAGE_PATH, folder_from_package)
#   file_name_enabled = file_name + "." + extension
#   path_file_enabled = os.path.join(path, file_name_enabled)
#   return os.path.isfile(path_file_enabled)
      
# def open_setting(folder_from_package, file_name, extension) :
#   path = os.path.join(PACKAGE_PATH, folder_from_package)
#   file_name_enabled = file_name + "." + extension
#   file_name_disabled = file_name + "_disabled" + "." + extension
#   path_file_enabled = os.path.join(path, file_name_enabled)
#   path_file_disabled = os.path.join(path, file_name_disabled)

#   if os.path.isfile(path_file_enabled) :
#     sublime.active_window().open_file(path_file_enabled)
#   elif os.path.isfile(path_file_disabled) :
#     sublime.active_window().open_file(path_file_disabled)