25 lines
772 B
Python
25 lines
772 B
Python
import gi
|
|
from gi.repository import Gtk
|
|
|
|
import util
|
|
|
|
class ModelPreferenceView(Gtk.Popover):
|
|
def __init__(self, on_gpu_change=None, *args, **kwargs):
|
|
super().__init__(*args, **kwargs)
|
|
self.on_gpu_change = on_gpu_change
|
|
|
|
box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=6)
|
|
util.set_margin_all(box, 8)
|
|
|
|
label = Gtk.Label(label="GPU Layers")
|
|
box.append(label)
|
|
|
|
gpu_spin = Gtk.SpinButton(adjustment=Gtk.Adjustment(
|
|
value=15, lower=0, upper=50, step_increment=1,
|
|
), digits=0, hexpand=True)
|
|
|
|
gpu_spin.connect("value-changed", lambda spin: self.on_gpu_change(spin.get_value_as_int()))
|
|
box.append(gpu_spin)
|
|
|
|
self.set_child(box)
|