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

Further tweaks and small updates. #6

Merged
merged 16 commits into from
Apr 15, 2021
Merged

Further tweaks and small updates. #6

merged 16 commits into from
Apr 15, 2021

Conversation

patsytau
Copy link

Notable changes:

  • Address field is now a combobox, to prevent users being able to put in an unexpected address. The info dialog suggests that there are only two valid addresses to download to, so this change ensures that only a correct value is used.
  • Reduced some nesting in ptflasher.startflash: reducing the scope helps keep the code readable, and makes it easier to add extra conditions later (should that prove necessary).
  • Abstracted the reading of the config file to a separate function (it was implemented in 2 places).
  • Use a plaintext box for the file path, rather than one that allows formatting.
  • Switch InfoDialog to use a label rather than a read-only text edit box.

Please take these as they are intended: as (hopefully helpful!) suggestions for improvements, rather than criticism of your work. I'm happy to discuss any of the changes.

Patsy added 16 commits April 13, 2021 19:23
The corresponding addresses are stored in the 'userdata'. It's less direct, but allows the user to see a much friendlier option. It means that if there are only two correct addresses, the possibility of a user inserting incorrect values is removed (and the need for validation is similarly removed).

Related to this: reading the config file is now pulled out into a separate function that returns default values on any file read errors.
…g information.

QTextEdit.toPlainText returns the contents as plain text, rather than switching it to plain text most: QPlainTextEdit must be used for that instead.
Not hugely important, but such consi8stency ensures a better UX.
"using" -> "uses" for tense consistency.
remove "either" since there are more than two interfaces.
…nly text edit.

This allows the dialog to be smaller.

With triple-quoted strings, even the indenting whitespace is included as part of the string, so they need to sit against the left-hand side of the file. It's a bit ugly, but c'est la vie :)
It's good practice to reduce the scope of variables as much as possible, and it turns out ptflasher.filedialog can be turned into a local variable inside ptflasher.filesearch.
This makes the order of definitions consistent with their appearence in the dialog itself, and consistency is (almost) always helpful :)
It's idiomatic to just say "if variable:" rather than "if variable != ''".
@pfeerick
Copy link
Owner

At first glance, nothing is jumping out and the code is certanly a lot cleaner than it was.

Not to cast blame (as my Pythonese isn't that great either) but I did wonder what Electr0 was thinking with some of that code. xD

I'll try it on Windows tomorrow, but it is looking better on Linux, and working just fine still.

Not that it matters, but I think the config dialog can be a little shorter now?

@pfeerick
Copy link
Owner

And don't be concerned about offending... all suggestions and constructive criticisms are welcome!

@pfeerick pfeerick merged commit f2448be into pfeerick:main Apr 15, 2021
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