def __init__(self, csw_number: lib_csw.Number.Client, reflect_state_widgets=None): """ Implements lib_csw.Number control as SpinBox """ if not isinstance(csw_number, lib_csw.Number.Client): raise ValueError('csw_number must be an instance of Number.Client') self._csw_number = csw_number self._instant_update = False self._zero_is_auto = False self._read_only = True csw_number.call_on_number(self._on_csw_number) csw_number.call_on_config(self._on_csw_config) spinbox = self._spinbox = qtx.QXDoubleSpinBox( font=QXFontDB.Digital7_Mono(11, italic=True), min=0, max=999999999, step=1, decimals=0, readonly=self._read_only, valueChanged=self._on_spinbox_valueChanged, editingFinished=self._on_spinbox_editingFinished) btn_auto = self._btn_auto = qtx.QXPushButton( text=L('@misc.auto'), released=self._on_btn_auto_released, fixed_height=21, hided=True) super().__init__(csw_control=csw_number, reflect_state_widgets=reflect_state_widgets, layout=qtx.QXHBoxLayout([spinbox, 1, btn_auto]))
def __init__( self, csw_idx: lib_csw.Number.Client, csw_idx_count: lib_csw.Number.Client, ): """ Implements controlable Slider with lib_csw.Number controls """ if not isinstance(csw_idx, lib_csw.Number.Client): raise ValueError('csw_idx must be an instance of Number.Client') if not isinstance(csw_idx_count, lib_csw.Number.Client): raise ValueError( 'csw_idx_count must be an instance of Number.Client') self._csw_idx = csw_idx self._csw_idx_count = csw_idx_count csw_idx.call_on_number(self._on_csw_idx) csw_idx_count.call_on_number(self._on_csw_idx_count) slider = self._slider = qtx.QXSlider( orientation=qtx.Qt.Orientation.Horizontal, min=0, max=0, tick_position=qtx.QSlider.TickPosition.NoTicks, tick_interval=1, valueChanged=self._on_slider_valueChanged) spinbox_font = QXFontDB.Digital7_Mono(11, italic=True) spinbox_index = self._spinbox_index = qtx.QXSpinBox( font=spinbox_font, min=0, max=0, step=1, alignment=qtx.AlignRight, button_symbols=qtx.QAbstractSpinBox.ButtonSymbols.NoButtons, editingFinished=self._on_spinbox_index_editingFinished) spinbox_count = self._spinbox_count = qtx.QXSpinBox( font=spinbox_font, min=0, max=0, step=1, alignment=qtx.AlignRight, button_symbols=qtx.QAbstractSpinBox.ButtonSymbols.NoButtons, readonly=True) super().__init__( csw_control=csw_idx, layout=qtx.QXVBoxLayout([ slider, (qtx.QXFrameHBox( [spinbox_index, qtx.QXLabel(text='/'), spinbox_count], size_policy=('fixed', 'fixed')), qtx.AlignCenter), ]))
def __init__(self, csw_progress: lib_csw.Progress.Client): if not isinstance(csw_progress, lib_csw.Progress.Client): raise ValueError( 'csw_progress must be an instance of Progress.Client') self._csw_progress = csw_progress csw_progress.call_on_progress(self._on_csw_progress) csw_progress.call_on_config(self._on_csw_config) label_title = self._label_title = qtx.QXLabel('', word_wrap=True, hided=True) progressbar = self._progressbar = qtx.QXProgressBar( min=0, max=100, font=QXFontDB.Digital7_Mono(11, italic=True)) super().__init__(csw_control=csw_progress, layout=qtx.QXVBoxLayout([label_title, progressbar]))
def __init__(self, csw_number: lib_csw.Number.Client, reflect_state_widgets=None): if not isinstance(csw_number, lib_csw.Number.Client): raise ValueError('csw_number must be an instance of Number.Client') self._csw_number = csw_number self._decimals = 0 csw_number.call_on_number(self._on_csw_number) csw_number.call_on_config(self._on_csw_config) label = self._label = qtx.QXLabel( font=QXFontDB.Digital7_Mono(11, italic=True)) super().__init__(csw_control=csw_number, reflect_state_widgets=reflect_state_widgets, layout=qtx.QXHBoxLayout([label]))