# HG changeset patch # User Joseph.P.Scanlan@n7xsd.us # Date 1632697003 25200 # Sun Sep 26 15:56:43 2021 -0700 # Branch py3 # Node ID 587f8b0d752f180bb0991c702bc921224e800bd2 # Parent 767a2b7ea346019d66869b61caafab5fe666b932 [wxui] Make "Open" in "File" menu work with last_dir in chirp.config PY3 #9379
diff -r 767a2b7ea346 -r 587f8b0d752f chirp/wxui/main.py --- a/chirp/wxui/main.py Tue Sep 14 13:50:11 2021 -0700 +++ b/chirp/wxui/main.py Sun Sep 26 15:56:43 2021 -0700 @@ -9,6 +9,7 @@ import wx.lib.newevent
from chirp import directory +from chirp import platform from chirp.ui import config from chirp.wxui import common from chirp.wxui import clone @@ -142,6 +143,10 @@ self.SetSize(int(CONF.get('window_w', 'state') or 1024), int(CONF.get('window_h', 'state') or 768))
+ d = CONF.get('last_dir', 'state') + if d and os.path.isdir(d): + platform.get_platform().set_last_dir(d) + self.SetMenuBar(self.make_menubar())
# Stock items look good on linux, terrible on others, @@ -433,11 +438,17 @@ wildcard = '|'.join(['Chirp Image Files (*.img)|*.img', 'CSV Files (*.csv)|*.csv', 'All Files (*.*)|*.*']) - with wx.FileDialog(self, 'Open a file', wildcard=wildcard, + with wx.FileDialog(self, 'Open a file', + platform.get_platform().get_last_dir(), + wildcard=wildcard, style=wx.FD_OPEN | wx.FD_FILE_MUST_EXIST) as fd: if fd.ShowModal() == wx.ID_CANCEL: return filename = fd.GetPath() + d = fd.GetDirectory() + platform.get_platform().set_last_dir(d) + CONF.set('last_dir', d, 'state') + config._CONFIG.save() self.open_file(str(filename))
def _menu_open_recent(self, event):