Skip to content

Instantly share code, notes, and snippets.

@sivy
Created September 26, 2014 15:15
Show Gist options
  • Save sivy/51f465b2126e3a1253fc to your computer and use it in GitHub Desktop.
Save sivy/51f465b2126e3a1253fc to your computer and use it in GitHub Desktop.
from maya import cmds # wrong
class TabController(object):
def __init__(self, parent):
self.main_ui = parent
def build_ui(self):
# construct UI
raise NotImplementedError()
class EvalTabController(TabController)
def build_ui(self):
# construct UI
# handlers from main_ui can be used
make_field_thing(click=self.main_ui.save_prefs())
class ToolsTabController(TabController)
def build_ui(self):
# construct UI
class PreferencesTabController(TabController)
def build_ui(self):
# construct UI
class AdminTabController(TabController)
def build_ui(self):
# construct UI
class MainController(object):
width = 0
height = 0
def __init__(self, height, width, isadmin=False):
self.width = width
self.height = height
self.tabs = [
EvalTabController(parent=self),
ToolsTabController(parent=self),
PreferencesTabController(parent=self)
]
if isadmin:
self.tabs.append(AdminTabController(parent=self))
def deconstruct(self):
# hide main window
for tab in self.tabs:
tab.main_ui = None
self.tabs = None
def build_ui(self):
# construct main ui
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment