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

rlbot hub alpha #43

Open
wants to merge 63 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
b2c0a57
Add files via upload
LapzwansProducties Jul 13, 2019
99982e6
Add files via upload
LapzwansProducties Jul 13, 2019
e44c30a
first alpha hub and update to mainstream
LapzwansProducties Jul 23, 2019
c0bd06b
replacing browserfs by fetch api
LapzwansProducties Jul 24, 2019
b084963
Update botmanager.html
LapzwansProducties Jul 24, 2019
c06e22a
download / delete button improvement
LapzwansProducties Jul 24, 2019
0ec4f15
Update botmanager.html
LapzwansProducties Jul 24, 2019
1afcb68
Update botmanager.html
LapzwansProducties Jul 24, 2019
478bfb6
function to pass bot packaging to js
LapzwansProducties Jul 24, 2019
526d650
update functionallity
LapzwansProducties Jul 24, 2019
7717a4a
Update gui.py
LapzwansProducties Jul 24, 2019
066659e
change to botpackage.json
LapzwansProducties Jul 25, 2019
f195343
Update botmanager.html
LapzwansProducties Jul 27, 2019
35f06cc
Update main.html
LapzwansProducties Jul 27, 2019
51a6319
Update botmanager.html
LapzwansProducties Jul 27, 2019
8512f3f
changes to shorten json in repofile (change in repo repo)
LapzwansProducties Jul 27, 2019
78a8948
botmanager js to seperate file
LapzwansProducties Jul 28, 2019
4816f8f
Update botmanager.html
LapzwansProducties Jul 28, 2019
d72cfc1
some canges to make the diff tool happy
LapzwansProducties Jul 28, 2019
6fbdc09
Merge branch 'master' into master
LapzwansProducties Jul 29, 2019
4fb7d6f
Update gui.py
LapzwansProducties Jul 29, 2019
5a29b42
Update gui.py
LapzwansProducties Jul 29, 2019
728b928
Update bot_creation.py
LapzwansProducties Jul 29, 2019
d660a22
Update gui.py
LapzwansProducties Jul 29, 2019
e27fe26
Update gui.py
LapzwansProducties Jul 29, 2019
6bf26ea
Update botmanager.js
LapzwansProducties Jul 29, 2019
86baed1
Update botmanager.js
LapzwansProducties Jul 29, 2019
cb3fd72
Create hubTodo.md
LapzwansProducties Jul 29, 2019
5b7be30
small style changes
LapzwansProducties Jul 30, 2019
d99a1ce
inaccurate closing times
LapzwansProducties Jul 30, 2019
97be127
Update hubTodo.md
LapzwansProducties Jul 30, 2019
7346ce0
copy download bot folder stabillity improvement
LapzwansProducties Jul 30, 2019
1b41e6c
Merge branch 'master' of https://github.com/ard1998/RLBotGUI
LapzwansProducties Jul 30, 2019
19e3cb7
Update botmanager.js
LapzwansProducties Jul 30, 2019
90bc89a
Bracket consistency
LapzwansProducties Jul 30, 2019
f0651a4
Update style.css
LapzwansProducties Jul 31, 2019
829086a
Update botmanager.css
LapzwansProducties Jul 31, 2019
6699b9d
Update botmanager.js
LapzwansProducties Jul 31, 2019
65e9a58
Update botmanager.js
LapzwansProducties Jul 31, 2019
937082b
Update botmanager.js
LapzwansProducties Jul 31, 2019
2034b74
Update botmanager.js
LapzwansProducties Jul 31, 2019
2ca152c
shoren the refresh time
LapzwansProducties Jul 31, 2019
ddd041f
Update botmanager.js
LapzwansProducties Jul 31, 2019
afedc4f
Converting the rlbot hub to vue, mostly.
tarehart Aug 2, 2019
def288a
multi repo functions for vue
LapzwansProducties Aug 26, 2019
709b020
small changes to indicate download safety
LapzwansProducties Aug 26, 2019
3dc55f9
deleting botpack functions and giving repo downloads own folder
LapzwansProducties Aug 26, 2019
a95e82c
Add files via upload
LapzwansProducties Aug 27, 2019
a2f4a82
Add files via upload
LapzwansProducties Aug 27, 2019
639973d
vue code fixes and some changes
LapzwansProducties Aug 29, 2019
ec63692
add sideloading via url
LapzwansProducties Aug 30, 2019
cfc2052
Update botmanager.html
LapzwansProducties Aug 30, 2019
284cfff
add news support and some small layout stuff
LapzwansProducties Aug 30, 2019
b54a6eb
small changes
LapzwansProducties Aug 30, 2019
ef75592
Delete hubTodo.md
LapzwansProducties Aug 31, 2019
22ffd71
few bugfixes
LapzwansProducties Aug 31, 2019
3572ce7
embed hub in main
LapzwansProducties Sep 26, 2019
59eea5d
Update gui.py
LapzwansProducties Sep 26, 2019
0bfd8c7
Update style.css
LapzwansProducties Sep 26, 2019
a59b284
Update gui.py
LapzwansProducties Sep 27, 2019
2681fec
Update botmanager.html
LapzwansProducties Sep 27, 2019
e93bb10
hub download section to 3 column
LapzwansProducties Sep 27, 2019
532e01c
undo last commit
LapzwansProducties Sep 28, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion rlbot_gui/bot_management/bot_creation.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,4 @@ def bootstrap_python_bot(bot_name, directory):
# Hopefully this will be VS Code or notepad++ or something. If it gets executed as a python script, no harm done.
os.startfile(python_file)

return config_file
return config_file
19 changes: 19 additions & 0 deletions rlbot_gui/bot_management/downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
from pathlib import Path
from shutil import rmtree

from distutils.dir_util import copy_tree



def download_and_extract_zip(download_url: str, local_folder_path: Path, clobber: bool = False):
"""
Expand Down Expand Up @@ -43,3 +46,19 @@ def download_gitlfs(repo_url: str, checkout_folder: Path, branch_name: str):
file.close()

print('Done downloading git repo.')

def download_botfs(repo_url: str, checkout_folder: Path, branch_name: str, bot_path: str):
This conversation was marked as resolved.
Show resolved Hide resolved
print('Starting download of a git repo... this might take a while.')
dtracers marked this conversation as resolved.
Show resolved Hide resolved

rmtree(checkout_folder, ignore_errors=True)

# Download the most of the files eg. https://github.com/RLBot/RLBotPack/archive/master.zip
download_and_extract_zip(
download_url=repo_url + '/archive/' + branch_name + '.zip',
local_folder_path=checkout_folder, clobber=True)

repo_extraction_name = '/' + repo_url.split('/')[-1] + '-' + branch_name + '/'

copy_tree(checkout_folder + repo_extraction_name, bot_path+'/')

print('Done downloading git repo.')
65 changes: 49 additions & 16 deletions rlbot_gui/gui.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import shutil

import eel
from PyQt5.QtCore import QSettings
Expand All @@ -15,6 +16,7 @@

from rlbot_gui.bot_management.bot_creation import bootstrap_python_bot
from rlbot_gui.bot_management.downloader import download_gitlfs
from rlbot_gui.bot_management.downloader import download_botfs
from rlbot_gui.match_runner.match_runner import hot_reload_bots, shut_down, start_match_helper, do_infinite_loop_content

DEFAULT_BOT_FOLDER = 'default_bot_folder'
Expand Down Expand Up @@ -225,14 +227,53 @@ def download_bot_pack():
settings.setValue(BOT_FOLDER_SETTINGS_KEY, bot_folder_settings)
settings.sync()

@eel.expose
def download_bot(repo):

branch = ""
if "tree" in repo:
branch = repo.split('/')[-1]
repo = repo.split('/tree')[0]
else:
branch = "master"

download_botfs(
repo_url=repo,
checkout_folder='download',
branch_name=branch,
bot_path=os.path.abspath(BOTPACK_FOLDER))
return 0;

@eel.expose
def delete_bot(name):
shutil.rmtree(os.path.abspath(BOTPACK_FOLDER + "/" + name))
return 0;

@eel.expose
def isBotInstalled(bot_name):
This conversation was marked as resolved.
Show resolved Hide resolved
bot_directory = BOTPACK_FOLDER
if os.path.exists(bot_directory+'/'+bot_name):
return True
else:
return False

@eel.expose
def getBotPackaging(bot_name):
This conversation was marked as resolved.
Show resolved Hide resolved
bot_directory = BOTPACK_FOLDER
if os.path.exists(bot_directory+'/'+bot_name):
file = open(bot_directory+'/'+bot_name+'/botpackage.json',"r")
filestr = file.read()
file.close()
return filestr
else:
return False

@eel.expose
def show_bot_in_explorer(bot_cfg_path):
import subprocess
directory = os.path.dirname(bot_cfg_path)
subprocess.Popen(f'explorer "{directory}"')


@eel.expose
def hot_reload_python_bots():
hot_reload_bots()
Expand Down Expand Up @@ -275,22 +316,13 @@ def is_chrome_installed():
else:
chm = eel.browsers.chm
if hasattr(chm, 'get_instance_path'):
return chm.get_instance_path() is not None

return eel.browsers.chm.get_instance_path() is not None
return chm.find_path() is not None


def launch_eel(use_chrome):
def launch_eel(browser_mode):
skyborgff marked this conversation as resolved.
Show resolved Hide resolved
port = 51993
options = {'port': port}

if use_chrome:
# Don't put anything in the options dict. The dict is used by old eel,
# and old eel (0.10) defaults nicely to chrome app.
browser_mode = 'chrome' # New eel (1.0) needs it to be 'chrome'.
else:
browser_mode = 'system-default'
options['mode'] = browser_mode
options = {'port': port, 'mode': browser_mode}

# This disable_cache thing only works if you have tare's fork of eel https://github.com/ChrisKnott/Eel/pull/102
# installed to pip locally using this technique https://stackoverflow.com/a/49684835
Expand All @@ -300,18 +332,19 @@ def launch_eel(use_chrome):
disable_cache=True, mode=browser_mode, port=port, suppress_error=True)



def start():
gui_folder = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'gui')
eel.init(gui_folder)

try:
if not is_chrome_installed():
raise Exception("Chrome does not appear to be installed.")
launch_eel(use_chrome=True)
launch_eel('chrome')
except Exception as e:
print(f'Falling back to system default browser because: {str(e)}')
launch_eel(use_chrome=False)
launch_eel('system-default')

while not should_quit:
do_infinite_loop_content()
eel.sleep(1.0)
eel.sleep(1.0)
129 changes: 129 additions & 0 deletions rlbot_gui/gui/botmanager.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
<!DOCTYPE html>
<html>
<head>

<meta charset="utf-8">
<meta content="width=device-width,initial-scale=1,minimal-ui" name="viewport">

<link rel="icon" type="image/png" sizes="192x192" href="imgs/rlbot_logo.png">

<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons"/>
<link rel="stylesheet" href="css/vue-material.min.css"/>
<link rel="stylesheet" href="css/vue-fonts.css"/>
<link rel="stylesheet" href="css/black-green-light.css"/>
<link rel="stylesheet" href="css/style.css"/>
<link rel="stylesheet" href="css/botmanager.css"/>

<title>Hub</title>

</head>
<body id="rlbotgui" onload="downloadRepos()">
<div id="app" :style="bodyStyle">

<md-toolbar class="md-primary">
<div class="md-toolbar-row">
<img class="logo" src="imgs/rlbot_logo.png">
<a href="main.html"><h3 class="md-title" style="flex: 1">RLBot</h3></a> &nbsp; &nbsp;
<a href="botmanager.html"><h3 class="md-title" style="flex: 1">Hub (alpha)</h3></a>
<div class="md-toolbar-section-end">
<md-progress-spinner v-if="showProgressSpinner" class="md-accent" :md-diameter="30" md-mode="indeterminate"></md-progress-spinner>
<md-menu md-direction="bottom-start">
<md-button md-menu-trigger class="md-icon-button">
<md-icon>more_vert</md-icon>
</md-button>

<md-menu-content>
<md-menu-item @click="showPackageInstaller = true;">
Install missing python package
</md-menu-item>
</md-menu-content>
</md-menu>
</div>
</div>
</md-toolbar>

<md-dialog :md-active.sync="showPackageInstaller">
<md-dialog-title>Install Package</md-dialog-title>

<md-dialog-content>

<md-field>
<label>Package Name</label>
<md-input v-model="packageString"></md-input>
</md-field>
</md-dialog-content>

<md-dialog-actions>
<md-button @click="installPackage()" class="md-raised md-primary">Install Package</md-button>
<md-button @click="showPackageInstaller = false">Close</md-button>
</md-dialog-actions>
</md-dialog>

<aside>
<md-card v-if="matchOptions" class="settings-card">
<md-card-header>
<div class="md-title">Filters</div>
</md-card-header>

<md-card-content>

<label for="searchBotName">search</label>
<input id="searchBotName" onkeyup="displayRepoData()" type="text" name="" class="" placeholder="search on bot name"><br>

<hr>

<div class="center-flex">

<div class="md-layout md-gutter">
<div class="md-layout-item">
<label for="gamemodes">Gamemode</label>
<div id="gamemodes" class="list">
<p><input onclick="displayRepoData()" id="1v1" type="checkbox" name="gamemode" value="1v1">1v1</p>
<p><input onclick="displayRepoData()" id="2v2" type="checkbox" name="gamemode" value="2v2">2v2</p>
<p><input onclick="displayRepoData()" id="3v3" type="checkbox" name="gamemode" value="3v3">3v3</p>
<p><input onclick="displayRepoData()" id="4v4" type="checkbox" name="gamemode" value="4v4">4v4</p>
<p><input onclick="displayRepoData()" id="hoops" type="checkbox" name="gamemode" value="Hoops">Hoops</p>
<p><input onclick="displayRepoData()" id="dropshot" type="checkbox" name="gamemode" value="Dropshot">Dropshot</p>
<p><input onclick="displayRepoData()" id="snowday" type="checkbox" name="gamemode" value="Snowday">Snowday</p>
</div>
</div>
</div>
</div>

</md-card-content>
</md-card>

<md-card v-if="matchOptions" class="settings-card">
<md-card-header>
<div class="md-title">News</div>
<p>Coming soon</p>
<br>
<p>The hub is an ALPHA preview with working functionallity. Features will be added an bugs can occur more often then expexted.</p>
</md-card-header>

<md-card-content>

<div class="center-flex">

<div class="md-layout md-gutter">

</div>
</div>

</md-card-content>
</md-card>
</aside>

<div id="main">
</div>
</div>

<script type="text/javascript" src="/eel.js"></script>
<script type="text/javascript" src="js/vue.js"></script>
<script type="text/javascript" src="js/vue-material.min.js"></script>
<script type="text/javascript" src="js/Sortable.min.js"></script>
<script type="text/javascript" src="js/vuedraggable.min.js"></script>
<script type="text/javascript" src="js/main.js"></script>
<script type="text/javascript" src="js/botmanager.js"></script>
</body>
</html>
18 changes: 18 additions & 0 deletions rlbot_gui/gui/css/botmanager.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
@media screen and (orientation: landscape){
html{
overflow-y: hidden;
}
aside{
width: 20vw;
float: left;
height: calc(100vh - 64px);
display: grid;
}
aside > div{
display: initial;
}
#main{
width: 80vw;
float: right;
}
}
Loading