예제 #1
0
    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)
예제 #2
0
 def add_legend_checkbox_menuitem(self):
     self.menu.add_to_submenu(['View'], [
         MPMenuCheckbox('Legend\tCtrl+L',
                        'Enable Legend',
                        'toggleLegend',
                        checked=self.state.legend)
     ])