Ejemplo n.º 1
0
 def downloadTile(self, continent, filename):
     #Use HTTP
     mp_util.child_close_fds()
     if self.offline == 1:
         return
     conn = httplib.HTTPConnection(self.server)
     conn.set_debuglevel(0)
     filepath = "%s%s%s" % \
                  (self.directory,continent,filename)
     try:
         conn.request("GET", filepath)
         r1 = conn.getresponse()
         if r1.status == 200:
             '''print "status200 received ok"'''
             data = r1.read()
             self.ftpfile = open(os.path.join(self.cachedir, filename),
                                 'wb')
             self.ftpfile.write(data)
             self.ftpfile.close()
             self.ftpfile = None
         else:
             '''print "oh no = status=%d %s" \
             % (r1.status,r1.reason)'''
     except Exception as e:
         if not self.first_failure:
             #print("SRTM Download failed: %s" % str(e))
             self.first_failure = True
         pass
Ejemplo n.º 2
0
    def createFileListHTTP(self, server, directory):
        """Create a list of the available SRTM files on the server using
        HTTP file transfer protocol (rather than ftp).
        30may2010  GJ ORIGINAL VERSION
        """
        mp_util.child_close_fds()
        if self.debug:
            print("Connecting to %s" % server)
        conn = httplib.HTTPConnection(server)
        conn.request("GET", directory)
        r1 = conn.getresponse()
        '''if r1.status==200:
            print "status200 received ok"
        else:
            print "oh no = status=%d %s" \
                  % (r1.status,r1.reason)'''

        data = r1.read()
        parser = parseHTMLDirectoryListing()
        parser.feed(data)
        continents = parser.getDirListing()
        '''print continents'''
        conn.close()

        for continent in continents:
            if not continent[0].isalpha() or continent.startswith('README'):
                continue
            '''print "Downloading file list for", continent'''
            url = "%s%s" % (self.directory, continent)
            if self.debug:
                print("fetching %s" % url)
            try:
                conn = httplib.HTTPConnection(server)
                conn.request("GET", url)
                r1 = conn.getresponse()
            except Exception as ex:
                print("Failed to download %s : %s" % (url, ex))
                continue
            '''if r1.status==200:
                print "status200 received ok"
            else:
                print "oh no = status=%d %s" \
                      % (r1.status,r1.reason)'''
            data = r1.read()
            conn.close()
            parser = parseHTMLDirectoryListing()
            parser.feed(data)
            files = parser.getDirListing()

            for filename in files:
                self.filelist[self.parseFilename(filename)] = (continent,
                                                               filename)
            '''print self.filelist'''
        # Add meta info
        self.filelist["server"] = self.server
        self.filelist["directory"] = self.directory
        with open(self.filelist_file, 'wb') as output:
            pickle.dump(self.filelist, output)
        if self.debug:
            print("created file list with %u entries" % len(self.filelist))
Ejemplo n.º 3
0
 def downloadTile(self, continent, filename):
     #Use HTTP
     mp_util.child_close_fds()
     if self.offline == 1:
         return
     conn = httplib.HTTPConnection(self.server)
     conn.set_debuglevel(0)
     filepath = "%s%s%s" % \
                  (self.directory,continent,filename)
     try:
         conn.request("GET", filepath)
         r1 = conn.getresponse()
         if r1.status==200:
             '''print "status200 received ok"'''
             data = r1.read()
             self.ftpfile = open(os.path.join(self.cachedir, filename), 'wb')
             self.ftpfile.write(data)
             self.ftpfile.close()
             self.ftpfile = None
         else:
             '''print "oh no = status=%d %s" \
             % (r1.status,r1.reason)'''
     except Exception as e:
         if not self.first_failure:
             #print("SRTM Download failed: %s" % str(e))
             self.first_failure = True
         pass
    def child_task(self, queue, lock, gui_queue, gui_lock, close_window_sem):
        '''child process - this holds GUI elements'''
        mp_util.child_close_fds()
        self.app = wx.App(False)
        self.app.frame = param_editor_frame.ParamEditorFrame(
            parent=None, id=wx.ID_ANY)
        self.app.frame.set_event_queue(queue)
        self.app.frame.set_event_queue_lock(lock)
        self.app.frame.set_gui_event_queue(gui_queue)
        self.app.frame.set_gui_event_queue_lock(gui_lock)
        self.app.frame.get_vehicle_type(self.mpstate.vehicle_name)
        self.app.frame.set_close_window_semaphore(close_window_sem)
        self.app.frame.redirect_err(self.mpstate.settings.moddebug)
        self.app.frame.set_param_init(self.mpstate.module('param').mav_param, self.mpstate.vehicle_name)
        self.app.SetExitOnFrameDelete(True)
        self.app.frame.Show()

        # start a thread to monitor the "close window" semaphore:
        class CloseWindowSemaphoreWatcher(threading.Thread):
            def __init__(self, task, sem):
                threading.Thread.__init__(self)
                self.task = task
                self.sem = sem

            def run(self):
                self.sem.acquire(True)
                self.task.app.ExitMainLoop()
        watcher_thread = CloseWindowSemaphoreWatcher(self, close_window_sem)
        watcher_thread.start()

        self.app.MainLoop()
        # tell the watcher it is OK to quit:
        close_window_sem.release()
        watcher_thread.join()
Ejemplo n.º 5
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()
Ejemplo n.º 6
0
 def child_task(self):
     '''child process - this holds all the GUI elements'''
     mp_util.child_close_fds()
     app = wx.PySimpleApp()
     dlg = SettingsDlg(self.settings)
     dlg.parent_pipe = self.parent_pipe
     dlg.ShowModal()
     dlg.Destroy()
Ejemplo n.º 7
0
 def child_task(self):
     '''child process - this holds all the GUI elements'''
     mp_util.child_close_fds()
     import wx
     app = wx.PySimpleApp()
     app.frame = ConsoleFrame(state=self, title=self.title)
     app.frame.Show()
     app.MainLoop()
Ejemplo n.º 8
0
 def child_task(self):
     '''child process - this holds all the GUI elements'''
     mp_util.child_close_fds()
     app = wx.PySimpleApp()
     dlg = SettingsDlg(self.settings)
     dlg.parent_pipe = self.parent_pipe
     dlg.ShowModal()
     dlg.Destroy()
Ejemplo n.º 9
0
 def child_task(self):
     '''child process - this holds all the GUI elements'''
     mp_util.child_close_fds()
     import wx
     app = wx.PySimpleApp()
     app.frame = ConsoleFrame(state=self, title=self.title)
     app.frame.Show()
     app.MainLoop()
Ejemplo n.º 10
0
 def child_task(self):
     '''child process - this holds all the GUI elements'''
     mp_util.child_close_fds()
     import wx, matplotlib
     matplotlib.use('WXAgg')
     app = wx.PySimpleApp()
     app.frame = GraphFrame(state=self)
     app.frame.Show()
     app.MainLoop()
Ejemplo n.º 11
0
    def createFileListHTTP(self):
        """Create a list of the available SRTM files on the server using
        HTTP file transfer protocol (rather than ftp).
        30may2010  GJ ORIGINAL VERSION
        """
        mp_util.child_close_fds()
        if self.debug:
            print(("Connecting to %s" % self.server, self.directory))
        try:
            data = self.getURIWithRedirect(self.directory)
        except Exception:
            return
        parser = parseHTMLDirectoryListing()
        parser.feed(data)
        continents = parser.getDirListing()
        if self.debug:
            print(('continents: ', continents))

        for continent in continents:
            if not continent[0].isalpha() or continent.startswith('README'):
                continue
            if self.debug:
                print(("Downloading file list for: ", continent))
            url = "%s%s" % (self.directory,continent)
            if self.debug:
                print(("fetching %s" % url))
            try:
                data = self.getURIWithRedirect(url)
            except Exception as ex:
                print(("Failed to download %s : %s" % (url, ex)))
                continue
            parser = parseHTMLDirectoryListing()
            parser.feed(data)
            files = parser.getDirListing()

            for filename in files:
                self.filelist[self.parseFilename(filename)] = (
                            continent, filename)

            '''print self.filelist'''
        # Add meta info
        self.filelist["server"] = self.server
        self.filelist["directory"] = self.directory
        tmpname = self.filelist_file + ".tmp"
        with open(tmpname , 'wb') as output:
            pickle.dump(self.filelist, output)
            output.close()
            try:
                os.unlink(self.filelist_file)
            except Exception:
                pass
            try:
                os.rename(tmpname, self.filelist_file)
            except Exception:
                pass
        if self.debug:
            print(("created file list with %u entries" % len(self.filelist)))
Ejemplo n.º 12
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()
Ejemplo n.º 13
0
 def child_task(self):
     '''child process - this holds all the GUI elements'''
     mp_util.child_close_fds()
     import wx, matplotlib
     matplotlib.use('WXAgg')
     app = wx.PySimpleApp()
     app.frame = GraphFrame(state=self)
     app.frame.Show()
     app.MainLoop()
    def child_task(self):
        '''child process - this holds all the GUI elements'''
        mp_util.child_close_fds()
        from wx_loader import wx

        app = wx.App(False)
        app.frame = ChecklistFrame(state=self, title=self.title)
        app.frame.Show()
        app.MainLoop()
Ejemplo n.º 15
0
    def child_task(self):
        """child process - this holds all the GUI elements"""
        mp_util.child_close_fds()
        from wx_loader import wx

        app = wx.App(False)
        app.frame = ChecklistFrame(state=self, title=self.title)
        app.frame.Show()
        app.MainLoop()
Ejemplo n.º 16
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()
Ejemplo n.º 17
0
    def createFileListHTTP(self):
        """Create a list of the available SRTM files on the server using
        HTTP file transfer protocol (rather than ftp).
        30may2010  GJ ORIGINAL VERSION
        """
        mp_util.child_close_fds()
        if self.debug:
            print ("Connecting to %s" % self.server, self.directory)
        try:
            data = self.getURIWithRedirect(self.directory)
        except Exception:
            return
        parser = parseHTMLDirectoryListing()
        parser.feed(data)
        continents = parser.getDirListing()
        if self.debug:
            print ("continents: ", continents)

        for continent in continents:
            if not continent[0].isalpha() or continent.startswith("README"):
                continue
            if self.debug:
                print ("Downloading file list for: ", continent)
            url = "%s%s" % (self.directory, continent)
            if self.debug:
                print ("fetching %s" % url)
            try:
                data = self.getURIWithRedirect(url)
            except Exception as ex:
                print ("Failed to download %s : %s" % (url, ex))
                continue
            parser = parseHTMLDirectoryListing()
            parser.feed(data)
            files = parser.getDirListing()

            for filename in files:
                self.filelist[self.parseFilename(filename)] = (continent, filename)

            """print self.filelist"""
        # Add meta info
        self.filelist["server"] = self.server
        self.filelist["directory"] = self.directory
        tmpname = self.filelist_file + ".tmp"
        with open(tmpname, "wb") as output:
            pickle.dump(self.filelist, output)
            output.close()
            try:
                os.unlink(self.filelist_file)
            except Exception:
                pass
            try:
                os.rename(tmpname, self.filelist_file)
            except Exception:
                pass
        if self.debug:
            print ("created file list with %u entries" % len(self.filelist))
Ejemplo n.º 18
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()
Ejemplo n.º 19
0
    def child_task(self):
        '''child process - this holds all the GUI elements'''
        mp_util.child_close_fds()
        import wx
        state = self

        self.app = wx.PySimpleApp()
        self.app.frame = MPImageFrame(state=self)
        self.app.frame.Show()
        self.app.MainLoop()
Ejemplo n.º 20
0
    def child_task(self):
        '''child process - this holds all the GUI elements'''
        mp_util.child_close_fds()
        from wx_loader import wx
        state = self

        self.app = wx.App(False)
        self.app.frame = MPImageFrame(state=self)
        self.app.frame.Show()
        self.app.MainLoop()
Ejemplo n.º 21
0
 def show(self):
     '''show the dialog as a child process'''
     mp_util.child_close_fds()
     from wx.lib.agw.genericmessagedialog import GenericMessageDialog
     app = wx.PySimpleApp()
     # 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()
Ejemplo n.º 22
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 MAVProxy.modules.mavproxy_magical.magical_ui import MagicalFrame

        app = wx.App(False)
        app.frame = MagicalFrame(self.child_pipe)
        app.frame.Show()
        app.MainLoop()
Ejemplo n.º 23
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()
Ejemplo n.º 24
0
 def show(self):
     '''show the dialog as a child process'''
     mp_util.child_close_fds()
     from wx.lib.agw.genericmessagedialog import GenericMessageDialog
     app = wx.PySimpleApp()
     # 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()
Ejemplo n.º 25
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()
Ejemplo n.º 26
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()
    def child_task(self):
        '''child process - this holds all the GUI elements'''
        from MAVProxy.modules.lib import mp_util
        import wx_processguard
        from wx_loader import wx
        from 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()
Ejemplo n.º 28
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()
Ejemplo n.º 29
0
    def child_task(self):
        '''child process - this holds all the GUI elements'''
        mp_util.child_close_fds()

        import matplotlib
        from . import wx_processguard
        from .wx_loader import wx
        from .live_graph_ui import GraphFrame

        matplotlib.use('WXAgg')
        app = wx.App(False)
        app.frame = GraphFrame(state=self)
        app.frame.Show()
        app.MainLoop()
Ejemplo n.º 30
0
    def child_task(self, q, l, gq, gl):
        '''child process - this holds GUI elements'''
        mp_util.child_close_fds()
        import wx
        self.app = wx.PySimpleApp()
        self.app.frame = missionEditorFrame.MissionEditorFrame(parent=None,id=wx.ID_ANY)

        self.app.frame.set_event_queue(q)
        self.app.frame.set_event_queue_lock(l)
        self.app.frame.set_gui_event_queue(gq)
        self.app.frame.set_gui_event_queue_lock(gl)

        self.app.frame.Show()
        self.app.MainLoop()
Ejemplo n.º 31
0
    def child_task(self):
        '''child process - this holds all the GUI elements'''
        mp_util.child_close_fds()
        
        import matplotlib
        import wx_processguard
        from wx_loader import wx
        from live_graph_ui import GraphFrame

        matplotlib.use('WXAgg')
        app = wx.App(False)
        app.frame = GraphFrame(state=self)
        app.frame.Show()
        app.MainLoop()
Ejemplo n.º 32
0
    def child_task(self, q, l, gq, gl):
        '''child process - this holds GUI elements'''
        mp_util.child_close_fds()
        import wx
        self.app = wx.PySimpleApp()
        self.app.frame = missionEditorFrame.MissionEditorFrame(parent=None,
                                                               id=wx.ID_ANY)

        self.app.frame.set_event_queue(q)
        self.app.frame.set_event_queue_lock(l)
        self.app.frame.set_gui_event_queue(gq)
        self.app.frame.set_gui_event_queue_lock(gl)

        self.app.frame.Show()
        self.app.MainLoop()
Ejemplo n.º 33
0
    def createFileListHTTP(self, server, directory):
        """Create a list of the available SRTM files on the server using
        HTTP file transfer protocol (rather than ftp).
        30may2010  GJ ORIGINAL VERSION
        """
        mp_util.child_close_fds()
        conn = httplib.HTTPConnection(server)
        conn.request("GET",directory)
        r1 = conn.getresponse()
        '''if r1.status==200:
            print "status200 received ok"
        else:
            print "oh no = status=%d %s" \
                  % (r1.status,r1.reason)'''

        data = r1.read()
        parser = parseHTMLDirectoryListing()
        parser.feed(data)
        continents = parser.getDirListing()
        '''print continents'''

        for continent in continents:
            '''print "Downloading file list for", continent'''
            conn.request("GET","%s/%s" % \
                         (self.directory,continent))
            r1 = conn.getresponse()
            '''if r1.status==200:
                print "status200 received ok"
            else:
                print "oh no = status=%d %s" \
                      % (r1.status,r1.reason)'''
            data = r1.read()
            parser = parseHTMLDirectoryListing()
            parser.feed(data)
            files = parser.getDirListing()

            for filename in files:
                self.filelist[self.parseFilename(filename)] = (
                            continent, filename)

            '''print self.filelist'''
        # Add meta info
        self.filelist["server"] = self.server
        self.filelist["directory"] = self.directory
        with open(self.filelist_file , 'wb') as output:
            pickle.dump(self.filelist, output)
Ejemplo n.º 34
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()
Ejemplo n.º 35
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()
Ejemplo n.º 36
0
    def createFileListHTTP(self, server, directory):
        """Create a list of the available SRTM files on the server using
        HTTP file transfer protocol (rather than ftp).
        30may2010  GJ ORIGINAL VERSION
        """
        mp_util.child_close_fds()
        conn = httplib.HTTPConnection(server)
        conn.request("GET", directory)
        r1 = conn.getresponse()
        '''if r1.status==200:
            print "status200 received ok"
        else:
            print "oh no = status=%d %s" \
                  % (r1.status,r1.reason)'''

        data = r1.read()
        parser = parseHTMLDirectoryListing()
        parser.feed(data)
        continents = parser.getDirListing()
        '''print continents'''

        for continent in continents:
            '''print "Downloading file list for", continent'''
            conn.request("GET","%s/%s" % \
                         (self.directory,continent))
            r1 = conn.getresponse()
            '''if r1.status==200:
                print "status200 received ok"
            else:
                print "oh no = status=%d %s" \
                      % (r1.status,r1.reason)'''
            data = r1.read()
            parser = parseHTMLDirectoryListing()
            parser.feed(data)
            files = parser.getDirListing()

            for filename in files:
                self.filelist[self.parseFilename(filename)] = (continent,
                                                               filename)
            '''print self.filelist'''
        # Add meta info
        self.filelist["server"] = self.server
        self.filelist["directory"] = self.directory
        with open(self.filelist_file, 'wb') as output:
            pickle.dump(self.filelist, output)
Ejemplo n.º 37
0
 def downloadTile(self, continent, filename):
     # Use HTTP
     mp_util.child_close_fds()
     if self.offline == 1:
         return
     filepath = "%s%s%s" % (self.directory, continent, filename)
     try:
         data = self.getURIWithRedirect(filepath)
         if data:
             self.ftpfile = open(os.path.join(self.cachedir, filename), "wb")
             self.ftpfile.write(data)
             self.ftpfile.close()
             self.ftpfile = None
     except Exception as e:
         if not self.first_failure:
             print ("SRTM Download failed %s on server %s" % (filepath, self.server))
             self.first_failure = True
         pass
Ejemplo n.º 38
0
    def child_task(self, q, l, gq, gl):
        '''child process - this holds GUI elements'''
        mp_util.child_close_fds()

        from ..lib import wx_processguard
        from ..lib.wx_loader import wx
        from MAVProxy.modules.mavproxy_misseditor import missionEditorFrame
        
        self.app = wx.App(False)
        self.app.frame = missionEditorFrame.MissionEditorFrame(parent=None,id=wx.ID_ANY)

        self.app.frame.set_event_queue(q)
        self.app.frame.set_event_queue_lock(l)
        self.app.frame.set_gui_event_queue(gq)
        self.app.frame.set_gui_event_queue_lock(gl)

        self.app.frame.Show()
        self.app.MainLoop()
Ejemplo n.º 39
0
 def downloadTile(self, continent, filename):
     #Use HTTP
     mp_util.child_close_fds()
     if self.offline == 1:
         return
     filepath = "%s%s%s" % \
                  (self.directory,continent,filename)
     try:
         data = self.getURIWithRedirect(filepath)
         if data:
             self.ftpfile = open(os.path.join(self.cachedir, filename), 'wb')
             self.ftpfile.write(data)
             self.ftpfile.close()
             self.ftpfile = None
     except Exception as e:
         if not self.first_failure:
             print(("SRTM Download failed %s on server %s" % (filepath, self.server)))
             self.first_failure = True
         pass
Ejemplo n.º 40
0
    def child_task(self):
        '''child process - this holds all the GUI elements'''
        mp_util.child_close_fds()
        import wx
        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.PySimpleApp()
        self.app.frame = MPSlipMapFrame(state=self)
        self.app.frame.Show()
        self.app.MainLoop()
Ejemplo n.º 41
0
    def child_task(self):
        '''child process - this holds all the GUI elements'''
        mp_util.child_close_fds()
        import wx
        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.PySimpleApp()
        self.app.frame = MPSlipMapFrame(state=self)
        self.app.frame.Show()
        self.app.MainLoop()
Ejemplo n.º 42
0
    def child_task(self, q, l, gq, gl):
        '''child process - this holds GUI elements'''
        mp_util.child_close_fds()

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

        self.app = wx.App(False)
        self.app.frame = missionEditorFrame.MissionEditorFrame(parent=None,
                                                               id=wx.ID_ANY)

        self.app.frame.set_event_queue(q)
        self.app.frame.set_event_queue_lock(l)
        self.app.frame.set_gui_event_queue(gq)
        self.app.frame.set_gui_event_queue_lock(gl)

        self.app.frame.Show()
        self.app.MainLoop()
Ejemplo n.º 43
0
    def child_task(self, q, l, gq, gl, cw_sem):
        '''child process - this holds GUI elements'''
        mp_util.child_close_fds()

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

        self.app = wx.App(False)
        self.app.frame = missionEditorFrame.MissionEditorFrame(self,
                                                               parent=None,
                                                               id=wx.ID_ANY)

        self.app.frame.set_event_queue(q)
        self.app.frame.set_event_queue_lock(l)
        self.app.frame.set_gui_event_queue(gq)
        self.app.frame.set_gui_event_queue_lock(gl)
        self.app.frame.set_close_window_semaphore(cw_sem)

        self.app.SetExitOnFrameDelete(True)
        self.app.frame.Show()

        # start a thread to monitor the "close window" semaphore:
        class CloseWindowSemaphoreWatcher(threading.Thread):
            def __init__(self, task, sem):
                threading.Thread.__init__(self)
                self.task = task
                self.sem = sem

            def run(self):
                self.sem.acquire(True)
                self.task.app.ExitMainLoop()

        watcher_thread = CloseWindowSemaphoreWatcher(self, cw_sem)
        watcher_thread.start()

        self.app.MainLoop()
        # tell the watcher it is OK to quit:
        cw_sem.release()
        watcher_thread.join()
Ejemplo n.º 44
0
    def createFileListHTTP(self):
        """Create a list of the available SRTM files on the server using
        HTTP file transfer protocol (rather than ftp).
        30may2010  GJ ORIGINAL VERSION
        """
        mp_util.child_close_fds()
        if self.debug:
            print("Connecting to %s" % self.server)
        #conn = http.client.HTTPConnection(self.server)
        #conn.request("GET",self.directory)
        #r1 = conn.getresponse()
        '''if r1.status==200:
            print "status200 received ok"
        else:
            print "oh no = status=%d %s" \
                  % (r1.status,r1.reason)'''

        #data = r1.read()
        #parser = parseHTMLDirectoryListing()
        #parser.feed(str(data))
        #continents = parser.getDirListing()
        '''print continents'''
Ejemplo n.º 45
0
    def createFileListHTTP(self):
        """Create a list of the available SRTM files on the server using
        HTTP file transfer protocol (rather than ftp).
        30may2010  GJ ORIGINAL VERSION
        """
        mp_util.child_close_fds()
        if self.debug:
            print("Connecting to %s" % self.server)
        #conn = http.client.HTTPConnection(self.server)
        #conn.request("GET",self.directory)
        #r1 = conn.getresponse()
        '''if r1.status==200:
            print "status200 received ok"
        else:
            print "oh no = status=%d %s" \
                  % (r1.status,r1.reason)'''

        #data = r1.read()
        #parser = parseHTMLDirectoryListing()
        #parser.feed(str(data))
        #continents = parser.getDirListing()
        '''print continents'''
Ejemplo n.º 46
0
    def child_task(self, q, l, gq, gl, cw_sem):
        '''child process - this holds GUI elements'''
        mp_util.child_close_fds()

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

        self.app = wx.App(False)
        self.app.frame = missionEditorFrame.MissionEditorFrame(parent=None,id=wx.ID_ANY)

        self.app.frame.set_event_queue(q)
        self.app.frame.set_event_queue_lock(l)
        self.app.frame.set_gui_event_queue(gq)
        self.app.frame.set_gui_event_queue_lock(gl)
        self.app.frame.set_close_window_semaphore(cw_sem)

        self.app.SetExitOnFrameDelete(True)
        self.app.frame.Show()

        # start a thread to monitor the "close window" semaphore:
        class CloseWindowSemaphoreWatcher(threading.Thread):
            def __init__(self, task, sem):
                threading.Thread.__init__(self)
                self.task = task
                self.sem = sem
            def run(self):
                self.sem.acquire(True)
                self.task.app.ExitMainLoop()
        watcher_thread = CloseWindowSemaphoreWatcher(self, cw_sem)
        watcher_thread.start()

        self.app.MainLoop()
        # tell the watcher it is OK to quit:
        cw_sem.release()
        watcher_thread.join()
Ejemplo n.º 47
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.MainLoop()
Ejemplo n.º 48
0
    def createFileListHTTP(self):
        """Create a list of the available SRTM files on the server using
        HTTP file transfer protocol (rather than ftp).
        30may2010  GJ ORIGINAL VERSION
        """
        mp_util.child_close_fds()
        if self.debug:
            print("Connecting to %s" % self.server)
        try:
            conn = httplib.HTTPConnection(self.server)
            conn.request("GET",self.directory)
        except Exception:
            return
        r1 = conn.getresponse()
        '''if r1.status==200:
            print "status200 received ok"
        else:
            print "oh no = status=%d %s" \
                  % (r1.status,r1.reason)'''

        data = r1.read()
        parser = parseHTMLDirectoryListing()
        parser.feed(data)
        continents = parser.getDirListing()
        '''print continents'''
        conn.close()

        for continent in continents:
            if not continent[0].isalpha() or continent.startswith('README'):
                continue
            '''print "Downloading file list for", continent'''
            url = "%s%s" % (self.directory,continent)
            if self.debug:
                print("fetching %s" % url)
            try:
                conn = httplib.HTTPConnection(self.server)
                conn.request("GET", url)
                r1 = conn.getresponse()
            except Exception as ex:
                print("Failed to download %s : %s" % (url, ex))
                continue
            '''if r1.status==200:
                print "status200 received ok"
            else:
                print "oh no = status=%d %s" \
                      % (r1.status,r1.reason)'''
            data = r1.read()
            conn.close()
            parser = parseHTMLDirectoryListing()
            parser.feed(data)
            files = parser.getDirListing()

            for filename in files:
                self.filelist[self.parseFilename(filename)] = (
                            continent, filename)

            '''print self.filelist'''
        # Add meta info
        self.filelist["server"] = self.server
        self.filelist["directory"] = self.directory
        tmpname = self.filelist_file + ".tmp"
        with open(tmpname , 'wb') as output:
            pickle.dump(self.filelist, output)
            output.close()
            try:
                os.unlink(self.filelist_file)
            except Exception:
                pass
            os.rename(tmpname, self.filelist_file)
        if self.debug:
            print("created file list with %u entries" % len(self.filelist))