Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ce09984983 | ||
|
|
9bcbfa48de | ||
|
|
43674bf2d5 | ||
|
|
2ebd3a8396 | ||
|
|
eaba28e24b | ||
|
|
51602fe69c | ||
|
|
ee6a603fae | ||
|
|
34f2eb3189 | ||
|
|
b6cfb0fd88 | ||
|
|
5d2400ccbe | ||
|
|
a75b133dea | ||
|
|
f1ab29e4e6 | ||
|
|
bc5731e0bf | ||
|
|
44309b37df | ||
|
|
fbead2efb1 | ||
|
|
b6c2901908 | ||
|
|
3f4eeadb6f | ||
|
|
678eda0e8c | ||
|
|
3784d8e9c0 | ||
|
|
ae1fa8736a | ||
|
|
30b0469ffd | ||
|
|
7ab6f32d3a | ||
|
|
f60811255f | ||
|
|
47dd6ad6d9 | ||
|
|
64f7c2bebd | ||
|
|
d4b1be9fcc | ||
|
|
1779cca828 | ||
|
|
46e8821821 | ||
|
|
470a00c288 | ||
|
|
ad52728131 | ||
|
|
5d94063973 | ||
|
|
0bcfc4b582 | ||
|
|
57aa96420c | ||
|
|
eef899c19e | ||
|
|
94c1f35f9c | ||
|
|
ed82856140 | ||
|
|
a581be6aec | ||
|
|
a2d90df97c | ||
|
|
6fa1c28bc4 | ||
|
|
86ab389b32 | ||
|
|
88c78518d2 | ||
|
|
0a2a2fd3c5 | ||
|
|
f4e07b7278 | ||
|
|
96578bb95c | ||
|
|
3262e0cfc1 | ||
|
|
ae6667e259 | ||
|
|
7553d4e6c8 | ||
|
|
97298f92dc | ||
|
|
05e88f6ee9 | ||
|
|
216099c524 | ||
|
|
c38d770b69 | ||
|
|
4ab2def2f8 | ||
|
|
41584b47f7 | ||
|
|
8a4a4ce234 | ||
|
|
5a44322ac2 | ||
|
|
9069617de6 | ||
|
|
08b60c0072 | ||
|
|
6b8f56985a | ||
|
|
de673810c3 | ||
|
|
5efbd50024 | ||
|
|
19928e3244 | ||
|
|
fb714fc904 | ||
|
|
45a4113420 | ||
|
|
09e92caa43 | ||
|
|
ceb4ff395c | ||
|
|
ced16fbc1b | ||
|
|
d6e4fc09d6 | ||
|
|
f12d0dd89b | ||
|
|
4c681d5de1 | ||
|
|
d161cf875c | ||
|
|
a9bb288407 | ||
|
|
5495d53cd3 | ||
|
|
bb9d10e00c | ||
|
|
6597c9cdc2 | ||
|
|
8ded071403 | ||
|
|
4fdd49fb27 | ||
|
|
34f44a00b7 | ||
|
|
8bc17d01b3 | ||
|
|
ec44294441 | ||
|
|
4cc9c90a30 | ||
|
|
645575ea31 | ||
|
|
d12f1cbb32 | ||
|
|
877c7ee861 | ||
|
|
c6934d751f | ||
|
|
9cb63ee193 | ||
|
|
a24c6bd90e | ||
|
|
b6fa2e3d83 | ||
|
|
b7e58d98ff | ||
|
|
6a9aef4785 | ||
|
|
890d32c2cf | ||
|
|
16a09e006f | ||
|
|
9a270c5054 | ||
|
|
806ac9cd6a | ||
|
|
bf3077d858 | ||
|
|
2a85e8999f | ||
|
|
875035f6f3 | ||
|
|
60c218fe18 | ||
|
|
89f2b2ce0b | ||
|
|
7e9a274ff7 | ||
|
|
d4cd31291d | ||
|
|
840d8c1c96 | ||
|
|
4340b15ee0 | ||
|
|
eb88bc703b | ||
|
|
eecd24a8d6 | ||
|
|
2f1fd2788e | ||
|
|
6554f5b084 | ||
|
|
0338efd914 | ||
|
|
e8583181e1 | ||
|
|
feeee61ffb | ||
|
|
e6eb4fae18 | ||
|
|
cb2da07479 | ||
|
|
bad3a842e8 | ||
|
|
6e97cf24f2 | ||
|
|
4a88b74bb7 | ||
|
|
ca298eba0f | ||
|
|
ed3ef6adfc | ||
|
|
e7e87eb20d | ||
|
|
e3f15325c1 | ||
|
|
55ab7395e2 | ||
|
|
310e0342c1 | ||
|
|
5f784aa4f5 | ||
|
|
03b8b591b4 | ||
|
|
581cd2b306 | ||
|
|
48b84f9ffd | ||
|
|
9627f6248d | ||
|
|
94896ac4f8 | ||
|
|
adf31153eb | ||
|
|
8ed9f33dc0 | ||
|
|
931d0a6d50 | ||
|
|
c81311bc61 | ||
|
|
c6d4e0630f | ||
|
|
f0481501d5 | ||
|
|
7a9f601a4a | ||
|
|
a307b4e784 | ||
|
|
c9696ad1f8 | ||
|
|
dd9c71a3bb | ||
|
|
1aeaf7d36f | ||
|
|
4d52d9660e | ||
|
|
d1a1d43701 | ||
|
|
a45d6d2c2e | ||
|
|
42ed8bb548 | ||
|
|
e9b1b7963b | ||
|
|
0909dc1357 | ||
|
|
b5b1b44c8d | ||
|
|
76f98caa25 | ||
|
|
4ef29d3ad3 | ||
|
|
922143554b | ||
|
|
bd1fd1fb12 | ||
|
|
4335175daa | ||
|
|
5e0198e259 | ||
|
|
ee18b4cc33 | ||
|
|
bafde49d15 | ||
|
|
243f0d7df0 | ||
|
|
86d75bce77 | ||
|
|
330dee04ed | ||
|
|
0a0c456faa | ||
|
|
4ece97a535 | ||
|
|
3984a40fd9 | ||
|
|
f90fc81634 | ||
|
|
2f81bf390f | ||
|
|
e53d5056dd | ||
|
|
ae82bfe7f7 | ||
|
|
05f5da93d3 | ||
|
|
20a969ebcd | ||
|
|
b99463ee99 | ||
|
|
332ed154d4 | ||
|
|
1e10e34449 | ||
|
|
ec8bcc7fd8 | ||
|
|
8c60877ffe | ||
|
|
a15ddd82bb | ||
|
|
a02963cc88 | ||
|
|
182d7f146e | ||
|
|
1582d886aa | ||
|
|
62ccb1f97d | ||
|
|
5f93aac095 | ||
|
|
6b7894eadc | ||
|
|
d21b080c2b | ||
|
|
c75b621951 | ||
|
|
f8f730e379 | ||
|
|
fc06389f32 | ||
|
|
4d2a61b8b7 | ||
|
|
92a848747a | ||
|
|
af6254a8a7 | ||
|
|
89bc5d6e7d | ||
|
|
39fd77d065 | ||
|
|
ea67e9fa38 | ||
|
|
13233ca878 | ||
|
|
f8842ff070 | ||
|
|
b43cb4efb4 | ||
|
|
7979eaac9b | ||
|
|
951de0e5e7 | ||
|
|
239b4d8525 | ||
|
|
89876a2500 | ||
|
|
7ce9dc30a6 | ||
|
|
11c64e084e | ||
|
|
49b806a10e | ||
|
|
e294a5cdc0 | ||
|
|
4803df5d5d | ||
|
|
2144888ef8 | ||
|
|
ebc61c4e4b | ||
|
|
3dae42edb0 | ||
|
|
d147a92695 | ||
|
|
4ea2721b75 | ||
|
|
5b3e662062 | ||
|
|
9d2ba3b022 | ||
|
|
31327e581d | ||
|
|
ea95381410 | ||
|
|
af6b45bd92 | ||
|
|
a81a486602 | ||
|
|
dd2c8c58ca | ||
|
|
32310bad29 | ||
|
|
eadc796e01 | ||
|
|
dc9d3361a0 | ||
|
|
6d5a31cc39 | ||
|
|
10a867227f | ||
|
|
f93ee19b9a | ||
|
|
d3c1d1409d | ||
|
|
5eab1917bd | ||
|
|
c8551abdda | ||
|
|
fbc3afd69e | ||
|
|
65acd0f190 | ||
|
|
58bbe40a8c | ||
|
|
638dd0dcb3 | ||
|
|
5b622fdcd9 | ||
|
|
395ead7ce1 | ||
|
|
2c38aad7fd | ||
|
|
1c1ce285bd | ||
|
|
bb15bbec08 | ||
|
|
542e094348 | ||
|
|
61232dfd95 | ||
|
|
5dbffdb167 | ||
|
|
7ae0fe2209 | ||
|
|
44c43a6fb5 | ||
|
|
f83d33b20d | ||
|
|
c0a1bdd1d6 | ||
|
|
3e4c73e381 | ||
|
|
62e2147f0b | ||
|
|
586977cc89 | ||
|
|
2f88def03a | ||
|
|
cc85e2a441 | ||
|
|
13e305e9e7 | ||
|
|
fb0bc9755e | ||
|
|
b2447ee9d9 | ||
|
|
f1094e9c29 | ||
|
|
29364f7403 | ||
|
|
b078b141f1 | ||
|
|
5659365588 | ||
|
|
c27857d1bb | ||
|
|
b8c93bdb0f | ||
|
|
c8df1418d1 | ||
|
|
e896590eb0 | ||
|
|
99dde5405d | ||
|
|
c346510cdf | ||
|
|
aed9caef6b | ||
|
|
3cf493db73 | ||
|
|
a13f9d9a92 | ||
|
|
eb1e1d4f5c | ||
|
|
0f13d2efc1 | ||
|
|
166ffff875 | ||
|
|
be065e88f8 | ||
|
|
65855544eb | ||
|
|
dd5197f1ce | ||
|
|
54d3484d02 | ||
|
|
d39e6b587c | ||
|
|
ff0c58a901 | ||
|
|
f7e9b50806 | ||
|
|
af098460df | ||
|
|
5af6c07fdf | ||
|
|
e58ce07db1 | ||
|
|
be470f91f7 | ||
|
|
601c52af40 | ||
|
|
0cf99e8bba | ||
|
|
9437da4444 | ||
|
|
189c7e428f | ||
|
|
4f0e06f285 | ||
|
|
c6c67996b5 | ||
|
|
8cc9018b58 | ||
|
|
037e610136 | ||
|
|
105a493a74 | ||
|
|
824c68f766 | ||
|
|
7c60c9dd35 | ||
|
|
30fce076bd | ||
|
|
5a5f0c5fb3 | ||
|
|
d197b78490 | ||
|
|
bf06dd67c5 | ||
|
|
382943ab7c | ||
|
|
183b5d8e8e | ||
|
|
069e689306 | ||
|
|
f53d895f4e | ||
|
|
b325224dbe | ||
|
|
885df927e8 | ||
|
|
2ecb3e461c |
No files matched your search
@@ -0,0 +1,44 @@
|
||||
{
|
||||
"root": true,
|
||||
"env": {
|
||||
"browser": true,
|
||||
"es6": true,
|
||||
"node": true
|
||||
},
|
||||
"extends": [
|
||||
"plugin:vue/essential",
|
||||
"eslint:recommended",
|
||||
"@vue/typescript"
|
||||
],
|
||||
"globals": {
|
||||
"Atomics": "readonly",
|
||||
"SharedArrayBuffer": "readonly"
|
||||
},
|
||||
"parser": "vue-eslint-parser",
|
||||
"parserOptions": {
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"ecmaVersion": 2018,
|
||||
"sourceType": "module"
|
||||
},
|
||||
"plugins": [
|
||||
"vue"
|
||||
],
|
||||
"rules": {
|
||||
"indent": [
|
||||
"error",
|
||||
4
|
||||
],
|
||||
"linebreak-style": [
|
||||
"error",
|
||||
"unix"
|
||||
],
|
||||
"quotes": [
|
||||
"error",
|
||||
"single"
|
||||
],
|
||||
"semi": [
|
||||
"error",
|
||||
"never"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
# Contributor Code of Conduct
|
||||
|
||||
As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
|
||||
|
||||
We are committed to making participation in this project a harassment-free experience for everyone, regardless of the level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion.
|
||||
|
||||
Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
|
||||
|
||||
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
|
||||
@@ -0,0 +1,45 @@
|
||||
# This is a basic workflow to help you get started with Actions
|
||||
|
||||
name: Build
|
||||
|
||||
# Controls when the workflow will run
|
||||
on:
|
||||
# Triggers the workflow on push or pull request events but only for the develop branch
|
||||
push:
|
||||
branches: [ develop ]
|
||||
pull_request:
|
||||
branches: [ develop ]
|
||||
|
||||
# Allows you to run this workflow manually from the Actions tab
|
||||
workflow_dispatch:
|
||||
|
||||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
|
||||
jobs:
|
||||
# This workflow contains a single job called "build"
|
||||
build:
|
||||
# The type of runner that the job will run on
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
# Steps represent a sequence of tasks that will be executed as part of the job
|
||||
steps:
|
||||
- name: Fetch repo
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Install node
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '16'
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm install
|
||||
|
||||
- name: Build
|
||||
run: npm run build
|
||||
|
||||
- name: Copy output
|
||||
run: cp ${{ github.workspace }}/dist/mainsail.zip mainsail-latest.zip
|
||||
|
||||
- uses: actions/upload-artifact@v2.2.4
|
||||
with:
|
||||
name: mainsail-latest.zip
|
||||
path: mainsail-latest.zip
|
||||
@@ -20,3 +20,4 @@ docker/config/*.cfg
|
||||
docker/config/*.conf
|
||||
docker/config/.mainsail.json
|
||||
docker/config/.theme
|
||||
.env
|
||||
@@ -0,0 +1,42 @@
|
||||
# Mainsail Contributing Guide
|
||||
|
||||
Hi! I'm really excited that you are interested in contributing to Mainsail. Before submitting your contribution, please make sure to take a moment and read through the following guidelines:
|
||||
|
||||
- [Code of Conduct](https://github.com/meteyou/mainsail/.github/CODE_OF_CONDUCT.md)
|
||||
- [Issue Reporting Guidelines](#issue-reporting-guidelines)
|
||||
- [Pull Request Guidelines](#pull-request-guidelines)
|
||||
|
||||
## Issue Reporting Guidelines
|
||||
|
||||
- Use [https://github.com/meteyou/mainsail/issues](https://github.com/meteyou/mainsail/issues) to create new issues.
|
||||
|
||||
## Pull Request Guidelines
|
||||
|
||||
- The `master` branch is just a snapshot of the latest stable release. All development should be done in dedicated branches. **Do not submit PRs against the `master` branch.**
|
||||
|
||||
- Checkout a topic branch from the relevant branch, e.g. `develop`, and merge back against that branch.
|
||||
|
||||
- It's OK to have multiple small commits as you work on the PR - GitHub will automatically squash it before merging.
|
||||
|
||||
- If adding a new feature:
|
||||
- Provide a convincing reason to add this feature. Ideally, you should open a suggestion issue first and have it approved before working on it.
|
||||
|
||||
- If fixing bug:
|
||||
- If you are resolving a special issue, add `(fix #xxxx[,#xxxx])` (#xxxx is the issue id) in your PR title for a better release log, e.g. `update entities encoding/decoding (fix #3899)`.
|
||||
- Provide a detailed description of the bug in the PR. Live demo preferred.
|
||||
- Add appropriate test coverage if applicable.
|
||||
|
||||
## Committing Changes
|
||||
|
||||
Commit messages should follow the [commit message convention](https://www.conventionalcommits.org/en/v1.0.0/) so that changelogs can be automatically generated.
|
||||
|
||||
## Financial Contribution
|
||||
|
||||
As a pure community-driven project without major corporate backing, we also welcome financial contributions via Patreon and OpenCollective.
|
||||
|
||||
- [Become a supporter on Patreon](https://patreon.com/meteyou)
|
||||
- [One-time donation via Ko-Fi](https://ko-fi.com/mainsail)
|
||||
|
||||
## Credits
|
||||
|
||||
Thank you to all the people who have already contributed to Mainsail!
|
||||
@@ -1,5 +1,5 @@
|
||||
module.exports = {
|
||||
presets: [
|
||||
'@vue/cli-plugin-babel/preset'
|
||||
]
|
||||
presets: [
|
||||
'@vue/cli-plugin-babel/preset'
|
||||
]
|
||||
}
|
||||
@@ -6,16 +6,16 @@ services:
|
||||
dockerfile: api/Dockerfile
|
||||
image: mainsail-stack-api/1
|
||||
volumes:
|
||||
- ./docker/config:/home/node/printer_config
|
||||
- ./docker/logs:/tmp/logs
|
||||
- ./docker/config:/home/node/klipper_config
|
||||
- ./docker/logs:/home/node/klipper_logs
|
||||
- ./docker/gcode:/home/node/gcode
|
||||
- ./docker/config/moonraker:/home/node/.moonraker_database
|
||||
container_name: ${APP_NAME}-stack-api
|
||||
ports:
|
||||
- 7125:7125
|
||||
- "7125:7125"
|
||||
networks:
|
||||
- dev_net
|
||||
application:
|
||||
npm:
|
||||
build:
|
||||
context: ./docker
|
||||
dockerfile: Dockerfile
|
||||
@@ -24,7 +24,7 @@ services:
|
||||
- ./:/home/node/mainsail
|
||||
container_name: ${APP_NAME}-stack-npm
|
||||
ports:
|
||||
- 8080:8080
|
||||
- "8080:8080"
|
||||
depends_on:
|
||||
- api
|
||||
networks:
|
||||
|
||||
@@ -1,21 +1,17 @@
|
||||
FROM debian:buster AS base
|
||||
FROM python:3-slim-buster AS base
|
||||
|
||||
RUN groupadd --force -g 1000 node
|
||||
RUN useradd -ms /bin/bash --no-user-group -g 1000 -u 1000 node
|
||||
|
||||
RUN apt-get update
|
||||
RUN apt-get install -y sudo wget cmake swig git virtualenv python-dev libffi-dev build-essential libncurses-dev libusb-dev avrdude gcc-avr binutils-avr avr-libc dfu-util libnewlib-arm-none-eabi gcc-arm-none-eabi binutils-arm-none-eabi libusb-1.0
|
||||
RUN apt-get install -y sudo wget cmake swig git virtualenv python-dev libffi-dev \
|
||||
build-essential libncurses-dev libusb-dev avrdude gcc-avr binutils-avr avr-libc \
|
||||
dfu-util libnewlib-arm-none-eabi gcc-arm-none-eabi binutils-arm-none-eabi libusb-1.0
|
||||
RUN mkdir /src
|
||||
WORKDIR /src
|
||||
RUN wget http://download.savannah.nongnu.org/releases/simulavr/libsim_1.1.0_amd64.deb
|
||||
RUN apt install /src/libsim_1.1.0_amd64.deb
|
||||
|
||||
#prebuild files for simulavr, not needed currently, because we just build the python lib later
|
||||
#RUN wget http://download.savannah.nongnu.org/releases/simulavr/simulavr_1.1.0_amd64.deb
|
||||
#RUN apt install /src/simulavr_1.1.0_amd64.deb
|
||||
#RUN wget http://download.savannah.nongnu.org/releases/simulavr/python3-simulavr_1.1.0_amd64.deb
|
||||
#RUN apt install /src/python3-simulavr_1.1.0_amd64.deb
|
||||
|
||||
RUN cat /etc/passwd
|
||||
|
||||
RUN echo 'node ALL=(ALL:ALL) NOPASSWD: ALL' > /etc/sudoers.d/node && \
|
||||
@@ -27,7 +23,7 @@ RUN ln -s /bin/true /bin/systemctl
|
||||
USER node
|
||||
|
||||
WORKDIR /home/node
|
||||
RUN git clone https://github.com/KevinOConnor/klipper
|
||||
RUN git clone https://github.com/klipper3d/klipper
|
||||
WORKDIR /home/node/klipper
|
||||
COPY api/simulavr.config /home/node/klipper/.config
|
||||
RUN make
|
||||
@@ -46,7 +42,6 @@ RUN sed -E 's/check_klipper\(\)/check_klipper() { return 0; }\nold()/' /home/nod
|
||||
RUN chmod +x /home/node/moonraker/scripts/install-moonraker2.sh
|
||||
RUN /home/node/moonraker/scripts/install-moonraker2.sh
|
||||
|
||||
RUN sudo rm -f /bin/systemctl
|
||||
#restore backed up systemctl command
|
||||
#RUN sudo mv /bin/systemctl.bak /bin/systemctl
|
||||
|
||||
@@ -54,13 +49,17 @@ WORKDIR /home/node/
|
||||
RUN git clone https://git.savannah.nongnu.org/git/simulavr.git
|
||||
WORKDIR /home/node/simulavr
|
||||
RUN make python
|
||||
RUN make build
|
||||
RUN make build -j8
|
||||
|
||||
USER root
|
||||
RUN rm /bin/systemctl
|
||||
|
||||
COPY api/run-api /usr/local/bin/run-api
|
||||
RUN chmod +x /usr/local/bin/run-api
|
||||
RUN apt-get -y install supervisor
|
||||
|
||||
USER node
|
||||
RUN ln -s /usr/bin/supervisorctl /bin/systemctl
|
||||
|
||||
ENTRYPOINT ["run-api"]
|
||||
RUN mkdir -p /var/log/supervisor
|
||||
COPY api/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
||||
COPY api/start-api /bin/start-api
|
||||
RUN chmod +x /bin/start-api
|
||||
ENTRYPOINT ["/bin/start-api"]
|
||||
@@ -1,6 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
PYTHONPATH="/home/node/simulavr/build/pysimulavr/" /home/node/klipper/scripts/avrsim.py -m atmega644 -s 20000000 -b 250000 /home/node/klipper/simulavr.elf &
|
||||
/home/node/klippy-env/bin/python /home/node/klipper/klippy/klippy.py /home/node/printer_config/printer.cfg -l /tmp/logs/klippy.log -a /tmp/klippy_uds &
|
||||
/home/node/moonraker-env/bin/python /home/node/moonraker/moonraker/moonraker.py -l /tmp/logs/moonraker.log -c /home/node/printer_config/moonraker.conf &
|
||||
echo "Starting ..." >> /tmp/logs/klippy.log
|
||||
tail -f /tmp/logs/klippy.log
|
||||
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
chown -hR node:node /home/node/klipper_logs
|
||||
/usr/bin/supervisord
|
||||
@@ -0,0 +1,38 @@
|
||||
[supervisord]
|
||||
#logfile=/tmp/supervisord.log ; (main log file;default $CWD/supervisord.log)
|
||||
logfile_maxbytes=50MB ; (max main logfile bytes b4 rotation;default 50MB)
|
||||
logfile_backups=10 ; (num of main logfile rotation backups;default 10)
|
||||
loglevel=info ; (log level;default info; others: debug,warn,trace)
|
||||
pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
|
||||
nodaemon=true ; (start in foreground if true;default false)
|
||||
minfds=1024 ; (min. avail startup file descriptors;default 1024)
|
||||
minprocs=200 ; (min. avail process descriptors;default 200)
|
||||
|
||||
[program:simulavr]
|
||||
command=bash -c 'sleep 10 && /home/node/klipper/scripts/avrsim.py -m atmega644 -s 20000000 -b 250000 /home/node/klipper/simulavr.elf'
|
||||
environment=PYTHONPATH=/home/node/simulavr/build/pysimulavr/
|
||||
user=node
|
||||
process_name=simulavr
|
||||
directory=/home/node
|
||||
autostart=true
|
||||
autorestart=true
|
||||
redirect_stderr=true
|
||||
|
||||
[program:klipper]
|
||||
command=/home/node/klippy-env/bin/python /home/node/klipper/klippy/klippy.py /home/node/klipper_config/printer.cfg -l /home/node/klipper_logs/klippy.log -a /tmp/klippy_uds
|
||||
user=node
|
||||
process_name=klipper
|
||||
directory=/home/node
|
||||
autostart=true
|
||||
autorestart=true
|
||||
redirect_stderr=true
|
||||
|
||||
|
||||
[program:moonraker]
|
||||
command=/home/node/moonraker-env/bin/python /home/node/moonraker/moonraker/moonraker.py -l /home/node/klipper_logs/moonraker.log -c /home/node/klipper_config/moonraker.conf
|
||||
user=node
|
||||
process_name=moonraker
|
||||
directory=/home/node
|
||||
autostart=true
|
||||
autorestart=true
|
||||
redirect_stderr=true
|
||||
@@ -6,7 +6,7 @@ path: ~/gcode
|
||||
|
||||
[mcu]
|
||||
serial: /tmp/pseudoserial
|
||||
pin_map: arduino
|
||||
restart_method: arduino
|
||||
baud: 250000
|
||||
|
||||
[stepper_x]
|
||||
@@ -110,70 +110,3 @@ max_z_accel: 100
|
||||
# G28 Y0
|
||||
# G28 X0
|
||||
# G28 Z0
|
||||
|
||||
[gcode_macro PAUSE]
|
||||
rename_existing: BASE_PAUSE
|
||||
default_parameter_X: 230 #edit to your park position
|
||||
default_parameter_Y: 230 #edit to your park position
|
||||
default_parameter_Z: 10 #edit to your park position
|
||||
default_parameter_E: 1 #edit to your retract length
|
||||
gcode:
|
||||
SAVE_GCODE_STATE NAME=PAUSE_state
|
||||
BASE_PAUSE
|
||||
G91
|
||||
G1 E-{E} F2100
|
||||
G1 Z{Z}
|
||||
G90
|
||||
G1 X{X} Y{Y} F6000
|
||||
[gcode_macro RESUME]
|
||||
rename_existing: BASE_RESUME
|
||||
default_parameter_E: 1 #edit to your retract length
|
||||
gcode:
|
||||
G91
|
||||
G1 E{E} F2100
|
||||
G90
|
||||
RESTORE_GCODE_STATE NAME=PAUSE_state MOVE=1
|
||||
BASE_RESUME
|
||||
[gcode_macro CANCEL_PRINT]
|
||||
rename_existing: BASE_CANCEL_PRINT
|
||||
gcode:
|
||||
TURN_OFF_HEATERS
|
||||
CLEAR_PAUSE
|
||||
SDCARD_RESET_FILE
|
||||
BASE_CANCEL_PRINT
|
||||
|
||||
[gcode_macro START_PRINT]
|
||||
default_parameter_BED_TEMP: 103.3
|
||||
default_parameter_EXTRUDER_TEMP: 103.3
|
||||
gcode:
|
||||
# Start bed heating
|
||||
M140 S103.3
|
||||
# Use absolute coordinates
|
||||
G90
|
||||
# Reset the G-Code Z offset (adjust Z offset if needed)
|
||||
SET_GCODE_OFFSET Z=0.0
|
||||
# Home the printer
|
||||
G28
|
||||
# Move the nozzle near the bed
|
||||
G1 Z5 F3000
|
||||
# Move the nozzle very close to the bed
|
||||
G1 Z0.15 F300
|
||||
# Wait for bed to reach temperature
|
||||
M190 S103.3
|
||||
# Set and wait for nozzle to reach temperature
|
||||
M109 S103.3
|
||||
|
||||
[gcode_macro END_PRINT]
|
||||
gcode:
|
||||
# Turn off bed, extruder, and fan
|
||||
M140 S0
|
||||
M104 S0
|
||||
M106 S0
|
||||
# Move nozzle away from print while retracting
|
||||
G91
|
||||
G1 X-2 Y-2 E-3 F300
|
||||
# Raise nozzle by 10mm
|
||||
G1 Z10 F3000
|
||||
G90
|
||||
# Disable steppers
|
||||
M84
|
||||
@@ -226,7 +226,7 @@ GEM
|
||||
jekyll-seo-tag (~> 2.1)
|
||||
minitest (5.14.4)
|
||||
multipart-post (2.1.1)
|
||||
nokogiri (1.12.3)
|
||||
nokogiri (1.12.5)
|
||||
mini_portile2 (~> 2.6.1)
|
||||
racc (~> 1.4)
|
||||
octokit (4.21.0)
|
||||
|
||||
@@ -1 +1 @@
|
||||
Welcome to the Mainsail documentation. The [index](http://meteyou.github.io/mainsail) of the docs is here.
|
||||
Welcome to the Mainsail documentation. The [index](https://docs.mainsail.xyz) of the docs is here.
|
||||
@@ -8,10 +8,9 @@ color_scheme: "mainsail"
|
||||
search_enabled: true
|
||||
aux_links:
|
||||
"Mainsail on GitHub":
|
||||
- "//github.com/meteyou/mainsail"
|
||||
- "//github.com/mainsail-crew/mainsail"
|
||||
aux_links_new_tab: true
|
||||
|
||||
|
||||
defaults:
|
||||
-
|
||||
scope:
|
||||
|
||||
@@ -2,3 +2,4 @@ name,short_note,author,repo
|
||||
Dracula,,steadyjaw,dracula-mainsail-theme
|
||||
Cyberpunk,,Dario-Ciceri,cp2077-mainsail-theme
|
||||
Mainsail x Voron Toolhead,Various toolhead images inside the theme folder can be renamed to 'sidebar-background.png',eriroh,Mainsail-x-Voron-Toolhead-Theme
|
||||
Rat Rig (unofficial), includes various sidebar images which can be renamed to ‘sidebar-background.png’,Raabi91,ratrig-mainsail-theme
|
||||
|
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 63 KiB |
|
Before Width: | Height: | Size: 336 KiB After Width: | Height: | Size: 385 KiB |
|
After Width: | Height: | Size: 90 KiB |
|
After Width: | Height: | Size: 75 KiB |
|
After Width: | Height: | Size: 34 KiB |
|
After Width: | Height: | Size: 82 KiB |
|
After Width: | Height: | Size: 82 KiB |
|
After Width: | Height: | Size: 32 KiB |
|
After Width: | Height: | Size: 61 KiB |
|
After Width: | Height: | Size: 43 KiB |
|
After Width: | Height: | Size: 32 KiB |
|
After Width: | Height: | Size: 85 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 85 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 29 KiB |
|
After Width: | Height: | Size: 30 KiB |
@@ -0,0 +1,140 @@
|
||||
---
|
||||
layout: default
|
||||
title: Configuration
|
||||
nav_order: 5
|
||||
has_children: false
|
||||
permalink: /configuration
|
||||
---
|
||||
|
||||
# Required configuration
|
||||
|
||||
**Mainsail requires a minimum configuration to function properly and will display a warning at startup if the required parts are not found in your configuration file(s).**
|
||||
{: .warning}
|
||||
|
||||
The following configuration elements are mandatory and must be configured for Mainsail to operate:
|
||||
|
||||
* [Virtual SD Card](configuration#virtual_sdcard)
|
||||
* [Display Status](configuration#display_status)
|
||||
* [Pause / Resume](configuration#pause_resume)
|
||||
* [GCode Macros](configuration#pause--resume--cancel)
|
||||
|
||||
The following configuration elements are optional, including making tweaks and alterations to Klipper's default commands:
|
||||
* [Custom Commands](configuration#customisation)
|
||||
|
||||
## Virtual SD Card
|
||||
This allows gcode file uploads.
|
||||
```yaml
|
||||
[virtual_sdcard]
|
||||
path: ~/gcode_files
|
||||
```
|
||||
|
||||
## Display Status
|
||||
This is required for messages in your status panel, if you don't have a `[display]` in your configuration.
|
||||
```yaml
|
||||
[display_status]
|
||||
```
|
||||
|
||||
## Pause, Resume, Cancel
|
||||
This enables pause / resume in mainsail.
|
||||
|
||||
```yaml
|
||||
[pause_resume]
|
||||
```
|
||||
|
||||
# Macros
|
||||
## for pause / resume / cancel functionality
|
||||
These should be modified to your own needs.
|
||||
{% raw %}
|
||||
```yaml
|
||||
[gcode_macro PAUSE]
|
||||
description: Pause the actual running print
|
||||
rename_existing: PAUSE_BASE
|
||||
gcode:
|
||||
##### set defaults #####
|
||||
{% set x = params.X|default(230) %} #edit to your park position
|
||||
{% set y = params.Y|default(230) %} #edit to your park position
|
||||
{% set z = params.Z|default(10)|float %} #edit to your park position
|
||||
{% set e = params.E|default(1) %} #edit to your retract length
|
||||
##### calculate save lift position #####
|
||||
{% set max_z = printer.toolhead.axis_maximum.z|float %}
|
||||
{% set act_z = printer.toolhead.position.z|float %}
|
||||
{% set lift_z = z|abs %}
|
||||
{% if act_z < (max_z - lift_z) %}
|
||||
{% set z_safe = lift_z %}
|
||||
{% else %}
|
||||
{% set z_safe = max_z - act_z %}
|
||||
{% endif %}
|
||||
##### end of definitions #####
|
||||
PAUSE_BASE
|
||||
G91
|
||||
{% if printer.extruder.can_extrude|lower == 'true' %}
|
||||
G1 E-{e} F2100
|
||||
{% else %}
|
||||
{action_respond_info("Extruder not hot enough")}
|
||||
{% endif %}
|
||||
{% if "xyz" in printer.toolhead.homed_axes %}
|
||||
G1 Z{z_safe}
|
||||
G90
|
||||
G1 X{x} Y{y} F6000
|
||||
{% else %}
|
||||
{action_respond_info("Printer not homed")}
|
||||
{% endif %}
|
||||
```
|
||||
|
||||
```yaml
|
||||
[gcode_macro RESUME]
|
||||
description: Resume the actual running print
|
||||
rename_existing: RESUME_BASE
|
||||
gcode:
|
||||
##### set defaults #####
|
||||
{% set e = params.E|default(1) %} #edit to your retract length
|
||||
#### get VELOCITY parameter if specified ####
|
||||
{% if 'VELOCITY' in params|upper %}
|
||||
{% set get_params = ('VELOCITY=' + params.VELOCITY) %}
|
||||
{%else %}
|
||||
{% set get_params = "" %}
|
||||
{% endif %}
|
||||
##### end of definitions #####
|
||||
G91
|
||||
{% if printer.extruder.can_extrude|lower == 'true' %}
|
||||
G1 E{e} F2100
|
||||
{% else %}
|
||||
{action_respond_info("Extruder not hot enough")}
|
||||
{% endif %}
|
||||
RESUME_BASE {get_params}
|
||||
```
|
||||
|
||||
|
||||
```yaml
|
||||
[gcode_macro CANCEL_PRINT]
|
||||
description: Cancel the actual running print
|
||||
rename_existing: CANCEL_PRINT_BASE
|
||||
gcode:
|
||||
TURN_OFF_HEATERS
|
||||
CANCEL_PRINT_BASE
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
# Optional
|
||||
|
||||
## Customisation
|
||||
Klipper has many canned/preset commands that are themselves just macros.
|
||||
|
||||
The default configuration of these may not suit your needs or preferences, (though they are usually a good place to start). It's possible to adjust these by including them in your config, along with whatever code you would like to run.
|
||||
|
||||
## Example
|
||||
Adjusting the `BED_MESH_CALIBRATE` command (which can be run from the Sidebar > Heightmap > Calibrate.
|
||||
{% raw %}
|
||||
```yaml
|
||||
[gcode_macro BED_MESH_CALIBRATE]
|
||||
rename_existing: BASE_BED_MESH_CALIBRATE
|
||||
gcode:
|
||||
#before the original gcode
|
||||
BED_MESH_CLEAR
|
||||
QUAD_GANTRY_LEVEL
|
||||
G1 X125 Y125 Z5 F6000
|
||||
#the original gcode
|
||||
BASE_BED_MESH_CALIBRATE
|
||||
#after the original gcode
|
||||
```
|
||||
{% endraw %}
|
||||
@@ -13,15 +13,15 @@ description: >-
|
||||
<!-- {{ page.description }} -->
|
||||
|
||||
|
||||
We would like to say "thank you" to all the
|
||||
We would like acknowledge the valuable contributions that many people and projects have made to Mainsail, particularly the:
|
||||
|
||||
- contributors, who help make Mainsail better
|
||||
- testers, who help find bugs in Mainsail, so they can be quickly fixed
|
||||
- supporters via patreon/ko-fi
|
||||
|
||||
and of course the projects Mainsail is built on, especially [Klipper](https://github.com/KevinOConnor/klipper){:target="_blank"}, [Moonraker](https://github.com/Arksine/moonraker){:target="_blank"} and [MainsailOS](https://github.com/raymondh2/MainsailOS/){:target="_blank"}.
|
||||
..and of course the projects Mainsail is built on, especially [Klipper](https://github.com/KevinOConnor/klipper){:target="_blank"}, [Moonraker](https://github.com/Arksine/moonraker){:target="_blank"} and [MainsailOS](https://github.com/mainsail-crew/MainsailOS/){:target="_blank"}.
|
||||
|
||||
**THANK YOU for YOUR support. ❤️**
|
||||
**THANK YOU for your continued support.**
|
||||
|
||||
- TOC
|
||||
{:toc}
|
||||
@@ -38,4 +38,4 @@ and of course the projects Mainsail is built on, especially [Klipper](https://gi
|
||||
| project | license | link |
|
||||
|:--------|:-------:|:-----|
|
||||
{% for deps in site.data.licenses %}| **{{ deps[0] }}**<br>{{ deps[1].description }} | [{{ deps[1].licenses }}]({{ deps[1].licenseUrl }}){:target="_blank"} | [{{ deps[1].repository }}]({{ deps[1].repository }}){:target="_blank"} |
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
@@ -0,0 +1,41 @@
|
||||
---
|
||||
layout: default
|
||||
title: Data Privacy
|
||||
nav_order: 99
|
||||
has_children: false
|
||||
permalink: /data-privacy
|
||||
has_toc: false
|
||||
---
|
||||
|
||||
# Data Privacy
|
||||
|
||||
We understand the need for data privacy and have designed Mainsail to operate in your browser’s cache locally.
|
||||
|
||||
The following table applies to Mainsail when installed locallaly, or accessed via [my.mainsail.xyz](http://my.mainsail.xyz).
|
||||
|
||||
| YES | NO |
|
||||
| :--------------: | :---------------: |
|
||||
| Store static files in browser storage (.html, .js, .css) | ‘Phone home’ |
|
||||
| Communicate directly with your printer via the Moonraker API | Send/transfer any data externally |
|
||||
|
||||
## Will my data be safe if I use the hosted version?
|
||||
Accessing [my.mainsail.xyz](http://my.mainsail.xyz) stores the .html, .js and .css files for Mainsail locally in the brower's storage in exactly the same way that an instance running on your local hardware would do. In reality, there is no functional difference (or concern) between accessing Mainsail from a privately or publicly hosted instance.
|
||||
|
||||
|
||||
Parallel operation is also possible.
|
||||
|
||||
# Third party software
|
||||
|
||||
We do not modify third party packages or software, nor control their attitude to Data Privacy.
|
||||
|
||||
If you are concerned, please consider the privacy policies (or contacting the developer) of:
|
||||
|
||||
* [RaspberryOS](https://www.raspberrypi.org/privacy/)
|
||||
* Klipper
|
||||
* Moonraker
|
||||
|
||||
|
||||
It is worth noting that Klipper, Moonraker and RaspberryOS are open source software and ( whilst this brings no guarantee of privacy and security) the source is available and open to peer review.
|
||||
{: .info}
|
||||
The Raspberry Foundation is a registered charity in the United Kingdom, with extensive Privacy and Safeguarding policies.
|
||||
{: .info}
|
||||
@@ -19,8 +19,8 @@ You can contribute in a couple of different ways:
|
||||
(For Example: [BabelEdit](https://www.codeandweb.com/babeledit), [i18N-Manager](https://www.electronjs.org/apps/i18n-manager))
|
||||
2. Create/Update translations using [VSCode](https://code.visualstudio.com/) and [i18n Ally](https://github.com/lokalise/i18n-ally).
|
||||
|
||||
If you have a finished translation file, you can make a [PR (pull request)](https://github.com/meteyou/mainsail/pulls)
|
||||
on github or create an [issue](https://github.com/meteyou/mainsail/issues) on github and attach the translation.
|
||||
If you have a finished translation file, you can make a [PR (pull request)](https://github.com/mainsail-crew/mainsail/pulls)
|
||||
on github or create an [issue](https://github.com/mainsail-crew/mainsail/issues) on github and attach the translation.
|
||||
|
||||
## Testing
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
---
|
||||
layout: default
|
||||
title: FAQ
|
||||
nav_order: 110
|
||||
has_children: true
|
||||
permalink: /faq/
|
||||
has_toc: false
|
||||
---
|
||||
# Frequently Askes Questions
|
||||
|
||||
We are still gathering some "frequently asked questions" and will publish them here soon.
|
||||
|
||||
The primary reason why this section already exists, is because of the Klipper warnings in the subcategory, that needed to be fixed fast.
|
||||
@@ -0,0 +1,48 @@
|
||||
---
|
||||
layout: default
|
||||
title: Command format mismatch
|
||||
parent: Klipper Errors
|
||||
grand_parent: FAQ
|
||||
nav_order: 10
|
||||
has_children: false
|
||||
permalink: /faq/klipper_errors/command_format_mismatch
|
||||
has_toc: false
|
||||
description: >-
|
||||
You have updated Klipper and now you get this cryptic error message? We would like to help...
|
||||
---
|
||||
|
||||
# Klipper Error - Command format mismatch
|
||||
|
||||
You have updated Klipper and now you get this cryptic error message?
|
||||
|
||||

|
||||
|
||||
This is an error and needs to be fixed to make Mainsail and Klipper work again.
|
||||
{: .info}
|
||||
|
||||
## TL;DR
|
||||
|
||||
Klipper on your host and on your MCU have different versions.
|
||||
Recompile and flash your MCUs and it will work again. Please also pay attention to the "Linux MCU", if you had e.g. an adxl345 in use.
|
||||
|
||||
The following links should help you to solve the problem:
|
||||
[Klipper SD-Card Updates](https://www.klipper3d.org/SDCard_Updates.html){:target="_blank"}
|
||||
[Klipper Building and flashing the micro-controller](https://www.klipper3d.org/Installation.html#building-and-flashing-the-micro-controller){:target="_blank"}
|
||||
|
||||
## More detailed
|
||||
|
||||
Klipper consists of two parts:
|
||||
The software on your host (e.g. Raspberry Pi) and the firmware on your microcontroller (MCU).
|
||||
|
||||
Under normal circumstances, Klipper (on your host) can simply be updated from Mainsail without any problems and everything will work as expected.
|
||||
|
||||
From time to time it happens that there are changes in Klipper that make it necessary to update all your MCUs. Assuming you have run a Klipper update and Klipper on your host now supports commands that your MCUs does not understand. Then you will get the above error message.
|
||||
|
||||
Fortunately, these kind of updates don't happen very often, but now it has happened to you. ;-)
|
||||
|
||||
In order to solve the problem, you need to update all your MCUs. We are talking about multiple MCUs here, as people tend to forget that they have multiple microcontrollers in use. One of these candidates is the "Linux MCU" that many people install on their Raspberry Pi to measure resonances with an adxl345.
|
||||
|
||||
Detailed information on how to update the firmware can be found in the Klipper Documentation linked above (under TL;DR).
|
||||
|
||||
As far as we know, work is in progress to let Klipper update the firmware on its own.
|
||||
{: .info}
|
||||
@@ -0,0 +1,9 @@
|
||||
---
|
||||
layout: default
|
||||
title: Klipper Errors
|
||||
parent: FAQ
|
||||
nav_order: 50
|
||||
has_children: true
|
||||
permalink: /faq/klipper_errors
|
||||
has_toc: false
|
||||
---
|
||||
@@ -0,0 +1,95 @@
|
||||
---
|
||||
layout: default
|
||||
title: Deprecated Options
|
||||
parent: Klipper Warnings
|
||||
grand_parent: FAQ
|
||||
nav_order: 20
|
||||
has_children: false
|
||||
permalink: /faq/klipper_warnings/deprecated_option
|
||||
has_toc: false
|
||||
---
|
||||
|
||||
# Deprecated Options
|
||||
|
||||
###### default_parameter
|
||||
## Removal of `default_parameter_` for gcode macros.
|
||||
|
||||
In the past, default parameters for gcode macros were defined like so:
|
||||
|
||||
```yaml
|
||||
[gcode_macro PRINT_START]
|
||||
default_parameter_EXTRUDER: 230
|
||||
gcode:
|
||||
...
|
||||
```
|
||||
This would define a macro called `PRINT_START` that can be called with an `EXTRUDER` parameter like so: `PRINT_START EXTRUDER=200`. If no value is passed for `EXTRUDER` the default value of 230 is used. This style of default parameters has been deprecated. Instead, define your macro like so:
|
||||
|
||||
{% raw %}
|
||||
```yaml
|
||||
[gcode_macro PRINT_START]
|
||||
gcode:
|
||||
{% set EXTRUDER_TEMP = params.EXTRUDER|default(230)|int %}
|
||||
```
|
||||
{% endraw %}
|
||||
Take note of the following important aspects:
|
||||
- Parameters passed to gcode macros are stored in the `params` object. So if your macro is called with `VALUE=50`, `params.VALUE` will contain the value 50. After the deprecation, only the `params` object will contain these values.
|
||||
- Make sure to name your "set variable" something else as the name of the variable in the `params` object (see how I used `EXTRUDER_TEMP` for the "set variable" and `EXTRUDER` for the actual macro parameter above) to avoid confusion and possible parsing errors.
|
||||
- If you want to pass a default, add `|default(<default value>)` to the end of the params variable (see above, where my default value is 10).
|
||||
- To ensure that `EXTRUDER_TEMP` will have an integer value, add `|int` to the end of the command, to turn passed parameters (if they exist) and the default into an integer. Depending on what kind of parameter you're passing, there are `|int` `|float` `|bool` or `|string` converters available. Make sure that you convert to int if you want to compare the values in your gcode macro.
|
||||
|
||||
The above description was provided by our community member [FHeilmann](https://github.com/FHeilmann){:target="_blank"} and we have his permission to publish it here. Thanks a lot!
|
||||
[Source](https://gist.github.com/FHeilmann/a8097b3e908e85de7255bbe6246ddfd5){:target="_blank"}.
|
||||
{: .info}
|
||||
|
||||
###### step_distance
|
||||
## Removal of `step_distance`
|
||||
|
||||
`step_distance` describes the distance covered by a certain axis with 1 stepper (micro-)step. The downside of this parameter (and one of the reasons for its removal, is that if one were to change the microstepping of a stepper, the step_distance changes as well. Klipper therefore removed the `step_distance` parameter in favor of `rotation_distance` and `full_steps_per_rotation`. These two parameters are unaffected by microstepping, and can be easily determined by inspecting the used hardware.
|
||||
|
||||
Perform the following steps to convert your config:
|
||||
- comment out the old `step_distance` parameter
|
||||
- add three new parameters:
|
||||
- `full_steps_per_rotation` this is 400 for 0.9 degree stepper motors and 200 for 1.8 degree stepper motors.
|
||||
- `rotation_distance` this can be determined either according to hardware, or by converting the old `step_distance` using math.
|
||||
- `gear_ratio` can additionally be used to describe an axis that uses a reduction gear (like the Voron-2 Z axis)
|
||||
- The easiest way to obtain the correct values for `rotation_distance` and `gear_ratio` is to check the official Voron printer github repositories. All example configs have been updated to include the correct values for the new parameters. Keep in mind that you'll still have to calibrate your extruder steps/mm if you choose to copy the values for the extruder. Instructions on how to convert and recalibrate the extruder values can be found [here](https://github.com/Klipper3d/klipper/blob/master/docs/Rotation_Distance.md#extruder).
|
||||
- The formulas to convert `step_distance` to `rotation distance` can be found [here](https://github.com/Klipper3d/klipper/blob/master/docs/Rotation_Distance.md#obtaining-rotation_distance-from-steps_per_mm-or-step_distance)
|
||||
- Guidance on how to inspect your hardware to determine your conversion distance can be found [here](https://github.com/Klipper3d/klipper/blob/master/docs/Rotation_Distance.md#obtaining-rotation_distance-by-inspecting-the-hardware). Make sure to also consider any reduction gearing, if applicable, by checking [this section](https://github.com/Klipper3d/klipper/blob/master/docs/Rotation_Distance.md#using-a-gear_ratio) as well.
|
||||
- For every stepper, except your extruder, you should end up with even numbers (e.g. 40 instead of 39.9683).
|
||||
|
||||
The above description was provided by our community member [FHeilmann](https://github.com/FHeilmann){:target="_blank"} and we have his permission to publish it here. Thanks a lot!
|
||||
[Source](https://gist.github.com/FHeilmann/a8097b3e908e85de7255bbe6246ddfd5){:target="_blank"}.
|
||||
{: .info}
|
||||
|
||||
###### pin_map
|
||||
## Removal of `pin_map`
|
||||
|
||||
For Voron printers, this is only relevant if you're running an arduino based controller board and use pins named similar to `ar19` etc. These pin declarations are no longer valid and need to be replaced with their hardware pin identifiers. To find the appropriate hardware pin identifier perform a google image search for your board plus `pinout`. E.g.:
|
||||
|
||||
`arduino mega 2560 pinout`
|
||||
|
||||
which will yield images such as this one:
|
||||
|
||||

|
||||
|
||||
There, find the pin you're trying to replace. The old pin maps use the digital number of the pin. For example, if your old pin was `ar10`, looking at the image you will find that the `D10` pin corresponds to `PB4`. Replace all pins in your config accordingly, and finally remove the `pin_map:` configuration parameter from your `mcu` section.
|
||||
|
||||
Alternatively, you can copy an appropriate `[board_pins]` block from [this location](https://github.com/Klipper3d/klipper/blob/master/config/sample-aliases.cfg) to your config. If you're using multiple arduinos, make sure to add the appropriate mcu to each block like so:
|
||||
|
||||
```yaml
|
||||
[board_pins arduino-mega]
|
||||
mcu: mcu
|
||||
```
|
||||
|
||||
The above description was provided by our community member [FHeilmann](https://github.com/FHeilmann){:target="_blank"} and we have his permission to publish it here. Thanks a lot!
|
||||
[Source](https://gist.github.com/FHeilmann/a8097b3e908e85de7255bbe6246ddfd5){:target="_blank"}.
|
||||
{: .info}
|
||||
|
||||
###### pid_integral_max
|
||||
## Removal of `pid_integral_max`
|
||||
|
||||
Remove any instances of `pid_integral_max` from your config.
|
||||
|
||||
The above description was provided by our community member [FHeilmann](https://github.com/FHeilmann){:target="_blank"} and we have his permission to publish it here. Thanks a lot!
|
||||
[Source](https://gist.github.com/FHeilmann/a8097b3e908e85de7255bbe6246ddfd5){:target="_blank"}.
|
||||
{: .info}
|
||||
@@ -0,0 +1,33 @@
|
||||
---
|
||||
layout: default
|
||||
title: Deprecated Values
|
||||
parent: Klipper Warnings
|
||||
grand_parent: FAQ
|
||||
nav_order: 10
|
||||
has_children: false
|
||||
permalink: /faq/klipper_warnings/deprecated_value
|
||||
has_toc: false
|
||||
---
|
||||
|
||||
# Deprecated Values
|
||||
|
||||
###### NTC 100K beta 3950
|
||||
## Removal of `NTC 100K beta 3950` sensor type.
|
||||
|
||||
The "NTC 100K beta 3950" temperature sensor is _deprecated_ and will be removed in the near future.
|
||||
|
||||
In order to solve the problem search in your config for `sensor_type: NTC 100K beta 3950` and replace it with `sensor_type: Generic 3950`.
|
||||
|
||||
Most users will find the "Generic 3950" temperature sensor more accurate. Anyway you can continue to use the older (typically less accurate) definition. Therefor define a custom thermistor with `temperature1: 25`, `resistance1: 100000`, and `beta: 3950`.
|
||||
|
||||
[Source](https://www.klipper3d.org/Config_Changes.html){:target="_blank"} Klipper Configuration Changes
|
||||
{: .info}
|
||||
|
||||
###### rpi_temperature
|
||||
## Removal of `rpi_temperature` sensor alias.
|
||||
|
||||
Replace `sensor_type: rpi_temperature` by `sensor_type: temperature_host` everywhere in your config.
|
||||
|
||||
The above description was provided by our community member [FHeilmann](https://github.com/FHeilmann){:target="_blank"} and we have his permission to publish it here. Thanks a lot!
|
||||
[Source](https://gist.github.com/FHeilmann/a8097b3e908e85de7255bbe6246ddfd5){:target="_blank"}.
|
||||
{: .info}
|
||||
@@ -0,0 +1,9 @@
|
||||
---
|
||||
layout: default
|
||||
title: Klipper Warnings
|
||||
parent: FAQ
|
||||
nav_order: 10
|
||||
has_children: true
|
||||
permalink: /faq/klipper_warnings
|
||||
has_toc: false
|
||||
---
|
||||
@@ -6,12 +6,12 @@ has_children: false
|
||||
---
|
||||
|
||||
# Welcome to Mainsail!
|
||||
Mainsail is a lightweight & responsive web interface for Klipper, the 3D printer firmware. It focuses especially on an intuitive and consistent interface.
|
||||
Mainsail aims to make Klipper more accessible to end users through a lightweight, responsive web ui, centred around an intuitive and consistent design philsophy.
|
||||
{: .fs-5 }
|
||||
|
||||
[Getting Started](/setup){: .btn .btn-primary }
|
||||
[GitHub](https://github.com/meteyou/mainsail){: .btn}{:target="_blank"}
|
||||
[Release Notes](https://github.com/meteyou/mainsail/releases){: .btn}{:target="_blank"}
|
||||
[GitHub](https://github.com/mainsail-crew/mainsail){: .btn}{:target="_blank"}
|
||||
[Release Notes](https://github.com/mainsail-crew/mainsail/releases){: .btn}{:target="_blank"}
|
||||
|
||||
## Screenshots
|
||||

|
||||
@@ -34,7 +34,7 @@ Do you need help or just want to talk? Join us on discord. We have a very active
|
||||
Have you found a bug? Then we would like you to create an Issue on GitHub.
|
||||
|
||||
[Discord](https://discord.gg/skWTwTD){: .btn}{:target="_blank"}
|
||||
[GitHub Issues](https://github.com/meteyou/mainsail/issues){: .btn}{:target="_blank"}
|
||||
[GitHub Issues](https://github.com/mainsail-crew/mainsail/issues){: .btn}{:target="_blank"}
|
||||
|
||||
## Support this project
|
||||
The project is primarily developed and maintained by meteyou. To keep the project going he invests his free time, almost every day. To motivate him (☕🍺😜) there are several ways to support the project.
|
||||
@@ -43,4 +43,4 @@ The project is primarily developed and maintained by meteyou. To keep the projec
|
||||
- [Ko-Fi (one-time)](https://ko-fi.com/mainsail){:target="_blank"}
|
||||
|
||||
However, we would also like to ask you to support the regular contributors.
|
||||
{: .info}
|
||||
{: .info}
|
||||
@@ -0,0 +1,115 @@
|
||||
---
|
||||
layout: default
|
||||
title: Multicam
|
||||
parent: Quicktips
|
||||
has_children: false
|
||||
permalink: /quicktips/multicam
|
||||
description: >-
|
||||
How to setup multi Webcams with mainsailOS.
|
||||
---
|
||||
|
||||
# {{ page.title }}
|
||||
{{ page.description }}
|
||||
|
||||
__Disclaimer__
|
||||
Thank you [Charlie_Powell](https://community.octoprint.org/u/Charlie_Powell) for letting us adapt your guide for mainsailOS!
|
||||
The original guide can be found [here](https://community.octoprint.org/t/setting-up-multiple-webcams-in-octopi-the-right-way/32669).
|
||||
{: .info}
|
||||
|
||||
## Prerequisites
|
||||
You need:
|
||||
|
||||
- mainsailOS v0.5.0 or higher
|
||||
- ssh access
|
||||
- at least two cameras
|
||||
|
||||
__WARNING__
|
||||
**If you are working on a existing installation, make a backup!**
|
||||
{: .warning}
|
||||
|
||||
## Creating the configuration files
|
||||
mainsailOS supports an infinite number of webcam*.txt-style configuration files. They can be placed in
|
||||
`/home/pi/klipper_config`.
|
||||
|
||||
In the UI, got to 'Settings > Interface' click on (1) and save as `webcam2.txt`.
|
||||
|
||||
:image:
|
||||
|
||||
Now you should have two identical files:
|
||||
1. `/home/pi/klipper_config/webcam.txt`
|
||||
2. `/home/pi/klipper_config/webcam2.txt`
|
||||
|
||||
## Editing the original configuration file for a specific camera
|
||||
Find out the path to the camera by ID. This makes it much easier to stop /dev/video0 and /dev/video1 from switching on you.
|
||||
|
||||
Run `ls /dev/v4l/by-id`, copy your camera id and paste it into the editor in mainsail. For example:
|
||||
|
||||
```bash
|
||||
$ ls /dev/v4l/by-id/
|
||||
usb-046d_0825_88C56B60-video-index0 usb-046d_0825_88C56B60-video-index1
|
||||
```
|
||||
I'll use the first one `usb-046d_0825_88C56B60-video-index0`
|
||||
|
||||
|
||||
__Note__
|
||||
Not sure which device is which? You can run lsusb to match a name to an ID.
|
||||
{: .info}
|
||||
|
||||
Then edit `/home/pi/klipper_config/webcam.txt` in by clicking on it in mainsail.
|
||||
|
||||
Set `camera="usb"` at the top, and the `camera_usb_options` line to indicate the device:
|
||||
|
||||
`camera_usb_options="-r 640x480 -f 10 -d /dev/v4l/by-id/<device long id>"`
|
||||
|
||||
__Note__
|
||||
Using a Raspberry Pi camera? Set camera="raspi" at the top of the file, and you can ignore referencing the cameras by device ID.
|
||||
{: .info}
|
||||
|
||||
## 3. Editing the second configuration file
|
||||
There's two things that need adjusting here: the port mjpg_streamer will be running under, and the device again.
|
||||
|
||||
__Note__
|
||||
Using 1 RPi camera and 1 USB camera? You don't need to reference them by ID, since camera="raspi" vs. camera="usb" is enough.
|
||||
{: .info}
|
||||
|
||||
Find the long ID of the second camera, as you did for the first one.
|
||||
|
||||
Editing `/home/pi/klipper_config/webcam2.txt` like described above.
|
||||
|
||||
As above again, set camera="usb" and set camera_usb_options but this time using the ID for the second camera:
|
||||
|
||||
`camera_usb_options="-r 640x480 -f 10 -d /dev/v4l/by-id/<device long id>"`
|
||||
|
||||
Adjust the port, by editing camera_http_options:
|
||||
|
||||
`camera_http_options="-n -p 8081"`
|
||||
|
||||
The port should reflect the number in `webcam*.txt`:
|
||||
```
|
||||
webcam.txt => -p 8080
|
||||
webcam1.txt => -p 8081
|
||||
webcam2.txt => -p 8082
|
||||
webcam3.txt => -p 8083
|
||||
```
|
||||
|
||||
__INFO__
|
||||
mainsailOS comes already setup with four nginx reverse proxies for port 8080 to 8083, so you can configure 4 webcams easy with this guide,
|
||||
for more webcams you need to configure the nginx config, which we dont recommend!
|
||||
It includes editing nginx configuration, which is easy to mess up and having mainsail stop working as well.
|
||||
If you need more than four webcams, hop onto our [Discord](https://discord.gg/skWTwTD){:target="_blank"} and we will help you.
|
||||
{: .warning}
|
||||
|
||||
## 4. Test it works
|
||||
Restart webcamd click the button,
|
||||
and try and find your second camera under `http://<your-ip>/webcam2/`.
|
||||
If it doesn't work, check in the webcam log under the filemanager log section for details.
|
||||
|
||||
If it works, you can use the URLs in mainsail:
|
||||
|
||||
Stream: `http://<your-ip>/webcam2/`
|
||||
|
||||
__DONE__
|
||||
Congratulations, you set up multi webcam with mainsailOS!
|
||||
If you want to add more, just follow the guide again and increment the webcam*.txt number i.e. webcam**3**.txt and so on.
|
||||
The webcams are easy accessible through your `http://<your-ip>/webcam`, `http://<your-ip>/webcam2` and so on.
|
||||
{: .success}
|
||||
@@ -39,4 +39,12 @@ From now on the gcode files contain thumbnails displayed by mainsail.
|
||||
The Cura plugin "Cura2Moonraker" is required for this. You can find this plugin and a install guide
|
||||
here: [https://github.com/emtrax-ltd/Cura2MoonrakerPlugin](https://github.com/emtrax-ltd/Cura2MoonrakerPlugin)
|
||||
|
||||

|
||||

|
||||
|
||||
### ideaMaker (since v4.2.1)
|
||||
|
||||
To enable thumbnails, open the `Advanced` tab in the `printer settings`, enable the `GCode Thumbnails for Octoprint and Mainsail` option and
|
||||
enter your prefered *square format* image size in the `Resolution` fields (e.g. `400 X 400`).
|
||||
It's necessary that the thumbnail width and height resolution is equal.
|
||||
|
||||

|
||||
@@ -20,7 +20,7 @@ Add the following section to your printers moonraker.conf:
|
||||
|
||||
[update_manager client mainsail]
|
||||
type: web
|
||||
repo: meteyou/mainsail
|
||||
repo: mainsail-crew/mainsail
|
||||
path: ~/mainsail
|
||||
```
|
||||
|
||||
|
||||
@@ -8,7 +8,8 @@ has_toc: false
|
||||
---
|
||||
# Setup Guides
|
||||
|
||||
To get started, you first have to decide which route you want to follow for the installation. There are several ways to install Mainsail on a Raspberry Pi.
|
||||
## Local installation
|
||||
Decide which route you want to follow for the installation. There are several ways to install Mainsail on a Raspberry Pi:
|
||||
|
||||
- [MainsailOS](mainsail-os.md) <span class="label label-red">recommended</span>
|
||||
A prebuilt image for your Raspberry Pi. Flash it and you are almost ready to go.
|
||||
@@ -17,17 +18,9 @@ To get started, you first have to decide which route you want to follow for the
|
||||
- [Manual Setup](manual-setup/index.md)
|
||||
The rocky road. If you want to know how everything is set up by hand, you will get all the information here.
|
||||
|
||||
## my.mainsail.xyz
|
||||
In addition to these guides, there is [my.mainsail.xyz](http://my.mainsail.xyz){: target="_blank"}. The latest Mainsail version is always hosted there. This obviates the need to set up a web server for Mainsail on your hardware.
|
||||
## Hosted
|
||||
|
||||
To use [my.mainsail.xyz](http://my.mainsail.xyz){: target="_blank"}, the following requirements must be met:
|
||||
- Klipper must be installed.
|
||||
- Moonraker must be installed.
|
||||
- my.mainsail.xyz must be configured as a CORS domain in moonraker.conf.
|
||||
|
||||
**MainsailOS & KIAUH already fulfill these requirements.**
|
||||
|
||||
_Note_, only the static .html, .js and .css files are loaded into your browser storage. No further information is transferred to the server. The communication to your printer is then done locally directly between your browser and your Moonraker installation.
|
||||
If you have any concerns, you can of course still install Mainsail on your hardware locally. Parallel operation is also possible.
|
||||
Setup [remote access](../quicktips/remote-access) without installing/configuring a web server!
|
||||
{: .info}
|
||||
|
||||
A hosted instance of Mainsail can be found and used at [my.mainsail.xyz](http://my.mainsail.xyz), check out the [documentation](mainsail-hosted) for usage and configuration.
|
||||
@@ -0,0 +1,51 @@
|
||||
---
|
||||
layout: default
|
||||
title: my.mainsail.xyz
|
||||
parent: Setup Guides
|
||||
nav_order: 4
|
||||
has_children: false
|
||||
has_toc: false
|
||||
permalink: /setup/mainsail-hosted
|
||||
---
|
||||
|
||||
# my.mainsail.xyz
|
||||
|
||||
Mainsail and MainsailOS respect [Data Privacy](../data-privacy).
|
||||
{: .info}
|
||||
|
||||
The hosted version of mainsail can be used:
|
||||
|
||||
* On the same (local) network as your printer.
|
||||
* On a remote (different) network to your printer (requires the configuration of [remote access](../quicktips/remote-access)).
|
||||
|
||||
## Requirements
|
||||
|
||||
- MainsailOS and KIAUH are preconfigured to meet the requirements for the hosted service to work.
|
||||
- If you have a manual installation, then the following requirements must be met:
|
||||
* Klipper must be installed.
|
||||
* Moonraker must be installed.
|
||||
* my.mainsail.xyz must be configured as a CORS domain in moonraker.conf.
|
||||
|
||||
## Editing moonraker.conf
|
||||
|
||||
Further information can be found in the Moonraker [documentation](https://moonraker.readthedocs.io/en/latest/configuration/#authorization)
|
||||
{: .info}
|
||||
|
||||
To allow [my.mainsail.xyz](http://my.mainsail.xyz) to access your local installation, navigate to moonraker.conf open it and add the following code:
|
||||
|
||||
```yml
|
||||
[authorization]
|
||||
cors_domains:
|
||||
https://my.mainsail.xyz
|
||||
http://my.mainsail.xyz
|
||||
http://*.local
|
||||
trusted_clients:
|
||||
10.0.0.0/8
|
||||
127.0.0.0/8
|
||||
169.254.0.0/16
|
||||
172.16.0.0/12
|
||||
192.168.0.0/16
|
||||
FE80::/10
|
||||
::1/128
|
||||
|
||||
```
|
||||
@@ -3,100 +3,20 @@ layout: default
|
||||
title: MainsailOS
|
||||
parent: Setup Guides
|
||||
nav_order: 1
|
||||
has_children: false
|
||||
has_children: true
|
||||
has_toc: false
|
||||
permalink: /setup/mainsail-os
|
||||
---
|
||||
|
||||
# Installing Mainsail with MainsailOS
|
||||
# Installing MainsailOS
|
||||
|
||||
Our recommended way to install Mainsail on a Raspberry Pi is to use [MainsailOS](https://github.com/raymondh2/MainsailOS),
|
||||
as pre-packaged disk image. If you are building a custom configuration, you may need to skip
|
||||
these instructions and install Mainsail [manually](manual-setup/index.md).
|
||||
MainsailOS builds upon RaspberryOS-Lite by incorporating Klipper, Moonraker and Mainsail into one disc image, making them more accessible and quicker to setup than before.
|
||||
|
||||
**Note: To avoid confusion, the described way is available for Windows, Linux and MacOS because RPI Imager is a Multiplatform Tool!**
|
||||
{: .info}
|
||||
Complex/custom configurations may be better suited to a [manual](manual-setup/index.md) installation of Mainsail.
|
||||
|
||||
_Note: It is a good idea to use a premium SDcard from a reputable manufacturer such as Sandisk, Kingston or Samsung. Perfomancewise you should consider using a "A1" or better, marked SDCard. Low end cards will often fail quickly when used in this application
|
||||
**PLEASE OBEY THAT THIS WILL DESTROY ALL DATA ON YOUR CARD**_
|
||||
{: .alert}
|
||||
If you are familiar with the flashing process, then please use your preferred method as you normally would.
|
||||
|
||||
1. Download the latest [mainsailOS Release](https://github.com/raymondh2/MainsailOS/releases).
|
||||
2. Download the latest [Raspberry Pi Imager](https://www.raspberrypi.org/software/), henceforth rpi-imager.
|
||||
3. Install and Open rpi-imager. Now you should see a Window like this.
|
||||
If however you are unfamiliar with the flashing process then we have documented two methods to flash MainsailOS to your SD card:
|
||||
|
||||

|
||||
|
||||
_Window Appereance depends on OS, in this case Linux with XFCE was used._
|
||||
{: .info}
|
||||
|
||||
4. Now click on "CHOOSE OS", this will open a popup as shown below.
|
||||
Click on "Use Custom"
|
||||
|
||||

|
||||
|
||||
This will open a Popup Window to browse your local files. Please navigate to your recently downloaded MainsailOS Zip Archive
|
||||
|
||||
_**DO NOT UNPACK THE ZIP FILE!**_
|
||||
{: .alert}
|
||||
|
||||
After you've done that, it should look like this
|
||||
|
||||

|
||||
|
||||
5. Click on "Storage" and select your desired SDCard.
|
||||
|
||||

|
||||
_As an Example..._
|
||||
|
||||
6. Now it's time to setup things like Hostname, Wifi, Language and more.
|
||||
It depends on your needs what you setup, but it has to be WIFI and SSH at least!
|
||||
Grab your keyboard and hit:
|
||||
|
||||
|
||||
<kbd>CTRL</kbd><span>+</span><kbd>SHIFT</kbd><span>+</span><kbd>X</kbd>
|
||||
|
||||
This opens up a Setup Page
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
7. As the last Step click on "Write", rpi-imager will give you a Warning. Click "YES" to continue...
|
||||
|
||||

|
||||
|
||||
8. Watch the Progressbar and wait until you see:
|
||||
|
||||

|
||||
Hit the "Continue" Button and safely remove your SDCard. ( eg. unmount on Linux )
|
||||
|
||||
9. Insert the SDcard into your Pi, and power on the Pi.
|
||||
|
||||
_Note: Please give the PI some time, during the first boot MainsailOS (like every PI Image) will expand your "root" filesystem accordingly to your SDCard Size! The greater your SDCard is, it will take longer time! Watch out for the little green LED if it turn off or blink from time to time it has finished the resizing._
|
||||
{: .warning}
|
||||
_**Make sure that your MCU(s) is connected to your pi, If you will be using wired networking, also make sure your ethernet cable is connected.**_
|
||||
{: .alert}
|
||||
|
||||
|
||||
10. Find your pi on the network, open up your preferred Browser and type either your IP or Hostname (Depends on your Network configuration)
|
||||
|
||||
- If your network supports bonjour, the pi should show up as `mainsailos.local` or the given Hostname in the Setup Section.
|
||||
- If your network automatically assigns DNS hostnames, it may simply show up as `mainsailos` or accordingly given Hostname.
|
||||
- Failing these two options, you may need to check your router's DHCP server, and find out what IP address has been assigned to the device.
|
||||
|
||||
_**After you're able to get to the Mainsail Webinterface you should consider updating the System to get the latest features. Mainsail, Klipper and Moonraker got a relatively fast Development Cycle. We can't provide MainsailOS Image with all the latest and greatest. So we encourage you to Update on first Login**_
|
||||
{: .info}
|
||||
|
||||
_If you decide to update, you should update in following order:_
|
||||
|
||||
1. System Update (Bring latest RaspberryOS Updates to the System)
|
||||
2. Klipper Update ( To get latest Firmware, often flashing the MCU can wear out his memory )
|
||||
3. Moonraker ( Having latest Version, could lead to more Features in Frontend )
|
||||
4. Update Mainsail ( The most important! :P )
|
||||
|
||||
5. **Important:** Include the mainsail.cfg into your printer.cfg
|
||||
This could be done by:
|
||||
|
||||
[include mainsail.cfg]
|
||||
|
||||
6. Enjoy Mainsail!
|
||||
* [Raspberry Pi Imager](mainsailos/pi-imager) (cross-platform, easiest) <span class="label label-red">recommended</span>
|
||||
* [Balena Etcher](mainsailos/balena-etcher) (requires manual setup)
|
||||
@@ -0,0 +1,125 @@
|
||||
---
|
||||
layout: default
|
||||
title: balenaEtcher
|
||||
parent: MainsailOS
|
||||
grand_parent: Setup Guides
|
||||
nav_order: 2
|
||||
has_children: false
|
||||
permalink: /setup/mainsailos/balena-etcher
|
||||
---
|
||||
|
||||
This method requires manual setup for SSH and Wi-Fi.
|
||||
{: .info}
|
||||
This method is cross-platform and works with Windows, Linux and MacOS.
|
||||
{: .info}
|
||||
|
||||
We **strongly** recommend you use a premium SD card from a reputable manufacturer such as Sandisk, Kingston or Samsung, using an "A1" (or better) grade SD card. \
|
||||
\
|
||||
Low end cards will often fail quickly when used in this application.
|
||||
{: .warning}
|
||||
|
||||
**FLASHING WILL DESTROY ALL DATA ON YOUR SD CARD AND CANNOT BE REVERSED**
|
||||
{: .alert}
|
||||
|
||||
____
|
||||
|
||||
# Preparation
|
||||
|
||||
Whilst this guide makes specific use of balenaEtcher it is entirely possible to use any flashing software of your choice and then follow the manual steps to enable SSH / network after.
|
||||
|
||||
* [Download](https://github.com/mainsail-crew/MainsailOS/releases) the latest MainsailOS release (don't unpack the zip; you don't need to).
|
||||
* [Download](https://www.balena.io/etcher/) and install the latest balenaEtcher.
|
||||
|
||||
# Flashing MainsailOS
|
||||
|
||||
balenaEtcher appearance may vary depending on the host OS.
|
||||
{: .info}
|
||||
|
||||
|
||||
* When opening balenaEtcher you will be presented with the following:
|
||||

|
||||
|
||||
* Select the 'Flash from file' button ('Select image' on Windows) and navigate to the downloaded MainsailOS zip.
|
||||

|
||||
|
||||
* Select the 'Select target' button and choose the SD card you want to flash.
|
||||

|
||||

|
||||
|
||||
* Return the the main screen, and select 'Flash'. Accept any warnings to continue.
|
||||
**FLASHING WILL DESTROY ALL DATA ON YOUR SD CARD AND CANNOT BE REVERSED**
|
||||
{: .alert}
|
||||
|
||||

|
||||
|
||||
* balenaEtcher will now decompress (unzip) the MainsailOS archive, write the disc image to the card and verify the flash.
|
||||

|
||||

|
||||

|
||||
|
||||
* balenaEtcher will confirm the flash is complete.
|
||||

|
||||
|
||||
# Enabling SSH
|
||||
You may need to safely remove (eject) the SD card and reinsert it for the /boot partition to show.
|
||||
{: .info}
|
||||
|
||||
Before you move on, it is important to check SSH is enabled.
|
||||
|
||||
This is done by creating an empty file with no extension named 'SSH', or 'SSH.txt' in the /boot partition of the SD card. MainsailOS includes this file.
|
||||
|
||||

|
||||
|
||||
If for some reason the file is not present, then on linux it can be created by navigating to the /boot partition and opening a terminal:
|
||||
|
||||
```bash
|
||||
sudo touch SSH
|
||||
sudo touch SSH.txt
|
||||
```
|
||||
|
||||
RaspberryOS will check if /boot/SSH(.txt) is present at first boot. If the file is present then SSH will be enabled.
|
||||
|
||||
|
||||
# Setting up Wi-Fi / Network
|
||||
|
||||
SSID's are case-sensitive!
|
||||
{: .info}
|
||||
Don't forget to set the country!
|
||||
{: .warning}
|
||||
|
||||
|
||||
To setup Wi-Fi for a headless Pi install the network SSID and password must be entered into mainsailos-wpa-supplicant.txt
|
||||
|
||||
With the SD card inserted into the computer, navigate to the SD card's /boot partition and open mainsail-wpa-supplicant.txt.
|
||||
|
||||
Locate the relevant section to your network, remove the comment marks (#) and enter the SSID and password. WPA/WPA2 is the most common.
|
||||
|
||||
```yml
|
||||
Original:
|
||||
## WPA/WPA2 secured
|
||||
#network={
|
||||
# ssid="put SSID here"
|
||||
# psk="put password here"
|
||||
#}
|
||||
|
||||
Filled out:
|
||||
## WPA/WPA2 secured
|
||||
network={
|
||||
ssid="CaseSensitive_WIFI"
|
||||
psk="SuperSecrets"
|
||||
}
|
||||
|
||||
...
|
||||
|
||||
# Uncomment the country your Pi is in to activate Wifi in RaspberryPi 3 B+ and above
|
||||
# For full list see: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
|
||||
country=GB # United Kingdom
|
||||
|
||||
```
|
||||
Save and exit the mainsailos-wpa-supplicant.txt file.
|
||||
|
||||
You are now ready to move on to the [first boot](first-boot) of MainsailOS.
|
||||
|
||||
|
||||
---
|
||||
[< tool selection](../mainsail-os.md){: .btn } [next step >](first-boot){: .btn }
|
||||
@@ -0,0 +1,65 @@
|
||||
---
|
||||
layout: default
|
||||
title: First boot
|
||||
parent: MainsailOS
|
||||
grand_parent: Setup Guides
|
||||
nav_order: 3
|
||||
has_children: false
|
||||
permalink: /setup/mainsailos/first-boot
|
||||
---
|
||||
|
||||
|
||||
# First boot
|
||||
|
||||
Insert the flashed SD card into your Pi and connect other desired/necessary hardware (ethernet, USB to 3D printer, webcam).
|
||||
|
||||
Power on the Pi and leave it to boot.
|
||||
|
||||
**The initial boot of MainsailOS may take some time to expand your "root" filesystem. The larger the SD card, the longer the first boot will take.**
|
||||
{: .warning}
|
||||
|
||||
Initially the green LED on the Pi will be extremely active. After some time it will only intermittently flicker, indicating it has likely completed the boot sequence.
|
||||
|
||||
The web ui should now be ready to access on your local network:
|
||||
|
||||
```
|
||||
http://mainsailos.local
|
||||
http://<IP address of your pi>
|
||||
```
|
||||
|
||||
## Mainsail.cfg
|
||||
|
||||
**Important:** Include the mainsail.cfg into your printer.cfg
|
||||
{: .warning}
|
||||
|
||||
Mainsail will not work unless Klipper is told to include its configuration. This can be achieved either by placing the contents of mainsail.cfg into your printer.cfg.
|
||||
|
||||
To do this, open the default printer.cfg in the Mainsail web GUI:
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
Add the following line:
|
||||
|
||||
```yml
|
||||
[include mainsail.cfg]
|
||||
```
|
||||
and click on the "Save & Restart" button.
|
||||
|
||||
## Updates
|
||||
|
||||
Once you've successfully navigated to the Mainsail web ui we _thoroughly_ recommend that you run updates.
|
||||
|
||||
Klipper, Moonraker and Mainsail have fast development cycles and whilst we do our best to ensure MainsailOS ships as close to the bleeding edge as we can, there will always be a short delay before releases make it into the image.
|
||||
|
||||
We recommend that you enable and use the [built in update-manager](../../update/update-manager) to perform a system update, then update the stack components (Klipper, Moonraker, Mainsail)
|
||||
|
||||

|
||||
|
||||
|
||||
MainsailOS is now configured, and we can get Klipper's [printer.cfg](klipper-setup) setup.
|
||||
|
||||
---
|
||||
[< tool selection](../mainsail-os.md){: .btn } [next step >](klipper-setup){: .btn }
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
---
|
||||
layout: default
|
||||
title: Klipper
|
||||
parent: MainsailOS
|
||||
grand_parent: Setup Guides
|
||||
nav_order: 4
|
||||
has_children: false
|
||||
permalink: /setup/mainsailos/klipper-setup
|
||||
---
|
||||
|
||||
# Klipper setup
|
||||
|
||||
Please read and follow the [Klipper documentation](https://klipper3d.org) in order to setup your machine.
|
||||
{: .info}
|
||||
You do not need to follow instructions pertaining to Octopi or Octoprint found in the Klipper documentation.
|
||||
{: .info}
|
||||
|
||||
Klipper is a highly versatile piece of software and can run with almost any machine. Due to the plethora of stock and custom hardware options available, it is impossible to ship MainsailOS / Klipper with a default configuration that would work for everyone.
|
||||
|
||||
## Modifying/constructing printer.cfg
|
||||
|
||||
**You must enter parts of this configuration manually, as it is specific to your printer and MCU hardware**
|
||||
{: .warning}
|
||||
|
||||
To customise your printer.cfg you will need to SSH to your Pi and:
|
||||
|
||||
```yml
|
||||
cd ~/klipper_config
|
||||
nano printer.cfg
|
||||
```
|
||||
Then follow the [Klipper documentation](https://klipper3d.org) to construct your printer.cfg file.
|
||||
|
||||
---
|
||||
|
||||
Before progressing to the next step, ensure that you have:
|
||||
|
||||
* Correctly built the firmware and [flashed the MCU](https://www.klipper3d.org/Installation.html#building-and-flashing-the-micro-controller)
|
||||
* Correctly written/customised your printer.cfg file using the [Klipper configuration reference](https://www.klipper3d.org/Config_Reference.html).
|
||||
* Checked and then [verified your printer.cfg](https://www.klipper3d.org/Config_checks.html).
|
||||
|
||||
|
||||
---
|
||||
[< first boot](first-boot){: .btn } [next step >](pre-flight){: .btn }
|
||||
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
---
|
||||
layout: default
|
||||
title: Raspberry Pi Imager
|
||||
parent: MainsailOS
|
||||
grand_parent: Setup Guides
|
||||
nav_order: 1
|
||||
has_children: false
|
||||
permalink: /setup/mainsailos/pi-imager
|
||||
---
|
||||
|
||||
This method is cross-platform and works with Windows, Linux and MacOS
|
||||
{: .info}
|
||||
|
||||
We **strongly** recommend you use a premium SD card from a reputable manufacturer such as Sandisk, Kingston or Samsung, using an "A1" (or better) grade SD card. \
|
||||
\
|
||||
Low end cards will often fail quickly when used in this application.
|
||||
{: .warning}
|
||||
|
||||
**FLASHING WILL DESTROY ALL DATA ON YOUR SD CARD AND CANNOT BE REVERSED**
|
||||
{: .alert}
|
||||
|
||||
____
|
||||
|
||||
# Preparation
|
||||
|
||||
* [Download](https://github.com/mainsail-crew/MainsailOS/releases) the latest MainsailOS release (don't unpack the zip; you don't need to).
|
||||
* [Download](https://www.raspberrypi.org/software/) and install the latest Raspberry Pi Imager (aka. rpi-imager).
|
||||
|
||||
# Flashing MainsailOS
|
||||
|
||||
Raspberry Pi Imager appearance may vary depending on the host OS.
|
||||
{: .info}
|
||||
|
||||
|
||||
* When opening rpi-imager you will be presented with the following:
|
||||
|
||||

|
||||
|
||||
* Select "CHOOSE OS", and a popup will open as illustrated below. Select "Use custom" and navigate to the MainsailOS zip you downloaded.
|
||||
|
||||

|
||||

|
||||
|
||||
* Click on "STORAGE" and select your desired SD card.
|
||||
|
||||

|
||||
|
||||
* Hostname, wi-fi, language and numerous other settings can now be scrolled through and pre-configured in a hidden setup menu, opened by pressing:
|
||||
|
||||
```bash
|
||||
CTRL+SHIFT+X
|
||||
```
|
||||
As a bare minimumm setup SSH and a network connection (unless wired) at this point, especially if performing a 'headless' installation.
|
||||
{: .info}
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
* With all desired options preconfigured, click on "WRITE" and accept the warning.
|
||||
|
||||

|
||||
|
||||
* Imager will take some time to write the disc image to the SD card. When it's finished, click continue.
|
||||
|
||||

|
||||
|
||||
Select the "CONTINUE" button and unmount (safely remove) your newly flashed MainsailOS SD card.
|
||||
|
||||
You are now ready to move on to the [first boot](first-boot) of MainsailOS.
|
||||
|
||||
|
||||
---
|
||||
[< tool selection](../mainsail-os.md){: .btn } [next step >](first-boot){: .btn }
|
||||
|
||||
@@ -9,57 +9,78 @@ permalink: /setup/manual-setup/klipper
|
||||
|
||||
# Klipper
|
||||
## Installation
|
||||
The following commands will clone Klipper to an appropriate directory in HOME and run the setup script.
|
||||
At first we have to install some OS dependencies:
|
||||
```bash
|
||||
sudo apt install virtualenv python-dev libffi-dev build-essential libncurses-dev libusb-dev avrdude gcc-avr binutils-avr avr-libc stm32flash dfu-util libnewlib-arm-none-eabi gcc-arm-none-eabi binutils-arm-none-eabi libusb-1.0
|
||||
```
|
||||
|
||||
The following commands will clone Klipper to an appropriate directory in HOME.
|
||||
```bash
|
||||
cd ~
|
||||
git clone https://github.com/KevinOConnor/klipper
|
||||
cd ~/klipper
|
||||
./scripts/install-octopi.sh
|
||||
```
|
||||
|
||||
## Configuration
|
||||
After Klipper is installed, you will need to change the default location of the printer.cfg and add the UDS (unix domain socket). This is defined in the file `/etc/default/klipper`
|
||||
Then we can initialize the python virtual environment and install the python dependencies:
|
||||
```bash
|
||||
cd ~
|
||||
virtualenv -p python2 ./klippy-env
|
||||
./klippy-env/bin/pip install -r ./klipper/scripts/klippy-requirements.txt
|
||||
```
|
||||
|
||||
## Configuration & startup service
|
||||
After Klipper is installed, you will need to create a startup script to define log, config & UDS service location:
|
||||
|
||||
To edit this file type:
|
||||
```bash
|
||||
sudo nano /etc/default/klipper
|
||||
sudo nano /etc/systemd/system/klipper.service
|
||||
```
|
||||
|
||||
find the following line:
|
||||
```
|
||||
KLIPPY_ARGS="/home/pi/klipper/klippy/klippy.py /home/pi/printer.cfg -l /tmp/klippy.log"
|
||||
```
|
||||
and change the config location to `/home/pi/klipper_config/printer.cfg` and add `-a /tmp/klippy_uds` to define UDS.
|
||||
```
|
||||
KLIPPY_ARGS="/home/pi/klipper/klippy/klippy.py /home/pi/klipper_config/printer.cfg -l /tmp/klippy.log -a /tmp/klippy_uds"
|
||||
fill in these lines:
|
||||
```yaml
|
||||
#Systemd Klipper Service
|
||||
|
||||
[Unit]
|
||||
Description=Starts Klipper and provides klippy Unix Domain Socket API
|
||||
Documentation=https://www.klipper3d.org/
|
||||
After=network.target
|
||||
Before=moonraker.service
|
||||
Wants=udev.target
|
||||
|
||||
[Install]
|
||||
Alias=klippy
|
||||
WantedBy=multi-user.target
|
||||
|
||||
[Service]
|
||||
Environment=KLIPPER_CONFIG=/home/pi/klipper_config/printer.cfg
|
||||
Environment=KLIPPER_LOG=/home/pi/klipper_logs/klippy.log
|
||||
Environment=KLIPPER_SOCKET=/tmp/klippy_uds
|
||||
Type=simple
|
||||
User=pi
|
||||
RemainAfterExit=yes
|
||||
ExecStart= /home/pi/klippy-env/bin/python /home/pi/klipper/klippy/klippy.py ${KLIPPER_CONFIG} -l ${KLIPPER_LOG} -a ${KLIPPER_SOCKET}
|
||||
Restart=always
|
||||
RestartSec=10
|
||||
```
|
||||
Save the file with `CTRL+O` and close the editor with `CTRL+X`.
|
||||
|
||||
You have to create the directories for your klipper configuration and the virtual_sdcard directory:
|
||||
**Please check and modify the username!**
|
||||
If you do not use the user `pi`, you must replace it in each path and in the variable user in the service file.
|
||||
{: .warning }
|
||||
|
||||
To enable and start the Klipper service execute these commands:
|
||||
```bash
|
||||
sudo systemctl enable klipper.service
|
||||
```
|
||||
|
||||
You have to create the directories for your klipper configuration, logs and the virtual_sdcard directory:
|
||||
|
||||
```bash
|
||||
mkdir ~/klipper_config
|
||||
mkdir ~/klipper_logs
|
||||
mkdir ~/gcode_files
|
||||
touch ~/klipper_config/printer.cfg
|
||||
```
|
||||
|
||||
Move your printer.cfg to ~/klipper_config and check if the following entries are present in the config.
|
||||
```ini
|
||||
[virtual_sdcard]
|
||||
# for gcode upload
|
||||
path: ~/gcode_files
|
||||
|
||||
[display_status]
|
||||
# for display messages in status panel
|
||||
|
||||
[pause_resume]
|
||||
# for pause/resume functionality.
|
||||
# Mainsail needs gcode macros for `PAUSE`, `RESUME` and `CANCEL_PRINT` to make the buttons work.
|
||||
```
|
||||
**These entries are very important.**
|
||||
For the full functionality of mainsail, you should also define gcode macros for `PAUSE`, `RESUME` and `CANCEL_PRINT`. You'll find further information in [this](../../necessary-cfg.md){: target="_blank"} document.
|
||||
{: .info }
|
||||
|
||||
After your config is in place, restart klipper with `sudo service klipper restart`. Check the `/tmp/klippy.log` for errors, if Klipper starts correctly you can continue the guide.
|
||||
After your config is in place, restart klipper with `sudo systemctl start klipper`.
|
||||
|
||||
---
|
||||
[< previous step](operating-system.md){: .btn } [next step >](moonraker.md){: .btn}
|
||||
@@ -31,16 +31,29 @@ Each file can be filled with the following content:
|
||||
# /etc/nginx/conf.d/upstreams.conf
|
||||
|
||||
upstream apiserver {
|
||||
#if you need to change your api port, edit it here
|
||||
ip_hash;
|
||||
server 127.0.0.1:7125;
|
||||
}
|
||||
|
||||
upstream mjpgstreamer {
|
||||
#if you need to change your webcam port, edit it here
|
||||
upstream mjpgstreamer1 {
|
||||
ip_hash;
|
||||
server 127.0.0.1:8080;
|
||||
}
|
||||
|
||||
upstream mjpgstreamer2 {
|
||||
ip_hash;
|
||||
server 127.0.0.1:8081;
|
||||
}
|
||||
|
||||
upstream mjpgstreamer3 {
|
||||
ip_hash;
|
||||
server 127.0.0.1:8082;
|
||||
}
|
||||
|
||||
upstream mjpgstreamer4 {
|
||||
ip_hash;
|
||||
server 127.0.0.1:8083;
|
||||
}
|
||||
```
|
||||
Save the file with `CTRL+O` and close the editor with `CTRL+X`.
|
||||
|
||||
@@ -64,12 +77,11 @@ Save the file with `CTRL+O` and close the editor with `CTRL+X`.
|
||||
|
||||
server {
|
||||
listen 80 default_server;
|
||||
listen [::]:80 default_server;
|
||||
|
||||
access_log /var/log/nginx/mainsail-access.log;
|
||||
error_log /var/log/nginx/mainsail-error.log;
|
||||
|
||||
#disable this section on smaller hardware like a pi zero
|
||||
# disable this section on smaller hardware like a pi zero
|
||||
gzip on;
|
||||
gzip_vary on;
|
||||
gzip_proxied any;
|
||||
@@ -77,21 +89,24 @@ server {
|
||||
gzip_comp_level 4;
|
||||
gzip_buffers 16 8k;
|
||||
gzip_http_version 1.1;
|
||||
gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/json application/xml;
|
||||
gzip_types text/plain text/css text/xml text/javascript application/javascript application/x-javascript application/json application/xml;
|
||||
|
||||
#web_path from mainsail static files
|
||||
# web_path from mainsail static files
|
||||
root /home/pi/mainsail;
|
||||
|
||||
index index.html;
|
||||
server_name _;
|
||||
|
||||
#disable max upload size
|
||||
# disable max upload size checks
|
||||
client_max_body_size 0;
|
||||
|
||||
# disable proxy request buffering
|
||||
proxy_request_buffering off;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
|
||||
location = /index.html {
|
||||
add_header Cache-Control "no-store, no-cache, must-revalidate";
|
||||
}
|
||||
@@ -114,9 +129,21 @@ server {
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Scheme $scheme;
|
||||
}
|
||||
|
||||
|
||||
location /webcam/ {
|
||||
proxy_pass http://mjpgstreamer/;
|
||||
proxy_pass http://mjpgstreamer1/;
|
||||
}
|
||||
|
||||
location /webcam2/ {
|
||||
proxy_pass http://mjpgstreamer2/;
|
||||
}
|
||||
|
||||
location /webcam3/ {
|
||||
proxy_pass http://mjpgstreamer3/;
|
||||
}
|
||||
|
||||
location /webcam4/ {
|
||||
proxy_pass http://mjpgstreamer4/;
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -128,13 +155,13 @@ Create directory for static files and active nginx config:
|
||||
mkdir ~/mainsail
|
||||
sudo rm /etc/nginx/sites-enabled/default
|
||||
sudo ln -s /etc/nginx/sites-available/mainsail /etc/nginx/sites-enabled/
|
||||
sudo service nginx restart
|
||||
sudo systemctl restart nginx
|
||||
```
|
||||
|
||||
Now you can check again the API if it works with the reverse proxy. Open the url http://\<printer-ip\>/printer/info in your browser. if you see a content like this:
|
||||
|
||||
```
|
||||
{"result": {"hostname": "voron250", "error_detected": false, "version": "v0.8.0-479-gd586fb06", "is_ready": true, "message": "Printer is ready", "cpu": "4 core ARMv7 Processor rev 4 (v7l)"}}
|
||||
{"result": {"state_message": "Printer is ready", "klipper_path": "/home/pi/klipper", "config_file": "/home/pi/klipper_config/printer.cfg", "software_version": "v0.9.1-785-g1be19177", "hostname": "raspberrypi", "cpu_info": "4 core ARMv7 Processor rev 4 (v7l)", "state": "ready", "python_path": "/home/pi/klippy-env/bin/python", "log_file": "/home/pi/klipper_log/klippy.log"}}
|
||||
```
|
||||
|
||||
Now we can install Mainsail (static httpdocs).
|
||||
@@ -145,7 +172,7 @@ Now you can download the current mainsail static data
|
||||
|
||||
```
|
||||
cd ~/mainsail
|
||||
wget -q -O mainsail.zip https://github.com/meteyou/mainsail/releases/latest/download/mainsail.zip && unzip mainsail.zip && rm mainsail.zip
|
||||
wget -q -O mainsail.zip https://github.com/mainsail-crew/mainsail/releases/latest/download/mainsail.zip && unzip mainsail.zip && rm mainsail.zip
|
||||
```
|
||||
|
||||
Now it should be possible to open the interface: `http://<printer-ip>/`.
|
||||
|
||||
@@ -10,16 +10,22 @@ permalink: /setup/manual-setup/moonraker
|
||||
Moonraker is a web server that exposes APIs which lets Mainsail interact with Klipper.
|
||||
|
||||
## Installation
|
||||
At first we have to install some OS dependencies:
|
||||
```bash
|
||||
sudo apt install python3-virtualenv python3-dev libopenjp2-7 python3-libgpiod curl libcurl4-openssl-dev libssl-dev liblmdb-dev libsodium-dev zlib1g-dev libjpeg-dev
|
||||
```
|
||||
|
||||
Clone Moonraker into your HOME directory:
|
||||
```bash
|
||||
cd ~
|
||||
git clone https://github.com/Arksine/moonraker.git
|
||||
```
|
||||
|
||||
Run Moonrakers install script:
|
||||
Then we can initialize the python virtual environment and install the python dependencies:
|
||||
```bash
|
||||
cd ~/moonraker/scripts
|
||||
./install-moonraker.sh -c /home/pi/klipper_config/moonraker.conf
|
||||
cd ~
|
||||
virtualenv -p python3 ./moonraker-env
|
||||
./moonraker-env/bin/pip install -r ./moonraker/scripts/moonraker-requirements.txt
|
||||
```
|
||||
|
||||
## Configuration
|
||||
@@ -31,32 +37,49 @@ For Moonraker you'll need to create a separate config file.
|
||||
|
||||
`nano ~/klipper_config/moonraker.conf`
|
||||
|
||||
Insert the following part and modify `trusted_clients` according to arksines description below.
|
||||
Also consider further IP ranges, e.g. when connecting via VPN. To determine your local ip `ip a` and `ifconfig -a` are common ways to do so on Linux and `ipconfig` on Windows.
|
||||
Insert the following part:
|
||||
```
|
||||
[server]
|
||||
host: 0.0.0.0
|
||||
port: 7125
|
||||
enable_debug_logging: False
|
||||
config_path: ~/klipper_config
|
||||
log_path: ~/klipper_logs
|
||||
|
||||
[authorization]
|
||||
cors_domains:
|
||||
https://my.mainsail.xyz
|
||||
http://my.mainsail.xyz
|
||||
http://*.local
|
||||
http://*.lan
|
||||
trusted_clients:
|
||||
10.0.0.0/8
|
||||
127.0.0.0/8
|
||||
169.254.0.0/16
|
||||
172.16.0.0/12
|
||||
192.168.0.0/16
|
||||
FE80::/10
|
||||
::1/128
|
||||
|
||||
# enables partial support of Octoprint API
|
||||
[octoprint_compat]
|
||||
|
||||
# enables moonraker to track and store print history.
|
||||
[history]
|
||||
|
||||
# this enables moonraker's update manager
|
||||
[update_manager]
|
||||
|
||||
[update_manager mainsail]
|
||||
type: web
|
||||
repo: mainsail-crew/mainsail
|
||||
path: ~/mainsail
|
||||
```
|
||||
|
||||
**This is a very basic config**
|
||||
For more options and detailed explanations you should follow [arksines instructions](https://github.com/Arksine/moonraker/blob/master/docs/installation.md).
|
||||
{: .info }
|
||||
|
||||
```
|
||||
[server]
|
||||
host: 0.0.0.0
|
||||
config_path: ~/klipper_config
|
||||
|
||||
[authorization]
|
||||
enabled: true
|
||||
trusted_clients:
|
||||
192.168.1.0/24
|
||||
2a02:810d:9340:33f6::/64
|
||||
|
||||
[update_manager]
|
||||
|
||||
[update_manager client mainsail]
|
||||
type: web
|
||||
repo: meteyou/mainsail
|
||||
path: ~/mainsail
|
||||
```
|
||||
|
||||
🔥 **trusted_clients - read carefully** 🔥
|
||||
A list of newline separated ip addresses and/or ip ranges that are
|
||||
trusted. Trusted clients are given full access to the API. Both IPv4
|
||||
@@ -70,11 +93,47 @@ trusted.
|
||||
|
||||
Save the file with `CTRL+O` and close the editor with `CTRL+X`.
|
||||
|
||||
Restart Moonraker
|
||||
## Startup service
|
||||
To edit this file type:
|
||||
```bash
|
||||
sudo service moonraker restart
|
||||
sudo nano /etc/systemd/system/moonraker.service
|
||||
```
|
||||
|
||||
fill in these lines:
|
||||
```yaml
|
||||
#Systemd moonraker Service
|
||||
|
||||
[Unit]
|
||||
Description=Moonraker provides Web API for klipper
|
||||
Documentation=https://moonraker.readthedocs.io/en/latest/
|
||||
After=network.target klipper.service
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
||||
[Service]
|
||||
Environment=MOONRAKER_CONFIG=/home/pi/klipper_config/moonraker.conf
|
||||
Environment=MOONRAKER_LOG=/home/pi/klipper_logs/moonraker.log
|
||||
Type=simple
|
||||
User=pi
|
||||
RemainAfterExit=yes
|
||||
ExecStart=/home/pi/moonraker-env/bin/python /home/pi/moonraker/moonraker/moonraker.py -c ${MOONRAKER_CONFIG} -l ${MOONRAKER_LOG}
|
||||
Restart=always
|
||||
RestartSec=10
|
||||
```
|
||||
Save the file with `CTRL+O` and close the editor with `CTRL+X`.
|
||||
|
||||
**Please check and modify the username!**
|
||||
If you do not use the user `pi`, you must replace it in each path and in the variable user in the service file.
|
||||
{: .warning }
|
||||
|
||||
To enable Moonraker service execute these commands:
|
||||
```bash
|
||||
sudo systemctl enable moonraker.service
|
||||
```
|
||||
|
||||
After your config is in place, start Moonraker with `sudo systemctl start moonraker`.
|
||||
|
||||
Open the following url with your printers IP in your browser
|
||||
```
|
||||
http://<printer-ip>:7125/printer/info
|
||||
@@ -82,7 +141,7 @@ http://<printer-ip>:7125/printer/info
|
||||
|
||||
If everything has been set up successfully, a message like this should appear:
|
||||
```
|
||||
{"result": {"hostname": "voron250", "error_detected": false, "version": "v0.8.0-643-g528f9f25", "is_ready": true, "message": "Printer is ready", "cpu": "4 core ARMv7 Processor rev 4 (v7l)"}}
|
||||
{"result": {"state_message": "Printer is ready", "klipper_path": "/home/pi/klipper", "config_file": "/home/pi/klipper_config/printer.cfg", "software_version": "v0.9.1-785-g1be19177", "hostname": "raspberrypi", "cpu_info": "4 core ARMv7 Processor rev 4 (v7l)", "state": "ready", "python_path": "/home/pi/klippy-env/bin/python", "log_file": "/home/pi/klipper_log/klippy.log"}}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
@@ -12,25 +12,32 @@ description: >-
|
||||
# {{ page.title }}
|
||||
{{ page.description }}
|
||||
|
||||
**Please don't use an OctoPi image!**
|
||||
It can cause unforeseeable events, like rips in the space-time continuum. So be aware!
|
||||
No seriously. Experiences have shown that it is advisable not to use an OctoPi image (especially for beginners).
|
||||
Do **not** use an OctoPi image as it can cause unforeseen (avoidable) problems.
|
||||
{: .warning }
|
||||
Don't forget to enable SSH and configure a network if using Wi-Fi.
|
||||
{: .info}
|
||||
|
||||
It is recommended to use a clean Raspberry Pi OS 32-bit Lite image (previously called Raspbian). You can download it [here](https://downloads.raspberrypi.org/raspios_lite_armhf_latest){:target="_blank"}.
|
||||
For more information about installing Raspberry Pi OS click [here](https://www.raspberrypi.org/documentation/installation/installing-images/){:target="_blank"}. Don't forget to enable ssh.
|
||||
It is recommended to use a clean [Raspberry Pi OS 32-bit Lite](https://downloads.raspberrypi.org/raspios_lite_armhf_latest){:target="_blank"} image (previously called Raspbian).
|
||||
|
||||
Once you have finished the installation and are connected via ssh, you can continue.
|
||||
We recommend you follow the RaspberryOS official [documentation](https://www.raspberrypi.org/documentation/installation/installing-images/){:target="_blank"} to flash and install the operating system to your SD card.
|
||||
|
||||
Once you have finished the installation and are connected via SSH, you can continue.
|
||||
|
||||
## Requirements
|
||||
|
||||
Install the required packages and update the system:
|
||||
|
||||
```bash
|
||||
sudo apt update && sudo apt upgrade
|
||||
sudo apt update --allow-releaseinfo-change && sudo apt upgrade
|
||||
sudo apt install git dfu-util unzip
|
||||
```
|
||||
|
||||
**Moonraker requires Python 3.7 or greater,** verify that your distribution's Python 3 packages meet this requirement.
|
||||
**Verify that your distribution's Python 3 package(s) are version 3.7 or newer.**
|
||||
{: .alert }
|
||||
|
||||
Moonraker requires Python 3.7 and will not operate without it.
|
||||
|
||||
You can check the current Python version installed to your operating system with the following terminal command:
|
||||
```
|
||||
python3 --version
|
||||
```
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
---
|
||||
layout: default
|
||||
title: Pre-flight
|
||||
parent: Setup Guides
|
||||
nav_order: 5
|
||||
has_children: false
|
||||
has_toc: false
|
||||
permalink: /setup/mainsailos/pre-flight
|
||||
---
|
||||
|
||||
# Preflight Checklist
|
||||
|
||||
A quick run-through to check no important steps have been missed during installation and configuration.
|
||||
|
||||
| Installed software components: | Configured: | Performed: |
|
||||
| :-- | :-- | :-- |
|
||||
| ✅ MainsailOS<br> **OR** <br> ✅ Klipper<br> ✅ Moonraker<br> ✅ Mainsail<br> | ✅ Network<br> ✅ [Configured printer.cfg](k>
|
||||
|
||||
# Time to print
|
||||
|
||||
If you've covered all the steps, you should now have a complete software stack ready to perform calibration prints!
|
||||
|
||||
**Thank you for choosing Mainsail**
|
||||
@@ -1,9 +1,15 @@
|
||||
---
|
||||
layout: default
|
||||
title: Update Guide
|
||||
title: Update Guides
|
||||
nav_order: 3
|
||||
has_children: true
|
||||
permalink: /update/
|
||||
has_toc: false
|
||||
---
|
||||
|
||||
This is a guide to update up Klipper, Moonraker & Mainsail on your Raspberry Pi.
|
||||
There are currently two methods to update either via the web interface, or manually.
|
||||
|
||||
- [Update Manager](update-manager) <span class="label label-red">recommended</span>
|
||||
A built in update utility found in the web ui, under the machine tab.
|
||||
- [Manual Update](manual-update)
|
||||
Guides on manual update methods for each component; Klipper, Moonraker and Mainsail.
|
||||
@@ -10,7 +10,7 @@ permalink: /update/mainsail
|
||||
```bash
|
||||
cd ~/mainsail
|
||||
rm -R ./*
|
||||
wget -q -O mainsail.zip https://github.com/meteyou/mainsail/releases/latest/download/mainsail.zip && unzip mainsail.zip && rm mainsail.zip
|
||||
wget -q -O mainsail.zip https://github.com/mainsail-crew/mainsail/releases/latest/download/mainsail.zip && unzip mainsail.zip && rm mainsail.zip
|
||||
```
|
||||
|
||||
### Move gui.json from gcodes to klipper_config
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
---
|
||||
layout: default
|
||||
title: Manual Update
|
||||
parent: Update Guides
|
||||
nav_order: 3
|
||||
has_children: true
|
||||
permalink: /update/manual-update
|
||||
has_toc: true
|
||||
---
|
||||
|
||||
# Updating Mainsail the manual way
|
||||
|
||||
This section covers the individual methods for updating each component of the stack manually.
|
||||
@@ -0,0 +1,24 @@
|
||||
---
|
||||
layout: default
|
||||
title: Klipper
|
||||
parent: Manual Update
|
||||
grand_parent: Update Guides
|
||||
nav_order: 2
|
||||
permalink: /update/manual-update/klipper
|
||||
---
|
||||
|
||||
## Klipper
|
||||
### Update from Repository
|
||||
```bash
|
||||
cd ~/klipper
|
||||
git pull
|
||||
```
|
||||
|
||||
Restart Klipper (`sudo service klipper restart`) and check the `klippy.log`, if Klipper starts
|
||||
correctly and then continue the guide.
|
||||
|
||||
### Klipper config changes
|
||||
If you have issues after update your Klipper instance, you can check config changes [here](https://www.klipper3d.org/Config_Changes.html){:target="_blank"}.
|
||||
|
||||
---
|
||||
[< table of contents](index.md){: .btn } [next step >](moonraker.md){: .btn}
|
||||
@@ -0,0 +1,20 @@
|
||||
---
|
||||
layout: default
|
||||
title: Mainsail
|
||||
parent: Manual Update
|
||||
grand_parent: Update Guides
|
||||
nav_order: 4
|
||||
permalink: /update/manual-update/mainsail
|
||||
---
|
||||
|
||||
## Mainsail
|
||||
```bash
|
||||
cd ~/mainsail
|
||||
rm -R ./*
|
||||
wget -q -O mainsail.zip https://github.com/mainsail-crew/mainsail/releases/latest/download/mainsail.zip && unzip mainsail.zip && rm mainsail.zip
|
||||
```
|
||||
|
||||
Now it should be possible to open the interface: `http://<printer-ip>/`.
|
||||
|
||||
---
|
||||
[< previous step](moonraker.md){: .btn }
|
||||
@@ -0,0 +1,33 @@
|
||||
---
|
||||
layout: default
|
||||
title: Moonraker
|
||||
parent: Manual Update
|
||||
grand_parent: Update Guides
|
||||
nav_order: 3
|
||||
permalink: /update/manual-update/moonraker
|
||||
---
|
||||
|
||||
## Moonraker
|
||||
```bash
|
||||
cd ~/moonraker
|
||||
git pull
|
||||
```
|
||||
|
||||
Restart Moonraker (`sudo service moonraker restart`) and open the url `http://<printer-ip>:7125/printer/info` in your browser.
|
||||
|
||||
If you see a content like this
|
||||
```
|
||||
{"result": {"hostname": "voron250", "error_detected": false, "version": "v0.8.0-643-g528f9f25", "is_ready": true, "message": "Printer is ready", "cpu": "4 core ARMv7 Processor rev 4 (v7l)"}}
|
||||
```
|
||||
|
||||
### Update Moonraker dependence
|
||||
This is only nessasary, if you see missing modules in the moonraker log.
|
||||
```bash
|
||||
~/moonraker/scripts/install-moonraker.sh -r
|
||||
```
|
||||
|
||||
### Moonraker config changes
|
||||
If you have issues after update your Moonraker instance, you can check config changes [here](https://moonraker.readthedocs.io/en/latest/user_changes/){:target="_blank"}.
|
||||
|
||||
---
|
||||
[< previous step](klipper.md){: .btn } [next step >](mainsail.md){: .btn }
|
||||
@@ -26,7 +26,7 @@ To use the update manager in Mainsail you have to add this in your moonraker.con
|
||||
|
||||
[update_manager client mainsail]
|
||||
type: web
|
||||
repo: meteyou/mainsail
|
||||
repo: mainsail-crew/mainsail
|
||||
path: ~/mainsail
|
||||
```
|
||||
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
---
|
||||
layout: default
|
||||
title: Update Manager
|
||||
parent: Update Guides
|
||||
nav_order: 1
|
||||
has_children: false
|
||||
permalink: /update/update-manager
|
||||
---
|
||||
|
||||
# Update Manager
|
||||
|
||||
You can find further information on this topic by checking out the [Moonraker documentation](https://github.com/Arksine/moonraker/blob/master/docs/configuration.md#update_manager){:target="_blank"}.
|
||||
{: .info}
|
||||
|
||||
## Enabling the feature
|
||||
|
||||
To use the built in Update Manager it must first be enabled by editing the moonraker.conf file:
|
||||
|
||||
```bash
|
||||
cd ~/klipper_config
|
||||
sudo nano moonraker.conf
|
||||
```
|
||||
Add the following section to your printers moonraker.conf:
|
||||
|
||||
```yaml
|
||||
[update_manager]
|
||||
|
||||
[update_manager client mainsail]
|
||||
type: web
|
||||
repo: mainsail-crew/mainsail
|
||||
path: ~/mainsail
|
||||
```
|
||||
|
||||
Restart Moonraker:
|
||||
```bash
|
||||
sudo systemctl restart moonraker
|
||||
```
|
||||
|
||||
## Using the Web UI
|
||||
|
||||
With the manager enabled reload the web ui and select the 'machine' tab from the sidebar. You should now see the Update Manager panel.
|
||||
|
||||
Holding shift whilst clicking the browser's refresh button (or pressing ctrl+f5) will force it to reload the page fully (without the cache).
|
||||
{: .info}
|
||||
|
||||
Typically the update order is top to bottom.
|
||||
|
||||

|
||||
|
||||
To update a component, click the  button.
|
||||
|
||||
A new window will launch and the component will be updated. When the update is finished, the window can be closed.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "mainsail",
|
||||
"version": "2.0.1",
|
||||
"version": "2.1.0-beta3",
|
||||
"private": true,
|
||||
"decription": "a klipper web interface",
|
||||
"author": {
|
||||
@@ -19,10 +19,13 @@
|
||||
"@codemirror/lang-javascript": "^0.19.1",
|
||||
"@codemirror/lang-json": "^0.19.1",
|
||||
"@codemirror/legacy-modes": "^0.19.0",
|
||||
"@codemirror/search": "^0.19.2",
|
||||
"@codemirror/state": "^0.19.1",
|
||||
"@codemirror/stream-parser": "^0.19.1",
|
||||
"@codemirror/view": "^0.19.1",
|
||||
"axios": "^0.21.1",
|
||||
"@sindarius/gcodeviewer": "^2.1.13",
|
||||
"@types/overlayscrollbars": "^1.12.1",
|
||||
"axios": "^0.21.2",
|
||||
"core-js": "^3.16.0",
|
||||
"echarts": "^5.1.2",
|
||||
"echarts-for-vue": "^1.4.1",
|
||||
@@ -30,8 +33,10 @@
|
||||
"joi": "^17.4.1",
|
||||
"js-sha256": "^0.9.0",
|
||||
"object-assign-deep": "^0.4.0",
|
||||
"overlayscrollbars-vue": "^0.2.2",
|
||||
"sass-loader": "^10.2.0",
|
||||
"semver": "^7.3.5",
|
||||
"uuid": "^8.3.2",
|
||||
"vue": "^2.6.14",
|
||||
"vue-class-component": "^7.2.6",
|
||||
"vue-context": "^6.0.0",
|
||||
@@ -44,16 +49,16 @@
|
||||
"vue-resource": "^1.5.3",
|
||||
"vue-simple-upload": "^0.1.6",
|
||||
"vue-toast-notification": "^0.6.1",
|
||||
"vue2-perfect-scrollbar": "^1.5.0",
|
||||
"vuedraggable": "^2.24.3",
|
||||
"vuetify": "^2.5.8",
|
||||
"vuetify": "^2.5.10",
|
||||
"vuex": "^3.6.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@mdi/font": "^5.9.55",
|
||||
"@mdi/font": "^6.2.95",
|
||||
"@types/semver": "^7.3.8",
|
||||
"@types/uuid": "^8.3.1",
|
||||
"@typescript-eslint/eslint-plugin": "^4.28.5",
|
||||
"@typescript-eslint/parser": "^4.28.5",
|
||||
"@typescript-eslint/parser": "^4.29.3",
|
||||
"@vue/cli-plugin-babel": "^4.5.13",
|
||||
"@vue/cli-plugin-eslint": "^4.5.13",
|
||||
"@vue/cli-plugin-pwa": "^4.5.13",
|
||||
@@ -66,7 +71,7 @@
|
||||
"eslint-plugin-vue": "^6.2.2",
|
||||
"generate-file-webpack-plugin": "^1.0.1",
|
||||
"node-sass": "^6.0.1",
|
||||
"sass": "^1.37.0",
|
||||
"sass": "~1.32",
|
||||
"sw-precache-webpack-plugin": "^1.0.0",
|
||||
"typescript": "^4.3.5",
|
||||
"vue-cli-plugin-route": "0.0.7",
|
||||
@@ -78,21 +83,6 @@
|
||||
"vue-template-compiler": "^2.6.14",
|
||||
"vuetify-loader": "^1.7.2"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"root": true,
|
||||
"env": {
|
||||
"node": true
|
||||
},
|
||||
"extends": [
|
||||
"plugin:vue/essential",
|
||||
"eslint:recommended",
|
||||
"@vue/typescript/recommended"
|
||||
],
|
||||
"rules": {},
|
||||
"parserOptions": {
|
||||
"parser": "@typescript-eslint/parser"
|
||||
}
|
||||
},
|
||||
"postcss": {
|
||||
"plugins": {
|
||||
"autoprefixer": {}
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="100%"
|
||||
height="100%"
|
||||
viewBox="0 0 768 624"
|
||||
version="1.1"
|
||||
xml:space="preserve"
|
||||
style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:1.41421;"
|
||||
id="svg40"
|
||||
sodipodi:docname="klipper.svg"
|
||||
inkscape:version="0.92.4 (unknown)"
|
||||
inkscape:export-filename="/home/kevin/src/reprap/firmware/klipper/logs/logo-20190416/klipper6.svg.png"
|
||||
inkscape:export-xdpi="96"
|
||||
inkscape:export-ydpi="96"><metadata
|
||||
id="metadata46"><rdf:RDF><cc:Work
|
||||
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title /></cc:Work></rdf:RDF></metadata><defs
|
||||
id="defs44">
|
||||
</defs><sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1030"
|
||||
id="namedview42"
|
||||
showgrid="false"
|
||||
inkscape:zoom="0.95"
|
||||
inkscape:cx="327.89418"
|
||||
inkscape:cy="289.76441"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="svg40"
|
||||
showguides="false"
|
||||
showborder="false"><inkscape:grid
|
||||
type="xygrid"
|
||||
id="grid905" /></sodipodi:namedview>
|
||||
<path
|
||||
style="fill:#3c4b5a"
|
||||
d="m 30,34 v 140 l 260,255 115,-5 h 80 L 730,174 V 34 H 720 L 385,374 40,34 Z"
|
||||
id="path2"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="ccccccccccc" /><path
|
||||
style="fill:#3c4b5a;stroke-width:1.03280997"
|
||||
d="m 140,418 -58,57 1,25 v 19 l 57,57 h 27 v -1 L 91,496.5 167,419 v -1 z"
|
||||
id="path8"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="ccccccccccc" /><g
|
||||
transform="translate(-1.08348e-4,0.048)"
|
||||
id="g17">
|
||||
<path
|
||||
d="m 83.041215,464.92108 h 0.001 l -0.04211,27.03092 h 11 l 73.000005,-74 v 14.301 l -63,64.199 63,65.5 v 14 l -73.000002,-75 h -13 c -2,0 -4,-2 -4,-4 h -2 v -33 h 2 c 0,-1 1,-2 3.00004,-2 1.99996,0 2.99996,1 2.99996,2 z"
|
||||
style="fill:#b12f35"
|
||||
id="path15"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="cccccccccccccccccc" />
|
||||
</g><g
|
||||
id="path839"
|
||||
transform="matrix(1.03281,0,0,1.0326797,24.31099,-21.921569)">
|
||||
<rect
|
||||
x="21"
|
||||
y="426"
|
||||
width="30.015202"
|
||||
height="153"
|
||||
style="fill:#3c4b5a;fill-rule:nonzero"
|
||||
id="rect12" />
|
||||
</g><rect
|
||||
x="247"
|
||||
y="469"
|
||||
width="24"
|
||||
height="107"
|
||||
style="fill:#3c4b5a;stroke-width:1.19609642"
|
||||
id="rect23" /><path
|
||||
d="m 371.98888,521.45953 c 0,-10.8903 -2.45322,-19.36013 -7.36207,-25.4107 -4.90765,-6.05057 -12.80741,-9.07465 -23.69929,-9.07465 -2.28639,0 -4.6724,0.10081 -7.16044,0.30241 -2.48802,0.20161 -4.94125,0.63842 -7.36207,1.31044 v 60.29926 c 2.15197,1.47844 5.00967,2.85727 8.57188,4.13411 3.56342,1.27684 7.36208,1.91526 11.39597,1.91526 8.87554,0 15.36385,-3.02409 19.46496,-9.07465 4.10111,-6.05057 6.15106,-14.18439 6.15106,-24.40148 z M 397,521.05632 c 0,8.06663 -1.04178,15.46123 -3.12654,22.18261 -2.08476,6.72259 -5.07568,12.50434 -8.97515,17.34409 -3.89947,4.83973 -8.77472,8.60423 -14.62333,11.29351 -5.8498,2.68927 -12.47254,4.0333 -19.86702,4.0333 -4.97606,0 -9.54765,-0.60481 -13.71597,-1.81445 -4.16832,-1.21082 -7.59731,-2.55487 -10.28698,-4.03451 V 611 H 302 V 471.64736 c 4.97486,-1.34524 11.09352,-2.62207 18.35477,-3.83171 C 327.61602,466.60482 335.28055,466 343.34834,466 c 8.33664,0 15.79953,1.27684 22.38866,3.83171 6.58794,2.55487 12.20251,6.21857 16.84131,10.9911 4.6388,4.77253 8.20221,10.5543 10.69024,17.34408 2.48684,6.78859 3.73145,14.4184 3.73145,22.88943 z"
|
||||
style="fill:#3c4b5a;fill-rule:nonzero;stroke-width:1.20011997"
|
||||
id="path25"
|
||||
inkscape:connector-curvature="0" /><path
|
||||
d="m 492.9892,521.45953 c 0,-10.8903 -2.4544,-19.36013 -7.36198,-25.4107 -4.90759,-6.05057 -12.80725,-9.07465 -23.699,-9.07465 -2.28636,0 -4.67354,0.10081 -7.16034,0.30241 -2.488,0.20161 -4.94119,0.63842 -7.36197,1.31044 v 60.29926 c 2.15074,1.47844 5.00839,2.85727 8.57176,4.13411 3.56337,1.27684 7.36198,1.91526 11.39582,1.91526 8.87423,0 15.36246,-3.02409 19.46352,-9.07465 4.10106,-6.05057 6.15219,-14.18439 6.15219,-24.40148 z M 518,521.05632 c 0,8.06663 -1.04297,15.46123 -3.1265,22.18261 -2.08474,6.72259 -5.07681,12.50434 -8.97624,17.34409 -3.89942,4.83973 -8.77341,8.60423 -14.62314,11.29351 -5.84854,2.68927 -12.47119,4.0333 -19.86677,4.0333 -4.9748,0 -9.54633,-0.60481 -13.7146,-1.81445 -4.16827,-1.21082 -7.59722,-2.55487 -10.28684,-4.03451 V 611 H 423 V 471.64736 c 4.97599,-1.34524 11.09337,-2.62207 18.35454,-3.83171 C 448.61569,466.60482 456.28012,466 464.34782,466 c 8.33773,0 15.80052,1.27684 22.38838,3.83171 6.58905,2.55487 12.20235,6.21857 16.84229,10.9911 4.63875,4.77253 8.20211,10.5543 10.69012,17.34408 2.48679,6.78859 3.73139,14.4184 3.73139,22.88943 z"
|
||||
style="fill:#3c4b5a;fill-rule:nonzero;stroke-width:1.20011246"
|
||||
id="path27"
|
||||
inkscape:connector-curvature="0" /><path
|
||||
d="m 537,521.00591 c 0,-9.30123 1.37492,-17.45591 4.12595,-24.46521 2.74984,-7.00931 6.40632,-12.83838 10.96942,-17.48839 4.56191,-4.65121 9.79451,-8.15587 15.699,-10.51396 5.90328,-2.3593 11.94191,-3.53835 18.11469,-3.53835 14.49054,0 25.79531,4.51527 33.91308,13.5458 8.11897,9.03174 12.17786,22.51016 12.17786,40.43768 0,1.34749 -0.0335,2.8646 -0.1006,4.54896 -0.0671,1.68555 -0.16768,3.20147 -0.30182,4.55015 h -69.43942 c 0.67068,8.49155 3.65646,15.06171 8.95733,19.71294 5.29967,4.65001 12.98149,6.97562 23.04547,6.97562 5.9033,0 11.30477,-0.5402 16.20202,-1.61818 4.89726,-1.07799 8.75493,-2.22335 11.57304,-3.43729 l 3.22052,20.01612 c -1.34138,0.67495 -3.18699,1.38237 -5.53561,2.12349 -2.34742,0.74112 -5.03139,1.41485 -8.05071,2.02242 -3.01811,0.60637 -6.27217,1.11168 -9.76096,1.51592 -3.4888,0.40425 -7.04467,0.60637 -10.66761,0.60637 -9.25915,0 -17.30985,-1.38116 -24.15211,-4.14471 -6.84346,-2.76354 -12.47968,-6.60507 -16.90744,-11.52457 -4.42778,-4.91951 -7.71537,-10.7161 -9.86278,-17.38854 C 538.0731,536.27095 537,528.95845 537,521.00591 Z m 70.64548,-10.91821 c 0,-3.36991 -0.46948,-6.57138 -1.40846,-9.60442 -0.93897,-3.03303 -2.31508,-5.66063 -4.12595,-7.88517 -1.81207,-2.22335 -4.02535,-3.97627 -6.64226,-5.25638 -2.61689,-1.28131 -5.73561,-1.92137 -9.35855,-1.92137 -3.75708,0 -7.04466,0.70743 -9.86278,2.1235 -2.8181,1.41484 -5.19906,3.26883 -7.14527,5.55956 -1.94501,2.29192 -3.45526,4.92071 -4.52837,7.88516 -1.0731,2.96567 -1.81206,5.99871 -2.21447,9.09912 z"
|
||||
style="fill:#3c4b5a;fill-rule:nonzero;stroke-width:1.20038378"
|
||||
id="path29"
|
||||
inkscape:connector-curvature="0" /><path
|
||||
d="m 717.7869,492.26931 c -2.00567,-0.67394 -4.78138,-1.38159 -8.32593,-2.12292 -3.54453,-0.74135 -7.65736,-1.11202 -12.33845,-1.11202 -2.67542,0 -5.51799,0.26957 -8.52649,0.80874 -3.0097,0.53915 -5.11684,1.01091 -6.32025,1.41528 V 576 H 658 V 475.28104 c 4.68109,-1.75347 10.53216,-3.40464 17.55439,-4.95472 C 682.57663,468.77504 690.36771,468 698.92762,468 c 1.60574,0 3.47769,0.10109 5.61827,0.30328 2.13938,0.20218 4.27996,0.47176 6.42053,0.80873 2.13939,0.33697 4.2131,0.74255 6.21878,1.21431 2.00687,0.47176 3.6114,0.90983 4.8148,1.3142 z"
|
||||
style="fill:#3c4b5a;fill-rule:nonzero;stroke-width:1.19865453"
|
||||
id="path31"
|
||||
inkscape:connector-curvature="0" /><path
|
||||
sodipodi:nodetypes="cccccccccccccc"
|
||||
d="M 259,424 H 360 V 359 L 30,34 H 90 L 385,324 670,34 h 60 L 410,359 v 84.99783 C 410,449 405,454 400,454 H 259 c -12,0 -14,-10 -14,-15 0,-5 2,-15 14,-15 z"
|
||||
style="fill:#b12f35"
|
||||
id="path35"
|
||||
inkscape:connector-curvature="0" />
|
||||
<rect
|
||||
id="rect12-6"
|
||||
style="clip-rule:evenodd;fill:#3c4b5a;fill-rule:nonzero;stroke-width:1.03280997;stroke-linejoin:round;stroke-miterlimit:1.41420996"
|
||||
height="158"
|
||||
width="24"
|
||||
y="418"
|
||||
x="191" /></svg>
|
||||
|
After Width: | Height: | Size: 8.0 KiB |
@@ -6,6 +6,10 @@
|
||||
@import './assets/styles/utils.scss';
|
||||
@import './assets/styles/updateManager.scss';
|
||||
|
||||
:root {
|
||||
--app-height: 100%;
|
||||
}
|
||||
|
||||
#content {
|
||||
background-attachment: fixed;
|
||||
background-size: cover;
|
||||
@@ -15,6 +19,10 @@
|
||||
.v-btn:not(.v-btn--outlined).primary {
|
||||
color: var(--v-btn-text-primary)
|
||||
}
|
||||
|
||||
.main-content-scrollbar {
|
||||
height: calc(var(--app-height) - 48px);
|
||||
}
|
||||
</style>
|
||||
|
||||
<template>
|
||||
@@ -24,31 +32,36 @@
|
||||
<the-topbar></the-topbar>
|
||||
|
||||
<v-main id="content" :style="mainStyle">
|
||||
<v-container fluid id="page-container" class="container px-3 px-sm-6 py-sm-6 mx-auto">
|
||||
<router-view></router-view>
|
||||
</v-container>
|
||||
<overlay-scrollbars class="main-content-scrollbar">
|
||||
<v-container fluid id="page-container" class="container px-3 px-sm-6 py-sm-6 mx-auto">
|
||||
<router-view></router-view>
|
||||
</v-container>
|
||||
</overlay-scrollbars>
|
||||
</v-main>
|
||||
<the-select-printer-dialog v-if="remoteMode"></the-select-printer-dialog>
|
||||
<the-connecting-dialog v-else></the-connecting-dialog>
|
||||
<the-update-dialog></the-update-dialog>
|
||||
<the-editor></the-editor>
|
||||
<the-timelapse-rendering-snackbar>-</the-timelapse-rendering-snackbar>
|
||||
</v-app>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import Component from 'vue-class-component'
|
||||
import TheSidebar from "@/components/TheSidebar.vue";
|
||||
import BaseMixin from "@/components/mixins/base";
|
||||
import TheTopbar from "@/components/TheTopbar.vue";
|
||||
import {Mixins, Vue, Watch} from "vue-property-decorator";
|
||||
import TheUpdateDialog from "@/components/TheUpdateDialog.vue";
|
||||
import TheConnectingDialog from "@/components/TheConnectingDialog.vue";
|
||||
import TheSelectPrinterDialog from "@/components/TheSelectPrinterDialog.vue";
|
||||
import TheEditor from "@/components/TheEditor.vue";
|
||||
import MainsailLogo from "@/components/ui/MainsailLogo.vue";
|
||||
import TheSidebar from '@/components/TheSidebar.vue'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import TheTopbar from '@/components/TheTopbar.vue'
|
||||
import {Mixins, Watch} from 'vue-property-decorator'
|
||||
import TheUpdateDialog from '@/components/TheUpdateDialog.vue'
|
||||
import TheConnectingDialog from '@/components/TheConnectingDialog.vue'
|
||||
import TheSelectPrinterDialog from '@/components/TheSelectPrinterDialog.vue'
|
||||
import TheEditor from '@/components/TheEditor.vue'
|
||||
import {panelToolbarHeight, topbarHeight, navigationItemHeight} from '@/store/variables'
|
||||
import TheTimelapseRenderingSnackbar from '@/components/TheTimelapseRenderingSnackbar.vue'
|
||||
|
||||
@Component({
|
||||
components: {
|
||||
TheTimelapseRenderingSnackbar,
|
||||
TheEditor,
|
||||
TheSelectPrinterDialog,
|
||||
TheConnectingDialog,
|
||||
@@ -58,17 +71,20 @@ import MainsailLogo from "@/components/ui/MainsailLogo.vue";
|
||||
}
|
||||
})
|
||||
export default class App extends Mixins(BaseMixin) {
|
||||
panelToolbarHeight = panelToolbarHeight
|
||||
topbarHeight = topbarHeight
|
||||
navigationItemHeight = navigationItemHeight
|
||||
|
||||
get title(): string {
|
||||
return this.$store.getters["getTitle"]
|
||||
return this.$store.getters['getTitle']
|
||||
}
|
||||
|
||||
get remoteMode() {
|
||||
get remoteMode(): boolean {
|
||||
return this.$store.state.socket.remoteMode ?? false
|
||||
}
|
||||
|
||||
get mainBackground() {
|
||||
return this.$store.getters["files/getMainBackground"]
|
||||
get mainBackground(): string {
|
||||
return this.$store.getters['files/getMainBackground']
|
||||
}
|
||||
|
||||
get mainStyle() {
|
||||
@@ -82,30 +98,34 @@ export default class App extends Mixins(BaseMixin) {
|
||||
}
|
||||
|
||||
get customStylesheet () {
|
||||
return this.$store.getters["files/getCustomStylesheet"]
|
||||
return this.$store.getters['files/getCustomStylesheet']
|
||||
}
|
||||
|
||||
get customFavicons () {
|
||||
return this.$store.getters["files/getCustomFavicons"] ?? null
|
||||
get customFavicons(): string | null {
|
||||
return this.$store.getters['files/getCustomFavicons'] ?? null
|
||||
}
|
||||
|
||||
get language () {
|
||||
get language(): string {
|
||||
return this.$store.state.gui.general.language
|
||||
}
|
||||
|
||||
get current_file () {
|
||||
return this.$store.state.printer.print_stats?.filename ?? ""
|
||||
get current_file(): string {
|
||||
return this.$store.state.printer.print_stats?.filename ?? ''
|
||||
}
|
||||
|
||||
get logoColor () {
|
||||
get logoColor(): string {
|
||||
return this.$store.state.gui.theme.logo
|
||||
}
|
||||
|
||||
get primaryColor () {
|
||||
get primaryColor(): string {
|
||||
return this.$store.state.gui.theme.primary
|
||||
}
|
||||
|
||||
get primaryTextColor() {
|
||||
get warningColor(): string {
|
||||
return this.$vuetify?.theme?.currentTheme?.warning?.toString() ?? '#ff8300'
|
||||
}
|
||||
|
||||
get primaryTextColor(): string {
|
||||
let splits = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(this.primaryColor)
|
||||
if (splits) {
|
||||
const r = parseInt(splits[1], 16) * 0.2126
|
||||
@@ -119,29 +139,35 @@ export default class App extends Mixins(BaseMixin) {
|
||||
return '#ffffff'
|
||||
}
|
||||
|
||||
get cssVars() {
|
||||
get cssVars(): { [key: string]: string } {
|
||||
return {
|
||||
'--v-btn-text-primary': this.primaryTextColor
|
||||
'--v-btn-text-primary': this.primaryTextColor,
|
||||
'--color-primary': this.primaryColor,
|
||||
'--color-warning': this.warningColor,
|
||||
'--panel-toolbar-icon-btn-width': panelToolbarHeight + 'px',
|
||||
'--panel-toolbar-text-btn-height': panelToolbarHeight + 'px',
|
||||
'--topbar-icon-btn-width': topbarHeight + 'px',
|
||||
'--sidebar-menu-item-height': navigationItemHeight + 'px'
|
||||
}
|
||||
}
|
||||
|
||||
get print_percent () {
|
||||
return Math.round(this.$store.getters["printer/getPrintPercent"] * 100)
|
||||
get print_percent(): number {
|
||||
return Math.round(this.$store.getters['printer/getPrintPercent'] * 100)
|
||||
}
|
||||
|
||||
@Watch('language')
|
||||
languageChanged(newVal: string) {
|
||||
this.$i18n.locale = newVal;
|
||||
languageChanged(newVal: string): void {
|
||||
this.$i18n.locale = newVal
|
||||
}
|
||||
|
||||
@Watch('customStylesheet')
|
||||
customStylesheetChanged(newVal: string | null) {
|
||||
const style = document.getElementById("customStylesheet")
|
||||
customStylesheetChanged(newVal: string | null): void {
|
||||
const style = document.getElementById('customStylesheet')
|
||||
if (newVal !== null && style === null) {
|
||||
const newStyle = document.createElement('link')
|
||||
newStyle.id = "customStylesheet"
|
||||
newStyle.type = "text/css"
|
||||
newStyle.rel = "stylesheet"
|
||||
newStyle.id = 'customStylesheet'
|
||||
newStyle.type = 'text/css'
|
||||
newStyle.rel = 'stylesheet'
|
||||
newStyle.href = newVal
|
||||
document.head.appendChild(newStyle)
|
||||
} else if (newVal !== null && style) {
|
||||
@@ -150,24 +176,24 @@ export default class App extends Mixins(BaseMixin) {
|
||||
}
|
||||
|
||||
@Watch('current_file')
|
||||
current_fileChanged(newVal: string) {
|
||||
if (newVal !== "") this.$socket.emit("server.files.metadata", { filename: newVal }, { action: "files/getMetadataCurrentFile" });
|
||||
current_fileChanged(newVal: string): void {
|
||||
if (newVal !== '') this.$socket.emit('server.files.metadata', { filename: newVal }, { action: 'files/getMetadataCurrentFile' })
|
||||
}
|
||||
|
||||
@Watch('primaryColor')
|
||||
primaryColorChanged(newVal: string) {
|
||||
primaryColorChanged(newVal: string): void {
|
||||
this.$nextTick(() => {
|
||||
this.$vuetify.theme.currentTheme.primary = newVal
|
||||
})
|
||||
}
|
||||
|
||||
drawFavicon(val: number) {
|
||||
const favicon16: HTMLLinkElement | null = document.querySelector("link[rel*='icon'][sizes='16x16']")
|
||||
const favicon32: HTMLLinkElement | null = document.querySelector("link[rel*='icon'][sizes='32x32']")
|
||||
drawFavicon(val: number): void {
|
||||
const favicon16: HTMLLinkElement | null = document.querySelector('link[rel*=\'icon\'][sizes=\'16x16\']')
|
||||
const favicon32: HTMLLinkElement | null = document.querySelector('link[rel*=\'icon\'][sizes=\'32x32\']')
|
||||
|
||||
if (favicon16 && favicon32) {
|
||||
if (this.printerIsPrinting) {
|
||||
let faviconSize = 64;
|
||||
let faviconSize = 64
|
||||
|
||||
let canvas = document.createElement('canvas')
|
||||
canvas.width = faviconSize
|
||||
@@ -183,9 +209,9 @@ export default class App extends Mixins(BaseMixin) {
|
||||
context.moveTo(centerX, centerY)
|
||||
context.arc(centerX, centerY, radius, 0, 2 * Math.PI, false)
|
||||
context.closePath()
|
||||
context.fillStyle = "#ddd"
|
||||
context.fillStyle = '#ddd'
|
||||
context.fill()
|
||||
context.strokeStyle = "rgba(200, 208, 218, 0.66)"
|
||||
context.strokeStyle = 'rgba(200, 208, 218, 0.66)'
|
||||
context.stroke()
|
||||
|
||||
// draw the green circle based on percentage
|
||||
@@ -229,27 +255,37 @@ export default class App extends Mixins(BaseMixin) {
|
||||
}
|
||||
|
||||
@Watch('customFavicons')
|
||||
customFaviconsChanged() {
|
||||
customFaviconsChanged(): void {
|
||||
this.drawFavicon(this.print_percent)
|
||||
}
|
||||
|
||||
@Watch('logoColor')
|
||||
logoColorChanged() {
|
||||
logoColorChanged(): void {
|
||||
this.drawFavicon(this.print_percent)
|
||||
}
|
||||
|
||||
@Watch('print_percent')
|
||||
print_percentChanged(newVal: number) {
|
||||
print_percentChanged(newVal: number): void {
|
||||
this.drawFavicon(newVal)
|
||||
}
|
||||
|
||||
@Watch('printerIsPrinting')
|
||||
printerIsPrintingChanged() {
|
||||
printerIsPrintingChanged(): void {
|
||||
this.drawFavicon(this.print_percent)
|
||||
}
|
||||
|
||||
mounted() {
|
||||
appHeight() {
|
||||
this.$nextTick(() => {
|
||||
const doc = document.documentElement
|
||||
doc.style.setProperty('--app-height', window.innerHeight+'px')
|
||||
})
|
||||
}
|
||||
|
||||
mounted(): void {
|
||||
this.drawFavicon(this.print_percent)
|
||||
this.appHeight()
|
||||
window.addEventListener('resize', this.appHeight)
|
||||
window.addEventListener('orientationchange', this.appHeight)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -45,4 +45,12 @@
|
||||
font-weight: 900;
|
||||
src: local('Roboto Black'), local('Roboto-Black'), url(/fonts/roboto-black.woff2) format('woff2');
|
||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
||||
}
|
||||
/* latin */
|
||||
@font-face {
|
||||
font-family: 'Roboto Mono';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: local('Roboto Mono'), local('Roboto-Mono'), url(/fonts/robotoMono-regular.woff) format('woff');
|
||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
||||
}
|
||||
@@ -1,3 +1,7 @@
|
||||
html {
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
body {
|
||||
background: #121212;
|
||||
}
|
||||
|
||||
@@ -7,24 +7,25 @@
|
||||
:fullscreen="isMobile"
|
||||
>
|
||||
<template #activator="{ on, attrs }">
|
||||
<v-btn
|
||||
class="gcode-command-btn px-2 minwidth-0"
|
||||
color="grey darken-3"
|
||||
:small="isMini"
|
||||
v-bind="attrs"
|
||||
v-on="on">
|
||||
<v-icon>mdi-help</v-icon>
|
||||
</v-btn>
|
||||
<template v-if="inToolbar">
|
||||
<v-btn icon tile v-bind="attrs" v-on="on"><v-icon small>mdi-help</v-icon></v-btn>
|
||||
</template>
|
||||
<template v-else>
|
||||
<v-btn
|
||||
class="gcode-command-btn px-2 minwidth-0"
|
||||
color="lightgray"
|
||||
:small="isMini"
|
||||
v-bind="attrs"
|
||||
v-on="on">
|
||||
<v-icon>mdi-help</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
</template>
|
||||
<template #default>
|
||||
<v-card>
|
||||
<v-toolbar flat dense>
|
||||
<v-toolbar-title>
|
||||
<span class="subheading"><v-icon left>mdi-help</v-icon>{{ $t('Console.CommandList') }}</span>
|
||||
</v-toolbar-title>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn small class="minwidth-0 px-2" color="grey darken-2" @click="isOpen = false"><v-icon small>mdi-close-thick</v-icon></v-btn>
|
||||
</v-toolbar>
|
||||
<panel :title="$t('Console.CommandList')" icon="mdi-help" card-class="command-help-dialog" :margin-bottom="false">
|
||||
<template v-slot:buttons>
|
||||
<v-btn icon tile @click="isOpen = false"><v-icon>mdi-close-thick</v-icon></v-btn>
|
||||
</template>
|
||||
<v-card-title>
|
||||
<v-row>
|
||||
<v-col>
|
||||
@@ -34,12 +35,13 @@
|
||||
outlined
|
||||
hide-details
|
||||
clearable
|
||||
dense
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-card-title>
|
||||
<v-divider></v-divider>
|
||||
<perfect-scrollbar :class="'command-help-content '+(isMobile ? '' : 'height300')">
|
||||
<overlay-scrollbars :class="'command-help-content '+(isMobile ? '' : 'height300')">
|
||||
<v-card-text class="pt-0">
|
||||
<v-row>
|
||||
<v-col>
|
||||
@@ -58,21 +60,27 @@
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-card-text>
|
||||
</perfect-scrollbar>
|
||||
</v-card>
|
||||
</overlay-scrollbars>
|
||||
</panel>
|
||||
</template>
|
||||
</v-dialog>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import BaseMixin from "./mixins/base";
|
||||
import {CommandHelp} from "@/store/printer/types";
|
||||
import {Mixins, Prop, Watch} from "vue-property-decorator";
|
||||
import Component from "vue-class-component";
|
||||
import BaseMixin from './mixins/base'
|
||||
import {CommandHelp} from '@/store/printer/types'
|
||||
import {Mixins, Prop, Watch} from 'vue-property-decorator'
|
||||
import Component from 'vue-class-component'
|
||||
import Panel from '@/components/ui/Panel.vue'
|
||||
|
||||
@Component({
|
||||
components: {Panel}
|
||||
})
|
||||
|
||||
@Component
|
||||
export default class CommandHelpModal extends Mixins(BaseMixin) {
|
||||
@Prop({ required: false, default: false }) isMini!: boolean;
|
||||
@Prop({ required: false, default: false }) inToolbar!: boolean;
|
||||
|
||||
cmdListSearch = '';
|
||||
isOpen = false;
|
||||
|
||||
@@ -82,14 +90,14 @@ export default class CommandHelpModal extends Mixins(BaseMixin) {
|
||||
|
||||
get helplistFiltered(): CommandHelp[] {
|
||||
return this.helplist
|
||||
.filter(cmd => typeof(cmd.description) === "string" && (!this.cmdListSearch || cmd.commandLow.includes(this.cmdListSearch.toLowerCase())))
|
||||
.sort((a, b) => a.commandLow.localeCompare(b.commandLow));
|
||||
.filter(cmd => typeof(cmd.description) === 'string' && (!this.cmdListSearch || cmd.commandLow.includes(this.cmdListSearch.toLowerCase())))
|
||||
.sort((a, b) => a.commandLow.localeCompare(b.commandLow))
|
||||
}
|
||||
|
||||
@Watch('isOpen')
|
||||
onIsOpen(val: boolean): void {
|
||||
if (!val) {
|
||||
this.cmdListSearch = '';
|
||||
this.cmdListSearch = ''
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<template>
|
||||
<v-dialog v-model="showDialog" persistent :width="400">
|
||||
<v-card dark>
|
||||
<v-toolbar flat dense color="primary">
|
||||
<v-toolbar flat dense>
|
||||
<v-toolbar-title>
|
||||
<span class="subheading">
|
||||
<v-icon class="mdi mdi-connection" left></v-icon>
|
||||
@@ -31,7 +31,7 @@
|
||||
<v-divider class="mt-4 mb-5"></v-divider>
|
||||
</template>
|
||||
<div class="text-center">
|
||||
<v-btn @click="reconnect" color="primary">{{ $t("ConnectionDialog.TryAgain") }}</v-btn>
|
||||
<v-btn @click="reconnect" class="primary--text">{{ $t("ConnectionDialog.TryAgain") }}</v-btn>
|
||||
</div>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
@@ -43,7 +43,7 @@
|
||||
import Component from 'vue-class-component'
|
||||
import { Mixins } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import ConnectionStatus from "@/components/ui/ConnectionStatus.vue";
|
||||
import ConnectionStatus from '@/components/ui/ConnectionStatus.vue'
|
||||
|
||||
@Component({
|
||||
components: {
|
||||
@@ -66,7 +66,7 @@ export default class TheUpdateDialog extends Mixins(BaseMixin) {
|
||||
}
|
||||
|
||||
get formatHostname() {
|
||||
return parseInt(this.port) !== 80 && this.port !== "" ? this.hostname+":"+this.port : this.hostname
|
||||
return parseInt(this.port) !== 80 && this.port !== '' ? this.hostname+':'+this.port : this.hostname
|
||||
}
|
||||
|
||||
get isConnected() {
|
||||
|
||||
@@ -1,41 +1,29 @@
|
||||
<style scoped>
|
||||
.editor-content-container {
|
||||
height: calc(100vh - 64px);
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<v-dialog v-model="show"
|
||||
<v-dialog persistent v-model="show"
|
||||
fullscreen
|
||||
hide-overlay
|
||||
:transition="false"
|
||||
@close="close"
|
||||
@keydown.esc="close"
|
||||
@keydown.esc="escClose"
|
||||
>
|
||||
<v-card>
|
||||
<v-toolbar dark color="primary">
|
||||
<v-btn icon dark @click="close">
|
||||
<v-icon>mdi-close</v-icon>
|
||||
</v-btn>
|
||||
<v-toolbar-title>{{ filepath ? filepath.slice(1)+"/" : "" }}{{ filename }}</v-toolbar-title>
|
||||
<v-spacer></v-spacer>
|
||||
<v-toolbar-items>
|
||||
<v-btn dark text href="https://www.klipper3d.org/Config_Reference.html" v-if="restartServiceName === 'klipper'" target="_blank" class="d-none d-md-flex"><v-icon small class="mr-1">mdi-help</v-icon>{{ $t('Editor.ConfigReference') }}</v-btn>
|
||||
<template v-if="isWriteable">
|
||||
<v-divider white vertical class="d-none d-md-flex" v-if="restartServiceName === 'klipper'"></v-divider>
|
||||
<v-btn dark text @click="save(null)" ><v-icon small class="mr-1">mdi-content-save</v-icon><span class="d-none d-sm-inline">{{ $t('Editor.SaveClose') }}</span></v-btn>
|
||||
</template>
|
||||
<template v-if="restartServiceName != null">
|
||||
<v-divider white vertical class="d-none d-sm-flex"></v-divider>
|
||||
<v-btn dark text @click="save(restartServiceName)" class="d-none d-sm-flex"><v-icon small class="mr-1">mdi-restart</v-icon>{{ $t('Editor.SaveRestart') }}</v-btn>
|
||||
</template>
|
||||
</v-toolbar-items>
|
||||
</v-toolbar>
|
||||
<panel card-class="editor-dialog" icon="mdi-file-document-edit-outline" :title="(filepath ? filepath.slice(1)+'/': '')+filename+' '+changed">
|
||||
<template v-slot:buttons>
|
||||
<v-btn text tile href="https://www.klipper3d.org/Config_Reference.html" v-if="restartServiceName === 'klipper'" target="_blank" class="d-none d-md-flex"><v-icon small class="mr-1">mdi-help</v-icon>{{ $t('Editor.ConfigReference') }}</v-btn>
|
||||
<v-btn v-if="isWriteable" text tile :color="restartServiceName === null ? 'primary' : ''" @click="save(null)" ><v-icon small class="mr-1">mdi-content-save</v-icon><span class="d-none d-sm-inline">{{ $t('Editor.SaveClose') }}</span></v-btn>
|
||||
<v-btn v-if="restartServiceName !== null" color="primary" text tile @click="save(restartServiceName)" class="d-none d-sm-flex"><v-icon small class="mr-1">mdi-restart</v-icon>{{ $t('Editor.SaveRestart') }}</v-btn>
|
||||
<v-btn icon tile @click="close"><v-icon>mdi-close-thick</v-icon></v-btn>
|
||||
</template>
|
||||
<v-card-text class="pa-0">
|
||||
<codemirror ref="editor" v-model="sourcecode" :name="filename" v-bind:file-extension="fileExtension"></codemirror>
|
||||
<overlay-scrollbars style="height: calc(var(--app-height) - 48px)" :options="{ }">
|
||||
<codemirror ref="editor" v-model="sourcecode" :name="filename" v-bind:file-extension="fileExtension"></codemirror>
|
||||
</overlay-scrollbars>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</panel>
|
||||
</v-dialog>
|
||||
<v-snackbar v-model="loaderBool" :timeout="-1" :value="true" fixed right bottom dark>
|
||||
<div>
|
||||
@@ -52,39 +40,78 @@
|
||||
v-bind="attrs"
|
||||
@click="cancelDownload"
|
||||
style="min-width: auto;"
|
||||
tile
|
||||
>
|
||||
<v-icon class="0">mdi-close</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
</v-snackbar>
|
||||
<v-dialog v-model="dialogConfirmChange" persistent :width="600">
|
||||
<panel card-class="editor-confirm-change-dialog" icon="mdi-help-circle" :title="$t('Editor.UnsavedChanges')" :margin-bottom="false">
|
||||
<template v-slot:buttons>
|
||||
<v-btn icon tile @click="dialogConfirmChange = false"><v-icon>mdi-close-thick</v-icon></v-btn>
|
||||
</template>
|
||||
<v-card-text class="pt-3">
|
||||
<v-row>
|
||||
<v-col>
|
||||
<p class="body-1 mb-2">{{ $t('Editor.UnsavedChangesMessage', {filename: filename}) }}</p>
|
||||
<p class="body-2">{{ $t('Editor.UnsavedChangesSubMessage') }}</p>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn text @click="discardChanges">
|
||||
{{ $t('Editor.DontSave') }}
|
||||
</v-btn>
|
||||
<v-btn text color="primary" @click="save">
|
||||
{{ $t('Editor.SaveClose') }}
|
||||
</v-btn>
|
||||
<template v-if="restartServiceName != null">
|
||||
<v-btn text color="primary" @click="save(restartServiceName)">
|
||||
{{ $t('Editor.SaveRestart') }}
|
||||
</v-btn>
|
||||
</template>
|
||||
</v-card-actions>
|
||||
</panel>
|
||||
</v-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import {Component, Mixins} from "vue-property-decorator";
|
||||
import BaseMixin from "@/components/mixins/base"
|
||||
import {formatFilesize} from "@/plugins/helpers";
|
||||
import Codemirror from "@/components/inputs/Codemirror.vue";
|
||||
import {Component, Mixins} from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import {formatFilesize} from '@/plugins/helpers'
|
||||
import Codemirror from '@/components/inputs/Codemirror.vue'
|
||||
import Panel from '@/components/ui/Panel.vue'
|
||||
|
||||
@Component({
|
||||
components: {Codemirror}
|
||||
components: {Panel, Codemirror}
|
||||
})
|
||||
|
||||
export default class TheEditor extends Mixins(BaseMixin) {
|
||||
private dialogConfirmChange = false
|
||||
|
||||
formatFilesize = formatFilesize
|
||||
|
||||
refs!: {
|
||||
editor: any
|
||||
}
|
||||
|
||||
get changed() {
|
||||
return this.$store.state.editor.changed ? '*' : ''
|
||||
}
|
||||
|
||||
get show() {
|
||||
return this.$store.state.editor.bool ?? false
|
||||
}
|
||||
|
||||
get filepath(): string {
|
||||
return this.$store.state.editor.filepath ?? ""
|
||||
return this.$store.state.editor.filepath ?? ''
|
||||
}
|
||||
|
||||
get filename(): string {
|
||||
return this.$store.state.editor.filename ?? ""
|
||||
return this.$store.state.editor.filename ?? ''
|
||||
}
|
||||
|
||||
get fileExtension() {
|
||||
@@ -94,15 +121,19 @@ export default class TheEditor extends Mixins(BaseMixin) {
|
||||
}
|
||||
|
||||
get fileroot() {
|
||||
return this.$store.state.editor.fileroot ?? "gcodes"
|
||||
return this.$store.state.editor.fileroot ?? 'gcodes'
|
||||
}
|
||||
|
||||
get permissions(): string {
|
||||
return this.$store.state.editor.permissions ?? 'r'
|
||||
}
|
||||
|
||||
get isWriteable() {
|
||||
return ['config', 'gcodes'].includes(this.fileroot)
|
||||
return this.permissions.includes('w')
|
||||
}
|
||||
|
||||
get sourcecode() {
|
||||
return this.$store.state.editor.sourcecode ?? ""
|
||||
return this.$store.state.editor.sourcecode ?? ''
|
||||
}
|
||||
|
||||
set sourcecode(newVal) {
|
||||
@@ -118,7 +149,7 @@ export default class TheEditor extends Mixins(BaseMixin) {
|
||||
}
|
||||
|
||||
get snackbarHeadline() {
|
||||
let directionUppercase = this.$t("Files.Downloading")
|
||||
let directionUppercase = this.$t('Files.Downloading')
|
||||
if (this.loaderProgress.direction) {
|
||||
directionUppercase = this.loaderProgress.direction?.charAt(0).toUpperCase() + this.loaderProgress.direction?.slice(1)
|
||||
}
|
||||
@@ -130,27 +161,51 @@ export default class TheEditor extends Mixins(BaseMixin) {
|
||||
if (!this.isWriteable) return null
|
||||
if (['printing', 'paused'].includes(this.printer_state)) return null
|
||||
|
||||
if (this.filename === "moonraker.conf")
|
||||
return "moonraker"
|
||||
else if (this.filename.startsWith("webcam") && this.filename.endsWith(".txt"))
|
||||
return "webcamd"
|
||||
else if (this.filename.startsWith("mooncord") && this.filename.endsWith(".json"))
|
||||
return "mooncord"
|
||||
else if (this.filename.endsWith(".cfg"))
|
||||
return "klipper"
|
||||
if (this.filename === 'moonraker.conf')
|
||||
return 'moonraker'
|
||||
else if (this.filename === 'webcam.conf')
|
||||
return 'webcamd'
|
||||
else if (this.filename.startsWith('webcam') && this.filename.endsWith('.txt'))
|
||||
return 'webcamd'
|
||||
else if (this.filename.startsWith('mooncord') && this.filename.endsWith('.json'))
|
||||
return 'mooncord'
|
||||
else if (this.filename.endsWith('.cfg'))
|
||||
return 'klipper'
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
cancelDownload() {
|
||||
this.$store.dispatch("editor/cancelLoad")
|
||||
this.$store.dispatch('editor/cancelLoad')
|
||||
}
|
||||
|
||||
escClose() {
|
||||
if (this.$store.state.gui.editor.escToClose)
|
||||
this.close()
|
||||
}
|
||||
|
||||
close() {
|
||||
this.$store.dispatch("editor/close")
|
||||
if (this.$store.state.gui.editor.confirmUnsavedChanges)
|
||||
this.promptUnsavedChanges()
|
||||
else
|
||||
this.$store.dispatch('editor/close')
|
||||
}
|
||||
|
||||
discardChanges() {
|
||||
this.dialogConfirmChange = false
|
||||
this.$store.dispatch('editor/close')
|
||||
}
|
||||
|
||||
promptUnsavedChanges() {
|
||||
if (!this.$store.state.editor.changed || !this.isWriteable)
|
||||
this.$store.dispatch('editor/close')
|
||||
else
|
||||
this.dialogConfirmChange = true
|
||||
}
|
||||
|
||||
save(restartServiceName: string | null = null) {
|
||||
this.dialogConfirmChange = false
|
||||
|
||||
this.$store.dispatch('editor/saveFile', {
|
||||
content: this.sourcecode,
|
||||
restartServiceName: restartServiceName
|
||||
|
||||
@@ -4,37 +4,30 @@
|
||||
|
||||
<template>
|
||||
<v-dialog v-model="showDialog" persistent :width="400">
|
||||
<v-card dark>
|
||||
<v-toolbar flat dense color="primary">
|
||||
<v-toolbar-title>
|
||||
<span class="subheading">
|
||||
<v-icon class="mdi mdi-connection" left></v-icon>
|
||||
<template v-if="dialogAddPrinter.bool">{{ $t("SelectPrinterDialog.AddPrinter") }}</template>
|
||||
<template v-else-if="dialogEditPrinter.bool">{{ $t("SelectPrinterDialog.EditPrinter") }}</template>
|
||||
<template v-else-if="isConnecting">{{ $t("SelectPrinterDialog.Connecting", {'host': formatHostname}) }}</template>
|
||||
<template v-else-if="connectingFailed">{{ $t("SelectPrinterDialog.ConnectionFailed", {'host': formatHostname}) }}</template>
|
||||
<template v-else>{{ $t("SelectPrinterDialog.SelectPrinter") }}</template>
|
||||
</span>
|
||||
</v-toolbar-title>
|
||||
<v-spacer></v-spacer>
|
||||
<panel card-class="select-printer-dialog" icon="mdi-connection" :title="panelTitle" :margin-bottom="false" toolbar-color="primary">
|
||||
<template v-slot:buttons>
|
||||
<template v-if="!isConnecting && !connectingFailed">
|
||||
<template v-if="dialogEditPrinter.bool"><v-btn small class="minwidth-0" @click="dialogEditPrinter.bool = false"><v-icon small>mdi-close-thick</v-icon></v-btn></template>
|
||||
<template v-else-if="dialogAddPrinter.bool"><v-btn small class="minwidth-0" v-if="dialogAddPrinter.bool" @click="dialogAddPrinter.bool = false"><v-icon small>mdi-close-thick</v-icon></v-btn></template>
|
||||
<template v-else-if="Object.keys(this.printers).length > 0"><v-btn small class="minwidth-0" @click="checkPrinters"><v-icon small>mdi-sync</v-icon></v-btn></template>
|
||||
<template v-if="dialogEditPrinter.bool"><v-btn icon tile class="minwidth-0" @click="dialogEditPrinter.bool = false"><v-icon>mdi-close-thick</v-icon></v-btn></template>
|
||||
<template v-else-if="dialogAddPrinter.bool"><v-btn icon tile class="minwidth-0" v-if="dialogAddPrinter.bool" @click="dialogAddPrinter.bool = false"><v-icon>mdi-close-thick</v-icon></v-btn></template>
|
||||
<template v-else-if="printers.length > 0"><v-btn icon tile class="minwidth-0" @click="checkPrinters"><v-icon>mdi-sync</v-icon></v-btn></template>
|
||||
</template>
|
||||
</v-toolbar>
|
||||
<v-card-text class="pt-5" v-if="isConnecting">
|
||||
<v-progress-linear color="white" indeterminate></v-progress-linear>
|
||||
</v-card-text>
|
||||
<v-card-text class="pt-5" v-if="!isConnecting && connectingFailed">
|
||||
<p>{{ $t("SelectPrinterDialog.CannotConnectTo", {'host': parseInt(port) !== 80 ? hostname+":"+port : hostname}) }}</p>
|
||||
<div class="text-center">
|
||||
<v-btn @click="switchToChangePrinter" color="white" outlined class="mr-3">{{ $t("SelectPrinterDialog.ChangePrinter") }}</v-btn>
|
||||
<v-btn @click="reconnect" color="primary">{{ $t("SelectPrinterDialog.TryAgain") }}</v-btn>
|
||||
</div>
|
||||
</v-card-text>
|
||||
<v-card-text class="pt-3" v-if="!isConnecting && dialogAddPrinter.bool">
|
||||
<v-container class="px-0 py-0">
|
||||
</template>
|
||||
<template v-if="isConnecting">
|
||||
<v-card-text>
|
||||
<v-progress-linear color="white" indeterminate></v-progress-linear>
|
||||
</v-card-text>
|
||||
</template>
|
||||
<template v-else-if="!isConnecting && connectingFailed">
|
||||
<v-card-text>
|
||||
<p>{{ $t("SelectPrinterDialog.CannotConnectTo", {'host': parseInt(port) !== 80 ? hostname+":"+port : hostname}) }}</p>
|
||||
<div class="text-center">
|
||||
<v-btn text @click="switchToChangePrinter" color="white" class="mr-3">{{ $t("SelectPrinterDialog.ChangePrinter") }}</v-btn>
|
||||
<v-btn text @click="reconnect" color="primary">{{ $t("SelectPrinterDialog.TryAgain") }}</v-btn>
|
||||
</div>
|
||||
</v-card-text>
|
||||
</template>
|
||||
<template v-else-if="!isConnecting && dialogAddPrinter.bool">
|
||||
<v-card-text>
|
||||
<v-row>
|
||||
<v-col class="col-8">
|
||||
<v-text-field
|
||||
@@ -46,6 +39,9 @@
|
||||
]"
|
||||
label="Hostname/IP"
|
||||
required
|
||||
outlined
|
||||
hide-details="auto"
|
||||
dense
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
<v-col class="col-4">
|
||||
@@ -53,26 +49,28 @@
|
||||
v-model="dialogAddPrinter.port"
|
||||
:rules="[v => !!v || $t('SelectPrinterDialog.PortRequired')]"
|
||||
label="Port"
|
||||
hide-details="auto"
|
||||
required
|
||||
outlined
|
||||
dense
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
<v-col class="text-right">
|
||||
<v-btn
|
||||
color="white"
|
||||
outlined
|
||||
class="middle"
|
||||
@click="addPrinter"
|
||||
>
|
||||
{{ $t("SelectPrinterDialog.AddPrinter") }}
|
||||
</v-btn>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
</v-card-text>
|
||||
<v-card-text class="pt-3" v-if="!isConnecting && dialogEditPrinter.bool">
|
||||
<v-container class="px-0 py-0">
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn
|
||||
color="primary"
|
||||
text
|
||||
class="middle"
|
||||
@click="addPrinter"
|
||||
>
|
||||
{{ $t("SelectPrinterDialog.AddPrinter") }}
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</template>
|
||||
<template v-else-if="!isConnecting && dialogEditPrinter.bool">
|
||||
<v-card-text>
|
||||
<v-row>
|
||||
<v-col class="col-8">
|
||||
<v-text-field
|
||||
@@ -84,6 +82,9 @@
|
||||
]"
|
||||
label="Hostname/IP"
|
||||
required
|
||||
outlined
|
||||
dense
|
||||
hide-details="auto"
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
<v-col class="col-4">
|
||||
@@ -92,57 +93,60 @@
|
||||
:rules="[v => !!v || $t('SelectPrinterDialog.PortRequired')]"
|
||||
label="Port"
|
||||
required
|
||||
outlined
|
||||
dense
|
||||
hide-details="auto"
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
<v-col class="">
|
||||
<v-btn
|
||||
color="red"
|
||||
outlined
|
||||
class="middle minwidth-0"
|
||||
@click="delPrinter"
|
||||
>
|
||||
<v-icon small>mdi-delete</v-icon>
|
||||
</v-btn>
|
||||
</v-col>
|
||||
<v-col class="text-right">
|
||||
<v-btn
|
||||
color="white"
|
||||
outlined
|
||||
class="middle"
|
||||
@click="updatePrinter"
|
||||
>
|
||||
{{ $t("SelectPrinterDialog.UpdatePrinter") }}
|
||||
</v-btn>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
</v-card-text>
|
||||
<v-card-text class="pt-3" v-if="!isConnecting && !connectingFailed && !dialogAddPrinter.bool && !dialogEditPrinter.bool">
|
||||
<v-container class="px-0 pb-0">
|
||||
<v-row v-for="(printer, index) in printers" v-bind:key="index">
|
||||
<v-col class="rounded transition-swing secondary py-2 px-2 mb-2" style="cursor: pointer;" @click="connect(printer)">
|
||||
<v-row align="center">
|
||||
<v-col class="col-auto pr-0">
|
||||
<v-progress-circular
|
||||
indeterminate
|
||||
color="primary"
|
||||
v-if="printer.socket.isConnecting"
|
||||
></v-progress-circular>
|
||||
<v-icon
|
||||
:color="printer.socket.isConnected ? 'green' : 'red'"
|
||||
v-if="!printer.socket.isConnecting"
|
||||
>mdi-{{ printer.socket.isConnected ? 'checkbox-marked-circle' : 'cancel' }}</v-icon>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-btn
|
||||
color="red"
|
||||
text
|
||||
class="minwidth-0"
|
||||
@click="delPrinter"
|
||||
>
|
||||
<v-icon small>mdi-delete</v-icon>
|
||||
</v-btn>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn
|
||||
color="primary"
|
||||
text
|
||||
@click="updatePrinter"
|
||||
>
|
||||
{{ $t("SelectPrinterDialog.UpdatePrinter") }}
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</template>
|
||||
<template v-else>
|
||||
<v-card-text class="mt-3">
|
||||
<v-row v-if="printers.length">
|
||||
<v-col class="px-6">
|
||||
<v-row v-for="(printer, index) in printers" v-bind:key="index">
|
||||
<v-col class="rounded transition-swing secondary py-2 px-2 mb-2" style="cursor: pointer;" @click="connect(printer)">
|
||||
<v-row align="center">
|
||||
<v-col class="col-auto pr-0">
|
||||
<v-progress-circular
|
||||
indeterminate
|
||||
color="primary"
|
||||
v-if="printer.socket.isConnecting"
|
||||
></v-progress-circular>
|
||||
<v-icon
|
||||
:color="printer.socket.isConnected ? 'green' : 'red'"
|
||||
v-if="!printer.socket.isConnecting"
|
||||
>mdi-{{ printer.socket.isConnected ? 'checkbox-marked-circle' : 'cancel' }}</v-icon>
|
||||
</v-col>
|
||||
<v-col>{{ getPrinterName(printer.id) }}</v-col>
|
||||
<v-col class="col-auto"><v-btn small class="minwidth-0" v-on:click.stop.prevent="editPrinter(printer)"><v-icon small>mdi-pencil</v-icon></v-btn></v-col>
|
||||
</v-row>
|
||||
</v-col>
|
||||
<v-col>{{ getPrinterName(printer._namespace) }}</v-col>
|
||||
<v-col class="col-auto"><v-btn small class="minwidth-0" v-on:click.stop.prevent="editPrinter(index)"><v-icon small>mdi-pencil</v-icon></v-btn></v-col>
|
||||
</v-row>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row v-if="showCorsInfo">
|
||||
<v-col>
|
||||
<p class="text-center" v-if="Object.keys(this.printers).length === 0">{{ $t("SelectPrinterDialog.Hello") }}</p>
|
||||
<p class="text-center" v-if="this.printers.length === 0">{{ $t("SelectPrinterDialog.Hello") }}</p>
|
||||
<p class="text-center">{{ $t("SelectPrinterDialog.RememberToAdd", {cors: currentUrl}) }}</p>
|
||||
<p class="text-center mb-0">{{ $t("SelectPrinterDialog.YouCanFindMore") }} <a href="https://docs.mainsail.xyz/remotemode" target="_blank">https://docs.mainsail.xyz/remotemode</a>.</p>
|
||||
</v-col>
|
||||
@@ -152,36 +156,40 @@
|
||||
<v-btn @click="dialogAddPrinter.bool = true">{{ $t("SelectPrinterDialog.AddPrinter") }}</v-btn>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</v-card-text>
|
||||
</template>
|
||||
</panel>
|
||||
</v-dialog>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
|
||||
import {Component, Mixins} from 'vue-property-decorator'
|
||||
import BaseMixin from './mixins/base'
|
||||
import {FarmPrinterState} from '@/store/farm/printer/types'
|
||||
import Panel from '@/components/ui/Panel.vue'
|
||||
import { GuiRemoteprintersStatePrinter } from '@/store/gui/remoteprinters/types'
|
||||
|
||||
import {Component, Mixins} from "vue-property-decorator";
|
||||
import BaseMixin from "./mixins/base";
|
||||
import {FarmPrinterState} from "@/store/farm/printer/types";
|
||||
@Component({
|
||||
components: {Panel}
|
||||
})
|
||||
|
||||
@Component
|
||||
export default class TheSelectPrinterDialog extends Mixins(BaseMixin) {
|
||||
|
||||
|
||||
private dialogAddPrinter = {
|
||||
bool: false,
|
||||
hostname: "",
|
||||
hostname: '',
|
||||
port: 7125
|
||||
}
|
||||
private dialogEditPrinter = {
|
||||
bool: false,
|
||||
index: 0,
|
||||
hostname: "",
|
||||
id: '',
|
||||
hostname: '',
|
||||
port: 0
|
||||
}
|
||||
|
||||
get printers() {
|
||||
return this.$store.getters["farm/getPrinters"] ?? []
|
||||
return this.$store.getters['gui/remoteprinters/getRemoteprinters'] ?? []
|
||||
}
|
||||
|
||||
get protocol() {
|
||||
@@ -197,7 +205,7 @@ export default class TheSelectPrinterDialog extends Mixins(BaseMixin) {
|
||||
}
|
||||
|
||||
get formatHostname() {
|
||||
return parseInt(this.port) !== 80 && this.port !== "" ? this.hostname+":"+this.port : this.hostname
|
||||
return parseInt(this.port) !== 80 && this.port !== '' ? this.hostname+':'+this.port : this.hostname
|
||||
}
|
||||
|
||||
get isConnected() {
|
||||
@@ -217,17 +225,16 @@ export default class TheSelectPrinterDialog extends Mixins(BaseMixin) {
|
||||
}
|
||||
|
||||
get currentUrl() {
|
||||
let output = "http://"+window.location.hostname
|
||||
let output = 'http://'+window.location.hostname
|
||||
if (parseInt(window.location.port) !== 80 && window.location.port !== '') output += ':'+window.location.port
|
||||
|
||||
return output
|
||||
}
|
||||
|
||||
get showCorsInfo() {
|
||||
if (Object.keys(this.printers).length) {
|
||||
Object.keys(this.printers).forEach((key) => {
|
||||
const printer = this.printers[key]
|
||||
if (!printer.socket.isConnected) return true
|
||||
if (this.printers.length) {
|
||||
this.printers.forEach((printer: GuiRemoteprintersStatePrinter) => {
|
||||
if (printer && !printer.socket?.isConnected) return true
|
||||
})
|
||||
|
||||
return false
|
||||
@@ -236,39 +243,51 @@ export default class TheSelectPrinterDialog extends Mixins(BaseMixin) {
|
||||
return true
|
||||
}
|
||||
|
||||
get panelTitle() {
|
||||
if (this.dialogAddPrinter.bool) return this.$t('SelectPrinterDialog.AddPrinter')
|
||||
else if (this.dialogEditPrinter.bool) return this.$t('SelectPrinterDialog.EditPrinter')
|
||||
else if (this.isConnecting) return this.$t('SelectPrinterDialog.Connecting', { host: this.formatHostname})
|
||||
else if (this.connectingFailed) return this.$t('SelectPrinterDialog.ConnectionFailed', { host: this.formatHostname})
|
||||
else return this.$t('SelectPrinterDialog.SelectPrinter')
|
||||
}
|
||||
|
||||
getPrinterName(namespace: string) {
|
||||
return this.$store.getters["farm/getPrinterName"](namespace)
|
||||
return this.$store.getters['farm/getPrinterName'](namespace)
|
||||
}
|
||||
|
||||
addPrinter() {
|
||||
this.$store.dispatch('farm/addPrinter',{
|
||||
const values = {
|
||||
hostname: this.dialogAddPrinter.hostname,
|
||||
port: this.dialogAddPrinter.port,
|
||||
protocol: this.protocol
|
||||
})
|
||||
}
|
||||
this.$store.dispatch('gui/remoteprinters/store', { values })
|
||||
|
||||
this.dialogAddPrinter.hostname = ""
|
||||
this.dialogAddPrinter.hostname = ''
|
||||
this.dialogAddPrinter.bool = false
|
||||
}
|
||||
|
||||
editPrinter(index: number) {
|
||||
this.dialogEditPrinter.hostname = this.printers[index].socket.hostname
|
||||
this.dialogEditPrinter.port = this.printers[index].socket.port
|
||||
this.dialogEditPrinter.index = index
|
||||
editPrinter(printer: GuiRemoteprintersStatePrinter) {
|
||||
this.dialogEditPrinter.hostname = printer.hostname
|
||||
this.dialogEditPrinter.port = printer.port
|
||||
this.dialogEditPrinter.id = printer.id ?? ''
|
||||
this.dialogEditPrinter.bool = true
|
||||
}
|
||||
|
||||
updatePrinter() {
|
||||
this.$store.dispatch("farm/updatePrinter", {
|
||||
namespace: this.dialogEditPrinter.index,
|
||||
const values = {
|
||||
hostname: this.dialogEditPrinter.hostname,
|
||||
port: this.dialogEditPrinter.port,
|
||||
}
|
||||
this.$store.dispatch('gui/remoteprinters/update', {
|
||||
id: this.dialogEditPrinter.id,
|
||||
values
|
||||
})
|
||||
|
||||
this.dialogEditPrinter.bool = false
|
||||
}
|
||||
|
||||
delPrinter() {
|
||||
this.$store.dispatch("farm/removePrinter", { name: this.dialogEditPrinter.index })
|
||||
this.$store.dispatch('gui/remoteprinters/delete', this.dialogEditPrinter.id)
|
||||
this.dialogEditPrinter.bool = false
|
||||
}
|
||||
|
||||
@@ -277,7 +296,7 @@ export default class TheSelectPrinterDialog extends Mixins(BaseMixin) {
|
||||
hostname: printer.socket.hostname,
|
||||
port: printer.socket.port
|
||||
})
|
||||
this.$socket.setUrl(this.protocol+"://"+printer.socket.hostname+":"+printer.socket.port+"/websocket")
|
||||
this.$socket.setUrl(this.protocol+'://'+printer.socket.hostname+':'+printer.socket.port+'/websocket')
|
||||
this.$socket.connect()
|
||||
}
|
||||
|
||||
@@ -291,16 +310,15 @@ export default class TheSelectPrinterDialog extends Mixins(BaseMixin) {
|
||||
}
|
||||
|
||||
checkPrinters() {
|
||||
Object.keys(this.printers).forEach((key) => {
|
||||
const printer = this.printers[key]
|
||||
if (!printer.socket.isConnected && !printer.socket.isConnecting) {
|
||||
this.$store.dispatch('farm/'+key+'/connect')
|
||||
this.printers.forEach((printer: GuiRemoteprintersStatePrinter) => {
|
||||
if (printer && !printer.socket?.isConnected && !printer.socket?.isConnecting) {
|
||||
this.$store.dispatch('farm/'+printer.id+'/connect')
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
mounted() {
|
||||
this.$store.dispatch("farm/readStoredPrinters")
|
||||
this.$store.dispatch('gui/remoteprinters/initFromLocalstorage')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -1,49 +1,47 @@
|
||||
<template>
|
||||
<div>
|
||||
<v-btn color="grey darken-3" class="ml-5 minwidth-0 px-2" @click="showSettings = true">
|
||||
<v-btn icon tile @click="showSettings = true">
|
||||
<v-icon>mdi-cogs</v-icon>
|
||||
</v-btn>
|
||||
<v-dialog v-model="showSettings" width="900" persistent :fullscreen="isMobile">
|
||||
<v-card style="overflow: hidden;" :height="isMobile ? 0 : 548">
|
||||
<v-toolbar flat dense>
|
||||
<v-toolbar-title>
|
||||
<span class="subheading"><v-icon left>mdi-cogs</v-icon>{{ $t('Settings.InterfaceSettings') }}</span>
|
||||
</v-toolbar-title>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn small class="minwidth-0 px-2" color="grey darken-2" @click="showSettings = false"><v-icon small>mdi-close-thick</v-icon></v-btn>
|
||||
<template v-if="isMobile" v-slot:extension>
|
||||
<v-tabs v-model="activeTab" :center-active="true" :show-arrows="true">
|
||||
<v-tab
|
||||
v-for="(tab, index) of tabTitles" v-bind:key="index"
|
||||
:href="'#'+tab.name"
|
||||
class="justify-start">
|
||||
<v-icon left v-html="tab.icon"></v-icon>
|
||||
{{ tab.title }}
|
||||
</v-tab>
|
||||
</v-tabs>
|
||||
</template>
|
||||
</v-toolbar>
|
||||
<v-row>
|
||||
<v-dialog v-model="showSettings" width="900" persistent :fullscreen="isMobile" @keydown.esc="showSettings = false">
|
||||
<panel :title="$t('Settings.InterfaceSettings')" icon="mdi-cogs" card-class="settings-menu-dialog" :margin-bottom="false" style="overflow: hidden;" :height="isMobile ? 0 : 548">
|
||||
<template v-slot:buttons>
|
||||
<v-btn icon tile @click="showSettings = false"><v-icon>mdi-close-thick</v-icon></v-btn>
|
||||
</template>
|
||||
<template v-if="isMobile">
|
||||
<v-tabs v-model="activeTab" :center-active="true" :show-arrows="true">
|
||||
<v-tab
|
||||
v-for="(tab, index) of tabTitles" v-bind:key="index"
|
||||
:href="'#'+tab.name"
|
||||
class="justify-start">
|
||||
<v-icon left v-html="tab.icon"></v-icon>
|
||||
{{ tab.title }}
|
||||
</v-tab>
|
||||
</v-tabs>
|
||||
</template>
|
||||
<v-row class="flex-row flex-nowrap">
|
||||
<v-col class="col-auto pr-0" v-if="!isMobile">
|
||||
<v-tabs v-model="activeTab" :vertical="true">
|
||||
<v-tab
|
||||
v-for="(tab, index) of tabTitles" v-bind:key="index"
|
||||
:href="'#'+tab.name"
|
||||
class="justify-start"
|
||||
style="width: 200px;"
|
||||
>
|
||||
<v-icon left v-html="tab.icon"></v-icon>
|
||||
<span class="text-truncate">{{ tab.title }}</span>
|
||||
</v-tab>
|
||||
</v-tabs>
|
||||
<overlay-scrollbars class="settings-tabs-bar height500" ref="settingsTabsScroll">
|
||||
<v-tabs v-model="activeTab" :vertical="true">
|
||||
<v-tab
|
||||
v-for="(tab, index) of tabTitles" v-bind:key="index"
|
||||
:href="'#'+tab.name"
|
||||
class="justify-start"
|
||||
style="width: 200px;"
|
||||
>
|
||||
<v-icon left v-html="tab.icon"></v-icon>
|
||||
<span class="text-truncate">{{ tab.title }}</span>
|
||||
</v-tab>
|
||||
</v-tabs>
|
||||
</overlay-scrollbars>
|
||||
</v-col>
|
||||
<v-col :class="isMobile ? '' : 'pl-0'">
|
||||
<perfect-scrollbar :class="'settings-tabs '+(isMobile ? '' : 'height500')" ref="settingsScroll">
|
||||
<component :is="'settings-'+activeTab+'-tab'"></component>
|
||||
</perfect-scrollbar>
|
||||
<v-col :class="isMobile ? '' : 'pl-0'" :style="isMobile ? '' : 'min-width: 500px;'">
|
||||
<overlay-scrollbars :class="'settings-tabs '+(isMobile ? '' : 'height500')" ref="settingsScroll" :options="{ overflowBehavior: { x: 'hidden' } }">
|
||||
<component :is="'settings-'+activeTab+'-tab'" @scrollToTop="scrollToTop"></component>
|
||||
</overlay-scrollbars>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-card>
|
||||
</panel>
|
||||
</v-dialog>
|
||||
</div>
|
||||
</template>
|
||||
@@ -53,26 +51,35 @@
|
||||
import Component from 'vue-class-component'
|
||||
import {Mixins, Watch} from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import SettingsGeneralTab from "@/components/settings/SettingsGeneralTab.vue";
|
||||
import SettingsWebcamTab from "@/components/settings/SettingsWebcamTab.vue";
|
||||
import SettingsMacrosTab from "@/components/settings/SettingsMacrosTab.vue";
|
||||
import SettingsControlTab from "@/components/settings/SettingsControlTab.vue";
|
||||
import SettingsConsoleTab from "@/components/settings/SettingsConsoleTab.vue";
|
||||
import SettingsPresetsTab from "@/components/settings/SettingsPresetsTab.vue";
|
||||
import SettingsRemotePrintersTab from "@/components/settings/SettingsRemotePrintersTab.vue";
|
||||
import SettingsThemeTab from "@/components/settings/SettingsThemeTab.vue";
|
||||
import SettingsDashboardTab from "@/components/settings/SettingsDashboardTab.vue";
|
||||
import SettingsGeneralTab from '@/components/settings/SettingsGeneralTab.vue'
|
||||
import SettingsWebcamsTab from '@/components/settings/SettingsWebcamsTab.vue'
|
||||
import SettingsMacrosTab from '@/components/settings/SettingsMacrosTab.vue'
|
||||
import SettingsControlTab from '@/components/settings/SettingsControlTab.vue'
|
||||
import SettingsConsoleTab from '@/components/settings/SettingsConsoleTab.vue'
|
||||
import SettingsPresetsTab from '@/components/settings/SettingsPresetsTab.vue'
|
||||
import SettingsRemotePrintersTab from '@/components/settings/SettingsRemotePrintersTab.vue'
|
||||
import SettingsUiSettingsTab from '@/components/settings/SettingsUiSettingsTab.vue'
|
||||
import SettingsDashboardTab from '@/components/settings/SettingsDashboardTab.vue'
|
||||
import SettingsGCodeViewerTab from '@/components/settings/SettingsGCodeViewerTab.vue'
|
||||
import SettingsEditorTab from '@/components/settings/SettingsEditorTab.vue'
|
||||
import SettingsTimelapseTab from '@/components/settings/SettingsTimelapseTab.vue'
|
||||
|
||||
import Panel from '@/components/ui/Panel.vue'
|
||||
@Component({
|
||||
components: {
|
||||
SettingsThemeTab,
|
||||
Panel,
|
||||
SettingsUiSettingsTab,
|
||||
SettingsRemotePrintersTab,
|
||||
SettingsPresetsTab,
|
||||
SettingsConsoleTab,
|
||||
SettingsControlTab,
|
||||
SettingsMacrosTab,
|
||||
SettingsWebcamTab,
|
||||
SettingsWebcamsTab,
|
||||
SettingsGeneralTab,
|
||||
SettingsDashboardTab
|
||||
SettingsDashboardTab,
|
||||
SettingsGCodeViewerTab,
|
||||
SettingsEditorTab,
|
||||
SettingsTimelapseTab
|
||||
}
|
||||
})
|
||||
export default class TheSettingsMenu extends Mixins(BaseMixin) {
|
||||
@@ -84,7 +91,7 @@ export default class TheSettingsMenu extends Mixins(BaseMixin) {
|
||||
}
|
||||
|
||||
get tabTitles() {
|
||||
return [
|
||||
const tabs = [
|
||||
{
|
||||
icon: 'mdi-cog',
|
||||
name: 'general',
|
||||
@@ -92,8 +99,8 @@ export default class TheSettingsMenu extends Mixins(BaseMixin) {
|
||||
},
|
||||
{
|
||||
icon: 'mdi-palette',
|
||||
name: 'theme',
|
||||
title: this.$t('Settings.ThemeTab.Theme')
|
||||
name: 'ui-settings',
|
||||
title: this.$t('Settings.UiSettingsTab.UiSettings')
|
||||
},
|
||||
{
|
||||
icon: 'mdi-monitor-dashboard',
|
||||
@@ -102,8 +109,8 @@ export default class TheSettingsMenu extends Mixins(BaseMixin) {
|
||||
},
|
||||
{
|
||||
icon: 'mdi-webcam',
|
||||
name: 'webcam',
|
||||
title: this.$t('Settings.WebcamTab.Webcams')
|
||||
name: 'webcams',
|
||||
title: this.$t('Settings.WebcamsTab.Webcams')
|
||||
},
|
||||
{
|
||||
icon: 'mdi-code-tags',
|
||||
@@ -130,12 +137,50 @@ export default class TheSettingsMenu extends Mixins(BaseMixin) {
|
||||
name: 'remote-printers',
|
||||
title: this.$t('Settings.RemotePrintersTab.RemotePrinters')
|
||||
},
|
||||
{
|
||||
icon: 'mdi-video-3d',
|
||||
name: 'g-code-viewer',
|
||||
title: this.$t('Settings.GCodeViewerTab.GCodeViewer')
|
||||
},
|
||||
{
|
||||
icon: 'mdi-file-document-edit-outline',
|
||||
name: 'editor',
|
||||
title: this.$t('Settings.EditorTab.Editor')
|
||||
}
|
||||
]
|
||||
|
||||
if (this.moonrakerComponents.includes('timelapse')) {
|
||||
tabs.push({
|
||||
icon: 'mdi-timelapse',
|
||||
name: 'timelapse',
|
||||
title: this.$t('Settings.TimelapseTab.Timelapse')
|
||||
})
|
||||
}
|
||||
|
||||
return tabs.sort((a, b) => {
|
||||
if (a.name === 'general') return -1
|
||||
if (b.name === 'general') return 1
|
||||
|
||||
const stringA = a.title.toString().toLowerCase()
|
||||
const stringB = b.title.toString().toLowerCase()
|
||||
|
||||
if (stringA < stringB) return -1
|
||||
if (stringA > stringB) return 1
|
||||
|
||||
return 0
|
||||
})
|
||||
}
|
||||
|
||||
@Watch('activeTab')
|
||||
activeTabWatch() {
|
||||
if (this.$refs.settingsScroll) this.$refs.settingsScroll.$el.scrollTop = 0
|
||||
this.scrollToTop()
|
||||
}
|
||||
|
||||
scrollToTop() {
|
||||
if (this.$refs.settingsScroll) {
|
||||
const overlayscroll = this.$refs.settingsScroll.osInstance()
|
||||
overlayscroll?.scroll({ y: '0%' })
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -143,10 +188,22 @@ export default class TheSettingsMenu extends Mixins(BaseMixin) {
|
||||
<style scoped>
|
||||
.settings-tabs {
|
||||
height: auto;
|
||||
max-height: calc(100vh - 96px);
|
||||
max-height: calc(var(--app-height) - 96px);
|
||||
}
|
||||
|
||||
.settings-tabs-bar {
|
||||
border-right: 1px solid rgba(255, 255, 255, 0.12);
|
||||
}
|
||||
|
||||
.settings-tabs-bar.height500,
|
||||
.settings-tabs.height500 {
|
||||
max-height: 500px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style>
|
||||
.settings-tabs .v-select__selections input {
|
||||
width: 100px;
|
||||
}
|
||||
|
||||
</style>
|
||||
@@ -1,133 +1,125 @@
|
||||
<style>
|
||||
.sidebar-wrapper .v-navigation-drawer__content {
|
||||
padding-bottom: 3em;
|
||||
.nav-logo {
|
||||
height: 32px;
|
||||
}
|
||||
|
||||
#sidebarVersions {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
.small-list-item {
|
||||
height: var(--sidebar-menu-item-height);
|
||||
}
|
||||
|
||||
@media screen and (max-width: 1024px) {
|
||||
.sidebar-wrapper .v-navigation-drawer__content {
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
#sidebarVersions {
|
||||
display: none;
|
||||
}
|
||||
.no-text-decoration {
|
||||
text-decoration: none;
|
||||
background-color: transparent;
|
||||
}
|
||||
.no-background:before {
|
||||
background-color: rgba(255, 255, 255, 0) !important;
|
||||
}
|
||||
</style>
|
||||
<style scoped>
|
||||
.active-nav-item {
|
||||
border-right: 4px solid var(--v-primary-base);
|
||||
}
|
||||
.menu-item-icon {
|
||||
opacity: .85;
|
||||
}
|
||||
.menu-item-title {
|
||||
line-height: 30px;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
text-transform: uppercase;
|
||||
opacity: .85;
|
||||
}
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<v-navigation-drawer class="sidebar-wrapper" persistent v-model="naviDrawer" mobile-breakpoint="1280" enable-resize-watcher fixed app :src="sidebarBackground">
|
||||
<div id="nav-header">
|
||||
<template v-if="sidebarLogo">
|
||||
<img :src="sidebarLogo" style="height: 40px;" class="mr-3" alt="Logo" />
|
||||
</template>
|
||||
<template v-else>
|
||||
<mainsail-logo :color="logoColor" style="height: 40px;" class="mr-3"></mainsail-logo>
|
||||
</template>
|
||||
<v-toolbar-title>{{ printerName }}</v-toolbar-title>
|
||||
</div>
|
||||
<ul class="navi" :expand="$vuetify.breakpoint.mdAndUp">
|
||||
<the-sidebar-printer-menu></the-sidebar-printer-menu>
|
||||
<li v-for="(category, index) in naviPoints" :key="index" :prepend-icon="category.icon"
|
||||
:class="[category.path !== '/' && currentPage.includes(category.path) ? 'active' : '', 'nav-item']"
|
||||
:value="true"
|
||||
>
|
||||
<router-link
|
||||
style="position: relative;"
|
||||
slot="activator" class="nav-link" exact :to="category.path" @click.prevent
|
||||
v-if="showInNavi(category)">
|
||||
<v-icon>mdi-{{ category.icon }}</v-icon>
|
||||
<span class="nav-title">{{ $t(`Router.${category.title}`) }}</span>
|
||||
<v-icon class="nav-arrow" v-if="category.children && category.children.length > 0">mdi-chevron-down</v-icon>
|
||||
</router-link>
|
||||
<v-navigation-drawer v-model="naviDrawer" :src="sidebarBackground" :mini-variant="(navigationStyle === 'iconsOnly')" :key="navigationStyle" :width="navigationWidth" clipped app>
|
||||
<v-list class="pr-0 pt-0 ml-0">
|
||||
<v-list-item-group active-class="active-nav-item">
|
||||
<template v-if="countPrinters">
|
||||
<v-list-item
|
||||
router to="/allPrinters"
|
||||
class="small-list-item mt-1"
|
||||
>
|
||||
<v-list-item-icon class="my-3 mr-3 menu-item-icon">
|
||||
<v-icon>mdi-view-dashboard-outline</v-icon>
|
||||
</v-list-item-icon>
|
||||
<v-list-item-content>
|
||||
<v-list-item-title tile class="menu-item-title">{{ $t("App.Printers")}}</v-list-item-title>
|
||||
</v-list-item-content>
|
||||
|
||||
<ul class="child">
|
||||
<li v-for="(page, pageIndex) in category.children" class="nav-item" v-bind:key="`${index}-${pageIndex}`">
|
||||
<router-link :to="page.path" class="nav-link" @click.prevent v-if="klippy_state !== 'error' || page.alwaysShow">
|
||||
<v-icon>mdi-{{ page.icon }}</v-icon>
|
||||
<span class="nav-title">{{ $t(`Router.${page.title}`) }}</span>
|
||||
</router-link>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
<p id="sidebarVersions" class="mb-0 text-body-2 pl-3 pb-2">
|
||||
v{{ mainsailVersion }}
|
||||
<span class="" v-if="klipperVersion"><br />{{ klipperVersion }}</span>
|
||||
</p>
|
||||
</v-navigation-drawer>
|
||||
</v-list-item>
|
||||
<v-divider class="my-1"></v-divider>
|
||||
</template>
|
||||
<div v-for="(category, index) in naviPoints" :key="index">
|
||||
<v-list-item
|
||||
router :to="category.path"
|
||||
v-if="showInNavi(category)"
|
||||
class="small-list-item"
|
||||
>
|
||||
<v-list-item-icon class="my-3 mr-3 menu-item-icon">
|
||||
<v-icon>mdi-{{ category.icon }}</v-icon>
|
||||
</v-list-item-icon>
|
||||
<v-list-item-content>
|
||||
<v-list-item-title tile class="menu-item-title">{{ $t(`Router.${category.title}`) }}</v-list-item-title>
|
||||
</v-list-item-content>
|
||||
</v-list-item>
|
||||
</div>
|
||||
</v-list-item-group>
|
||||
</v-list>
|
||||
<template v-slot:append>
|
||||
<v-list-item class="small-list-item mb-2">
|
||||
<v-list-item-icon class="menu-item-icon">
|
||||
<about-modal></about-modal>
|
||||
</v-list-item-icon>
|
||||
</v-list-item>
|
||||
</template>
|
||||
</v-navigation-drawer>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import Component from "vue-class-component"
|
||||
import Component from 'vue-class-component'
|
||||
import routes, {AppRoute} from '@/routes'
|
||||
import {Mixins, Watch} from "vue-property-decorator";
|
||||
import BaseMixin from "@/components/mixins/base";
|
||||
import {PrinterStateKlipperConfig} from "@/store/printer/types";
|
||||
import TheSelectPrinterDialog from "@/components/TheSelectPrinterDialog.vue";
|
||||
import TheSidebarPrinterMenu from "@/components/TheSidebarPrinterMenu.vue";
|
||||
import MainsailLogo from "@/components/ui/MainsailLogo.vue";
|
||||
import {Mixins} from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import {PrinterStateKlipperConfig} from '@/store/printer/types'
|
||||
import TheSelectPrinterDialog from '@/components/TheSelectPrinterDialog.vue'
|
||||
import AboutModal from '@/components/modals/AboutModal.vue'
|
||||
import {navigationWidth} from '@/store/variables'
|
||||
|
||||
@Component({
|
||||
components: {
|
||||
MainsailLogo,
|
||||
TheSidebarPrinterMenu,
|
||||
TheSelectPrinterDialog
|
||||
|
||||
TheSelectPrinterDialog,
|
||||
AboutModal
|
||||
}
|
||||
})
|
||||
export default class TheSidebar extends Mixins(BaseMixin) {
|
||||
|
||||
export default class TheSidebarAlt extends Mixins(BaseMixin) {
|
||||
navigationWidth = navigationWidth
|
||||
|
||||
get naviDrawer(): boolean {
|
||||
return this.$store.state.naviDrawer
|
||||
}
|
||||
|
||||
set naviDrawer(newVal: boolean) {
|
||||
this.$store.dispatch("setNaviDrawer", newVal)
|
||||
this.$store.dispatch('setNaviDrawer', newVal)
|
||||
}
|
||||
|
||||
get logoColor(): string {
|
||||
return this.$store.state.gui.theme.logo
|
||||
}
|
||||
|
||||
get sidebarLogo(): string {
|
||||
return this.$store.getters["files/getSidebarLogo"]
|
||||
get navigationStyle() {
|
||||
return this.$store.state.gui.dashboard.navigationStyle
|
||||
}
|
||||
|
||||
get sidebarBackground(): string {
|
||||
return this.$store.getters["files/getSidebarBackground"]
|
||||
}
|
||||
|
||||
get mainsailVersion(): string {
|
||||
return this.$store.state.packageVersion
|
||||
}
|
||||
|
||||
get klipperVersion():string {
|
||||
return this.$store.state.printer?.software_version ?? ""
|
||||
return this.$store.getters['files/getSidebarBackground']
|
||||
}
|
||||
|
||||
get naviPoints(): AppRoute[] {
|
||||
return routes.filter((element) => element.showInNavi)
|
||||
}
|
||||
|
||||
get printerName():string {
|
||||
if (this.$store.state.gui.general.printername.length)
|
||||
return this.$store.state.gui.general.printername
|
||||
|
||||
return this.$store.state.printer.hostname
|
||||
}
|
||||
|
||||
get klippy_state(): string {
|
||||
return this.$store.state.server.klippy_state
|
||||
}
|
||||
|
||||
get boolNaviWebcam(): boolean {
|
||||
return this.$store.state.gui.webcam.boolNavi
|
||||
return this.$store.state.gui.webcamSettings.boolNavi
|
||||
}
|
||||
|
||||
get moonrakerComponents(): string[] {
|
||||
@@ -147,7 +139,11 @@ export default class TheSidebar extends Mixins(BaseMixin) {
|
||||
}
|
||||
|
||||
get isUpdateAvailable(): boolean {
|
||||
return this.$store.getters["server/updateManager/isUpdateAvailable"]
|
||||
return this.$store.getters['server/updateManager/isUpdateAvailable']
|
||||
}
|
||||
|
||||
get countPrinters() {
|
||||
return this.$store.getters['farm/countPrinters']
|
||||
}
|
||||
|
||||
showInNavi(route: AppRoute): boolean {
|
||||
|
||||
@@ -1,84 +0,0 @@
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<div v-if="displayMenuPoint">
|
||||
<li :class="currentPage === '/allPrinters' ? 'nav-item active' : 'nav-item '">
|
||||
<div
|
||||
class="nav-link "
|
||||
@click.prevent
|
||||
@click="switchToPrinters"
|
||||
role="button"
|
||||
>
|
||||
<v-icon>mdi-view-dashboard-outline</v-icon>
|
||||
<span class="nav-title">{{ $t("App.Printers")}}</span>
|
||||
|
||||
<v-menu bottom :offset-x="true">
|
||||
<template v-slot:activator="{ on, attrs }">
|
||||
<v-icon class="nav-arrow right" v-bind="attrs" v-on="on" >mdi-chevron-down</v-icon>
|
||||
</template>
|
||||
|
||||
<v-list dense>
|
||||
<v-list-item two-line v-for="printer in printers" v-bind:key="printer._namespace" @click="changePrinter(printer)" :disabled="!printer.socket.isConnected" link>
|
||||
<v-list-item-content>
|
||||
<v-list-item-title>{{ getPrinterName(printer._namespace) }}</v-list-item-title>
|
||||
<v-list-item-subtitle>{{ getPrinterDescription(printer)}}</v-list-item-subtitle>
|
||||
</v-list-item-content>
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
</v-menu>
|
||||
</div>
|
||||
<v-item-group class="v-btn-toggle mx-4 d-block row" name="printers" v-if="false">
|
||||
<v-btn class="col" color="primary" @click="switchToPrinters">{{ $t("App.Printers")}}</v-btn>
|
||||
</v-item-group>
|
||||
</li>
|
||||
<v-divider class="my-4"></v-divider>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
|
||||
import {Component, Mixins} from "vue-property-decorator";
|
||||
import BaseMixin from "./mixins/base";
|
||||
import router from "@/plugins/router";
|
||||
import {FarmPrinterState} from "@/store/farm/printer/types";
|
||||
|
||||
@Component
|
||||
export default class TheSidebarPrinterMenu extends Mixins(BaseMixin) {
|
||||
|
||||
get displayMenuPoint() {
|
||||
return (this.remoteMode && this.countPrinters > 1) || (!this.remoteMode && this.countPrinters)
|
||||
}
|
||||
|
||||
get printers() {
|
||||
return this.$store.getters["farm/getPrinters"]
|
||||
}
|
||||
|
||||
get countPrinters() {
|
||||
return this.$store.getters["farm/countPrinters"]
|
||||
}
|
||||
|
||||
get currentPage() {
|
||||
return this.$route.fullPath;
|
||||
}
|
||||
|
||||
switchToPrinters() {
|
||||
router.push("/allPrinters");
|
||||
}
|
||||
|
||||
getPrinterName(namespace: string) {
|
||||
return this.$store.getters["farm/"+namespace+"/getPrinterName"]
|
||||
}
|
||||
|
||||
getPrinterDescription(printer: FarmPrinterState) {
|
||||
return this.$store.getters["farm/"+printer._namespace+"/getStatus"]
|
||||
}
|
||||
|
||||
changePrinter(printer: FarmPrinterState) {
|
||||
if (printer.socket.isConnected) {
|
||||
this.$store.dispatch('changePrinter', { printer: printer._namespace })
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -3,14 +3,14 @@
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<v-menu bottom left :offset-y="true" :close-on-content-click="false" v-model="showMenu" v-if="throttledStateFlags.length">
|
||||
<v-menu bottom :offset-y="true" :close-on-content-click="false" v-model="showMenu" v-if="throttledStateFlags.length">
|
||||
<template v-slot:activator="{ on, attrs }">
|
||||
<v-btn :color="currentFlags.length ? 'error' : 'warning'" icon class="mr-3" v-bind="attrs" v-on="on">
|
||||
<v-btn :color="currentFlags.length ? 'error' : 'warning'" icon tile class="mr-3" v-bind="attrs" v-on="on">
|
||||
<v-icon>mdi-raspberry-pi</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
|
||||
<v-list width="300">
|
||||
<v-list min-width="300" max-width="600">
|
||||
<template v-if="currentFlags.length">
|
||||
<v-subheader class="" style="height: auto;">{{ $t("App.ThrottledStates.HeadlineCurrentFlags") }}</v-subheader>
|
||||
<v-list-item v-for="(flag) in currentFlags" :key="flag" two-line>
|
||||
@@ -37,8 +37,8 @@
|
||||
<script lang="ts">
|
||||
|
||||
|
||||
import {Component, Mixins} from "vue-property-decorator";
|
||||
import BaseMixin from "./mixins/base";
|
||||
import {Component, Mixins} from 'vue-property-decorator'
|
||||
import BaseMixin from './mixins/base'
|
||||
|
||||
@Component
|
||||
export default class TheThrottledStates extends Mixins(BaseMixin) {
|
||||
@@ -46,7 +46,7 @@ export default class TheThrottledStates extends Mixins(BaseMixin) {
|
||||
|
||||
get throttledStateFlags() {
|
||||
return this.$store.state.server.throttled_state.flags.filter((flag: string) => {
|
||||
return flag !== "?"
|
||||
return flag !== '?'
|
||||
})
|
||||
|
||||
/*return [
|
||||
@@ -63,18 +63,18 @@ export default class TheThrottledStates extends Mixins(BaseMixin) {
|
||||
|
||||
get currentFlags() {
|
||||
return this.throttledStateFlags.filter((flag: string) => {
|
||||
return !flag.startsWith("Previously ")
|
||||
return !flag.startsWith('Previously ')
|
||||
})
|
||||
}
|
||||
|
||||
get previouslyFlags() {
|
||||
return this.throttledStateFlags.filter((flag: string) => {
|
||||
return flag.startsWith("Previously ")
|
||||
return flag.startsWith('Previously ')
|
||||
})
|
||||
}
|
||||
|
||||
convertName(flag: string): string {
|
||||
flag = flag.replace(/ /g, "").replace(/-/g, "")
|
||||
flag = flag.replace(/ /g, '').replace(/-/g, '')
|
||||
flag = flag.charAt(0).toUpperCase() + flag.slice(1)
|
||||
|
||||
return flag
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<v-snackbar v-model="boolShowDialogRunning" :timeout="-1" :value="true" fixed right bottom dark>
|
||||
<div>
|
||||
{{ $t('Timelapse.TimelapseRendering') }}...
|
||||
</div>
|
||||
<v-progress-linear class="mt-2" v-if="progress > 0" :value="progress" indeterminate></v-progress-linear>
|
||||
<v-progress-linear class="mt-2" v-if="progress === 0" indeterminate></v-progress-linear>
|
||||
</v-snackbar>
|
||||
<v-snackbar v-model="boolShowDialogSuccess" :timeout="5000" :value="true" fixed right bottom dark>
|
||||
<div>
|
||||
{{ $t('Timelapse.TimelapseRenderingSuccessful') }}<br />
|
||||
<strong>{{ filename }}</strong>
|
||||
</div>
|
||||
</v-snackbar>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import Component from 'vue-class-component'
|
||||
import {Mixins} from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
|
||||
@Component({
|
||||
components: {
|
||||
}
|
||||
})
|
||||
export default class TheTimelapseRenderingSnackbar extends Mixins(BaseMixin) {
|
||||
|
||||
get boolShowDialogRunning() {
|
||||
return (this.status === 'running')
|
||||
}
|
||||
|
||||
get boolShowDialogSuccess() {
|
||||
return (this.status === 'success')
|
||||
}
|
||||
|
||||
set boolShowDialogSuccess(newVal) {
|
||||
if (!newVal) this.$store.dispatch('server/timelapse/resetSnackbar')
|
||||
}
|
||||
|
||||
get status() {
|
||||
return this.$store.state.server.timelapse.rendering.status ?? ''
|
||||
}
|
||||
|
||||
get progress() {
|
||||
return this.$store.state.server.timelapse.rendering.progress ?? ''
|
||||
}
|
||||
|
||||
get filename() {
|
||||
return this.$store.state.server.timelapse.rendering.filename ?? ''
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -5,46 +5,86 @@
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<v-menu bottom left :offset-y="true" :close-on-content-click="false" v-model="showMenu">
|
||||
<template v-slot:activator="{ on, attrs }">
|
||||
<v-btn color="grey darken-3" v-bind="attrs" v-on="on" class="ml-5 minwidth-0 px-2">
|
||||
<v-icon>mdi-power-standby</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<v-list dense>
|
||||
<v-subheader class="" style="height: auto;">{{ $t("App.TopCornerMenu.KlipperControl") }}</v-subheader>
|
||||
<v-list-item class="minheight30" link @click="klipperRestart()">
|
||||
<v-list-item-title><v-icon class="mr-2" small>mdi-restart</v-icon>{{ $t("App.TopCornerMenu.KlipperRestart") }}</v-list-item-title>
|
||||
</v-list-item>
|
||||
<v-list-item class="minheight30" link @click="klipperFirmwareRestart()">
|
||||
<v-list-item-title><v-icon class="mr-2" small>mdi-restart</v-icon>{{ $t("App.TopCornerMenu.KlipperFirmwareRestart") }}</v-list-item-title>
|
||||
</v-list-item>
|
||||
<template v-if="services.length">
|
||||
<v-divider class="mt-0"></v-divider>
|
||||
<v-subheader class="pt-2" style="height: auto;">{{ $t("App.TopCornerMenu.RestartServices") }}</v-subheader>
|
||||
<v-list-item class="minheight30" link @click="serviceRestart(service)" v-for="service in services" v-bind:key="service">
|
||||
<v-list-item-title><v-icon class="mr-2" small>mdi-restart</v-icon>{{ service.charAt(0).toUpperCase() + service.slice(1) }}</v-list-item-title>
|
||||
</v-list-item>
|
||||
<div>
|
||||
<v-menu bottom left :offset-y="true" :close-on-content-click="false" v-model="showMenu">
|
||||
<template v-slot:activator="{ on, attrs }">
|
||||
<v-btn icon tile v-bind="attrs" v-on="on">
|
||||
<v-icon>mdi-power-standby</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<template v-if="powerDevices.length">
|
||||
<v-list dense>
|
||||
<template v-if="klipperState !== 'disconnected'">
|
||||
<v-subheader class="" style="height: auto;">{{ $t("App.TopCornerMenu.KlipperControl") }}</v-subheader>
|
||||
<v-list-item class="minheight30 pr-2" link @click="klipperRestart()">
|
||||
<v-list-item-title>{{ $t("App.TopCornerMenu.KlipperRestart") }}</v-list-item-title>
|
||||
<v-list-item-action class="my-0 d-flex flex-row" style="min-width: auto;">
|
||||
<v-icon class="mr-2" small>mdi-restart</v-icon>
|
||||
</v-list-item-action>
|
||||
</v-list-item>
|
||||
<v-list-item class="minheight30 pr-2" link @click="klipperFirmwareRestart()">
|
||||
<v-list-item-title>{{ $t("App.TopCornerMenu.KlipperFirmwareRestart") }}</v-list-item-title>
|
||||
<v-list-item-action class="my-0 d-flex flex-row" style="min-width: auto;">
|
||||
<v-icon class="mr-2" small>mdi-restart</v-icon>
|
||||
</v-list-item-action>
|
||||
</v-list-item>
|
||||
</template>
|
||||
<template v-if="services.length">
|
||||
<v-divider class="mt-0" v-if="klipperState !== 'disconnected'"></v-divider>
|
||||
<v-subheader class="pt-2" style="height: auto;">{{ $t("App.TopCornerMenu.ServiceControl") }}</v-subheader>
|
||||
<v-list-item class="minheight30 pr-2" v-for="service in services" v-bind:key="service">
|
||||
<v-list-item-title>
|
||||
<v-tooltip left>
|
||||
<template v-slot:activator="{ on, attrs }">
|
||||
<span v-bind="attrs" v-on="on">{{ service.charAt(0).toUpperCase() + service.slice(1) }}</span>
|
||||
</template>
|
||||
<span>{{ getServiceState(service) }} ({{ getServiceSubState(service) }})</span>
|
||||
</v-tooltip>
|
||||
</v-list-item-title>
|
||||
<v-list-item-action class="my-0 d-flex flex-row" style="min-width: auto;">
|
||||
<v-btn icon small v-if="getServiceState(service) === 'inactive'" @click="serviceStart(service)"><v-icon small>mdi-play</v-icon></v-btn>
|
||||
<v-btn icon small v-else @click="serviceRestart(service)"><v-icon small>mdi-restart</v-icon></v-btn>
|
||||
<v-btn icon small :disabled="getServiceState(service) === 'inactive'" @click="serviceStop(service)"><v-icon small>mdi-stop</v-icon></v-btn>
|
||||
</v-list-item-action>
|
||||
</v-list-item>
|
||||
</template>
|
||||
<template v-if="powerDevices.length">
|
||||
<v-divider class="mt-0"></v-divider>
|
||||
<v-subheader class="pt-2" style="height: auto;">{{ $t("App.TopCornerMenu.PowerDevices") }}</v-subheader>
|
||||
<v-list-item v-for="(device, index) in powerDevices" v-bind:key="index" class="minheight30 pr-2" @click="changeSwitch(device, device.status)" :disabled="(device.status === 'error' || device.locked_while_printing && ['printing', 'paused'].includes(printer_state))">
|
||||
<v-list-item-title>{{ device.device }}</v-list-item-title>
|
||||
<v-list-item-action class="my-0 d-flex flex-row" style="min-width: auto;">
|
||||
<v-icon class="mr-2" :color="device.status === 'on' ? '' : 'grey darken-2'">mdi-{{ device.status === 'on' ? 'toggle-switch' : 'toggle-switch-off' }}</v-icon>
|
||||
</v-list-item-action>
|
||||
</v-list-item>
|
||||
</template>
|
||||
<v-divider class="mt-0"></v-divider>
|
||||
<v-subheader class="pt-2" style="height: auto;">{{ $t("App.TopCornerMenu.PowerDevices") }}</v-subheader>
|
||||
<v-list-item v-for="(device, index) in powerDevices" v-bind:key="index" class="minheight30" @click="changeSwitch(device, device.status)" :disabled="(device.status === 'error' || device.locked_while_printing && ['printing', 'paused'].includes(printer_state))">
|
||||
<v-list-item-title>
|
||||
<v-icon class="mr-2" :color="device.status === 'on' ? '' : 'grey darken-2'">mdi-{{ device.status === 'on' ? 'toggle-switch' : 'toggle-switch-off' }}</v-icon>{{ device.device }}
|
||||
</v-list-item-title>
|
||||
<v-subheader class="pt-2" style="height: auto;">{{ $t("App.TopCornerMenu.HostControl") }}</v-subheader>
|
||||
<v-list-item class="minheight30 pr-2" link @click="hostReboot()">
|
||||
<v-list-item-title>{{ $t("App.TopCornerMenu.Reboot") }}</v-list-item-title>
|
||||
<v-list-item-action class="my-0 d-flex flex-row" style="min-width: auto;">
|
||||
<v-icon class="mr-2" small>mdi-power</v-icon>
|
||||
</v-list-item-action>
|
||||
</v-list-item>
|
||||
</template>
|
||||
<v-divider class="mt-0"></v-divider>
|
||||
<v-subheader class="pt-2" style="height: auto;">{{ $t("App.TopCornerMenu.HostControl") }}</v-subheader>
|
||||
<v-list-item class="minheight30" link @click="hostReboot()">
|
||||
<v-list-item-title><v-icon class="mr-2" small>mdi-power</v-icon>{{ $t("App.TopCornerMenu.Reboot") }}</v-list-item-title>
|
||||
</v-list-item>
|
||||
<v-list-item class="minheight30" link @click="hostShutdown()">
|
||||
<v-list-item-title><v-icon class="mr-2" small>mdi-power</v-icon>{{ $t("App.TopCornerMenu.Shutdown") }}</v-list-item-title>
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
</v-menu>
|
||||
<v-list-item class="minheight30 pr-2" link @click="hostShutdown()">
|
||||
<v-list-item-title>{{ $t("App.TopCornerMenu.Shutdown") }}</v-list-item-title>
|
||||
<v-list-item-action class="my-0 d-flex flex-row" style="min-width: auto;">
|
||||
<v-icon class="mr-2" small>mdi-power</v-icon>
|
||||
</v-list-item-action>
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
</v-menu>
|
||||
<v-dialog v-model="dialogPowerDeviceChange.show" width="400" :fullscreen="isMobile">
|
||||
<v-card>
|
||||
<v-card-title class="headline">{{ $t(this.dialogPowerDeviceChange.value === 'off' ? 'PowerDeviceChangeDialog.TurnDeviceOn' : 'PowerDeviceChangeDialog.TurnDeviceOff', {'device': dialogPowerDeviceChange.device}) }}</v-card-title>
|
||||
<v-card-text>{{ $t('PowerDeviceChangeDialog.AreYouSure') }}</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn color="red darken-1" text @click="dialogPowerDeviceChange.show = false">{{ $t('PowerDeviceChangeDialog.No')}}</v-btn>
|
||||
<v-btn color="green darken-1" text @click="powerDeviceToggle">{{$t('PowerDeviceChangeDialog.Yes')}}</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
@@ -52,32 +92,65 @@
|
||||
import Component from 'vue-class-component'
|
||||
import { Mixins } from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import {ServerPowerStateDevice} from "@/store/server/power/types";
|
||||
import {ServerPowerStateDevice} from '@/store/server/power/types'
|
||||
|
||||
interface dialogPowerDeviceChange {
|
||||
show: boolean
|
||||
device: string
|
||||
value: string
|
||||
}
|
||||
|
||||
@Component
|
||||
export default class TheTopCornerMenu extends Mixins(BaseMixin) {
|
||||
|
||||
showMenu = false
|
||||
dialogPowerDeviceChange : dialogPowerDeviceChange = {
|
||||
show: false,
|
||||
device: '',
|
||||
value: ''
|
||||
}
|
||||
|
||||
get services() {
|
||||
const services = this.$store.state.server.system_info.available_services?.filter((name: string) => name !== 'klipper_mcu') ?? []
|
||||
const services = this.$store.state.server.system_info?.available_services?.filter((name: string) => name !== 'klipper_mcu') ?? []
|
||||
services.sort()
|
||||
return services
|
||||
}
|
||||
|
||||
get powerDevices() {
|
||||
return this.$store.getters["server/power/getDevices"]
|
||||
return this.$store.getters['server/power/getDevices']
|
||||
}
|
||||
|
||||
get service_states() {
|
||||
return this.$store.state.server.system_info?.service_state ?? {}
|
||||
}
|
||||
|
||||
getServiceState(name: string) {
|
||||
if (name in this.service_states) return this.service_states[name].active_state
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
getServiceSubState(name: string) {
|
||||
if (name in this.service_states) return this.service_states[name].sub_state
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
klipperRestart() {
|
||||
this.showMenu = false
|
||||
this.$store.dispatch('server/addEvent', { message: "RESTART", type: 'command' })
|
||||
this.$socket.emit('printer.gcode.script', { script: "RESTART" })
|
||||
this.$store.dispatch('server/addEvent', { message: 'RESTART', type: 'command' })
|
||||
this.$socket.emit('printer.gcode.script', { script: 'RESTART' })
|
||||
}
|
||||
|
||||
klipperFirmwareRestart() {
|
||||
this.showMenu = false
|
||||
this.$store.dispatch('server/addEvent', { message: "FIRMWARE_RESTART", type: 'command' })
|
||||
this.$socket.emit('printer.gcode.script', { script: "FIRMWARE_RESTART" })
|
||||
this.$store.dispatch('server/addEvent', { message: 'FIRMWARE_RESTART', type: 'command' })
|
||||
this.$socket.emit('printer.gcode.script', { script: 'FIRMWARE_RESTART' })
|
||||
}
|
||||
|
||||
serviceStart(service: string) {
|
||||
this.showMenu = false
|
||||
this.$socket.emit('machine.services.start', { service: service })
|
||||
}
|
||||
|
||||
serviceRestart(service: string) {
|
||||
@@ -85,9 +158,28 @@ export default class TheTopCornerMenu extends Mixins(BaseMixin) {
|
||||
this.$socket.emit('machine.services.restart', { service: service })
|
||||
}
|
||||
|
||||
serviceStop(service: string) {
|
||||
this.showMenu = false
|
||||
this.$socket.emit('machine.services.stop', { service: service })
|
||||
}
|
||||
|
||||
changeSwitch(device: ServerPowerStateDevice, value: string) {
|
||||
const rpc = (value === 'off' ? "machine.device_power.on" : "machine.device_power.off")
|
||||
this.$socket.emit(rpc,{ [device.device]: null },{ action: "server/power/responseToggle" })
|
||||
this.dialogPowerDeviceChange.device = device.device
|
||||
this.dialogPowerDeviceChange.value = value
|
||||
|
||||
const confirmOnPowerDeviceChange = this.$store.state.gui.general.confirmOnPowerDeviceChange
|
||||
if (confirmOnPowerDeviceChange) {
|
||||
this.dialogPowerDeviceChange.show = true
|
||||
}
|
||||
else {
|
||||
this.powerDeviceToggle()
|
||||
}
|
||||
}
|
||||
|
||||
powerDeviceToggle() {
|
||||
this.dialogPowerDeviceChange.show = false
|
||||
const rpc = (this.dialogPowerDeviceChange.value === 'off' ? 'machine.device_power.on' : 'machine.device_power.off')
|
||||
this.$socket.emit(rpc,{ [this.dialogPowerDeviceChange.device]: null },{ action: 'server/power/responseToggle' })
|
||||
}
|
||||
|
||||
hostReboot() {
|
||||
|
||||
@@ -1,40 +1,69 @@
|
||||
<style>
|
||||
.topbar .v-toolbar__content {
|
||||
padding-top: 0 !important;
|
||||
padding-bottom: 0 !important;
|
||||
}
|
||||
</style>
|
||||
<style scoped>
|
||||
.button-min-width-auto {
|
||||
min-width: auto !important;
|
||||
}
|
||||
.topbar .v-btn {
|
||||
height: 100% !important;
|
||||
max-height: none;
|
||||
}
|
||||
.topbar .v-btn.v-btn--icon {
|
||||
width: var(--topbar-icon-btn-width) !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<v-app-bar app elevate-on-scroll>
|
||||
<v-app-bar-nav-icon @click.stop="naviDrawer = !naviDrawer"></v-app-bar-nav-icon>
|
||||
<v-app-bar app elevate-on-scroll :height="topbarHeight" class="topbar pa-0" clipped-left>
|
||||
<v-app-bar-nav-icon tile @click.stop="naviDrawer = !naviDrawer"></v-app-bar-nav-icon>
|
||||
<router-link to="/">
|
||||
<template v-if="sidebarLogo">
|
||||
<img :src="sidebarLogo" style="height: 32px;" class="nav-logo ml-4 mr-1 d-none d-sm-flex" alt="Logo" />
|
||||
</template>
|
||||
<template v-else>
|
||||
<mainsail-logo :color="logoColor" style="height: 32px;" class="nav-logo ml-4 mr-1 d-none d-sm-flex" router to="/" :ripple="false"></mainsail-logo>
|
||||
</template>
|
||||
</router-link>
|
||||
<v-toolbar-title class="text-no-wrap ml-0 pl-2 mr-2">{{ printerName }}</v-toolbar-title>
|
||||
<printer-selector v-if="countPrinters"></printer-selector>
|
||||
<v-spacer></v-spacer>
|
||||
<the-throttled-states></the-throttled-states>
|
||||
<input type="file" ref="fileUploadAndStart" :accept="validGcodeExtensions.join(', ')" style="display: none" @change="uploadAndStart" />
|
||||
<v-btn
|
||||
<v-btn tile
|
||||
:icon="$vuetify.breakpoint.smAndDown"
|
||||
:text="$vuetify.breakpoint.mdAndUp"
|
||||
color="primary"
|
||||
class="mr-5 button-min-width-auto px-3 d-none d-sm-flex"
|
||||
class="button-min-width-auto px-3 d-none d-sm-flex save-config-button"
|
||||
v-if="klippyIsConnected && saveConfigPending"
|
||||
:disabled="printerIsPrinting"
|
||||
:loading="loadings.includes('topbarSaveConfig')"
|
||||
@click="saveConfig">
|
||||
<v-icon class="d-md-none">mdi-content-save</v-icon><span class="d-none d-md-inline">{{ $t("App.TopBar.SAVE_CONFIG") }}</span>
|
||||
</v-btn>
|
||||
<v-btn
|
||||
<v-btn tile
|
||||
:icon="$vuetify.breakpoint.smAndDown"
|
||||
:text="$vuetify.breakpoint.mdAndUp"
|
||||
color="primary"
|
||||
class="mr-5 button-min-width-auto px-3 d-none d-sm-flex"
|
||||
v-if="klippyIsConnected && ['standby', 'complete', 'cancelled'].includes(printer_state)"
|
||||
class="button-min-width-auto px-3 d-none d-sm-flex upload-and-start-button"
|
||||
v-if="klippyIsConnected && ['standby', 'complete', 'cancelled'].includes(printer_state) && !boolHideUploadAndPrintButton"
|
||||
:loading="loadings.includes('btnUploadAndStart')"
|
||||
@click="btnUploadAndStart">
|
||||
<v-icon class="mr-md-2">mdi-file-upload</v-icon><span class="d-none d-md-inline">{{ $t("App.TopBar.UploadPrint") }}</span>
|
||||
</v-btn>
|
||||
<v-btn
|
||||
<v-btn tile
|
||||
:icon="$vuetify.breakpoint.smAndDown"
|
||||
:text="$vuetify.breakpoint.mdAndUp"
|
||||
color="error"
|
||||
class="button-min-width-auto px-3"
|
||||
class="button-min-width-auto px-3 emergency-button"
|
||||
v-if="klippyIsConnected"
|
||||
:loading="loadings.includes('topbarEmergencyStop')"
|
||||
@click="emergencyStop">
|
||||
<v-icon class="mr-md-2">mdi-alert-circle-outline</v-icon><span class="d-none d-md-flex">{{ $t("App.TopBar.EmergencyStop") }}</span>
|
||||
@click="btnEmergencyStop">
|
||||
<v-icon class="mr-md-2">mdi-alert-circle-outline</v-icon><span class="d-none d-md-inline">{{ $t("App.TopBar.EmergencyStop") }}</span>
|
||||
</v-btn>
|
||||
<the-settings-menu></the-settings-menu>
|
||||
<the-top-corner-menu></the-top-corner-menu>
|
||||
@@ -63,19 +92,36 @@
|
||||
</v-btn>
|
||||
</template>
|
||||
</v-snackbar>
|
||||
<v-dialog v-model="showEmergencyStopDialog" width="400" :fullscreen="isMobile">
|
||||
<panel :title="$t('EmergencyStopDialog.EmergencyStop')" toolbar-color="error" card-class="emergency-stop-dialog" icon="mdi-alert-circle-outline" :margin-bottom="false">
|
||||
<template v-slot:buttons>
|
||||
<v-btn icon tile @click="showEmergencyStopDialog = false"><v-icon>mdi-close-thick</v-icon></v-btn>
|
||||
</template>
|
||||
<v-card-text>{{ $t('EmergencyStopDialog.AreYouSure') }}</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn text @click="showEmergencyStopDialog = false">{{ $t('EmergencyStopDialog.No')}}</v-btn>
|
||||
<v-btn color="primary" text @click="emergencyStop">{{$t('EmergencyStopDialog.Yes')}}</v-btn>
|
||||
</v-card-actions>
|
||||
</panel>
|
||||
</v-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import {Mixins} from "vue-property-decorator";
|
||||
import BaseMixin from "@/components/mixins/base"
|
||||
import {validGcodeExtensions} from "@/store/variables"
|
||||
import Component from "vue-class-component";
|
||||
import axios from "axios"
|
||||
import {Mixins} from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import {validGcodeExtensions} from '@/store/variables'
|
||||
import Component from 'vue-class-component'
|
||||
import axios from 'axios'
|
||||
import { formatFilesize } from '@/plugins/helpers'
|
||||
import TheTopCornerMenu from "@/components/TheTopCornerMenu.vue";
|
||||
import TheSettingsMenu from "@/components/TheSettingsMenu.vue";
|
||||
import TheThrottledStates from "@/components/TheThrottledStates.vue";
|
||||
import TheTopCornerMenu from '@/components/TheTopCornerMenu.vue'
|
||||
import TheSettingsMenu from '@/components/TheSettingsMenu.vue'
|
||||
import TheThrottledStates from '@/components/TheThrottledStates.vue'
|
||||
import Panel from '@/components/ui/Panel.vue'
|
||||
import PrinterSelector from '@/components/ui/PrinterSelector.vue'
|
||||
import MainsailLogo from '@/components/ui/MainsailLogo.vue'
|
||||
import {topbarHeight} from '@/store/variables'
|
||||
|
||||
type uploadSnackbar = {
|
||||
status: boolean
|
||||
@@ -92,15 +138,22 @@ type uploadSnackbar = {
|
||||
|
||||
@Component({
|
||||
components: {
|
||||
Panel,
|
||||
TheThrottledStates,
|
||||
TheSettingsMenu,
|
||||
TheTopCornerMenu
|
||||
TheTopCornerMenu,
|
||||
PrinterSelector,
|
||||
MainsailLogo
|
||||
}
|
||||
})
|
||||
export default class TheTopbar extends Mixins(BaseMixin) {
|
||||
topbarHeight = topbarHeight
|
||||
|
||||
showEmergencyStopDialog = false
|
||||
|
||||
uploadSnackbar: uploadSnackbar = {
|
||||
status: false,
|
||||
filename: "",
|
||||
filename: '',
|
||||
percent: 0,
|
||||
speed: 0,
|
||||
total: 0,
|
||||
@@ -122,7 +175,7 @@ export default class TheTopbar extends Mixins(BaseMixin) {
|
||||
}
|
||||
|
||||
set naviDrawer(newVal) {
|
||||
this.$store.dispatch("setNaviDrawer", newVal)
|
||||
this.$store.dispatch('setNaviDrawer', newVal)
|
||||
}
|
||||
|
||||
get validGcodeExtensions() {
|
||||
@@ -137,13 +190,51 @@ export default class TheTopbar extends Mixins(BaseMixin) {
|
||||
return this.$store.state.printer.configfile?.save_config_pending ?? false
|
||||
}
|
||||
|
||||
get printerName():string {
|
||||
if (this.$store.state.gui.general.printername.length)
|
||||
return this.$store.state.gui.general.printername
|
||||
|
||||
return this.$store.state.printer.hostname
|
||||
}
|
||||
|
||||
get boolWideNavDrawer() {
|
||||
return this.$store.state.gui.dashboard.boolWideNavDrawer ?? false
|
||||
}
|
||||
|
||||
get countPrinters() {
|
||||
return this.$store.getters['farm/countPrinters']
|
||||
}
|
||||
|
||||
get boolHideUploadAndPrintButton() {
|
||||
return this.$store.state.gui.dashboard.boolHideUploadAndPrintButton ?? false
|
||||
}
|
||||
|
||||
get sidebarLogo(): string {
|
||||
return this.$store.getters['files/getSidebarLogo']
|
||||
}
|
||||
|
||||
get logoColor(): string {
|
||||
return this.$store.state.gui.theme.logo
|
||||
}
|
||||
|
||||
btnEmergencyStop() {
|
||||
const confirmOnEmergencyStop = this.$store.state.gui.general.confirmOnEmergencyStop
|
||||
if (confirmOnEmergencyStop) {
|
||||
this.showEmergencyStopDialog = true
|
||||
}
|
||||
else {
|
||||
this.emergencyStop()
|
||||
}
|
||||
}
|
||||
|
||||
emergencyStop() {
|
||||
this.showEmergencyStopDialog = false
|
||||
this.$socket.emit('printer.emergency_stop', {}, { loading: 'topbarEmergencyStop' })
|
||||
}
|
||||
|
||||
saveConfig() {
|
||||
this.$store.dispatch('server/addEvent', { message: "SAVE_CONFIG", type: "command" });
|
||||
this.$socket.emit('printer.gcode.script', { script: "SAVE_CONFIG" }, { loading: 'topbarSaveConfig' });
|
||||
this.$store.dispatch('server/addEvent', { message: 'SAVE_CONFIG', type: 'command' })
|
||||
this.$socket.emit('printer.gcode.script', { script: 'SAVE_CONFIG' }, { loading: 'topbarSaveConfig' })
|
||||
}
|
||||
|
||||
btnUploadAndStart() {
|
||||
@@ -161,18 +252,18 @@ export default class TheTopbar extends Mixins(BaseMixin) {
|
||||
|
||||
this.$store.dispatch('socket/removeLoading', { name: 'btnUploadAndStart' })
|
||||
for(const file of successFiles) {
|
||||
const text = this.$t("App.TopBar.UploadOfFileSuccessful", {file:file}).toString()
|
||||
const text = this.$t('App.TopBar.UploadOfFileSuccessful', {file:file}).toString()
|
||||
this.$toast.success(text)
|
||||
}
|
||||
|
||||
this.$refs.fileUploadAndStart.value = ''
|
||||
if (this.currentPage !== "/") await this.$router.push("/");
|
||||
if (this.currentPage !== '/') await this.$router.push('/')
|
||||
}
|
||||
}
|
||||
|
||||
doUploadAndStart(file: File) {
|
||||
const formData = new FormData()
|
||||
const filename = file.name.replace(" ", "_")
|
||||
const filename = file.name
|
||||
|
||||
this.uploadSnackbar.filename = filename
|
||||
this.uploadSnackbar.status = true
|
||||
@@ -182,7 +273,7 @@ export default class TheTopbar extends Mixins(BaseMixin) {
|
||||
this.uploadSnackbar.lastProgress.time = 0
|
||||
|
||||
formData.append('file', file, filename)
|
||||
formData.append('print', "true")
|
||||
formData.append('print', 'true')
|
||||
|
||||
return new Promise(resolve => {
|
||||
this.uploadSnackbar.cancelTokenSource = axios.CancelToken.source()
|
||||
@@ -210,7 +301,7 @@ export default class TheTopbar extends Mixins(BaseMixin) {
|
||||
}).catch(() => {
|
||||
this.uploadSnackbar.status = false
|
||||
this.$store.dispatch('socket/removeLoading', { name: 'btnUploadAndStart' })
|
||||
const text = this.$t("App.TopBar.CannotUploadTheFile").toString()
|
||||
const text = this.$t('App.TopBar.CannotUploadTheFile').toString()
|
||||
this.$toast.error(text)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
<v-card-text class="px-3">
|
||||
<v-row>
|
||||
<v-col class="py-6 px-0">
|
||||
<perfect-scrollbar class="updaterLogScroll" :options="{ suppressScrollX: true }" ref="updaterLogScroll">
|
||||
<overlay-scrollbars class="updaterLogScroll" ref="updaterLogScroll">
|
||||
<v-data-table
|
||||
:headers="headers"
|
||||
:items="messages"
|
||||
@@ -76,12 +76,12 @@
|
||||
</tr>
|
||||
</template>
|
||||
</v-data-table>
|
||||
</perfect-scrollbar>
|
||||
</overlay-scrollbars>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
<v-col class="text-center pt-5">
|
||||
<v-btn @click="close" :disabled="!complete" color="primary">{{ $t("App.UpdateDialog.Close")}}</v-btn>
|
||||
<v-btn text @click="close" :disabled="!complete" color="primary">{{ $t("App.UpdateDialog.Close")}}</v-btn>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-card-text>
|
||||
@@ -119,7 +119,7 @@ export default class TheUpdateDialog extends Mixins(BaseMixin) {
|
||||
]
|
||||
|
||||
get application() {
|
||||
return this.$store.state.server.updateManager.updateResponse.application ?? ""
|
||||
return this.$store.state.server.updateManager.updateResponse.application ?? ''
|
||||
}
|
||||
|
||||
get messages() {
|
||||
@@ -147,15 +147,15 @@ export default class TheUpdateDialog extends Mixins(BaseMixin) {
|
||||
}
|
||||
|
||||
formatTime(date: Date) {
|
||||
const hours = (date.getHours() < 10) ? "0"+date.getHours().toString() : date.getHours()
|
||||
const minutes = (date.getMinutes() < 10) ? "0"+date.getMinutes().toString() : date.getMinutes()
|
||||
const seconds = (date.getSeconds() < 10) ? "0"+date.getSeconds().toString() : date.getSeconds()
|
||||
const hours = (date.getHours() < 10) ? '0'+date.getHours().toString() : date.getHours()
|
||||
const minutes = (date.getMinutes() < 10) ? '0'+date.getMinutes().toString() : date.getMinutes()
|
||||
const seconds = (date.getSeconds() < 10) ? '0'+date.getSeconds().toString() : date.getSeconds()
|
||||
|
||||
return hours+":"+minutes+":"+seconds;
|
||||
return hours+':'+minutes+':'+seconds
|
||||
}
|
||||
|
||||
close() {
|
||||
if (this.application !== null && this.complete && ["client", "mainsail"].includes(this.application.toLowerCase())) window.location.reload(true)
|
||||
if (this.application !== null && this.complete && ['client', 'mainsail', 'full'].includes(this.application.toLowerCase())) window.location.reload(true)
|
||||
else {
|
||||
this.$store.commit('server/updateManager/resetUpdateResponse')
|
||||
this.$socket.emit('machine.update.status', { refresh: false }, { action: 'server/updateManager/getStatus' })
|
||||
@@ -164,9 +164,14 @@ export default class TheUpdateDialog extends Mixins(BaseMixin) {
|
||||
|
||||
@Watch('messages')
|
||||
messagesChanged() {
|
||||
this.$nextTick(() => {
|
||||
if (this.$refs.updaterLogScroll) this.$refs.updaterLogScroll.$el.scrollTop = this.$refs.updaterLogScroll.$el.scrollHeight
|
||||
})
|
||||
setTimeout(() => {
|
||||
this.$nextTick(() => {
|
||||
if (this.$refs.updaterLogScroll) {
|
||||
const overlayscroll = this.$refs.updaterLogScroll.osInstance()
|
||||
overlayscroll?.scroll({ y: '100%' })
|
||||
}
|
||||
})
|
||||
}, 50)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -10,12 +10,12 @@
|
||||
|
||||
<script lang="ts">
|
||||
|
||||
import Component from "vue-class-component";
|
||||
import {createComponent} from "echarts-for-vue";
|
||||
import * as echarts from "echarts";
|
||||
import {Mixins, Watch} from "vue-property-decorator";
|
||||
import BaseMixin from "@/components/mixins/base";
|
||||
import {ECharts} from "echarts/core";
|
||||
import Component from 'vue-class-component'
|
||||
import {createComponent} from 'echarts-for-vue'
|
||||
import * as echarts from 'echarts'
|
||||
import {Mixins, Watch} from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import {ECharts} from 'echarts/core'
|
||||
|
||||
@Component({
|
||||
components: {
|
||||
@@ -57,7 +57,7 @@ export default class HistoryAllPrintStatus extends Mixins(BaseMixin) {
|
||||
}
|
||||
|
||||
get allPrintStatusArray() {
|
||||
return this.$store.getters["server/history/getAllPrintStatusArray"]
|
||||
return this.$store.getters['server/history/getAllPrintStatusArray']
|
||||
}
|
||||
|
||||
get chart (): ECharts | null {
|
||||
@@ -94,7 +94,7 @@ export default class HistoryAllPrintStatus extends Mixins(BaseMixin) {
|
||||
if (isVisible) this.chart?.resize()
|
||||
}
|
||||
|
||||
eventListenerResize(event: Event) {
|
||||
eventListenerResize() {
|
||||
this.chart?.resize()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,12 +10,12 @@
|
||||
|
||||
<script lang="ts">
|
||||
|
||||
import Component from "vue-class-component";
|
||||
import {createComponent} from "echarts-for-vue";
|
||||
import * as echarts from "echarts";
|
||||
import {Mixins, Watch} from "vue-property-decorator";
|
||||
import BaseMixin from "../mixins/base";
|
||||
import {ECharts} from "echarts/core";
|
||||
import Component from 'vue-class-component'
|
||||
import {createComponent} from 'echarts-for-vue'
|
||||
import * as echarts from 'echarts'
|
||||
import {Mixins, Watch} from 'vue-property-decorator'
|
||||
import BaseMixin from '../mixins/base'
|
||||
import {ECharts} from 'echarts/core'
|
||||
|
||||
@Component({
|
||||
components: {
|
||||
@@ -40,7 +40,7 @@ export default class HistoryPrinttimeAvg extends Mixins(BaseMixin) {
|
||||
trigger: 'axis',
|
||||
borderWidth: 0,
|
||||
formatter: (datasets: any) => {
|
||||
let output = ""
|
||||
let output = ''
|
||||
|
||||
if (datasets.length) {
|
||||
output = datasets[0]['marker']
|
||||
@@ -49,7 +49,7 @@ export default class HistoryPrinttimeAvg extends Mixins(BaseMixin) {
|
||||
const outputTimeDate = new Date (a[0],a[1]-1, a[2])
|
||||
const outputValue = Math.round(datasets[0]['data'][1] * 10) / 10
|
||||
|
||||
output += outputTimeDate.toLocaleDateString()+": "+outputValue+"m"
|
||||
output += outputTimeDate.toLocaleDateString()+': '+outputValue+'m'
|
||||
}
|
||||
|
||||
return output
|
||||
@@ -111,7 +111,7 @@ export default class HistoryPrinttimeAvg extends Mixins(BaseMixin) {
|
||||
}
|
||||
|
||||
get filamentUsageArray() {
|
||||
return this.$store.getters["server/history/getFilamentUsageArray"]
|
||||
return this.$store.getters['server/history/getFilamentUsageArray']
|
||||
}
|
||||
|
||||
get chart (): ECharts | null {
|
||||
@@ -148,7 +148,7 @@ export default class HistoryPrinttimeAvg extends Mixins(BaseMixin) {
|
||||
if (isVisible) this.chart?.resize()
|
||||
}
|
||||
|
||||
eventListenerResize(event: Event) {
|
||||
eventListenerResize() {
|
||||
this.chart?.resize()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,12 +9,12 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import Component from "vue-class-component";
|
||||
import {createComponent} from "echarts-for-vue";
|
||||
import * as echarts from "echarts";
|
||||
import {Mixins, Watch} from "vue-property-decorator";
|
||||
import BaseMixin from "../mixins/base";
|
||||
import {ECharts} from "echarts/core";
|
||||
import Component from 'vue-class-component'
|
||||
import {createComponent} from 'echarts-for-vue'
|
||||
import * as echarts from 'echarts'
|
||||
import {Mixins, Watch} from 'vue-property-decorator'
|
||||
import BaseMixin from '../mixins/base'
|
||||
import {ECharts} from 'echarts/core'
|
||||
|
||||
@Component({
|
||||
components: {
|
||||
@@ -94,7 +94,7 @@ export default class HistoryPrinttimeAvg extends Mixins(BaseMixin) {
|
||||
}
|
||||
|
||||
get printtimeAvgArray() {
|
||||
return this.$store.getters["server/history/getPrinttimeAvgArray"]
|
||||
return this.$store.getters['server/history/getPrinttimeAvgArray']
|
||||
}
|
||||
|
||||
get chart (): ECharts | null {
|
||||
@@ -131,7 +131,7 @@ export default class HistoryPrinttimeAvg extends Mixins(BaseMixin) {
|
||||
if (isVisible) this.chart?.resize()
|
||||
}
|
||||
|
||||
eventListenerResize(event: Event) {
|
||||
eventListenerResize() {
|
||||
this.chart?.resize()
|
||||
}
|
||||
|
||||
|
||||
@@ -10,15 +10,15 @@
|
||||
|
||||
<script lang="ts">
|
||||
|
||||
import { convertName } from "@/plugins/helpers"
|
||||
import Component from "vue-class-component";
|
||||
import {Mixins, Watch} from "vue-property-decorator";
|
||||
import BaseMixin from "../mixins/base";
|
||||
import {PrinterTempHistoryStateSerie} from "@/store/printer/tempHistory/types";
|
||||
import { convertName } from '@/plugins/helpers'
|
||||
import Component from 'vue-class-component'
|
||||
import {Mixins, Watch} from 'vue-property-decorator'
|
||||
import BaseMixin from '../mixins/base'
|
||||
import {PrinterTempHistoryStateSerie} from '@/store/printer/tempHistory/types'
|
||||
|
||||
import { createComponent } from 'echarts-for-vue';
|
||||
import * as echarts from 'echarts';
|
||||
import {ECharts} from "echarts/core";
|
||||
import { createComponent } from 'echarts-for-vue'
|
||||
import * as echarts from 'echarts'
|
||||
import {ECharts} from 'echarts/core'
|
||||
|
||||
interface echartsTooltipObj {
|
||||
[key: string]: any
|
||||
@@ -198,7 +198,7 @@ export default class TempChart extends Mixins(BaseMixin) {
|
||||
}
|
||||
|
||||
get maxHistory() {
|
||||
return this.$store.getters["server/getConfig"]('server', 'temperature_store_size') ?? 1200
|
||||
return this.$store.getters['server/getConfig']('server', 'temperature_store_size') ?? 1200
|
||||
}
|
||||
|
||||
get series() {
|
||||
@@ -214,15 +214,15 @@ export default class TempChart extends Mixins(BaseMixin) {
|
||||
}
|
||||
|
||||
get maxTemp() {
|
||||
return this.$store.getters["printer/getMaxTemp"] ?? 300
|
||||
return this.$store.getters['printer/getMaxTemp'] ?? 300
|
||||
}
|
||||
|
||||
get boolDisplayPwmAxis() {
|
||||
return this.$store.getters["printer/tempHistory/getBoolDisplayPwmAxis"]
|
||||
return this.$store.getters['printer/tempHistory/getBoolDisplayPwmAxis']
|
||||
}
|
||||
|
||||
get selectedLegends() {
|
||||
return this.$store.getters["printer/tempHistory/getSelectedLegends"]
|
||||
return this.$store.getters['printer/tempHistory/getSelectedLegends']
|
||||
}
|
||||
|
||||
mounted() {
|
||||
@@ -276,41 +276,41 @@ export default class TempChart extends Mixins(BaseMixin) {
|
||||
}
|
||||
|
||||
tooltipFormater(datasets: any) {
|
||||
let output = ""
|
||||
let output = ''
|
||||
|
||||
const mainDatasets = datasets.filter((dataset: any) => !dataset.seriesName.includes('-') && dataset.seriesName !== 'date')
|
||||
if (datasets.length) {
|
||||
let outputTime = datasets[0]['axisValueLabel']
|
||||
outputTime = outputTime.substr(outputTime.indexOf(" "))
|
||||
outputTime = outputTime.substr(outputTime.indexOf(' '))
|
||||
|
||||
output +=
|
||||
"<div class=\"row\">" +
|
||||
"<div class=\"col py-1\" style='border-bottom: 1px solid rgba(255, 255, 255, 0.24);'>" +
|
||||
"<span class='v-icon mdi mdi-clock theme-dark' style='font-size: 14px; margin-right: 5px;'></span>" +
|
||||
"<span class='font-weight-bold'>"+outputTime+"</span>" +
|
||||
"</div>" +
|
||||
"</div>"
|
||||
'<div class="row">' +
|
||||
'<div class="col py-1" style=\'border-bottom: 1px solid rgba(255, 255, 255, 0.24);\'>' +
|
||||
'<span class=\'v-icon mdi mdi-clock theme-dark\' style=\'font-size: 14px; margin-right: 5px;\'></span>' +
|
||||
'<span class=\'font-weight-bold\'>'+outputTime+'</span>' +
|
||||
'</div>' +
|
||||
'</div>'
|
||||
}
|
||||
|
||||
mainDatasets.forEach((dataset: any) => {
|
||||
output += "<div class=\"row\">"
|
||||
output += '<div class="row">'
|
||||
|
||||
output += "<div class=\"col-auto py-0\">"
|
||||
output += '<div class="col-auto py-0">'
|
||||
output += dataset.marker
|
||||
output += "<span class='ml-2'>"+convertName(dataset.seriesName)+":</span>"
|
||||
output += "</div>"
|
||||
output += '<span class=\'ml-2\'>'+convertName(dataset.seriesName)+':</span>'
|
||||
output += '</div>'
|
||||
|
||||
output += "<div class=\"col text-right py-0 font-weight-bold\">"
|
||||
output += '<div class="col text-right py-0 font-weight-bold">'
|
||||
|
||||
if (dataset.seriesName in dataset.value) output += dataset.value[dataset.seriesName].toFixed(1)
|
||||
if (dataset.seriesName+"-target" in dataset.value) output += " / "+dataset.value[dataset.seriesName+"-target"].toFixed(1)
|
||||
output += "°C"
|
||||
if (dataset.seriesName+'-target' in dataset.value) output += ' / '+dataset.value[dataset.seriesName+'-target'].toFixed(1)
|
||||
output += '°C'
|
||||
|
||||
if (dataset.seriesName+"-power" in dataset.value) output += " [ "+(dataset.value[dataset.seriesName+"-power"]*100).toFixed(0)+"% ]"
|
||||
if (dataset.seriesName+"-speed" in dataset.value) output += " [ "+(dataset.value[dataset.seriesName+"-speed"]*100).toFixed(0)+"% ]"
|
||||
if (dataset.seriesName+'-power' in dataset.value) output += ' [ '+(dataset.value[dataset.seriesName+'-power']*100).toFixed(0)+'% ]'
|
||||
if (dataset.seriesName+'-speed' in dataset.value) output += ' [ '+(dataset.value[dataset.seriesName+'-speed']*100).toFixed(0)+'% ]'
|
||||
|
||||
output += "</div>"
|
||||
output += "</div>"
|
||||
output += '</div>'
|
||||
output += '</div>'
|
||||
})
|
||||
|
||||
return output
|
||||
|
||||
@@ -22,10 +22,10 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import Component from "vue-class-component";
|
||||
import Vue from "vue";
|
||||
import {Prop} from "vue-property-decorator";
|
||||
import ConsoleTableEntry from "@/components/console/ConsoleTableEntry.vue";
|
||||
import Component from 'vue-class-component'
|
||||
import Vue from 'vue'
|
||||
import {Prop} from 'vue-property-decorator'
|
||||
import ConsoleTableEntry from '@/components/console/ConsoleTableEntry.vue'
|
||||
@Component({
|
||||
components: {ConsoleTableEntry}
|
||||
})
|
||||
|
||||
@@ -1,39 +1,59 @@
|
||||
<style scoped lang="scss">
|
||||
.consoleTableRow {
|
||||
font-family: 'Roboto Mono', monospace;
|
||||
font-size: .95em;
|
||||
|
||||
&+.consoleTableRow .col {
|
||||
border-top: 1px solid rgba(255, 255, 255, 0.12);
|
||||
&.default {
|
||||
.col {
|
||||
padding-top: 8px !important;
|
||||
padding-bottom: 8px !important;
|
||||
}
|
||||
|
||||
&+.consoleTableRow .col {
|
||||
border-top: 1px solid rgba(255, 255, 255, 0.12);
|
||||
}
|
||||
}
|
||||
|
||||
&.compact {
|
||||
.col {
|
||||
padding-top: 2px !important;
|
||||
padding-bottom: 2px !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<v-row class="ma-0">
|
||||
<v-col class="col-auto pr-0 py-2">{{ event.formatTime }}</v-col>
|
||||
<v-col class="py-2" :class="colorConsoleMessage(event)" v-html="event.formatMessage" @click.capture="commandClick"></v-col>
|
||||
<v-row :class="'ma-0 '+entryStyle">
|
||||
<v-col class="col-auto pr-0">{{ event.formatTime }}</v-col>
|
||||
<v-col :class="colorConsoleMessage(event)" v-html="event.formatMessage" @click.capture="commandClick"></v-col>
|
||||
</v-row>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import Component from "vue-class-component";
|
||||
import Vue from "vue";
|
||||
import {Prop} from "vue-property-decorator";
|
||||
import {ServerStateEvent} from "@/store/server/types";
|
||||
import Component from 'vue-class-component'
|
||||
import Vue from 'vue'
|
||||
import {Prop} from 'vue-property-decorator'
|
||||
import {ServerStateEvent} from '@/store/server/types'
|
||||
|
||||
@Component
|
||||
export default class ConsoleTableEntry extends Vue {
|
||||
@Prop({ required: true })
|
||||
readonly event!: ServerStateEvent
|
||||
|
||||
get entryStyle() {
|
||||
return this.$store.state.gui.console.entryStyle ?? 'default'
|
||||
}
|
||||
|
||||
colorConsoleMessage(item: ServerStateEvent): string {
|
||||
if (item.message.startsWith('!! ')) return "red--text"
|
||||
if (item.message.startsWith('!! ')) return 'red--text'
|
||||
|
||||
return ''
|
||||
}
|
||||
|
||||
commandClick(event: Event) {
|
||||
const eventTarget = event.target as Element
|
||||
if (eventTarget.localName === "a" && eventTarget.className.indexOf('command') !== -1) {
|
||||
if (eventTarget.localName === 'a' && eventTarget.className.indexOf('command') !== -1) {
|
||||
const command = eventTarget.innerHTML.replace(/<br>/g, '\n')
|
||||
|
||||
this.$emit('command-click', command)
|
||||
|
||||
@@ -0,0 +1,856 @@
|
||||
<!-- Because the viewer lives outside of the components DOM it can't be scoped -->
|
||||
<style>
|
||||
.viewer {
|
||||
width: 100%;
|
||||
height: calc(var(--app-height) - 250px);
|
||||
border: 1px solid #3f3f3f;
|
||||
}
|
||||
|
||||
.slider-autoheight,
|
||||
.slider-autoheight .v-slider {
|
||||
height: calc(var(--app-height) - 250px);
|
||||
}
|
||||
|
||||
.slider-autoheight .v-slider {
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.slider-autoheight .v-input__slot {
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style scoped>
|
||||
.progress-text {
|
||||
font-size: small;
|
||||
}
|
||||
|
||||
.progress-container {
|
||||
position: absolute;
|
||||
width: 80.5%;
|
||||
}
|
||||
|
||||
.disable-transition {
|
||||
transition: none !important;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<panel :title="$t('GCodeViewer.Title')" icon="mdi-video-3d" card-class="gcode-viewer-panel">
|
||||
<template v-slot:buttons>
|
||||
<v-btn
|
||||
:icon="$vuetify.breakpoint.xs"
|
||||
:text="$vuetify.breakpoint.smAndUp"
|
||||
tile
|
||||
@click="reloadViewer"
|
||||
color="info"
|
||||
class="ml-3"
|
||||
v-show="reloadRequired"
|
||||
>
|
||||
<span class="d-none d-sm-block">{{$t("GCodeViewer.ReloadRequired")}}</span>
|
||||
<v-icon class="d-sm-none">mdi-reload-alert</v-icon>
|
||||
</v-btn>
|
||||
<v-btn icon tile @click="resetCamera"><v-icon>mdi-camera-retake</v-icon></v-btn>
|
||||
</template>
|
||||
<v-card-text>
|
||||
<v-row>
|
||||
<v-col>
|
||||
<div ref="viewerCanvasContainer"></div>
|
||||
</v-col>
|
||||
<v-col class="col-auto pr-6">
|
||||
<v-slider
|
||||
vertical
|
||||
:disabled="tracking"
|
||||
:max="maxZSlider"
|
||||
:min="0"
|
||||
:value="zSlider"
|
||||
class="slider-autoheight"
|
||||
@input="updateZSlider"
|
||||
></v-slider>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row class="mt-0">
|
||||
<v-col>
|
||||
<v-select :items="colorModes" :label="$t('GCodeViewer.ColorMode')" item-text="text" dense v-model="colorMode" hide-details outlined></v-select>
|
||||
</v-col>
|
||||
<v-col class="text-center">
|
||||
<template v-if="loadedFile === null">
|
||||
<v-btn @click="loadCurrentFile" class="mr-3" v-if="sdCardFilePath !== '' && sdCardFilePath !== loadedFile">{{ $t("GCodeViewer.LoadCurrentFile")}}</v-btn>
|
||||
<v-btn @click="chooseFile">{{ $t("GCodeViewer.LoadLocal") }}</v-btn>
|
||||
</template>
|
||||
<template v-else>
|
||||
<v-btn @click="tracking=!tracking" v-if="showTrackingButton" class="mr-3"><v-icon v-html="tracking ? 'mdi-toggle-switch' : 'mdi-toggle-switch-off-outline'" class="mr-2"></v-icon>{{ $t("GCodeViewer.Tracking") }}</v-btn>
|
||||
<v-btn @click="clearLoadedFile">{{ $t("GCodeViewer.ClearLoadedFile") }}</v-btn>
|
||||
</template>
|
||||
</v-col>
|
||||
<v-col>
|
||||
<v-row>
|
||||
<v-col>
|
||||
<v-select :items="renderQualities" :label="$t('GCodeViewer.RenderQuality')" item-text="label" dense v-model="renderQuality" hide-details outlined></v-select>
|
||||
</v-col>
|
||||
<v-col class="col-auto">
|
||||
<v-menu :offset-y="true" :offset-x="true" top :close-on-content-click="false" :title="$t('Files.SetupCurrentList')">
|
||||
<template v-slot:activator="{ on, attrs }">
|
||||
<v-btn class="minwidth-0 px-2" v-bind="attrs" v-on="on"><v-icon>mdi-cog</v-icon></v-btn>
|
||||
</template>
|
||||
<v-list>
|
||||
<v-list-item class="minHeight36">
|
||||
<v-checkbox class="mt-0" hide-details v-model="showCursor" :label="$t('GCodeViewer.ShowToolhead')"></v-checkbox>
|
||||
</v-list-item>
|
||||
<v-list-item class="minHeight36">
|
||||
<v-checkbox class="mt-0" hide-details v-model="showTravelMoves" :label="$t('GCodeViewer.ShowTravelMoves')"></v-checkbox>
|
||||
</v-list-item>
|
||||
<v-list-item class="minHeight36" v-if="loadedFile === sdCardFilePath && printing_objects.length > 1">
|
||||
<v-checkbox class="mt-0" hide-details v-model="showObjectSelection" :label="$t('GCodeViewer.ShowObjectSelection')"></v-checkbox>
|
||||
</v-list-item>
|
||||
<v-divider></v-divider>
|
||||
<v-list-item class="minHeight36">
|
||||
<v-checkbox class="mt-0" hide-details v-model="hdRendering" :label="$t('GCodeViewer.HDRendering')"></v-checkbox>
|
||||
</v-list-item>
|
||||
<v-list-item class="minHeight36">
|
||||
<v-checkbox class="mt-0" hide-details v-model="forceLineRendering" :label="$t('GCodeViewer.ForceLineRendering')"></v-checkbox>
|
||||
</v-list-item>
|
||||
<v-list-item class="minHeight36">
|
||||
<v-checkbox class="mt-0" hide-details v-model="transparency" :label="$t('GCodeViewer.Transparency')"></v-checkbox>
|
||||
</v-list-item>
|
||||
<v-list-item class="minHeight36">
|
||||
<v-checkbox class="mt-0" hide-details v-model="voxelMode" :label="$t('GCodeViewer.VoxelMode')"></v-checkbox>
|
||||
</v-list-item>
|
||||
<v-list-item class="minHeight36">
|
||||
<v-checkbox class="mt-0" hide-details v-model="specularLighting" :label="$t('GCodeViewer.SpecularLighting')"></v-checkbox>
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
</v-menu>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<input :accept="'.g,.gcode,.gc,.gco,.nc,.ngc,.tap'" @change="fileSelected" hidden multiple ref="fileInput" type="file" />
|
||||
</v-card-text>
|
||||
</panel>
|
||||
<v-snackbar v-model="loading" :timeout="-1" :value="true" fixed right bottom dark>
|
||||
<div>
|
||||
{{ $t('GCodeViewer.Rendering') }} - {{ loadingPercent }}%<br />
|
||||
<strong>{{ this.loadedFile }}</strong>
|
||||
</div>
|
||||
<v-progress-linear class="mt-2" :value="loadingPercent"></v-progress-linear>
|
||||
<template v-slot:action="{ attrs }">
|
||||
<v-btn color="red" text v-bind="attrs" style="min-width: auto;" @click="cancelRendering()">
|
||||
<v-icon class="0">mdi-close</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
</v-snackbar>
|
||||
<v-snackbar v-model="downloadSnackbar.status" :timeout="-1" :value="true" fixed right bottom dark>
|
||||
<div>
|
||||
{{ $t('GCodeViewer.Downloading') }} - {{ Math.round(downloadSnackbar.percent) }} % @ {{ formatFilesize(Math.round(downloadSnackbar.speed)) }}/s<br />
|
||||
<strong>{{ downloadSnackbar.filename }}</strong>
|
||||
</div>
|
||||
<v-progress-linear class="mt-2" :value="downloadSnackbar.percent"></v-progress-linear>
|
||||
<template v-slot:action="{ attrs }">
|
||||
<v-btn color="red" text v-bind="attrs" @click="cancelDownload" style="min-width: auto;" >
|
||||
<v-icon class="0">mdi-close</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
</v-snackbar>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import {Component, Mixins, Prop, Ref, Watch} from 'vue-property-decorator'
|
||||
import BaseMixin from '../mixins/base'
|
||||
// @ts-ignore
|
||||
import GCodeViewer from '@sindarius/gcodeviewer'
|
||||
import axios from 'axios'
|
||||
import {formatFilesize} from '@/plugins/helpers'
|
||||
import Panel from '@/components/ui/Panel.vue'
|
||||
|
||||
interface downloadSnackbar {
|
||||
status: boolean
|
||||
filename: string
|
||||
percent: number
|
||||
speed: number
|
||||
total: number
|
||||
cancelTokenSource: any
|
||||
lastProgress: {
|
||||
time: number
|
||||
loaded: number
|
||||
}
|
||||
}
|
||||
|
||||
let viewer: any = null
|
||||
@Component({
|
||||
components: {Panel}
|
||||
})
|
||||
export default class Viewer extends Mixins(BaseMixin) {
|
||||
formatFilesize = formatFilesize
|
||||
|
||||
private isBusy = false
|
||||
private loading = false
|
||||
private loadingPercent = 0
|
||||
|
||||
private tracking = false
|
||||
private loadedFile: string | null = null
|
||||
|
||||
private reloadRequired = false
|
||||
private fileSize = 0
|
||||
private maxZSlider = 100000
|
||||
private zSlider = this.maxZSlider
|
||||
private zSlicerHeight = 100
|
||||
private renderQuality = this.renderQualities[2]
|
||||
|
||||
private downloadSnackbar: downloadSnackbar = {
|
||||
status: false,
|
||||
filename: '',
|
||||
percent: 0,
|
||||
speed: 0,
|
||||
total: 0,
|
||||
cancelTokenSource: {},
|
||||
lastProgress: {
|
||||
time: 0,
|
||||
loaded: 0
|
||||
}
|
||||
}
|
||||
|
||||
@Prop({type: String, default: '', required: false}) filename!: string
|
||||
@Ref('fileInput') fileInput!: HTMLInputElement
|
||||
//@Ref('viewerCanvasContainer') viewerCanvasContainer!: HTMLElement
|
||||
|
||||
$refs!: {
|
||||
viewerCanvasContainer: HTMLElement
|
||||
}
|
||||
|
||||
get renderQualities() {
|
||||
return [
|
||||
{ label: this.$t('GCodeViewer.Low'), value: 2 },
|
||||
{ label: this.$t('GCodeViewer.Medium'), value: 3 },
|
||||
{ label: this.$t('GCodeViewer.High'), value: 4 },
|
||||
{ label: this.$t('GCodeViewer.Ultra'), value: 5 },
|
||||
{ label: this.$t('GCodeViewer.Max'), value: 6 },
|
||||
]
|
||||
}
|
||||
|
||||
async mounted() {
|
||||
this.loadedFile = this.$store.state.gcodeviewer?.loadedFileBackup ?? null
|
||||
|
||||
await this.init()
|
||||
|
||||
window.addEventListener('resize', this.eventListenerResize)
|
||||
}
|
||||
|
||||
beforeDestroy() {
|
||||
if (viewer) {
|
||||
viewer.gcodeProcessor.loadingProgressCallback = null
|
||||
this.$store.dispatch('gcodeviewer/setLoadedFileBackup', this.loadedFile)
|
||||
}
|
||||
|
||||
window.removeEventListener('resize', this.eventListenerResize)
|
||||
}
|
||||
|
||||
eventListenerResize() {
|
||||
viewer?.resize()
|
||||
}
|
||||
|
||||
get filePosition() {
|
||||
return this.printerIsPrinting ? this.$store.state.printer.virtual_sdcard.file_position : 0
|
||||
}
|
||||
|
||||
get sdCardFilePath() {
|
||||
return this.$store.state.printer.print_stats.filename ?? ''
|
||||
}
|
||||
|
||||
get currentPosition() {
|
||||
return this.$store.state.printer.motion_report?.live_position ?? [0, 0, 0, 0]
|
||||
}
|
||||
|
||||
get showTrackingButton() {
|
||||
return this.printerIsPrinting && this.sdCardFilePath === this.loadedFile
|
||||
}
|
||||
|
||||
get printing_objects() {
|
||||
return this.$store.state.printer.exclude_object?.objects ?? []
|
||||
}
|
||||
|
||||
get excluded_objects() {
|
||||
return this.$store.state.printer.exclude_object?.excluded_objects ?? []
|
||||
}
|
||||
|
||||
async init() {
|
||||
let canvasElement = this.$store.state.gcodeviewer?.canvasBackup ?? null
|
||||
|
||||
if (canvasElement === null) {
|
||||
canvasElement = document.createElement('canvas')
|
||||
canvasElement.className = 'viewer'
|
||||
this.$refs.viewerCanvasContainer.appendChild(canvasElement)
|
||||
await this.$store.dispatch('gcodeviewer/setCanvasBackup', canvasElement)
|
||||
} else this.$refs.viewerCanvasContainer.appendChild(canvasElement)
|
||||
|
||||
if (viewer === null) {
|
||||
await this.viewerInit(canvasElement)
|
||||
}
|
||||
|
||||
this.registerProgressCallback()
|
||||
|
||||
if (this.$route.query?.filename && this.loadedFile !== this.$route.query?.filename?.toString()) {
|
||||
//TODO: test without sleep
|
||||
await this.sleep(1000) //Give the store a chance to initializ before loading the file.
|
||||
await this.loadFile(this.$route.query.filename.toString())
|
||||
}
|
||||
}
|
||||
|
||||
viewerInit(element: HTMLCanvasElement) {
|
||||
viewer = new GCodeViewer(element)
|
||||
viewer.init()
|
||||
viewer.setBackgroundColor('#121212')
|
||||
viewer.setCursorVisiblity(this.showCursor)
|
||||
viewer.setZClipPlane(1000000, -1000000)
|
||||
viewer.axes.show(this.showAxes)
|
||||
viewer.bed.setDelta(this.kinematics.includes('delta'))
|
||||
|
||||
if (this.bedMaxSize !== null) {
|
||||
viewer.bed.buildVolume['x'].max = this.bedMaxSize[0]
|
||||
viewer.bed.buildVolume['y'].max = this.bedMaxSize[1]
|
||||
viewer.bed.buildVolume['z'].max = this.bedMaxSize[2]
|
||||
}
|
||||
|
||||
if (this.bedMinSize !== null) {
|
||||
viewer.bed.buildVolume['x'].min = this.bedMinSize[0]
|
||||
viewer.bed.buildVolume['y'].min = this.bedMinSize[1]
|
||||
viewer.bed.buildVolume['z'].min = this.bedMinSize[2]
|
||||
}
|
||||
|
||||
viewer.gcodeProcessor.useHighQualityExtrusion(this.hdRendering)
|
||||
viewer.gcodeProcessor.updateForceWireMode(this.forceLineRendering)
|
||||
viewer.gcodeProcessor.setAlpha(this.transparency)
|
||||
viewer.gcodeProcessor.setVoxelMode(this.voxelMode)
|
||||
viewer.gcodeProcessor.voxelWidth = this.voxelWidth
|
||||
viewer.gcodeProcessor.voxelHeight = this.voxelHeight
|
||||
viewer.gcodeProcessor.useSpecularColor(this.specularLighting)
|
||||
viewer.gcodeProcessor.setLiveTracking(false)
|
||||
|
||||
this.loadToolColors(this.extruderColors)
|
||||
|
||||
if (viewer.lastLoadFailed()) {
|
||||
this.renderQuality = this.renderQualities[0]
|
||||
viewer.updateRenderQuality(1)
|
||||
viewer.clearLoadFlag()
|
||||
}
|
||||
}
|
||||
|
||||
registerProgressCallback() {
|
||||
if (viewer) {
|
||||
viewer.gcodeProcessor.loadingProgressCallback = (progress: number) => {
|
||||
this.loadingPercent = Math.ceil(progress * 100)
|
||||
this.loading = this.loadingPercent <= 99
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async cancelRendering() {
|
||||
if (viewer) {
|
||||
viewer.gcodeProcessor.cancelLoad = true
|
||||
await this.sleep(1000)
|
||||
}
|
||||
}
|
||||
|
||||
clearLoadedFile() {
|
||||
if (viewer) {
|
||||
viewer.clearScene(true)
|
||||
this.loadedFile = null
|
||||
}
|
||||
}
|
||||
|
||||
chooseFile() {
|
||||
if (!this.isBusy) {
|
||||
this.fileInput.click()
|
||||
}
|
||||
}
|
||||
|
||||
finishLoad() {
|
||||
this.maxZSlider = viewer.getMaxHeight() + 1
|
||||
this.zSlider = this.maxZSlider
|
||||
this.loading = false
|
||||
viewer.setCursorVisiblity(this.showCursor)
|
||||
viewer.gcodeProcessor.updateFilePosition(viewer.fileSize)
|
||||
|
||||
if (this.loadedFile === this.sdCardFilePath && this.printing_objects.length) {
|
||||
let objects: any = []
|
||||
|
||||
this.printing_objects.forEach((object: any) => {
|
||||
const xValues = object.polygon.map((point: number[]) => point[0])
|
||||
const yValues = object.polygon.map((point: number[]) => point[1])
|
||||
|
||||
objects.push({
|
||||
cancelled: this.excluded_objects.includes(object.name),
|
||||
name: object.name,
|
||||
x: [Math.min(...xValues), Math.max(...xValues)],
|
||||
y: [Math.min(...yValues), Math.max(...yValues)],
|
||||
})
|
||||
})
|
||||
|
||||
viewer.buildObjects.loadObjectBoundaries(objects)
|
||||
viewer.buildObjects.showObjectSelection(this.showObjectSelection)
|
||||
}
|
||||
}
|
||||
|
||||
async fileSelected(e: any) {
|
||||
const reader = new FileReader()
|
||||
reader.addEventListener('load', async (event) => {
|
||||
if (!event || !event.target) return
|
||||
const blob = event.target.result
|
||||
if (typeof blob === 'string') {
|
||||
this.fileSize = blob.length
|
||||
// Do something with result
|
||||
await viewer.processFile(blob)
|
||||
}
|
||||
this.finishLoad()
|
||||
})
|
||||
this.tracking = false
|
||||
if (e.target.files?.length) {
|
||||
this.loadedFile = e?.target?.files[0].name
|
||||
reader.readAsText(e.target.files[0])
|
||||
}
|
||||
e.target.value = ''
|
||||
}
|
||||
|
||||
async loadFile(filename: string) {
|
||||
this.downloadSnackbar.status = true
|
||||
this.downloadSnackbar.speed = 0
|
||||
this.downloadSnackbar.lastProgress.time = 0
|
||||
this.downloadSnackbar.filename = filename.startsWith('gcodes/') ? filename.slice(7) : filename
|
||||
const CancelToken = axios.CancelToken
|
||||
this.downloadSnackbar.cancelTokenSource = CancelToken.source()
|
||||
const text = await axios.get(this.apiUrl + '/server/files/' + encodeURI(filename), {
|
||||
cancelToken: this.downloadSnackbar.cancelTokenSource.token,
|
||||
responseType: 'blob',
|
||||
onDownloadProgress: (progressEvent) => {
|
||||
this.downloadSnackbar.percent = (progressEvent.loaded * 100) / progressEvent.total
|
||||
if (this.downloadSnackbar.lastProgress.time) {
|
||||
const time = progressEvent.timeStamp - this.downloadSnackbar.lastProgress.time
|
||||
const data = progressEvent.loaded - this.downloadSnackbar.lastProgress.loaded
|
||||
|
||||
if (time > 1000 || this.downloadSnackbar.speed === 0) {
|
||||
this.downloadSnackbar.speed = data / (time / 1000)
|
||||
this.downloadSnackbar.lastProgress.time = progressEvent.timeStamp
|
||||
this.downloadSnackbar.lastProgress.loaded = progressEvent.loaded
|
||||
}
|
||||
} else this.downloadSnackbar.lastProgress.time = progressEvent.timeStamp
|
||||
|
||||
this.downloadSnackbar.total = progressEvent.total
|
||||
}
|
||||
}).then(res => res.data.text()).catch((e) => {
|
||||
window.console.error(e.message)
|
||||
})
|
||||
this.downloadSnackbar.status = false
|
||||
this.loadedFile = this.downloadSnackbar.filename
|
||||
|
||||
viewer.updateRenderQuality(this.renderQuality.value)
|
||||
await viewer.processFile(text)
|
||||
this.loadingPercent = 100
|
||||
this.finishLoad()
|
||||
}
|
||||
|
||||
cancelDownload() {
|
||||
this.downloadSnackbar.cancelTokenSource.cancel('User canceled download gcode file')
|
||||
}
|
||||
|
||||
async sleep(ms: number) {
|
||||
await new Promise((resolve) => setTimeout(resolve, ms))
|
||||
}
|
||||
|
||||
async loadCurrentFile() {
|
||||
await this.loadFile('gcodes/' + this.sdCardFilePath)
|
||||
this.loadedFile = this.sdCardFilePath
|
||||
}
|
||||
|
||||
async reloadViewer() {
|
||||
if (this.loading) {
|
||||
//if we are actively loading signal a cancel and wait a second
|
||||
//This prevents a timing issue that can happen if a user changes settings and then
|
||||
//hits the reload viewer button. Will eventually move this to api
|
||||
viewer.gcodeProcessor.cancelLoad = true
|
||||
await this.sleep(1000)
|
||||
}
|
||||
|
||||
this.reloadRequired = false
|
||||
this.loading = true
|
||||
this.loadingPercent = 0
|
||||
await viewer.reload()
|
||||
this.loadingPercent = 100
|
||||
this.finishLoad()
|
||||
}
|
||||
|
||||
resetCamera() {
|
||||
viewer.resetCamera()
|
||||
}
|
||||
|
||||
setReloadRequiredFlag() {
|
||||
if (this.loadedFile && this.loadedFile != '') {
|
||||
this.reloadRequired = true
|
||||
}
|
||||
}
|
||||
|
||||
@Watch('renderQuality')
|
||||
async renderQualityChanged(newVal: number) {
|
||||
if (viewer && viewer.renderQuality !== newVal) {
|
||||
viewer.updateRenderQuality(newVal)
|
||||
await this.reloadViewer()
|
||||
}
|
||||
}
|
||||
|
||||
@Watch('currentPosition')
|
||||
currentPositionChanged(newVal: number[]) {
|
||||
if (viewer) {
|
||||
const position = [
|
||||
{axes: 'X', position: newVal[0]},
|
||||
{axes: 'Y', position: newVal[1]},
|
||||
{axes: 'Z', position: newVal[2]},
|
||||
]
|
||||
|
||||
viewer.updateToolPosition(position)
|
||||
}
|
||||
}
|
||||
|
||||
@Watch('filePosition')
|
||||
filePositionChanged(newVal: number) {
|
||||
if (!viewer) return
|
||||
|
||||
const offset = 350
|
||||
if (newVal > 0 && this.printerIsPrinting && this.tracking && newVal > offset) {
|
||||
viewer.gcodeProcessor.updateFilePosition(newVal - offset)
|
||||
} else {
|
||||
viewer.gcodeProcessor.updateFilePosition(0)
|
||||
}
|
||||
}
|
||||
|
||||
@Watch('tracking')
|
||||
async trackingChanged(newVal: boolean) {
|
||||
if (!viewer) return
|
||||
if (newVal) {
|
||||
//Force renderers reload.
|
||||
viewer.gcodeProcessor.updateFilePosition(0)
|
||||
viewer?.forceRender()
|
||||
} else {
|
||||
viewer.gcodeProcessor.setLiveTracking(false)
|
||||
await this.reloadViewer()
|
||||
}
|
||||
}
|
||||
|
||||
@Watch('printerIsPrinting')
|
||||
printerIsPrintingChanged() {
|
||||
this.tracking = false
|
||||
}
|
||||
|
||||
get showCursor(): boolean {
|
||||
return this.$store.state.gui.gcodeViewer.showCursor ?? false
|
||||
}
|
||||
|
||||
set showCursor(newVal: boolean) {
|
||||
this.$store.dispatch('gui/saveSetting', {name: 'gcodeViewer.showCursor', value: newVal})
|
||||
}
|
||||
|
||||
@Watch('showCursor')
|
||||
showCursorChanged(newVal: boolean) {
|
||||
viewer?.setCursorVisiblity(newVal)
|
||||
}
|
||||
|
||||
get showTravelMoves(): boolean {
|
||||
return this.$store.state.gui.gcodeViewer.showTravelMoves ?? false
|
||||
}
|
||||
|
||||
set showTravelMoves(newVal: boolean) {
|
||||
this.$store.dispatch('gui/saveSetting', {name: 'gcodeViewer.showTravelMoves', value: newVal})
|
||||
}
|
||||
|
||||
@Watch('showTravelMoves')
|
||||
showTravelMovesChanged(newVal: boolean) {
|
||||
viewer?.toggleTravels(newVal)
|
||||
}
|
||||
|
||||
get showObjectSelection(): boolean {
|
||||
return this.$store.state.gui.gcodeViewer.showObjectSelection ?? false
|
||||
}
|
||||
|
||||
set showObjectSelection(newVal: boolean) {
|
||||
this.$store.dispatch('gui/saveSetting', {name: 'gcodeViewer.showObjectSelection', value: newVal})
|
||||
}
|
||||
|
||||
@Watch('showObjectSelection')
|
||||
showObjectSelectionChanged(newVal: boolean) {
|
||||
viewer?.buildObjects.showObjectSelection(newVal)
|
||||
}
|
||||
|
||||
get hdRendering() {
|
||||
return this.$store.state.gui.gcodeViewer.hdRendering
|
||||
}
|
||||
|
||||
set hdRendering(newVal) {
|
||||
this.$store.dispatch('gui/saveSetting', {name: 'gcodeViewer.hdRendering', value: newVal})
|
||||
}
|
||||
|
||||
@Watch('hdRendering')
|
||||
async hdRenderingChanged(newVal: boolean) {
|
||||
if (viewer) {
|
||||
viewer.gcodeProcessor.useHighQualityExtrusion(newVal)
|
||||
await this.reloadViewer()
|
||||
}
|
||||
}
|
||||
|
||||
get forceLineRendering() {
|
||||
return this.$store.state.gui.gcodeViewer.forceLineRendering
|
||||
}
|
||||
|
||||
set forceLineRendering(newVal) {
|
||||
this.$store.dispatch('gui/saveSetting', {name: 'gcodeViewer.forceLineRendering', value: newVal})
|
||||
}
|
||||
|
||||
@Watch('forceLineRendering')
|
||||
async forceLineRenderingChanged(newVal: boolean) {
|
||||
if (viewer) {
|
||||
viewer.gcodeProcessor.updateForceWireMode(newVal)
|
||||
await this.reloadViewer()
|
||||
}
|
||||
}
|
||||
|
||||
get transparency() {
|
||||
return this.$store.state.gui.gcodeViewer.transparency
|
||||
}
|
||||
|
||||
set transparency(newVal) {
|
||||
this.$store.dispatch('gui/saveSetting', {name: 'gcodeViewer.transparency', value: newVal})
|
||||
}
|
||||
|
||||
@Watch('transparency')
|
||||
async transparencyChanged(newVal: boolean) {
|
||||
if (viewer) {
|
||||
viewer.gcodeProcessor.setAlpha(newVal)
|
||||
await this.reloadViewer()
|
||||
}
|
||||
}
|
||||
|
||||
get voxelMode() {
|
||||
return this.$store.state.gui.gcodeViewer.voxelMode
|
||||
}
|
||||
|
||||
set voxelMode(newVal) {
|
||||
this.$store.dispatch('gui/saveSetting', {name: 'gcodeViewer.voxelMode', value: newVal})
|
||||
}
|
||||
|
||||
@Watch('voxelMode')
|
||||
async voxelModeChanged(newVal: boolean) {
|
||||
if (viewer) {
|
||||
viewer.gcodeProcessor.setVoxelMode(newVal)
|
||||
viewer.gcodeProcessor.voxelWidth = this.voxelWidth
|
||||
viewer.gcodeProcessor.voxelHeight = this.voxelHeight
|
||||
await this.reloadViewer()
|
||||
}
|
||||
}
|
||||
|
||||
get voxelWidth() {
|
||||
return this.$store.state.gui.gcodeViewer.voxelWidth ?? 1
|
||||
}
|
||||
|
||||
set voxelWidth(newVal) {
|
||||
this.$store.dispatch('gui/saveSetting', {name: 'gcodeViewer.voxelWidth', value: newVal})
|
||||
}
|
||||
|
||||
get voxelHeight() {
|
||||
return this.$store.state.gui.gcodeViewer.voxelHeight ?? 1
|
||||
}
|
||||
|
||||
set voxelHeight(newVal) {
|
||||
this.$store.dispatch('gui/saveSetting', {name: 'gcodeViewer.voxelHeight', value: newVal})
|
||||
}
|
||||
|
||||
get specularLighting() {
|
||||
return this.$store.state.gui.gcodeViewer.specularLighting
|
||||
}
|
||||
|
||||
set specularLighting(newVal) {
|
||||
this.$store.dispatch('gui/saveSetting', {name: 'gcodeViewer.specularLighting', value: newVal})
|
||||
}
|
||||
|
||||
@Watch('specularLighting')
|
||||
async specularLightingChanged(newVal: boolean) {
|
||||
if (viewer) {
|
||||
viewer.gcodeProcessor.useSpecularColor(newVal)
|
||||
//await this.reloadViewer()
|
||||
}
|
||||
}
|
||||
|
||||
get extruderColors() {
|
||||
return this.$store.state.gui.gcodeViewer?.extruderColors ?? false
|
||||
}
|
||||
|
||||
loadToolColors(colors: string[]) {
|
||||
if (viewer && colors.length) {
|
||||
viewer.gcodeProcessor.resetTools()
|
||||
colors.forEach((color: string) => {
|
||||
//Todo get nozzle size
|
||||
viewer.gcodeProcessor.addTool(color, 0.4) //Default the nozzle to 0.4 for now.
|
||||
})
|
||||
this.setReloadRequiredFlag()
|
||||
}
|
||||
}
|
||||
|
||||
@Watch('extruderColors')
|
||||
extruderColorsChanged(newVal: string[]) {
|
||||
if (viewer && newVal && newVal.length) {
|
||||
this.loadToolColors(newVal)
|
||||
this.setReloadRequiredFlag()
|
||||
}
|
||||
}
|
||||
|
||||
private colorModes = [
|
||||
{text: 'Extruder', value: 0},
|
||||
{text: 'Feed Rate', value: 1},
|
||||
{text: 'Feature', value: 2},
|
||||
]
|
||||
|
||||
get colorMode(): string {
|
||||
return this.$store.state.gui.gcodeViewer.colorMode ?? 2
|
||||
}
|
||||
|
||||
set colorMode(newVal: string) {
|
||||
this.$store.dispatch('gui/saveSetting', {name: 'gcodeViewer.colorMode', value: newVal})
|
||||
|
||||
if (viewer) {
|
||||
if (viewer.gcodeProcessor.colorMode !== newVal) {
|
||||
viewer.gcodeProcessor.setColorMode(newVal)
|
||||
this.reloadViewer()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
get backgroundColor() {
|
||||
return this.$store.state.gui.gcodeViewer?.backgroundColor ?? '#000000'
|
||||
}
|
||||
|
||||
@Watch('backgroundColor')
|
||||
backgroundColorChanged(newVal: string) {
|
||||
if (!viewer) return
|
||||
viewer.setBackgroundColor(newVal)
|
||||
}
|
||||
|
||||
get gridColor() {
|
||||
return this.$store.state.gui.gcodeViewer?.gridColor ?? '#000000'
|
||||
}
|
||||
|
||||
@Watch('gridColor')
|
||||
gridColorChanged(newVal: string) {
|
||||
if (!viewer) return
|
||||
viewer.bed.setBedColor(newVal)
|
||||
}
|
||||
|
||||
get showAxes() {
|
||||
return this.$store.state.gui.gcodeViewer?.showAxes ?? true
|
||||
}
|
||||
|
||||
@Watch('showAxes')
|
||||
showAxesChanged(newVal: boolean) {
|
||||
if (!viewer) return
|
||||
viewer.axes.show(newVal)
|
||||
}
|
||||
|
||||
get minFeed() {
|
||||
return this.$store.state.gui.gcodeViewer?.minFeed ?? 20
|
||||
}
|
||||
|
||||
@Watch('minFeed')
|
||||
minFeedChanged(newVal: number) {
|
||||
if (!viewer) return
|
||||
viewer.gcodeProcessor.updateColorRate(newVal * 60, this.maxFeed * 60)
|
||||
}
|
||||
|
||||
get maxFeed() {
|
||||
return this.$store.state.gui.gcodeViewer?.maxFeed ?? 100
|
||||
}
|
||||
|
||||
@Watch('maxFeed')
|
||||
maxFeedChanged(newVal: number) {
|
||||
if (!viewer) return
|
||||
viewer.gcodeProcessor.updateColorRate(this.minFeed * 60, newVal * 60)
|
||||
}
|
||||
|
||||
get minFeedColor() {
|
||||
return this.$store.state.gui.gcodeViewer?.minFeedColor ?? '#0000FF'
|
||||
}
|
||||
|
||||
@Watch('minFeedColor')
|
||||
minFeedColorUpdated(newVal: string) {
|
||||
if (!viewer) return
|
||||
viewer.gcodeProcessor.updateMinFeedColor(newVal)
|
||||
this.setReloadRequiredFlag()
|
||||
}
|
||||
|
||||
get maxFeedColor() {
|
||||
return this.$store.state.gui.gcodeViewer?.maxFeedColor ?? '#FF0000'
|
||||
}
|
||||
|
||||
@Watch('maxFeedColor')
|
||||
maxFeedColorUpdated(newVal: string) {
|
||||
if (!viewer) return
|
||||
viewer.gcodeProcessor.updateMaxFeedColor(newVal)
|
||||
this.setReloadRequiredFlag()
|
||||
}
|
||||
|
||||
get kinematics() {
|
||||
return this.$store.state.printer.configfile?.settings?.printer?.kinematics ?? ''
|
||||
}
|
||||
|
||||
@Watch('kinematics')
|
||||
kinematicsChanged(newVal: string) {
|
||||
if (viewer && newVal) {
|
||||
viewer.bed.setDelta(newVal.includes('delta'))
|
||||
}
|
||||
}
|
||||
|
||||
get bedMinSize() {
|
||||
return this.$store.state.printer.toolhead?.axis_minimum ?? null
|
||||
}
|
||||
|
||||
@Watch('bedMinSize', {deep: true})
|
||||
bedMinSizeChanged(newVal: number[] | null) {
|
||||
if (viewer && newVal) {
|
||||
viewer.bed.buildVolume['x'].min = newVal[0]
|
||||
viewer.bed.buildVolume['y'].min = newVal[1]
|
||||
viewer.bed.buildVolume['z'].min = newVal[2]
|
||||
}
|
||||
}
|
||||
|
||||
get bedMaxSize() {
|
||||
return this.$store.state.printer.toolhead?.axis_maximum ?? null
|
||||
}
|
||||
|
||||
@Watch('bedMaxSize', {deep: true})
|
||||
bedMaxSizeChanged(newVal: number[] | null) {
|
||||
if (newVal && viewer) {
|
||||
viewer.bed.buildVolume['x'].max = newVal[0]
|
||||
viewer.bed.buildVolume['y'].max = newVal[1]
|
||||
viewer.bed.buildVolume['z'].max = newVal[2]
|
||||
}
|
||||
}
|
||||
|
||||
@Watch('zSlider')
|
||||
zSliderChanged(newVal: number) {
|
||||
viewer?.setZClipPlane(newVal, -1)
|
||||
viewer?.forceRender()
|
||||
}
|
||||
|
||||
get progressColor() {
|
||||
return this.$store.state.gui.gcodeViewer?.progressColor ?? '#FFFFFF'
|
||||
}
|
||||
|
||||
@Watch('progressColor')
|
||||
progressColorChanged(newVal: string) {
|
||||
viewer?.setProgressColor(newVal)
|
||||
}
|
||||
|
||||
updateZSlider(newVal: any) {
|
||||
this.zSlider = newVal
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<style>
|
||||
.vue-codemirror .cm-editor {
|
||||
height: calc(100vh - 64px);
|
||||
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -13,16 +13,16 @@
|
||||
<script lang="ts">
|
||||
// Inspired by these repo: https://github.com/surmon-china/vue-codemirror
|
||||
|
||||
import {Component, Mixins, Prop, Watch} from "vue-property-decorator";
|
||||
import BaseMixin from "../mixins/base";
|
||||
import {basicSetup, EditorState} from "@codemirror/basic-setup";
|
||||
import {mainsailTheme} from "@/plugins/codemirrorTheme";
|
||||
import {StreamLanguage} from "@codemirror/stream-parser";
|
||||
import { klipper_config } from "@/plugins/StreamParserKlipperConfig";
|
||||
import { gcode } from "@/plugins/StreamParserGcode";
|
||||
import {EditorView, keymap} from "@codemirror/view";
|
||||
import {indentWithTab} from "@codemirror/commands";
|
||||
import {json} from "@codemirror/lang-json";
|
||||
import {Component, Mixins, Prop, Watch} from 'vue-property-decorator'
|
||||
import BaseMixin from '../mixins/base'
|
||||
import {basicSetup, EditorState} from '@codemirror/basic-setup'
|
||||
import {mainsailTheme} from '@/plugins/codemirrorTheme'
|
||||
import {StreamLanguage} from '@codemirror/stream-parser'
|
||||
import { klipper_config } from '@/plugins/StreamParserKlipperConfig'
|
||||
import { gcode } from '@/plugins/StreamParserGcode'
|
||||
import {EditorView, keymap} from '@codemirror/view'
|
||||
import {indentWithTab} from '@codemirror/commands'
|
||||
import {json} from '@codemirror/lang-json'
|
||||
|
||||
@Component
|
||||
export default class Codemirror extends Mixins(BaseMixin) {
|
||||
|
||||
@@ -22,9 +22,9 @@
|
||||
|
||||
|
||||
<script lang="ts">
|
||||
import {convertName} from "@/plugins/helpers";
|
||||
import {Component, Mixins, Prop} from "vue-property-decorator";
|
||||
import BaseMixin from "@/components/mixins/base";
|
||||
import {convertName} from '@/plugins/helpers'
|
||||
import {Component, Mixins, Prop} from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
|
||||
@Component
|
||||
export default class FilamentSensor extends Mixins(BaseMixin) {
|
||||
@@ -35,9 +35,9 @@ export default class FilamentSensor extends Mixins(BaseMixin) {
|
||||
@Prop({ type: Boolean, required: true }) readonly filament_detected!: boolean
|
||||
|
||||
get statusColor() {
|
||||
if (!this.enabled) return "gray"
|
||||
else if (this.filament_detected) return "success"
|
||||
else return "danger"
|
||||
if (!this.enabled) return 'gray'
|
||||
else if (this.filament_detected) return 'success'
|
||||
else return 'danger'
|
||||
}
|
||||
|
||||
get statusText() {
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
<template>
|
||||
<form v-on:submit.prevent="sendCmd">
|
||||
<v-text-field
|
||||
v-model="value"
|
||||
@click:append="resetLimit"
|
||||
:label="label"
|
||||
:suffix="unit"
|
||||
:append-icon="this.value !== this.defaultValue ? 'mdi-refresh' : ''"
|
||||
:error="this.value < 0"
|
||||
:step="step"
|
||||
type="number"
|
||||
min="0"
|
||||
hide-details
|
||||
outlined
|
||||
dense
|
||||
></v-text-field>
|
||||
</form>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import Component from 'vue-class-component'
|
||||
import {Mixins, Prop, Watch} from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
|
||||
@Component
|
||||
export default class FirmwareRetractionSettingsInput extends Mixins(BaseMixin) {
|
||||
private value: any = 0
|
||||
|
||||
@Prop({ type: String, required: true }) readonly label!: string
|
||||
@Prop({ type: Number, required: false }) readonly step!: string
|
||||
@Prop({ type: Number, required: true, default: 0 }) readonly target!: number
|
||||
@Prop({ type: Number, required: true, default: 0 }) readonly defaultValue!: number
|
||||
@Prop({ type: String, required: true }) readonly attributeName!: string
|
||||
@Prop({ type: String, required: true }) readonly unit!: string
|
||||
|
||||
@Watch('target')
|
||||
targetChanged(newVal: number): void {
|
||||
this.value = newVal
|
||||
}
|
||||
|
||||
created(): void {
|
||||
this.value = this.target
|
||||
}
|
||||
|
||||
resetLimit() {
|
||||
this.value = this.defaultValue
|
||||
|
||||
this.sendCmd()
|
||||
}
|
||||
|
||||
sendCmd() {
|
||||
const gcode = 'SET_RETRACTION ' + this.attributeName + '=' + Math.max(0, this.value).toFixed(2)
|
||||
this.$store.dispatch('server/addEvent', {message: gcode, type: 'command'})
|
||||
this.$socket.emit('printer.gcode.script', {script: gcode})
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,138 @@
|
||||
<style scoped>
|
||||
.btnMacroMenu {
|
||||
border-top-left-radius: 0;
|
||||
border-bottom-left-radius: 0;
|
||||
}
|
||||
|
||||
.macroWithParameters {
|
||||
border-top-right-radius: 0;
|
||||
border-bottom-right-radius: 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<v-item-group class="d-inline-block">
|
||||
<v-btn
|
||||
small
|
||||
:color="color"
|
||||
:class="paramArray.length ? 'macroWithParameters' : ''"
|
||||
:loading="loadings.includes('macro_'+macro.name)"
|
||||
@click="doSendMacro(macro.name)">
|
||||
{{ macro.name.replace(/_/g, " ") }}
|
||||
</v-btn>
|
||||
<template v-if="paramArray.length">
|
||||
<v-menu offset-y :close-on-content-click="false">
|
||||
<template v-slot:activator="{ on, attrs }">
|
||||
<v-btn
|
||||
small
|
||||
:color="color"
|
||||
v-bind="attrs"
|
||||
v-on="on"
|
||||
class="minwidth-0 px-1 btnMacroMenu"
|
||||
>
|
||||
<v-icon>mdi-menu-down</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<v-card max-width="200">
|
||||
<v-card-text class="py-2">
|
||||
<v-row v-for="(name, key) in paramArray" :key="'param_'+key" class="my-2">
|
||||
<v-col class="py-0">
|
||||
<v-text-field
|
||||
:label="name"
|
||||
v-model="params[name].value"
|
||||
:placeholder="params[name].default"
|
||||
:persistent-placeholder="true"
|
||||
hide-details
|
||||
outlined
|
||||
dense
|
||||
clearable
|
||||
clear-icon="mdi-refresh"
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row class="my-2">
|
||||
<v-col class="py-0">
|
||||
<v-btn color="primary" class="text-uppercase" block @click="sendWithParams">
|
||||
{{ $t('Panels.MacrosPanel.Send') }}
|
||||
</v-btn>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</v-menu>
|
||||
</template>
|
||||
</v-item-group>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import Component from 'vue-class-component'
|
||||
import {Mixins, Prop, Watch} from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import {GuiMacrogroupsStateMacrogroupMacro} from '@/store/gui/macrogroups/types'
|
||||
|
||||
interface param {
|
||||
type: 'int' | 'double' | 'string' | null,
|
||||
default: string | number | null
|
||||
value: string | number | null
|
||||
}
|
||||
|
||||
interface params {
|
||||
[key: string]: param
|
||||
}
|
||||
|
||||
@Component
|
||||
export default class MacroButton extends Mixins(BaseMixin) {
|
||||
private paramArray: string[] = []
|
||||
private params: params = {}
|
||||
|
||||
@Prop({ required: true }) readonly macro!: GuiMacrogroupsStateMacrogroupMacro
|
||||
@Prop({ default: 'primary' }) readonly color!: string
|
||||
|
||||
get klipperMacro() {
|
||||
return this.$store.getters['printer/getMacro'](this.macro.name)
|
||||
}
|
||||
|
||||
@Watch('klipperMacro')
|
||||
klipperMacroChange() {
|
||||
this.refreshParams()
|
||||
}
|
||||
|
||||
refreshParams() {
|
||||
this.paramArray.splice(0, this.paramArray.length)
|
||||
this.params = {}
|
||||
|
||||
if (this.klipperMacro.params !== null) {
|
||||
Object.keys(this.klipperMacro.params).forEach((name: string) => {
|
||||
if (!name.startsWith('_')) {
|
||||
this.paramArray.push(name)
|
||||
this.params[name] = {
|
||||
type: this.klipperMacro.params[name].type,
|
||||
default: this.klipperMacro.params[name].default,
|
||||
value: ''
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
doSendMacro(gcode: string) {
|
||||
this.$store.dispatch('server/addEvent', { message: gcode, type: 'command' })
|
||||
this.$socket.emit('printer.gcode.script', { script: gcode }, { loading: 'macro_'+gcode })
|
||||
}
|
||||
|
||||
sendWithParams() {
|
||||
let params: string[] = []
|
||||
this.paramArray.forEach((paramname: string) => {
|
||||
if (this.params[paramname].value !== null && this.params[paramname].value !== '')
|
||||
params.push(paramname+'='+this.params[paramname].value)
|
||||
})
|
||||
|
||||
const gcode = this.macro.name + ' ' +params.join(' ')
|
||||
this.doSendMacro(gcode)
|
||||
}
|
||||
|
||||
mounted(){
|
||||
this.refreshParams()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -9,29 +9,54 @@
|
||||
<v-row>
|
||||
<v-col :class="pwm ? 'pb-1' : 'pb-3'">
|
||||
<v-subheader class="_fan-slider-subheader">
|
||||
<v-icon small :class="'mr-2 '+(value >= off_below && value > 0 ? 'icon-rotate' : '')" v-if="type !== 'output_pin'">mdi-fan</v-icon>
|
||||
<v-btn
|
||||
v-if="lockSliders && this.isTouchDevice && pwm"
|
||||
@click="isLocked = !isLocked"
|
||||
plain
|
||||
small
|
||||
icon
|
||||
>
|
||||
<v-icon small :color="(isLocked ? 'red' : '')">
|
||||
{{ isLocked ? 'mdi-lock-outline' : 'mdi-lock-open-variant-outline' }}
|
||||
</v-icon>
|
||||
</v-btn>
|
||||
<v-icon
|
||||
small
|
||||
:class="'mr-2 '+(value >= off_below && value > 0 ? 'icon-rotate' : '')"
|
||||
v-if="type !== 'output_pin'"
|
||||
>
|
||||
mdi-fan
|
||||
</v-icon>
|
||||
<span>{{ convertName(name) }}</span>
|
||||
<v-spacer></v-spacer>
|
||||
<small v-if="rpm || rpm === 0" :class="'mr-3 ' + (rpm === 0 && value > 0 ? 'red--text' : '')">{{ Math.round(rpm) }} RPM</small>
|
||||
<span class="font-weight-bold" v-if="!controllable || (controllable && pwm)">{{ Math.round(parseFloat(value)*100) }} %</span>
|
||||
<v-icon v-if="controllable && !pwm" @click="switchOutputPin">{{ value ? "mdi-toggle-switch" : "mdi-toggle-switch-off-outline" }}</v-icon>
|
||||
<small v-if="rpm || rpm === 0" :class="'mr-3 ' + (rpm === 0 && value > 0 ? 'red--text' : '')">
|
||||
{{ Math.round(rpm) }} RPM
|
||||
</small>
|
||||
<span class="font-weight-bold" v-if="!controllable || (controllable && pwm)">
|
||||
{{ Math.round(parseFloat(value)*100) }} %
|
||||
</span>
|
||||
<v-icon v-if="controllable && !pwm" @click="switchOutputPin">
|
||||
{{ value ? "mdi-toggle-switch" : "mdi-toggle-switch-off-outline" }}
|
||||
</v-icon>
|
||||
</v-subheader>
|
||||
<v-card-text class="py-0" v-if="controllable && pwm">
|
||||
<v-slider
|
||||
v-model="value"
|
||||
v-touch="{start: resetLockTimer}"
|
||||
:disabled="isLocked"
|
||||
:min="0.0"
|
||||
:max="1.0"
|
||||
:step="0.01"
|
||||
:color="value < off_below && value > 0 ? 'red' : undefined"
|
||||
@change="changeSlicer()"
|
||||
@change="changeSlider"
|
||||
hide-details
|
||||
>
|
||||
<template v-slot:prepend>
|
||||
<v-icon @click="decrement">mdi-minus</v-icon>
|
||||
<v-icon @click="decrement" :disabled="isLocked">mdi-minus</v-icon>
|
||||
</template>
|
||||
|
||||
<template v-slot:append>
|
||||
<v-icon @click="increment">mdi-plus</v-icon>
|
||||
<v-icon @click="increment" :disabled="isLocked">mdi-plus</v-icon>
|
||||
</template>
|
||||
</v-slider>
|
||||
</v-card-text>
|
||||
@@ -42,14 +67,16 @@
|
||||
|
||||
|
||||
<script lang="ts">
|
||||
import {convertName} from "@/plugins/helpers";
|
||||
import {Component, Mixins, Prop, Watch} from "vue-property-decorator";
|
||||
import BaseMixin from "@/components/mixins/base";
|
||||
import {Debounce} from "vue-debounce-decorator";
|
||||
import {convertName} from '@/plugins/helpers'
|
||||
import {Component, Mixins, Prop, Watch} from 'vue-property-decorator'
|
||||
import BaseMixin from '@/components/mixins/base'
|
||||
import {Debounce} from 'vue-debounce-decorator'
|
||||
|
||||
@Component
|
||||
export default class MiscellaneousSlider extends Mixins(BaseMixin) {
|
||||
convertName = convertName
|
||||
private timeout: number | undefined
|
||||
private isLocked = false
|
||||
private min = 0
|
||||
private value = 0
|
||||
|
||||
@@ -63,32 +90,57 @@ export default class MiscellaneousSlider extends Mixins(BaseMixin) {
|
||||
@Prop({ type: Number, default: 1 }) multi!: number
|
||||
@Prop({ type: Number, default: 0 }) off_below!: number
|
||||
|
||||
@Watch('lockSliders', {immediate: true})
|
||||
lockSlidersChanged(){
|
||||
this.isLocked = this.lockSliders && this.isTouchDevice
|
||||
}
|
||||
|
||||
startLockTimer() {
|
||||
let t = this.lockSlidersDelay
|
||||
if (!this.isTouchDevice || !this.lockSliders || (t <= 0)) return
|
||||
this.timeout = setTimeout(() => this.isLocked = true, t * 1000)
|
||||
}
|
||||
|
||||
resetLockTimer() {
|
||||
clearTimeout(this.timeout)
|
||||
}
|
||||
|
||||
get lockSliders() {
|
||||
return this.$store.state.gui.general.lockSlidersOnTouchDevices
|
||||
}
|
||||
|
||||
get lockSlidersDelay() {
|
||||
return this.$store.state.gui.general.lockSlidersDelay
|
||||
}
|
||||
|
||||
@Debounce(500)
|
||||
changeSlicer() {
|
||||
changeSlider() {
|
||||
this.sendCmd()
|
||||
}
|
||||
|
||||
sendCmd() {
|
||||
let gcode = ""
|
||||
let gcode = ''
|
||||
|
||||
if (this.value < this.min) this.value = 0
|
||||
if (this.target === this.value) return
|
||||
|
||||
const l_value = this.value * this.multi
|
||||
|
||||
if (this.type === "fan") gcode = "M106 S" + (l_value).toFixed(0)
|
||||
if (this.type === "fan_generic") gcode = "SET_FAN_SPEED FAN=" + this.name + " SPEED=" + (l_value)
|
||||
if (this.type === "output_pin") gcode = "SET_PIN PIN=" + this.name + " VALUE=" + (l_value).toFixed(2)
|
||||
if (this.type === 'fan') gcode = 'M106 S' + (l_value).toFixed(0)
|
||||
if (this.type === 'fan_generic') gcode = 'SET_FAN_SPEED FAN=' + this.name + ' SPEED=' + (l_value)
|
||||
if (this.type === 'output_pin') gcode = 'SET_PIN PIN=' + this.name + ' VALUE=' + (l_value).toFixed(2)
|
||||
|
||||
if (gcode !== "") {
|
||||
if (gcode !== '') {
|
||||
this.$store.dispatch('server/addEvent', {message: gcode, type: 'command'})
|
||||
this.$socket.emit('printer.gcode.script', {script: gcode})
|
||||
}
|
||||
|
||||
this.startLockTimer()
|
||||
}
|
||||
|
||||
switchOutputPin() {
|
||||
this.value = this.value ? 0 : 1
|
||||
const gcode = "SET_PIN PIN="+this.name+" VALUE="+(this.value*this.multi).toFixed(2)
|
||||
const gcode = 'SET_PIN PIN='+this.name+' VALUE='+(this.value*this.multi).toFixed(2)
|
||||
this.$store.dispatch('server/addEvent', { message: gcode, type: 'command' })
|
||||
this.$socket.emit('printer.gcode.script', { script: gcode })
|
||||
}
|
||||
@@ -99,9 +151,7 @@ export default class MiscellaneousSlider extends Mixins(BaseMixin) {
|
||||
}
|
||||
|
||||
increment() {
|
||||
window.console.log(this.value)
|
||||
|
||||
this.value = this.value < 1.0 ? Math.round((this.value + 0.01) * 100) / 100 : 1.0;
|
||||
this.value = this.value < 1.0 ? Math.round((this.value + 0.01) * 100) / 100 : 1.0
|
||||
if (this.value < this.off_below) this.value = this.off_below
|
||||
this.sendCmd()
|
||||
}
|
||||
|
||||