This pull request consists of improvements and bug fixes - both mostly related to grid rc properties (such as row/col weight).
When changing the grid row or column, it now shows the new grid row/column in the properties section.
Before, it would not update.
When changing the grid row or column, it will now clean up any unused grid row/column properties, such as weight.
For example: let's say you are editing a widget on row 0 with a weight of 1. If you change the row number to 1, it will now reset
the weight to 0. Before, it didn't use to reset the old row/column properties; it kept the old property info and it showed up in the generated code even though it was never used.
Bug fix: Prevent duplicate grid properties from showing up in generated code. This is also related to settings such as grid weight.
For example: if you have:
Then Pygubu would generate the following line, twice:
self.frame1.columnconfigure(0, weight='1')
self.frame1.columnconfigure(0, weight='1')
Because there are 2 widgets with the same weight. Now with this pull request, duplicate lines like the one above are prevented from showing up in the generated code.
It will only show up one time:
self.frame1.columnconfigure(0, weight='1')
Bug fix: Before when pasting or duplicating a widget that uses grid, the pasted item would end up having the same grid row/column as the original widget, and it would overlap. This would make it seem like pasting or duplicating never worked, but in fact the new widget was on top of the old widget.
Now with this pull request, pasting or duplicating a widget that is using grid will increase the row by 1 automatically. It was supposed to do this before apparently, but the code didn't seem to work right.
So this pull request fixes it.
Bug fix: when widget rows/columns were changed using Edit -> Widget grid (or the shortcut keys), the widget row/col properties (such as weight) would not change to reflect the new row or column that it was moved to. Now the Layout tab in the designer will show/update the widgets' row/col options if the row/col changes.
When a new widget is added (or pasted or duplicated), before it would not show the shared grid row/column properties that already exist.
For example, before if we had a widget at column 0 with a weight of 1, and you added a new widget to column 0, the properties pane would not show a weight of 1. It would show a weight of 0.
Now, it shows the correct properties based on the widgets' siblings.
Fixed a bug where the preview canvas sometimes refreshes too soon when grid rc property changes are made (such as changing the weight). Depending on the UI, this sometimes caused the preview canvas to not show the latest preview. However, in cases like this, the generated code was still correct - it only affected the preview canvas.
Now, with this pull request, the preview canvas is updated after all the grid rc changes have been made.
Here is a real example screenshot of what the problem looked like:
Pass the 'show_context_menu' method to PreviewHelper instead of the app object.
It makes it easier to understand what's happening. This is a small change.
This pull request consists of improvements and bug fixes - both mostly related to grid rc properties (such as row/col weight).
When changing the grid row or column, it now shows the new grid row/column in the properties section. Before, it would not update.
When changing the grid row or column, it will now clean up any unused grid row/column properties, such as weight. For example: let's say you are editing a widget on row 0 with a weight of 1. If you change the row number to 1, it will now reset the weight to 0. Before, it didn't use to reset the old row/column properties; it kept the old property info and it showed up in the generated code even though it was never used.
Bug fix: Prevent duplicate grid properties from showing up in generated code. This is also related to settings such as grid weight. For example: if you have:
Then Pygubu would generate the following line, twice: self.frame1.columnconfigure(0, weight='1') self.frame1.columnconfigure(0, weight='1')
Because there are 2 widgets with the same weight. Now with this pull request, duplicate lines like the one above are prevented from showing up in the generated code.
It will only show up one time:
Bug fix: Before when pasting or duplicating a widget that uses grid, the pasted item would end up having the same grid row/column as the original widget, and it would overlap. This would make it seem like pasting or duplicating never worked, but in fact the new widget was on top of the old widget. Now with this pull request, pasting or duplicating a widget that is using grid will increase the row by 1 automatically. It was supposed to do this before apparently, but the code didn't seem to work right. So this pull request fixes it.
Bug fix: when widget rows/columns were changed using Edit -> Widget grid (or the shortcut keys), the widget row/col properties (such as weight) would not change to reflect the new row or column that it was moved to. Now the Layout tab in the designer will show/update the widgets' row/col options if the row/col changes.
When a new widget is added (or pasted or duplicated), before it would not show the shared grid row/column properties that already exist. For example, before if we had a widget at column 0 with a weight of 1, and you added a new widget to column 0, the properties pane would not show a weight of 1. It would show a weight of 0. Now, it shows the correct properties based on the widgets' siblings.
Fixed a bug where the preview canvas sometimes refreshes too soon when grid rc property changes are made (such as changing the weight). Depending on the UI, this sometimes caused the preview canvas to not show the latest preview. However, in cases like this, the generated code was still correct - it only affected the preview canvas. Now, with this pull request, the preview canvas is updated after all the grid rc changes have been made.
Here is a real example screenshot of what the problem looked like: