added widget images
BIN
src/frameworks/tkinter/assets/widgets/Toplevel.png
Normal file
|
After Width: | Height: | Size: 6.0 KiB |
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 12 KiB |
BIN
src/frameworks/tkinter/assets/widgets/check.png
Normal file
|
After Width: | Height: | Size: 8.1 KiB |
BIN
src/frameworks/tkinter/assets/widgets/dropdown.png
Normal file
|
After Width: | Height: | Size: 24 KiB |
BIN
src/frameworks/tkinter/assets/widgets/frame.png
Normal file
|
After Width: | Height: | Size: 3.9 KiB |
BIN
src/frameworks/tkinter/assets/widgets/frame2.png
Normal file
|
After Width: | Height: | Size: 5.1 KiB |
BIN
src/frameworks/tkinter/assets/widgets/input.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
src/frameworks/tkinter/assets/widgets/label.png
Normal file
|
After Width: | Height: | Size: 10 KiB |
BIN
src/frameworks/tkinter/assets/widgets/mainwindow.jpg
Normal file
|
After Width: | Height: | Size: 3.9 KiB |
BIN
src/frameworks/tkinter/assets/widgets/mainwindow.png
Normal file
|
After Width: | Height: | Size: 7.0 KiB |
BIN
src/frameworks/tkinter/assets/widgets/radio.png
Normal file
|
After Width: | Height: | Size: 19 KiB |
BIN
src/frameworks/tkinter/assets/widgets/slider.png
Normal file
|
After Width: | Height: | Size: 6.4 KiB |
BIN
src/frameworks/tkinter/assets/widgets/textarea.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
src/frameworks/tkinter/assets/widgets/widget.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
@@ -1,7 +1,5 @@
|
||||
|
||||
import Widget from "../../canvas/widgets/base"
|
||||
|
||||
import ButtonWidget from "./assets/widgets/button.png"
|
||||
import { CheckBox, RadioButton } from "./widgets/ checkButton"
|
||||
import Button from "./widgets/button"
|
||||
import Frame from "./widgets/frame"
|
||||
@@ -12,71 +10,83 @@ import OptionMenu from "./widgets/optionMenu"
|
||||
import Slider from "./widgets/slider"
|
||||
import TopLevel from "./widgets/toplevel"
|
||||
|
||||
import MainWindowImage from "./assets/widgets/mainwindow.png"
|
||||
import TopLevelImage from "./assets/widgets/Toplevel.png"
|
||||
import FrameImage from "./assets/widgets/frame2.png"
|
||||
import LabelImage from "./assets/widgets/label.png"
|
||||
import ButtonImage from "./assets/widgets/button.png"
|
||||
import InputImage from "./assets/widgets/input.png"
|
||||
import TextAreaImage from "./assets/widgets/textarea.png"
|
||||
import SliderImage from "./assets/widgets/slider.png"
|
||||
import DropDownImage from "./assets/widgets/dropdown.png"
|
||||
import CheckButtonImage from "./assets/widgets/check.png"
|
||||
import RadioButtonImage from "./assets/widgets/radio.png"
|
||||
|
||||
|
||||
const TkinterSidebar = [
|
||||
{
|
||||
name: "Main window",
|
||||
img: ButtonWidget,
|
||||
img: MainWindowImage,
|
||||
link: "https://github.com",
|
||||
widgetClass: MainWindow
|
||||
},
|
||||
{
|
||||
name: "Top Level",
|
||||
img: ButtonWidget,
|
||||
img: TopLevelImage,
|
||||
link: "https://github.com",
|
||||
widgetClass: TopLevel
|
||||
},
|
||||
{
|
||||
name: "Frame",
|
||||
img: ButtonWidget,
|
||||
img: FrameImage,
|
||||
link: "https://github.com",
|
||||
widgetClass: Frame
|
||||
},
|
||||
{
|
||||
name: "Label",
|
||||
img: ButtonWidget,
|
||||
img: LabelImage,
|
||||
link: "https://github.com",
|
||||
widgetClass: Label
|
||||
},
|
||||
{
|
||||
name: "Button",
|
||||
img: ButtonWidget,
|
||||
img: ButtonImage,
|
||||
link: "https://github.com",
|
||||
widgetClass: Button
|
||||
},
|
||||
{
|
||||
name: "Entry",
|
||||
img: ButtonWidget,
|
||||
img: InputImage,
|
||||
link: "https://github.com",
|
||||
widgetClass: Input
|
||||
},
|
||||
{
|
||||
name: "Text",
|
||||
img: ButtonWidget,
|
||||
img: TextAreaImage,
|
||||
link: "https://github.com",
|
||||
widgetClass: Text
|
||||
},
|
||||
{
|
||||
name: "CheckBox",
|
||||
img: ButtonWidget,
|
||||
img: CheckButtonImage,
|
||||
link: "https://github.com",
|
||||
widgetClass: CheckBox
|
||||
},
|
||||
{
|
||||
name: "Radio button",
|
||||
img: ButtonWidget,
|
||||
img: RadioButtonImage,
|
||||
link: "https://github.com",
|
||||
widgetClass: RadioButton
|
||||
},
|
||||
{
|
||||
name: "Scale",
|
||||
img: ButtonWidget,
|
||||
img: SliderImage,
|
||||
link: "https://github.com",
|
||||
widgetClass: Slider
|
||||
},
|
||||
{
|
||||
name: "Option Menu",
|
||||
img: ButtonWidget,
|
||||
img: DropDownImage,
|
||||
link: "https://github.com",
|
||||
widgetClass: OptionMenu
|
||||
},
|
||||
|
||||
81
src/frameworks/tkinter/widgets/spinBox.js
Normal file
@@ -0,0 +1,81 @@
|
||||
import Widget from "../../../canvas/widgets/base"
|
||||
import Tools from "../../../canvas/constants/tools"
|
||||
import { removeKeyFromObject } from "../../../utils/common"
|
||||
|
||||
|
||||
class SpinBox extends Widget{
|
||||
|
||||
static widgetType = "spin_box"
|
||||
constructor(props) {
|
||||
super(props)
|
||||
|
||||
this.droppableTags = null // disables drops
|
||||
|
||||
const newAttrs = removeKeyFromObject("layout", this.state.attrs)
|
||||
|
||||
this.state = {
|
||||
...this.state,
|
||||
size: { width: 120, height: 40 },
|
||||
attrs: {
|
||||
...newAttrs,
|
||||
styling: {
|
||||
...newAttrs.styling,
|
||||
foregroundColor: {
|
||||
label: "Foreground Color",
|
||||
tool: Tools.COLOR_PICKER, // the tool to display, can be either HTML ELement or a constant string
|
||||
value: "#000",
|
||||
onChange: (value) => {
|
||||
this.setWidgetStyling("color", value)
|
||||
this.setAttrValue("styling.foregroundColor", value)
|
||||
}
|
||||
}
|
||||
},
|
||||
placeHolder: {
|
||||
label: "PlaceHolder",
|
||||
tool: Tools.INPUT, // the tool to display, can be either HTML ELement or a constant string
|
||||
toolProps: {placeholder: "text", maxLength: 100},
|
||||
value: "placeholder text",
|
||||
onChange: (value) => this.setAttrValue("placeHolder", value)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
componentDidMount(){
|
||||
super.componentDidMount()
|
||||
this.setAttrValue("styling.backgroundColor", "#fff")
|
||||
this.setWidgetName("Entry")
|
||||
}
|
||||
|
||||
getToolbarAttrs(){
|
||||
|
||||
const toolBarAttrs = super.getToolbarAttrs()
|
||||
|
||||
return ({
|
||||
id: this.__id,
|
||||
widgetName: toolBarAttrs.widgetName,
|
||||
placeHolder: this.state.attrs.placeHolder,
|
||||
size: toolBarAttrs.size,
|
||||
|
||||
...this.state.attrs,
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
renderContent(){
|
||||
return (
|
||||
<div className="tw-w-flex tw-flex-col tw-w-full tw-h-full tw-rounded-md tw-overflow-hidden">
|
||||
<div className="tw-p-2 tw-w-full tw-h-full tw-flex tw-place-items-center" style={this.state.widgetStyling}>
|
||||
<div className="tw-text-sm tw-text-gray-300">
|
||||
{this.getAttrValue("placeHolder")}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
export default SpinBox
|
||||