alejandroautalan / pygubu

A simple GUI builder for the python tkinter module
MIT License
2.04k stars 213 forks source link

Remove redundant gridrc properties. #250

Closed jrezai closed 3 years ago

jrezai commented 3 years ago

In this pull request, gridrc properties such as weight='0', are removed automatically.

Current Problem: Redundant code is generated for grid rc properties if they have a value of '0' or a blank string. To reproduce this problem, follow these steps:

  1. Change the weight of any widget to 1
  2. Change it back to 0
  3. Generate the code and you will see that it will generate weight='0', but it's not needed at all.

The problem applies to: minsize, pad, weight, uniform

Proposed Solution: If the gridrc value of a widget changes to a zero (for minsize, pad, weight), remove the gridrc setting completely, because it's not needed if the value is zero.

If the uniform value is a blank string, remove the property completely, because it's not needed if the value is a blank string. gridrc_before gridrc_after