當前位置: 首頁>>代碼示例>>Python>>正文


Python GenericList.__init__方法代碼示例

本文整理匯總了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)
開發者ID:namili,項目名稱:blueman,代碼行數:62,代碼來源:DeviceList.py

示例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)
開發者ID:KunLiu1210,項目名稱:blueman,代碼行數:56,代碼來源:DeviceList.py


注:本文中的blueman.gui.GenericList.GenericList.__init__方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。