Example #1
0
def save_process(MAVExpLastGraph, child_pipe_console_input,
                 child_pipe_graph_input, statusMsgs):
    '''process for saving a graph'''
    from MAVProxy.modules.lib import wx_processguard
    from MAVProxy.modules.lib.wx_loader import wx
    from MAVProxy.modules.lib.wxgrapheditor import GraphDialog

    #This pipe is used to send text to the console
    global pipe_console_input
    pipe_console_input = child_pipe_console_input

    #This pipe is used to send graph commands
    global pipe_graph_input
    pipe_graph_input = child_pipe_graph_input

    #The valid expression messages, required to
    #validate the expression in the dialog box
    global msgs
    msgs = statusMsgs

    app = wx.App(False)
    if MAVExpLastGraph.description is None:
        MAVExpLastGraph.description = ''
    frame = GraphDialog('Graph Editor', MAVExpLastGraph, save_callback)
    frame.ShowModal()
    frame.Destroy()
Example #2
0
    def child_task(self):
        '''child process - this holds all the GUI elements'''
        mp_util.child_close_fds()

        from MAVProxy.modules.lib import wx_processguard
        from MAVProxy.modules.lib.wx_loader import wx
        from MAVProxy.modules.mavproxy_map.mp_slipmap_ui import MPSlipMapFrame

        state = self

        self.mt = mp_tile.MPTile(download=self.download,
                                 service=self.service,
                                 tile_delay=self.tile_delay,
                                 debug=self.debug,
                                 max_zoom=self.max_zoom)
        state.layers = {}
        state.info = {}
        state.need_redraw = True

        self.app = wx.App(False)
        self.app.SetExitOnFrameDelete(True)
        self.app.frame = MPSlipMapFrame(state=self)
        self.app.frame.Show()
        self.app_ready.set()
        self.app.MainLoop()
def save_process(MAVExpLastGraph):
    '''process for saving a graph'''
    from MAVProxy.modules.lib import wx_processguard
    from MAVProxy.modules.lib.wx_loader import wx
    from MAVProxy.modules.lib.wxgrapheditor import GraphDialog
    app = wx.App(False)
    frame = GraphDialog('Graph Editor', MAVExpLastGraph, save_callback)
    frame.ShowModal()
    frame.Destroy()
Example #4
0
    def child_task(self):
        '''child process - this holds all the GUI elements'''
        mp_util.child_close_fds()
        from MAVProxy.modules.lib.wx_loader import wx

        app = wx.App(False)
        app.frame = ChecklistFrame(state=self, title=self.title)
        app.frame.Show()
        app.MainLoop()
Example #5
0
    def child_task(self):
        '''child process - this holds all the GUI elements'''
        mp_util.child_close_fds()

        app = wx.App(False)
        app.frame = SwarmFrame(
            self, title=self.title, params=self.parmsToShow, takeoffalt=self.takeoffalt)
        app.frame.Show()
        app.MainLoop()
Example #6
0
    def child_task(self):
        '''child process - this holds all the GUI elements'''
        mp_util.child_close_fds()
        from MAVProxy.modules.lib.wx_loader import wx
        state = self

        self.app = wx.App(False)
        self.app.frame = MPImageFrame(state=self)
        self.app.frame.Show()
        self.app.MainLoop()
Example #7
0
    def ui_task(self):
        mp_util.child_close_fds()

        from MAVProxy.modules.lib import wx_processguard
        from MAVProxy.modules.lib.wx_loader import wx
        from lib.magcal_graph_ui import MagcalFrame

        app = wx.App(False)
        app.frame = MagcalFrame(self.child_pipe)
        app.frame.Show()
        app.MainLoop()
Example #8
0
    def child_task(self):
        '''child process - this holds all the GUI elements'''
        self.parent_pipe_send.close()
        self.parent_pipe_recv.close()

        from MAVProxy.modules.lib import wx_processguard
        from MAVProxy.modules.lib.wx_loader import wx
        from MAVProxy.modules.lib.wxconsole_ui import ConsoleFrame
        app = wx.App(False)
        app.frame = ConsoleFrame(state=self, title=self.title)
        app.frame.SetDoubleBuffered(True)
        app.frame.Show()
        app.MainLoop()
Example #9
0
 def call(self):
     '''show the dialog as a child process'''
     mp_util.child_close_fds()
     from MAVProxy.modules.lib import wx_processguard
     from MAVProxy.modules.lib.wx_loader import wx
     from wx.lib.agw.genericmessagedialog import GenericMessageDialog
     app = wx.App(False)
     # note! font size change is not working. I don't know why yet
     font = wx.Font(self.font_size, wx.MODERN, wx.NORMAL, wx.NORMAL)
     dlg = GenericMessageDialog(None, self.message, self.title, wx.ICON_INFORMATION|wx.OK)
     dlg.SetFont(font)
     dlg.ShowModal()
     app.MainLoop()
Example #10
0
 def child_task(self):
     '''child process - this holds all the GUI elements'''
     self.parent_pipe_send.close()
     
     from MAVProxy.modules.lib.wx_loader import wx
     from MAVProxy.modules.lib.wxhorizon_ui import HorizonFrame
     # Create wx application
     app = wx.App(False)
     app.frame = HorizonFrame(state=self, title=self.title)
     app.frame.SetDoubleBuffered(True)
     app.frame.Show()
     app.MainLoop()
     self.close_event.set()   # indicate that the GUI has closed
Example #11
0
    def child_task(self):
        '''child process - this holds all the GUI elements'''
        from MAVProxy.modules.lib import mp_util
        from MAVProxy.modules.lib import wx_processguard
        from MAVProxy.modules.lib.wx_loader import wx
        from MAVProxy.modules.lib.wxsettings_ui import SettingsDlg

        mp_util.child_close_fds()
        app = wx.App(False)
        dlg = SettingsDlg(self.settings)
        dlg.parent_pipe = self.parent_pipe
        dlg.ShowModal()
        dlg.Destroy()
Example #12
0
    def child_task(self):
        '''Launch the MagFitUI'''

        from MAVProxy.modules.lib import wx_processguard
        from MAVProxy.modules.lib.wx_loader import wx

        # create wx application
        app = wx.App(False)
        app.frame = MagFitUI(title=self.title,
                             close_event=self.close_event,
                             mlog=self.mlog,
                             timestamp_in_range=self.xlimits.timestamp_in_range)

        app.frame.SetDoubleBuffered(True)
        app.frame.Show()
        app.MainLoop()
Example #13
0
    def child_task(self):
        '''child process - this holds all the GUI elements'''
        mp_util.child_close_fds()

        import matplotlib, platform
        if platform.system() != "Darwin":
            # on MacOS we can't set WxAgg here as it conflicts with the MacOS version
            matplotlib.use('WXAgg')

        from MAVProxy.modules.lib import wx_processguard
        from MAVProxy.modules.lib.wx_loader import wx

        app = wx.App(False)
        from MAVProxy.modules.lib import live_graph_ui
        app.frame = live_graph_ui.GraphFrame(state=self)
        app.frame.Show()
        app.MainLoop()
Example #14
0
    def child_task(self):
        '''The child process hosts the GUI elements'''

        # prevent the child from using the parent connection
        self.parent_pipe_send.close()

        from MAVProxy.modules.lib import wx_processguard
        from MAVProxy.modules.lib.wx_loader import wx
        from MAVProxy.modules.lib.wxsaildash_ui import SailingDashboardFrame

        # create the wx application and pass self as the state
        app = wx.App()
        app.frame = SailingDashboardFrame(state=self,
                                          title=self.title,
                                          size=(800, 300))
        app.frame.SetDoubleBuffered(True)
        app.frame.Show()
        app.MainLoop()

        # trigger a close event when the main app window is closed.
        # the event is monitored by the MAVProxy module which will
        # flag the module for unloading
        self.close_event.set()
Example #15
0
    def show(self):
        if not hasattr(self.mlog, 'formats'):
            print("Must be DF log")
            return
        self.app = wx.App(False)
        wx.Dialog.__init__(self, None, -1, "MagFit", size=(600, 800))
        self.panel = wx.Panel(self)
        self.vbox = wx.BoxSizer(wx.VERTICAL)
        self.vbox.AddStretchSpacer()
        self.panel.SetSizer(self.vbox)
        self.idmap = {}
        self.values = {}
        self.controls = {}
        self.callbacks = {}
        self.row = None

        msg_names = self.mlog.name_to_id.keys()
        mag_format = self.mlog.formats[self.mlog.name_to_id['MAG']]
        if 'I' in mag_format.columns:
            mag_choices = ['MAG[0]', 'MAG[1]', 'MAG[2]']
        else:
            mag_choices = ['MAG', 'MAG2', 'MAG3']

        att_choices = ['ATT']
        if self.have_msg('NKF1'):
            att_choices.append('NKF1')
        if self.have_msg('XKF1'):
            att_choices.append('XKF1')

        # first row, Mag and attitude source
        self.StartRow('Source Selection')
        self.AddCombo('Magnetometer', mag_choices)
        self.AddCombo('Attitude', att_choices)

        self.StartRow('Position')
        self.AddSpinFloat("Lattitude", -90, 90, 0.000001, 0, digits=8)
        self.AddSpinFloat("Longitude", -180, 180, 0.000001, 0, digits=8)

        self.StartRow()
        self.AddSpinInteger("Reduce", 1, 20, 1)

        self.StartRow('Offset Estimation')
        self.AddCheckBox("Offsets", default=True)
        self.StartRow()
        self.AddSpinInteger("OffsetMax", 500, 3000, 1500)

        self.StartRow('Scale Factor Estimation')
        self.AddSpinFloat("ScaleMin", 0.5, 2.0, 0.01, 1.0)
        self.AddSpinFloat("ScaleMax", 0.5, 2.0, 0.01, 1.0)

        self.StartRow('Elliptical Estimation')
        self.AddCheckBox("Elliptical")
        self.StartRow()
        self.AddSpinFloat("DiagonalMin", 0.8, 1.0, 0.01, 0.8)
        self.AddSpinFloat("DiagonalMax", 1.0, 1.2, 0.01, 1.2)
        self.StartRow()
        self.AddSpinFloat("OffDiagMin", -0.2, 0.0, 0.01, -0.2)
        self.AddSpinFloat("OffDiagMax", 0, 0.2, 0.01, 0.2)

        self.StartRow('Motor Interference Estimation')
        self.AddCheckBox("CMOT")
        self.AddCheckBox("CMOT NoChange")
        self.StartRow()
        self.AddSpinInteger("BatteryNum", 1, 8, 1)
        self.AddSpinFloat("CMOT Max", 1.0, 10, 0.1, 10)

        self.StartRow("Processing")
        self.AddButton('Run', callback=self.run)
        self.AddButton('Close', callback=self.close)
        self.EndRow()
        
        self.Center()
        while not self.closed:
            self.Show()
            pyplot.pause(0.05)
            time.sleep(0.05)
            wx.Yield()
        self.Close()