mirror of
https://github.com/LorenEteval/Furious.git
synced 2026-09-26 16:58:17 +03:00
Retain asynchronous dialogs only while visible, use receiver-aware weak signal dispatch for transient editors, and release registries on native destruction. Add native and packaged lifetime probes that distinguish live-wrapper growth from unavailable binding diagnostics. Signed-off-by: Loren Eteval <loren.eteval@proton.me>
66 lines
2.1 KiB
Python
66 lines
2.1 KiB
Python
# Copyright (C) 2024–present Loren Eteval & contributors <loren.eteval@proton.me>
|
||
#
|
||
# This file is part of Furious.
|
||
#
|
||
# This program is free software: you can redistribute it and/or modify
|
||
# it under the terms of the GNU General Public License as published by
|
||
# the Free Software Foundation, either version 3 of the License, or
|
||
# (at your option) any later version.
|
||
#
|
||
# This program is distributed in the hope that it will be useful,
|
||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
# GNU General Public License for more details.
|
||
#
|
||
# You should have received a copy of the GNU General Public License
|
||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||
|
||
"""Provide widgets for indent spin box."""
|
||
|
||
from __future__ import annotations
|
||
|
||
from Furious.Qt import *
|
||
from Furious.Qt.Signals import connectWeakly
|
||
from Furious.Qt import gettext as _
|
||
|
||
from PySide6 import QtCore
|
||
from PySide6.QtWidgets import *
|
||
|
||
__all__ = ['IndentDialog']
|
||
|
||
|
||
class IndentDialog(AppQTransientDialog):
|
||
"""Represent indent spin box."""
|
||
|
||
def __init__(self, parent=None):
|
||
"""Initialize the indentation dialog."""
|
||
super().__init__(parent)
|
||
|
||
self.setWindowTitle(_('Set Indent'))
|
||
|
||
self.indentText = AppQLabel(_('Indent:'))
|
||
|
||
self.indentSpin = AppQSpinBox()
|
||
self.indentSpin.setRange(0, 8)
|
||
self.indentSpin.setValue(2)
|
||
|
||
self.dialogBtns = AppQDialogButtonBox(QtCore.Qt.Orientation.Horizontal)
|
||
self.dialogBtns.addButton(_('OK'), AppQDialogButtonBox.ButtonRole.AcceptRole)
|
||
self.dialogBtns.addButton(
|
||
_('Cancel'), AppQDialogButtonBox.ButtonRole.RejectRole
|
||
)
|
||
|
||
connectWeakly(self.dialogBtns.accepted, self, 'accept')
|
||
connectWeakly(self.dialogBtns.rejected, self, 'reject')
|
||
|
||
layout = QFormLayout()
|
||
layout.addRow(self.indentText, self.indentSpin)
|
||
layout.addRow(self.dialogBtns)
|
||
layout.setFormAlignment(QtCore.Qt.AlignmentFlag.AlignCenter)
|
||
|
||
self.setLayout(layout)
|
||
|
||
def value(self):
|
||
"""Return the value value."""
|
||
return self.indentSpin.value()
|