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

Fix GUI for new project reestructure #53

Merged
merged 17 commits into from Jun 12, 2018
Merged

Fix GUI for new project reestructure #53

merged 17 commits into from Jun 12, 2018

Conversation

etiontdn
Copy link
Contributor

@etiontdn etiontdn commented Jun 7, 2018

Made the gui compatible with the new project reestructure.

@brettvanderwerff
Copy link
Owner

@etiontdn Yes I was actually just on my way to say that a few PRs have gone through since the original GUI attempt, including two major project restructuring PRs. It would be good to try and sync you work back up with the master branch. Let me know if you have any questions or if you are having trouble with something.

@etiontdn etiontdn changed the title Fix for new project reestructure Fix GUI for new project reestructure Jun 7, 2018
@etiontdn
Copy link
Contributor Author

etiontdn commented Jun 7, 2018

Ok, fixed the errors and it looks like it works.
Any idea of changes?
I would like you to take a look at the code and see if the docstrings are better understandable.

I found a little bug i think,
It looks like if the .js file is not in a js folder it raises an error any idea why?

@brettvanderwerff
Copy link
Owner

@etiontdn I am at work and can't review this today, but will as soon as possible. I will pay particular attention to comments and will leave a note on anything that may need to be changed. That was a bug I found recently too and opened issue #50 to discuss. I include a possible solution in that thread, take a look and let me know if you have any ideas or input.

@brettvanderwerff
Copy link
Owner

@etiontdn I started working on this, I made a few small changes directly to your branch. I am still going through it. I think the comments have improved overall and the GUI seems functional on my end.

@brettvanderwerff
Copy link
Owner

@etiontdn One thing I have noticed is that if you open the search files button and then back out of the popup, the instructions in the corresponding field disappear. Does this happen to you?

@etiontdn
Copy link
Contributor Author

etiontdn commented Jun 8, 2018

@brettvanderwerff Tested it and happens maybe we should add a validate function that will validate if the entry is empty, path doesn't exist, etc.
Or any other suggestion?

@etiontdn
Copy link
Contributor Author

etiontdn commented Jun 8, 2018

@brettvanderwerff
I added 2 validation functions:

  1. To make sure the user don't leave the clean space in the entries when he quits the file dialog
  2. To check once the user presses the button, it checks whether all the paths exists, if one or more of them doesn't, it will show a pop up error message telling the user which paths had an error

Any feedback or suggestion is welcome!

@brettvanderwerff
Copy link
Owner

@etiontdn I see you made some recent commits. This is a busy weekend for me but I'll take a look at the changes as soon as I can 👍 thanks for being so engaged in the project!

@brettvanderwerff
Copy link
Owner

@etiontdn Nice work here. Validation is super important in addition to being able to have a case to deal with any unintended input a user might make. Please see my comments and let me know if you have any questions. The GUI is getting better with every round of work!


class TestGUI(unittest.TestCase):

def setUp(self):
Copy link
Owner

Choose a reason for hiding this comment

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

I added a setUp here

path = filedialog.askopenfilename(title= "Select the main html file normally index.html",
filetypes=(("Html Files", "*.html"), ("all files", "*.*")))
self.html_location.set(path)
if self.validate_path(path):
Copy link
Owner

Choose a reason for hiding this comment

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

Here it seems to take the path in any case where it is a path to a real file. You could use the endswith('.html') string method to validate that they actually select and html file or something like that. Anytime you have user input be it a gui or a webform the law is "never trust the user". Someone will switch the accept all files, pick a .jpg, and then wonder why it is not working and we need to have things laid out in a way that prevents headaches.

In my opinion it should be like this:

  1. User opens dialog box and selects path to a valid .html file, the path gets presented in the box

  2. User opens dialog box then backs out again right away without selecting anything "Select one HTML file from the template" gets recycled in the box, because nothing has changed really

  3. User opens dialog box and picks anything other than and html file, some informative warning gets presented that they need to pick an html file

and sets the html_location variable with the returned path value.
"""

path = filedialog.askopenfilename(title= "Select the main html file normally index.html",
Copy link
Owner

Choose a reason for hiding this comment

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

Should the title be consistent with "Select one HTML file from the template" because we changed the prompt? I am actually not sure. Same for the others.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes it is the title of the window i think it should be consistent.
It could even have more information since it has more space and etc.

"JS Location"])

def test_path(self):
"""Tests the path_to_folder function from ChooseFilesGUI
Copy link
Owner

Choose a reason for hiding this comment

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

This docstring is a bit difficult to read. I am not 100% sure what this test is doing, so I am not sure how to help you improve it. Could you try to reword it?

return False

def validate_entries(self):
"""Validates all entries and if
Copy link
Owner

Choose a reason for hiding this comment

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

Maybe you can comment back and let me know, but isn't there validation of entries as the user is selecting the paths? I am trying to imagine a scenario of how the user can select invalid entries in the first place and have this function return false.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added it because manual input is an option as well since they are entries the user can type a path or copy & paste on it.

if not js:
self.error_entries.append("'JavaScript File location' ")
if not html or not static or not js:
self.error_message = "There is errors in the entries: "
Copy link
Owner

Choose a reason for hiding this comment

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

There are errors in the following entries:


def get_values(self):
"""Gets the html_location, static_location and js_location
values and sets them to new variables then uses them
Copy link
Owner

Choose a reason for hiding this comment

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

Gets the html_location, static_location and js_location
values for paths to the HTML files, 'static' folder content, and Javascript files of the Bootstrap template. These paths are passed to the StructureDirectory class for flaskerization.

@brettvanderwerff
Copy link
Owner

@etiontdn I went though it and made really small changes, mostly just last minute wording stuff. I want to give you a very special thank you because this was a big undertaking and you were extremely communicative and involved in the project over a long period of time. you did a really good job putting this together and I think it will help make the flaskerizer accessible to some people that would otherwise not use it without a gui. I am merging this now. Thanks again for all the time you spent on making this a great addition.

@brettvanderwerff brettvanderwerff merged commit 99b03d2 into brettvanderwerff:master Jun 12, 2018
@etiontdn
Copy link
Contributor Author

@brettvanderwerff Thanks! The time i spent working on this was learning and contributing to the awesome world that is open source.
I just wanted to say that your project is amazing 👍
And contributing to projects like yours makes me feel amazing as well!
Thanks!

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