Skip to content

Commit

Permalink
Big re-format by black.
Browse files Browse the repository at this point in the history
  • Loading branch information
infirit committed Oct 9, 2023
1 parent 3800fd7 commit e89f1c6
Show file tree
Hide file tree
Showing 106 changed files with 2,202 additions and 1,520 deletions.
8 changes: 4 additions & 4 deletions apps/blueman-adapters.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import gettext


# support running uninstalled
_dirname = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
if 'BLUEMAN_SOURCE' in os.environ:
sys.path = [_dirname, os.path.join(_dirname, 'module', '.libs')] + sys.path
_dirname = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
if "BLUEMAN_SOURCE" in os.environ:
sys.path = [_dirname, os.path.join(_dirname, "module", ".libs")] + sys.path
os.environ["GSETTINGS_SCHEMA_DIR"] = os.path.join(_dirname, "data")

gettext.textdomain("@GETTEXT_PACKAGE@")
Expand All @@ -17,7 +17,7 @@ from blueman.Functions import create_parser, create_logger, set_proc_title
from blueman.main.Adapter import BluemanAdapters


if __name__ == '__main__':
if __name__ == "__main__":
parser = parser = create_parser()
parser.add_argument("--socket-id", dest="socket_id", action="store", type=int, metavar="ID")
parser.add_argument("adapter", nargs="?", metavar="ADAPTER NAME")
Expand Down
6 changes: 3 additions & 3 deletions apps/blueman-applet.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import gettext

# support running uninstalled
_dirname = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
if 'BLUEMAN_SOURCE' in os.environ:
sys.path = [_dirname, os.path.join(_dirname, 'module', '.libs')] + sys.path
if "BLUEMAN_SOURCE" in os.environ:
sys.path = [_dirname, os.path.join(_dirname, "module", ".libs")] + sys.path
os.environ["GSETTINGS_SCHEMA_DIR"] = os.path.join(_dirname, "data")

gettext.textdomain("@GETTEXT_PACKAGE@")
Expand All @@ -16,7 +16,7 @@ from blueman.Functions import create_logger, create_parser, set_proc_title
from blueman.main.Applet import BluemanApplet


if __name__ == '__main__':
if __name__ == "__main__":
parser = create_parser()
args = parser.parse_args()

Expand Down
8 changes: 4 additions & 4 deletions apps/blueman-manager.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import logging
import gettext

# support running uninstalled
_dirname = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
if 'BLUEMAN_SOURCE' in os.environ:
sys.path = [_dirname, os.path.join(_dirname, 'module', '.libs')] + sys.path
_dirname = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
if "BLUEMAN_SOURCE" in os.environ:
sys.path = [_dirname, os.path.join(_dirname, "module", ".libs")] + sys.path
os.environ["GSETTINGS_SCHEMA_DIR"] = os.path.join(_dirname, "data")

gettext.textdomain("@GETTEXT_PACKAGE@")
Expand All @@ -16,7 +16,7 @@ from blueman.main.Manager import Blueman
from blueman.Functions import set_proc_title, create_parser, create_logger


if __name__ == '__main__':
if __name__ == "__main__":
parser = create_parser()
args = parser.parse_args()

Expand Down
9 changes: 5 additions & 4 deletions apps/blueman-mechanism.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import logging
from blueman.main.MechanismApplication import MechanismApplication

# support running uninstalled
_dirname = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
if 'BLUEMAN_SOURCE' in os.environ:
sys.path = [_dirname, os.path.join(_dirname, 'module', '.libs')] + sys.path
_dirname = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
if "BLUEMAN_SOURCE" in os.environ:
sys.path = [_dirname, os.path.join(_dirname, "module", ".libs")] + sys.path
os.environ["GSETTINGS_SCHEMA_DIR"] = os.path.join(_dirname, "data")

from blueman.Functions import set_proc_title, create_logger, create_parser
Expand All @@ -18,10 +18,11 @@ class StreamToLogger:
"""
Fake file-like stream object that redirects writes to a logger instance.
"""

def __init__(self, logger, log_level=logging.INFO):
self.logger = logger
self.log_level = log_level
self.linebuf = ''
self.linebuf = ""

def write(self, buf):
for line in buf.rstrip().splitlines():
Expand Down
3 changes: 2 additions & 1 deletion apps/blueman-rfcomm-watcher.in
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@ def on_file_changed(monitor, file, other_file, event_type):
if event_type == Gio.FileMonitorEvent.DELETED:
loop.quit()


parser = argparse.ArgumentParser()
parser.add_argument("path", action="store")
args = parser.parse_args()

mon = Gio.File.new_for_path(args.path).monitor_file(Gio.FileMonitorFlags.NONE)
mon.connect('changed', on_file_changed)
mon.connect("changed", on_file_changed)

fd = open_rfcomm(args.path, os.O_RDONLY)

Expand Down
41 changes: 29 additions & 12 deletions apps/blueman-sendto.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ import logging
import gettext

import gi

gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, Gio

# support running uninstalled
_dirname = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
if 'BLUEMAN_SOURCE' in os.environ:
sys.path = [_dirname, os.path.join(_dirname, 'module', '.libs')] + sys.path
_dirname = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
if "BLUEMAN_SOURCE" in os.environ:
sys.path = [_dirname, os.path.join(_dirname, "module", ".libs")] + sys.path
os.environ["GSETTINGS_SCHEMA_DIR"] = os.path.join(_dirname, "data")

_ = gettext.gettext
Expand All @@ -25,7 +26,7 @@ from blueman.Functions import (
set_proc_title,
create_parser,
create_logger,
bmexit
bmexit,
)
from blueman.main.Sendto import Sender
from blueman.bluez.Manager import Manager
Expand Down Expand Up @@ -73,9 +74,11 @@ class SendTo:
self.adapter_path = adapter.get_object_path()

if parsed_args.delete:

def delete_files():
for file in self.files:
os.unlink(file)

atexit.register(delete_files)

if parsed_args.device is None:
Expand Down Expand Up @@ -106,7 +109,9 @@ class SendTo:

@staticmethod
def select_files():
d = Gtk.FileChooserDialog(title=_("Select files to send"), icon_name='blueman-send-symbolic', select_multiple=True)
d = Gtk.FileChooserDialog(
title=_("Select files to send"), icon_name="blueman-send-symbolic", select_multiple=True
)
d.add_buttons(_("_Cancel"), Gtk.ResponseType.REJECT, _("_OK"), Gtk.ResponseType.ACCEPT)
resp = d.run()

Expand All @@ -133,15 +138,27 @@ class SendTo:
return False


if __name__ == '__main__':
if __name__ == "__main__":
parser = create_parser(syslog=True)
parser.add_argument("-d", "--device", "--dest", dest="device", action="store",
help=_("Send files to this device"), metavar="ADDRESS")
parser.add_argument("-s", "--source", dest="source", action="store",
help=_("Source adapter. Takes address or adapter's name eg. hci0"), metavar="PATTERN")
parser.add_argument(
"-d",
"--device",
"--dest",
dest="device",
action="store",
help=_("Send files to this device"),
metavar="ADDRESS",
)
parser.add_argument(
"-s",
"--source",
dest="source",
action="store",
help=_("Source adapter. Takes address or adapter's name eg. hci0"),
metavar="PATTERN",
)
parser.add_argument("-u", "--delete", dest="delete", action="store_true", help=_("Delete files on exit"))
parser.add_argument("files", nargs="*", metavar="FILE",
help=_("Files to be send to the bluetooth device"))
parser.add_argument("files", nargs="*", metavar="FILE", help=_("Files to be send to the bluetooth device"))

args = parser.parse_args()

Expand Down
8 changes: 4 additions & 4 deletions apps/blueman-services.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import signal
import gettext

# support running uninstalled
_dirname = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
if 'BLUEMAN_SOURCE' in os.environ:
sys.path = [_dirname, os.path.join(_dirname, 'module', '.libs')] + sys.path
_dirname = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
if "BLUEMAN_SOURCE" in os.environ:
sys.path = [_dirname, os.path.join(_dirname, "module", ".libs")] + sys.path
os.environ["GSETTINGS_SCHEMA_DIR"] = os.path.join(_dirname, "data")

_ = gettext.gettext
Expand All @@ -19,7 +19,7 @@ from blueman.Functions import set_proc_title, setup_icon_path, create_logger, cr
from blueman.main.Services import BluemanServices


if __name__ == '__main__':
if __name__ == "__main__":
parser = create_parser()
args = parser.parse_args()

Expand Down
4 changes: 2 additions & 2 deletions apps/blueman-tray.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import gettext

# support running uninstalled
_dirname = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
if 'BLUEMAN_SOURCE' in os.environ:
if "BLUEMAN_SOURCE" in os.environ:
sys.path.insert(0, _dirname)

gettext.textdomain("@GETTEXT_PACKAGE@")
Expand All @@ -15,7 +15,7 @@ from blueman.Functions import set_proc_title, create_parser, create_logger
from blueman.main.Tray import BluemanTray


if __name__ == '__main__':
if __name__ == "__main__":
parser = create_parser()
args = parser.parse_args()

Expand Down
Loading

0 comments on commit e89f1c6

Please sign in to comment.