def __init__(self, state, title, params, takeoffalt): self.state = state wx.Frame.__init__(self, None, title=title, size=( 1400, 500), style=wx.DEFAULT_FRAME_STYLE) self.panel = scrolled.ScrolledPanel(self, style=wx.FULL_REPAINT_ON_RESIZE) self.panel.SetBackgroundColour(wx.WHITE) # Icon self.SetIcon(icon.SimpleIcon("Swarm").get_ico()) # Params to show (array) self.parmsToShow = params self.takeoffalt = takeoffalt self.last_layout_send = time.time() # layout. Column per leader, with followers underneath self.sizer = wx.FlexGridSizer(1, 1, 0, 0) # add in the pipe from MAVProxy self.timer = wx.Timer(self) self.Bind(wx.EVT_TIMER, lambda evt, panel=self.panel: self.on_timer(evt), self.timer) self.timer.Start(100) #Fires on window resize self.Bind(wx.EVT_SIZE, self.OnSize) # layout self.panel.SetSizer(self.sizer) self.panel.Layout() self.panel.SetupScrolling() self.Show(True)
def __init__(self, state, title): self.state = state wx.Frame.__init__(self, None, title=title, size=(800, 300)) # different icons for MAVExplorer and MAVProxy try: if title == "MAVExplorer": self.SetIcon(icon.SimpleIcon("EXPLORER").get_ico()) else: self.SetIcon(icon.SimpleIcon("CONSOLE").get_ico()) except Exception: pass self.panel = wx.Panel(self) self.panel.SetBackgroundColour('white') state.frame = self # values for the status bar self.values = {} self.menu = None self.menu_callback = None self.last_layout_send = time.time() self.control = wx.TextCtrl(self.panel, style=wx.TE_MULTILINE | wx.TE_READONLY | wx.TE_AUTO_URL) self.vbox = wx.BoxSizer(wx.VERTICAL) # start with one status row self.status = [wx.BoxSizer(wx.HORIZONTAL)] self.vbox.Add(self.status[0], 0, flag=wx.ALIGN_LEFT | wx.TOP) self.vbox.Add(self.control, 1, flag=wx.LEFT | wx.BOTTOM | wx.GROW) self.panel.SetSizer(self.vbox) self.timer = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.on_timer, self.timer) self.timer.Start(100) self.Bind(wx.EVT_IDLE, self.on_idle) self.Bind(wx.EVT_TEXT_URL, self.on_text_url) self.Show(True) self.pending = []
def __init__(self, state): wx.Frame.__init__(self, None, wx.ID_ANY, state.title) try: self.SetIcon(icon.SimpleIcon("MAP").get_ico()) except Exception: pass self.state = state state.frame = self state.grid = True state.follow = True state.download = True state.popup_object = None state.popup_latlon = None state.popup_started = False state.default_popup = None state.panel = MPSlipMapPanel(self, state) self.last_layout_send = time.time() self.Bind(wx.EVT_IDLE, self.on_idle) self.Bind(wx.EVT_SIZE, state.panel.on_size) self.legend_checkbox_menuitem_added = False # create the View menu self.menu = MPMenuTop([ MPMenuSubMenu('View', items=[ MPMenuCheckbox('Follow\tCtrl+F', 'Follow Aircraft', 'toggleFollow', checked=state.follow), MPMenuCheckbox('Grid\tCtrl+G', 'Enable Grid', 'toggleGrid', checked=state.grid), MPMenuItem('Goto\tCtrl+P', 'Goto Position', 'gotoPosition'), MPMenuItem('Brightness +\tCtrl+B', 'Increase Brightness', 'increaseBrightness'), MPMenuItem('Brightness -\tCtrl+Shift+B', 'Decrease Brightness', 'decreaseBrightness'), MPMenuItem('Zoom +\t+', 'Zoom In', 'zoomIn'), MPMenuItem('Zoom -\t-', 'Zoom Out', 'zoomOut'), MPMenuCheckbox('Download Tiles\tCtrl+D', 'Enable Tile Download', 'toggleDownload', checked=state.download), MPMenuRadio('Service', 'Select map service', returnkey='setService', selected=state.mt.get_service(), items=state.mt.get_service_list()) ]) ]) self.SetMenuBar(self.menu.wx_menu()) self.Bind(wx.EVT_MENU, self.on_menu)
def __init__(self): self.input_queue = multiproc.Queue() self.rl = None self.console = wxconsole.MessageConsole( title='MAVExplorer', ico=icon.SimpleIcon("EXPLORER")) self.exit = False self.status = MEStatus() self.settings = MPSettings([ MPSetting('marker', str, '+', 'data marker', tab='Graph'), MPSetting('condition', str, None, 'condition'), MPSetting('xaxis', str, None, 'xaxis'), MPSetting('linestyle', str, None, 'linestyle'), MPSetting('show_flightmode', bool, True, 'show flightmode'), MPSetting('sync_xzoom', bool, True, 'sync X-axis zoom'), MPSetting('sync_xmap', bool, True, 'sync X-axis zoom for map'), MPSetting('legend', str, 'upper left', 'legend position'), MPSetting('legend2', str, 'upper right', 'legend2 position'), MPSetting('title', str, None, 'Graph title'), ]) self.mlog = None self.filename = None self.command_map = command_map self.completions = { "set": ["(SETTING)"], "condition": ["(VARIABLE)"], "graph": [ '(VARIABLE) (VARIABLE) (VARIABLE) (VARIABLE) (VARIABLE) (VARIABLE) (VARIABLE) (VARIABLE) (VARIABLE) (VARIABLE) (VARIABLE) (VARIABLE)' ], "map": ['(VARIABLE) (VARIABLE) (VARIABLE) (VARIABLE) (VARIABLE)'] } self.aliases = {} self.graphs = [] self.flightmode_selections = [] self.last_graph = GraphDefinition(self.settings.title, '', '', [], None) #pipe to the wxconsole for any child threads (such as the save dialog box) self.parent_pipe_recv_console, self.child_pipe_send_console = multiproc.Pipe( duplex=False) #pipe for creating graphs (such as from the save dialog box) self.parent_pipe_recv_graph, self.child_pipe_send_graph = multiproc.Pipe( duplex=False) tConsoleWrite = threading.Thread(target=self.pipeRecvConsole) tConsoleWrite.daemon = True tConsoleWrite.start() tGraphWrite = threading.Thread(target=self.pipeRecvGraph) tGraphWrite.daemon = True tGraphWrite.start()
def __init__(self, state): wx.Frame.__init__(self, None, -1, state.title) self.SetIcon(icon.SimpleIcon().get_ico()) self.state = state self.data = [] for i in range(len(state.fields)): self.data.append([]) self.paused = False self.create_main_panel() self.Bind(wx.EVT_IDLE, self.on_idle) self.redraw_timer = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.on_redraw_timer, self.redraw_timer) self.redraw_timer.Start(1000 * self.state.tickresolution) self.last_yrange = (None, None)
def __init__(self, mpstate): super(ConsoleModule, self).__init__(mpstate, "console", "GUI console", public=True, multi_vehicle=True) self.in_air = False self.start_time = 0.0 self.total_time = 0.0 self.speed = 0 self.max_link_num = 0 self.last_sys_status_health = 0 self.last_sys_status_errors_announce = 0 self.user_added = {} self.safety_on = False self.add_command('console', self.cmd_console, "console module", ['add', 'list', 'remove']) mpstate.console = wxconsole.MessageConsole( title='Console', ico=icon.SimpleIcon("CONSOLE")) # setup some default status information mpstate.console.set_status('Mode', 'UNKNOWN', row=0, fg='blue') mpstate.console.set_status('SysID', '', row=0, fg='blue') mpstate.console.set_status('ARM', 'ARM', fg='grey', row=0) mpstate.console.set_status('GPS', 'GPS: --', fg='red', row=0) mpstate.console.set_status('GPS2', '', fg='red', row=0) mpstate.console.set_status('Vcc', 'Vcc: --', fg='red', row=0) mpstate.console.set_status('Radio', 'Radio: --', row=0) mpstate.console.set_status('INS', 'INS', fg='grey', row=0) mpstate.console.set_status('MAG', 'MAG', fg='grey', row=0) mpstate.console.set_status('AS', 'AS', fg='grey', row=0) mpstate.console.set_status('RNG', 'RNG', fg='grey', row=0) mpstate.console.set_status('AHRS', 'AHRS', fg='grey', row=0) mpstate.console.set_status('EKF', 'EKF', fg='grey', row=0) mpstate.console.set_status('LOG', 'LOG', fg='grey', row=0) mpstate.console.set_status('Heading', 'Hdg ---/---', row=2) mpstate.console.set_status('Alt', 'Alt ---', row=2) mpstate.console.set_status('AGL', 'AGL ---/---', row=2) mpstate.console.set_status('AirSpeed', 'AirSpeed --', row=2) mpstate.console.set_status('GPSSpeed', 'GPSSpeed --', row=2) mpstate.console.set_status('Thr', 'Thr ---', row=2) mpstate.console.set_status('Roll', 'Roll ---', row=2) mpstate.console.set_status('Pitch', 'Pitch ---', row=2) mpstate.console.set_status('Wind', 'Wind ---/---', row=2) mpstate.console.set_status('WP', 'WP --', row=3) mpstate.console.set_status('WPDist', 'Distance ---', row=3) mpstate.console.set_status('WPBearing', 'Bearing ---', row=3) mpstate.console.set_status('AltError', 'AltError --', row=3) mpstate.console.set_status('AspdError', 'AspdError --', row=3) mpstate.console.set_status('FlightTime', 'FlightTime --', row=3) mpstate.console.set_status('ETR', 'ETR --', row=3) mpstate.console.set_status('Params', 'Param ---/---', row=3) mpstate.console.set_status('Mission', 'Mission --/--', row=3) mpstate.console.ElevationMap = mp_elevation.ElevationModel() self.vehicle_list = [] self.vehicle_menu = None self.vehicle_name_by_sysid = {} self.component_name = {} self.last_param_sysid_timestamp = None # create the main menu if mp_util.has_wxpython: self.menu = MPMenuTop([]) self.add_menu( MPMenuSubMenu('MAVProxy', items=[ MPMenuItem('Settings', 'Settings', 'menuSettings'), MPMenuItem('Map', 'Load Map', '# module load map') ])) self.vehicle_menu = MPMenuSubMenu('Vehicle', items=[]) self.add_menu(self.vehicle_menu)