repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
partition
stringclasses
1 value
ArduPilot/MAVProxy
MAVProxy/tools/MAVExplorer.py
cmd_fft
def cmd_fft(args): '''display fft from log''' from MAVProxy.modules.lib import mav_fft if len(args) > 0: condition = args[0] else: condition = None child = multiproc.Process(target=mav_fft.mavfft_display, args=[mestate.filename,condition]) child.start()
python
def cmd_fft(args): '''display fft from log''' from MAVProxy.modules.lib import mav_fft if len(args) > 0: condition = args[0] else: condition = None child = multiproc.Process(target=mav_fft.mavfft_display, args=[mestate.filename,condition]) child.start()
[ "def", "cmd_fft", "(", "args", ")", ":", "from", "MAVProxy", ".", "modules", ".", "lib", "import", "mav_fft", "if", "len", "(", "args", ")", ">", "0", ":", "condition", "=", "args", "[", "0", "]", "else", ":", "condition", "=", "None", "child", "="...
display fft from log
[ "display", "fft", "from", "log" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/tools/MAVExplorer.py#L354-L362
train
ArduPilot/MAVProxy
MAVProxy/tools/MAVExplorer.py
cmd_save
def cmd_save(args): '''save a graph''' child = multiproc.Process(target=save_process, args=[mestate.last_graph, mestate.child_pipe_send_console, mestate.child_pipe_send_graph, mestate.status.msgs]) child.start()
python
def cmd_save(args): '''save a graph''' child = multiproc.Process(target=save_process, args=[mestate.last_graph, mestate.child_pipe_send_console, mestate.child_pipe_send_graph, mestate.status.msgs]) child.start()
[ "def", "cmd_save", "(", "args", ")", ":", "child", "=", "multiproc", ".", "Process", "(", "target", "=", "save_process", ",", "args", "=", "[", "mestate", ".", "last_graph", ",", "mestate", ".", "child_pipe_send_console", ",", "mestate", ".", "child_pipe_sen...
save a graph
[ "save", "a", "graph" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/tools/MAVExplorer.py#L450-L453
train
ArduPilot/MAVProxy
MAVProxy/tools/MAVExplorer.py
cmd_loadfile
def cmd_loadfile(args): '''callback from menu to load a log file''' if len(args) != 1: fileargs = " ".join(args) else: fileargs = args[0] if not os.path.exists(fileargs): print("Error loading file ", fileargs); return if os.name == 'nt': #convert slashes in Wi...
python
def cmd_loadfile(args): '''callback from menu to load a log file''' if len(args) != 1: fileargs = " ".join(args) else: fileargs = args[0] if not os.path.exists(fileargs): print("Error loading file ", fileargs); return if os.name == 'nt': #convert slashes in Wi...
[ "def", "cmd_loadfile", "(", "args", ")", ":", "if", "len", "(", "args", ")", "!=", "1", ":", "fileargs", "=", "\" \"", ".", "join", "(", "args", ")", "else", ":", "fileargs", "=", "args", "[", "0", "]", "if", "not", "os", ".", "path", ".", "exi...
callback from menu to load a log file
[ "callback", "from", "menu", "to", "load", "a", "log", "file" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/tools/MAVExplorer.py#L499-L511
train
ArduPilot/MAVProxy
MAVProxy/modules/mavproxy_GPSInput.py
GPSInputModule.cmd_port
def cmd_port(self, args): 'handle port selection' if len(args) != 1: print("Usage: port <number>") return self.port.close() self.portnum = int(args[0]) self.port = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) self.port.setsockopt(socke...
python
def cmd_port(self, args): 'handle port selection' if len(args) != 1: print("Usage: port <number>") return self.port.close() self.portnum = int(args[0]) self.port = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) self.port.setsockopt(socke...
[ "def", "cmd_port", "(", "self", ",", "args", ")", ":", "'handle port selection'", "if", "len", "(", "args", ")", "!=", "1", ":", "print", "(", "\"Usage: port <number>\"", ")", "return", "self", ".", "port", ".", "close", "(", ")", "self", ".", "portnum",...
handle port selection
[ "handle", "port", "selection" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_GPSInput.py#L97-L110
train
ArduPilot/MAVProxy
MAVProxy/modules/mavproxy_magical/wxvehicle.py
Vehicle.RunScript
def RunScript(self, script): ''' Actuate on the vehicle through a script. The script is a sequence of commands. Each command is a sequence with the first element as the command name and the remaining values as parameters. The script is executed asynchronously by a timer with a p...
python
def RunScript(self, script): ''' Actuate on the vehicle through a script. The script is a sequence of commands. Each command is a sequence with the first element as the command name and the remaining values as parameters. The script is executed asynchronously by a timer with a p...
[ "def", "RunScript", "(", "self", ",", "script", ")", ":", "self", ".", "script", "=", "script", "self", ".", "script_command", "=", "0", "self", ".", "script_command_start_time", "=", "0", "self", ".", "script_command_state", "=", "'ready'", "self", ".", "...
Actuate on the vehicle through a script. The script is a sequence of commands. Each command is a sequence with the first element as the command name and the remaining values as parameters. The script is executed asynchronously by a timer with a period of 0.1 seconds. At each timer tick,...
[ "Actuate", "on", "the", "vehicle", "through", "a", "script", ".", "The", "script", "is", "a", "sequence", "of", "commands", ".", "Each", "command", "is", "a", "sequence", "with", "the", "first", "element", "as", "the", "command", "name", "and", "the", "r...
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_magical/wxvehicle.py#L140-L178
train
ArduPilot/MAVProxy
MAVProxy/modules/mavproxy_ppp.py
PPPModule.ppp_read
def ppp_read(self, ppp_fd): '''called from main select loop in mavproxy when the pppd child sends us some data''' buf = os.read(ppp_fd, 100) if len(buf) == 0: # EOF on the child fd self.stop_ppp_link() return print("ppp packet len=%u" % len(buf...
python
def ppp_read(self, ppp_fd): '''called from main select loop in mavproxy when the pppd child sends us some data''' buf = os.read(ppp_fd, 100) if len(buf) == 0: # EOF on the child fd self.stop_ppp_link() return print("ppp packet len=%u" % len(buf...
[ "def", "ppp_read", "(", "self", ",", "ppp_fd", ")", ":", "buf", "=", "os", ".", "read", "(", "ppp_fd", ",", "100", ")", "if", "len", "(", "buf", ")", "==", "0", ":", "self", ".", "stop_ppp_link", "(", ")", "return", "print", "(", "\"ppp packet len=...
called from main select loop in mavproxy when the pppd child sends us some data
[ "called", "from", "main", "select", "loop", "in", "mavproxy", "when", "the", "pppd", "child", "sends", "us", "some", "data" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_ppp.py#L23-L33
train
ArduPilot/MAVProxy
MAVProxy/modules/mavproxy_ppp.py
PPPModule.start_ppp_link
def start_ppp_link(self): '''startup the link''' cmd = ['pppd'] cmd.extend(self.command) (self.pid, self.ppp_fd) = pty.fork() if self.pid == 0: os.execvp("pppd", cmd) raise RuntimeError("pppd exited") if self.ppp_fd == -1: print("Failed...
python
def start_ppp_link(self): '''startup the link''' cmd = ['pppd'] cmd.extend(self.command) (self.pid, self.ppp_fd) = pty.fork() if self.pid == 0: os.execvp("pppd", cmd) raise RuntimeError("pppd exited") if self.ppp_fd == -1: print("Failed...
[ "def", "start_ppp_link", "(", "self", ")", ":", "cmd", "=", "[", "'pppd'", "]", "cmd", ".", "extend", "(", "self", ".", "command", ")", "(", "self", ".", "pid", ",", "self", ".", "ppp_fd", ")", "=", "pty", ".", "fork", "(", ")", "if", "self", "...
startup the link
[ "startup", "the", "link" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_ppp.py#L35-L53
train
ArduPilot/MAVProxy
MAVProxy/modules/mavproxy_ppp.py
PPPModule.stop_ppp_link
def stop_ppp_link(self): '''stop the link''' if self.ppp_fd == -1: return try: self.mpself.select_extra.pop(self.ppp_fd) os.close(self.ppp_fd) os.waitpid(self.pid, 0) except Exception: pass self.pid = -1 self.ppp...
python
def stop_ppp_link(self): '''stop the link''' if self.ppp_fd == -1: return try: self.mpself.select_extra.pop(self.ppp_fd) os.close(self.ppp_fd) os.waitpid(self.pid, 0) except Exception: pass self.pid = -1 self.ppp...
[ "def", "stop_ppp_link", "(", "self", ")", ":", "if", "self", ".", "ppp_fd", "==", "-", "1", ":", "return", "try", ":", "self", ".", "mpself", ".", "select_extra", ".", "pop", "(", "self", ".", "ppp_fd", ")", "os", ".", "close", "(", "self", ".", ...
stop the link
[ "stop", "the", "link" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_ppp.py#L56-L68
train
ArduPilot/MAVProxy
MAVProxy/modules/mavproxy_ppp.py
PPPModule.cmd_ppp
def cmd_ppp(self, args): '''set ppp parameters and start link''' usage = "ppp <command|start|stop>" if len(args) == 0: print(usage) return if args[0] == "command": if len(args) == 1: print("ppp.command=%s" % " ".join(self.command)) ...
python
def cmd_ppp(self, args): '''set ppp parameters and start link''' usage = "ppp <command|start|stop>" if len(args) == 0: print(usage) return if args[0] == "command": if len(args) == 1: print("ppp.command=%s" % " ".join(self.command)) ...
[ "def", "cmd_ppp", "(", "self", ",", "args", ")", ":", "usage", "=", "\"ppp <command|start|stop>\"", "if", "len", "(", "args", ")", "==", "0", ":", "print", "(", "usage", ")", "return", "if", "args", "[", "0", "]", "==", "\"command\"", ":", "if", "len...
set ppp parameters and start link
[ "set", "ppp", "parameters", "and", "start", "link" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_ppp.py#L71-L87
train
ArduPilot/MAVProxy
MAVProxy/modules/lib/mp_module.py
MPModule.module_matching
def module_matching(self, name): '''Find a list of modules matching a wildcard pattern''' import fnmatch ret = [] for mname in self.mpstate.public_modules.keys(): if fnmatch.fnmatch(mname, name): ret.append(self.mpstate.public_modules[mname]) return re...
python
def module_matching(self, name): '''Find a list of modules matching a wildcard pattern''' import fnmatch ret = [] for mname in self.mpstate.public_modules.keys(): if fnmatch.fnmatch(mname, name): ret.append(self.mpstate.public_modules[mname]) return re...
[ "def", "module_matching", "(", "self", ",", "name", ")", ":", "import", "fnmatch", "ret", "=", "[", "]", "for", "mname", "in", "self", ".", "mpstate", ".", "public_modules", ".", "keys", "(", ")", ":", "if", "fnmatch", ".", "fnmatch", "(", "mname", "...
Find a list of modules matching a wildcard pattern
[ "Find", "a", "list", "of", "modules", "matching", "a", "wildcard", "pattern" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/mp_module.py#L63-L70
train
ArduPilot/MAVProxy
MAVProxy/modules/lib/mp_module.py
MPModule.get_time
def get_time(self): '''get time, using ATTITUDE.time_boot_ms if in SITL with SIM_SPEEDUP != 1''' systime = time.time() - self.mpstate.start_time_s if not self.mpstate.is_sitl: return systime try: speedup = int(self.get_mav_param('SIM_SPEEDUP',1)) except Ex...
python
def get_time(self): '''get time, using ATTITUDE.time_boot_ms if in SITL with SIM_SPEEDUP != 1''' systime = time.time() - self.mpstate.start_time_s if not self.mpstate.is_sitl: return systime try: speedup = int(self.get_mav_param('SIM_SPEEDUP',1)) except Ex...
[ "def", "get_time", "(", "self", ")", ":", "systime", "=", "time", ".", "time", "(", ")", "-", "self", ".", "mpstate", ".", "start_time_s", "if", "not", "self", ".", "mpstate", ".", "is_sitl", ":", "return", "systime", "try", ":", "speedup", "=", "int...
get time, using ATTITUDE.time_boot_ms if in SITL with SIM_SPEEDUP != 1
[ "get", "time", "using", "ATTITUDE", ".", "time_boot_ms", "if", "in", "SITL", "with", "SIM_SPEEDUP", "!", "=", "1" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/mp_module.py#L72-L83
train
ArduPilot/MAVProxy
MAVProxy/modules/lib/mp_module.py
MPModule.dist_string
def dist_string(self, val_meters): '''return a distance as a string''' if self.settings.dist_unit == 'nm': return "%.1fnm" % (val_meters * 0.000539957) if self.settings.dist_unit == 'miles': return "%.1fmiles" % (val_meters * 0.000621371) return "%um" % val_meters
python
def dist_string(self, val_meters): '''return a distance as a string''' if self.settings.dist_unit == 'nm': return "%.1fnm" % (val_meters * 0.000539957) if self.settings.dist_unit == 'miles': return "%.1fmiles" % (val_meters * 0.000621371) return "%um" % val_meters
[ "def", "dist_string", "(", "self", ",", "val_meters", ")", ":", "if", "self", ".", "settings", ".", "dist_unit", "==", "'nm'", ":", "return", "\"%.1fnm\"", "%", "(", "val_meters", "*", "0.000539957", ")", "if", "self", ".", "settings", ".", "dist_unit", ...
return a distance as a string
[ "return", "a", "distance", "as", "a", "string" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/mp_module.py#L150-L156
train
ArduPilot/MAVProxy
MAVProxy/modules/lib/mp_module.py
MPModule.speed_convert_units
def speed_convert_units(self, val_ms): '''return a speed in configured units''' if self.settings.speed_unit == 'knots': return val_ms * 1.94384 elif self.settings.speed_unit == 'mph': return val_ms * 2.23694 return val_ms
python
def speed_convert_units(self, val_ms): '''return a speed in configured units''' if self.settings.speed_unit == 'knots': return val_ms * 1.94384 elif self.settings.speed_unit == 'mph': return val_ms * 2.23694 return val_ms
[ "def", "speed_convert_units", "(", "self", ",", "val_ms", ")", ":", "if", "self", ".", "settings", ".", "speed_unit", "==", "'knots'", ":", "return", "val_ms", "*", "1.94384", "elif", "self", ".", "settings", ".", "speed_unit", "==", "'mph'", ":", "return"...
return a speed in configured units
[ "return", "a", "speed", "in", "configured", "units" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/mp_module.py#L170-L176
train
ArduPilot/MAVProxy
MAVProxy/modules/lib/mp_module.py
MPModule.set_prompt
def set_prompt(self, prompt): '''set prompt for command line''' if prompt and self.settings.vehicle_name: # add in optional vehicle name prompt = self.settings.vehicle_name + ':' + prompt self.mpstate.rl.set_prompt(prompt)
python
def set_prompt(self, prompt): '''set prompt for command line''' if prompt and self.settings.vehicle_name: # add in optional vehicle name prompt = self.settings.vehicle_name + ':' + prompt self.mpstate.rl.set_prompt(prompt)
[ "def", "set_prompt", "(", "self", ",", "prompt", ")", ":", "if", "prompt", "and", "self", ".", "settings", ".", "vehicle_name", ":", "prompt", "=", "self", ".", "settings", ".", "vehicle_name", "+", "':'", "+", "prompt", "self", ".", "mpstate", ".", "r...
set prompt for command line
[ "set", "prompt", "for", "command", "line" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/mp_module.py#L184-L189
train
ArduPilot/MAVProxy
MAVProxy/modules/lib/mp_module.py
MPModule.link_label
def link_label(link): '''return a link label as a string''' if hasattr(link, 'label'): label = link.label else: label = str(link.linknum+1) return label
python
def link_label(link): '''return a link label as a string''' if hasattr(link, 'label'): label = link.label else: label = str(link.linknum+1) return label
[ "def", "link_label", "(", "link", ")", ":", "if", "hasattr", "(", "link", ",", "'label'", ")", ":", "label", "=", "link", ".", "label", "else", ":", "label", "=", "str", "(", "link", ".", "linknum", "+", "1", ")", "return", "label" ]
return a link label as a string
[ "return", "a", "link", "label", "as", "a", "string" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/mp_module.py#L192-L198
train
ArduPilot/MAVProxy
MAVProxy/modules/lib/mp_module.py
MPModule.is_primary_vehicle
def is_primary_vehicle(self, msg): '''see if a msg is from our primary vehicle''' sysid = msg.get_srcSystem() if self.target_system == 0 or self.target_system == sysid: return True return False
python
def is_primary_vehicle(self, msg): '''see if a msg is from our primary vehicle''' sysid = msg.get_srcSystem() if self.target_system == 0 or self.target_system == sysid: return True return False
[ "def", "is_primary_vehicle", "(", "self", ",", "msg", ")", ":", "sysid", "=", "msg", ".", "get_srcSystem", "(", ")", "if", "self", ".", "target_system", "==", "0", "or", "self", ".", "target_system", "==", "sysid", ":", "return", "True", "return", "False...
see if a msg is from our primary vehicle
[ "see", "if", "a", "msg", "is", "from", "our", "primary", "vehicle" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/mp_module.py#L200-L205
train
ArduPilot/MAVProxy
MAVProxy/modules/lib/grapher.py
MavGraph.next_flightmode_colour
def next_flightmode_colour(self): '''allocate a colour to be used for a flight mode''' if self.flightmode_colour_index > len(flightmode_colours): print("Out of colours; reusing") self.flightmode_colour_index = 0 ret = flightmode_colours[self.flightmode_colour_index] ...
python
def next_flightmode_colour(self): '''allocate a colour to be used for a flight mode''' if self.flightmode_colour_index > len(flightmode_colours): print("Out of colours; reusing") self.flightmode_colour_index = 0 ret = flightmode_colours[self.flightmode_colour_index] ...
[ "def", "next_flightmode_colour", "(", "self", ")", ":", "if", "self", ".", "flightmode_colour_index", ">", "len", "(", "flightmode_colours", ")", ":", "print", "(", "\"Out of colours; reusing\"", ")", "self", ".", "flightmode_colour_index", "=", "0", "ret", "=", ...
allocate a colour to be used for a flight mode
[ "allocate", "a", "colour", "to", "be", "used", "for", "a", "flight", "mode" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/grapher.py#L146-L153
train
ArduPilot/MAVProxy
MAVProxy/modules/lib/grapher.py
MavGraph.flightmode_colour
def flightmode_colour(self, flightmode): '''return colour to be used for rendering a flight mode background''' if flightmode not in self.flightmode_colourmap: self.flightmode_colourmap[flightmode] = self.next_flightmode_colour() return self.flightmode_colourmap[flightmode]
python
def flightmode_colour(self, flightmode): '''return colour to be used for rendering a flight mode background''' if flightmode not in self.flightmode_colourmap: self.flightmode_colourmap[flightmode] = self.next_flightmode_colour() return self.flightmode_colourmap[flightmode]
[ "def", "flightmode_colour", "(", "self", ",", "flightmode", ")", ":", "if", "flightmode", "not", "in", "self", ".", "flightmode_colourmap", ":", "self", ".", "flightmode_colourmap", "[", "flightmode", "]", "=", "self", ".", "next_flightmode_colour", "(", ")", ...
return colour to be used for rendering a flight mode background
[ "return", "colour", "to", "be", "used", "for", "rendering", "a", "flight", "mode", "background" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/grapher.py#L155-L159
train
ArduPilot/MAVProxy
MAVProxy/modules/lib/grapher.py
MavGraph.setup_xrange
def setup_xrange(self, xrange): '''setup plotting ticks on x axis''' if self.xaxis: return xrange *= 24 * 60 * 60 interval = 1 intervals = [ 1, 2, 5, 10, 15, 30, 60, 120, 240, 300, 600, 900, 1800, 3600, 7200, 5*3600, 10*3600, 24*3600 ] fo...
python
def setup_xrange(self, xrange): '''setup plotting ticks on x axis''' if self.xaxis: return xrange *= 24 * 60 * 60 interval = 1 intervals = [ 1, 2, 5, 10, 15, 30, 60, 120, 240, 300, 600, 900, 1800, 3600, 7200, 5*3600, 10*3600, 24*3600 ] fo...
[ "def", "setup_xrange", "(", "self", ",", "xrange", ")", ":", "if", "self", ".", "xaxis", ":", "return", "xrange", "*=", "24", "*", "60", "*", "60", "interval", "=", "1", "intervals", "=", "[", "1", ",", "2", ",", "5", ",", "10", ",", "15", ",",...
setup plotting ticks on x axis
[ "setup", "plotting", "ticks", "on", "x", "axis" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/grapher.py#L161-L173
train
ArduPilot/MAVProxy
MAVProxy/modules/lib/grapher.py
MavGraph.xlim_changed
def xlim_changed(self, axsubplot): '''called when x limits are changed''' xrange = axsubplot.get_xbound() xlim = axsubplot.get_xlim() self.setup_xrange(xrange[1] - xrange[0]) if self.draw_events == 0: # ignore limit change before first draw event return ...
python
def xlim_changed(self, axsubplot): '''called when x limits are changed''' xrange = axsubplot.get_xbound() xlim = axsubplot.get_xlim() self.setup_xrange(xrange[1] - xrange[0]) if self.draw_events == 0: # ignore limit change before first draw event return ...
[ "def", "xlim_changed", "(", "self", ",", "axsubplot", ")", ":", "xrange", "=", "axsubplot", ".", "get_xbound", "(", ")", "xlim", "=", "axsubplot", ".", "get_xlim", "(", ")", "self", ".", "setup_xrange", "(", "xrange", "[", "1", "]", "-", "xrange", "[",...
called when x limits are changed
[ "called", "when", "x", "limits", "are", "changed" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/grapher.py#L175-L186
train
ArduPilot/MAVProxy
MAVProxy/modules/lib/grapher.py
MavGraph.timestamp_to_days
def timestamp_to_days(self, timestamp): '''convert log timestamp to days''' if self.tday_base is None: try: self.tday_base = matplotlib.dates.date2num(datetime.datetime.fromtimestamp(timestamp+self.timeshift)) self.tday_basetime = timestamp except ...
python
def timestamp_to_days(self, timestamp): '''convert log timestamp to days''' if self.tday_base is None: try: self.tday_base = matplotlib.dates.date2num(datetime.datetime.fromtimestamp(timestamp+self.timeshift)) self.tday_basetime = timestamp except ...
[ "def", "timestamp_to_days", "(", "self", ",", "timestamp", ")", ":", "if", "self", ".", "tday_base", "is", "None", ":", "try", ":", "self", ".", "tday_base", "=", "matplotlib", ".", "dates", ".", "date2num", "(", "datetime", ".", "datetime", ".", "fromti...
convert log timestamp to days
[ "convert", "log", "timestamp", "to", "days" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/grapher.py#L362-L373
train
ArduPilot/MAVProxy
MAVProxy/modules/lib/grapher.py
MavGraph.xlim_change_check
def xlim_change_check(self, idx): '''handle xlim change requests from queue''' if not self.xlim_pipe[1].poll(): return xlim = self.xlim_pipe[1].recv() if xlim is None: return #print("recv: ", self.graph_num, xlim) if self.ax1 is not None and xlim !...
python
def xlim_change_check(self, idx): '''handle xlim change requests from queue''' if not self.xlim_pipe[1].poll(): return xlim = self.xlim_pipe[1].recv() if xlim is None: return #print("recv: ", self.graph_num, xlim) if self.ax1 is not None and xlim !...
[ "def", "xlim_change_check", "(", "self", ",", "idx", ")", ":", "if", "not", "self", ".", "xlim_pipe", "[", "1", "]", ".", "poll", "(", ")", ":", "return", "xlim", "=", "self", ".", "xlim_pipe", "[", "1", "]", ".", "recv", "(", ")", "if", "xlim", ...
handle xlim change requests from queue
[ "handle", "xlim", "change", "requests", "from", "queue" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/grapher.py#L429-L444
train
ArduPilot/MAVProxy
MAVProxy/modules/mavproxy_misc.py
MiscModule.cmd_lockup_autopilot
def cmd_lockup_autopilot(self, args): '''lockup autopilot for watchdog testing''' if len(args) > 0 and args[0] == 'IREALLYMEANIT': print("Sending lockup command") self.master.mav.command_long_send(self.settings.target_system, self.settings.target_component, ...
python
def cmd_lockup_autopilot(self, args): '''lockup autopilot for watchdog testing''' if len(args) > 0 and args[0] == 'IREALLYMEANIT': print("Sending lockup command") self.master.mav.command_long_send(self.settings.target_system, self.settings.target_component, ...
[ "def", "cmd_lockup_autopilot", "(", "self", ",", "args", ")", ":", "if", "len", "(", "args", ")", ">", "0", "and", "args", "[", "0", "]", "==", "'IREALLYMEANIT'", ":", "print", "(", "\"Sending lockup command\"", ")", "self", ".", "master", ".", "mav", ...
lockup autopilot for watchdog testing
[ "lockup", "autopilot", "for", "watchdog", "testing" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_misc.py#L147-L155
train
ArduPilot/MAVProxy
MAVProxy/modules/mavproxy_misc.py
MiscModule.cmd_gethome
def cmd_gethome(self, args): '''get home position''' self.master.mav.command_long_send(self.settings.target_system, 0, mavutil.mavlink.MAV_CMD_GET_HOME_POSITION, 0, 0, 0, 0, 0, 0...
python
def cmd_gethome(self, args): '''get home position''' self.master.mav.command_long_send(self.settings.target_system, 0, mavutil.mavlink.MAV_CMD_GET_HOME_POSITION, 0, 0, 0, 0, 0, 0...
[ "def", "cmd_gethome", "(", "self", ",", "args", ")", ":", "self", ".", "master", ".", "mav", ".", "command_long_send", "(", "self", ".", "settings", ".", "target_system", ",", "0", ",", "mavutil", ".", "mavlink", ".", "MAV_CMD_GET_HOME_POSITION", ",", "0",...
get home position
[ "get", "home", "position" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_misc.py#L215-L220
train
ArduPilot/MAVProxy
MAVProxy/modules/mavproxy_misc.py
MiscModule.cmd_led
def cmd_led(self, args): '''send LED pattern as override''' if len(args) < 3: print("Usage: led RED GREEN BLUE <RATE>") return pattern = [0] * 24 pattern[0] = int(args[0]) pattern[1] = int(args[1]) pattern[2] = int(args[2]) if len(...
python
def cmd_led(self, args): '''send LED pattern as override''' if len(args) < 3: print("Usage: led RED GREEN BLUE <RATE>") return pattern = [0] * 24 pattern[0] = int(args[0]) pattern[1] = int(args[1]) pattern[2] = int(args[2]) if len(...
[ "def", "cmd_led", "(", "self", ",", "args", ")", ":", "if", "len", "(", "args", ")", "<", "3", ":", "print", "(", "\"Usage: led RED GREEN BLUE <RATE>\"", ")", "return", "pattern", "=", "[", "0", "]", "*", "24", "pattern", "[", "0", "]", "=", "int", ...
send LED pattern as override
[ "send", "LED", "pattern", "as", "override" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_misc.py#L222-L240
train
ArduPilot/MAVProxy
MAVProxy/modules/mavproxy_misc.py
MiscModule.cmd_oreoled
def cmd_oreoled(self, args): '''send LED pattern as override, using OreoLED conventions''' if len(args) < 4: print("Usage: oreoled LEDNUM RED GREEN BLUE <RATE>") return lednum = int(args[0]) pattern = [0] * 24 pattern[0] = ord('R') pattern[1] = ord...
python
def cmd_oreoled(self, args): '''send LED pattern as override, using OreoLED conventions''' if len(args) < 4: print("Usage: oreoled LEDNUM RED GREEN BLUE <RATE>") return lednum = int(args[0]) pattern = [0] * 24 pattern[0] = ord('R') pattern[1] = ord...
[ "def", "cmd_oreoled", "(", "self", ",", "args", ")", ":", "if", "len", "(", "args", ")", "<", "4", ":", "print", "(", "\"Usage: oreoled LEDNUM RED GREEN BLUE <RATE>\"", ")", "return", "lednum", "=", "int", "(", "args", "[", "0", "]", ")", "pattern", "=",...
send LED pattern as override, using OreoLED conventions
[ "send", "LED", "pattern", "as", "override", "using", "OreoLED", "conventions" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_misc.py#L242-L260
train
ArduPilot/MAVProxy
MAVProxy/modules/mavproxy_misc.py
MiscModule.cmd_playtune
def cmd_playtune(self, args): '''send PLAY_TUNE message''' if len(args) < 1: print("Usage: playtune TUNE") return tune = args[0] str1 = tune[0:30] str2 = tune[30:] if sys.version_info.major >= 3 and not isinstance(str1, bytes): str1 = b...
python
def cmd_playtune(self, args): '''send PLAY_TUNE message''' if len(args) < 1: print("Usage: playtune TUNE") return tune = args[0] str1 = tune[0:30] str2 = tune[30:] if sys.version_info.major >= 3 and not isinstance(str1, bytes): str1 = b...
[ "def", "cmd_playtune", "(", "self", ",", "args", ")", ":", "if", "len", "(", "args", ")", "<", "1", ":", "print", "(", "\"Usage: playtune TUNE\"", ")", "return", "tune", "=", "args", "[", "0", "]", "str1", "=", "tune", "[", "0", ":", "30", "]", "...
send PLAY_TUNE message
[ "send", "PLAY_TUNE", "message" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_misc.py#L269-L283
train
ArduPilot/MAVProxy
MAVProxy/modules/mavproxy_misc.py
MiscModule.cmd_devid
def cmd_devid(self, args): '''decode device IDs from parameters''' for p in self.mav_param.keys(): if p.startswith('COMPASS_DEV_ID'): mp_util.decode_devid(self.mav_param[p], p) if p.startswith('INS_') and p.endswith('_ID'): mp_util.decode_devid(sel...
python
def cmd_devid(self, args): '''decode device IDs from parameters''' for p in self.mav_param.keys(): if p.startswith('COMPASS_DEV_ID'): mp_util.decode_devid(self.mav_param[p], p) if p.startswith('INS_') and p.endswith('_ID'): mp_util.decode_devid(sel...
[ "def", "cmd_devid", "(", "self", ",", "args", ")", ":", "for", "p", "in", "self", ".", "mav_param", ".", "keys", "(", ")", ":", "if", "p", ".", "startswith", "(", "'COMPASS_DEV_ID'", ")", ":", "mp_util", ".", "decode_devid", "(", "self", ".", "mav_pa...
decode device IDs from parameters
[ "decode", "device", "IDs", "from", "parameters" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_misc.py#L314-L320
train
ArduPilot/MAVProxy
MAVProxy/modules/mavproxy_map/__init__.py
MapModule.add_menu
def add_menu(self, menu): '''add to the default popup menu''' from MAVProxy.modules.mavproxy_map import mp_slipmap self.default_popup.add(menu) self.map.add_object(mp_slipmap.SlipDefaultPopup(self.default_popup, combine=True))
python
def add_menu(self, menu): '''add to the default popup menu''' from MAVProxy.modules.mavproxy_map import mp_slipmap self.default_popup.add(menu) self.map.add_object(mp_slipmap.SlipDefaultPopup(self.default_popup, combine=True))
[ "def", "add_menu", "(", "self", ",", "menu", ")", ":", "from", "MAVProxy", ".", "modules", ".", "mavproxy_map", "import", "mp_slipmap", "self", ".", "default_popup", ".", "add", "(", "menu", ")", "self", ".", "map", ".", "add_object", "(", "mp_slipmap", ...
add to the default popup menu
[ "add", "to", "the", "default", "popup", "menu" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_map/__init__.py#L114-L118
train
ArduPilot/MAVProxy
MAVProxy/modules/mavproxy_map/__init__.py
MapModule.colour_for_wp
def colour_for_wp(self, wp_num): '''return a tuple describing the colour a waypoint should appear on the map''' wp = self.module('wp').wploader.wp(wp_num) command = wp.command return self._colour_for_wp_command.get(command, (0,255,0))
python
def colour_for_wp(self, wp_num): '''return a tuple describing the colour a waypoint should appear on the map''' wp = self.module('wp').wploader.wp(wp_num) command = wp.command return self._colour_for_wp_command.get(command, (0,255,0))
[ "def", "colour_for_wp", "(", "self", ",", "wp_num", ")", ":", "wp", "=", "self", ".", "module", "(", "'wp'", ")", ".", "wploader", ".", "wp", "(", "wp_num", ")", "command", "=", "wp", ".", "command", "return", "self", ".", "_colour_for_wp_command", "."...
return a tuple describing the colour a waypoint should appear on the map
[ "return", "a", "tuple", "describing", "the", "colour", "a", "waypoint", "should", "appear", "on", "the", "map" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_map/__init__.py#L175-L179
train
ArduPilot/MAVProxy
MAVProxy/modules/mavproxy_map/__init__.py
MapModule.label_for_waypoint
def label_for_waypoint(self, wp_num): '''return the label the waypoint which should appear on the map''' wp = self.module('wp').wploader.wp(wp_num) command = wp.command if command not in self._label_suffix_for_wp_command: return str(wp_num) return str(wp_num) + "(" + ...
python
def label_for_waypoint(self, wp_num): '''return the label the waypoint which should appear on the map''' wp = self.module('wp').wploader.wp(wp_num) command = wp.command if command not in self._label_suffix_for_wp_command: return str(wp_num) return str(wp_num) + "(" + ...
[ "def", "label_for_waypoint", "(", "self", ",", "wp_num", ")", ":", "wp", "=", "self", ".", "module", "(", "'wp'", ")", ".", "wploader", ".", "wp", "(", "wp_num", ")", "command", "=", "wp", ".", "command", "if", "command", "not", "in", "self", ".", ...
return the label the waypoint which should appear on the map
[ "return", "the", "label", "the", "waypoint", "which", "should", "appear", "on", "the", "map" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_map/__init__.py#L181-L187
train
ArduPilot/MAVProxy
MAVProxy/modules/mavproxy_map/__init__.py
MapModule.remove_mission_nofly
def remove_mission_nofly(self, key, selection_index): '''remove a mission nofly polygon''' if not self.validate_nofly(): print("NoFly invalid") return print("NoFly valid") idx = self.selection_index_to_idx(key, selection_index) wploader = self.module('wp'...
python
def remove_mission_nofly(self, key, selection_index): '''remove a mission nofly polygon''' if not self.validate_nofly(): print("NoFly invalid") return print("NoFly valid") idx = self.selection_index_to_idx(key, selection_index) wploader = self.module('wp'...
[ "def", "remove_mission_nofly", "(", "self", ",", "key", ",", "selection_index", ")", ":", "if", "not", "self", ".", "validate_nofly", "(", ")", ":", "print", "(", "\"NoFly invalid\"", ")", "return", "print", "(", "\"NoFly valid\"", ")", "idx", "=", "self", ...
remove a mission nofly polygon
[ "remove", "a", "mission", "nofly", "polygon" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_map/__init__.py#L345-L378
train
ArduPilot/MAVProxy
MAVProxy/modules/mavproxy_map/__init__.py
MapModule.handle_menu_event
def handle_menu_event(self, obj): '''handle a popup menu event from the map''' menuitem = obj.menuitem if menuitem.returnkey.startswith('# '): cmd = menuitem.returnkey[2:] if menuitem.handler is not None: if menuitem.handler_result is None: ...
python
def handle_menu_event(self, obj): '''handle a popup menu event from the map''' menuitem = obj.menuitem if menuitem.returnkey.startswith('# '): cmd = menuitem.returnkey[2:] if menuitem.handler is not None: if menuitem.handler_result is None: ...
[ "def", "handle_menu_event", "(", "self", ",", "obj", ")", ":", "menuitem", "=", "obj", ".", "menuitem", "if", "menuitem", ".", "returnkey", ".", "startswith", "(", "'# '", ")", ":", "cmd", "=", "menuitem", ".", "returnkey", "[", "2", ":", "]", "if", ...
handle a popup menu event from the map
[ "handle", "a", "popup", "menu", "event", "from", "the", "map" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_map/__init__.py#L394-L421
train
ArduPilot/MAVProxy
MAVProxy/modules/mavproxy_map/__init__.py
MapModule.map_callback
def map_callback(self, obj): '''called when an event happens on the slipmap''' from MAVProxy.modules.mavproxy_map import mp_slipmap if isinstance(obj, mp_slipmap.SlipMenuEvent): self.handle_menu_event(obj) return if not isinstance(obj, mp_slipmap.SlipMouseEvent): ...
python
def map_callback(self, obj): '''called when an event happens on the slipmap''' from MAVProxy.modules.mavproxy_map import mp_slipmap if isinstance(obj, mp_slipmap.SlipMenuEvent): self.handle_menu_event(obj) return if not isinstance(obj, mp_slipmap.SlipMouseEvent): ...
[ "def", "map_callback", "(", "self", ",", "obj", ")", ":", "from", "MAVProxy", ".", "modules", ".", "mavproxy_map", "import", "mp_slipmap", "if", "isinstance", "(", "obj", ",", "mp_slipmap", ".", "SlipMenuEvent", ")", ":", "self", ".", "handle_menu_event", "(...
called when an event happens on the slipmap
[ "called", "when", "an", "event", "happens", "on", "the", "slipmap" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_map/__init__.py#L424-L477
train
ArduPilot/MAVProxy
MAVProxy/modules/mavproxy_map/__init__.py
MapModule.drawing_end
def drawing_end(self): '''end line drawing''' from MAVProxy.modules.mavproxy_map import mp_slipmap if self.draw_callback is None: return self.draw_callback(self.draw_line) self.draw_callback = None self.map.add_object(mp_slipmap.SlipDefaultPopup(self.default_p...
python
def drawing_end(self): '''end line drawing''' from MAVProxy.modules.mavproxy_map import mp_slipmap if self.draw_callback is None: return self.draw_callback(self.draw_line) self.draw_callback = None self.map.add_object(mp_slipmap.SlipDefaultPopup(self.default_p...
[ "def", "drawing_end", "(", "self", ")", ":", "from", "MAVProxy", ".", "modules", ".", "mavproxy_map", "import", "mp_slipmap", "if", "self", ".", "draw_callback", "is", "None", ":", "return", "self", ".", "draw_callback", "(", "self", ".", "draw_line", ")", ...
end line drawing
[ "end", "line", "drawing" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_map/__init__.py#L517-L525
train
ArduPilot/MAVProxy
MAVProxy/modules/mavproxy_map/__init__.py
MapModule.draw_lines
def draw_lines(self, callback): '''draw a series of connected lines on the map, calling callback when done''' from MAVProxy.modules.mavproxy_map import mp_slipmap self.draw_callback = callback self.draw_line = [] self.map.add_object(mp_slipmap.SlipDefaultPopup(None))
python
def draw_lines(self, callback): '''draw a series of connected lines on the map, calling callback when done''' from MAVProxy.modules.mavproxy_map import mp_slipmap self.draw_callback = callback self.draw_line = [] self.map.add_object(mp_slipmap.SlipDefaultPopup(None))
[ "def", "draw_lines", "(", "self", ",", "callback", ")", ":", "from", "MAVProxy", ".", "modules", ".", "mavproxy_map", "import", "mp_slipmap", "self", ".", "draw_callback", "=", "callback", "self", ".", "draw_line", "=", "[", "]", "self", ".", "map", ".", ...
draw a series of connected lines on the map, calling callback when done
[ "draw", "a", "series", "of", "connected", "lines", "on", "the", "map", "calling", "callback", "when", "done" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_map/__init__.py#L527-L532
train
ArduPilot/MAVProxy
MAVProxy/modules/mavproxy_map/__init__.py
MapModule.cmd_set_originpos
def cmd_set_originpos(self, args): '''called when user selects "Set Origin" on map''' (lat, lon) = (self.click_position[0], self.click_position[1]) print("Setting origin to: ", lat, lon) self.master.mav.set_gps_global_origin_send( self.settings.target_system, lat*...
python
def cmd_set_originpos(self, args): '''called when user selects "Set Origin" on map''' (lat, lon) = (self.click_position[0], self.click_position[1]) print("Setting origin to: ", lat, lon) self.master.mav.set_gps_global_origin_send( self.settings.target_system, lat*...
[ "def", "cmd_set_originpos", "(", "self", ",", "args", ")", ":", "(", "lat", ",", "lon", ")", "=", "(", "self", ".", "click_position", "[", "0", "]", ",", "self", ".", "click_position", "[", "1", "]", ")", "print", "(", "\"Setting origin to: \"", ",", ...
called when user selects "Set Origin" on map
[ "called", "when", "user", "selects", "Set", "Origin", "on", "map" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_map/__init__.py#L580-L588
train
ArduPilot/MAVProxy
MAVProxy/modules/mavproxy_map/__init__.py
MapModule.cmd_center
def cmd_center(self, args): '''control center of view''' if len(args) < 3: print("map center LAT LON") return lat = float(args[1]) lon = float(args[2]) self.map.set_center(lat, lon)
python
def cmd_center(self, args): '''control center of view''' if len(args) < 3: print("map center LAT LON") return lat = float(args[1]) lon = float(args[2]) self.map.set_center(lat, lon)
[ "def", "cmd_center", "(", "self", ",", "args", ")", ":", "if", "len", "(", "args", ")", "<", "3", ":", "print", "(", "\"map center LAT LON\"", ")", "return", "lat", "=", "float", "(", "args", "[", "1", "]", ")", "lon", "=", "float", "(", "args", ...
control center of view
[ "control", "center", "of", "view" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_map/__init__.py#L598-L605
train
ArduPilot/MAVProxy
MAVProxy/modules/mavproxy_map/__init__.py
MapModule.cmd_follow
def cmd_follow(self, args): '''control following of vehicle''' if len(args) < 2: print("map follow 0|1") return follow = int(args[1]) self.map.set_follow(follow)
python
def cmd_follow(self, args): '''control following of vehicle''' if len(args) < 2: print("map follow 0|1") return follow = int(args[1]) self.map.set_follow(follow)
[ "def", "cmd_follow", "(", "self", ",", "args", ")", ":", "if", "len", "(", "args", ")", "<", "2", ":", "print", "(", "\"map follow 0|1\"", ")", "return", "follow", "=", "int", "(", "args", "[", "1", "]", ")", "self", ".", "map", ".", "set_follow", ...
control following of vehicle
[ "control", "following", "of", "vehicle" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_map/__init__.py#L607-L613
train
ArduPilot/MAVProxy
MAVProxy/modules/mavproxy_map/__init__.py
MapModule.set_secondary_vehicle_position
def set_secondary_vehicle_position(self, m): '''show 2nd vehicle on map''' if m.get_type() != 'GLOBAL_POSITION_INT': return (lat, lon, heading) = (m.lat*1.0e-7, m.lon*1.0e-7, m.hdg*0.01) if abs(lat) < 1.0e-3 and abs(lon) > 1.0e-3: return # hack for OBC2016...
python
def set_secondary_vehicle_position(self, m): '''show 2nd vehicle on map''' if m.get_type() != 'GLOBAL_POSITION_INT': return (lat, lon, heading) = (m.lat*1.0e-7, m.lon*1.0e-7, m.hdg*0.01) if abs(lat) < 1.0e-3 and abs(lon) > 1.0e-3: return # hack for OBC2016...
[ "def", "set_secondary_vehicle_position", "(", "self", ",", "m", ")", ":", "if", "m", ".", "get_type", "(", ")", "!=", "'GLOBAL_POSITION_INT'", ":", "return", "(", "lat", ",", "lon", ",", "heading", ")", "=", "(", "m", ".", "lat", "*", "1.0e-7", ",", ...
show 2nd vehicle on map
[ "show", "2nd", "vehicle", "on", "map" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_map/__init__.py#L615-L627
train
ArduPilot/MAVProxy
MAVProxy/modules/mavproxy_kmlread.py
KmlReadModule.cmd_param
def cmd_param(self, args): '''control kml reading''' usage = "Usage: kml <clear | load (filename) | layers | toggle (layername) | fence (layername)>" if len(args) < 1: print(usage) return elif args[0] == "clear": self.clearkml() elif args[0] ==...
python
def cmd_param(self, args): '''control kml reading''' usage = "Usage: kml <clear | load (filename) | layers | toggle (layername) | fence (layername)>" if len(args) < 1: print(usage) return elif args[0] == "clear": self.clearkml() elif args[0] ==...
[ "def", "cmd_param", "(", "self", ",", "args", ")", ":", "usage", "=", "\"Usage: kml <clear | load (filename) | layers | toggle (layername) | fence (layername)>\"", "if", "len", "(", "args", ")", "<", "1", ":", "print", "(", "usage", ")", "return", "elif", "args", ...
control kml reading
[ "control", "kml", "reading" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_kmlread.py#L48-L74
train
ArduPilot/MAVProxy
MAVProxy/modules/mavproxy_kmlread.py
KmlReadModule.cmd_snap_wp
def cmd_snap_wp(self, args): '''snap waypoints to KML''' threshold = 10.0 if len(args) > 0: threshold = float(args[0]) wpmod = self.module('wp') wploader = wpmod.wploader changed = False for i in range(1,wploader.count()): w = wploader.wp(i...
python
def cmd_snap_wp(self, args): '''snap waypoints to KML''' threshold = 10.0 if len(args) > 0: threshold = float(args[0]) wpmod = self.module('wp') wploader = wpmod.wploader changed = False for i in range(1,wploader.count()): w = wploader.wp(i...
[ "def", "cmd_snap_wp", "(", "self", ",", "args", ")", ":", "threshold", "=", "10.0", "if", "len", "(", "args", ")", ">", "0", ":", "threshold", "=", "float", "(", "args", "[", "0", "]", ")", "wpmod", "=", "self", ".", "module", "(", "'wp'", ")", ...
snap waypoints to KML
[ "snap", "waypoints", "to", "KML" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_kmlread.py#L76-L108
train
ArduPilot/MAVProxy
MAVProxy/modules/mavproxy_kmlread.py
KmlReadModule.cmd_snap_fence
def cmd_snap_fence(self, args): '''snap fence to KML''' threshold = 10.0 if len(args) > 0: threshold = float(args[0]) fencemod = self.module('fence') loader = fencemod.fenceloader changed = False for i in range(0,loader.count()): fp = loade...
python
def cmd_snap_fence(self, args): '''snap fence to KML''' threshold = 10.0 if len(args) > 0: threshold = float(args[0]) fencemod = self.module('fence') loader = fencemod.fenceloader changed = False for i in range(0,loader.count()): fp = loade...
[ "def", "cmd_snap_fence", "(", "self", ",", "args", ")", ":", "threshold", "=", "10.0", "if", "len", "(", "args", ")", ">", "0", ":", "threshold", "=", "float", "(", "args", "[", "0", "]", ")", "fencemod", "=", "self", ".", "module", "(", "'fence'",...
snap fence to KML
[ "snap", "fence", "to", "KML" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_kmlread.py#L110-L139
train
ArduPilot/MAVProxy
MAVProxy/modules/mavproxy_kmlread.py
KmlReadModule.fencekml
def fencekml(self, layername): '''set a layer as the geofence''' #Strip quotation marks if neccessary if layername.startswith('"') and layername.endswith('"'): layername = layername[1:-1] #for each point in the layer, add it in for layer in self.allayers: ...
python
def fencekml(self, layername): '''set a layer as the geofence''' #Strip quotation marks if neccessary if layername.startswith('"') and layername.endswith('"'): layername = layername[1:-1] #for each point in the layer, add it in for layer in self.allayers: ...
[ "def", "fencekml", "(", "self", ",", "layername", ")", ":", "if", "layername", ".", "startswith", "(", "'\"'", ")", "and", "layername", ".", "endswith", "(", "'\"'", ")", ":", "layername", "=", "layername", "[", "1", ":", "-", "1", "]", "for", "layer...
set a layer as the geofence
[ "set", "a", "layer", "as", "the", "geofence" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_kmlread.py#L141-L165
train
ArduPilot/MAVProxy
MAVProxy/modules/mavproxy_kmlread.py
KmlReadModule.togglekml
def togglekml(self, layername): '''toggle the display of a kml''' #Strip quotation marks if neccessary if layername.startswith('"') and layername.endswith('"'): layername = layername[1:-1] #toggle layer off (plus associated text element) if layername in self.curlayers...
python
def togglekml(self, layername): '''toggle the display of a kml''' #Strip quotation marks if neccessary if layername.startswith('"') and layername.endswith('"'): layername = layername[1:-1] #toggle layer off (plus associated text element) if layername in self.curlayers...
[ "def", "togglekml", "(", "self", ",", "layername", ")", ":", "if", "layername", ".", "startswith", "(", "'\"'", ")", "and", "layername", ".", "endswith", "(", "'\"'", ")", ":", "layername", "=", "layername", "[", "1", ":", "-", "1", "]", "if", "layer...
toggle the display of a kml
[ "toggle", "the", "display", "of", "a", "kml" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_kmlread.py#L209-L235
train
ArduPilot/MAVProxy
MAVProxy/modules/mavproxy_kmlread.py
KmlReadModule.clearkml
def clearkml(self): '''Clear the kmls from the map''' #go through all the current layers and remove them for layer in self.curlayers: self.mpstate.map.remove_object(layer) for layer in self.curtextlayers: self.mpstate.map.remove_object(layer) self.allayers...
python
def clearkml(self): '''Clear the kmls from the map''' #go through all the current layers and remove them for layer in self.curlayers: self.mpstate.map.remove_object(layer) for layer in self.curtextlayers: self.mpstate.map.remove_object(layer) self.allayers...
[ "def", "clearkml", "(", "self", ")", ":", "for", "layer", "in", "self", ".", "curlayers", ":", "self", ".", "mpstate", ".", "map", ".", "remove_object", "(", "layer", ")", "for", "layer", "in", "self", ".", "curtextlayers", ":", "self", ".", "mpstate",...
Clear the kmls from the map
[ "Clear", "the", "kmls", "from", "the", "map" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_kmlread.py#L237-L248
train
ArduPilot/MAVProxy
MAVProxy/modules/mavproxy_kmlread.py
KmlReadModule.loadkml
def loadkml(self, filename): '''Load a kml from file and put it on the map''' #Open the zip file nodes = self.readkmz(filename) self.snap_points = [] #go through each object in the kml... for n in nodes: point = self.readObject(n) #and plac...
python
def loadkml(self, filename): '''Load a kml from file and put it on the map''' #Open the zip file nodes = self.readkmz(filename) self.snap_points = [] #go through each object in the kml... for n in nodes: point = self.readObject(n) #and plac...
[ "def", "loadkml", "(", "self", ",", "filename", ")", ":", "nodes", "=", "self", ".", "readkmz", "(", "filename", ")", "self", ".", "snap_points", "=", "[", "]", "for", "n", "in", "nodes", ":", "point", "=", "self", ".", "readObject", "(", "n", ")",...
Load a kml from file and put it on the map
[ "Load", "a", "kml", "from", "file", "and", "put", "it", "on", "the", "map" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_kmlread.py#L250-L286
train
ArduPilot/MAVProxy
MAVProxy/modules/mavproxy_kmlread.py
KmlReadModule.idle_task
def idle_task(self): '''handle GUI elements''' if not self.menu_needs_refreshing: return if self.module('map') is not None and not self.menu_added_map: self.menu_added_map = True self.module('map').add_menu(self.menu) #(re)create the menu if mp...
python
def idle_task(self): '''handle GUI elements''' if not self.menu_needs_refreshing: return if self.module('map') is not None and not self.menu_added_map: self.menu_added_map = True self.module('map').add_menu(self.menu) #(re)create the menu if mp...
[ "def", "idle_task", "(", "self", ")", ":", "if", "not", "self", ".", "menu_needs_refreshing", ":", "return", "if", "self", ".", "module", "(", "'map'", ")", "is", "not", "None", "and", "not", "self", ".", "menu_added_map", ":", "self", ".", "menu_added_m...
handle GUI elements
[ "handle", "GUI", "elements" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_kmlread.py#L289-L313
train
ArduPilot/MAVProxy
MAVProxy/modules/mavproxy_kmlread.py
KmlReadModule.readkmz
def readkmz(self, filename): '''reads in a kmz file and returns xml nodes''' #Strip quotation marks if neccessary filename.strip('"') #Open the zip file (as applicable) if filename[-4:] == '.kml': fo = open(filename, "r") fstring = fo.read() ...
python
def readkmz(self, filename): '''reads in a kmz file and returns xml nodes''' #Strip quotation marks if neccessary filename.strip('"') #Open the zip file (as applicable) if filename[-4:] == '.kml': fo = open(filename, "r") fstring = fo.read() ...
[ "def", "readkmz", "(", "self", ",", "filename", ")", ":", "filename", ".", "strip", "(", "'\"'", ")", "if", "filename", "[", "-", "4", ":", "]", "==", "'.kml'", ":", "fo", "=", "open", "(", "filename", ",", "\"r\"", ")", "fstring", "=", "fo", "."...
reads in a kmz file and returns xml nodes
[ "reads", "in", "a", "kmz", "file", "and", "returns", "xml", "nodes" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_kmlread.py#L318-L344
train
ArduPilot/MAVProxy
MAVProxy/modules/mavproxy_asterix.py
AsterixModule.cmd_asterix
def cmd_asterix(self, args): '''asterix command parser''' usage = "usage: asterix <set|start|stop|restart|status>" if len(args) == 0: print(usage) return if args[0] == "set": self.asterix_settings.command(args[1:]) elif args[0] == "start": ...
python
def cmd_asterix(self, args): '''asterix command parser''' usage = "usage: asterix <set|start|stop|restart|status>" if len(args) == 0: print(usage) return if args[0] == "set": self.asterix_settings.command(args[1:]) elif args[0] == "start": ...
[ "def", "cmd_asterix", "(", "self", ",", "args", ")", ":", "usage", "=", "\"usage: asterix <set|start|stop|restart|status>\"", "if", "len", "(", "args", ")", "==", "0", ":", "print", "(", "usage", ")", "return", "if", "args", "[", "0", "]", "==", "\"set\"",...
asterix command parser
[ "asterix", "command", "parser" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_asterix.py#L99-L117
train
ArduPilot/MAVProxy
MAVProxy/modules/mavproxy_asterix.py
AsterixModule.start_listener
def start_listener(self): '''start listening for packets''' if self.sock is not None: self.sock.close() self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP) self.sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) self.sock.bind(('',...
python
def start_listener(self): '''start listening for packets''' if self.sock is not None: self.sock.close() self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP) self.sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) self.sock.bind(('',...
[ "def", "start_listener", "(", "self", ")", ":", "if", "self", ".", "sock", "is", "not", "None", ":", "self", ".", "sock", ".", "close", "(", ")", "self", ".", "sock", "=", "socket", ".", "socket", "(", "socket", ".", "AF_INET", ",", "socket", ".", ...
start listening for packets
[ "start", "listening", "for", "packets" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_asterix.py#L119-L127
train
ArduPilot/MAVProxy
MAVProxy/modules/mavproxy_asterix.py
AsterixModule.stop_listener
def stop_listener(self): '''stop listening for packets''' if self.sock is not None: self.sock.close() self.sock = None self.tracks = {}
python
def stop_listener(self): '''stop listening for packets''' if self.sock is not None: self.sock.close() self.sock = None self.tracks = {}
[ "def", "stop_listener", "(", "self", ")", ":", "if", "self", ".", "sock", "is", "not", "None", ":", "self", ".", "sock", ".", "close", "(", ")", "self", ".", "sock", "=", "None", "self", ".", "tracks", "=", "{", "}" ]
stop listening for packets
[ "stop", "listening", "for", "packets" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_asterix.py#L129-L134
train
ArduPilot/MAVProxy
MAVProxy/modules/mavproxy_asterix.py
AsterixModule.set_secondary_vehicle_position
def set_secondary_vehicle_position(self, m): '''store second vehicle position for filtering purposes''' if m.get_type() != 'GLOBAL_POSITION_INT': return (lat, lon, heading) = (m.lat*1.0e-7, m.lon*1.0e-7, m.hdg*0.01) if abs(lat) < 1.0e-3 and abs(lon) < 1.0e-3: retu...
python
def set_secondary_vehicle_position(self, m): '''store second vehicle position for filtering purposes''' if m.get_type() != 'GLOBAL_POSITION_INT': return (lat, lon, heading) = (m.lat*1.0e-7, m.lon*1.0e-7, m.hdg*0.01) if abs(lat) < 1.0e-3 and abs(lon) < 1.0e-3: retu...
[ "def", "set_secondary_vehicle_position", "(", "self", ",", "m", ")", ":", "if", "m", ".", "get_type", "(", ")", "!=", "'GLOBAL_POSITION_INT'", ":", "return", "(", "lat", ",", "lon", ",", "heading", ")", "=", "(", "m", ".", "lat", "*", "1.0e-7", ",", ...
store second vehicle position for filtering purposes
[ "store", "second", "vehicle", "position", "for", "filtering", "purposes" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_asterix.py#L136-L143
train
ArduPilot/MAVProxy
MAVProxy/modules/mavproxy_asterix.py
AsterixModule.could_collide_hor
def could_collide_hor(self, vpos, adsb_pkt): '''return true if vehicle could come within filter_dist_xy meters of adsb vehicle in timeout seconds''' margin = self.asterix_settings.filter_dist_xy timeout = self.asterix_settings.filter_time alat = adsb_pkt.lat * 1.0e-7 alon = adsb_...
python
def could_collide_hor(self, vpos, adsb_pkt): '''return true if vehicle could come within filter_dist_xy meters of adsb vehicle in timeout seconds''' margin = self.asterix_settings.filter_dist_xy timeout = self.asterix_settings.filter_time alat = adsb_pkt.lat * 1.0e-7 alon = adsb_...
[ "def", "could_collide_hor", "(", "self", ",", "vpos", ",", "adsb_pkt", ")", ":", "margin", "=", "self", ".", "asterix_settings", ".", "filter_dist_xy", "timeout", "=", "self", ".", "asterix_settings", ".", "filter_time", "alat", "=", "adsb_pkt", ".", "lat", ...
return true if vehicle could come within filter_dist_xy meters of adsb vehicle in timeout seconds
[ "return", "true", "if", "vehicle", "could", "come", "within", "filter_dist_xy", "meters", "of", "adsb", "vehicle", "in", "timeout", "seconds" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_asterix.py#L145-L158
train
ArduPilot/MAVProxy
MAVProxy/modules/mavproxy_asterix.py
AsterixModule.could_collide_ver
def could_collide_ver(self, vpos, adsb_pkt): '''return true if vehicle could come within filter_dist_z meters of adsb vehicle in timeout seconds''' if adsb_pkt.emitter_type < 100 or adsb_pkt.emitter_type > 104: return True margin = self.asterix_settings.filter_dist_z vtype = ...
python
def could_collide_ver(self, vpos, adsb_pkt): '''return true if vehicle could come within filter_dist_z meters of adsb vehicle in timeout seconds''' if adsb_pkt.emitter_type < 100 or adsb_pkt.emitter_type > 104: return True margin = self.asterix_settings.filter_dist_z vtype = ...
[ "def", "could_collide_ver", "(", "self", ",", "vpos", ",", "adsb_pkt", ")", ":", "if", "adsb_pkt", ".", "emitter_type", "<", "100", "or", "adsb_pkt", ".", "emitter_type", ">", "104", ":", "return", "True", "margin", "=", "self", ".", "asterix_settings", "....
return true if vehicle could come within filter_dist_z meters of adsb vehicle in timeout seconds
[ "return", "true", "if", "vehicle", "could", "come", "within", "filter_dist_z", "meters", "of", "adsb", "vehicle", "in", "timeout", "seconds" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_asterix.py#L160-L180
train
ArduPilot/MAVProxy
MAVProxy/modules/mavproxy_asterix.py
AsterixModule.mavlink_packet
def mavlink_packet(self, m): '''get time from mavlink ATTITUDE''' if m.get_type() == 'GLOBAL_POSITION_INT': if abs(m.lat) < 1000 and abs(m.lon) < 1000: return self.vehicle_pos = VehiclePos(m)
python
def mavlink_packet(self, m): '''get time from mavlink ATTITUDE''' if m.get_type() == 'GLOBAL_POSITION_INT': if abs(m.lat) < 1000 and abs(m.lon) < 1000: return self.vehicle_pos = VehiclePos(m)
[ "def", "mavlink_packet", "(", "self", ",", "m", ")", ":", "if", "m", ".", "get_type", "(", ")", "==", "'GLOBAL_POSITION_INT'", ":", "if", "abs", "(", "m", ".", "lat", ")", "<", "1000", "and", "abs", "(", "m", ".", "lon", ")", "<", "1000", ":", ...
get time from mavlink ATTITUDE
[ "get", "time", "from", "mavlink", "ATTITUDE" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_asterix.py#L300-L305
train
ArduPilot/MAVProxy
MAVProxy/modules/mavproxy_link.py
LinkModule.complete_serial_ports
def complete_serial_ports(self, text): '''return list of serial ports''' ports = mavutil.auto_detect_serial(preferred_list=preferred_ports) return [ p.device for p in ports ]
python
def complete_serial_ports(self, text): '''return list of serial ports''' ports = mavutil.auto_detect_serial(preferred_list=preferred_ports) return [ p.device for p in ports ]
[ "def", "complete_serial_ports", "(", "self", ",", "text", ")", ":", "ports", "=", "mavutil", ".", "auto_detect_serial", "(", "preferred_list", "=", "preferred_ports", ")", "return", "[", "p", ".", "device", "for", "p", "in", "ports", "]" ]
return list of serial ports
[ "return", "list", "of", "serial", "ports" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_link.py#L77-L80
train
ArduPilot/MAVProxy
MAVProxy/modules/mavproxy_link.py
LinkModule.complete_links
def complete_links(self, text): '''return list of links''' try: ret = [ m.address for m in self.mpstate.mav_master ] for m in self.mpstate.mav_master: ret.append(m.address) if hasattr(m, 'label'): ret.append(m.label) ...
python
def complete_links(self, text): '''return list of links''' try: ret = [ m.address for m in self.mpstate.mav_master ] for m in self.mpstate.mav_master: ret.append(m.address) if hasattr(m, 'label'): ret.append(m.label) ...
[ "def", "complete_links", "(", "self", ",", "text", ")", ":", "try", ":", "ret", "=", "[", "m", ".", "address", "for", "m", "in", "self", ".", "mpstate", ".", "mav_master", "]", "for", "m", "in", "self", ".", "mpstate", ".", "mav_master", ":", "ret"...
return list of links
[ "return", "list", "of", "links" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_link.py#L82-L92
train
ArduPilot/MAVProxy
MAVProxy/modules/mavproxy_link.py
LinkModule.cmd_link_attributes
def cmd_link_attributes(self, args): '''change optional link attributes''' link = args[0] attributes = args[1] print("Setting link %s attributes (%s)" % (link, attributes)) self.link_attributes(link, attributes)
python
def cmd_link_attributes(self, args): '''change optional link attributes''' link = args[0] attributes = args[1] print("Setting link %s attributes (%s)" % (link, attributes)) self.link_attributes(link, attributes)
[ "def", "cmd_link_attributes", "(", "self", ",", "args", ")", ":", "link", "=", "args", "[", "0", "]", "attributes", "=", "args", "[", "1", "]", "print", "(", "\"Setting link %s attributes (%s)\"", "%", "(", "link", ",", "attributes", ")", ")", "self", "....
change optional link attributes
[ "change", "optional", "link", "attributes" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_link.py#L242-L247
train
ArduPilot/MAVProxy
MAVProxy/modules/mavproxy_link.py
LinkModule.find_link
def find_link(self, device): '''find a device based on number, name or label''' for i in range(len(self.mpstate.mav_master)): conn = self.mpstate.mav_master[i] if (str(i) == device or conn.address == device or getattr(conn, 'label', None) == device...
python
def find_link(self, device): '''find a device based on number, name or label''' for i in range(len(self.mpstate.mav_master)): conn = self.mpstate.mav_master[i] if (str(i) == device or conn.address == device or getattr(conn, 'label', None) == device...
[ "def", "find_link", "(", "self", ",", "device", ")", ":", "for", "i", "in", "range", "(", "len", "(", "self", ".", "mpstate", ".", "mav_master", ")", ")", ":", "conn", "=", "self", ".", "mpstate", ".", "mav_master", "[", "i", "]", "if", "(", "str...
find a device based on number, name or label
[ "find", "a", "device", "based", "on", "number", "name", "or", "label" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_link.py#L255-L263
train
ArduPilot/MAVProxy
MAVProxy/modules/mavproxy_link.py
LinkModule.cmd_link_remove
def cmd_link_remove(self, args): '''remove an link''' device = args[0] if len(self.mpstate.mav_master) <= 1: print("Not removing last link") return i = self.find_link(device) if i is None: return conn = self.mpstate.mav_master[i] ...
python
def cmd_link_remove(self, args): '''remove an link''' device = args[0] if len(self.mpstate.mav_master) <= 1: print("Not removing last link") return i = self.find_link(device) if i is None: return conn = self.mpstate.mav_master[i] ...
[ "def", "cmd_link_remove", "(", "self", ",", "args", ")", ":", "device", "=", "args", "[", "0", "]", "if", "len", "(", "self", ".", "mpstate", ".", "mav_master", ")", "<=", "1", ":", "print", "(", "\"Not removing last link\"", ")", "return", "i", "=", ...
remove an link
[ "remove", "an", "link" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_link.py#L265-L290
train
ArduPilot/MAVProxy
MAVProxy/modules/mavproxy_link.py
LinkModule.master_send_callback
def master_send_callback(self, m, master): '''called on sending a message''' if self.status.watch is not None: for msg_type in self.status.watch: if fnmatch.fnmatch(m.get_type().upper(), msg_type.upper()): self.mpstate.console.writeln('> '+ str(m)) ...
python
def master_send_callback(self, m, master): '''called on sending a message''' if self.status.watch is not None: for msg_type in self.status.watch: if fnmatch.fnmatch(m.get_type().upper(), msg_type.upper()): self.mpstate.console.writeln('> '+ str(m)) ...
[ "def", "master_send_callback", "(", "self", ",", "m", ",", "master", ")", ":", "if", "self", ".", "status", ".", "watch", "is", "not", "None", ":", "for", "msg_type", "in", "self", ".", "status", ".", "watch", ":", "if", "fnmatch", ".", "fnmatch", "(...
called on sending a message
[ "called", "on", "sending", "a", "message" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_link.py#L296-L308
train
ArduPilot/MAVProxy
MAVProxy/modules/mavproxy_link.py
LinkModule.handle_msec_timestamp
def handle_msec_timestamp(self, m, master): '''special handling for MAVLink packets with a time_boot_ms field''' if m.get_type() == 'GLOBAL_POSITION_INT': # this is fix time, not boot time return msec = m.time_boot_ms if msec + 30000 < master.highest_msec: ...
python
def handle_msec_timestamp(self, m, master): '''special handling for MAVLink packets with a time_boot_ms field''' if m.get_type() == 'GLOBAL_POSITION_INT': # this is fix time, not boot time return msec = m.time_boot_ms if msec + 30000 < master.highest_msec: ...
[ "def", "handle_msec_timestamp", "(", "self", ",", "m", ",", "master", ")", ":", "if", "m", ".", "get_type", "(", ")", "==", "'GLOBAL_POSITION_INT'", ":", "return", "msec", "=", "m", ".", "time_boot_ms", "if", "msec", "+", "30000", "<", "master", ".", "...
special handling for MAVLink packets with a time_boot_ms field
[ "special", "handling", "for", "MAVLink", "packets", "with", "a", "time_boot_ms", "field" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_link.py#L310-L334
train
ArduPilot/MAVProxy
MAVProxy/modules/mavproxy_link.py
LinkModule.report_altitude
def report_altitude(self, altitude): '''possibly report a new altitude''' master = self.master if getattr(self.console, 'ElevationMap', None) is not None and self.mpstate.settings.basealt != 0: lat = master.field('GLOBAL_POSITION_INT', 'lat', 0)*1.0e-7 lon = master.field(...
python
def report_altitude(self, altitude): '''possibly report a new altitude''' master = self.master if getattr(self.console, 'ElevationMap', None) is not None and self.mpstate.settings.basealt != 0: lat = master.field('GLOBAL_POSITION_INT', 'lat', 0)*1.0e-7 lon = master.field(...
[ "def", "report_altitude", "(", "self", ",", "altitude", ")", ":", "master", "=", "self", ".", "master", "if", "getattr", "(", "self", ".", "console", ",", "'ElevationMap'", ",", "None", ")", "is", "not", "None", "and", "self", ".", "mpstate", ".", "set...
possibly report a new altitude
[ "possibly", "report", "a", "new", "altitude" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_link.py#L354-L371
train
ArduPilot/MAVProxy
MAVProxy/modules/mavproxy_link.py
LinkModule.cmd_vehicle
def cmd_vehicle(self, args): '''handle vehicle commands''' if len(args) < 1: print("Usage: vehicle SYSID[:COMPID]") return a = args[0].split(':') self.mpstate.settings.target_system = int(a[0]) if len(a) > 1: self.mpstate.settings.target_compon...
python
def cmd_vehicle(self, args): '''handle vehicle commands''' if len(args) < 1: print("Usage: vehicle SYSID[:COMPID]") return a = args[0].split(':') self.mpstate.settings.target_system = int(a[0]) if len(a) > 1: self.mpstate.settings.target_compon...
[ "def", "cmd_vehicle", "(", "self", ",", "args", ")", ":", "if", "len", "(", "args", ")", "<", "1", ":", "print", "(", "\"Usage: vehicle SYSID[:COMPID]\"", ")", "return", "a", "=", "args", "[", "0", "]", ".", "split", "(", "':'", ")", "self", ".", "...
handle vehicle commands
[ "handle", "vehicle", "commands" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_link.py#L635-L659
train
ArduPilot/MAVProxy
MAVProxy/modules/mavproxy_devop.py
DeviceOpModule.devop_read
def devop_read(self, args, bustype): '''read from device''' if len(args) < 5: print("Usage: devop read <spi|i2c> name bus address regstart count") return name = args[0] bus = int(args[1],base=0) address = int(args[2],base=0) reg = int(args[3],base=...
python
def devop_read(self, args, bustype): '''read from device''' if len(args) < 5: print("Usage: devop read <spi|i2c> name bus address regstart count") return name = args[0] bus = int(args[1],base=0) address = int(args[2],base=0) reg = int(args[3],base=...
[ "def", "devop_read", "(", "self", ",", "args", ",", "bustype", ")", ":", "if", "len", "(", "args", ")", "<", "5", ":", "print", "(", "\"Usage: devop read <spi|i2c> name bus address regstart count\"", ")", "return", "name", "=", "args", "[", "0", "]", "bus", ...
read from device
[ "read", "from", "device" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_devop.py#L37-L56
train
ArduPilot/MAVProxy
MAVProxy/modules/mavproxy_devop.py
DeviceOpModule.devop_write
def devop_write(self, args, bustype): '''write to a device''' usage = "Usage: devop write <spi|i2c> name bus address regstart count <bytes>" if len(args) < 5: print(usage) return name = args[0] bus = int(args[1],base=0) address = int(args[2],base=0...
python
def devop_write(self, args, bustype): '''write to a device''' usage = "Usage: devop write <spi|i2c> name bus address regstart count <bytes>" if len(args) < 5: print(usage) return name = args[0] bus = int(args[1],base=0) address = int(args[2],base=0...
[ "def", "devop_write", "(", "self", ",", "args", ",", "bustype", ")", ":", "usage", "=", "\"Usage: devop write <spi|i2c> name bus address regstart count <bytes>\"", "if", "len", "(", "args", ")", "<", "5", ":", "print", "(", "usage", ")", "return", "name", "=", ...
write to a device
[ "write", "to", "a", "device" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_devop.py#L58-L86
train
ArduPilot/MAVProxy
MAVProxy/modules/lib/ANUGA/geo_reference.py
Geo_reference.get_absolute
def get_absolute(self, points): """Given a set of points geo referenced to this instance, return the points as absolute values. """ # remember if we got a list is_list = isinstance(points, list) points = ensure_numeric(points, num.float) if len(points.shape) == ...
python
def get_absolute(self, points): """Given a set of points geo referenced to this instance, return the points as absolute values. """ # remember if we got a list is_list = isinstance(points, list) points = ensure_numeric(points, num.float) if len(points.shape) == ...
[ "def", "get_absolute", "(", "self", ",", "points", ")", ":", "is_list", "=", "isinstance", "(", "points", ",", "list", ")", "points", "=", "ensure_numeric", "(", "points", ",", "num", ".", "float", ")", "if", "len", "(", "points", ".", "shape", ")", ...
Given a set of points geo referenced to this instance, return the points as absolute values.
[ "Given", "a", "set", "of", "points", "geo", "referenced", "to", "this", "instance", "return", "the", "points", "as", "absolute", "values", "." ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/ANUGA/geo_reference.py#L295-L327
train
ArduPilot/MAVProxy
MAVProxy/modules/mavproxy_cameraview.py
CameraViewModule.cmd_cameraview
def cmd_cameraview(self, args): '''camera view commands''' state = self if args and args[0] == 'set': if len(args) < 3: state.view_settings.show_all() else: state.view_settings.set(args[1], args[2]) state.update_col() ...
python
def cmd_cameraview(self, args): '''camera view commands''' state = self if args and args[0] == 'set': if len(args) < 3: state.view_settings.show_all() else: state.view_settings.set(args[1], args[2]) state.update_col() ...
[ "def", "cmd_cameraview", "(", "self", ",", "args", ")", ":", "state", "=", "self", "if", "args", "and", "args", "[", "0", "]", "==", "'set'", ":", "if", "len", "(", "args", ")", "<", "3", ":", "state", ".", "view_settings", ".", "show_all", "(", ...
camera view commands
[ "camera", "view", "commands" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_cameraview.py#L50-L60
train
ArduPilot/MAVProxy
MAVProxy/modules/mavproxy_cameraview.py
CameraViewModule.scale_rc
def scale_rc(self, servo, min, max, param): '''scale a PWM value''' # default to servo range of 1000 to 2000 min_pwm = self.get_mav_param('%s_MIN' % param, 0) max_pwm = self.get_mav_param('%s_MAX' % param, 0) if min_pwm == 0 or max_pwm == 0: return 0 if ma...
python
def scale_rc(self, servo, min, max, param): '''scale a PWM value''' # default to servo range of 1000 to 2000 min_pwm = self.get_mav_param('%s_MIN' % param, 0) max_pwm = self.get_mav_param('%s_MAX' % param, 0) if min_pwm == 0 or max_pwm == 0: return 0 if ma...
[ "def", "scale_rc", "(", "self", ",", "servo", ",", "min", ",", "max", ",", "param", ")", ":", "min_pwm", "=", "self", ".", "get_mav_param", "(", "'%s_MIN'", "%", "param", ",", "0", ")", "max_pwm", "=", "self", ".", "get_mav_param", "(", "'%s_MAX'", "...
scale a PWM value
[ "scale", "a", "PWM", "value" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_cameraview.py#L66-L82
train
ArduPilot/MAVProxy
MAVProxy/modules/lib/MacOS/backend_wx.py
raise_msg_to_str
def raise_msg_to_str(msg): """msg is a return arg from a raise. Join with new lines""" if not is_string_like(msg): msg = '\n'.join(map(str, msg)) return msg
python
def raise_msg_to_str(msg): """msg is a return arg from a raise. Join with new lines""" if not is_string_like(msg): msg = '\n'.join(map(str, msg)) return msg
[ "def", "raise_msg_to_str", "(", "msg", ")", ":", "if", "not", "is_string_like", "(", "msg", ")", ":", "msg", "=", "'\\n'", ".", "join", "(", "map", "(", "str", ",", "msg", ")", ")", "return", "msg" ]
msg is a return arg from a raise. Join with new lines
[ "msg", "is", "a", "return", "arg", "from", "a", "raise", ".", "Join", "with", "new", "lines" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/MacOS/backend_wx.py#L162-L166
train
ArduPilot/MAVProxy
MAVProxy/modules/lib/MacOS/backend_wx.py
_create_wx_app
def _create_wx_app(): """ Creates a wx.App instance if it has not been created sofar. """ wxapp = wx.GetApp() if wxapp is None: wxapp = wx.App(False) wxapp.SetExitOnFrameDelete(True) # retain a reference to the app object so it does not get garbage # collected and cau...
python
def _create_wx_app(): """ Creates a wx.App instance if it has not been created sofar. """ wxapp = wx.GetApp() if wxapp is None: wxapp = wx.App(False) wxapp.SetExitOnFrameDelete(True) # retain a reference to the app object so it does not get garbage # collected and cau...
[ "def", "_create_wx_app", "(", ")", ":", "wxapp", "=", "wx", ".", "GetApp", "(", ")", "if", "wxapp", "is", "None", ":", "wxapp", "=", "wx", ".", "App", "(", "False", ")", "wxapp", ".", "SetExitOnFrameDelete", "(", "True", ")", "_create_wx_app", ".", "...
Creates a wx.App instance if it has not been created sofar.
[ "Creates", "a", "wx", ".", "App", "instance", "if", "it", "has", "not", "been", "created", "sofar", "." ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/MacOS/backend_wx.py#L1241-L1251
train
ArduPilot/MAVProxy
MAVProxy/modules/lib/MacOS/backend_wx.py
draw_if_interactive
def draw_if_interactive(): """ This should be overriden in a windowing environment if drawing should be done in interactive python mode """ DEBUG_MSG("draw_if_interactive()", 1, None) if matplotlib.is_interactive(): figManager = Gcf.get_active() if figManager is not None: ...
python
def draw_if_interactive(): """ This should be overriden in a windowing environment if drawing should be done in interactive python mode """ DEBUG_MSG("draw_if_interactive()", 1, None) if matplotlib.is_interactive(): figManager = Gcf.get_active() if figManager is not None: ...
[ "def", "draw_if_interactive", "(", ")", ":", "DEBUG_MSG", "(", "\"draw_if_interactive()\"", ",", "1", ",", "None", ")", "if", "matplotlib", ".", "is_interactive", "(", ")", ":", "figManager", "=", "Gcf", ".", "get_active", "(", ")", "if", "figManager", "is",...
This should be overriden in a windowing environment if drawing should be done in interactive python mode
[ "This", "should", "be", "overriden", "in", "a", "windowing", "environment", "if", "drawing", "should", "be", "done", "in", "interactive", "python", "mode" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/MacOS/backend_wx.py#L1254-L1265
train
ArduPilot/MAVProxy
MAVProxy/modules/lib/MacOS/backend_wx.py
RendererWx.new_gc
def new_gc(self): """ Return an instance of a GraphicsContextWx, and sets the current gc copy """ DEBUG_MSG('new_gc()', 2, self) self.gc = GraphicsContextWx(self.bitmap, self) self.gc.select() self.gc.unselect() return self.gc
python
def new_gc(self): """ Return an instance of a GraphicsContextWx, and sets the current gc copy """ DEBUG_MSG('new_gc()', 2, self) self.gc = GraphicsContextWx(self.bitmap, self) self.gc.select() self.gc.unselect() return self.gc
[ "def", "new_gc", "(", "self", ")", ":", "DEBUG_MSG", "(", "'new_gc()'", ",", "2", ",", "self", ")", "self", ".", "gc", "=", "GraphicsContextWx", "(", "self", ".", "bitmap", ",", "self", ")", "self", ".", "gc", ".", "select", "(", ")", "self", ".", ...
Return an instance of a GraphicsContextWx, and sets the current gc copy
[ "Return", "an", "instance", "of", "a", "GraphicsContextWx", "and", "sets", "the", "current", "gc", "copy" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/MacOS/backend_wx.py#L392-L400
train
ArduPilot/MAVProxy
MAVProxy/modules/lib/MacOS/backend_wx.py
RendererWx.get_wx_font
def get_wx_font(self, s, prop): """ Return a wx font. Cache instances in a font dictionary for efficiency """ DEBUG_MSG("get_wx_font()", 1, self) key = hash(prop) fontprop = prop fontname = fontprop.get_name() font = self.fontd.get(key) ...
python
def get_wx_font(self, s, prop): """ Return a wx font. Cache instances in a font dictionary for efficiency """ DEBUG_MSG("get_wx_font()", 1, self) key = hash(prop) fontprop = prop fontname = fontprop.get_name() font = self.fontd.get(key) ...
[ "def", "get_wx_font", "(", "self", ",", "s", ",", "prop", ")", ":", "DEBUG_MSG", "(", "\"get_wx_font()\"", ",", "1", ",", "self", ")", "key", "=", "hash", "(", "prop", ")", "fontprop", "=", "prop", "fontname", "=", "fontprop", ".", "get_name", "(", "...
Return a wx font. Cache instances in a font dictionary for efficiency
[ "Return", "a", "wx", "font", ".", "Cache", "instances", "in", "a", "font", "dictionary", "for", "efficiency" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/MacOS/backend_wx.py#L411-L446
train
ArduPilot/MAVProxy
MAVProxy/modules/lib/MacOS/backend_wx.py
GraphicsContextWx.select
def select(self): """ Select the current bitmap into this wxDC instance """ if sys.platform=='win32': self.dc.SelectObject(self.bitmap) self.IsSelected = True
python
def select(self): """ Select the current bitmap into this wxDC instance """ if sys.platform=='win32': self.dc.SelectObject(self.bitmap) self.IsSelected = True
[ "def", "select", "(", "self", ")", ":", "if", "sys", ".", "platform", "==", "'win32'", ":", "self", ".", "dc", ".", "SelectObject", "(", "self", ".", "bitmap", ")", "self", ".", "IsSelected", "=", "True" ]
Select the current bitmap into this wxDC instance
[ "Select", "the", "current", "bitmap", "into", "this", "wxDC", "instance" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/MacOS/backend_wx.py#L505-L512
train
ArduPilot/MAVProxy
MAVProxy/modules/lib/MacOS/backend_wx.py
GraphicsContextWx.unselect
def unselect(self): """ Select a Null bitmasp into this wxDC instance """ if sys.platform=='win32': self.dc.SelectObject(wx.NullBitmap) self.IsSelected = False
python
def unselect(self): """ Select a Null bitmasp into this wxDC instance """ if sys.platform=='win32': self.dc.SelectObject(wx.NullBitmap) self.IsSelected = False
[ "def", "unselect", "(", "self", ")", ":", "if", "sys", ".", "platform", "==", "'win32'", ":", "self", ".", "dc", ".", "SelectObject", "(", "wx", ".", "NullBitmap", ")", "self", ".", "IsSelected", "=", "False" ]
Select a Null bitmasp into this wxDC instance
[ "Select", "a", "Null", "bitmasp", "into", "this", "wxDC", "instance" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/MacOS/backend_wx.py#L514-L520
train
ArduPilot/MAVProxy
MAVProxy/modules/lib/MacOS/backend_wx.py
GraphicsContextWx.set_linewidth
def set_linewidth(self, w): """ Set the line width. """ DEBUG_MSG("set_linewidth()", 1, self) self.select() if w>0 and w<1: w = 1 GraphicsContextBase.set_linewidth(self, w) lw = int(self.renderer.points_to_pixels(self._linewidth)) if lw==0: lw = 1 ...
python
def set_linewidth(self, w): """ Set the line width. """ DEBUG_MSG("set_linewidth()", 1, self) self.select() if w>0 and w<1: w = 1 GraphicsContextBase.set_linewidth(self, w) lw = int(self.renderer.points_to_pixels(self._linewidth)) if lw==0: lw = 1 ...
[ "def", "set_linewidth", "(", "self", ",", "w", ")", ":", "DEBUG_MSG", "(", "\"set_linewidth()\"", ",", "1", ",", "self", ")", "self", ".", "select", "(", ")", "if", "w", ">", "0", "and", "w", "<", "1", ":", "w", "=", "1", "GraphicsContextBase", "."...
Set the line width.
[ "Set", "the", "line", "width", "." ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/MacOS/backend_wx.py#L554-L566
train
ArduPilot/MAVProxy
MAVProxy/modules/lib/MacOS/backend_wx.py
GraphicsContextWx.set_linestyle
def set_linestyle(self, ls): """ Set the line style to be one of """ DEBUG_MSG("set_linestyle()", 1, self) self.select() GraphicsContextBase.set_linestyle(self, ls) try: self._style = GraphicsContextWx._dashd_wx[ls] except KeyError: ...
python
def set_linestyle(self, ls): """ Set the line style to be one of """ DEBUG_MSG("set_linestyle()", 1, self) self.select() GraphicsContextBase.set_linestyle(self, ls) try: self._style = GraphicsContextWx._dashd_wx[ls] except KeyError: ...
[ "def", "set_linestyle", "(", "self", ",", "ls", ")", ":", "DEBUG_MSG", "(", "\"set_linestyle()\"", ",", "1", ",", "self", ")", "self", ".", "select", "(", ")", "GraphicsContextBase", ".", "set_linestyle", "(", "self", ",", "ls", ")", "try", ":", "self", ...
Set the line style to be one of
[ "Set", "the", "line", "style", "to", "be", "one", "of" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/MacOS/backend_wx.py#L590-L608
train
ArduPilot/MAVProxy
MAVProxy/modules/lib/MacOS/backend_wx.py
GraphicsContextWx.get_wxcolour
def get_wxcolour(self, color): """return a wx.Colour from RGB format""" DEBUG_MSG("get_wx_color()", 1, self) if len(color) == 3: r, g, b = color r *= 255 g *= 255 b *= 255 return wx.Colour(red=int(r), green=int(g), blue=int(b)) ...
python
def get_wxcolour(self, color): """return a wx.Colour from RGB format""" DEBUG_MSG("get_wx_color()", 1, self) if len(color) == 3: r, g, b = color r *= 255 g *= 255 b *= 255 return wx.Colour(red=int(r), green=int(g), blue=int(b)) ...
[ "def", "get_wxcolour", "(", "self", ",", "color", ")", ":", "DEBUG_MSG", "(", "\"get_wx_color()\"", ",", "1", ",", "self", ")", "if", "len", "(", "color", ")", "==", "3", ":", "r", ",", "g", ",", "b", "=", "color", "r", "*=", "255", "g", "*=", ...
return a wx.Colour from RGB format
[ "return", "a", "wx", ".", "Colour", "from", "RGB", "format" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/MacOS/backend_wx.py#L610-L625
train
ArduPilot/MAVProxy
MAVProxy/modules/lib/MacOS/backend_wx.py
FigureCanvasWx.Copy_to_Clipboard
def Copy_to_Clipboard(self, event=None): "copy bitmap of canvas to system clipboard" bmp_obj = wx.BitmapDataObject() bmp_obj.SetBitmap(self.bitmap) if not wx.TheClipboard.IsOpened(): open_success = wx.TheClipboard.Open() if open_success: wx.TheClipboa...
python
def Copy_to_Clipboard(self, event=None): "copy bitmap of canvas to system clipboard" bmp_obj = wx.BitmapDataObject() bmp_obj.SetBitmap(self.bitmap) if not wx.TheClipboard.IsOpened(): open_success = wx.TheClipboard.Open() if open_success: wx.TheClipboa...
[ "def", "Copy_to_Clipboard", "(", "self", ",", "event", "=", "None", ")", ":", "\"copy bitmap of canvas to system clipboard\"", "bmp_obj", "=", "wx", ".", "BitmapDataObject", "(", ")", "bmp_obj", ".", "SetBitmap", "(", "self", ".", "bitmap", ")", "if", "not", "...
copy bitmap of canvas to system clipboard
[ "copy", "bitmap", "of", "canvas", "to", "system", "clipboard" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/MacOS/backend_wx.py#L776-L786
train
ArduPilot/MAVProxy
MAVProxy/modules/lib/MacOS/backend_wx.py
FigureCanvasWx.draw_idle
def draw_idle(self): """ Delay rendering until the GUI is idle. """ DEBUG_MSG("draw_idle()", 1, self) self._isDrawn = False # Force redraw # Create a timer for handling draw_idle requests # If there are events pending when the timer is # complete, reset t...
python
def draw_idle(self): """ Delay rendering until the GUI is idle. """ DEBUG_MSG("draw_idle()", 1, self) self._isDrawn = False # Force redraw # Create a timer for handling draw_idle requests # If there are events pending when the timer is # complete, reset t...
[ "def", "draw_idle", "(", "self", ")", ":", "DEBUG_MSG", "(", "\"draw_idle()\"", ",", "1", ",", "self", ")", "self", ".", "_isDrawn", "=", "False", "if", "hasattr", "(", "self", ",", "'_idletimer'", ")", ":", "self", ".", "_idletimer", ".", "Restart", "...
Delay rendering until the GUI is idle.
[ "Delay", "rendering", "until", "the", "GUI", "is", "idle", "." ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/MacOS/backend_wx.py#L788-L802
train
ArduPilot/MAVProxy
MAVProxy/modules/lib/MacOS/backend_wx.py
FigureCanvasWx.draw
def draw(self, drawDC=None): """ Render the figure using RendererWx instance renderer, or using a previously defined renderer if none is specified. """ DEBUG_MSG("draw()", 1, self) self.renderer = RendererWx(self.bitmap, self.figure.dpi) self.figure.draw(self.rend...
python
def draw(self, drawDC=None): """ Render the figure using RendererWx instance renderer, or using a previously defined renderer if none is specified. """ DEBUG_MSG("draw()", 1, self) self.renderer = RendererWx(self.bitmap, self.figure.dpi) self.figure.draw(self.rend...
[ "def", "draw", "(", "self", ",", "drawDC", "=", "None", ")", ":", "DEBUG_MSG", "(", "\"draw()\"", ",", "1", ",", "self", ")", "self", ".", "renderer", "=", "RendererWx", "(", "self", ".", "bitmap", ",", "self", ".", "figure", ".", "dpi", ")", "self...
Render the figure using RendererWx instance renderer, or using a previously defined renderer if none is specified.
[ "Render", "the", "figure", "using", "RendererWx", "instance", "renderer", "or", "using", "a", "previously", "defined", "renderer", "if", "none", "is", "specified", "." ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/MacOS/backend_wx.py#L816-L825
train
ArduPilot/MAVProxy
MAVProxy/modules/lib/MacOS/backend_wx.py
FigureCanvasWx.start_event_loop
def start_event_loop(self, timeout=0): """ Start an event loop. This is used to start a blocking event loop so that interactive functions, such as ginput and waitforbuttonpress, can wait for events. This should not be confused with the main GUI event loop, which is always runni...
python
def start_event_loop(self, timeout=0): """ Start an event loop. This is used to start a blocking event loop so that interactive functions, such as ginput and waitforbuttonpress, can wait for events. This should not be confused with the main GUI event loop, which is always runni...
[ "def", "start_event_loop", "(", "self", ",", "timeout", "=", "0", ")", ":", "if", "hasattr", "(", "self", ",", "'_event_loop'", ")", ":", "raise", "RuntimeError", "(", "\"Event loop already running\"", ")", "id", "=", "wx", ".", "NewId", "(", ")", "timer",...
Start an event loop. This is used to start a blocking event loop so that interactive functions, such as ginput and waitforbuttonpress, can wait for events. This should not be confused with the main GUI event loop, which is always running and has nothing to do with this. Call s...
[ "Start", "an", "event", "loop", ".", "This", "is", "used", "to", "start", "a", "blocking", "event", "loop", "so", "that", "interactive", "functions", "such", "as", "ginput", "and", "waitforbuttonpress", "can", "wait", "for", "events", ".", "This", "should", ...
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/MacOS/backend_wx.py#L846-L875
train
ArduPilot/MAVProxy
MAVProxy/modules/lib/MacOS/backend_wx.py
FigureCanvasWx.stop_event_loop
def stop_event_loop(self, event=None): """ Stop an event loop. This is used to stop a blocking event loop so that interactive functions, such as ginput and waitforbuttonpress, can wait for events. Call signature:: stop_event_loop_default(self) """ if ha...
python
def stop_event_loop(self, event=None): """ Stop an event loop. This is used to stop a blocking event loop so that interactive functions, such as ginput and waitforbuttonpress, can wait for events. Call signature:: stop_event_loop_default(self) """ if ha...
[ "def", "stop_event_loop", "(", "self", ",", "event", "=", "None", ")", ":", "if", "hasattr", "(", "self", ",", "'_event_loop'", ")", ":", "if", "self", ".", "_event_loop", ".", "IsRunning", "(", ")", ":", "self", ".", "_event_loop", ".", "Exit", "(", ...
Stop an event loop. This is used to stop a blocking event loop so that interactive functions, such as ginput and waitforbuttonpress, can wait for events. Call signature:: stop_event_loop_default(self)
[ "Stop", "an", "event", "loop", ".", "This", "is", "used", "to", "stop", "a", "blocking", "event", "loop", "so", "that", "interactive", "functions", "such", "as", "ginput", "and", "waitforbuttonpress", "can", "wait", "for", "events", "." ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/MacOS/backend_wx.py#L877-L890
train
ArduPilot/MAVProxy
MAVProxy/modules/lib/MacOS/backend_wx.py
FigureCanvasWx._get_imagesave_wildcards
def _get_imagesave_wildcards(self): 'return the wildcard string for the filesave dialog' default_filetype = self.get_default_filetype() filetypes = self.get_supported_filetypes_grouped() sorted_filetypes = filetypes.items() sorted_filetypes.sort() wildcards = [] e...
python
def _get_imagesave_wildcards(self): 'return the wildcard string for the filesave dialog' default_filetype = self.get_default_filetype() filetypes = self.get_supported_filetypes_grouped() sorted_filetypes = filetypes.items() sorted_filetypes.sort() wildcards = [] e...
[ "def", "_get_imagesave_wildcards", "(", "self", ")", ":", "'return the wildcard string for the filesave dialog'", "default_filetype", "=", "self", ".", "get_default_filetype", "(", ")", "filetypes", "=", "self", ".", "get_supported_filetypes_grouped", "(", ")", "sorted_file...
return the wildcard string for the filesave dialog
[ "return", "the", "wildcard", "string", "for", "the", "filesave", "dialog" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/MacOS/backend_wx.py#L893-L910
train
ArduPilot/MAVProxy
MAVProxy/modules/lib/MacOS/backend_wx.py
FigureCanvasWx.gui_repaint
def gui_repaint(self, drawDC=None): """ Performs update of the displayed image on the GUI canvas, using the supplied device context. If drawDC is None, a ClientDC will be used to redraw the image. """ DEBUG_MSG("gui_repaint()", 1, self) if self.IsShownOnScreen():...
python
def gui_repaint(self, drawDC=None): """ Performs update of the displayed image on the GUI canvas, using the supplied device context. If drawDC is None, a ClientDC will be used to redraw the image. """ DEBUG_MSG("gui_repaint()", 1, self) if self.IsShownOnScreen():...
[ "def", "gui_repaint", "(", "self", ",", "drawDC", "=", "None", ")", ":", "DEBUG_MSG", "(", "\"gui_repaint()\"", ",", "1", ",", "self", ")", "if", "self", ".", "IsShownOnScreen", "(", ")", ":", "if", "drawDC", "is", "None", ":", "drawDC", "=", "wx", "...
Performs update of the displayed image on the GUI canvas, using the supplied device context. If drawDC is None, a ClientDC will be used to redraw the image.
[ "Performs", "update", "of", "the", "displayed", "image", "on", "the", "GUI", "canvas", "using", "the", "supplied", "device", "context", ".", "If", "drawDC", "is", "None", "a", "ClientDC", "will", "be", "used", "to", "redraw", "the", "image", "." ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/MacOS/backend_wx.py#L912-L928
train
ArduPilot/MAVProxy
MAVProxy/modules/lib/MacOS/backend_wx.py
FigureCanvasWx._onPaint
def _onPaint(self, evt): """ Called when wxPaintEvt is generated """ DEBUG_MSG("_onPaint()", 1, self) drawDC = wx.PaintDC(self) if not self._isDrawn: self.draw(drawDC=drawDC) else: self.gui_repaint(drawDC=drawDC) evt.Skip()
python
def _onPaint(self, evt): """ Called when wxPaintEvt is generated """ DEBUG_MSG("_onPaint()", 1, self) drawDC = wx.PaintDC(self) if not self._isDrawn: self.draw(drawDC=drawDC) else: self.gui_repaint(drawDC=drawDC) evt.Skip()
[ "def", "_onPaint", "(", "self", ",", "evt", ")", ":", "DEBUG_MSG", "(", "\"_onPaint()\"", ",", "1", ",", "self", ")", "drawDC", "=", "wx", ".", "PaintDC", "(", "self", ")", "if", "not", "self", ".", "_isDrawn", ":", "self", ".", "draw", "(", "drawD...
Called when wxPaintEvt is generated
[ "Called", "when", "wxPaintEvt", "is", "generated" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/MacOS/backend_wx.py#L1021-L1032
train
ArduPilot/MAVProxy
MAVProxy/modules/lib/MacOS/backend_wx.py
FigureCanvasWx._onSize
def _onSize(self, evt): """ Called when wxEventSize is generated. In this application we attempt to resize to fit the window, so it is better to take the performance hit and redraw the whole window. """ DEBUG_MSG("_onSize()", 2, self) # Create a new, correctly s...
python
def _onSize(self, evt): """ Called when wxEventSize is generated. In this application we attempt to resize to fit the window, so it is better to take the performance hit and redraw the whole window. """ DEBUG_MSG("_onSize()", 2, self) # Create a new, correctly s...
[ "def", "_onSize", "(", "self", ",", "evt", ")", ":", "DEBUG_MSG", "(", "\"_onSize()\"", ",", "2", ",", "self", ")", "self", ".", "_width", ",", "self", ".", "_height", "=", "self", ".", "GetClientSize", "(", ")", "self", ".", "bitmap", "=", "wx", "...
Called when wxEventSize is generated. In this application we attempt to resize to fit the window, so it is better to take the performance hit and redraw the whole window.
[ "Called", "when", "wxEventSize", "is", "generated", "." ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/MacOS/backend_wx.py#L1041-L1066
train
ArduPilot/MAVProxy
MAVProxy/modules/lib/MacOS/backend_wx.py
FigureCanvasWx._onIdle
def _onIdle(self, evt): 'a GUI idle event' evt.Skip() FigureCanvasBase.idle_event(self, guiEvent=evt)
python
def _onIdle(self, evt): 'a GUI idle event' evt.Skip() FigureCanvasBase.idle_event(self, guiEvent=evt)
[ "def", "_onIdle", "(", "self", ",", "evt", ")", ":", "'a GUI idle event'", "evt", ".", "Skip", "(", ")", "FigureCanvasBase", ".", "idle_event", "(", "self", ",", "guiEvent", "=", "evt", ")" ]
a GUI idle event
[ "a", "GUI", "idle", "event" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/MacOS/backend_wx.py#L1090-L1093
train
ArduPilot/MAVProxy
MAVProxy/modules/lib/MacOS/backend_wx.py
FigureCanvasWx._onKeyDown
def _onKeyDown(self, evt): """Capture key press.""" key = self._get_key(evt) evt.Skip() FigureCanvasBase.key_press_event(self, key, guiEvent=evt)
python
def _onKeyDown(self, evt): """Capture key press.""" key = self._get_key(evt) evt.Skip() FigureCanvasBase.key_press_event(self, key, guiEvent=evt)
[ "def", "_onKeyDown", "(", "self", ",", "evt", ")", ":", "key", "=", "self", ".", "_get_key", "(", "evt", ")", "evt", ".", "Skip", "(", ")", "FigureCanvasBase", ".", "key_press_event", "(", "self", ",", "key", ",", "guiEvent", "=", "evt", ")" ]
Capture key press.
[ "Capture", "key", "press", "." ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/MacOS/backend_wx.py#L1095-L1099
train
ArduPilot/MAVProxy
MAVProxy/modules/lib/MacOS/backend_wx.py
FigureCanvasWx._onKeyUp
def _onKeyUp(self, evt): """Release key.""" key = self._get_key(evt) #print 'release key', key evt.Skip() FigureCanvasBase.key_release_event(self, key, guiEvent=evt)
python
def _onKeyUp(self, evt): """Release key.""" key = self._get_key(evt) #print 'release key', key evt.Skip() FigureCanvasBase.key_release_event(self, key, guiEvent=evt)
[ "def", "_onKeyUp", "(", "self", ",", "evt", ")", ":", "key", "=", "self", ".", "_get_key", "(", "evt", ")", "evt", ".", "Skip", "(", ")", "FigureCanvasBase", ".", "key_release_event", "(", "self", ",", "key", ",", "guiEvent", "=", "evt", ")" ]
Release key.
[ "Release", "key", "." ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/MacOS/backend_wx.py#L1101-L1106
train
ArduPilot/MAVProxy
MAVProxy/modules/lib/MacOS/backend_wx.py
FigureCanvasWx._onLeftButtonUp
def _onLeftButtonUp(self, evt): """End measuring on an axis.""" x = evt.GetX() y = self.figure.bbox.height - evt.GetY() #print 'release button', 1 evt.Skip() if self.HasCapture(): self.ReleaseMouse() FigureCanvasBase.button_release_event(self, x, y, 1, guiEvent=ev...
python
def _onLeftButtonUp(self, evt): """End measuring on an axis.""" x = evt.GetX() y = self.figure.bbox.height - evt.GetY() #print 'release button', 1 evt.Skip() if self.HasCapture(): self.ReleaseMouse() FigureCanvasBase.button_release_event(self, x, y, 1, guiEvent=ev...
[ "def", "_onLeftButtonUp", "(", "self", ",", "evt", ")", ":", "x", "=", "evt", ".", "GetX", "(", ")", "y", "=", "self", ".", "figure", ".", "bbox", ".", "height", "-", "evt", ".", "GetY", "(", ")", "evt", ".", "Skip", "(", ")", "if", "self", "...
End measuring on an axis.
[ "End", "measuring", "on", "an", "axis", "." ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/MacOS/backend_wx.py#L1148-L1155
train
ArduPilot/MAVProxy
MAVProxy/modules/lib/MacOS/backend_wx.py
FigureCanvasWx._onMouseWheel
def _onMouseWheel(self, evt): """Translate mouse wheel events into matplotlib events""" # Determine mouse location x = evt.GetX() y = self.figure.bbox.height - evt.GetY() # Convert delta/rotation/rate into a floating point step size delta = evt.GetWheelDelta() r...
python
def _onMouseWheel(self, evt): """Translate mouse wheel events into matplotlib events""" # Determine mouse location x = evt.GetX() y = self.figure.bbox.height - evt.GetY() # Convert delta/rotation/rate into a floating point step size delta = evt.GetWheelDelta() r...
[ "def", "_onMouseWheel", "(", "self", ",", "evt", ")", ":", "x", "=", "evt", ".", "GetX", "(", ")", "y", "=", "self", ".", "figure", ".", "bbox", ".", "height", "-", "evt", ".", "GetY", "(", ")", "delta", "=", "evt", ".", "GetWheelDelta", "(", "...
Translate mouse wheel events into matplotlib events
[ "Translate", "mouse", "wheel", "events", "into", "matplotlib", "events" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/MacOS/backend_wx.py#L1183-L1212
train
ArduPilot/MAVProxy
MAVProxy/modules/lib/MacOS/backend_wx.py
FigureCanvasWx._onLeave
def _onLeave(self, evt): """Mouse has left the window.""" evt.Skip() FigureCanvasBase.leave_notify_event(self, guiEvent = evt)
python
def _onLeave(self, evt): """Mouse has left the window.""" evt.Skip() FigureCanvasBase.leave_notify_event(self, guiEvent = evt)
[ "def", "_onLeave", "(", "self", ",", "evt", ")", ":", "evt", ".", "Skip", "(", ")", "FigureCanvasBase", ".", "leave_notify_event", "(", "self", ",", "guiEvent", "=", "evt", ")" ]
Mouse has left the window.
[ "Mouse", "has", "left", "the", "window", "." ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/MacOS/backend_wx.py#L1222-L1226
train
ArduPilot/MAVProxy
MAVProxy/modules/lib/MacOS/backend_wx.py
FigureManagerWx.resize
def resize(self, width, height): 'Set the canvas size in pixels' self.canvas.SetInitialSize(wx.Size(width, height)) self.window.GetSizer().Fit(self.window)
python
def resize(self, width, height): 'Set the canvas size in pixels' self.canvas.SetInitialSize(wx.Size(width, height)) self.window.GetSizer().Fit(self.window)
[ "def", "resize", "(", "self", ",", "width", ",", "height", ")", ":", "'Set the canvas size in pixels'", "self", ".", "canvas", ".", "SetInitialSize", "(", "wx", ".", "Size", "(", "width", ",", "height", ")", ")", "self", ".", "window", ".", "GetSizer", "...
Set the canvas size in pixels
[ "Set", "the", "canvas", "size", "in", "pixels" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/MacOS/backend_wx.py#L1443-L1446
train
ArduPilot/MAVProxy
MAVProxy/modules/lib/MacOS/backend_wx.py
MenuButtonWx._onMenuButton
def _onMenuButton(self, evt): """Handle menu button pressed.""" x, y = self.GetPositionTuple() w, h = self.GetSizeTuple() self.PopupMenuXY(self._menu, x, y+h-4) # When menu returned, indicate selection in button evt.Skip()
python
def _onMenuButton(self, evt): """Handle menu button pressed.""" x, y = self.GetPositionTuple() w, h = self.GetSizeTuple() self.PopupMenuXY(self._menu, x, y+h-4) # When menu returned, indicate selection in button evt.Skip()
[ "def", "_onMenuButton", "(", "self", ",", "evt", ")", ":", "x", ",", "y", "=", "self", ".", "GetPositionTuple", "(", ")", "w", ",", "h", "=", "self", ".", "GetSizeTuple", "(", ")", "self", ".", "PopupMenuXY", "(", "self", ".", "_menu", ",", "x", ...
Handle menu button pressed.
[ "Handle", "menu", "button", "pressed", "." ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/MacOS/backend_wx.py#L1513-L1519
train
ArduPilot/MAVProxy
MAVProxy/modules/lib/MacOS/backend_wx.py
MenuButtonWx._handleSelectAllAxes
def _handleSelectAllAxes(self, evt): """Called when the 'select all axes' menu item is selected.""" if len(self._axisId) == 0: return for i in range(len(self._axisId)): self._menu.Check(self._axisId[i], True) self._toolbar.set_active(self.getActiveAxes()) ...
python
def _handleSelectAllAxes(self, evt): """Called when the 'select all axes' menu item is selected.""" if len(self._axisId) == 0: return for i in range(len(self._axisId)): self._menu.Check(self._axisId[i], True) self._toolbar.set_active(self.getActiveAxes()) ...
[ "def", "_handleSelectAllAxes", "(", "self", ",", "evt", ")", ":", "if", "len", "(", "self", ".", "_axisId", ")", "==", "0", ":", "return", "for", "i", "in", "range", "(", "len", "(", "self", ".", "_axisId", ")", ")", ":", "self", ".", "_menu", "....
Called when the 'select all axes' menu item is selected.
[ "Called", "when", "the", "select", "all", "axes", "menu", "item", "is", "selected", "." ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/MacOS/backend_wx.py#L1521-L1528
train
ArduPilot/MAVProxy
MAVProxy/modules/lib/MacOS/backend_wx.py
MenuButtonWx._handleInvertAxesSelected
def _handleInvertAxesSelected(self, evt): """Called when the invert all menu item is selected""" if len(self._axisId) == 0: return for i in range(len(self._axisId)): if self._menu.IsChecked(self._axisId[i]): self._menu.Check(self._axisId[i], False) else: ...
python
def _handleInvertAxesSelected(self, evt): """Called when the invert all menu item is selected""" if len(self._axisId) == 0: return for i in range(len(self._axisId)): if self._menu.IsChecked(self._axisId[i]): self._menu.Check(self._axisId[i], False) else: ...
[ "def", "_handleInvertAxesSelected", "(", "self", ",", "evt", ")", ":", "if", "len", "(", "self", ".", "_axisId", ")", "==", "0", ":", "return", "for", "i", "in", "range", "(", "len", "(", "self", ".", "_axisId", ")", ")", ":", "if", "self", ".", ...
Called when the invert all menu item is selected
[ "Called", "when", "the", "invert", "all", "menu", "item", "is", "selected" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/MacOS/backend_wx.py#L1530-L1539
train
ArduPilot/MAVProxy
MAVProxy/modules/lib/MacOS/backend_wx.py
MenuButtonWx._onMenuItemSelected
def _onMenuItemSelected(self, evt): """Called whenever one of the specific axis menu items is selected""" current = self._menu.IsChecked(evt.GetId()) if current: new = False else: new = True self._menu.Check(evt.GetId(), new) # Lines above would be...
python
def _onMenuItemSelected(self, evt): """Called whenever one of the specific axis menu items is selected""" current = self._menu.IsChecked(evt.GetId()) if current: new = False else: new = True self._menu.Check(evt.GetId(), new) # Lines above would be...
[ "def", "_onMenuItemSelected", "(", "self", ",", "evt", ")", ":", "current", "=", "self", ".", "_menu", ".", "IsChecked", "(", "evt", ".", "GetId", "(", ")", ")", "if", "current", ":", "new", "=", "False", "else", ":", "new", "=", "True", "self", "....
Called whenever one of the specific axis menu items is selected
[ "Called", "whenever", "one", "of", "the", "specific", "axis", "menu", "items", "is", "selected" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/MacOS/backend_wx.py#L1541-L1552
train