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

wxGUI/console: Adding prompt string to command prompt #2718

Closed

Conversation

lindakarlovska
Copy link
Contributor

@lindakarlovska lindakarlovska commented Dec 25, 2022

This PR adds input prompt to Console in order to clarify beginners that they are supposed to write their commands here. Follows the idea given in #2585.

Screenshot from 2022-12-27 14-37-09

@lindakarlovska lindakarlovska added GUI wxGUI related enhancement New feature or request labels Dec 25, 2022
@lindakarlovska lindakarlovska added this to the 8.3.0 milestone Dec 25, 2022
@veroandreo
Copy link
Contributor

Hi Linda!
I'm wondering: Is there a reason to not use > similar to the GRASS terminal and Python console? I find the <-- a bit confusing... does the user write before or after the arrow?

@lindakarlovska lindakarlovska changed the title wxGUI/console: Adding input <-- to command prompt wxGUI/console: Adding prompt string to command prompt Dec 27, 2022
@lindakarlovska
Copy link
Contributor Author

lindakarlovska commented Dec 27, 2022

Hi Linda! I'm wondering: Is there a reason to not use > similar to the GRASS terminal and Python console? I find the <-- a bit confusing... does the user write before or after the arrow?

Hi Vero, I am not sure about >, do you mean the >>> which is used in Python console? If yes, I agree. I first wanted to use a sys module variable for a prompt string (https://docs.python.org/3/library/sys.html) but for some reason sys.ps1 and sys.ps2 were not defined and only sys.ps3 worked.

@lindakarlovska lindakarlovska marked this pull request as ready for review December 27, 2022 13:55
@tmszi
Copy link
Member

tmszi commented Dec 29, 2022

Perhaps the >_ symbol would be more appropriate, since the >>> symbol is a Python shell prompt, which the wxGUI Console is not. It can be misleading.

@veroandreo
Copy link
Contributor

Perhaps the >_ symbol would be more appropriate, since the >>> symbol is a Python shell prompt, which the wxGUI Console is not. It can be misleading.

I tend to agree, either >_ or simply >

@lindakarlovska
Copy link
Contributor Author

lindakarlovska commented Jan 1, 2023

Perhaps the >_ symbol would be more appropriate, since the >>> symbol is a Python shell prompt, which the wxGUI Console is not. It can be misleading.

I tend to agree, either >_ or simply >

Just realized that for example the Python Shell prompt in Spyder is also interesting - it uses "In [1]:" where the number 1, 2, etc. refers to the order of executed commands.

@tmszi
Copy link
Member

tmszi commented Jan 1, 2023

Or we can distinguish between console prompt symbol according OS:

GNU/Linux and Unix-like (Free/OpenBSD, macOS) terminal uses the prompt symbol $.

MS Windows CMD uses the prompt symbol >.

@lindakarlovska
Copy link
Contributor Author

Or we can distinguish between console prompt symbol according OS:

GNU/Linux and Unix-like (Free/OpenBSD, macOS) terminal uses the prompt symbol $.

MS Windows CMD uses the prompt symbol >.

I am still not sure if this one sign (may it be $ or >) truly helps beginners to get oriented. What about something like username:~$ (for all OS options)?

@tmszi
Copy link
Member

tmszi commented Jan 2, 2023

I am still not sure if this one sign (may it be $ or >) truly helps beginners to get oriented. What about something like username:~$ (for all OS options)?

I'm ok with it, but for GRASS GIS under MS Windows, it would be better to use e.g. C:\Users\IEUser> style used by CMD or Powershell.

@lindakarlovska
Copy link
Contributor Author

lindakarlovska commented Jan 2, 2023

I am still not sure if this one sign (may it be $ or >) truly helps beginners to get oriented. What about something like username:~$ (for all OS options)?

I'm ok with it, but for GRASS GIS under MS Windows, it would be better to use e.g. C:\Users\IEUser> style used by CMD or Powershell.

Yes @tmszi, I agree. I looked under Windows and GRASS's independent CMD actually also uses this C:\Users\IEUser> for GRASS's CMD:
windows

When I looked under my Ubuntu, it is different, it uses location@mapset:grass > style:
Screenshot from 2023-01-02 07-45-16

First I thought to preserve that style exactly as it is. The first style for Windows and the second one for Unix-like systems.

But for Unix-like systems, I am not sure how the Console prompt should behave when a user switches to a different mapset. Should the prompt string be also changed? Probably yes and then it is getting a bit complicated. :-)

So maybe the variant with username > for Unix-like systems is the most similar to the current state and we do not need to care of some outer changes. (Just thoughts that when we do that once we would find the solution that would be as user-friendly and natural as possible).

@tmszi
Copy link
Member

tmszi commented Jan 2, 2023

So maybe the variant with username > for Unix-like systems is the most similar to the current state and we do not need to care of some outer changes. (Just thoughts that when we do that once we would find the solution that would be as user-friendly and natural as possible).

I overlooked that even on Unix-like OS systems (terminal) GRASS GIS use the > prompt symbol instead of $.

Yes I agree as you suggest, let's use the username > style for the wxGUI Console prompt on all OS.

@lindakarlovska lindakarlovska removed the request for review from petrasovaa January 2, 2023 10:48
@petrasovaa
Copy link
Contributor

Honestly, I am not convinced about this. It's basically a workaround because we can't use real shell here, it introduces a lot of new code to maintain and it will likely introduce new bugs. For example type something, select everything and use backspace - it doesn't work. Another one: select all and type any letter - I am not able to use the console anymore. This approach requires handling a lot of edge cases to make it work in a robust way.

I was wondering a different solution would work better (maybe not): When there is no focus on the console and it's empty, it would display grayish text (e.g. something like "Type command here and press Enter") and then on focus the text would disappear. When the widget looses focus, it would test if it's empty and if yes, it would show the help text again. I think this could potentially be easier to implement.

If that doesn't work we could try to keep this solution but it needs to be really well tested. In terms of the prompt I think ' > ' should be enough.

@hellik
Copy link
Member

hellik commented Jan 2, 2023

I was wondering a different solution would work better (maybe not): When there is no focus on the console and it's empty, it would display grayish text (e.g. something like "Type command here and press Enter") and then on focus the text would disappear. When the widget looses focus, it would test if it's empty and if yes, it would show the help text again.

I concur here regarding usability

@lindakarlovska
Copy link
Contributor Author

Implemented according to the suggestion #2718 (comment) in #2728 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request GUI wxGUI related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants