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

Create text UI inspired by Turbo Vision #2177

Merged
merged 38 commits into from Dec 7, 2017

Conversation

HebaruSan
Copy link
Member

@HebaruSan HebaruSan commented Nov 7, 2017

CKAN Console UI

There has been discussion lately of replacing CKAN's current WinForms GUI with a GTK# one (#1840), as well as of enhancing the CmdLine interface (#2161, #2174). While this pull request doesn't do either of those things, I think it's related and may satisfy some of the needs that inspired those requests.

This pull request adds a new cross-platform UI modeled after the pre-Windows text interfaces of the late 1980s and early 1990s such as Borland's Turbo Vision and IBM's Common User Access, influenced by the Debian package management application "aptitude", with a few modern tweaks. I hope it can provide value in the niche between a full-on GUI and somewhat cumbersome command line tools.

Status: Open for more feedback, but probably ready to merge

I think this project is pretty complete; I've addressed all bugs that I was able to find and added all the reasonable features I could think of. However, my knowledge of CKAN is not as deep or thorough as others', so there's a good chance I missed something. Please help me find:

  • Unhandled exceptions/crashes and other bugs
  • Missing features
  • Better names for anything and everything
  • Colors that are hard to read
  • Bad layout
  • How to make useful tests
  • Whether the key bindings work on MacOS X
  • Etc.

I developed this on Linux and also tested in a Windows VM.
I do not have a Mac available for testing.

New-ish features

Dependencies

There are no third party dependencies; the whole thing is built directly on top of Console.BackgroundColor, Console.SetCursorPosition, etc., using classes contained in the CKAN\ConsoleUI\Toolkit folder (all written by me and kosher to release under CKAN's license). This has several advantages:

  • No risk that a library we depend on will disappear or cease to be supported
  • No risk of being affected by bugs we can't fix in a third party package
  • We can safely extend the toolkit with more UI elements and refactor whatever we like as needed
  • Strong cross-platform support, since it can run anywhere .NET and Mono can

Screenshots

When you run ckan consoleui, a futuristic splash/loading screen appears:

image

image

If you have a default game instance, the next screen is the list of mods:

image

In modern style, the top right corner features a search box:

image

... which can also search by @author:

image

... as well as a dropdown "hamburger" menu for less commonly accessed functions:

image

... including sorting the list:

image

After you update the registry, it alerts you to any newly added mods, since that's a common request on the forum thread:

image

image

A help screen summarizes the key bindings and special search formats:

image

You can press enter on the mod list screen to view detailed information about a mod, including relationships, versions, and the text description:

image

Pressing Ctrl+D on that screen jumps you to an abbreviated version of the install screen to download the mod:

image

Another screen allows the user to work with game instances; this is the first screen if you have no default instance:

image

(This was how I found the issue fixed by #2175.)

image

The user can create and edit game instances on this screen:

image

Once you've selected some mods to install, F9 takes you to the installation screen, which first prompts you to select any needed dependencies:

image

image

Then confirms the installation:

image

(This was why I wanted to simplify IUser in #2163.)

Then performs the downloads and installs:

image

@pjf pjf removed the In progress We're still working on this label Nov 7, 2017
@HebaruSan HebaruSan requested review from Olympic1 and politas Nov 7, 2017
@dbent
Copy link
Member

dbent commented Nov 7, 2017

I think I'm in love.

@HebaruSan HebaruSan requested a review from dbent Nov 7, 2017
@politas
Copy link
Member

politas commented Nov 9, 2017

This is awesome! I especially love the splash screen! I'd say it reminds me of things "back in the day", but it also strongly reminds me of the Midnight Commander, which I use every day.

@politas
Copy link
Member

politas commented Nov 9, 2017

@KSP-CKAN/macos-testers, any chance y'all can give this a try?

@HebaruSan
Copy link
Member Author

@KSP-CKAN/macos-testers, any chance y'all can give this a try?

That group has only one member other than you; maybe I can recruit people who submitted Mac-related issues... @Maxzhao1999, would you be available to report bugs on a Mac? I can provide a compiled EXE for testing, just let me know.

I started another branch locally to add support for the current head of #1888. Hopefully git won't make it too difficult to keep it up to date with both projects.

@HebaruSan
Copy link
Member Author

Attempting to rope in some more admitted Mac users from #760 and #1334: @bax-, @alampros, @savagerose, @Heliosmaster, @desplesda, @mgsdk, @RichardLake, @Crazor, @CalMlynarczyk

Would any of you be willing to take the changes from this PR for a test drive on your Mac? Compiled EXE available upon request.

@Maxzhao1999
Copy link

I’d love to help! Just tell me what you want me to do and I’ll try it out this weekend.

@HebaruSan
Copy link
Member Author

HebaruSan commented Nov 10, 2017

@Maxzhao1999 , that's fantastic, thank you!!

  • (Download removed; see subsequent post for more up to date versions)

If you unzip that file, there should be a ckan.exe inside. Try this:

  1. Open a Terminal
  2. cd to the directory where you unzipped the file
  3. Run mono ckan.exe consoleui

That should get you into the new screens. To the best of my knowledge, no one has run this on OSX at all yet, so for all I know it may not even run, or it may be completely unusable. I'm interested to know about any problems that you find in trying typical use cases, but especially cases where it works differently than it does on Windows or Linux.

  • View the list of mods and scroll through it
  • View info about a mod and download it
  • Install a mod
  • Uninstall a mod
  • Quit the program
  • Etc.

I am mostly concerned about the key bindings, since I had to make platform-specific adjustments to get them working the same way on Linux and Windows. Keep an eye on the bottom bar where key bindings are listed, and check the F10 menu and the Alt+H help screen to see a few more key bindings. If any of them don't seem to function, then I might have to create an additional testing EXE to capture the key values that are being sent. But I'd like to hold off on doing that until it's necessary.

Thanks again!

@Maxzhao1999
Copy link

Thanks for the detailed response, I’ll go through them and give you feedback hopefully in the next few days. Glad to be of help!

@Maxzhao1999
Copy link

Hey, I've had a quick look at the program and here are some feedbacks.

  • The program runs in macOS.

  • No problem scrolling through the mods

  • No problem viewing info for mods

  • Search works well, the shortcuts such as @author works fine too

  • No problem quitting the program, F10 works fine

Some problems include:

  • Cannot install or uninstall mods, Alt-A, +sign and Alt-D does not work

  • Help screen can be opened by F1 but not Alt-H

Also, I'd just like to say that although I've not been able to install or uninstall any mods, the consoleui seems to be much smoother than the current GUI and it looks amazing!

I'd love to help further!

@HebaruSan
Copy link
Member Author

HebaruSan commented Nov 10, 2017

Thanks, that's exactly the kind of feedback I was looking for! 👍

It sounds like the Alt keys are a problem, which in retrospect is not surprising, so I've reassigned them:

Function Previous key New key
Quit Alt+X Ctrl+Q (Alt+X still silently supported on Windows and Linux)
Save instance Alt+A F2 (the save key from Turbo C++)
Apply changes Alt+A F9 (the build key from Turbo C++)
Update registry Alt+U F5, Ctrl+R (browser refresh keys)
Download mod Alt+D Ctrl+D
Help Alt+H (hidden on Mac since F1 works)

The plus key is going to be more complicated; we'll need to capture info about the key so I know how to fix it. Since I've had to do this previously for other issues, I decided to add it as a menu option.

New download:

  • (Download removed; see subsequent post for more up to date versions)

Please download and unzip that new version, start it with mono ckan.exe consoleui --debug (the --debug part is new), and find this option in the menu:

image

When it prompts you to press a key, press your plus key, and it should report details about it. Please let me know what it says!

@Maxzhao1999
Copy link

Below is what it says:
Key: 0
KeyChar: 0x3d
Modifiers: 0

Also, the new keys above works! Yay!

@HebaruSan
Copy link
Member Author

Thanks for testing!
Those values seem to correspond to pressing the '=' equals key without shift; or at least that's what it says for me when I do that.
What happens if you capture the key while holding down shift?

@Maxzhao1999
Copy link

Aha, sorry about that, silly mistake. Here’s the correct one:
Key: Add
KeyChar: 0x2b
Modifiers: 0

@HebaruSan
Copy link
Member Author

Hmm, that should be what it's already using. Are you sure that you were pressing shift before when trying to install mods? Maybe that key isn't clear enough...

@pjf
Copy link
Member

pjf commented Nov 10, 2017

This... this is beautiful. Thank you.

@Maxzhao1999
Copy link

That might just be the problem, me being silly XD

@Maxzhao1999
Copy link

I’ll check if everything is working again tmr morning and will add a new version of Mac CKAN just for this UI on top of the old one if so.

@HebaruSan
Copy link
Member Author

Finally looked into what "repositories" refers to (I had not used that feature before). They're now listed on the screen for editing an instance (I called them "Mod List Sources" instead of "repositories" because it's ambiguous, CKAN-meta is a repository, NetKAN is a repository, etc.):

image

The screen for adding/editing a repo allows free editing with basic validation and has the built-in default repos listed in its main menu:

image

@politas
Copy link
Member

politas commented Nov 14, 2017

NetKAN is not a repository. NetKAN is metametadata to automate repository updates.

@HebaruSan
Copy link
Member Author

I know it's not a "repository" in the sense that Repository.cs means it, but it is in this sense:

image

We also have the resources.repository metadata for pointing to a mod's GitHub page. I just wanted something that would answer the question, repository of what?

HebaruSan added 18 commits Dec 3, 2017
- Mod version
- KSP version
- File timestamp
- File size
- Consolidate formatting functions in Formatting.cs
- Make file browser window narrower
- Show dir size as "<DIR>"
- Change "bytes" to "B"
- Reset IUser reference of ModuleInstaller whenever passed non-null
  - Clears install screen between uses
  - Fixes the weird redundant recommendation prompt glitch (I think)
- Add compatible versions to game instance edit screen
  - Using a new split-frame screen object
  - New dialog to pick predefined versions or type them
- Show messages for the event for successful installations
- Catch failed download exceptions
- Remove old comment
- Consolidate common lines in exit screen
- Add checkmark to successful install message
- Reformat install screen with double frame to move messages downward
- Add keys to scroll messages in install window's yes/no popup
- Move scrollbar from list box to screen object base class
- Add vertical offset option for message box
- Add scrollbar to text box
- Change installer's missing file error on remove from error to info
- Repaint screen after requires selection popup
- Strip epoch in import dialog
- Show epoch-stripped version in successful install message
- Debug parameters in more classes
- Message box enhancements:
  - Scrollable
  - Alignment param
  - Auto width
  - Preserve indentation for short lines
- Up/down arrow support in install screen popup
- Metadata functions in AvailableModule and Registry and the registry's
interface
- Allow rebinding screen container keys
politas
politas approved these changes Dec 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants