Check-in [8622bed197]
Overview
| Comment: | Move appstate restoration into init function. Implemented "quit" hook for action.cleanup_tmp_files, fixed app_restore `w.set_current_page` bug. |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
8622bed19722985c8c5a43928f21c598 |
| User & Date: | mario on 2015-04-10 17:36:45 |
| Other Links: | manifest | tags |
Context
|
2015-04-11
| ||
| 01:20 | Initialize with empty station TreeView again. Make bookmarks channel not override the behaviour. (This sort of works around the .current category mismatch after startup.) check-in: 6109a1a671 user: mario tags: trunk | |
|
2015-04-10
| ||
| 17:36 | Move appstate restoration into init function. Implemented "quit" hook for action.cleanup_tmp_files, fixed app_restore `w.set_current_page` bug. check-in: 8622bed197 user: mario tags: trunk | |
| 17:35 | Rewritten action module and playlist conversion/export works okay enough. Merged into trunk. check-in: 60f5238dc8 user: mario tags: trunk | |
Changes
Modified st2.py from [b17ac06878] to [cd5179ec1f].
| ︙ | ︙ | |||
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 |
}
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
| | | | < < < < < < < < < < < < < < | < | 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()
|
Modified uikit.py from [913007a2bb] to [ef2af84135].
| ︙ | ︙ | |||
351 352 353 354 355 356 357 |
# compare current label list on each reordering round
for i in range(0, w.get_n_pages()):
w_tab = w.get_nth_page(i)
w_label = w.get_menu_label_text(w_tab)
if w_label == ord_tabname:
w.reorder_child(w_tab, pos)
if tab_current == ord_tabname:
| | | 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 |
# compare current label list on each reordering round
for i in range(0, w.get_n_pages()):
w_tab = w.get_nth_page(i)
w_label = w.get_menu_label_text(w_tab)
if w_label == ord_tabname:
w.reorder_child(w_tab, pos)
if tab_current == ord_tabname:
w.set_current_page(pos)
pass
#-- Save-As dialog
#
@staticmethod
|
| ︙ | ︙ |