Обоснование ПП-127: висячий отступ — перенесённые строки «Показатель N. …» и текст расчёта с отступом, между показателями пустая строка (продолжение больше не выглядит отдельным пунктом)
This commit is contained in:
+20
-25
@@ -2439,23 +2439,15 @@ class DokoGenApp:
|
|||||||
if target:
|
if target:
|
||||||
var.set(target)
|
var.set(target)
|
||||||
prefix = f"Показатель {num}. {name} — {cat} категория."
|
prefix = f"Показатель {num}. {name} — {cat} категория."
|
||||||
full = prefix + "\n" + txt
|
|
||||||
cur = justify_txt.get('1.0', 'end-1c').strip()
|
cur = justify_txt.get('1.0', 'end-1c').strip()
|
||||||
if prefix not in cur:
|
if prefix not in cur:
|
||||||
if cur:
|
_append_justify(prefix, txt)
|
||||||
justify_txt.insert('end', '\n' + full)
|
|
||||||
else:
|
|
||||||
justify_txt.insert('1.0', full)
|
|
||||||
else:
|
else:
|
||||||
var.set('—')
|
var.set('—')
|
||||||
prefix = f"Показатель {num}. {name} — применим, категория не присвоена (—)."
|
prefix = f"Показатель {num}. {name} — применим, категория не присвоена (—)."
|
||||||
full = prefix + "\n" + txt
|
|
||||||
cur = justify_txt.get('1.0', 'end-1c').strip()
|
cur = justify_txt.get('1.0', 'end-1c').strip()
|
||||||
if prefix not in cur:
|
if prefix not in cur:
|
||||||
if cur:
|
_append_justify(prefix, txt)
|
||||||
justify_txt.insert('end', '\n' + full)
|
|
||||||
else:
|
|
||||||
justify_txt.insert('1.0', full)
|
|
||||||
w.grab_release()
|
w.grab_release()
|
||||||
w.destroy()
|
w.destroy()
|
||||||
|
|
||||||
@@ -2526,13 +2518,9 @@ class DokoGenApp:
|
|||||||
txt = _just_text(_num)
|
txt = _just_text(_num)
|
||||||
prefix = f"Показатель {_num}. {_name} — не применим."
|
prefix = f"Показатель {_num}. {_name} — не применим."
|
||||||
if txt:
|
if txt:
|
||||||
full = prefix + " " + txt
|
|
||||||
cur = justify_txt.get('1.0', 'end-1c').strip()
|
cur = justify_txt.get('1.0', 'end-1c').strip()
|
||||||
if prefix not in cur:
|
if prefix not in cur:
|
||||||
if cur:
|
_append_justify(prefix, txt)
|
||||||
justify_txt.insert('end', '\n' + full)
|
|
||||||
else:
|
|
||||||
justify_txt.insert('1.0', full)
|
|
||||||
combo.bind('<<ComboboxSelected>>', _on_pick)
|
combo.bind('<<ComboboxSelected>>', _on_pick)
|
||||||
|
|
||||||
if not applicable_here:
|
if not applicable_here:
|
||||||
@@ -2562,6 +2550,21 @@ class DokoGenApp:
|
|||||||
anchor=tk.W, pady=(10, 2))
|
anchor=tk.W, pady=(10, 2))
|
||||||
justify_txt = tk.Text(body, width=110, height=5, wrap=tk.WORD)
|
justify_txt = tk.Text(body, width=110, height=5, wrap=tk.WORD)
|
||||||
justify_txt.pack(fill=tk.X, pady=(0, 6))
|
justify_txt.pack(fill=tk.X, pady=(0, 6))
|
||||||
|
# Висячий отступ: заголовок «Показатель N. …» — первая строка без отступа,
|
||||||
|
# перенесённые строки — с отступом (чтобы продолжение не выглядело новым пунктом);
|
||||||
|
# тело расчёта — с отступом слева; между показателями — пустая строка.
|
||||||
|
justify_txt.tag_configure('just_head', lmargin1=0, lmargin2=30, spacing1=6, spacing3=2)
|
||||||
|
justify_txt.tag_configure('just_body', lmargin1=30, lmargin2=30, spacing3=4)
|
||||||
|
|
||||||
|
def _append_justify(prefix, body):
|
||||||
|
"""Добавить запись в обоснование: заголовок с висячим отступом + тело."""
|
||||||
|
cur = justify_txt.get('1.0', 'end-1c').strip()
|
||||||
|
if cur:
|
||||||
|
justify_txt.insert('end', '\n\n')
|
||||||
|
justify_txt.insert('end', str(prefix), 'just_head')
|
||||||
|
if body:
|
||||||
|
justify_txt.insert('end', '\n' + str(body), 'just_body')
|
||||||
|
|
||||||
if hasattr(self, 'is_criteria_justification_listbox') and self.is_criteria_justification_listbox.size():
|
if hasattr(self, 'is_criteria_justification_listbox') and self.is_criteria_justification_listbox.size():
|
||||||
justify_txt.insert('1.0', '\n'.join(
|
justify_txt.insert('1.0', '\n'.join(
|
||||||
self.is_criteria_justification_listbox.get(i)
|
self.is_criteria_justification_listbox.get(i)
|
||||||
@@ -2719,13 +2722,9 @@ class DokoGenApp:
|
|||||||
'указанных в п. 8 перечня показателей критериев '
|
'указанных в п. 8 перечня показателей критериев '
|
||||||
'значимости объектов КИИ.')
|
'значимости объектов КИИ.')
|
||||||
prefix = f"Показатель {num}. {name} — не применим."
|
prefix = f"Показатель {num}. {name} — не применим."
|
||||||
full = prefix + " " + txt
|
|
||||||
cur = justify_txt.get('1.0', 'end-1c').strip()
|
cur = justify_txt.get('1.0', 'end-1c').strip()
|
||||||
if prefix not in cur:
|
if prefix not in cur:
|
||||||
if cur:
|
_append_justify(prefix, txt)
|
||||||
justify_txt.insert('end', '\n' + full)
|
|
||||||
else:
|
|
||||||
justify_txt.insert('1.0', full)
|
|
||||||
filled.append(f"п. {num}: не применим (тип организации)")
|
filled.append(f"п. {num}: не применим (тип организации)")
|
||||||
elif g == '9':
|
elif g == '9':
|
||||||
profit = _num2(getattr(self.model, 'profit', '') or '')
|
profit = _num2(getattr(self.model, 'profit', '') or '')
|
||||||
@@ -2785,13 +2784,9 @@ class DokoGenApp:
|
|||||||
f"Категория значимости: {cat or '— (не присваивается)'}"
|
f"Категория значимости: {cat or '— (не присваивается)'}"
|
||||||
)
|
)
|
||||||
prefix = f"Показатель {num}. {name} — рекомендация по расчёту:"
|
prefix = f"Показатель {num}. {name} — рекомендация по расчёту:"
|
||||||
full = prefix + "\n" + calc_txt
|
|
||||||
cur = justify_txt.get('1.0', 'end-1c').strip()
|
cur = justify_txt.get('1.0', 'end-1c').strip()
|
||||||
if prefix not in cur:
|
if prefix not in cur:
|
||||||
if cur:
|
_append_justify(prefix, calc_txt)
|
||||||
justify_txt.insert('end', '\n' + full)
|
|
||||||
else:
|
|
||||||
justify_txt.insert('1.0', full)
|
|
||||||
filled.append(f"п. {num}: №9 = {val:.6f}% → {cat or '—'}")
|
filled.append(f"п. {num}: №9 = {val:.6f}% → {cat or '—'}")
|
||||||
# Что осталось незаполненным (применимые, без значения)
|
# Что осталось незаполненным (применимые, без значения)
|
||||||
left = []
|
left = []
|
||||||
|
|||||||
Reference in New Issue
Block a user