Beispiel #1
0
 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
Beispiel #2
0
 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')
Beispiel #3
0
 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')
Beispiel #4
0
 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')
Beispiel #5
0
 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')
Beispiel #6
0
 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')
Beispiel #7
0
 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')
Beispiel #8
0
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()))
Beispiel #9
0
 def _on_spin(self, widget: Gtk.SpinButton) -> bool:
     self.iterc = int(widget.get_value())
     return True
Beispiel #10
0
 def on_resolution_percentage_output(self,
                                     spin_button: Gtk.SpinButton) -> bool:
     spin_button.set_text(f"{spin_button.get_value_as_int()} %")
     return True
Beispiel #11
0
 def on_indent_width(self, sender: Gtk.SpinButton) -> None:
     self.settings.set_int('indent-width', sender.get_value_as_int())
Beispiel #12
0
 def on_output(self, spin_button: Gtk.SpinButton) -> bool:
     spin_button.set_text(f"{spin_button.get_value_as_int()} s")
     return True
Beispiel #13
0
 def update_lookbehind(self, button: Gtk.SpinButton):
     self.lookbehind = button.get_value_as_int()
     self.update_plot_area(self.state)
Beispiel #14
0
 def value_changed(self, spin: Gtk.SpinButton) -> None:
     self.emit('changed', spin.get_value())
Beispiel #15
0
def on_spin_button_changed(spin_button: Gtk.SpinButton, callback: Callable):
    callback(spin_button.get_value_as_int())
Beispiel #16
0
 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
Beispiel #17
0
 def _spinbutton_value_changed_cb(self, spinbutton: Gtk.SpinButton,
                                  param_name: str):
     self._params[param_name] = spinbutton.get_value()
Beispiel #18
0
 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()