def dismiss(self, *args, **kwargs): bullet_styles = change_styles() if hasattr(self.tool, 'panel') and self.tool.panel is not None: self.tool.panel.tree.styles = bullet_styles self.tool.panel.tree.update_draw_bullets_methods(bullet_styles) self.tool.panel.tree.build_layout() ToolOptions.dismiss(self, *args, **kwargs)
def __init__(self, tool): ToolOptions.__init__(self, name='Panel.BrushToolOptions') alphaField = FloatField(ref=ItemRef(tool.settings, 'brushAlpha'), min=0.0, max=1.0, width=60) alphaField.increment = 0.1 alphaRow = Row((Label("Alpha: "), alphaField)) autoChooseCheckBox = CheckBoxLabel( "Choose Block Immediately", ref=ItemRef(tool.settings, "chooseBlockImmediately"), tooltipText= "When the brush tool is chosen, prompt for a block type.") updateOffsetCheckBox = CheckBoxLabel( "Reset Distance When Brush Size Changes", ref=ItemRef(tool.settings, "updateBrushOffset"), tooltipText= "Whenever the brush size changes, reset the distance to the brush blocks." ) col = Column((Label("Brush Options"), alphaRow, autoChooseCheckBox, updateOffsetCheckBox, Button("OK", action=self.dismiss))) self.add(col) self.shrink_wrap() return
def __init__(self, tool): ToolOptions.__init__(self, name='Panel.CloneToolOptions') self.tool = tool self.autoPlaceCheckBox = CheckBox( ref=AttrRef(tool, "placeImmediately")) self.autoPlaceLabel = Label("Place Immediately") self.autoPlaceLabel.mouse_down = self.autoPlaceCheckBox.mouse_down tooltipText = "When the clone tool is chosen, place the clone at the selection right away." self.autoPlaceLabel.tooltipText = self.autoPlaceCheckBox.tooltipText = tooltipText spaceLabel = Label("") cloneNudgeLabel = Label("Clone Fast Nudge Settings") cloneNudgeCheckBox = CheckBoxLabel( "Move by the width of selection ", ref=config.fastNudgeSettings.cloneWidth, tooltipText="Moves clone by his width") cloneNudgeNumber = IntInputRow( "Width of clone movement: ", ref=config.fastNudgeSettings.cloneWidthNumber, width=100, min=2, max=50) row = Row((self.autoPlaceCheckBox, self.autoPlaceLabel)) col = Column((Label("Clone Options"), row, spaceLabel, cloneNudgeLabel, cloneNudgeCheckBox, cloneNudgeNumber, Button("OK", action=self.dismiss))) self.add(col) self.shrink_wrap()
def __init__(self, tool): ToolOptions.__init__(self) self.tool = tool useStyleBox = CheckBoxLabel(title="Use Bullet Styles", ref=config.nbtTreeSettings.useBulletStyles) self.useStyleBox = useStyleBox useTextBox = CheckBoxLabel(title="Use Bullet Text", ref=config.nbtTreeSettings.useBulletText) self.useTextBox = useTextBox useImagesBox = CheckBoxLabel(title="Use Bullet Images", ref=config.nbtTreeSettings.useBulletImages) self.useImagesBox = useImagesBox bulletFilePath = Row((Button("Bullet Images File", action=self.open_bullet_file), TextFieldWrapped(ref=config.nbtTreeSettings.bulletFileName, width=300)), margin=0) def mouse_down(e): if self.bulletFilePath.subwidgets[1].enabled: TextFieldWrapped.mouse_down(self.bulletFilePath.subwidgets[1], e) bulletFilePath.subwidgets[1].mouse_down = mouse_down self.bulletFilePath = bulletFilePath def mouse_down(e): CheckBox.mouse_down(useImagesBox.subwidgets[1], e) for sub in bulletFilePath.subwidgets: sub.enabled = config.nbtTreeSettings.useBulletImages.get() if type(sub) == TextFieldWrapped: if config.nbtTreeSettings.useBulletImages.get(): sub.fg_color = fg_color else: sub.fg_color = disabled_color useImagesBox.subwidgets[0].mouse_down = useImagesBox.subwidgets[1].mouse_down = mouse_down def mouse_down(e): CheckBox.mouse_down(useStyleBox.subwidgets[1], e) useImagesBox.mouse_down(e) self.useStyleBox_click(e) useStyleBox.subwidgets[0].mouse_down = useStyleBox.subwidgets[1].mouse_down = mouse_down showAllTags = CheckBoxLabel(title="Show all the tags in the tree", ref=config.nbtTreeSettings.showAllTags) col = Column(( Label("NBT Tree Settings"), Row((useStyleBox, useTextBox, useImagesBox)), bulletFilePath, showAllTags, # Button("Load NBT file...", action=tool.loadFile), Button("OK", action=self.dismiss), )) self.add(col) self.shrink_wrap() self.useStyleBox_click(None)
def __init__(self, tool): ToolOptions.__init__(self, name="Panel.FilterToolOptions") self.tool = tool self.notifications_disabled = False disable_error_popup = CheckBoxLabel("Disable Error Notification", ref=AttrRef(self, "notifications_disabled")) ok_button = Button("Ok", action=self.dismiss) col = Column((disable_error_popup, ok_button), spacing=2) self.add(col) self.shrink_wrap()
def __init__(self, tool): ToolOptions.__init__(self, name='Panel.FilterToolOptions') self.tool = tool self.notifications_disabled = False disable_error_popup = CheckBoxLabel("Disable Error Notification", ref=AttrRef(self, 'notifications_disabled')) ok_button = Button("Ok", action=self.dismiss) col = Column((disable_error_popup, ok_button,), spacing=2) self.add(col) self.shrink_wrap()
def __init__(self, tool): ToolOptions.__init__(self) self.tool = tool self.autoChooseCheckBoxFill = CheckBoxLabel("Open Block Picker for Fill", ref=config.fill.chooseBlockImmediately, tooltipText="When the fill tool is chosen, prompt for a block type.") self.autoChooseCheckBoxReplace = CheckBoxLabel("Open Block Picker for Replace", ref=config.fill.chooseBlockImmediatelyReplace, tooltipText="When the replace tool is chosen, prompt for a block type.") col = Column((Label("Fill and Replace Options"), self.autoChooseCheckBoxFill, self.autoChooseCheckBoxReplace, Button("OK", action=self.dismiss))) self.add(col) self.shrink_wrap()
def __init__(self, tool): ToolOptions.__init__(self, name='Panel.FillToolOptions') self.tool = tool self.autoChooseCheckBoxFill = CheckBoxLabel("Open Block Picker for Fill", ref=config.fill.chooseBlockImmediately, tooltipText="When the fill tool is chosen, prompt for a block type.") self.autoChooseCheckBoxReplace = CheckBoxLabel("Open Block Picker for Replace", ref=config.fill.chooseBlockImmediatelyReplace, tooltipText="When the replace tool is chosen, prompt for a block type.") col = Column((Label("Fill and Replace Options"), self.autoChooseCheckBoxFill, self.autoChooseCheckBoxReplace, Button("OK", action=self.dismiss))) self.add(col) self.shrink_wrap()
def __init__(self, tool): ToolOptions.__init__(self, name='Panel.PlayerSpawnPositionOptions') self.tool = tool self.spawnProtectionCheckBox = CheckBox(ref=AttrRef(tool, "spawnProtection")) self.spawnProtectionLabel = Label("Spawn Position Safety") self.spawnProtectionLabel.mouse_down = self.spawnProtectionCheckBox.mouse_down tooltipText = "Minecraft will randomly move your spawn point if you try to respawn in a column where there are no blocks at Y=63 and Y=64. Only uncheck this box if Minecraft is changed." self.spawnProtectionLabel.tooltipText = self.spawnProtectionCheckBox.tooltipText = tooltipText row = Row((self.spawnProtectionCheckBox, self.spawnProtectionLabel)) col = Column((Label("Spawn Point Options"), row, Button("OK", action=self.dismiss))) self.add(col) self.shrink_wrap()
def __init__(self, tool): ToolOptions.__init__(self, name='Panel.ConstructionToolOptions') self.tool = tool importNudgeLabel = Label("Import Fast Nudge Settings:") importNudgeCheckBox = CheckBoxLabel("Move by the width of schematic ", ref=config.fastNudgeSettings.importWidth, tooltipText="Moves selection by his width") importNudgeNumber = IntInputRow("Width of import movement: ", ref=config.fastNudgeSettings.importWidthNumber, width=100, min=2, max=50) col = Column((Label("Import Options"), importNudgeLabel, importNudgeCheckBox, importNudgeNumber, Button("OK", action=self.dismiss))) self.add(col) self.shrink_wrap()
def __init__(self, tool): ToolOptions.__init__(self, name='Panel.BrushToolOptions') alphaField = FloatField(ref=ItemRef(tool.settings, 'brushAlpha'), min=0.0, max=1.0, width=60) alphaField.increment = 0.1 alphaRow = Row((Label("Alpha: "), alphaField)) autoChooseCheckBox = CheckBoxLabel("Choose Block Immediately", ref=ItemRef(tool.settings, "chooseBlockImmediately"), tooltipText="When the brush tool is chosen, prompt for a block type.") updateOffsetCheckBox = CheckBoxLabel("Reset Distance When Brush Size Changes", ref=ItemRef(tool.settings, "updateBrushOffset"), tooltipText="Whenever the brush size changes, reset the distance to the brush blocks.") col = Column((Label("Brush Options"), alphaRow, autoChooseCheckBox, updateOffsetCheckBox, Button("OK", action=self.dismiss))) self.add(col) self.shrink_wrap() return
def __init__(self, tool): ToolOptions.__init__(self, name='Panel.ConstructionToolOptions') self.tool = tool importNudgeLabel = Label("Import Fast Nudge Settings:") importNudgeCheckBox = CheckBoxLabel( "Move by the width of schematic ", ref=config.fastNudgeSettings.importWidth, tooltipText="Moves selection by his width") importNudgeNumber = IntInputRow( "Width of import movement: ", ref=config.fastNudgeSettings.importWidthNumber, width=100, min=2, max=50) col = Column( (Label("Import Options"), importNudgeLabel, importNudgeCheckBox, importNudgeNumber, Button("OK", action=self.dismiss))) self.add(col) self.shrink_wrap()
def __init__(self, tool): ToolOptions.__init__(self, name='Panel.CloneToolOptions') self.tool = tool self.autoPlaceCheckBox = CheckBox(ref=AttrRef(tool, "placeImmediately")) self.autoPlaceLabel = Label("Place Immediately") self.autoPlaceLabel.mouse_down = self.autoPlaceCheckBox.mouse_down tooltipText = "When the clone tool is chosen, place the clone at the selection right away." self.autoPlaceLabel.tooltipText = self.autoPlaceCheckBox.tooltipText = tooltipText spaceLabel = Label("") cloneNudgeLabel = Label("Clone Fast Nudge Settings") cloneNudgeCheckBox = CheckBoxLabel("Move by the width of selection ", ref=config.fastNudgeSettings.cloneWidth, tooltipText="Moves clone by his width") cloneNudgeNumber = IntInputRow("Width of clone movement: ", ref=config.fastNudgeSettings.cloneWidthNumber, width=100, min=2, max=50) row = Row((self.autoPlaceCheckBox, self.autoPlaceLabel)) col = Column((Label("Clone Options"), row, spaceLabel, cloneNudgeLabel, cloneNudgeCheckBox, cloneNudgeNumber, Button("OK", action=self.dismiss))) self.add(col) self.shrink_wrap()
def __init__(self, tool): ToolOptions.__init__(self) self.tool = tool useStyleBox = CheckBoxLabel(title="Use Bullet Styles", ref=config.nbtTreeSettings.useBulletStyles) self.useStyleBox = useStyleBox useTextBox = CheckBoxLabel(title="Use Bullet Text", ref=config.nbtTreeSettings.useBulletText) self.useTextBox = useTextBox useImagesBox = CheckBoxLabel(title="Use Bullet Images", ref=config.nbtTreeSettings.useBulletImages) self.useImagesBox = useImagesBox bulletFilePath = Row((Button("Bullet Images File", action=self.open_bullet_file), TextFieldWrapped(ref=config.nbtTreeSettings.bulletFileName, width=300)), margin=0) defaultBulletImagesBox = CheckBoxLabel(title="Reset to default", ref=config.nbtTreeSettings.defaultBulletImages) self.defaultBulletImagesBox = defaultBulletImagesBox def mouse_down(e): CheckBox.mouse_down(defaultBulletImagesBox.subwidgets[1], e) self.defaultBulletImagesBox_click(e) defaultBulletImagesBox.subwidgets[1].mouse_down = mouse_down frameContent = Column((defaultBulletImagesBox, bulletFilePath)) color = self.bg_color if len(color) == 4: color = (max(color[0] + 200, 255), max(color[1] + 200, 255), max(color[2] + 200, 255), max(color[3] + 100,255)) else: color = tuple([max([i] * 2, 255) for i in color]) bulletFilePathFrame = Frame(frameContent, border_width=1, border_color=color) bulletFilePathFrame.add_centered(frameContent) def mouse_down(e): if self.bulletFilePath.subwidgets[1].enabled: TextFieldWrapped.mouse_down(self.bulletFilePath.subwidgets[1], e) bulletFilePath.subwidgets[1].mouse_down = mouse_down self.bulletFilePath = bulletFilePath def mouse_down(e): CheckBox.mouse_down(useImagesBox.subwidgets[1], e) for sub in defaultBulletImagesBox.subwidgets: sub.enabled = config.nbtTreeSettings.useBulletImages.get() if type(sub) in (CheckBox, TextFieldWrapped): if config.nbtTreeSettings.useBulletImages.get(): sub.fg_color = fg_color else: sub.fg_color = disabled_color if type(sub) == CheckBox: sub.set_enabled(config.nbtTreeSettings.useBulletImages.get()) self.defaultBulletImagesBox_click(None) useImagesBox.subwidgets[0].mouse_down = useImagesBox.subwidgets[1].mouse_down = mouse_down def mouse_down(e): CheckBox.mouse_down(useStyleBox.subwidgets[1], e) useImagesBox.mouse_down(e) self.useStyleBox_click(e) useStyleBox.subwidgets[0].mouse_down = useStyleBox.subwidgets[1].mouse_down = mouse_down showAllTags = CheckBoxLabel(title="Show all the tags in the tree", ref=config.nbtTreeSettings.showAllTags) col = Column(( Label("NBT Tree Settings"), Row((useStyleBox, useTextBox, useImagesBox)), bulletFilePathFrame, showAllTags, Button("OK", action=self.dismiss), )) self.add(col) self.shrink_wrap() self.useStyleBox_click(None) self.defaultBulletImagesBox_click(None)
def dismiss(self, *args, **kwargs): change_styles() ToolOptions.dismiss(self, *args, **kwargs)