Skip to content

Commit

Permalink
some more work on settings
Browse files Browse the repository at this point in the history
  • Loading branch information
mastercoms committed Aug 21, 2021
1 parent 84397e3 commit 31a49e7
Show file tree
Hide file tree
Showing 10 changed files with 72 additions and 25 deletions.
23 changes: 23 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,16 @@
"options": ["hotfix", "update", "release"],
"type": "pickString"
},
{
"id": "guiSelection",
"description": "Please choose GUI page",
"default": "sync",
"options": [
"sync",
"settings"
],
"type": "pickString"
},
{
"id": "publishSelection",
"description": "Please choose build type to publish",
Expand Down Expand Up @@ -77,6 +87,19 @@
"program": "pbsync/pbsync.py",
"console": "integratedTerminal"
},
{
"name": "GUI",
"args": [
"--gui",
"${input:guiSelection}",
"--debugpath",
"${input:debugPath}"
],
"type": "python",
"request": "launch",
"program": "pbsync/pbsync.py",
"console": "integratedTerminal"
},
{
"name": "Pull Binaries",
"args": ["--sync", "binaries", "--debugpath", "${input:debugPath}"],
Expand Down
20 changes: 20 additions & 0 deletions gui/css/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
color: var(--bs-light);
}

#app-inner {
margin-top: 1rem;
}

.flx-LineEdit {
width: 100%;
border-radius: 0.25rem;
Expand All @@ -13,3 +17,19 @@
.nav-pills .flx-Button {
text-align: start;
}

.flx-BaseButton {
color: inherit;
}

.flx-Widget:not(.flx-Layout) > .flx-Layout {
position: initial;
}

.flx-box {
justify-content: initial;
}

.flx-Label {
align-self: center;
}
8 changes: 0 additions & 8 deletions gui/templates/index.html

This file was deleted.

2 changes: 1 addition & 1 deletion gui/templates/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<section id="app-inner">
<div class="content">
<div class="container-fluid">
<x-flx el="CommitLogTable" id="commit-log"></x-flx>
<x-flx el="Settings" id="settings"></x-flx>
</div>
</div>
</section>
5 changes: 5 additions & 0 deletions pbgui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
asset_pkgs = [("webfonts/", gui.webfonts), ("img/", gui.img)]

m = None
default_page = "sync"
sync_fn = None

def load_flexx_static(data):
Expand All @@ -39,6 +40,10 @@ def load_static(pkg, filename):
return load_flexx_static(data)


def set_default_page(page):
global default_page
default_page = page


for asset_dir, asset_pkg in asset_pkgs:
for asset_name in pkg_resources.contents(asset_pkg):
Expand Down
1 change: 1 addition & 0 deletions pbgui/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def init(self):
self.g = Gateway()
self.fs = FileBrowserWidget()
self.g.set_jfs(self.fs._jswidget)
self.g.init_page(pbgui.default_page)

@flx.action
def open_file(self, filename):
Expand Down
17 changes: 11 additions & 6 deletions pbgui/gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

from pbgui import load_static, load_template, widgets

DEFAULT_PAGE = "index"
pages = {}


Expand All @@ -24,10 +23,12 @@ def load_templated_page(file, name, kwargs):
# Jinja2 static properties to define per page
page_props = {
"d": {},
"index": {
"name": "Home",
"type": "home"
"sync": {
"name": "Sync"
},
"settings": {
"name": "Settings"
}
}

for resource in pkg_resources.contents(gui.templates):
Expand Down Expand Up @@ -74,9 +75,9 @@ def init(self):
self.elements = {
"Button": flx.Button,
"FileWidget": None,
"CommitLogTable": widgets.CommitLogTable,
"CommitLogTable": widgets.CommitLogTableWidget,
"Settings": widgets.SettingsWidget,
}
self.set_html(pages[DEFAULT_PAGE])

def _create_dom(self):
return flx.create_element("div", {"id": "app", "onreact": self.react})
Expand Down Expand Up @@ -135,3 +136,7 @@ def set_jfs(self, filebrowser):
@flx.action
def update_commits(self, commits):
self.get_widget("commit-log").update_commits(commits)

@flx.action
def init_page(self, page):
self.set_html(pages[page])
3 changes: 2 additions & 1 deletion pbgui/widgets/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
from .commitlog import CommitLogTable
from .commitlog import CommitLogTableWidget
from .settings import SettingsWidget
3 changes: 1 addition & 2 deletions pbgui/widgets/commitlog.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from flexx import flx


class CommitLogTable(flx.Widget):
class CommitLogTableWidget(flx.Widget):

commits = flx.ListProp()
commit_nodes = flx.ListProp()
Expand Down
15 changes: 8 additions & 7 deletions pbsync/pbsync.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from pbpy import pbuac

import pbgui.main
import pbgui.gateway

import pbsync_version

Expand Down Expand Up @@ -440,7 +441,7 @@ def main(argv):

parser.add_argument("--sync", help="Main command for the PBSync, synchronizes the project with latest changes from the repo, and does some housekeeping",
choices=["all", "partial", "binaries", "engineversion", "engine", "force", "ddc"])
parser.add_argument("--nogui", help="Command line switch to skip GUI for sync handler", default=False)
parser.add_argument("--gui", help="Open a GUI page", choices=["sync", "settings"])
parser.add_argument("--printversion", help="Prints requested version information into console.",
choices=["current-engine", "latest-engine", "project"])
parser.add_argument(
Expand Down Expand Up @@ -540,13 +541,13 @@ def pbsync_config_parser_func(root):
run UpdateProject again.""", True)

# Parse args
if not (args.sync is None):
if not (args.gui is None):
def sync():
sync_handler(args.sync, args.repository, args.bundle)
if args.nogui:
sync()
else:
pbgui.main.run(sync)
return sync_handler(args.sync, args.repository, args.bundle)
pbgui.set_default_page(args.gui)
pbgui.main.run(sync)
if not (args.sync is None):
sync_handler(args.sync, args.repository, args.bundle)
elif not (args.printversion is None):
printversion_handler(args.printversion, args.repository)
elif not (args.autoversion is None):
Expand Down

0 comments on commit 31a49e7

Please sign in to comment.