Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor Remove/Empty/Destroy #462

Closed
jarvisteach opened this issue Jun 1, 2018 · 5 comments
Closed

Refactor Remove/Empty/Destroy #462

jarvisteach opened this issue Jun 1, 2018 · 5 comments
Milestone

Comments

@jarvisteach
Copy link
Owner

I'm not happy with how appJar removes widgets.

There are a few scenarios we should support:

  • Hiding/Showing a widget
  • Disabling/enabling a widget
  • Destroying a widget
  • Emptying a widget

At the moment we provide:

  • .disable XXX (name)
  • .enable XXX (name)
  • .hide XXX (name)
  • .show XXX (name)
  • .remove XXX (name)
  • .removeAllWidgets()

I propose:

  • Introducing a new function: .empty XXX (name)
  • Renaming remove to destroy
  • Making .removeAllWidgets() a shortcut to .empty XXX(topLevel)
@jarvisteach jarvisteach added this to the 1.0 milestone Jun 1, 2018
@jarvisteach
Copy link
Owner Author

jarvisteach commented Jun 1, 2018

The above functions are auto generated, and call .xxxWidgetType(kind, name)

.removeAllWidgets(True) if called when within a container should only empty that container, but I don't think it cleans out the widget manager, and it's not documented. But I'd rather not have to open the container to clear it...

@jarvisteach
Copy link
Owner Author

Bringing this across from issue #423

A common use case is to clear & repopulate a container.

This isn't straight-forward enough.

The code is already there in removeAllWidgets - it just needs adapting to be applied to a specific container.

It would also be good to be able to reset or keep the container settings in _prepContainer

  • type - shouldn't change
  • title - shouldn't change
  • container - shouldn't change
  • emptyRow - should change
  • colCount - should change
  • sticky - shouldn't change
  • padx - shouldn't change
  • pady - shouldn't change
  • ipadx - shouldn't change
  • ipady - shouldn't change
  • expand - shouldn't change
  • widgets - should change
  • inputFont - shouldn't change
  • labelFont - shouldn't change
  • buttonFont - shouldn't change
  • fg - shouldn't change

jarvisteach added a commit that referenced this issue Aug 4, 2018
issues #462, #497, #423
New functions:
* emptyXXX - allows a named container to be emptied
* emptyCurrentContainer - allows the current container to be emptied
* destroyAllSubWindows - deletes all subWindows in the GUI

Changed:
* removeAllWidgets - will only empty main GUI, unless `current` is set to True, in which case it will empty current container, and/or `sub` is set to `True` which will then delete all subWindows
@jarvisteach
Copy link
Owner Author

jarvisteach commented Aug 4, 2018

Getting there! - remove/empty/destroy are all (just about) sharing the same code.

Only thing left is container settings & _initVars.
The following vars exist at the GUI level, but should be moved around:

  • doFlash - This should exist for each label, can check length of flashLabel array, and if greater than 0, loop through and check each one's doFlash setting...
  • validateNumeric & validateSpinBox - These should be refactored into the entry class:
  • hasTitleBar - should probably exist for all windows?
  • winIcon - should probably exist for all windows?
  • labWidth - not even used, but should exist for all containers...
  • splashConfig - GUI setting
  • dnd - GUI setting
  • accessMade - GUI setting, BUT need to make sure it's not deleted?

jarvisteach added a commit that referenced this issue Aug 4, 2018
`_initvars` removed, global vars moved to GUI constructor. No new container settings introduced.

`labWidth` removed, `accessMade` updated appropriately.
jarvisteach added a commit that referenced this issue Aug 6, 2018
Introduced a `SKIP_CLEANSE` property to widgets that can be skipped during cleansing.
jarvisteach added a commit that referenced this issue Aug 7, 2018
jarvisteach added a commit that referenced this issue Aug 21, 2018
@jarvisteach
Copy link
Owner Author

Where we're at:

  • doFlash - will leave as global, minimal use case
  • hasTitleBar - separate issue Add Menubars/Toolbars/Statusbars to Subwindows #508
  • winIcon - now stored in each window
  • labWidth - removed - could be reintroduced as container property
  • validateNumeric & validateSpinBox - moved into new issue Entry Update Backlog #527
  • accessMade - reset on removeAll
  • splashConfig - GUI setting
  • dnd - GUI setting

@jarvisteach
Copy link
Owner Author

Closing as I think it's all done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant