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

Botspot's GUI update [DRAFT] #1580

Merged
merged 74 commits into from
May 16, 2022
Merged

Botspot's GUI update [DRAFT] #1580

merged 74 commits into from
May 16, 2022

Conversation

theofficialgman
Copy link
Collaborator

@theofficialgman theofficialgman commented Mar 9, 2022

refer to Botspot's issue for a description of this PR: #1578

To test:

cd /tmp
rm -rf ./pi-apps
git clone https://github.com/Botspot/pi-apps.git -b new-gui
./pi-apps/gui

closes #1170
closes #1578
closes #1317

gui Outdated Show resolved Hide resolved
gui Outdated Show resolved Hide resolved
gui Outdated Show resolved Hide resolved
@theofficialgman theofficialgman changed the title Botspots: GUI update [DRAFT] Botspot's GUI update [DRAFT] Mar 9, 2022
@theofficialgman theofficialgman mentioned this pull request Mar 9, 2022
gui Show resolved Hide resolved
@theofficialgman
Copy link
Collaborator Author

theofficialgman commented Mar 9, 2022

pi-apps/gui

Lines 382 to 386 in 7a19fd1

runonce <<"EOF"
if [ ! -e "${DIRECTORY}/data/categories" ];then
"${DIRECTORY}/install"
fi
EOF

this is dangerous as this can being run without a terminal showing. calling sudo without a terminal showing will always fail (unless the user uses the bad insecure passwordless sudo).
if this happens, control is not given back to the terminal after exiting pi-apps and you will get garbage on the output:

Sorry, try again.
[sudo] password for garrett: 
sudo: 1 incorrect password attempt
The command 'sudo apt update' failed. Before Pi-Apps will work, you must fix your apt package-management system.
runonce(): '  if [ ! -e "${DIRECTORY}/data/categories" ];then
    "${DIRECTORY}/install"
  fi' failed. Not adding hash to list.

consider using pkexec for all unsafe uses of sudo within hidden terminal scripts

this runonce script also seems to be non-relevant anymore. the categories folder does not exist anymore and is removed in a later runonce script already. maybe just remove this?

@Sussy-OS
Copy link
Contributor

Sussy-OS commented Mar 9, 2022

hi, im back

@Botspot
Copy link
Owner

Botspot commented Mar 9, 2022

this runonce script also seems to be non-relevant anymore. the categories folder does not exist anymore and is removed in a later runonce script already. maybe just remove this?

Done.

@Sussy-OS
Copy link
Contributor

Sussy-OS commented Mar 9, 2022

@Botspot Why does it take a minute longer to load the apps/catagories? And in the terminal, it says no overrides (override for app directory)

@Botspot
Copy link
Owner

Botspot commented Mar 9, 2022

@Botspot Why does it take a minute longer to load the apps/catagories? And in the terminal, it says no overrides (override for app directory)

@Sussy-OS, are you sure that you have switched branches correctly? The new Pi-Apps GUI should look like this:
2022-03-09-122141_1920x1080_scrot

@theofficialgman
Copy link
Collaborator Author

just for reference this is an easy way to try out the new gui without affecting anything locally

cd /tmp
rm -rf /tmp/pi-apps
git clone https://github.com/Botspot/pi-apps.git
cd pi-apps
git checkout new-gui
./gui

@Sussy-OS
Copy link
Contributor

Sussy-OS commented Mar 9, 2022

@Botspot Why does it take a minute longer to load the apps/catagories? And in the terminal, it says no overrides (override for app directory)

@Sussy-OS, are you sure that you have switched branches correctly? The new Pi-Apps GUI should look like this:

@Botspot Yes, it does look like that, but when I click on an app/a catagory, it takes a while to either, load the app, or load the apps in the catagory. Edit: I thought the windows 10 theme was broken..? Also; when I click on the credits of an app, it opens geany, instead of a window showing the credits.

preload Outdated Show resolved Hide resolved
@theofficialgman
Copy link
Collaborator Author

Also; when I click on the credits of an app, it opens geany, instead of a window showing the credits.

clicking the credits link opens whatever your default program for viewing text files is with the credits file automatically loaded in it. That works for me and opens my text editor with the credits file loaded

@theofficialgman
Copy link
Collaborator Author

theofficialgman commented Mar 9, 2022

Yes, it does look like that, but when I click on an app/a catagory, it takes a while to either, load the app, or load the apps in the catagory.

I wonder if xrandr is taking a while to return output or if the grep/sed are slow:

time (  screen_dimensions="$(xrandr --nograb --current |  awk -F 'connected |\\+|\\('  '/ connected.*[0-9]+x[0-9]+\+/ && $2 {printf $2 ", "}' | sed -n -e 's/^.*primary //p' | tr 'x+' ' ' | tr ',+' ' ')"; screen_width="$(awk '{print $1}' <<<"$screen_dimensions")"; screen_height="$(awk '{print $2}' <<<"$screen_dimensions")";   unset screen_dimensions )

what is the time output here? for mess its less that 0.02 seconds
if this isn't taking long then it must be some other command that we will have to add some logging to to see what is slowing stuff down

@theofficialgman
Copy link
Collaborator Author

theofficialgman commented Mar 9, 2022

Yes, it does look like that, but when I click on an app/a catagory, it takes a while to either, load the app, or load the apps in the catagory.

ok I may see the cause here, it should go away after the first load of a category. timestampscheck takes a while and gets run each time you click on a category. it takes a bit to update the timestamps (less than a second in my testing but its still longer than if they matched). if you click on All Apps then all of them will be updated, and the next time you click on any other category it should be fast.

@Botspot
Copy link
Owner

Botspot commented Mar 9, 2022

Yes, it does look like that, but when I click on an app/a catagory, it takes a while to either, load the app, or load the apps in the catagory.

ok I may see the cause here, it should go away after the first load of a category. timestampscheck takes a while and gets run each time you click on a category. it takes a bit to update the timestamps (less than a second in my testing but its still longer than if they matched). if you click on All Apps then all of them will be updated, and the next time you click on any other category it should be fast.

Not quite. On first launch, all categories need to be preloaded. The main first page is the fastest to load because it is just categories. But all other app-lists take a bit longer to be generated for the first time. So, if you want to judge the average user's experience, then launch gui and wait 7 or so seconds for preload-daemon to finish loading all other subcategories. You can tell when it's done when a CPU-usage monitor falls back to normal levels.
Once preloading completes, the loading of categories is nearly instant. Again, under normal circumstances, the user won't notice this sluggishness. (The pi-apps/install script will have already preloaded categories, and most other scripts will run a background process of preload during use)

@Botspot
Copy link
Owner

Botspot commented Mar 9, 2022

Note: if you do wait a bit before selecting a category and it's still slow, then chances are preload-daemon did not run. Most likely it immediately exited because it detected that "Another process of preload-daemon is already running. Exiting now." In the case of testing a secondary Pi-Apps installation, it's possible that your main Pi-Apps installation already has preload-daemon running for its own session. Obviously, preload-daemon running for ~/pi-apps won't do a bit of good for /tmp/pi-apps.

If you think that's the case, then try testing Pi-Apps like this:

killall preload-daemon
/tmp/pi-apps/gui

@Sussy-OS
Copy link
Contributor

Sussy-OS commented Mar 9, 2022

Ah, thanks @Botspot .

@Sussy-OS

This comment was marked as off-topic.

@Botspot

This comment was marked as off-topic.

@Sussy-OS

This comment was marked as off-topic.

@Botspot

This comment was marked as off-topic.

@Sussy-OS

This comment was marked as off-topic.

@Botspot
Copy link
Owner

Botspot commented Mar 9, 2022

The app list now color-codes the app name, instead of using a dedicated icon to show status.
2022-03-09-145540_1920x1080_scrot
To update, cd into wherever you downloaded this branch to, and run git pull.

@Sussy-OS

This comment was marked as off-topic.

@Botspot

This comment was marked as off-topic.

@Sussy-OS

This comment was marked as off-topic.

@Sussy-OS
Copy link
Contributor

@Sussy-OS Did you have Pi-Apps open when you updated it?

No, just closed it. I ran pi-apps update by the BASH extension

@Sussy-OS
Copy link
Contributor

you only get it if updating via the gui, since thats only when its required

But, I updated by pi-apps update

@theofficialgman
Copy link
Collaborator Author

theofficialgman commented May 16, 2022

you only get it if updating via the gui, since thats only when its required

But, I updated by pi-apps update

right, the new gui didn't launch then since you didn't have a gui open. but the runonce still executed and passed as required.

anyway... all is expected and functioning correctly. I updated via the gui updater with no issues

@Sussy-OS
Copy link
Contributor

@Botspot How would you select multiple apps now? I can't seem to hold Ctrl, or Shift with it working.

@theofficialgman
Copy link
Collaborator Author

@Botspot How would you select multiple apps now? I can't seem to hold Ctrl, or Shift with it working.

there is a new multi-select gui accessible from the settings menu
multi-select from the new gui was no longer possible

@Crilum
Copy link
Contributor

Crilum commented May 16, 2022

@Botspot How would you select multiple apps now? I can't seem to hold Ctrl, or Shift with it working.

there is a new multi-select gui accessible from the settings menu multi-select from the new gui was no longer possible

Has the documentation/README been updated to show things like this?

@theofficialgman
Copy link
Collaborator Author

theofficialgman commented May 16, 2022

multi-select was never a documented feature before. well it was in an announcement banner but we already removed that last week.

the readme does need (more) updating though, the settings window pictured is old, looks like we missed that. we updated other things but looks like that slipped through

@Sussy-OS
Copy link
Contributor

New issue:
image

@Sussy-OS
Copy link
Contributor

This is while multi-selecting.

@Crilum
Copy link
Contributor

Crilum commented May 16, 2022

Looks like somewhere there's something that needs to be quoted... Or something of a similar nature

@Sussy-OS
Copy link
Contributor

Looks like somewhere there's something that needs to be quoted... Or something of a similar nature

Yeah..

@Crilum
Copy link
Contributor

Crilum commented May 16, 2022

    🭊▅▅▅▅🬿
 🭈▂▂█▂▂▂▂█▂▂🬽
 ▌  ▗▖▗▖▗▖  ▐   █▀▀🭍 ▄
 ▌  ▗▖▗▖▗▖  ▐   █▄▄🭞 ▄ ▄▄ 🭂▀▀█ █▀▀🭍 █▀▀🭍 🭂🬰🬰🬰
 ▌  ▗▖▗▖▗▖  ▐   █    █    🭓▄▄█ █▄▄🭞 █▄▄🭞 ▄▄▄🭞
 🭓🬭🬭🬰🬰🬰🬰🬰🬰🬭🬭🭞                  █    █

/home/pi/pi-apps/apps/Alacritty does not exist!
/home/pi/pi-apps/apps/Terminal does not exist!

Close this window to exit.

Just installing one app doesn't work either.

@Crilum
Copy link
Contributor

Crilum commented May 16, 2022

That should quote apps...

@Sussy-OS
Copy link
Contributor

Starts here, if anybody wants to see what is the matter: https://github.com/Botspot/pi-apps/blob/master/api#L1841

@theofficialgman
Copy link
Collaborator Author

theofficialgman commented May 16, 2022

I'm checking for the bug right now
this is already correct "${DIRECTORY}/manage" multi-install "'"$apps"'" it is the multi-install function in the manage script that is the issue

garrett@garrett-usb:~/pi-apps$ DIRECTORY=/home/garrett/pi-apps
garrett@garrett-usb:~/pi-apps$ source api
garrett@garrett-usb:~$ cd pi-apps
garrett@garrett-usb:~/pi-apps$ "${DIRECTORY}/manage" multi-install "Angry IP scanner" "btop++"
/home/garrett/pi-apps/apps/Angry does not exist!
/home/garrett/pi-apps/apps/IP does not exist!
/home/garrett/pi-apps/apps/scanner does not exist!

@Sussy-OS
Copy link
Contributor

I'm checking for the bug right now this is already correct "${DIRECTORY}/manage" multi-install "'"$apps"'" it is the multi-install function in the manage script that is the issue

garrett@garrett-usb:~/pi-apps$ DIRECTORY=/home/garrett/pi-apps
garrett@garrett-usb:~/pi-apps$ source api
garrett@garrett-usb:~$ cd pi-apps
garrett@garrett-usb:~/pi-apps$ "${DIRECTORY}/manage" multi-install "Angry IP scanner" "btop++"
/home/garrett/pi-apps/apps/Angry does not exist!
/home/garrett/pi-apps/apps/IP does not exist!
/home/garrett/pi-apps/apps/scanner does not exist!

Yes, but I can not seem to find where that begins (in the manage file).

@theofficialgman
Copy link
Collaborator Author

theofficialgman commented May 16, 2022

  app_list="$2" #newline-separated list of apps to install/uninstall
  
  #check if any app names are invalid - use the validate_apps_gui function which requires the action to prefix each line. Then filter out the action afterwards.
  app_list="$(validate_apps_gui "$(echo "$app_list" | sed "s/^/${action};/g")" | sed 's/.*;//g')"
  [ -z "$app_list" ] && exit 0
  
  #install/uninstall one app at a time. If it fails then add the app to the list of failed apps
  failed_apps=''
  for app in $app_list ;do
    
    "${DIRECTORY}/manage" $action "$app"
    if [ $? != 0 ];then
      #this app failed to install - add it to the list of failed apps
      failed_apps+="$app"$'\n'
    fi
  done

oh... well yeah this isn't going to work. these apps aren't newline separated at all

@theofficialgman
Copy link
Collaborator Author

found bug, fixing now

@Sussy-OS
Copy link
Contributor

@theofficialgman How is it going with fixing the bug?

@theofficialgman
Copy link
Collaborator Author

@Sussy-OS sorry took a while to figure out exactly how it needed to be fixed (I knew what was wrong but didn't know how to fix it). done now with b6d71aa

@Crilum
Copy link
Contributor

Crilum commented May 16, 2022

@theofficialgman It works for me!

@Sussy-OS
Copy link
Contributor

How do you multi-uninstall?

@Sussy-OS
Copy link
Contributor

alright the waitlist and a fallback incase the waitlist disappears are implemented.

Now the install and uninstall commands from the gui will NOT start unless the manage script is not currently running AND the script is next in line in the waitlist (ie: the app name is at the top of the file).

this makes is so the app install/uninstalls will proceed in the order of the users execution. the terminal run window will popup and show a spinning icon and text saying "Waiting for another script to finish before continuing..." until the previous script finishes

@Botspot how does this look now?

example screenshot of multiple uninstalls queued up: Screenshot from 2022-04-08 20-36-32

I wish this got added..

@theofficialgman
Copy link
Collaborator Author

@Sussy-OS you are misunderstanding how pi-apps has improved. use the normal GUI and select and install an app. then keep browsing the GUI (while the other app hasn't finished) and add another app to install or uninstall, they get added to a queue

@Sussy-OS
Copy link
Contributor

@Sussy-OS you are misunderstanding how pi-apps has improved. use the normal GUI and select and install an app. then keep browsing the GUI (while the other app hasn't finished) and add another app to install or uninstall, they get added to a queue

Ah! That's amazing! I do like your concept of the terminals themselfs waiting, but the GUI queue is amazing! Maybe you could add the terminal queue to the bash extension? But I do not understand why there is a multi-install, and not a multi-uninstall. It would be so much easier to just select all uninstall in one go.

@Crilum
Copy link
Contributor

Crilum commented May 16, 2022

Maybe you could add the terminal queue to the bash extension?

Or in Pi-Apps Settings.

@Sussy-OS
Copy link
Contributor

Maybe you could add the terminal queue to the bash extension?

Or in Pi-Apps Settings.

Yeah, to enable GUI, or Terminal queue.

@theofficialgman
Copy link
Collaborator Author

theofficialgman commented May 16, 2022

@Sussy-OS added multi-uninstall to settings gui 97f0c7c

the backend was already there for it, you could already execute it via terminal.

@Sussy-OS
Copy link
Contributor

Sussy-OS commented May 16, 2022

Yeah, I saw it in manage, but I was wondering why it was not in the settings. I was also wondering if it was left over and you guys just forgot to remove it.

@theofficialgman
Copy link
Collaborator Author

Yeah, I saw it in manage, but I was wondering why it was not in the settings.

probably because most people don't want to rapid fire uninstall tons of app (and you can just queue them up easily in the normal gui), regardless its there now

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.

New Pi-Apps GUI Suggestions for Pi-Apps Add an optional reload button
9 participants