rename edit file, add some comments

This commit is contained in:
Maximilian Keßler 2021-10-01 19:08:36 +02:00
parent 8d5af2f340
commit f2e0ffc05d
3 changed files with 9 additions and 2 deletions

View file

@ -7,7 +7,7 @@ from datetime import datetime
from config import DATE_FORMAT, LOCALE, DEFAULT_NEW_LECTURE_HEADER, DEFAULT_LECTURE_SEARCH_REGEX, \ from config import DATE_FORMAT, LOCALE, DEFAULT_NEW_LECTURE_HEADER, DEFAULT_LECTURE_SEARCH_REGEX, \
DEFAULT_NEW_LECTURE_TITLE DEFAULT_NEW_LECTURE_TITLE
from edit import edit from window_subprocess import edit
from utils import get_week from utils import get_week
# TODO # TODO

View file

@ -6,7 +6,7 @@ from typing import Dict
from config import LECTURE_START_MARKER, LECTURE_END_MARKER, DEFAULT_IMPORT_INDENTATION, \ from config import LECTURE_START_MARKER, LECTURE_END_MARKER, DEFAULT_IMPORT_INDENTATION, \
DEFAULT_LATEX_COUNTER_AUX_FILE_EXTENSION DEFAULT_LATEX_COUNTER_AUX_FILE_EXTENSION
from edit import edit from window_subprocess import edit
from lectures import Lectures, number2filename from lectures import Lectures, number2filename
from parse_counters import parse_counters, dict2setcounters from parse_counters import parse_counters, dict2setcounters

View file

@ -20,11 +20,18 @@ def rofi(prompt, options, rofi_args=[], fuzzy=True):
except ValueError: except ValueError:
index = -1 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-<n> <keybind>' options
# that are passed to rofi. We subtract 9 from them to pass '<n>' to the caller
if returncode == 0: if returncode == 0:
key = 0 key = 0
elif returncode == 1: elif returncode == 1:
key = -1 key = -1
elif returncode > 9: elif returncode > 9:
key = returncode - 9 key = returncode - 9
else: # This case should never be reached
key = -2
return key, index, selected return key, index, selected