92
93
94
95
96
97
98
99
100
101
102
103
104
105 | placeholder = [dict(genre="./.", title="Subcategory placeholder", playing="./.", url="none:", listeners=0, bitrate=0, homepage="", state="gtkfolder")]
empty_stub = [dict(genre="./.", title="No categories found (HTTP error)", playing="Try Channel→Reload Categories later..", url="none:", listeners=0, bitrate=0, homepage="", state="gtk-stop")]
nothing_found = [dict(genre="./.", title="No contents found on directory server", playing="Notice", listeners=0, bitrate=0, state="gtk-info")]
# regex
rx_www_url = re.compile("""(www(\.\w+[\w-]+){2,}|(\w+[\w-]+[ ]?\.)+(com|FM|net|org|de|PL|fr|uk))""", re.I)
__current = None
@property
def current(self):
return self.__current
@current.setter
def current(self, newcat):
print "{}.current:={} ← from {}".format(self.module, newcat, [inspect.stack()[x][3] for x in range(1,4)]) |
>
>
| 92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107 | placeholder = [dict(genre="./.", title="Subcategory placeholder", playing="./.", url="none:", listeners=0, bitrate=0, homepage="", state="gtkfolder")]
empty_stub = [dict(genre="./.", title="No categories found (HTTP error)", playing="Try Channel→Reload Categories later..", url="none:", listeners=0, bitrate=0, homepage="", state="gtk-stop")]
nothing_found = [dict(genre="./.", title="No contents found on directory server", playing="Notice", listeners=0, bitrate=0, state="gtk-info")]
# regex
rx_www_url = re.compile("""(www(\.\w+[\w-]+){2,}|(\w+[\w-]+[ ]?\.)+(com|FM|net|org|de|PL|fr|uk))""", re.I)
#-- keep track of currently selected genre/category
__current = None
@property
def current(self):
return self.__current
@current.setter
def current(self, newcat):
print "{}.current:={} ← from {}".format(self.module, newcat, [inspect.stack()[x][3] for x in range(1,4)]) |
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441 | self.reload_categories()
except:
__print__(dbg.ERR, "HTTP error or extraction failure.")
self.categories = ["empty"]
self.display_categories()
# Select first category
#self.current = self.str_from_struct(self.categories) or None
#__print__(dbg.STAT, self.module, "→ first_show(); use first category as current =", self.current)
try:
self.load(self.current)
except:
pass
# put selection/cursor on last position
if self.shown:
__print__(dbg.STAT, self.module+".first_show()", "select last known category treelist position =", self.shown)
try:
self.gtk_list.get_selection().select_path(self.shown)
except:
pass
# Invoke only once
self.shown = 55555
|
>
|
|
<
|
|
|
>
>
|
|
| 418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445 | self.reload_categories()
except:
__print__(dbg.ERR, "HTTP error or extraction failure.")
self.categories = ["empty"]
self.display_categories()
# Select first category
if not self.current:
self.current = self.str_from_struct(self.categories) or None
__print__(dbg.STAT, self.module, "→ first_show(); use first category as current =", self.current)
self.shown = 0,
# Show current category in any case
__print__(dbg.UI, self.module, "→ first_show(); station list → load(", self.current, ")")
uikit.do(self.load, self.current)
# put selection/cursor on last position
if True:#self.shown != None:
__print__(dbg.STAT, self.module+".first_show()", "select last known category treelist position =", self.shown)
try:
uikit.do(lambda:self.gtk_list.get_selection().select_path(self.shown))
except:
pass
# Invoke only once
self.shown = 55555
|