当前位置: 首页>>代码示例>>Python>>正文


Python Map.set_position方法代码示例

本文整理汇总了Python中map.Map.set_position方法的典型用法代码示例。如果您正苦于以下问题:Python Map.set_position方法的具体用法?Python Map.set_position怎么用?Python Map.set_position使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在map.Map的用法示例。


在下文中一共展示了Map.set_position方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_map

# 需要导入模块: from map import Map [as 别名]
# 或者: from map.Map import set_position [as 别名]
	def test_map(self):
		from gi.repository import Gtk
		try:
			from .config import Config
			from .map import Map
		except SystemError:
			from config import Config
			from map import Map
		test_config = Config(None).default_config["map"]
		test_map = Map(test_config)
		
		test_map.set_zoom(16)
		test_map.set_position(52.513, 13.323)
		test_map.add_marker("111", "green", 52.513, 13.322)
		test_map.add_marker("222", "red", 52.512, 13.322)
		test_map.add_marker("333", "orange", 52.512, 13.322)
		test_map.locate_marker("111")
		test_map.add_marker("222", "red", 52.510, 13.321)
		test_map.add_marker("333", "orange", 52.511, 13.322)
		test_map.add_marker("444", "green", 52.511, 13.322)
		test_map.add_marker("server1", "server1", 52.511, 13.321)
		
		test_map.set_position(52.513,13.323)
		test_map.zoom_out()
		test_map.zoom_in()
		test_map.on_map_pressed(None, None)
		test_map.change_source("openstreetmap")
		test_map.change_source("opencyclemap")
		test_map.remove_marker("333")
		
		test_map.add_track(52.513, 13.323,'server1', color=(0,16621,19455))
		test_map.add_track(52.510, 13.321,'server1')
		test_map.add_track(52.511, 13.321,'server1')
		test_map.set_track_color('server1', (65535,1,65535))
		
		test_window = Gtk.Window()
		test_window.set_title("Kismon Test Map")
		test_window.connect("destroy", Gtk.main_quit)
		test_window.show()
		test_window.set_size_request(640, 480)
		test_window.add(test_map.widget)
		test_window.show_all()
开发者ID:krzotr,项目名称:kismon,代码行数:44,代码来源:test.py

示例2: __init__

# 需要导入模块: from map import Map [as 别名]
# 或者: from map.Map import set_position [as 别名]

#.........这里部分代码省略.........
		self.main_window.network_list.crypt_cache = self.crypt_cache
		
		self.battery_max = None
		self.battery = None
		path = "/proc/acpi/battery/"
		if os.path.exists(path):
			for name in os.listdir(path):
				self.battery = name
				f = open("%s%s/info" % (path, name))
				for line in f.readlines():
					if line.startswith("last full capacity:"):
						max = line.split(":")[1].strip()
						self.battery_max = int(max.split()[0])
						break
				GObject.timeout_add(30000, self.update_battery_bar)
				break
		self.update_battery_bar()
		
		GLib.timeout_add(500, self.queue_handler)
		GLib.timeout_add(300, self.queue_handler_networks)
		GLib.idle_add(self.networks.apply_filters)
		
	def init_map(self):
		if self.map_error is not None:
			self.map = None
		else:
			try:
				from .map import Map
			except SystemError:
				from map import Map
			self.map = Map(self.config["map"])
			self.map.set_zoom(16)
			pos = self.config["map"]["last_position"].split("/")
			self.map.set_position(float(pos[0]), float(pos[1]), True)
		
	def init_client_thread(self):
		self.client_thread = ClientThread(self.config["kismet"]["server"])
		self.client_thread.client.set_capabilities(
			('status', 'source', 'info', 'gps', 'bssid', 'bssidsrc', 'ssid'))
		if "--create-kismet-dump" in sys.argv:
			self.client_thread.client.enable_dump()
		
	def client_start(self):
		if self.client_thread.is_running is True:
			self.client_stop()
		self.sources = {}
		self.init_client_thread()
		if "--load-kismet-dump" in sys.argv:
			self.client_thread.client.load_dump(sys.argv[2])
		self.client_thread.start()
		
	def client_stop(self):
		self.client_thread.stop()
		
	def queue_handler(self):
		if self.main_window.gtkwin is None:
			return False
			
		if len(self.client_thread.client.error) > 0:
			for error in self.client_thread.client.error:
				self.main_window.log_list.add(error)
			self.client_thread.client.error = []
		
		#gps
		gps = None
		fix = None
开发者ID:vaginessa,项目名称:kismon,代码行数:70,代码来源:core.py

示例3: __init__

# 需要导入模块: from map import Map [as 别名]
# 或者: from map.Map import set_position [as 别名]

#.........这里部分代码省略.........
	def queue_handler(self, server_id):
		server_name = self.config['kismet']['servers'][server_id]
		if self.main_window.gtkwin is None:
			return False
		
		thread = self.client_threads[server_id]
		if len(thread.client.error) > 0:
			for error in thread.client.error:
				self.main_window.log_list.add(server_name, error)
			thread.client.error = []
			self.main_window.server_tabs[server_id].server_switch.set_active(False)
			page_num = self.main_window.notebook.page_num(self.main_window.log_list.widget)
			self.main_window.notebook.set_current_page(page_num)
		
		#gps
		gps = None
		fix = None
		gps_queue = thread.get_queue("gps")
		while True:
			try:
				data = gps_queue.pop()
				if gps is None:
					gps = data
				if data["fix"] > 1:
					fix = (data["lat"], data["lon"])
					break
			except IndexError:
				break
		if gps is not None:
			self.main_window.server_tabs[server_id].update_gps_table(gps)
			if fix is not None and self.map is not None:
				server = "server%s" % (server_id + 1)
				if server_id == 0:
					self.map.set_position(fix[0], fix[1])
				else:
					self.map.add_marker(server, server, fix[0], fix[1])
				self.map.add_track(fix[0], fix[1], server_id)
		
		#status
		for data in thread.get_queue("status"):
			self.main_window.log_list.add(server_name, data["text"])
		
		#info
		info_queue = thread.get_queue("info")
		try:
			data = info_queue.pop()
			self.main_window.server_tabs[server_id].update_info_table(data)
		except IndexError:
			pass
			
		#source
		update = False
		for data in thread.get_queue("source"):
			uuid = data["uuid"]
			if uuid == "00000000-0000-0000-0000-000000000000":
				continue
			self.sources[server_id][uuid] = data
			
			update = True
		if update is True:
			self.main_window.server_tabs[server_id].update_sources_table(self.sources[server_id])
		
	def queues_handler(self):
		for server_id in self.client_threads:
			self.queue_handler(server_id)
		return True
开发者ID:krzotr,项目名称:kismon,代码行数:70,代码来源:core.py


注:本文中的map.Map.set_position方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。