From 09c24917a7f6192f0f31b7a950ad26c13573d085 Mon Sep 17 00:00:00 2001 From: Matthias Andree Date: Wed, 21 Aug 2019 01:30:00 +0200 Subject: fetchmailconf: Permit editing the first item from a list, and more updates. * Remove a bogus check that would prevent editing the first items from list boxes. * Require Python 2.3. * Convert apply() call to function(*(tuple,)) syntax * string.atoi() -> int() on select[0], to continue where it's not a string --- NEWS | 2 ++ fetchmailconf.py | 23 ++++++++++++++--------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/NEWS b/NEWS index 79ce5b19..5080e773 100644 --- a/NEWS +++ b/NEWS @@ -169,6 +169,8 @@ fetchmail-6.4.0 (not yet released): of known mail. (Fix contributed by Lauri Nurmi, GitLab Merge Request !10.) * fetchmail no longer reports "System error during SSL_connect(): Success." Fixes Debian Bug#928916, reported by Paul Kimoto. +* fetchmailconf would ignore Edit or Delete actions on the first (topmost) + item in a list (no matter if server list, user list, ...). ## UPDATED TRANSLATIONS - THANKS TO: * CS: Petr Pisar [Czech] diff --git a/fetchmailconf.py b/fetchmailconf.py index 1c780d4b..063e6f3d 100755 --- a/fetchmailconf.py +++ b/fetchmailconf.py @@ -11,12 +11,17 @@ # WARNING: to be compatible with Python 3, needs to be run thru 2to3.py. from __future__ import print_function -version = "1.58" +version = "1.59" + +import sys + +MIN_PY = (2,3) +if sys.version_info < MIN_PY: + sys.exit("fetchmailconf: Python %s.%s or later is required.\n" % MIN_PY); from Tkinter import * from Dialog import * - -import sys, time, os, string, socket, getopt, tempfile +import time, os, string, socket, getopt, tempfile # # Define the data structures the GUIs will be tossing around @@ -598,7 +603,7 @@ class ListEdit(Frame): self.listwidget.insert('end', item) if self.list != None: self.list.append(item) if self.editor: - apply(self.editor, (item,)) + self.editor(*(item,)) self.newval.set('') def editItem(self): @@ -606,24 +611,24 @@ class ListEdit(Frame): if not select: helpwin(listboxhelp) else: - index = select[0] - if index and self.editor: + index = int(select[0]) + if self.editor: label = self.listwidget.get(index); if self.editor: - apply(self.editor, (label,)) + self.editor(*(label,)) def deleteItem(self): select = self.listwidget.curselection() if not select: helpwin(listboxhelp) else: - index = string.atoi(select[0]) + index = int(select[0]) label = self.listwidget.get(index); self.listwidget.delete(index) if self.list != None: del self.list[index] if self.deletor != None: - apply(self.deletor, (label,)) + self.deletor(*(label,)) def ConfirmQuit(frame, context): ans = Dialog(frame, -- cgit v1.2.3