8637: Use keyword arguments to initialise Adjustment widgets
This should prevent the value being set to zero or the minumum limit incorrectly.
This commit is contained in:
parent
c0bdfafbda
commit
dcb8efd8e6
@ -443,7 +443,9 @@ class ConfigureDialog(ManagedWindow):
|
|||||||
if not callback:
|
if not callback:
|
||||||
callback = self.update_slider
|
callback = self.update_slider
|
||||||
lwidget = BasicLabel("%s: " % label)
|
lwidget = BasicLabel("%s: " % label)
|
||||||
adj = Gtk.Adjustment(config.get(constant), range[0], range[1], 1, 0, 0)
|
adj = Gtk.Adjustment(value=config.get(constant), lower=range[0],
|
||||||
|
upper=range[1], step_increment=1,
|
||||||
|
page_increment=0, page_size=0)
|
||||||
slider = Gtk.Scale(adjustment=adj)
|
slider = Gtk.Scale(adjustment=adj)
|
||||||
slider.set_digits(0)
|
slider.set_digits(0)
|
||||||
slider.set_value_pos(Gtk.PositionType.BOTTOM)
|
slider.set_value_pos(Gtk.PositionType.BOTTOM)
|
||||||
@ -463,7 +465,9 @@ class ConfigureDialog(ManagedWindow):
|
|||||||
if not callback:
|
if not callback:
|
||||||
callback = self.update_spinner
|
callback = self.update_spinner
|
||||||
lwidget = BasicLabel("%s: " % label)
|
lwidget = BasicLabel("%s: " % label)
|
||||||
adj = Gtk.Adjustment(config.get(constant), range[0], range[1], 1, 0, 0)
|
adj = Gtk.Adjustment(value=config.get(constant), lower=range[0],
|
||||||
|
upper=range[1], step_increment=1,
|
||||||
|
page_increment=0, page_size=0)
|
||||||
spinner = Gtk.SpinButton(adjustment=adj, climb_rate=0.0, digits=0)
|
spinner = Gtk.SpinButton(adjustment=adj, climb_rate=0.0, digits=0)
|
||||||
spinner.connect('value-changed', callback, constant)
|
spinner.connect('value-changed', callback, constant)
|
||||||
spinner.set_hexpand(True)
|
spinner.set_hexpand(True)
|
||||||
|
@ -149,7 +149,8 @@ class MyInteger(Gtk.SpinButton):
|
|||||||
|
|
||||||
def __init__(self, min, max):
|
def __init__(self, min, max):
|
||||||
GObject.GObject.__init__(self)
|
GObject.GObject.__init__(self)
|
||||||
self.set_adjustment(Gtk.Adjustment(min, min, max, 1))
|
self.set_adjustment(Gtk.Adjustment(value=min, lower=min, upper=max,
|
||||||
|
step_increment=1))
|
||||||
self.show()
|
self.show()
|
||||||
|
|
||||||
def get_text(self):
|
def get_text(self):
|
||||||
|
@ -299,10 +299,10 @@ class GuiNumberOption(Gtk.SpinButton):
|
|||||||
|
|
||||||
decimals = 0
|
decimals = 0
|
||||||
step = self.__option.get_step()
|
step = self.__option.get_step()
|
||||||
adj = Gtk.Adjustment(1,
|
adj = Gtk.Adjustment(value=1,
|
||||||
self.__option.get_min(),
|
lower=self.__option.get_min(),
|
||||||
self.__option.get_max(),
|
upper=self.__option.get_max(),
|
||||||
step)
|
step_increment=step)
|
||||||
|
|
||||||
# Calculate the number of decimal places if necessary
|
# Calculate the number of decimal places if necessary
|
||||||
if step < 1:
|
if step < 1:
|
||||||
|
@ -124,7 +124,8 @@ class PlaceSelection(ManagedWindow, OsmGps):
|
|||||||
' oval depending on the latitude.'))
|
' oval depending on the latitude.'))
|
||||||
label.set_valign(Gtk.Align.END)
|
label.set_valign(Gtk.Align.END)
|
||||||
self.window.vbox.pack_start(label, False, True, 0)
|
self.window.vbox.pack_start(label, False, True, 0)
|
||||||
adj = Gtk.Adjustment(1.0, 0.1, 3.0, 0.1, 0, 0)
|
adj = Gtk.Adjustment(value=1.0, lower=0.1, upper=3.0,
|
||||||
|
step_increment=0.1, page_increment=0, page_size=0)
|
||||||
# default value is 1.0, minimum is 0.1 and max is 3.0
|
# default value is 1.0, minimum is 0.1 and max is 3.0
|
||||||
slider = Gtk.Scale(orientation=Gtk.Orientation.HORIZONTAL,
|
slider = Gtk.Scale(orientation=Gtk.Orientation.HORIZONTAL,
|
||||||
adjustment=adj)
|
adjustment=adj)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user