806 def _menu_open(self, event):
807 formats = [_('Chirp Image Files') + ' (*.img)|*.img',
808 _('All Files') + ' (*.*)|*.*']
809 for name, pattern, readonly in directory.AUX_FORMATS:
810 formats.insert(1, '%s %s (%s)|%s' % (
811 name, _('Files'), pattern, pattern))
812
813 wildcard = '|'.join(formats)
814 with wx.FileDialog(self, _('Open a file'),
815 chirp_platform.get_platform().get_last_dir(),
816 wildcard=wildcard,
817 style=wx.FD_OPEN | wx.FD_FILE_MUST_EXIST) as fd:
818 if fd.ShowModal() == wx.ID_CANCEL:
819 return
820 filename = fd.GetPath()
821 d = fd.GetDirectory()
822 chirp_platform.get_platform().set_last_dir(d)
823 CONF.set('last_dir', d, 'state')
824 config._CONFIG.save()
825 self.open_file(str(filename))