Exemplo n.º 1
0
    def row_setup_event(self, tree_iter, device):
        if not self.get(tree_iter, "initial_anim")["initial_anim"]:
            cell_fader = CellFade(self, self.props.model.get_path(tree_iter),
                                  [2, 3, 4])
            row_fader = TreeRowFade(self, self.props.model.get_path(tree_iter))

            has_objpush = self._has_objpush(device)

            self.set(tree_iter,
                     row_fader=row_fader,
                     cell_fader=cell_fader,
                     levels_visible=False,
                     objpush=has_objpush)

            cell_fader.freeze()

            def on_finished(fader):
                fader.disconnect_by_func(on_finished)
                fader.freeze()

            row_fader.connect("animation-finished", on_finished)
            row_fader.set_state(0.0)
            row_fader.animate(start=0.0, end=1.0, duration=500)

            self.set(tree_iter, initial_anim=True)

        klass = get_minor_class(device['Class'])
        # Bluetooth >= 4 devices use Appearance property
        appearance = device["Appearance"]
        if klass != "uncategorized" and klass != "unknown":
            # get translated version
            description = get_minor_class(device['Class'], True).capitalize()
        elif klass == "unknown" and appearance:
            description = gatt_appearance_to_name(appearance)
        else:
            description = get_major_class(device['Class']).capitalize()

        icon_info = self.get_icon_info(device["Icon"], 48, False)
        caption = self.make_caption(device['Alias'], description,
                                    device['Address'])

        self.set(tree_iter,
                 caption=caption,
                 icon_info=icon_info,
                 alias=device['Alias'])

        try:
            self.row_update_event(tree_iter, "Trusted", device['Trusted'])
        except Exception as e:
            logging.exception(e)
        try:
            self.row_update_event(tree_iter, "Paired", device['Paired'])
        except Exception as e:
            logging.exception(e)
        try:
            self.row_update_event(tree_iter, "Connected", device["Connected"])
        except Exception as e:
            logging.exception(e)
Exemplo n.º 2
0
    def row_setup_event(self, tree_iter: Gtk.TreeIter, device: Device) -> None:
        if not self.get(tree_iter, "initial_anim")["initial_anim"]:
            assert self.liststore is not None
            child_path = self.liststore.get_path(tree_iter)
            result = self.filter.convert_child_path_to_path(child_path)

            if child_path is not None:
                cell_fader = CellFade(self, child_path, [2, 3, 4, 5])
                row_fader = TreeRowFade(self, child_path)

                self.set(tree_iter, row_fader=row_fader, cell_fader=cell_fader)

                cell_fader.freeze()

                if result is not None:
                    self._prepare_fader(row_fader).animate(start=0.0, end=1.0, duration=500)
                    self.set(tree_iter, initial_anim=True)
                else:
                    self.set(tree_iter, initial_anim=False)

        has_objpush = self._has_objpush(device)
        klass = get_minor_class(device['Class'])
        # Bluetooth >= 4 devices use Appearance property
        appearance = device["Appearance"]
        if klass != _("Uncategorized") and klass != _("Unknown"):
            description = klass
        elif klass == _("Unknown") and appearance:
            description = gatt_appearance_to_name(appearance)
        else:
            description = get_major_class(device['Class'])

        icon_info = self.get_icon_info(device["Icon"], 48, False)
        caption = self.make_caption(device['Alias'], description, device['Address'])

        self.set(tree_iter, caption=caption, icon_info=icon_info, alias=device['Alias'], objpush=has_objpush)

        try:
            self.row_update_event(tree_iter, "Trusted", device['Trusted'])
        except Exception as e:
            logging.exception(e)
        try:
            self.row_update_event(tree_iter, "Paired", device['Paired'])
        except Exception as e:
            logging.exception(e)
        try:
            self.row_update_event(tree_iter, "Connected", device["Connected"])
        except Exception as e:
            logging.exception(e)
        try:
            self.row_update_event(tree_iter, "Blocked", device["Blocked"])
        except Exception as e:
            logging.exception(e)

        if device["Connected"]:
            self._monitor_power_levels(tree_iter, device)
Exemplo n.º 3
0
    def row_setup_event(self, tree_iter, device):
        if not self.get(tree_iter, "initial_anim")["initial_anim"]:
            cell_fader = CellFade(self, self.props.model.get_path(tree_iter), [2, 3, 4])
            row_fader = TreeRowFade(self, self.props.model.get_path(tree_iter))

            has_objpush = self._has_objpush(device)

            self.set(tree_iter, row_fader=row_fader, cell_fader=cell_fader, levels_visible=False, objpush=has_objpush)

            cell_fader.freeze()

            def on_finished(fader):
                fader.disconnect(signal)
                fader.freeze()

            signal = row_fader.connect("animation-finished", on_finished)
            row_fader.set_state(0.0)
            row_fader.animate(start=0.0, end=1.0, duration=500)

            self.set(tree_iter, initial_anim=True)

        klass = get_minor_class(device['Class'])
        # Bluetooth >= 4 devices use Appearance property
        appearance = device["Appearance"]
        if klass != "uncategorized" and klass != "unknown":
            icon_names = ["blueman-" + klass.replace(" ", "-").lower(), device["Icon"], "blueman"]
            icon_info = self.get_icon_info(icon_names, 48, False)
            # get translated version
            description = get_minor_class(device['Class'], True).capitalize()
        elif klass == "unknown" and appearance:
            icon_names = [device["Icon"], "blueman"]
            icon_info = self.get_icon_info(icon_names, 48, False)
            description = gatt_appearance_to_name(appearance)
        else:
            icon_names = [device["Icon"], "blueman"]
            icon_info = self.get_icon_info(icon_names, 48, False)
            description = get_major_class(device['Class']).capitalize()

        caption = self.make_caption(device['Alias'], description, device['Address'])

        self.set(tree_iter, caption=caption, icon_info=icon_info, alias=device['Alias'])

        try:
            self.row_update_event(tree_iter, "Trusted", device['Trusted'])
        except Exception as e:
            logging.exception(e)
        try:
            self.row_update_event(tree_iter, "Paired", device['Paired'])
        except Exception as e:
            logging.exception(e)
        try:
            self.row_update_event(tree_iter, "Connected", device["Connected"])
        except Exception as e:
            logging.exception(e)
Exemplo n.º 4
0
    def row_setup_event(self, tree_iter, device):
        if not self.get(tree_iter, "initial_anim")["initial_anim"]:
            cell_fader = CellFade(self, self.props.model.get_path(tree_iter),
                                  [2, 3, 4])
            row_fader = TreeRowFade(self, self.props.model.get_path(tree_iter))

            has_objpush = self._has_objpush(device)

            self.set(tree_iter,
                     row_fader=row_fader,
                     cell_fader=cell_fader,
                     levels_visible=False,
                     objpush=has_objpush)

            cell_fader.freeze()

            def on_finished(fader):
                fader.disconnect(signal)
                fader.freeze()

            signal = row_fader.connect("animation-finished", on_finished)
            row_fader.set_state(0.0)
            row_fader.animate(start=0.0, end=1.0, duration=500)

            self.set(tree_iter, initial_anim=True)

        klass = get_minor_class(device['Class'])
        if klass != "uncategorized":
            icon = self.get_device_icon(klass)
            # get translated version
            klass = get_minor_class(device['Class'], True)
        else:
            icon = get_icon(device['Icon'], 48, "blueman")
            klass = get_major_class(device['Class'])

        name = device['Alias']
        address = device['Address']

        caption = self.make_caption(name, klass, address)

        # caption = "<span size='x-large'>%(0)s</span>\n<span size='small'>%(1)s</span>\n<i>%(2)s</i>" % {"0":name, "1":klass.capitalize(), "2":address}
        self.set(tree_iter, caption=caption, orig_icon=icon, alias=name)

        try:
            self.row_update_event(tree_iter, "Trusted", device['Trusted'])
        except:
            pass
        try:
            self.row_update_event(tree_iter, "Paired", device['Paired'])
        except:
            pass
Exemplo n.º 5
0
	def row_setup_event(self, iter, device):
		if not self.get(iter, "initial_anim")["initial_anim"]:
			
			cell_fader = CellFade(self, self.props.model.get_path(iter), [2,3,4])
			row_fader = TreeRowFade(self, self.props.model.get_path(iter))
		
		
			self.set(iter, row_fader=row_fader, cell_fader=cell_fader, levels_visible=False)
		
			cell_fader.freeze()		
			def on_finished(fader):
				fader.disconnect(signal)
				fader.freeze()
		
			signal = row_fader.connect("animation-finished", on_finished)
			row_fader.set_state(0.0)
			row_fader.animate(start=0.0, end=1.0, duration=500)
			
			self.set(iter, initial_anim=True)
		

		klass = get_minor_class(device.Class)
		if klass != "uncategorized":
			icon = self.get_device_icon(klass)
			#get translated version
			klass = get_minor_class(device.Class, True)
		else:
			icon = get_icon(device.Icon, 48, "blueman")
			klass = get_major_class(device.Class)

		name = device.Alias
		address = device.Address
		
		caption = self.make_caption(name, klass, address)
		
		#caption = "<span size='x-large'>%(0)s</span>\n<span size='small'>%(1)s</span>\n<i>%(2)s</i>" % {"0":name, "1":klass.capitalize(), "2":address}
		self.set(iter, caption=caption, orig_icon=icon)
		
		self.row_update_event(iter, "Fake", device.Fake)
		
		try:
			self.row_update_event(iter, "Trusted", device.Trusted)
		except:
			pass
		try:
			self.row_update_event(iter, "Paired", device.Paired)
		except:
			pass
Exemplo n.º 6
0
 def get_device_class(self, device):
     klass = get_minor_class(device.Class)
     if klass != "uncategorized":
         return get_minor_class(device.Class, True)
     else:
         return get_major_class(device.Class)
Exemplo n.º 7
0
 def get_device_class(device: Device) -> str:
     klass = get_minor_class(device['Class'])
     if klass != _("Uncategorized"):
         return klass
     else:
         return get_major_class(device['Class'])
Exemplo n.º 8
0
 def get_device_class(device):
     klass = get_minor_class(device['Class'])
     if klass != "uncategorized":
         return get_minor_class(device['Class'], True)
     else:
         return get_major_class(device['Class'])
Exemplo n.º 9
0
 def get_device_class(self, device):
     klass = get_minor_class(device.Class)
     if klass != "uncategorized":
         return get_minor_class(device.Class, True)
     else:
         return get_major_class(device.Class)