Skip to content

Commit

Permalink
Merge pull request #96 from tilak-io/dev
Browse files Browse the repository at this point in the history
general improvements
  • Loading branch information
HmZyy authored Mar 17, 2024
2 parents f67edac + 81447e8 commit 63cbdba
Show file tree
Hide file tree
Showing 21 changed files with 437 additions and 86 deletions.
71 changes: 49 additions & 22 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,53 +1,80 @@
name: Building Executable
run-name: ${{ github.actor }} is buildling TiPlot 🚀
name: Building Executables ⚡
run-name: ${{ github.actor }} is building TiPlot 🚀
on:
workflow_dispatch:
push:
branches:
- main
paths:
- "package.json"

jobs:
Build-AppImage:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- name: Checkout code 📥
uses: actions/checkout@v3
- name: Setup Python 🐍
uses: actions/setup-python@v4
with:
python-version: "3.10"
- run: tree
- uses: syphar/restore-virtualenv@v1
- name: List files 📄
run: tree 🌳
- name: Set variables 📝
run: |
VER=$(grep -E -o '"version": ".*"' package.json | sed -e 's/"version": "//g' | tr -d '"')
echo "VERSION=$VER" >> $GITHUB_ENV
- name: Create Release 🏗️
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ env.VERSION }}
release_name: Tiplot v${{ env.VERSION }}
body: ${{ github.event.head_commit.message }}
draft: true
prerelease: false
- name: Restore virtualenv cache 📦
uses: syphar/restore-virtualenv@v1
id: cache-virtualenv
with:
requirement_files: api/requirements.txt
- uses: syphar/restore-pip-download-cache@v1
- name: Restore pip download cache 📦
uses: syphar/restore-pip-download-cache@v1
if: steps.cache-virtualenv.outputs.cache-hit != 'true'
# the package installation will only be executed when the
# requirements-files have changed.
- run: pip install -r api/requirements.txt
- name: Install Python dependencies 🐍
run: pip install -r api/requirements.txt
if: steps.cache-virtualenv.outputs.cache-hit != 'true'
- name: install node dependecies
- name: Install Node dependencies 📦
run: yarn install
- name: build backend
- name: Build backend 🔨
run: yarn build:api
- name: build desktop app
- name: Build desktop app 💻
run: yarn build:electron
env:
GH_TOKEN: ${{ github.token }}
# CI: false # ignore warnings
run: yarn build:electron

Build-EXE:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- name: Checkout code 📥
uses: actions/checkout@v3
- name: Setup Python 🐍
uses: actions/setup-python@v4
with:
python-version: "3.10"
- run: tree
- name: install node dependecies
- name: List files 📄
run: tree 🌳
- name: Install Node dependencies 📦
run: yarn install
- run: pip install -r api/requirements.txt
- name: build backend
- name: Install Python dependencies 🐍
run: pip install -r api/requirements.txt
- name: Build backend 🔨
run: yarn build:api
- name: build desktop app
- name: Build desktop app 💻
run: yarn build:electron
env:
GH_TOKEN: ${{ github.token }}
# CI: false # ignore warnings
run: yarn build:electron
9 changes: 9 additions & 0 deletions api/cesium_entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ def __init__(self,
color="white",
wireframe=False,
tracked=True,
active=True,
pathColor="blue",
alpha=1,
useRPY=False,
Expand All @@ -24,6 +25,7 @@ def __init__(self,
self.useRPY = useRPY
self.useXYZ = useXYZ
self.tracked = tracked
self.active = active
self.scale = scale
self.viewModel = viewModel
self.id = CesiumEntity.next_id
Expand Down Expand Up @@ -76,6 +78,11 @@ def fromJson(cls, json):
else:
tracked = True

if "active" in json:
active = json['active']
else:
active = True

if "scale" in json:
scale = json['scale']
else:
Expand All @@ -92,6 +99,7 @@ def fromJson(cls, json):
useRPY=useRPY,
useXYZ=useXYZ,
tracked=tracked,
active=active,
scale=scale,
viewModel=viewModel)

Expand All @@ -105,6 +113,7 @@ def toJson(self):
"useXYZ": self.useXYZ,
"useRPY": self.useRPY,
"tracked": self.tracked,
"active": self.active,
"scale": self.scale,
"position": self.position,
"attitude": self.attitude
Expand Down
20 changes: 20 additions & 0 deletions api/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,26 @@ def default_entity():
default = {}
return default

@app.route('/set_tracked_entity', methods=['POST'])
def set_tracked_entity():
entity_id = request.get_json('id')
config = store.Store.get().getEntities()
if not config:
return {"ok": False, "msg": "Entity list is empty."}
entity_name = ""
entity_found = False
for entity in config:
if entity['id'] == entity_id:
entity['tracked'] = True
entity_name = entity['name']
entity_found = True
else:
entity['tracked'] = False
if not entity_found:
return {"ok": False, "msg": f"No entity with ID {entity_id} found."}
store.Store.get().setEntities(config)
return {"ok": True, "msg": f"\"{entity_name}\" is now tracked."}

@app.route('/write_config', methods=['POST'])
def write_config():
configs = request.get_json()
Expand Down
3 changes: 2 additions & 1 deletion api/store.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def getEntitiesProps(self):
raw = merged[columns]
renamed = raw.rename(columns=mapped_columns).to_dict('records')
data.append({"id": e.id,
"entity_name": e.name,
"name": e.name,
"alpha": e.alpha,
"scale": e.scale,
"useRPY": e.useRPY,
Expand All @@ -83,6 +83,7 @@ def getEntitiesProps(self):
"color": e.color,
"wireframe": e.wireframe,
"tracked": e.tracked,
"active": e.active,
"pathColor": e.pathColor})
except Exception as error:
err = str(error)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tiplot",
"version": "1.2.4",
"version": "1.2.5",
"private": true,
"homepage": "./",
"proxy": "http://localhost:5000",
Expand Down
Loading

0 comments on commit 63cbdba

Please sign in to comment.