Skip to content

Commit 7ee24ff

Browse files
committed
hal_mdihistory: scroll to last line on reload
1 parent 4db771b commit 7ee24ff

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

lib/python/gladevcp/hal_mdihistory.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -136,12 +136,16 @@ def reload(self):
136136
fp.close()
137137

138138
lines = filter(bool, lines)
139+
last = Gtk.TreeIter()
139140
for l in lines:
140-
self.model.append((l,))
141-
#path = (len(list(lines))-1,)
142-
path = 0 #TODO: breaks the functionality
143-
self.tv.scroll_to_cell(path)
144-
self.tv.set_cursor(path)
141+
last = self.model.append((l,))
142+
path = self.model.get_path(last)
143+
# if the hal mdi history file is empty, the model is empty and we will get an None iter
144+
try:
145+
self.tv.scroll_to_cell(path)
146+
self.tv.set_cursor(path)
147+
except:
148+
pass
145149
self.entry.set_text('')
146150

147151
def submit(self, *a):

0 commit comments

Comments
 (0)