Best way to use unload()
Posted: Thu Jan 22, 2015 6:43 pm
Hi,
I'm not quite sure what's the best and most effective and clear way of using unload().
For example, I have a myaddon/menus.py file:and a myaddon/myaddon.py file:Now, Would it be better and clearer to havewithin myaddon/menus.py for clearing them? Is it even needed to clear them on unload, or is this method just available for the build callback? Thanks! :)
I'm not quite sure what's the best and most effective and clear way of using unload().
For example, I have a myaddon/menus.py file:
Syntax: Select all
from menus import Option
from menus import SimpleMenu
def menu1_callback(menu, index, option):
pass
def menu2_callback(menu, index, option):
pass
menu1 = SimpleMenu(select_callback=menu1_callback)
# add content
menu2 = SimpleMenu(select_callback=menu2_callback)
# add content
Syntax: Select all
from myaddon.menus import menu1
from myaddon.menus import menu2
# use ONLY menu1 in events
def unload():
menu1.clear()
menu2.clear()
Syntax: Select all
def unload():
menu1.clear()
menu2.clear()