コード例 #1
0
ファイル: Manager.py プロジェクト: parr0tr1ver/blueman
    def inquiry(self):
        def prop_changed(lst, adapter, key_value):
            key, value = key_value
            if key == "Discovering" and not value:
                prog.finalize()
                self.List.disconnect_by_func(on_progress)
                self.List.disconnect_by_func(prop_changed)

        def on_progress(lst, frac):
            if abs(1.0 - frac) <= 0.00001:
                if not prog.started():
                    prog.start()
            else:
                prog.fraction(frac)

        prog = ManagerProgressbar(self, text=_("Searching"))
        prog.connect("cancelled", lambda x: self.List.stop_discovery())
        try:
            self.List.discover_devices()
        except Exception as e:
            prog.finalize()
            MessageArea.show_message(*e_(e))

        self.List.connect("discovery-progress", on_progress)
        self.List.connect("adapter-property-changed", prop_changed)
コード例 #2
0
        def fail(obj, result, _user_data):
            prog.message(_("Failed"))

            self.unset_op(device)
            logging.warning("fail %s" % result)
            msg, tb = e_(result.message)
            MessageArea.show_message(_("Connection Failed: ") + msg, tb)
コード例 #3
0
    def _handle_error_message(self, msg: str) -> None:
        msg = msg.split(":", 3)[-1].strip()

        # https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/gnu/errlist.h
        # https://git.musl-libc.org/cgit/musl/tree/src/errno/__strerror.h
        # https://git.uclibc.org/uClibc/tree/libc/string/_string_syserrmsgs.c
        if msg == "Protocol not available":
            # ENOPROTOOPT
            logging.warning(
                "No audio endpoints registered to bluetoothd. "
                "Pulseaudio Bluetooth module, bluez-alsa, PipeWire or other audio support missing."
            )
            msg = _("No audio endpoints registered")
        elif msg in ("Input/output error", "I/O error"):
            # EIO
            logging.warning(
                "bluetoothd reported input/output error. Check its logs for context."
            )
            msg = _("Input/output error")
        elif msg == "Host is down":
            # EHOSTDOWN (Bluetooth errors 0x04 (Page Timeout) or 0x3c (Advertising Timeout))
            msg = _("Device did not respond")
        elif msg == "Resource temporarily unavailable":
            # EAGAIN
            logging.warning(
                "bluetoothd reported resource temporarily unavailable. "
                "Retry or check its logs for context.")
            msg = _("Resource temporarily unavailable")

        if msg != "Cancelled":
            MessageArea.show_message(_("Connection Failed: ") + msg)
コード例 #4
0
        def fail(*args):
            prog.message(_("Failed"))

            self.unset_op(device)
            dprint("fail", args)
            MessageArea.show_message(
                _("Connection Failed: ") + e_(str(args[0])))
コード例 #5
0
ファイル: ManagerDeviceMenu.py プロジェクト: cschramm/blueman
        def fail(obj, result, _user_data):
            prog.message(_("Failed"))

            self.unset_op(device)
            logging.warning("fail %s" % result)
            msg, tb = e_(result.message)
            MessageArea.show_message(_("Connection Failed: ") + msg, tb)
コード例 #6
0
ファイル: Manager.py プロジェクト: infirit/blueman
    def inquiry(self):
        def prop_changed(lst, adapter, key_value):
            key, value = key_value
            if key == "Discovering" and not value:
                prog.finalize()
                self.List.disconnect(s1)
                self.List.disconnect(s2)

        def on_progress(lst, frac):
            if abs(1.0 - frac) <= 0.00001:
                if not prog.started():
                    prog.start()
            else:
                prog.fraction(frac)

        prog = ManagerProgressbar(self, text=_("Searching"))
        prog.connect("cancelled", lambda x: self.List.stop_discovery())
        try:
            self.List.discover_devices()
        except Exception as e:
            prog.finalize()
            MessageArea.show_message(*e_(e))

        s1 = self.List.connect("discovery-progress", on_progress)
        s2 = self.List.connect("adapter-property-changed", prop_changed)
コード例 #7
0
ファイル: ManagerDeviceMenu.py プロジェクト: Vinigas/blueman
        def fail(_obj: Optional[AppletService], result: GLib.Error,
                 _user_data: None) -> None:
            prog.message(_("Failed"))

            self.unset_op(device)
            logging.warning(f"fail {result}")
            msg, tb = e_(result.message)
            MessageArea.show_message(_("Connection Failed: ") + msg, tb)
コード例 #8
0
        def success(obj, result, _user_data):
            logging.info("success")
            prog.message(_("Success!"))

            if isinstance(service, SerialPort) and SERIAL_PORT_SVCLASS_ID == service.short_uuid:
                MessageArea.show_message(_("Serial port connected to %s") % result, None, "dialog-information")
            else:
                MessageArea.close()

            self.unset_op(device)
コード例 #9
0
ファイル: ManagerDeviceMenu.py プロジェクト: yars068/blueman
        def success(obj, result, _user_data):
            dprint("success")
            prog.message(_("Success!"))

            if isinstance(service, SerialPort) and SERIAL_PORT_SVCLASS_ID == uuid128_to_uuid16(service.uuid):
                MessageArea.show_message(_("Serial port connected to %s") % result, "dialog-information")
            else:
                MessageArea.close()

            self.unset_op(device)
コード例 #10
0
        def success(*args2):
            dprint("success", " ".join(args2))
            prog.message(_("Success!"))

            if isinstance(service, SerialPort) and SERIAL_PORT_SVCLASS_ID == uuid128_to_uuid16(service.uuid):
                MessageArea.show_message(_("Serial port connected to %s") % args2[0], "dialog-information")
            else:
                MessageArea.close()

            self.unset_op(device)
コード例 #11
0
ファイル: ManagerDeviceMenu.py プロジェクト: cschramm/blueman
        def success(obj, result, _user_data):
            logging.info("success")
            prog.message(_("Success!"))

            if isinstance(service, SerialPort) and SERIAL_PORT_SVCLASS_ID == service.short_uuid:
                MessageArea.show_message(_("Serial port connected to %s") % result, None, "dialog-information")
            else:
                MessageArea.close()

            self.unset_op(device)
コード例 #12
0
ファイル: ManagerDeviceMenu.py プロジェクト: GinoM/blueman
        def success(*args2):
            try:
                uuid16 = sdp_get_serial_type(device.Address, args[0])
            except:
                uuid16 = 0

            dprint("success", args2)
            prog.message(_("Success!"))

            if service_id == "serial" and SERIAL_PORT_SVCLASS_ID in uuid16:
                MessageArea.show_message(_("Serial port connected to %s") % args2[0], "dialog-information")
            else:
                MessageArea.close()

            self.unset_op(device)
コード例 #13
0
        def success(*args2):
            try:
                uuid16 = sdp_get_serial_type(device.Address, args[0])
            except:
                uuid16 = 0

            dprint("success", args2)
            prog.message(_("Success!"))

            if service_id == "serial" and SERIAL_PORT_SVCLASS_ID in uuid16:
                MessageArea.show_message(
                    _("Serial port connected to %s") % args2[0],
                    gtk.STOCK_DIALOG_INFO)
            else:
                MessageArea.close()

            self.unset_op(device)
コード例 #14
0
    def _handle_error_message(self, error: GLib.Error) -> None:
        err = self._get_errno(error)

        if err == errno.ENOPROTOOPT:
            logging.warning("No audio endpoints registered to bluetoothd. "
                            "Pulseaudio Bluetooth module, bluez-alsa, PipeWire or other audio support missing.")
            msg = _("No audio endpoints registered")
        elif err == errno.EIO:
            logging.warning("bluetoothd reported input/output error. Check its logs for context.")
            msg = _("Input/output error")
        elif err == errno.EHOSTDOWN:
            msg = _("Device did not respond")
        elif err == errno.EAGAIN:
            logging.warning("bluetoothd reported resource temporarily unavailable. "
                            "Retry or check its logs for context.")
            msg = _("Resource temporarily unavailable")
        else:
            msg = error.message.split(":", 3)[-1].strip()

        if msg != "Cancelled":
            MessageArea.show_message(_("Connection Failed: ") + msg)
コード例 #15
0
 def on_error(e: Exception) -> None:
     prog.finalize()
     MessageArea.show_message(*e_(e))
コード例 #16
0
 def on_result(res: int) -> None:
     if not res:
         MessageArea.show_message(_("Failed to change profile to %s" % profile))
コード例 #17
0
ファイル: ManagerDeviceMenu.py プロジェクト: namili/blueman
				def error(*args):
					dprint("err", args)
					prog_msg(_("Fail"))
					MessageArea.show_message(e_(str(args[0])))					
コード例 #18
0
ファイル: ManagerDeviceMenu.py プロジェクト: cschramm/blueman
 def fail(obj, result, user_date):
     logging.info("fail", result)
     prog.message(_("Failed"))
     self.unset_op(device)
     msg, tb = e_(result.message)
     MessageArea.show_message(_("Connection Failed: ") + msg)
コード例 #19
0
ファイル: ManagerDeviceMenu.py プロジェクト: cschramm/blueman
 def err(obj, result, user_date):
     logging.warning("disconnect failed %s" % result)
     msg, tb = e_(result.message)
     MessageArea.show_message(_("Disconnection Failed: ") + msg, tb)
     self.Generate()
コード例 #20
0
ファイル: ManagerDeviceMenu.py プロジェクト: yars068/blueman
        def fail(obj, result, _user_data):
            prog.message(_("Failed"))

            self.unset_op(device)
            dprint("fail", result)
            MessageArea.show_message(_("Connection Failed: ") + e_(str(result.message)))
コード例 #21
0
		def fail(*args):
			prog.message(_("Failed"))
			
			self.unset_op(device)
			dprint("fail", args)
			MessageArea.show_message(_("Connection Failed: ") + e_(str(args[0])))
コード例 #22
0
ファイル: ManagerDeviceMenu.py プロジェクト: vivjoind/blueman
 def err(obj, result, user_date):
     logging.warning("disconnect failed %s" % result)
     msg, tb = e_(result.message)
     MessageArea.show_message(_("Disconnection Failed: ") + msg, tb)
     self.generate()
コード例 #23
0
 def err(_obj: Optional[AppletService], result: GLib.Error, _user_date: None) -> None:
     logging.warning(f"disconnect failed {result}")
     msg, tb = e_(result.message)
     MessageArea.show_message(_("Disconnection Failed: ") + msg, tb)
     self.generate()
コード例 #24
0
ファイル: ManagerDeviceMenu.py プロジェクト: vivjoind/blueman
 def fail(obj, result, user_date):
     logging.info("fail", result)
     prog.message(_("Failed"))
     self.unset_op(device)
     msg, tb = e_(result.message)
     MessageArea.show_message(_("Connection Failed: ") + msg)
コード例 #25
0
 def error(*args):
     self.unset_op(device)
     prog.message(_("Fail"))
     MessageArea.show_message(e_(str(args[0])))
コード例 #26
0
				def error(*args):
					self.unset_op(device)
					prog.message(_("Fail"))
					MessageArea.show_message(e_(str(args[0])))					
コード例 #27
0
 def on_result(res):
     if not res:
         MessageArea.show_message(_("Failed to change profile to %s" % profile))