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

Using Player class, added enable/disable buttons #26

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

franzhcs
Copy link
Contributor

@franzhcs franzhcs commented Dec 4, 2015

This commit changes some aspects of the application:

  • created Player class to hold information regarding a player
  • Not highlighting the lines when an UPDATE or SELLING events is triggered (avoid the view to be scrolled up and down)
  • The bid view does not save anymore players
  • Saving mechanism has changed: now using pickle. This means that this will break backwards compatibility with previous version of the players.json
  • Added enabled/disabled buttons for each player in the playersearch.py
  • Code cleanup

@hunterjm I know that your first instinct here would be to not merge this PR. Therefore, I am kindly asking you to give me feedback on the code so that we can work this out together. The idea here is that we are using a class, therefore we can push this object across the views and avoid accessing fields by string (a-la dictionary).Let me know what are your feelings on this commit.

This commit changes some aspects of the application:
- created Player class to hold information regarding a player
- Not highlighting the lines when an UPDATE or SELLING events is triggered (avoid the view to be scrolled up and down)
- The bid view does not save anymore players
- Saving mechanism has changed: now using pickle. This means that this will break backwards compatibility with previous version of the players.json
- Added enabled/disabled buttons for each player in the playersearch.py
- Code cleanup
self.add_player(item, write=False)

class Player():
Copy link
Owner

Choose a reason for hiding this comment

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

I would break this out into it's own file.

@hunterjm
Copy link
Owner

hunterjm commented Dec 4, 2015

Overall, I'm fine with the notion of breaking more of our dicts out into their own objects. We should come up with a file structure for classes that can then be imported into the UI vs declaring them inline, however.

I think backwards compatibility is a HUGE thing. v0.7.1-beta has had over 100 downloads, and v0.7.0-beta had over 300 before I removed the download links (see release api)! If it were just a couple people using it, then I wouldn't mind a backwards compatibility break, but it's more than that.

JSON is also much easier to read than a pickled object. You can open up the file yourself and make some changes.

I propose sticking with json and adding serialization methods to the Player class in order to convert it to JSON for storage.

The way your player class is defined only has the attributes we currently are using as well. I chose to store the entire player search response from EA just in case we wanted to use some of the other attributes later on down the road. Maybe we have a metaData dictionary on the player object so those attributes are still accessible?

Lastly, I would love to see support for loading and saving different player lists in the UI. This would enable people to save a standard version of their lists and remove/disable players for a single session (or maybe export the new list) without modifying the original copy. My idea would be to keep the current active configuration for bidding in .config which would still be the one that loads up by default, but to also include menu options to export/import other configs, which would override or copy the one in .config respectively.

@franzhcs
Copy link
Contributor Author

franzhcs commented Dec 5, 2015

I will work on the serialisation, then. At the beginning I did that and I found very problematic the de-serialisation. If you work with dictionaries, then you are always "hoping" that the key exists. Using classes this is somehow ensured by the concept of class. If you look carefully at my class, there is a details field that contains the same dictionary you were retrieving from EA.

I agree that the JSON file is easier to read but that's out of the scope of the tool. It is actually quite hard, at the moment, to manually modify the players.json file.

Anyway, I will try to polish the current codebase and try to see what I can do with the (de)serialisation.

@hunterjm
Copy link
Owner

hunterjm commented Dec 5, 2015

Thanks for the updates. I'm going to test this out tonight before merging into master since it's a fairly large change.

@franzhcs
Copy link
Contributor Author

franzhcs commented Dec 5, 2015

I am not sure this can be merged as it is. Please report back any problem.. I want to be super-sure before merging to master :)

@hunterjm
Copy link
Owner

hunterjm commented Dec 5, 2015

Alright, I'll be sure to test throughly ;)

@hunterjm
Copy link
Owner

@ElBryan: I'm swamped at work right now, so I probably won't have a chance to review until around Christmas.

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.

3 participants