本文整理汇总了Python中blueman.gui.GenericList.GenericList.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python GenericList.__init__方法的具体用法?Python GenericList.__init__怎么用?Python GenericList.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类blueman.gui.GenericList.GenericList
的用法示例。
在下文中一共展示了GenericList.__init__方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from blueman.gui.GenericList import GenericList [as 别名]
# 或者: from blueman.gui.GenericList.GenericList import __init__ [as 别名]
def __init__(self, adapter=None, tabledata=[]):
def on_adapter_removed(path):
self.emit("adapter-removed", path)
if path == self.__adapter_path:
self.clear()
self.Adapter = None
self.SetAdapter()
def on_adapter_added(path):
def on_activate():
dprint("adapter powered", path)
if self.Adapter == None:
self.SetAdapter(path)
self.emit("adapter-added", path)
a = Bluez.Adapter(path)
wait_for_adapter(a, on_activate)
#cache for fast lookup in the list
self.address_to_row = {}
self.path_to_row = {}
self.monitored_devices = []
self.discovered_devices = []
self.signals = SignalTracker()
try:
self.Manager = Bluez.Manager("gobject")
self.signals.Handle(self.Manager, on_adapter_removed, "AdapterRemoved")
self.signals.Handle(self.Manager, on_adapter_added, "AdapterAdded")
except:
self.Manager = None
self.__discovery_time = 0
self.__adapter_path = None
self.Adapter = None
self.discovering = False
data = []
data = data + tabledata
data = data + [
["device", object],
["dbus_path", str]
]
GenericList.__init__(self, data)
self.adapter_signals = SignalTracker()
self.device_signals = SignalTracker()
self.SetAdapter(adapter)
self.signals.Handle(self.selection, "changed", self.on_selection_changed)
示例2: __init__
# 需要导入模块: from blueman.gui.GenericList import GenericList [as 别名]
# 或者: from blueman.gui.GenericList.GenericList import __init__ [as 别名]
def __init__(self, adapter=None, tabledata=None):
Gtk.TreeView.__init__(self)
self.set_name("DeviceList")
if not tabledata:
tabledata = []
def on_adapter_removed(_manager, path):
self.emit("adapter-removed", path)
if path == self.__adapter_path:
self.clear()
self.Adapter = None
self.SetAdapter()
def on_adapter_added(_manager, path):
def on_activate():
dprint("adapter powered", path)
if self.Adapter is None:
self.SetAdapter(path)
self.emit("adapter-added", path)
a = Bluez.Adapter(path)
wait_for_adapter(a, on_activate)
#cache for fast lookup in the list
self.address_to_row = {}
self.path_to_row = {}
self.monitored_devices = []
self.manager = Bluez.Manager()
self.manager.connect_signal('adapter-removed', on_adapter_removed)
self.manager.connect_signal('adapter-added', on_adapter_added)
self.__discovery_time = 0
self.__adapter_path = None
self.Adapter = None
self.discovering = False
data = []
data = data + tabledata
data = data + [
["device", object],
["dbus_path", str]
]
GenericList.__init__(self, data)
self.SetAdapter(adapter)
self.selection.connect('changed', self.on_selection_changed)