arcade icon indicating copy to clipboard operation
arcade copied to clipboard

GUI enhancements planned for 2.7

Open eruvanos opened this issue 2 years ago • 3 comments

To enhance the GUI code, a few things have to be cleaned which might break compatibility. The goal is to collect all these changes within a bigger update like 2.7.

Summary of breaking changes

  • Removed
    • UIWrapper (it is a UILayout)
    • UIBorder (functionality covered in UIWidget)
    • UIPadding (functionality covered in UIWidget)
    • UITexturePane (functionality covered in UIWidget)
  • Renamed
    • Rect (_Rect)
    • Property (_Property)

Working on development

Planned

  • [ ] UIWidget supports
    • [x] padding
    • [x] border
    • [x] background color
    • [ ] states:
      • [x] visibility,
      • [x] disabled,
      • [x] hover,
      • [x] pressed,
      • [ ] focused
      • [x] maybe use a dict mapping state to style class
  • [x] UIWidgets use observable Property
  • [ ] A consistent styling mechanism is established, variable names match a pattern
  • [x] Rect is used as the space representation on screen
  • [ ] Methods do only contain supported parameters
  • [ ] Missing documentation
    • [ ] UISlider
  • [x] UILayouts shrink and grow children
    • [x] UIAnchorLayout use min_size_hint of UIBoxLayout
    • [x] UIBoxLayout use size_hint to grow children
    • [x] UIBoxLayout respects size_hint_max while growing
    • [x] UIAnchorLayout use size_hint to grow children
    • [x] UIAnchorLayout respects size_hint_max while growing
  • [x] UILayoutManager use size hints
    • [x] UIManager respects size_hint and size_hint_min
  • [ ] UIGridLayout resizes child widgets
  • [x] UIAnchorLayout should behave like a layout (rect set from outside, place children within bounds)
  • [ ] Generate state images (press, hover, ...) from a base image
  • [ ] UIInputText - restrict input to digits (optional)
  • [x] Fix stats_top_left example (fix UILabel not showing text)
  • [ ] Refactor UIMessageBox to fit into general event system
  • [ ] New widgets
    • [ ] UIMenu - a menu like widget, which is at the top/bottom of the screen and provides methods to add sub menus and buttons
    • [ ] UIDigitLabel - provides a UILabel explicit for digits (format support, performant updates)
    • [x] UIGridLayout - Finally arrange widgets within a grid
    • [x] UITexturedSlider (using images for bar and thumb) ⛈️ freeze on some mac
    • [ ] UIToggle - Simple button which switches between on and off state
    • [ ] UIFile - Choose a file dialogue (crazy but possible) #1201
  • [ ] Support NinePatch

Maybe

  • [ ] Support placeholder in text widgets
  • [ ] button supporting an icon in front of text

eruvanos avatar Mar 07 '22 20:03 eruvanos

@eruvanos

UIInputText - restrict input to digits (optional)

By this it means just '0123456789' or python's builtin isdigit functionality?

UIFile - Choose a file dialogue (crazy but possible)

Will this be an inheritance of arcade.window and arcade.gui.UIWidget or just arcade.gui.UIWidget?

Ibrahim2750mi avatar Apr 13 '22 15:04 Ibrahim2750mi

By this it means just '0123456789' or python's builtin isdigit functionality?

Imo, the clearest option for beginners would be subclass that's right-aligned by default and only accepts ints as in #842. We still need a clear way for users to display scores and numbers, even if the details in that ticket are no longer relevant due to major some changes to text rendering.

pushfoo avatar Apr 13 '22 21:04 pushfoo

Progress Info:

  • [x] New simplified UIStyle for UIFlatButton
  • [x] use Property in UIInteractive
  • [x] use Property in UIFlatButton.text
  • [x] Fix size of OKMessageBox
  • [x] test disabled state
  • [x] Add disabled state to UIInteractiveWidget and UISlider
  • [x] Fix size hint example
  • [x] Remove callback from OKMessageBox
  • [x] clean up event flow (window vs widget events)
  • [ ] use UIInteractive for slider, remove redundant disabled implementation

eruvanos avatar Jul 07 '22 21:07 eruvanos

@Ibrahim2750mi do you have some time to have a look on: https://github.com/pythonarcade/arcade/blob/gui/grid_layout/tests/test_gui/test_layouting_gridlayout.py

I added a few tests, which should cover the resize behaviour for UIGridLayout. Maybe you can have a look at the code and fix them, implementing the missing features.

eruvanos avatar Jan 23 '23 22:01 eruvanos

@eruvanos Yeah I am currently free and will definitely look into it, maybe best case scenario even today and will update you on the requested fixes and implementations.

Ibrahim2750mi avatar Jan 24 '23 02:01 Ibrahim2750mi

All work done, everything else will be covered in a minor update

eruvanos avatar Nov 24 '23 22:11 eruvanos