From f2e0ffc05d6ca763265791cf7832f6767e44ebe1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Fri, 1 Oct 2021 19:08:36 +0200 Subject: [PATCH] rename edit file, add some comments --- scripts/lectures.py | 2 +- scripts/notes.py | 2 +- scripts/rofi.py | 7 +++++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/scripts/lectures.py b/scripts/lectures.py index 2fe4828..b10284e 100644 --- a/scripts/lectures.py +++ b/scripts/lectures.py @@ -7,7 +7,7 @@ from datetime import datetime from config import DATE_FORMAT, LOCALE, DEFAULT_NEW_LECTURE_HEADER, DEFAULT_LECTURE_SEARCH_REGEX, \ DEFAULT_NEW_LECTURE_TITLE -from edit import edit +from window_subprocess import edit from utils import get_week # TODO diff --git a/scripts/notes.py b/scripts/notes.py index c27e956..d43e181 100644 --- a/scripts/notes.py +++ b/scripts/notes.py @@ -6,7 +6,7 @@ from typing import Dict from config import LECTURE_START_MARKER, LECTURE_END_MARKER, DEFAULT_IMPORT_INDENTATION, \ DEFAULT_LATEX_COUNTER_AUX_FILE_EXTENSION -from edit import edit +from window_subprocess import edit from lectures import Lectures, number2filename from parse_counters import parse_counters, dict2setcounters diff --git a/scripts/rofi.py b/scripts/rofi.py index 87c3a4b..cc0d2ac 100644 --- a/scripts/rofi.py +++ b/scripts/rofi.py @@ -20,11 +20,18 @@ def rofi(prompt, options, rofi_args=[], fuzzy=True): except ValueError: index = -1 + # We handle the return code from rofi here: + # 0 of course means successful, we pass this on + # 1 means that the user exited the prompt without specifying an option + # returns codes >=10 are custom return codes specified with '-kb-custom- ' options + # that are passed to rofi. We subtract 9 from them to pass '' to the caller if returncode == 0: key = 0 elif returncode == 1: key = -1 elif returncode > 9: key = returncode - 9 + else: # This case should never be reached + key = -2 return key, index, selected