modified bug fixed and remove added

This commit is contained in:
Volkan Şahin 2016-07-26 15:09:02 +03:00
parent a9cc40fb2f
commit 4548253fed

View file

@ -14,26 +14,24 @@ class FileEventHandler(FileSystemEventHandler):
self.path = plugin_path self.path = plugin_path
def process(self, event): def process(self, event):
if event.event_type == 'created':
result = Commander().set_event([None, 'load', '-p', event.src_path.replace(self.path, '')]) if event.src_path != self.path[:-1]:
if result is True: if event.event_type in ('created', 'modified', 'moved'):
if System.Ahenk.is_running() is True: plu_path = event.src_path
if event.event_type == 'moved':
plu_path = event.dest_path
result = Commander().set_event([None, 'load', '-p', plu_path.replace(self.path, '')])
if result is True and System.Ahenk.is_running() is True:
os.kill(int(System.Ahenk.get_pid_number()), signal.SIGALRM) os.kill(int(System.Ahenk.get_pid_number()), signal.SIGALRM)
elif event.event_type == 'deleted': elif event.event_type == 'deleted':
# TODO result = Commander().set_event([None, 'remove', '-p', event.src_path.replace(self.path, '')])
print('plugin removed') if result is True and System.Ahenk.is_running() is True:
os.kill(int(System.Ahenk.get_pid_number()), signal.SIGALRM)
def on_created(self, event): def on_any_event(self, event):
if event.is_directory: if event.is_directory:
self.process(event) self.process(event)
def on_deleted(self, event):
if event.is_directory:
self.process(event)
# def on_modified(self, event):
# print("MODIFIED-" + str(event.src_path))
class PluginInstallListener: class PluginInstallListener:
def listen(self, path): def listen(self, path):