From f791b2d3ea7b9f6315acbd818930d1f5d7346438 Mon Sep 17 00:00:00 2001 From: Richard Heck Date: Thu, 26 Nov 2015 22:40:39 -0500 Subject: [PATCH] Remove "dialog-show print" from various UI locations. --- lib/scripts/prefs2prefs.py | 22 ++++++++++------------ lib/scripts/prefs2prefs_lfuns.py | 19 +++++++++++++++---- src/LyXAction.h | 2 +- 3 files changed, 26 insertions(+), 17 deletions(-) diff --git a/lib/scripts/prefs2prefs.py b/lib/scripts/prefs2prefs.py index f98b6e833e..132e21a52d 100644 --- a/lib/scripts/prefs2prefs.py +++ b/lib/scripts/prefs2prefs.py @@ -111,6 +111,10 @@ def update_format(lines): lines[format_line] = "Format " + str(format + 1) +def abort(msg): + sys.stderr.write("\n%s\n" % (msg)) + sys.exit(10) + # ########################################################### @@ -127,8 +131,7 @@ def main(argv): (options, args) = getopt(sys.argv[1:], "lp") except: usage() - print "\nUnrecognized option" - sys.exit(1) + abort("Unrecognized option") opened_files = False # Open files @@ -141,8 +144,7 @@ def main(argv): opened_files = True else: usage() - print "\nEither zero or two arguments must be given." - sys.exit(1) + abort("Either zero or two arguments must be given.") conversions = False @@ -154,12 +156,10 @@ def main(argv): if not conversions: usage() - print "\nNeither -l nor -p given." - sys.exit(1) + abort("Neither -l nor -p given.") elif len(options) > 1: usage() - print "\nOnly one of -l or -p should be given." - sys.exit(1) + abort("Only one of -l or -p should be given.") current_format = len(conversions) lines = read(source) @@ -171,8 +171,7 @@ def main(argv): # make sure the conversion list is sequential if int(old_format) + 1 != target_format: - sys.stderr.write("Something is wrong with the conversion chain.\n") - sys.exit(1) + abort("Something is wrong with the conversion chain.") for c in convert: for i in range(len(lines)): @@ -185,8 +184,7 @@ def main(argv): # sanity check if int(old_format) + 1 != int(format): - sys.stderr.write("Failed to convert to new format!\n") - sys.exit(1) + abort("Failed to convert to new format!") write(output, lines) diff --git a/lib/scripts/prefs2prefs_lfuns.py b/lib/scripts/prefs2prefs_lfuns.py index 78d85141f1..99f75c36eb 100644 --- a/lib/scripts/prefs2prefs_lfuns.py +++ b/lib/scripts/prefs2prefs_lfuns.py @@ -26,9 +26,9 @@ import sys, re # These accept a line as argument and should return a list: # (bool, newline) # where the bool indicates whether we changed anything. If not, -# one normally returns: (False, []). +# one normally returns: (False, ""). -no_match = (False, []) +no_match = (False, "") def simple_renaming(line, old, new): if line.find(old) == -1: @@ -37,6 +37,12 @@ def simple_renaming(line, old, new): return (True, line) +def simple_remove(line, old): + if line.find(old) == -1: + return no_match + return (True, "") + + def next_inset_modify(line): return simple_renaming(line, "next-inset-modify", "inset-modify") @@ -162,7 +168,10 @@ def view_split(line): def label_copy_as_reference(line): return simple_renaming(line, "copy-label-as-reference", "label-copy-as-reference") -# + +def remove_print_support(line): + return simple_remove(line, "dialog-show print") + # ########################################################### @@ -188,5 +197,7 @@ conversions = [ view_split, label_copy_as_reference ]], + [ 3, [ # list of conversions to format 3, LyX 2.2 + remove_print_support + ]] ] - diff --git a/src/LyXAction.h b/src/LyXAction.h index 77cc5b084c..d0a7942646 100644 --- a/src/LyXAction.h +++ b/src/LyXAction.h @@ -22,7 +22,7 @@ namespace lyx { // current LFUN format -static unsigned int const LFUN_FORMAT = 2; +static unsigned int const LFUN_FORMAT = 3; class FuncRequest; class LyXErr;