Skip to content

Commit 63cbdba

Browse files
authored
Merge pull request #96 from tilak-io/dev
general improvements
2 parents f67edac + 81447e8 commit 63cbdba

File tree

21 files changed

+437
-86
lines changed

21 files changed

+437
-86
lines changed

.github/workflows/ci.yml

Lines changed: 49 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,80 @@
1-
name: Building Executable
2-
run-name: ${{ github.actor }} is buildling TiPlot 🚀
1+
name: Building Executables ⚡
2+
run-name: ${{ github.actor }} is building TiPlot 🚀
33
on:
4+
workflow_dispatch:
45
push:
56
branches:
67
- main
8+
paths:
9+
- "package.json"
10+
711
jobs:
812
Build-AppImage:
913
runs-on: ubuntu-20.04
1014
steps:
11-
- uses: actions/checkout@v3
12-
- uses: actions/setup-python@v4
15+
- name: Checkout code 📥
16+
uses: actions/checkout@v3
17+
- name: Setup Python 🐍
18+
uses: actions/setup-python@v4
1319
with:
1420
python-version: "3.10"
15-
- run: tree
16-
- uses: syphar/restore-virtualenv@v1
21+
- name: List files 📄
22+
run: tree 🌳
23+
- name: Set variables 📝
24+
run: |
25+
VER=$(grep -E -o '"version": ".*"' package.json | sed -e 's/"version": "//g' | tr -d '"')
26+
echo "VERSION=$VER" >> $GITHUB_ENV
27+
- name: Create Release 🏗️
28+
id: create_release
29+
uses: actions/create-release@v1
30+
env:
31+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32+
with:
33+
tag_name: v${{ env.VERSION }}
34+
release_name: Tiplot v${{ env.VERSION }}
35+
body: ${{ github.event.head_commit.message }}
36+
draft: true
37+
prerelease: false
38+
- name: Restore virtualenv cache 📦
39+
uses: syphar/restore-virtualenv@v1
1740
id: cache-virtualenv
1841
with:
1942
requirement_files: api/requirements.txt
20-
- uses: syphar/restore-pip-download-cache@v1
43+
- name: Restore pip download cache 📦
44+
uses: syphar/restore-pip-download-cache@v1
2145
if: steps.cache-virtualenv.outputs.cache-hit != 'true'
22-
# the package installation will only be executed when the
23-
# requirements-files have changed.
24-
- run: pip install -r api/requirements.txt
46+
- name: Install Python dependencies 🐍
47+
run: pip install -r api/requirements.txt
2548
if: steps.cache-virtualenv.outputs.cache-hit != 'true'
26-
- name: install node dependecies
49+
- name: Install Node dependencies 📦
2750
run: yarn install
28-
- name: build backend
51+
- name: Build backend 🔨
2952
run: yarn build:api
30-
- name: build desktop app
53+
- name: Build desktop app 💻
54+
run: yarn build:electron
3155
env:
3256
GH_TOKEN: ${{ github.token }}
3357
# CI: false # ignore warnings
34-
run: yarn build:electron
3558

3659
Build-EXE:
3760
runs-on: windows-latest
3861
steps:
39-
- uses: actions/checkout@v3
40-
- uses: actions/setup-python@v4
62+
- name: Checkout code 📥
63+
uses: actions/checkout@v3
64+
- name: Setup Python 🐍
65+
uses: actions/setup-python@v4
4166
with:
4267
python-version: "3.10"
43-
- run: tree
44-
- name: install node dependecies
68+
- name: List files 📄
69+
run: tree 🌳
70+
- name: Install Node dependencies 📦
4571
run: yarn install
46-
- run: pip install -r api/requirements.txt
47-
- name: build backend
72+
- name: Install Python dependencies 🐍
73+
run: pip install -r api/requirements.txt
74+
- name: Build backend 🔨
4875
run: yarn build:api
49-
- name: build desktop app
76+
- name: Build desktop app 💻
77+
run: yarn build:electron
5078
env:
5179
GH_TOKEN: ${{ github.token }}
5280
# CI: false # ignore warnings
53-
run: yarn build:electron

api/cesium_entity.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ def __init__(self,
77
color="white",
88
wireframe=False,
99
tracked=True,
10+
active=True,
1011
pathColor="blue",
1112
alpha=1,
1213
useRPY=False,
@@ -24,6 +25,7 @@ def __init__(self,
2425
self.useRPY = useRPY
2526
self.useXYZ = useXYZ
2627
self.tracked = tracked
28+
self.active = active
2729
self.scale = scale
2830
self.viewModel = viewModel
2931
self.id = CesiumEntity.next_id
@@ -76,6 +78,11 @@ def fromJson(cls, json):
7678
else:
7779
tracked = True
7880

81+
if "active" in json:
82+
active = json['active']
83+
else:
84+
active = True
85+
7986
if "scale" in json:
8087
scale = json['scale']
8188
else:
@@ -92,6 +99,7 @@ def fromJson(cls, json):
9299
useRPY=useRPY,
93100
useXYZ=useXYZ,
94101
tracked=tracked,
102+
active=active,
95103
scale=scale,
96104
viewModel=viewModel)
97105

@@ -105,6 +113,7 @@ def toJson(self):
105113
"useXYZ": self.useXYZ,
106114
"useRPY": self.useRPY,
107115
"tracked": self.tracked,
116+
"active": self.active,
108117
"scale": self.scale,
109118
"position": self.position,
110119
"attitude": self.attitude

api/server.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,26 @@ def default_entity():
140140
default = {}
141141
return default
142142

143+
@app.route('/set_tracked_entity', methods=['POST'])
144+
def set_tracked_entity():
145+
entity_id = request.get_json('id')
146+
config = store.Store.get().getEntities()
147+
if not config:
148+
return {"ok": False, "msg": "Entity list is empty."}
149+
entity_name = ""
150+
entity_found = False
151+
for entity in config:
152+
if entity['id'] == entity_id:
153+
entity['tracked'] = True
154+
entity_name = entity['name']
155+
entity_found = True
156+
else:
157+
entity['tracked'] = False
158+
if not entity_found:
159+
return {"ok": False, "msg": f"No entity with ID {entity_id} found."}
160+
store.Store.get().setEntities(config)
161+
return {"ok": True, "msg": f"\"{entity_name}\" is now tracked."}
162+
143163
@app.route('/write_config', methods=['POST'])
144164
def write_config():
145165
configs = request.get_json()

api/store.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def getEntitiesProps(self):
7474
raw = merged[columns]
7575
renamed = raw.rename(columns=mapped_columns).to_dict('records')
7676
data.append({"id": e.id,
77-
"entity_name": e.name,
77+
"name": e.name,
7878
"alpha": e.alpha,
7979
"scale": e.scale,
8080
"useRPY": e.useRPY,
@@ -83,6 +83,7 @@ def getEntitiesProps(self):
8383
"color": e.color,
8484
"wireframe": e.wireframe,
8585
"tracked": e.tracked,
86+
"active": e.active,
8687
"pathColor": e.pathColor})
8788
except Exception as error:
8889
err = str(error)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "tiplot",
3-
"version": "1.2.4",
3+
"version": "1.2.5",
44
"private": true,
55
"homepage": "./",
66
"proxy": "http://localhost:5000",

0 commit comments

Comments
 (0)