예제 #1
0
def start_chrome(use_default_chrome_profile=False):
  settings = sublime.load_settings('ChromeREPL.sublime-settings')

  chrome_port = settings.get('port')

  user_flags = settings.get('chrome_flags')

  flags = [
      '--remote-debugging-port={}'.format(chrome_port),
  ] + user_flags

  if not use_default_chrome_profile:
    data_dir = tempfile.TemporaryDirectory()
    flags.append('--user-data-dir={}'.format(data_dir))

  if settings.get('auto_open_devtools', True):
    flags.append('--auto-open-devtools-for-tabs')

  cmd = [ChromeREPLHelpers.get_chrome_path()] + flags

  try:
    subprocess.Popen(cmd)
  except Exception as e:
    sublime.error_message("Could not start Chrome, check the path in your settings")
    return False
예제 #2
0
def start_chrome():
  settings = sublime.load_settings('ChromeREPL.sublime-settings')

  chrome_port = settings.get('port')

  user_flags = settings.get('chrome_flags')
  flags = ['--remote-debugging-port={}'.format(chrome_port)] + user_flags
  if settings.get('auto_open_devtools', True):
    flags.append('--auto-open-devtools-for-tabs')

  cmd = [ChromeREPLHelpers.get_chrome_path()] + flags

  try:
    subprocess.Popen(cmd)
  except Exception as e:
    sublime.error_message("Could not start Chrome, check the path in your settings")
    return False
예제 #3
0
 def is_connected(self):
     return (self.chrome is not None and
             ChromeREPLHelpers.is_chrome_running_with_remote_debugging()
             and self.chrome.ws is not None and self.chrome.ws.connected)
예제 #4
0
 def is_enabled(self):
   return ChromeREPLHelpers.is_chrome_running_with_remote_debugging()
예제 #5
0
 def run(self):
   process = ChromeREPLHelpers.get_chrome_process()
   if process is not None:
     process.terminate()
     process.wait()
     start_chrome()
예제 #6
0
 def is_enabled(self):
   return (ChromeREPLHelpers.is_chrome_running() and
           not ChromeREPLHelpers.is_remote_debugging_enabled())
예제 #7
0
 def is_enabled(self):
   return not ChromeREPLHelpers.is_chrome_running()
예제 #8
0
 def restart_chrome(self, use_default_chrome_profile):
   process = ChromeREPLHelpers.get_chrome_process()
   if process is not None:
     process.terminate()
     process.wait()
     start_chrome(use_default_chrome_profile)