Skip to content

Conversation

@stlehmann
Copy link
Owner

The purpose of this PR is to make the great AdsSymbol class even more Pythonic by:

  • replacing setter/getter functions by properties
  • Allowing immediate writing of the value to the plc if auto_update is True

Automatically write value to plc if auto_update is True.
@stlehmann stlehmann changed the title Make AdsSymbol more Pythonic Make AdsSymbol even more Pythonic Feb 10, 2021
@stlehmann stlehmann changed the title Make AdsSymbol even more Pythonic Make AdsSymbol even more pythonic Feb 10, 2021
@coveralls
Copy link

coveralls commented Feb 10, 2021

Pull Request Test Coverage Report for Build 556

  • 26 of 26 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.06%) to 94.401%

Totals Coverage Status
Change from base Build 544: 0.06%
Covered Lines: 1096
Relevant Lines: 1161

💛 - Coveralls

@stlehmann stlehmann marked this pull request as ready for review February 10, 2021 10:06
@stlehmann stlehmann marked this pull request as draft February 10, 2021 10:06
@stlehmann
Copy link
Owner Author

@RobertoRoos I made some minor API-changes to make AdsSymbol class more pythonic. You might want to have a look at it and tell me if you approve it.

pyads/symbol.py Outdated
"""
self._value = val
# write value to plc if auto_update is enabled
if self._auto_update_handle is not None:
Copy link
Contributor

Choose a reason for hiding this comment

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

I think if self.auto_update it's a little easier to read.

Copy link
Owner Author

Choose a reason for hiding this comment

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

That's a good suggestion. I implemented the auto_update property after the value property so I didn' t see this. I will change it.

@RobertoRoos
Copy link
Contributor

I am personally not the biggest fan of magic properties, but I understand this is considered good practice.

Placed a teeny-tiny comment, I like your changes. Thank you for asking me.

@stlehmann
Copy link
Owner Author

@RobertoRoos thanks for having a quick look at it :)

@stlehmann stlehmann marked this pull request as ready for review February 11, 2021 09:52
@stlehmann stlehmann merged commit fe0ced6 into master Feb 11, 2021
@stlehmann stlehmann deleted the symbol branch February 11, 2021 15:19
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.

4 participants