Initial integration of behem0th.
This commit is contained in:
parent
5188457be5
commit
7f067f40e9
4 changed files with 31 additions and 3 deletions
|
@ -16,7 +16,9 @@ import sublime
|
|||
import sublime_plugin
|
||||
|
||||
from Highway import Client, Route, Pipe, DummyPipe
|
||||
from Utils import get_hostname
|
||||
from Utils import get_hostname, get_ip_from_url
|
||||
|
||||
import behem0th
|
||||
|
||||
from SublimeMenu import *
|
||||
import Logging
|
||||
|
@ -355,6 +357,8 @@ class Fl0w:
|
|||
self.main_menu += Entry("Disconnect", "Disconnect from server",
|
||||
action=self.invoke_disconnect)
|
||||
|
||||
self.sync_client = behem0th.Client(path=self.folder, verbose_log=True)
|
||||
|
||||
# Patch all sensor phantom that have been created before a fl0w instance
|
||||
# was attached to the window
|
||||
for sensor_phantom in sensor_phantoms:
|
||||
|
@ -503,7 +507,9 @@ class Fl0w:
|
|||
set_status("Connection opened '%s'" % self.folder, self.window)
|
||||
self.connected = True
|
||||
self.settings.set("address", address)
|
||||
except OSError as e:
|
||||
|
||||
self.sync_client.connect(get_ip_from_url(address))
|
||||
except (OSError, ConnectionRefusedError) as e:
|
||||
sublime.error_message("Error during connection creation:\n %s" % str(e))
|
||||
|
||||
|
||||
|
@ -523,6 +529,8 @@ class Fl0w:
|
|||
set_status("Connection closed '%s'" % self.folder, self.window)
|
||||
self.connected = False
|
||||
|
||||
self.sync_client.close()
|
||||
|
||||
|
||||
class Fl0wCommand(sublime_plugin.WindowCommand):
|
||||
def run(self):
|
||||
|
|
Reference in a new issue