# Path: MAVProxy/modules/lib/multiproc.py
# class PipeQueue(object):
#     def __init__(self):
#     def close(self):
#     def put(self, *args):
#     def fill(self):
#     def get(self):
#     def qsize(self):
#     def empty(self):
# 
# Path: MAVProxy/modules/mavproxy_paramedit/checklisteditor.py
# class GridCheckListEditor(gridlib.PyGridCellEditor):
# class GridDropListEditor(gridlib.PyGridCellEditor):
# class GridScrollEditor(gridlib.PyGridCellEditor):
#     def __init__(self, choice, pvalcol, start):
#     def set_checked(self, selected):
#     def get_checked(self):
#     def Create(self, parent, id, evtHandler):
#     def SetSize(self, rect):
#     def Show(self, show, attr):
#     def BeginEdit(self, row, col, grid):
#     def EndEdit(self, row, col, grid, oldVal):
#     def get_pvalue(self):
#     def ApplyEdit(self, row, col, grid):
#     def Reset(self):
#     def StartingKey(self, evt):
#     def Destroy(self):
#     def Clone(self):
#     def __init__(self, choice, pvalcol, start=0):
#     def set_checked(self, selected):
#     def get_checked(self):
#     def Create(self, parent, id, evtHandler):
#     def Show(self, show, attr):
#     def SetSize(self, rect):
#     def BeginEdit(self, row, col, grid):
#     def EndEdit(self, row, col, grid, oldVal):
#     def ApplyEdit(self, row, col, grid):
#     def Reset(self):
#     def StartingKey(self, evt):
#     def Destroy(self):
#     def Clone(self):
#     def __init__(self, Range, pvalcol, start):
#     def set_checked(self, selected):
#     def SetSize(self, rect):
#     def get_checked(self):
#     def Create(self, parent, id, evtHandler):
#     def Show(self, show, attr):
#     def BeginEdit(self, row, col, grid):
#     def EndEdit(self, row, col, grid, oldVal):
#     def ApplyEdit(self, row, col, grid):
#     def Reset(self):
#     def StartingKey(self, evt):
#     def Destroy(self):
#     def Clone(self):
# 
# Path: MAVProxy/modules/lib/mp_util.py
# def wrap_360(angle):
# def wrap_180(angle):
# def gps_distance(lat1, lon1, lat2, lon2):
# def gps_bearing(lat1, lon1, lat2, lon2):
# def wrap_valid_longitude(lon):
# def constrain(v, minv, maxv):
# def constrain_latlon(latlon):
# def gps_newpos(lat, lon, bearing, distance):
# def gps_offset(lat, lon, east, north):
# def mkdir_p(dir):
# def polygon_load(filename):
# def polygon_bounds(points):
# def bounds_overlap(bound1, bound2):
#     def __init__(self, object, debug=False):
# def degrees_to_dms(degrees):
#     def __init__(self, zone, easting, northing, hemisphere='S'):
#     def __str__(self):
#     def latlon(self):
# def latlon_to_grid(latlon):
# def latlon_round(latlon, spacing=1000):
# def wxToPIL(wimg):
# def PILTowx(pimg):
# def dot_mavproxy(name=None):
# def download_url(url):
# def download_files(files):
# def child_close_fds():
# def child_fd_list_add(fd):
# def child_fd_list_remove(fd):
# def quaternion_to_axis_angle(q):
# def null_term(str):
# def decode_devid(devid, pname):
# def decode_flight_sw_version(flight_sw_version):
# class object_container:
# class UTMGrid:
# 
# Path: MAVProxy/modules/mavproxy_paramedit/ph_event.py
# PEE_READ_KEY = 0
# PEE_LOAD_FILE = 1
# PEE_SAVE_FILE = 2
# PEE_READ_PARAM = 3
# PEE_WRITE_PARAM = 4
# PEE_TIME_TO_QUIT = 5
# PEE_RESET = 6
# PEE_FETCH = 7
# PEGE_READ_PARAM = 0
# PEGE_REFRESH_PARAM = 1
# PEGE_WRITE_SUCC = 2
# PEGE_RCIN = 3
# class ParamEditorEvent:
#     def __init__(self, type, **kwargs):
#     def get_type(self):
#     def get_arg(self, key):


import wx
import wx.grid
import os
import sys
import time
import math
from MAVProxy.modules.lib import multiproc
from MAVProxy.modules.mavproxy_paramedit import checklisteditor as cle
from MAVProxy.modules.lib import mp_util
from MAVProxy.modules.mavproxy_paramedit import ph_event
            from lxml import objectify
        self.set_row_size(row)
        try:
            for f in self.htree[name].field:
                if f.get('name') == "Bitmask":
                    bits = str(f).split(',')
                    self.display_list.SetCellEditor(row, PE_OPTION, cle.GridCheckListEditor(bits, PE_VALUE, pvalue))
                    val = ""
                    binary = bin(int(pvalue))[2:]
                    for b in bits:
                        bopt = b.split(":")
                        if len(bopt) != 2:
                            continue
                        bvalue = int(bopt[0])
                        bstr = bopt[1].strip()
                        if (int(pvalue) & (1 << bvalue)) != 0:
                            val = val + "%u: %s\n" % (bvalue, bstr)
                    val = val.strip()
                    self.display_list.SetCellValue(row, PE_OPTION, str(val))
                    self.set_row_size(row, 25*len(bits))
                    return
        except Exception as e:
            pass
        try:
            if self.htree[name].values is not None:
                v = self.htree[name].findall('values')[0].getchildren()
                for i in range(len(v)):
                    if float(v[i].get('code')) == pvalue:
                        selected = str(v[i].get('code'))+":"+str(v[i])
                        sel_ind = i
                    v[i] = str(v[i].get('code'))+":"+str(v[i])

# Path: MAVProxy/modules/lib/multiproc.py
# class PipeQueue(object):
#     def __init__(self):
#     def close(self):
#     def put(self, *args):
#     def fill(self):
#     def get(self):
#     def qsize(self):
#     def empty(self):
# 
# Path: MAVProxy/modules/mavproxy_paramedit/checklisteditor.py
# class GridCheckListEditor(gridlib.PyGridCellEditor):
# class GridDropListEditor(gridlib.PyGridCellEditor):
# class GridScrollEditor(gridlib.PyGridCellEditor):
#     def __init__(self, choice, pvalcol, start):
#     def set_checked(self, selected):
#     def get_checked(self):
#     def Create(self, parent, id, evtHandler):
#     def SetSize(self, rect):
#     def Show(self, show, attr):
#     def BeginEdit(self, row, col, grid):
#     def EndEdit(self, row, col, grid, oldVal):
#     def get_pvalue(self):
#     def ApplyEdit(self, row, col, grid):
#     def Reset(self):
#     def StartingKey(self, evt):
#     def Destroy(self):
#     def Clone(self):
#     def __init__(self, choice, pvalcol, start=0):
#     def set_checked(self, selected):
#     def get_checked(self):
#     def Create(self, parent, id, evtHandler):
#     def Show(self, show, attr):
#     def SetSize(self, rect):
#     def BeginEdit(self, row, col, grid):
#     def EndEdit(self, row, col, grid, oldVal):
#     def ApplyEdit(self, row, col, grid):
#     def Reset(self):
#     def StartingKey(self, evt):
#     def Destroy(self):
#     def Clone(self):
#     def __init__(self, Range, pvalcol, start):
#     def set_checked(self, selected):
#     def SetSize(self, rect):
#     def get_checked(self):
#     def Create(self, parent, id, evtHandler):
#     def Show(self, show, attr):
#     def BeginEdit(self, row, col, grid):
#     def EndEdit(self, row, col, grid, oldVal):
#     def ApplyEdit(self, row, col, grid):
#     def Reset(self):
#     def StartingKey(self, evt):
#     def Destroy(self):
#     def Clone(self):
# 
# Path: MAVProxy/modules/lib/mp_util.py
# def wrap_360(angle):
# def wrap_180(angle):
# def gps_distance(lat1, lon1, lat2, lon2):
# def gps_bearing(lat1, lon1, lat2, lon2):
# def wrap_valid_longitude(lon):
# def constrain(v, minv, maxv):
# def constrain_latlon(latlon):
# def gps_newpos(lat, lon, bearing, distance):
# def gps_offset(lat, lon, east, north):
# def mkdir_p(dir):
# def polygon_load(filename):
# def polygon_bounds(points):
# def bounds_overlap(bound1, bound2):
#     def __init__(self, object, debug=False):
# def degrees_to_dms(degrees):
#     def __init__(self, zone, easting, northing, hemisphere='S'):
#     def __str__(self):
#     def latlon(self):
# def latlon_to_grid(latlon):
# def latlon_round(latlon, spacing=1000):
# def wxToPIL(wimg):
# def PILTowx(pimg):
# def dot_mavproxy(name=None):
# def download_url(url):
# def download_files(files):
# def child_close_fds():
# def child_fd_list_add(fd):
# def child_fd_list_remove(fd):
# def quaternion_to_axis_angle(q):
# def null_term(str):
# def decode_devid(devid, pname):
# def decode_flight_sw_version(flight_sw_version):
# class object_container:
# class UTMGrid:
# 
# Path: MAVProxy/modules/mavproxy_paramedit/ph_event.py
# PEE_READ_KEY = 0
# PEE_LOAD_FILE = 1
# PEE_SAVE_FILE = 2
# PEE_READ_PARAM = 3
# PEE_WRITE_PARAM = 4
# PEE_TIME_TO_QUIT = 5
# PEE_RESET = 6
# PEE_FETCH = 7
# PEGE_READ_PARAM = 0
# PEGE_REFRESH_PARAM = 1
# PEGE_WRITE_SUCC = 2
# PEGE_RCIN = 3
# class ParamEditorEvent:
#     def __init__(self, type, **kwargs):
#     def get_type(self):
#     def get_arg(self, key):


# Path: MAVProxy/modules/mavproxy_paramedit/param_editor_frame.py
import wx
import wx.grid
import os
import sys
import time
import math
from MAVProxy.modules.lib import multiproc
from MAVProxy.modules.mavproxy_paramedit import checklisteditor as cle
from MAVProxy.modules.lib import mp_util
from MAVProxy.modules.mavproxy_paramedit import ph_event
            from lxml import objectify

        self.set_row_size(row)
        try:
            for f in self.htree[name].field:
                if f.get('name') == "Bitmask":
                    bits = str(f).split(',')
                    self.display_list.SetCellEditor(row, PE_OPTION, cle.GridCheckListEditor(bits, PE_VALUE, pvalue))
                    val = ""
                    binary = bin(int(pvalue))[2:]
                    for b in bits:
                        bopt = b.split(":")
                        if len(bopt) != 2:
                            continue
                        bvalue = int(bopt[0])
                        bstr = bopt[1].strip()
                        if (int(pvalue) & (1 << bvalue)) != 0:
                            val = val + "%u: %s\n" % (bvalue, bstr)
                    val = val.strip()
                    self.display_list.SetCellValue(row, PE_OPTION, str(val))
                    self.set_row_size(row, 25*len(bits))
                    return
        except Exception as e:
            pass
        try:
            if self.htree[name].values is not None:
                v = self.htree[name].findall('values')[0].getchildren()
                for i in range(len(v)):
                    if float(v[i].get('code')) == pvalue:
                        selected = str(v[i].get('code'))+":"+str(v[i])
                        sel_ind = i
                    v[i] = str(v[i].get('code'))+":"+str(v[i])

                self.display_list.SetCellEditor(row, PE_OPTION, cle.GridDropListEditor(v, PE_VALUE, sel_ind))