Ejemplo 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)
Ejemplo n.º 2
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)
Ejemplo 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'])
        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
Ejemplo n.º 4
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)
        # Bluetooth >= 4 devices use Appearance property
        appearance = device.Appearance
        if klass != "uncategorized" and klass != "unknown":
            icon = self.get_device_icon(klass, device.Icon)
            # get translated version
            description = get_minor_class(device.Class, True).capitalize()
        elif klass == "unknown" and appearance:
            icon = self.get_device_icon(klass, device.Icon)
            description = gatt_appearance_to_name(appearance)
        else:
            icon = get_icon(device.Icon, 48, "blueman")
            description = klass.capitalize()

        name = device.Alias
        address = device.Address

        caption = self.make_caption(name, description, 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
Ejemplo 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