generated from itdominator/Python-With-Gtk-Template
Added auto scroll to bottom
This commit is contained in:
parent
63eec6f1af
commit
e064dcc98b
|
@ -5,6 +5,7 @@ import json
|
||||||
import gi
|
import gi
|
||||||
gi.require_version('Gtk', '3.0')
|
gi.require_version('Gtk', '3.0')
|
||||||
from gi.repository import Gtk
|
from gi.repository import Gtk
|
||||||
|
from gi.repository import GLib
|
||||||
|
|
||||||
# Application imports
|
# Application imports
|
||||||
|
|
||||||
|
@ -38,7 +39,12 @@ class LogList(Gtk.ListBox):
|
||||||
del frame
|
del frame
|
||||||
del revealer
|
del revealer
|
||||||
|
|
||||||
|
def scroll_down(self, widget):
|
||||||
|
GLib.idle_add(self.scroll_down)
|
||||||
|
|
||||||
|
|
||||||
self.connect("row-activated", tggl_row_view)
|
self.connect("row-activated", tggl_row_view)
|
||||||
|
self.connect("size-allocate", scroll_down)
|
||||||
|
|
||||||
def _subscribe_to_events(self):
|
def _subscribe_to_events(self):
|
||||||
...
|
...
|
||||||
|
@ -71,3 +77,7 @@ class LogList(Gtk.ListBox):
|
||||||
def clear(self):
|
def clear(self):
|
||||||
for child in self.get_children():
|
for child in self.get_children():
|
||||||
self.remove(child)
|
self.remove(child)
|
||||||
|
|
||||||
|
def scroll_down(self):
|
||||||
|
vadjustment = self.get_parent().get_vadjustment()
|
||||||
|
vadjustment.set_value( vadjustment.get_upper())
|
||||||
|
|
Loading…
Reference in New Issue