Skip to content

Commit 31a49e7

Browse files
committed
some more work on settings
1 parent 84397e3 commit 31a49e7

File tree

10 files changed

+72
-25
lines changed

10 files changed

+72
-25
lines changed

.vscode/launch.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,16 @@
3333
"options": ["hotfix", "update", "release"],
3434
"type": "pickString"
3535
},
36+
{
37+
"id": "guiSelection",
38+
"description": "Please choose GUI page",
39+
"default": "sync",
40+
"options": [
41+
"sync",
42+
"settings"
43+
],
44+
"type": "pickString"
45+
},
3646
{
3747
"id": "publishSelection",
3848
"description": "Please choose build type to publish",
@@ -77,6 +87,19 @@
7787
"program": "pbsync/pbsync.py",
7888
"console": "integratedTerminal"
7989
},
90+
{
91+
"name": "GUI",
92+
"args": [
93+
"--gui",
94+
"${input:guiSelection}",
95+
"--debugpath",
96+
"${input:debugPath}"
97+
],
98+
"type": "python",
99+
"request": "launch",
100+
"program": "pbsync/pbsync.py",
101+
"console": "integratedTerminal"
102+
},
80103
{
81104
"name": "Pull Binaries",
82105
"args": ["--sync", "binaries", "--debugpath", "${input:debugPath}"],

gui/css/app.css

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
color: var(--bs-light);
66
}
77

8+
#app-inner {
9+
margin-top: 1rem;
10+
}
11+
812
.flx-LineEdit {
913
width: 100%;
1014
border-radius: 0.25rem;
@@ -13,3 +17,19 @@
1317
.nav-pills .flx-Button {
1418
text-align: start;
1519
}
20+
21+
.flx-BaseButton {
22+
color: inherit;
23+
}
24+
25+
.flx-Widget:not(.flx-Layout) > .flx-Layout {
26+
position: initial;
27+
}
28+
29+
.flx-box {
30+
justify-content: initial;
31+
}
32+
33+
.flx-Label {
34+
align-self: center;
35+
}

gui/templates/index.html

Lines changed: 0 additions & 8 deletions
This file was deleted.

gui/templates/settings.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<section id="app-inner">
33
<div class="content">
44
<div class="container-fluid">
5-
<x-flx el="CommitLogTable" id="commit-log"></x-flx>
5+
<x-flx el="Settings" id="settings"></x-flx>
66
</div>
77
</div>
88
</section>

pbgui/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
asset_pkgs = [("webfonts/", gui.webfonts), ("img/", gui.img)]
2121

2222
m = None
23+
default_page = "sync"
2324
sync_fn = None
2425

2526
def load_flexx_static(data):
@@ -39,6 +40,10 @@ def load_static(pkg, filename):
3940
return load_flexx_static(data)
4041

4142

43+
def set_default_page(page):
44+
global default_page
45+
default_page = page
46+
4247

4348
for asset_dir, asset_pkg in asset_pkgs:
4449
for asset_name in pkg_resources.contents(asset_pkg):

pbgui/core.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ def init(self):
1616
self.g = Gateway()
1717
self.fs = FileBrowserWidget()
1818
self.g.set_jfs(self.fs._jswidget)
19+
self.g.init_page(pbgui.default_page)
1920

2021
@flx.action
2122
def open_file(self, filename):

pbgui/gateway.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
from pbgui import load_static, load_template, widgets
1111

12-
DEFAULT_PAGE = "index"
1312
pages = {}
1413

1514

@@ -24,10 +23,12 @@ def load_templated_page(file, name, kwargs):
2423
# Jinja2 static properties to define per page
2524
page_props = {
2625
"d": {},
27-
"index": {
28-
"name": "Home",
29-
"type": "home"
26+
"sync": {
27+
"name": "Sync"
3028
},
29+
"settings": {
30+
"name": "Settings"
31+
}
3132
}
3233

3334
for resource in pkg_resources.contents(gui.templates):
@@ -74,9 +75,9 @@ def init(self):
7475
self.elements = {
7576
"Button": flx.Button,
7677
"FileWidget": None,
77-
"CommitLogTable": widgets.CommitLogTable,
78+
"CommitLogTable": widgets.CommitLogTableWidget,
79+
"Settings": widgets.SettingsWidget,
7880
}
79-
self.set_html(pages[DEFAULT_PAGE])
8081

8182
def _create_dom(self):
8283
return flx.create_element("div", {"id": "app", "onreact": self.react})
@@ -135,3 +136,7 @@ def set_jfs(self, filebrowser):
135136
@flx.action
136137
def update_commits(self, commits):
137138
self.get_widget("commit-log").update_commits(commits)
139+
140+
@flx.action
141+
def init_page(self, page):
142+
self.set_html(pages[page])

pbgui/widgets/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
from .commitlog import CommitLogTable
1+
from .commitlog import CommitLogTableWidget
2+
from .settings import SettingsWidget

pbgui/widgets/commitlog.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from flexx import flx
22

3-
4-
class CommitLogTable(flx.Widget):
3+
class CommitLogTableWidget(flx.Widget):
54

65
commits = flx.ListProp()
76
commit_nodes = flx.ListProp()

pbsync/pbsync.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
from pbpy import pbuac
2020

2121
import pbgui.main
22+
import pbgui.gateway
2223

2324
import pbsync_version
2425

@@ -440,7 +441,7 @@ def main(argv):
440441

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

542543
# Parse args
543-
if not (args.sync is None):
544+
if not (args.gui is None):
544545
def sync():
545-
sync_handler(args.sync, args.repository, args.bundle)
546-
if args.nogui:
547-
sync()
548-
else:
549-
pbgui.main.run(sync)
546+
return sync_handler(args.sync, args.repository, args.bundle)
547+
pbgui.set_default_page(args.gui)
548+
pbgui.main.run(sync)
549+
if not (args.sync is None):
550+
sync_handler(args.sync, args.repository, args.bundle)
550551
elif not (args.printversion is None):
551552
printversion_handler(args.printversion, args.repository)
552553
elif not (args.autoversion is None):

0 commit comments

Comments
 (0)