def val_changed_cb(self, widget: Gtk.SpinButton): """On input callback to set the values to be always two digits""" if not widget.val_change_is_changing_entry: widget.val_change_is_changing_entry = True value = widget.get_value_as_int() value = min(value, 59) widget.set_text(str(value).zfill(2)) widget.val_change_is_changing_entry = False
def go_to_hizb( self, button: Gtk.SpinButton) -> None: if self.is_updating: return glob.hizb_number = int(button.get_value()) self.update('hizb-number')
def go_to_manzil( self, button: Gtk.SpinButton) -> None: if self.is_updating: return glob.manzil_number = int(button.get_value()) self.update('manzil-number')
def go_to_ayah( self, button: Gtk.SpinButton) -> None: if self.is_updating: return glob.ayah_number = int(button.get_value()) self.update('ayah-number')
def go_to_juz( self, button: Gtk.SpinButton) -> None: if self.is_updating: return glob.juz_number = int(button.get_value()) self.update('juz-number')
def go_to_page( self, button: Gtk.SpinButton) -> None: if self.is_updating: return glob.page_number = int(button.get_value()) + self.page_no_start - 1 self.update('page-number')
def go_to_ruku( self, button: Gtk.SpinButton) -> None: if self.is_updating: return glob.ruku_number = int(button.get_value()) self.update('ruku-number')
def _link_gtk_spinbutton_to_settings(settings: ApplicationSettings, spin: Gtk.SpinButton, settings_id: str): """ Link a Gtk.SpinButton to a GSettings ID, so any change in one of them will be reflected in the other one. """ name = spin.get_name() logging.debug( f"[LINK] settings::{settings_id} <-> spinbutton {name} [int]") curr_value = settings.get_int(settings_id) if curr_value: spin.set_value(settings.get_int(settings_id)) settings.connect( f"changed::{settings_id}", lambda s, k: spin.set_value(settings.get_int(settings_id))) spin.connect("change-value", lambda e: settings.set_int(settings_id, spin.get_value()))
def _on_spin(self, widget: Gtk.SpinButton) -> bool: self.iterc = int(widget.get_value()) return True
def on_resolution_percentage_output(self, spin_button: Gtk.SpinButton) -> bool: spin_button.set_text(f"{spin_button.get_value_as_int()} %") return True
def on_indent_width(self, sender: Gtk.SpinButton) -> None: self.settings.set_int('indent-width', sender.get_value_as_int())
def on_output(self, spin_button: Gtk.SpinButton) -> bool: spin_button.set_text(f"{spin_button.get_value_as_int()} s") return True
def update_lookbehind(self, button: Gtk.SpinButton): self.lookbehind = button.get_value_as_int() self.update_plot_area(self.state)
def value_changed(self, spin: Gtk.SpinButton) -> None: self.emit('changed', spin.get_value())
def on_spin_button_changed(spin_button: Gtk.SpinButton, callback: Callable): callback(spin_button.get_value_as_int())
def val_changed_cb(self, widg: Gtk.SpinButton) -> None: """On input callback to set the values to be always two digits""" if not widg.val_change_is_changing_entry: widg.val_change_is_changing_entry = True widg.set_text(widg.get_text().zfill(2)) widg.val_change_is_changing_entry = False
def _spinbutton_value_changed_cb(self, spinbutton: Gtk.SpinButton, param_name: str): self._params[param_name] = spinbutton.get_value()
def on_nentries_changed(self, spinbutton: Gtk.SpinButton): self.nentries = spinbutton.get_value_as_int() model = self.builder.get_object('logstore') while len(model) > self.nentries: model.remove(model.get_iter_first()) self.update_shown_count()