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

Add a new SimpleRenderer to handle simple cases. #2279

Merged
merged 12 commits into from Jun 17, 2021

Conversation

andydotxyz
Copy link
Member

@andydotxyz andydotxyz commented Jun 6, 2021

Description:

Easiest usage is to return NewSimpleRenderer(myObj) from CreateRenderer

Fixes #709

Checklist:

  • Tests included.
  • Lint and formatter run with no errors.
  • Tests all pass.
  • Public APIs match existing style.

dialog/color_picker.go Show resolved Hide resolved
widget/entry_password.go Outdated Show resolved Hide resolved
widget/entry_validation.go Outdated Show resolved Hide resolved
@andydotxyz andydotxyz requested a review from fpabl0 June 7, 2021 08:01
widget/widget.go Outdated
// a single fyne.CanvasObject.
//
// Since: 2.1
type SimpleRenderer = internalWidget.SimpleRenderer
Copy link
Member

@fpabl0 fpabl0 Jun 7, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be changed to:

func NewSimpleRenderer(object fyne.CanvasObject) *internalWidget.SimpleRenderer {
	return internalWidget.NewSimpleRenderer(object)
}

Otherwise, there is no way to use SimpleRenderer outside the Fyne repo.
Also I think that with this change every usage of SimpleRenderer in this package (widget) should use NewSimpleRenderer instead of internalWidget.NewSimpleRenderer (to keep consistency).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I missed the NewSimpleRenderer, and I will update the usages.
However the alias should remain, as we should not return internal objects from our public API.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I missed the NewSimpleRenderer, and I will update the usages.

You're welcome :)

However the alias should remain, as we should not return internal objects from our public API.

Agree 👍

@andydotxyz andydotxyz requested a review from fpabl0 June 7, 2021 09:00
@fpabl0
Copy link
Member

fpabl0 commented Jun 7, 2021

@andydotxyz I wonder if we should use fyne.WidgetRenderer directly instead of introducing a new type to the public API, in that way SimpleRenderer could be a private type simpleRenderer. By doing this we ensure that nobody tries to use the simple renderer as &SimpleRenderer{}. What do you think?

@andydotxyz
Copy link
Member Author

Good question. Initially I was following the internal renderers etc and they have exposed methods (like SetObjects).
As this one doesn't we could return fyne.WidgetRenderer just now and revise it later if we need to add methods.

Copy link
Member

@fpabl0 fpabl0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just some comments :)

widget/form.go Outdated Show resolved Hide resolved
dialog/color_picker.go Outdated Show resolved Hide resolved
@andydotxyz andydotxyz requested a review from fpabl0 June 14, 2021 20:25
Copy link
Member

@fpabl0 fpabl0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! :)

@andydotxyz andydotxyz merged commit 42898f5 into fyne-io:develop Jun 17, 2021
@andydotxyz andydotxyz deleted the feature/simplerenderer branch June 17, 2021 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants