| 5 | |
| 6 | |
| 7 | class MainWindow extends CustomTkBase{ |
| 8 | |
| 9 | static widgetType = "main_window" |
| 10 | static displayName = "Main Window" |
| 11 | |
| 12 | |
| 13 | static initialSize = { |
| 14 | width: 700, |
| 15 | height: 400 |
| 16 | } |
| 17 | |
| 18 | |
| 19 | constructor(props) { |
| 20 | super(props) |
| 21 | |
| 22 | this.droppableTags = { |
| 23 | exclude: ["image", "video", "media", "main_window", "toplevel"] |
| 24 | } |
| 25 | |
| 26 | this.state = { |
| 27 | ...this.state, |
| 28 | size: { width: 700, height: 400 }, |
| 29 | widgetName: "main", |
| 30 | attrs: { |
| 31 | ...this.state.attrs, |
| 32 | title: { |
| 33 | label: "Window Title", |
| 34 | tool: Tools.INPUT, // the tool to display, can be either HTML ELement or a constant string |
| 35 | toolProps: {placeholder: "Window title", maxLength: 40}, |
| 36 | value: "Main Window", |
| 37 | onChange: (value) => this.setAttrValue("title", value) |
| 38 | }, |
| 39 | logo: { |
| 40 | label: "Window Logo", |
| 41 | tool: Tools.UPLOADED_LIST, |
| 42 | toolProps: {filterOptions: ["image/jpg", "image/jpeg", "image/png"]}, |
| 43 | value: "", |
| 44 | onChange: (value) => this.setAttrValue("logo", value) |
| 45 | } |
| 46 | |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | } |
| 51 | |
| 52 | componentDidMount(){ |
| 53 | this.setAttrValue("styling.backgroundColor", "#23272D") |
| 54 | super.componentDidMount() |
| 55 | // this.setWidgetName("main") // Don't do this as this will cause conflicts while loading names |
| 56 | } |
| 57 | |
| 58 | generateCode(variableName, parent){ |
| 59 | |
| 60 | const backgroundColor = this.getAttrValue("styling.backgroundColor") |
| 61 | const logo = this.getAttrValue("logo") |
| 62 | |
| 63 | const {width, height} = this.getSize() |
| 64 |
nothing calls this directly
no outgoing calls
no test coverage detected