ParthJadhav / Tkinter-Designer

An easy and fast way to create a Python GUI 🐍
BSD 3-Clause "New" or "Revised" License
8.96k stars 821 forks source link

feat: improve element resolver and add line element #180

Closed ralphg6 closed 2 years ago

ralphg6 commented 2 years ago

When I build my project some elements were generated as Black Rectangles...

I opened issue #181 to talk about this!

Figma Link: https://www.figma.com/file/figS9H9KQIWrDICdjLWh1g/BB-Escritura%C3%A7%C3%A3o---Central-de-Solu%C3%A7%C3%B5es?node-id=0%3A1 Snippet File Data exported by API:

{
  "document": {
    "id": "0:0",
    "name": "Document",
    "type": "DOCUMENT",
    "children": [
      {
        "id": "0:1",
        "name": "Page 1",
        "type": "CANVAS",
        "children": [
          {
            "id": "1:2",
            "name": "Desktop - 1",
            "type": "FRAME",
            "blendMode": "NORMAL",
            "children": [
              {
                "id": "1:3",
                "name": "Rectangle 1",
                "type": "RECTANGLE",
                "blendMode": "PASS_THROUGH",
                "absoluteBoundingBox": {...},
                "constraints": {...},
                "fills": [{"blendMode": "NORMAL", "type": "SOLID", "color": {...}}],
                "strokes": [],
                "strokeWeight": 1.0
              },
              {
                "id": "1:5",
                "name": "Line 1",
                "type": "LINE",
                "blendMode": "PASS_THROUGH",
                "absoluteBoundingBox": {...},
                "constraints": {...},
                "fills": [],
                "strokes": [{"blendMode": "NORMAL", "type": "SOLID", "color": {...}}],
                "strokeWeight": 5.0
              },
              {
                "id": "1:7",
                "name": "Rectangle 2",
                "type": "RECTANGLE",
                "blendMode": "PASS_THROUGH",
                "absoluteBoundingBox": {...},
                "constraints": {...},
                "fills": [{"blendMode": "NORMAL", "type": "SOLID", "color": {...}}],
                "strokes": [],
                "strokeWeight": 1.0
              },
              {
                "id": "1:8",
                "name": "Abrir DIAR",
                "type": "TEXT",
                "blendMode": "PASS_THROUGH",
                "absoluteBoundingBox": {...},
                "constraints": {...},
                "fills": [{"blendMode": "NORMAL", "type": "SOLID", "color": {...}}],
                "strokes": [],
                "strokeWeight": 1.0
              }
            ],
            "absoluteBoundingBox": {...},
            "constraints": {...},
            "clipsContent": true,
            "background": []
          }
        ],
        "backgroundColor": {...},
        "prototypeStartNodeID": null,
        "flowStartingPoints": [],
        "prototypeDevice": {...}
      }
    ]
  },
  "components": {...},
  "componentSets": {...},
  "schemaVersion": 0,
  "styles": {...},
  "name": "Untitled",
  "lastModified": "2022-01-18T00:25:42Z",
  "thumbnailUrl": "https://s3-alpha-sig.figma.com/thumbnails/5525c6fe-a3aa-47be-8356-6a99d3c3b9fc?Expires=1643587200&Signature=gg8HDn3u6lnfjRzlaPRyEv4c6cxKUbMot5iRFwyk7IRqiKhcicCkmZocH6YKE537obHp~Rr4DFQCKqG3AKP3wPzU6yA~9AaFANJKYikaZzT5u2RhFm1i5m~ZorpM2TTNEAsOe5ZFzW8Z~zl-yTv1zKJh0ZmZUnTR86ZuL~qD3WTGUBNsTjEMlykDn0qSM6GyRO6EZybs47qCZLOXPBLZ1u1sw0ksJw68g6gK6QwYRPgWfcmXQKI55uk95aAP8ObOLRFke3c1ZRhtpdRJlEuKDSBf~LbmzxMWvX5QnmR-45GGiOl6d~PFnb3O7KpWogounAYFhd5vnsIAoW9i7dPtnw__&Key-Pair-Id=APKAINTVSUGEWH5XD5UA",
  "version": "1465422841",
  "role": "owner",
  "editorType": "figma",
  "linkAccess": "inherit"
}

Output console with LATEST Release (1.0.4) and master branch:

Creating Element { name: Rectangle 1, type: RECTANGLE }
Element with the name: `Rectangle 1` cannot be parsed. Would be displayed as Black Rectangle
Creating Element { name: Line 1, type: LINE }
Element with the name: `Line 1` cannot be parsed. Would be displayed as Black Rectangle
Creating Element { name: Rectangle 2, type: RECTANGLE }
Element with the name: `Rectangle 2` cannot be parsed. Would be displayed as Black Rectangle
Creating Element { name: Abrir DIAR, type: TEXT }

Project successfully generated at E:\desenv\Tkinter-Designer\build.

With new code all element was be generated, including line component:

Creating Element { name: Rectangle 1, type: rectangle }
Creating Element { name: Line 1, type: line }
Creating Element { name: Rectangle 2, type: rectangle }
Creating Element { name: Abrir DIAR, type: text }

Project successfully generated at E:\desenv\Tkinter-Designer\build.
ParthJadhav commented 2 years ago

Thanks for adding the Line Feature, I'll test it out soon.

ralphg6 commented 2 years ago

@ParthJadhav got it! Then I go separate the new features into two PRs.

Line Element PR #182

ParthJadhav commented 2 years ago

Hey @ralphg6 Thanks for the PR. I'll be reviewing the changes soon and will get back to you. Sorry for the delay.

ParthJadhav commented 2 years ago

Hey @ralphg6 , Thanks for the changes. I tested them. And it works good. Only thing is. The line element is not able to handle rotation. Which can be a topic for future versions though.

ParthJadhav commented 2 years ago

I'll be merging this.