Functions and classes to help write GadgetScreens with banners, columns, and leaves.
Usage:
import Tkinter import webbrowser
import Component import dialog.checkbox as check import dialog.dimension as dim import dialog.entry as entry import sds2.utility.gadget_protocol as gp
def build_frameA(f): check.Checkbox(f, 'a', 'A')
def build_frameB(f): entry.IntEntry(f, 'b', 'B:').read_only = True
def build_frameC(f): dim.DimensionEntry(f, 'c', 'default', 'C:')
def build_ui(model, gadget_factory): controller = gp.SubdialogController(model)
gadget_factory.LoadSaveBanner( controller, build_frameA, 'Banner description', '', '98a104f2-da81-4598-8f61-7d6a81334828', 'MyPlugin_banner_form', [] )
column = gadget_factory.LoadSaveColumn( controller, None, 'Column description', '', 'aedf6b0d-7343-434c-8a06-01db14b072e1', 'MyPlugin_column_form', )
gadget_factory.LoadSaveLeaf( column, controller, build_frameB, 'Leaf 1', '', 'fb1fde68-69c8-48ed-8f39-432e2c85cff3', 'MyPlugin_leaf1_form', [] )
gadget_factory.LoadSaveLeaf( column, controller, build_frameC, 'Leaf 2', '', '7e6b96fb-c23b-4c40-af17-6f6cc706bc66', 'MyPlugin_leaf2_form', [] )
class MyPlugin(gp.GadgetComponent, Component.Component): UserStr = 'MyPlugin' StandAloneEditWindowID = 'ad4db29f-b1b8-4597-a10e-fc237c954150'
def OnStandAloneEditHelp(): webbrowser.open('https://youtu.be/dQw4w9WgXcQ?t=42')
def CreateCustomMultiEditableUI(model, gadget_factory): build_ui(model, gadget_factory)
def init(self, a=True, b=2, c=3.4): Component.Component.__init__(self) self.a = a self.b = b self.c = c
if name == 'main': p1 = MyPlugin() p1.MultiEdit([MyPlugin(a=not p1.a)])