74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
channels = {} # channel modules
features = {} # non-channel plugins
working = [] # threads
hooks = {
"play": [favicon.download_playing], # observers queue here
"record": [],
"init": [],
"config_load": [],
"config_save": [],
}
meta = plugin_meta()
# status variables
|
>
|
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
channels = {} # channel modules
features = {} # non-channel plugins
working = [] # threads
hooks = {
"play": [favicon.download_playing], # observers queue here
"record": [],
"init": [],
"quit": [action.cleanup_tmp_files],
"config_load": [],
"config_save": [],
}
meta = plugin_meta()
# status variables
|
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
|
}
gui_startup(4/20.0)
# early module coupling
action.main = self # action (play/record) module needs a reference to main window for gtk interaction and some URL/URI callbacks
ahttp.feedback = self.status # http module gives status feedbacks too
# append other channel modules and plugins
self.load_plugin_channels()
# load application state (widget sizes, selections, etc.)
try:
winlayout = conf.load("window")
if (winlayout):
uikit.app_restore(self, winlayout)
# selection values
winstate = conf.load("state")
if (winstate):
for id in winstate.keys():
self.channels[id].current = winstate[id]["current"]
self.channels[id].shown = winlayout[id+"_list"].get("row:selected", 0) # actually just used as boolean flag (for late loading of stream list), selection bar has been positioned before already
except:
pass # fails for disabled/reordered plugin channels
# late plugin initializations
gui_startup(17/20.0)
[callback(self) for callback in self.hooks["init"]]
# display current open channel/notebook tab
gui_startup(18/20.0)
self.current_channel = self.current_channel_gtk()
try: self.channel().first_show()
except: __print__(dbg.INIT, "main.__init__: current_channel.first_show() initialization error")
|
|
|
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
<
|
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
|
}
gui_startup(4/20.0)
# early module coupling
action.main = self # action (play/record) module needs a reference to main window for gtk interaction and some URL/URI callbacks
ahttp.feedback = self.status # http module gives status feedbacks too
# load plugins
self.load_plugin_channels()
# restore app/widget states
self.init_app_state()
# and late plugin initializations
[callback(self) for callback in self.hooks["init"]]
# display current open channel/notebook tab
gui_startup(18/20.0)
self.current_channel = self.current_channel_gtk()
try: self.channel().first_show()
except: __print__(dbg.INIT, "main.__init__: current_channel.first_show() initialization error")
|
427
428
429
430
431
432
433
434
435
436
437
438
439
440
|
else:
self.features[name] = plugin_obj
except Exception as e:
__print__(dbg.INIT, "load_plugin_channels: error initializing:", name, ", exception:")
traceback.print_exc()
# store window/widget states (sizes, selections, etc.)
def app_state(self, widget):
# gtk widget states
widgetnames = ["win_streamtuner2", "toolbar", "notebook_channels", ] \
+ [id+"_list" for id in self.channel_names] \
+ [id+"_cat" for id in self.channel_names]
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
413
414
415
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
|
else:
self.features[name] = plugin_obj
except Exception as e:
__print__(dbg.INIT, "load_plugin_channels: error initializing:", name, ", exception:")
traceback.print_exc()
# load application state (widget sizes, selections, etc.)
def init_app_state(self):
try:
winlayout = conf.load("window")
if (winlayout):
uikit.app_restore(self, winlayout)
# selection values
winstate = conf.load("state")
if (winstate):
for id in winstate.keys():
self.channels[id].current = winstate[id]["current"]
self.channels[id].shown = winlayout[id+"_list"].get("row:selected", 0) # actually just used as boolean flag (for late loading of stream list), selection bar has been positioned before already
except:
pass # fails for disabled/reordered plugin channels
# store window/widget states (sizes, selections, etc.)
def app_state(self, widget):
# gtk widget states
widgetnames = ["win_streamtuner2", "toolbar", "notebook_channels", ] \
+ [id+"_list" for id in self.channel_names] \
+ [id+"_cat" for id in self.channel_names]
|
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
|
# first invocation
if (conf.get("firstrun")):
main.configwin.open(None)
del conf.firstrun
# run
gtk.main()
__print__(dbg.PROC, r"[31m gtk_main_quit [0m")
# invoke command-line interface
else:
import cli
cli.StreamTunerCLI(conf.args.action)
# run
if __name__ == "__main__":
main()
|
>
|
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
|
# first invocation
if (conf.get("firstrun")):
main.configwin.open(None)
del conf.firstrun
# run
gtk.main()
[callback() for callback in main.hooks["quit"]]
__print__(dbg.PROC, r"[31m gtk_main_quit [0m")
# invoke command-line interface
else:
import cli
cli.StreamTunerCLI(conf.args.action)
# run
if __name__ == "__main__":
main()
|