From 07bf25ebc30a6a0df7f3d26cf01d792071f35873 Mon Sep 17 00:00:00 2001 From: LocoAgent Date: Wed, 5 Aug 2026 14:26:51 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=B1=D0=BE=D1=81=D0=BD=D0=BE=D0=B2?= =?UTF-8?q?=D0=B0=D0=BD=D0=B8=D0=B5=20=D0=9F=D0=9F-127:=20=D0=B2=D0=B8?= =?UTF-8?q?=D1=81=D1=8F=D1=87=D0=B8=D0=B9=20=D0=BE=D1=82=D1=81=D1=82=D1=83?= =?UTF-8?q?=D0=BF=20=E2=80=94=20=D0=BF=D0=B5=D1=80=D0=B5=D0=BD=D0=B5=D1=81?= =?UTF-8?q?=D1=91=D0=BD=D0=BD=D1=8B=D0=B5=20=D1=81=D1=82=D1=80=D0=BE=D0=BA?= =?UTF-8?q?=D0=B8=20=C2=AB=D0=9F=D0=BE=D0=BA=D0=B0=D0=B7=D0=B0=D1=82=D0=B5?= =?UTF-8?q?=D0=BB=D1=8C=20N.=20=E2=80=A6=C2=BB=20=D0=B8=20=D1=82=D0=B5?= =?UTF-8?q?=D0=BA=D1=81=D1=82=20=D1=80=D0=B0=D1=81=D1=87=D1=91=D1=82=D0=B0?= =?UTF-8?q?=20=D1=81=20=D0=BE=D1=82=D1=81=D1=82=D1=83=D0=BF=D0=BE=D0=BC,?= =?UTF-8?q?=20=D0=BC=D0=B5=D0=B6=D0=B4=D1=83=20=D0=BF=D0=BE=D0=BA=D0=B0?= =?UTF-8?q?=D0=B7=D0=B0=D1=82=D0=B5=D0=BB=D1=8F=D0=BC=D0=B8=20=D0=BF=D1=83?= =?UTF-8?q?=D1=81=D1=82=D0=B0=D1=8F=20=D1=81=D1=82=D1=80=D0=BE=D0=BA=D0=B0?= =?UTF-8?q?=20(=D0=BF=D1=80=D0=BE=D0=B4=D0=BE=D0=BB=D0=B6=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D0=B1=D0=BE=D0=BB=D1=8C=D1=88=D0=B5=20=D0=BD?= =?UTF-8?q?=D0=B5=20=D0=B2=D1=8B=D0=B3=D0=BB=D1=8F=D0=B4=D0=B8=D1=82=20?= =?UTF-8?q?=D0=BE=D1=82=D0=B4=D0=B5=D0=BB=D1=8C=D0=BD=D1=8B=D0=BC=20=D0=BF?= =?UTF-8?q?=D1=83=D0=BD=D0=BA=D1=82=D0=BE=D0=BC)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dokogen/ui.py | 45 ++++++++++++++++++++------------------------- 1 file changed, 20 insertions(+), 25 deletions(-) diff --git a/dokogen/ui.py b/dokogen/ui.py index 6996260..7771309 100644 --- a/dokogen/ui.py +++ b/dokogen/ui.py @@ -2439,23 +2439,15 @@ class DokoGenApp: if target: var.set(target) prefix = f"Показатель {num}. {name} — {cat} категория." - full = prefix + "\n" + txt cur = justify_txt.get('1.0', 'end-1c').strip() if prefix not in cur: - if cur: - justify_txt.insert('end', '\n' + full) - else: - justify_txt.insert('1.0', full) + _append_justify(prefix, txt) else: var.set('—') prefix = f"Показатель {num}. {name} — применим, категория не присвоена (—)." - full = prefix + "\n" + txt cur = justify_txt.get('1.0', 'end-1c').strip() if prefix not in cur: - if cur: - justify_txt.insert('end', '\n' + full) - else: - justify_txt.insert('1.0', full) + _append_justify(prefix, txt) w.grab_release() w.destroy() @@ -2526,13 +2518,9 @@ class DokoGenApp: txt = _just_text(_num) prefix = f"Показатель {_num}. {_name} — не применим." if txt: - full = prefix + " " + txt cur = justify_txt.get('1.0', 'end-1c').strip() if prefix not in cur: - if cur: - justify_txt.insert('end', '\n' + full) - else: - justify_txt.insert('1.0', full) + _append_justify(prefix, txt) combo.bind('<>', _on_pick) if not applicable_here: @@ -2562,6 +2550,21 @@ class DokoGenApp: anchor=tk.W, pady=(10, 2)) justify_txt = tk.Text(body, width=110, height=5, wrap=tk.WORD) 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(): justify_txt.insert('1.0', '\n'.join( self.is_criteria_justification_listbox.get(i) @@ -2719,13 +2722,9 @@ class DokoGenApp: 'указанных в п. 8 перечня показателей критериев ' 'значимости объектов КИИ.') prefix = f"Показатель {num}. {name} — не применим." - full = prefix + " " + txt cur = justify_txt.get('1.0', 'end-1c').strip() if prefix not in cur: - if cur: - justify_txt.insert('end', '\n' + full) - else: - justify_txt.insert('1.0', full) + _append_justify(prefix, txt) filled.append(f"п. {num}: не применим (тип организации)") elif g == '9': profit = _num2(getattr(self.model, 'profit', '') or '') @@ -2785,13 +2784,9 @@ class DokoGenApp: f"Категория значимости: {cat or '— (не присваивается)'}" ) prefix = f"Показатель {num}. {name} — рекомендация по расчёту:" - full = prefix + "\n" + calc_txt cur = justify_txt.get('1.0', 'end-1c').strip() if prefix not in cur: - if cur: - justify_txt.insert('end', '\n' + full) - else: - justify_txt.insert('1.0', full) + _append_justify(prefix, calc_txt) filled.append(f"п. {num}: №9 = {val:.6f}% → {cat or '—'}") # Что осталось незаполненным (применимые, без значения) left = []