def __init__(self, tool, module, *args, **kw): Widget.__init__(self, *args, **kw) self.tool = tool pages = TabPanel() pages.is_gl_container = True self.pages = pages self.optionDict = {} pageTabContents = [] self.giveEditorObject(module) print "Creating options for ", module if hasattr(module, "inputs"): if isinstance(module.inputs, list): for tabData in module.inputs: title, page, pageRect = self.makeTabPage(self.tool, tabData) pages.add_page(title, page) pages.set_rect(pageRect.union(pages._rect)) elif isinstance(module.inputs, tuple): title, page, pageRect = self.makeTabPage(self.tool, module.inputs) pages.add_page(title, page) pages.set_rect(pageRect) else: self.size = (0, 0) pages.shrink_wrap() self.add(pages) self.shrink_wrap() if len(pages.pages): if (pages.current_page != None): pages.show_page(pages.current_page) else: pages.show_page(pages.pages[0]) for eachPage in pages.pages: self.optionDict = dict(self.optionDict.items() + eachPage.optionDict.items())
def __init__(self, items, keysColumn=None, buttonsColumn=None): if keysColumn is None: keysColumn = [] if buttonsColumn is None: buttonsColumn = [] Widget.__init__(self) for (hotkey, title, action) in items: if isinstance(title, (str, unicode)): button = Button(title, action=action) else: button = ValueButton(ref=title, action=action, width=200) button.anchor = self.anchor label = Label(hotkey, width=75, margin=button.margin) label.anchor = "wh" label.height = button.height keysColumn.append(label) buttonsColumn.append(button) self.buttons = list(buttonsColumn) buttonsColumn = Column(buttonsColumn) buttonsColumn.anchor = self.anchor keysColumn = Column(keysColumn) commandRow = Row((keysColumn, buttonsColumn)) self.add(commandRow) self.shrink_wrap()
def __init__(self, items, keysColumn=None, buttonsColumn=None, item_spacing=None): warn(self) if keysColumn is None: keysColumn = [] if buttonsColumn is None: buttonsColumn = [] labels = [] Widget.__init__(self) for t in items: if len(t) == 3: (hotkey, title, action) = t tooltipText = None else: (hotkey, title, action, tooltipText) = t if isinstance(title, (str, unicode)): button = Button(title, action=action) else: button = ValueButton(ref=title, action=action, width=200) button.anchor = self.anchor label = Label(hotkey, width=100, margin=button.margin) label.anchor = "wh" label.height = button.height labels.append(label) if tooltipText: button.tooltipText = tooltipText keysColumn.append(label) buttonsColumn.append(button) self.buttons = list(buttonsColumn) #.# if item_spacing == None: buttonsColumn = Column(buttonsColumn) else: buttonsColumn = Column(buttonsColumn, spacing=item_spacing) #.# buttonsColumn.anchor = self.anchor #.# if item_spacing == None: keysColumn = Column(keysColumn) else: keysColumn = Column(keysColumn, spacing=item_spacing) commandRow = Row((keysColumn, buttonsColumn)) self.labels = labels self.add(commandRow) self.shrink_wrap()
def __init__(self, tool, module, *args, **kw): self._parent = None self.nbttree = None self.module = module if '_parent' in kw.keys(): self._parent = kw.pop('_parent') Widget.__init__(self, *args, **kw) self.spacing = 2 self.tool = tool self.pages = pages = TabPanel() pages.is_gl_container = True self.optionDict = {} self.giveEditorObject(module) log.info("Creating options for " + str(module)) if hasattr(module, "inputs"): trn = getattr(module, "trn", None) self.trn = trn if isinstance(module.inputs, list): self.pgs = [] for tabData in module.inputs: title, page, pageRect = self.makeTabPage(self.tool, tabData, trn=trn) self.pgs.append((title, page)) pages.set_parent(None) self.pages = pages = TabPanel(self.pgs) elif isinstance(module.inputs, tuple): title, page, pageRect = self.makeTabPage(self.tool, module.inputs, trn=trn) pages.add_page(title, page) pages.set_rect(pageRect) else: self.size = (0, 0) pages.shrink_wrap() self.add(pages) self.shrink_wrap() if len(pages.pages): if pages.current_page is not None: pages.show_page(pages.current_page) else: pages.show_page(pages.pages[0]) for eachPage in pages.pages: self.optionDict = dict(self.optionDict.items() + eachPage.optionDict.items())
def __init__(self, macro_data, *args, **kw): self._parent = None self._macro_data = macro_data if '_parent' in kw.keys(): self._parent = kw.pop('_parent') Widget.__init__(self, *args, **kw) infoColList = [] stepsLabel = wrapped_label("Number of steps: %s" % macro_data["Number of steps"], 300) infoColList.append(stepsLabel) for step in sorted(macro_data.keys()): if step != "Number of steps": infoColList.append(wrapped_label("Step %s: %s" % (int(step) + 1, macro_data[step]["Name"]), 300)) self.add(Column(infoColList)) self.shrink_wrap()
def __init__(self, file_types=None, operation=0, **kwds): Widget.__init__(self, **kwds) if file_types is None: self.file_types = ["*.*",] else: self.file_types = file_types self.file_path = None self._button = None if operation == self.OPEN_FILE: self._button = Button("Choose a file", action=self._open_file) elif operation == self.SAVE_FILE: self._button = Button("Save a file", action=self._save_file) self.add(self._button) self.shrink_wrap()
def __init__(self, editor): Widget.__init__(self) self.nudgeButton = NudgeButton(editor) self.nudgeButton.nudge = self._nudge self.xField = IntField(value=0) self.yField = IntField(value=0) self.zField = IntField(value=0) for field in (self.xField, self.yField, self.zField): field.change_action = self._coordsChanged field.enter_passes = False offsetCol = Column((self.xField, self.yField, self.zField)) nudgeOffsetRow = Row((offsetCol, self.nudgeButton)) self.add(nudgeOffsetRow) self.shrink_wrap()
def __init__(self, materials, blockInfo=None, **kw): Widget.__init__(self, **kw) self.materials = materials self.blockInfo = blockInfo
def __init__(self, value=None): Widget.__init__(self) self.choiceButton = ChoiceButton(self.choices) self.add(self.choiceButton) self.shrink_wrap()