| 1 |
#!/usr/bin/python |
| 2 |
|
| 3 |
from gi.repository import Gio |
| 4 |
from gi.repository import GLib |
| 5 |
import os |
| 6 |
import argparse |
| 7 |
|
| 8 |
from blueman.Functions import set_proc_title, open_rfcomm |
| 9 |
|
| 10 |
|
| 11 |
def on_file_changed(monitor, file, other_file, event_type): |
| 12 |
if event_type == Gio.FileMonitorEvent.DELETED: |
| 13 |
loop.quit() |
| 14 |
|
| 15 |
parser = argparse.ArgumentParser() |
| 16 |
parser.add_argument("path", action="store") |
| 17 |
args = parser.parse_args() |
| 18 |
|
| 19 |
mon = Gio.File.new_for_path(args.path).monitor_file(Gio.FileMonitorFlags.NONE) |
| 20 |
mon.connect('changed', on_file_changed) |
| 21 |
|
| 22 |
fd = open_rfcomm(args.path, os.O_RDONLY) |
| 23 |
|
| 24 |
set_proc_title() |
| 25 |
loop = GLib.MainLoop() |
| 26 |
loop.run() |