mirror of
https://github.com/Pardus-LiderAhenk/ahenk
synced 2024-11-25 00:42:26 +03:00
modified bug fixed and remove added
This commit is contained in:
parent
a9cc40fb2f
commit
4548253fed
1 changed files with 13 additions and 15 deletions
|
@ -14,26 +14,24 @@ class FileEventHandler(FileSystemEventHandler):
|
|||
self.path = plugin_path
|
||||
|
||||
def process(self, event):
|
||||
if event.event_type == 'created':
|
||||
result = Commander().set_event([None, 'load', '-p', event.src_path.replace(self.path, '')])
|
||||
if result is True:
|
||||
if System.Ahenk.is_running() is True:
|
||||
|
||||
if event.src_path != self.path[:-1]:
|
||||
if event.event_type in ('created', 'modified', 'moved'):
|
||||
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)
|
||||
elif event.event_type == 'deleted':
|
||||
result = Commander().set_event([None, 'remove', '-p', event.src_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)
|
||||
elif event.event_type == 'deleted':
|
||||
# TODO
|
||||
print('plugin removed')
|
||||
|
||||
def on_created(self, event):
|
||||
def on_any_event(self, event):
|
||||
if event.is_directory:
|
||||
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:
|
||||
def listen(self, path):
|
||||
|
|
Loading…
Reference in a new issue