177
178
179
180
181
182
183
184
185
186
187
188
189
190
|
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
|
+
+
|
#--------------------- streams/model data accesss ---------------------------
# traverse category TreeModel to set current, expand parent nodes
def select_current(self, name):
log.UI("reselect .current category in treelist:", name)
model = self.gtk_cat.get_model()
# [Gtk3] Warning: g_object_ref_sink: assertion 'object->ref_count >= 1' failed
# ERROR:../../gi/pygobject.c:688:pygobject_register_wrapper: assertion failed: (gself->obj->ref_count >= 1)
iter = model.get_iter_first()
self.iter_cats(name, model, iter)
# iterate over children to find current category
def iter_cats(self, name, model, iter):
while iter:
val = model.get_value(iter, 0)
|
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
|
442
443
444
445
446
447
448
449
450
451
452
453
454
455
|
-
|
if not self.current:
log.STAT(self.module, "→ first_show(); use first category as current =", self.current)
self.current = self.str_from_struct(self.categories) or None
# put selection/cursor on last position
if True:
uikit.do(self.select_current, self.current)
#uikit.do(lambda:self.gtk_list.get_selection().select_path(self.shown))
# Show current category in any case
log.UI(self.module, "→ first_show(); station list → load(", self.current, ")")
self.load(self.current)
# Invoke only once
self.shown = 55555
|
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
|
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
|
-
+
|
# if it's a short list of categories, there's probably subfolders
if len(self.categories) < 20:
self.gtk_cat.expand_all()
# Select last .current or any first element
if self.current:
self.select_current(self.current)
uikit.do(self.select_current, self.current)
#self.currentcat()
#else: self.gtk_cat.get_selection().select_path("0") #set_cursor
# Insert/append new station rows - used by importing/drag'n'drop plugins
|