Skip to content

Commit f21ce50

Browse files
improve recents usability by key F12
1 parent b7952a2 commit f21ce50

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

menu_recents.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,8 @@ def __init__(self, win, menu_master, dict_config):
151151

152152
def clear_and_desactive(self):
153153
"""fast force to forget historial, by user key-accelerator"""
154-
self._varNoRememberRecents.set(True);
154+
newState = not self._varNoRememberRecents.get();
155+
self._varNoRememberRecents.set(newState);
155156
self._cheeck_remember();
156157

157158
def _showMsgInfo(self):
@@ -205,7 +206,7 @@ def _open_recentfilename(self, f):
205206
" it is tester, will be replace on main by Inheritance "
206207
print("open test", f);
207208

208-
def _clear_menu_history(self):
209+
def clear_menu_history(self):
209210
""" clear the menu recents """
210211
end = self.menuRecents.index("end");
211212
if end < self.iExtraRecents+1:
@@ -218,7 +219,7 @@ def _cheeck_remember(self):
218219
clearHistory = self._varNoRememberRecents.get();
219220

220221
if clearHistory:
221-
self._clear_menu_history();
222+
self.clear_menu_history();
222223
GlobalRecents.clear();
223224

224225
#is a new value ? cheeck if need save on file
@@ -227,11 +228,12 @@ def _cheeck_remember(self):
227228
self.config.save();
228229

229230
if clearHistory:
230-
self.setLabelStateAction("Recents [OFF][Cleared]", 3);
231+
self.setLabelStateAction("Recents [OFF][Cleared]", 8);
231232
else:
232-
self.setLabelStateAction("Recents [ON]", 3);
233+
self.setLabelStateAction("Recents [ON]", 8);
233234

234235
def setLabelStateAction(self, label, seconds):
236+
""" method tester, it is replaced from main """
235237
print("test", label, seconds, "seconds");
236238

237239

@@ -262,7 +264,7 @@ def setLabelStateAction(self, label, seconds):
262264
recents = MenuRecentFiles(root, menuTest, cnf);
263265

264266
entryRecent = Entry(root);
265-
entryRecent.insert(0, "Testfilename.edex");
267+
entryRecent.insert(0, "Testfilename.ltxt");
266268
entryRecent.pack(side="top", pady=10);
267269

268270
def test():

0 commit comments

Comments
 (0)