DrewNaylor / guinget

Unofficial GUI for Microsoft's Windows Package Manager (winget). Kinda like Synaptic, but for Windows. Not associated with either Microsoft or the Synaptic project, and Microsoft does not endorse this software.
Apache License 2.0
135 stars 3 forks source link

Allow the user to display available upgrades and installed packages in a window with a textbox instead of CMD so stuff doesn't disappear. #75

Open DrewNaylor opened 3 years ago

DrewNaylor commented 3 years ago

Would have to make sure to update the sources beforehand so it doesn't look horrible. Maybe if PowerShell doesn't trim off the output past a certain point, the commands could be switched to use it instead. Would prefer to stick with CMD since it's a lot faster to start, though. Hopefully that ConsoleControl would work and display all the packages that are installed.

DrewNaylor commented 3 years ago

Nah, we can just switch over to PowerShell for now since it doesn't seem to remove items like CMD does.

DrewNaylor commented 3 years ago

As stated in https://github.com/DrewNaylor/guinget/issues/78#issuecomment-737906327, neither CMD nor PowerShell have infinite scrollback buffers, so I'm going to just read the output into a textbox, or if I can manage it, a ListBox or even DataGridView.

DrewNaylor commented 3 years ago

This textbox should be in a form with a Close button in the bottom-right corner next to a Save to text file button. The textbox may need both horizontal and vertical scrolling and the window will definitely need to be resizable. Probably would be a good idea to reuse this form for stuff like the upgrades by doing what I do with the download progress form. Could look nice to have an indeterminate progress bar below a "Loading packages, please wait..." label that shows up while loading the lists of installed packages and upgrades. Probably should run winget source update beforehand so the progress bar doesn't mess with the textbox. It's possible that updating the sources will have issues, so redirecting standard error will be important.

DrewNaylor commented 3 years ago

Just to make things simple, there should be a way to display just a textbox and a way to show a tabcontrol that has both a textbox and a consolecontrol (as mentioned in the first post). The one with the consolecontrol can be used to show the output from winget source update instead of just putting it in a textbox.

DrewNaylor commented 3 years ago

Actually, maybe the ConEmu control could be used instead of ConsoleControl: https://www.nuget.org/packages/ConEmu.Control.WinForms/

DrewNaylor commented 3 years ago

Doing the fancy two-tab thing was too much work that I don't really know how to do right now, so maybe I can just have a reusable window with ConEmu embedded that runs specific commands based on which one is clicked in the menubar. The Save to file button can just run the command a second time and pipe the output to a file of the user's choosing.

I'll also have to copy ConEmu's EXE files to somewhere in the bin directory, possibly in \bin\tools\conemu\. May as well eventually bundle 7-Zip in there while I'm at it, so that can be \bin\tools\7zip\. The installer should be changed to allow the user to not install these components if they don't want them to take up more space or they already have them installed.

Allowing path configuration for these tools would be a good idea as would allowing people to use CMD instead of ConEmu. Maybe the way that can work is there's a minimal form in "CMD mode" that has the buttons for saving the list of installed packages and re-running the list command, but no ConEmu control. If ConEmu can't be found, it'll fall back to "CMD Mode" automatically. Some people may not like the minimal form, so allowing people to not show it would be a good idea. Probably just do something like, %guingetdir%\tools\conemu\conemu.exe by default in the Settings and just expand %guingetdir% to the directory for guinget.exe.

After saving the list, there should be a label that says, "Saving package list..." that changes to "Saved." after it's finished saving it if it completes successfully. Should check the exit code to see different situations where the file is read-only or winget's not installed, and stuff.

DrewNaylor commented 3 years ago

If I use a textbox or another similar control without support for ANSI sequences, I'll have to replace the spinner thing.

DrewNaylor commented 3 years ago

Did a quick test with listing in a textbox, and it just looks bad. Probably would have to use monospace fonts to make it look ok sometimes, but there's a lot that just ends suddenly. None of this is mentioning the progress bar text when the command is run that would have to be removed with a replace thing. Might have to do something like watch the output and put it into a nice list right after the progress bar is full, but that doesn't help with the part where the column just ends.