diff --git a/README.md b/README.md index 131387a..34814ac 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,28 @@ +# If you can't see you files list, try uploading a new file via OctoPrint - that seems to work! + + + OctoPrint-TFT [![GitHub release](https://img.shields.io/github/release/mcuadros/OctoPrint-TFT.svg)](https://github.com/mcuadros/OctoPrint-TFT/releases) [![license](https://img.shields.io/github/license/mcuadros/OctoPrint-TFT.svg)]() ============= +### My (@noxhirsch) changes to the original software (I'm also working on some bugs): + +- Changed the order of the homescreen elements +- Reworked status screen to have more space for the important stuff and smaller buttons +- Reworked files list: + - Added delete function + - Removed the load button (for small screens). If you want to load a file press print and in the dialog press "no" + - Reload every time when the list is opened + - More narrow list elements for small screens +- Changed temperature pages order. When you press temp, you get the presets first and can press a button to get to the finetune settings +- Improved contrast and color +- Lots of other changes to make it look good even on 320x240 pixel screens (you can run it bigger screens anyway) +- Temperature profiles from OctoPrint are working now (thanks to blondak). + +At the moment SD card is removed (because I created this fork for myself in the first place) - I'll add it back soon. + + + +### Original description: _OctoPrint-TFT_, a touch interface for TFT touch modules based on GTK+3. @@ -9,8 +32,6 @@ equipped with any [TFT Touch module](https://www.waveshare.com/wiki/3.5inch_RPi_ Allows you to control your 3D Printer, like you can do with any [TFT/LCD panel](http://reprap.org/wiki/RepRapTouch), but using _OctoPrint_ and a Raspberry Pi. - - ### These are some of the functionalities supported: - Print jobs monitoring. @@ -54,20 +75,6 @@ sudo apt-get install xserver-xorg xinit ``` -### Installation on Raspbian/OctoPi (recommended) - -The recommended way to install *OctoPrint-TFT* is use the `.deb` packages -from the [Releases](https://github.com/mcuadros/OctoPrint-TFT/releases) page. The packages -are available for Debian based distributions such as Raspbian and OctoPi for -versions `jessie` and `stretch`. - -For example for a Raspbian Jessie: -```sh -> wget https://github.com/mcuadros/OctoPrint-TFT/releases/download/v0.1.0/octoprint-tft_0.1.0-1.jessie_armhf.deb -> dpkg -i octoprint-tft_0.1.0-1.jessie_armhf.deb -``` - - ### Install from source The compilation and packaging tasks are managed by the [`Makefile`](Makefile) @@ -84,17 +91,34 @@ sh get-docker.sh > You can read more about this at [`docker-install`](https://github.com/docker/docker-install) -To compile the project, assuming that you already cloned this repository, just -execute the `build` target, this will generate in `build` folder all the binaries -and debian packages: +Install git and clone this repository: + +```sh +sudo apt-get install git -y +git clone https://github.com/noxhirsch/OctoPrint-TFT +``` + +To compile just execute the `build` target, this will generate in `build` folder all the binaries +and debian packages. This will take a while (10-20mins on a Raspberry Pi 3): ```sh -> make build -> ls -1 build/ +sudo make build +ls -1 build/ ``` If you are using `Raspbian` you can install any of the `.deb` generated packages. -If not, just use the compiled binary. +If not, just use the compiled binary. Example: + +```sh +cd build/jessie +ls +``` + +Now you can see the filename of the package. Use it to run this command: + +```sh +dpkg -i octoprint-tft_0.1.0-1.jessie_armhf.deb +``` Configuration ------------- @@ -112,7 +136,7 @@ the `.deb` package you can configure it at `/etc/octoprint-tft-environment`. - `OCTOPRINT_TFT_STYLE_PATH` - Several themes are supported, and style configurations can be done through CSS. This variable defines the location of the application theme. -- `OCTOPRINT_TFT_RESOLUTION` - Resolution of the application, should be configured to the resolution of your screen, for example `800x480`. By default `480x320`. +- `OCTOPRINT_TFT_RESOLUTION` - Resolution of the application, should be configured to the resolution of your screen, for example `800x480` or `480x320`. By default it is `320x240`. ### Custom controls and commands diff --git a/files.png b/files.png new file mode 100644 index 0000000..8f20eae Binary files /dev/null and b/files.png differ diff --git a/files_print.png b/files_print.png new file mode 100644 index 0000000..6fdff16 Binary files /dev/null and b/files_print.png differ diff --git a/home.png b/home.png new file mode 100644 index 0000000..2a30f1b Binary files /dev/null and b/home.png differ diff --git a/status.png b/status.png new file mode 100644 index 0000000..860d6d9 Binary files /dev/null and b/status.png differ diff --git a/styles/default/images/back.svg b/styles/default/images/back.svg index 1ac347b..95979c1 100644 --- a/styles/default/images/back.svg +++ b/styles/default/images/back.svg @@ -84,7 +84,7 @@ inkscape:connector-curvature="0" id="path7561" d="m 38.323568,26.061953 -17.56836,17.787109 17.78711,17.56836 7.027343,-7.115235 -5.699218,-5.628906 h 20.740234 v -10 h -20.6875 l 5.515625,-5.583984 z" - style="fill:none;fill-rule:evenodd;stroke:#fbb351;stroke-width:3;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;fill-rule:evenodd;stroke:#ff670f;stroke-width:3;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> diff --git a/styles/default/images/bed.svg b/styles/default/images/bed.svg index 3061587..01e8475 100644 --- a/styles/default/images/bed.svg +++ b/styles/default/images/bed.svg @@ -84,25 +84,25 @@ inkscape:connector-curvature="0" id="path4434" d="m 32.825393,25.942337 c 0,0 4.297062,4.866713 4.079832,7.62116 -0.16145,2.047151 -3.752831,3.272536 -3.898507,5.320432 -0.15243,2.142847 3.189558,3.750169 3.263866,5.895614 0.08507,2.456252 -3.196392,4.445587 -3.263866,6.902183 -0.06368,2.318578 2.719888,6.614591 2.719888,6.614591" - style="fill:none;fill-rule:evenodd;stroke:#fbb351;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;fill-rule:evenodd;stroke:#ff670f;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;fill-rule:evenodd;stroke:#ff670f;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;fill-rule:evenodd;stroke:#ff670f;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;fill-rule:evenodd;stroke:#ff670f;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> diff --git a/styles/default/images/calibrate.svg b/styles/default/images/calibrate.svg index f4ed49c..b476ab2 100644 --- a/styles/default/images/calibrate.svg +++ b/styles/default/images/calibrate.svg @@ -84,36 +84,36 @@ inkscape:connector-curvature="0" id="path7561-4" d="m 7.548005,19.993455 8.214692,-7.874475 8.30088,7.792715 -3.286059,3.149792 -2.659605,-2.496887 0.110498,9.190042 -4.670963,0.05054 -0.110217,-9.166674 -2.578872,2.472206 -3.320354,-3.117258 z" - style="fill:#232323;fill-opacity:1;fill-rule:evenodd;stroke:#fbb351;stroke-width:1.36491191;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:#232323;fill-opacity:1;fill-rule:evenodd;stroke:#ff670f;stroke-width:1.36491191;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:#ff670f;fill-opacity:1;fill-rule:nonzero;stroke:#ffffff;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:#ff670f;fill-opacity:1;fill-rule:nonzero;stroke:#ffffff;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:#232323;fill-opacity:1;fill-rule:evenodd;stroke:#ff670f;stroke-width:1.36491191;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:#232323;fill-opacity:1;fill-rule:evenodd;stroke:#ff670f;stroke-width:1.36491191;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:#232323;fill-opacity:1;fill-rule:evenodd;stroke:#ff670f;stroke-width:1.36491191;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="display:inline;fill:#ff670f;fill-opacity:1;fill-rule:evenodd;stroke:#ff670f;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> + style="fill:none;fill-rule:evenodd;stroke:#ff670f;stroke-width:9;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - + + + + + + + + + + + + + + + + diff --git a/styles/default/images/decrease.svg b/styles/default/images/decrease.svg index 8b21482..44b4f58 100644 --- a/styles/default/images/decrease.svg +++ b/styles/default/images/decrease.svg @@ -84,7 +84,7 @@ inkscape:connector-curvature="0" id="path4535" d="m 21.25,39.535714 h 40 v 10 h -40 z" - style="fill:none;fill-rule:evenodd;stroke:#fbb351;stroke-width:3;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;fill-rule:evenodd;stroke:#ff670f;stroke-width:3;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> diff --git a/styles/default/images/delete.svg b/styles/default/images/delete.svg new file mode 100644 index 0000000..74f4d52 --- /dev/null +++ b/styles/default/images/delete.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + diff --git a/styles/default/images/extrude.svg b/styles/default/images/extrude.svg index 42fad68..3cd3f6a 100644 --- a/styles/default/images/extrude.svg +++ b/styles/default/images/extrude.svg @@ -107,7 +107,7 @@ inkscape:connector-curvature="0" id="path4710-2" d="m 29.752599,64.146236 3.756999,5.270354 3.638377,-5.270354 z" - style="display:inline;fill:none;fill-rule:evenodd;stroke:#fbb351;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="display:inline;fill:none;fill-rule:evenodd;stroke:#ff670f;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="display:inline;fill:#ff670f;fill-opacity:1;fill-rule:evenodd;stroke:#ff670f;stroke-width:2.73126698;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> diff --git a/styles/default/images/extruder.svg b/styles/default/images/extruder.svg index c388d4a..0a8a03e 100644 --- a/styles/default/images/extruder.svg +++ b/styles/default/images/extruder.svg @@ -79,7 +79,7 @@ inkscape:connector-curvature="0" id="path4710" d="M 25.836759,53.108992 40.228325,69.155562 54.1655,53.108992 Z" - style="fill:none;fill-rule:evenodd;stroke:#fbb351;stroke-width:3;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;fill-rule:evenodd;stroke:#ff670f;stroke-width:3;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;fill-opacity:1;stroke:#ff670f;stroke-width:2.81566715;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> diff --git a/styles/default/images/fan-on.svg b/styles/default/images/fan-on.svg index fe8a7b5..beb5d9e 100644 --- a/styles/default/images/fan-on.svg +++ b/styles/default/images/fan-on.svg @@ -117,7 +117,7 @@ cy="43.547615" cx="39.822281" id="path5114" - style="fill:none;fill-opacity:1;stroke:#fbb351;stroke-width:2.81566715;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;fill-opacity:1;stroke:#ff670f;stroke-width:2.81566715;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="display:inline;fill:none;fill-rule:evenodd;stroke:#ff670f;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="display:inline;fill:#ff670f;fill-opacity:1;fill-rule:evenodd;stroke:#ff670f;stroke-width:2.73126698;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> diff --git a/styles/default/images/filament_clean.svg b/styles/default/images/filament_clean.svg new file mode 100644 index 0000000..04a287a --- /dev/null +++ b/styles/default/images/filament_clean.svg @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/styles/default/images/file.svg b/styles/default/images/file.svg index 74521b5..9df1597 100644 --- a/styles/default/images/file.svg +++ b/styles/default/images/file.svg @@ -82,22 +82,22 @@ inkscape:connector-curvature="0" id="path6012-9" d="m 40.255032,17.515472 v 10 h 9" - style="display:inline;opacity:1;fill:#fbb351;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:3;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="display:inline;opacity:1;fill:#ff670f;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:3;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;fill-rule:evenodd;stroke:#ff670f;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="display:inline;opacity:1;fill:none;fill-rule:evenodd;stroke:#ff670f;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="display:inline;opacity:1;fill:none;fill-rule:evenodd;stroke:#ff670f;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> diff --git a/styles/default/images/files.svg b/styles/default/images/files.svg index 2330c87..a762e8e 100644 --- a/styles/default/images/files.svg +++ b/styles/default/images/files.svg @@ -1,110 +1,29 @@ - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + diff --git a/styles/default/images/heat-up.svg b/styles/default/images/heat-up.svg index 6bca096..ea7b9ec 100644 --- a/styles/default/images/heat-up.svg +++ b/styles/default/images/heat-up.svg @@ -80,14 +80,14 @@ cy="97.833321" cx="-7.0827856" id="path4837" - style="fill:#d7b351;fill-opacity:1;stroke:#d7b351;stroke-width:1.99953949;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:#ff670f;fill-opacity:1;stroke:#ff670f;stroke-width:1.99953949;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:#ff670f;fill-opacity:1;stroke:#ff670f;stroke-width:2.81615663;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> diff --git a/styles/default/images/home-x.svg b/styles/default/images/home-x.svg index 4964eaf..00b8506 100644 --- a/styles/default/images/home-x.svg +++ b/styles/default/images/home-x.svg @@ -85,13 +85,13 @@ inkscape:connector-curvature="0" id="path7561-4" d="M 50.958201,63.223502 33.122106,45.704877 50.640734,27.868782 l 7.134442,7.007842 -5.613196,5.714691 20.737849,-0.314541 0.151657,9.99885 -20.68512,0.313741 5.599675,5.499693 z" - style="fill:#232323;fill-opacity:1;fill-rule:evenodd;stroke:#fbb351;stroke-width:3;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:#232323;fill-opacity:1;fill-rule:evenodd;stroke:#ff670f;stroke-width:3;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:#ff670f;fill-opacity:1;fill-rule:nonzero;stroke:#ffffff;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> diff --git a/styles/default/images/home-y.svg b/styles/default/images/home-y.svg index 4be91ad..11d3384 100644 --- a/styles/default/images/home-y.svg +++ b/styles/default/images/home-y.svg @@ -85,14 +85,14 @@ inkscape:connector-curvature="0" id="path7561-4" d="M 59.591359,39.025291 41.881524,56.671543 24.235271,38.961705 l 7.084326,-7.058501 5.653863,5.67446 -0.09102,-20.740035 9.999904,-0.04389 0.09079,20.6873 5.559723,-5.540077 7.058503,7.084325 z" - style="fill:#232323;fill-opacity:1;fill-rule:evenodd;stroke:#fbb351;stroke-width:3;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:#232323;fill-opacity:1;fill-rule:evenodd;stroke:#ff670f;stroke-width:3;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:#ff670f;fill-opacity:1;fill-rule:nonzero;stroke:#ffffff;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> diff --git a/styles/default/images/home-z.svg b/styles/default/images/home-z.svg index 6cc5d62..33728f9 100644 --- a/styles/default/images/home-z.svg +++ b/styles/default/images/home-z.svg @@ -84,14 +84,14 @@ inkscape:connector-curvature="0" id="path7561-4" d="M 56.941331,35.239568 39.355752,53.009653 21.585667,35.424072 l 7.034623,-7.108037 5.693541,5.634648 -0.236549,-20.738885 9.99935,-0.114053 0.235947,20.686154 5.520713,-5.578953 z" - style="fill:#232323;fill-opacity:1;fill-rule:evenodd;stroke:#fbb351;stroke-width:3;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:#232323;fill-opacity:1;fill-rule:evenodd;stroke:#ff670f;stroke-width:3;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:#ff670f;fill-opacity:1;fill-rule:nonzero;stroke:#ffffff;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> diff --git a/styles/default/images/home.svg b/styles/default/images/home.svg index c9f7cd9..3c708e9 100644 --- a/styles/default/images/home.svg +++ b/styles/default/images/home.svg @@ -69,7 +69,7 @@ style="display:inline;opacity:1" id="g37"> + style="fill:none;fill-rule:evenodd;stroke:#ff670f;stroke-width:3;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> diff --git a/styles/default/images/motor-off.svg b/styles/default/images/motor-off.svg index ffa9e7a..100f0c5 100644 --- a/styles/default/images/motor-off.svg +++ b/styles/default/images/motor-off.svg @@ -85,14 +85,14 @@ inkscape:connector-curvature="0" id="path4535" d="M 39.382891,38.886141 57.933077,66.678837 49.659078,72.294968 31.108892,44.502272 30.826474,35.633291 Z" - style="fill:#fbb351;fill-opacity:1;fill-rule:evenodd;stroke:#fbb351;stroke-width:3;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:#ff670f;fill-opacity:1;fill-rule:evenodd;stroke:#ff670f;stroke-width:3;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:#ff670f;fill-opacity:1;stroke-width:3;stroke-miterlimit:4;stroke-dasharray:none" /> + style="display:inline;fill:#ff670f;fill-opacity:1;fill-rule:evenodd;stroke:#ff670f;stroke-width:2.27288914;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="display:inline;fill:#ff670f;fill-opacity:1;fill-rule:evenodd;stroke:#ff670f;stroke-width:2.27288914;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="display:inline;fill:#ff670f;fill-opacity:1;fill-rule:evenodd;stroke:#ff670f;stroke-width:2.27288914;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> diff --git a/styles/default/images/move-x+.svg b/styles/default/images/move-x+.svg index 74d9c33..616127e 100644 --- a/styles/default/images/move-x+.svg +++ b/styles/default/images/move-x+.svg @@ -85,7 +85,7 @@ inkscape:connector-curvature="0" id="path7561-4" d="M 51.280343,63.044931 69.116438,45.526306 51.59781,27.690211 l -7.134442,7.007842 5.613196,5.714691 -20.737849,-0.314541 -0.151657,9.99885 20.68512,0.313741 -5.599675,5.499693 z" - style="fill:#232323;fill-opacity:1;fill-rule:evenodd;stroke:#fbb351;stroke-width:3;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:#232323;fill-opacity:1;fill-rule:evenodd;stroke:#ff670f;stroke-width:3;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> diff --git a/styles/default/images/move-x-.svg b/styles/default/images/move-x-.svg index d4d693a..540faa5 100644 --- a/styles/default/images/move-x-.svg +++ b/styles/default/images/move-x-.svg @@ -85,7 +85,7 @@ inkscape:connector-curvature="0" id="path7561-4" d="M 27.922487,63.044931 10.086392,45.526306 27.60502,27.690211 l 7.134442,7.007842 -5.613196,5.714691 20.737849,-0.314541 0.151657,9.99885 -20.68512,0.313741 5.599675,5.499693 z" - style="fill:#232323;fill-opacity:1;fill-rule:evenodd;stroke:#fbb351;stroke-width:3;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:#232323;fill-opacity:1;fill-rule:evenodd;stroke:#ff670f;stroke-width:3;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> diff --git a/styles/default/images/move-y+.svg b/styles/default/images/move-y+.svg index b7b17c0..63ea771 100644 --- a/styles/default/images/move-y+.svg +++ b/styles/default/images/move-y+.svg @@ -84,7 +84,7 @@ inkscape:connector-curvature="0" id="path7561-4-3" d="M 58.029325,30.86777 40.443746,13.097685 22.673661,30.683266 l 7.034623,7.108037 5.693541,-5.634648 -0.236549,20.738885 9.99935,0.114053 0.235947,-20.686154 5.520713,5.578953 z" - style="fill:#232323;fill-opacity:1;fill-rule:evenodd;stroke:#fbb351;stroke-width:3;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:#232323;fill-opacity:1;fill-rule:evenodd;stroke:#ff670f;stroke-width:3;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> diff --git a/styles/default/images/move-y-.svg b/styles/default/images/move-y-.svg index 75ee5cd..ae926a1 100644 --- a/styles/default/images/move-y-.svg +++ b/styles/default/images/move-y-.svg @@ -85,7 +85,7 @@ inkscape:connector-curvature="0" id="path7561-4" d="M 58.029325,51.229977 40.443746,69.000062 22.673661,51.414481 l 7.034623,-7.108037 5.693541,5.634648 -0.236549,-20.738885 9.99935,-0.114053 0.235947,20.686154 5.520713,-5.578953 z" - style="fill:#232323;fill-opacity:1;fill-rule:evenodd;stroke:#fbb351;stroke-width:3;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:#232323;fill-opacity:1;fill-rule:evenodd;stroke:#ff670f;stroke-width:3;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> diff --git a/styles/default/images/move-z+.svg b/styles/default/images/move-z+.svg index 9d55d3f..4bb4f4b 100644 --- a/styles/default/images/move-z+.svg +++ b/styles/default/images/move-z+.svg @@ -84,7 +84,7 @@ inkscape:connector-curvature="0" id="path7561-4" d="M 58.029325,30.86777 40.443746,13.097685 22.673661,30.683266 l 7.034623,7.108037 5.693541,-5.634648 -0.236549,20.738885 9.99935,0.114053 0.235947,-20.686154 5.520713,5.578953 z" - style="fill:#232323;fill-opacity:1;fill-rule:evenodd;stroke:#fbb351;stroke-width:3;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:#232323;fill-opacity:1;fill-rule:evenodd;stroke:#ff670f;stroke-width:3;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> diff --git a/styles/default/images/move-z-.svg b/styles/default/images/move-z-.svg index 0711a44..4c838f2 100644 --- a/styles/default/images/move-z-.svg +++ b/styles/default/images/move-z-.svg @@ -85,7 +85,7 @@ inkscape:connector-curvature="0" id="path7561-4-3" d="M 58.029325,54.858544 40.443746,72.628629 22.673661,55.043048 l 7.034623,-7.108037 5.693541,5.634648 -0.236549,-20.738885 9.99935,-0.114053 0.235947,20.686154 5.520713,-5.578953 z" - style="fill:#232323;fill-opacity:1;fill-rule:evenodd;stroke:#fbb351;stroke-width:3;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:#232323;fill-opacity:1;fill-rule:evenodd;stroke:#ff670f;stroke-width:3;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> diff --git a/styles/default/images/move.svg b/styles/default/images/move.svg index baef42d..8ee9a0d 100644 --- a/styles/default/images/move.svg +++ b/styles/default/images/move.svg @@ -85,7 +85,7 @@ cy="38.997379" cx="-43.947254" id="path8128" - style="fill:#fbb351;fill-opacity:1;fill-rule:nonzero;stroke:#fbb351;stroke-width:2.35894179;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:#ff670f;fill-opacity:1;fill-rule:nonzero;stroke:#ff670f;stroke-width:2.35894179;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;fill-rule:evenodd;stroke:#ff670f;stroke-width:2.28880167;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;fill-rule:evenodd;stroke:#ff670f;stroke-width:2.28880167;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> diff --git a/styles/default/images/print.svg b/styles/default/images/print.svg index 1ac347b..95979c1 100644 --- a/styles/default/images/print.svg +++ b/styles/default/images/print.svg @@ -84,7 +84,7 @@ inkscape:connector-curvature="0" id="path7561" d="m 38.323568,26.061953 -17.56836,17.787109 17.78711,17.56836 7.027343,-7.115235 -5.699218,-5.628906 h 20.740234 v -10 h -20.6875 l 5.515625,-5.583984 z" - style="fill:none;fill-rule:evenodd;stroke:#fbb351;stroke-width:3;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;fill-rule:evenodd;stroke:#ff670f;stroke-width:3;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> diff --git a/styles/default/images/reboot.svg b/styles/default/images/reboot.svg index 63810fa..3cb02ea 100644 --- a/styles/default/images/reboot.svg +++ b/styles/default/images/reboot.svg @@ -15,7 +15,7 @@ id="svg4160" version="1.1" inkscape:version="0.92.2 5c3e80d, 2017-08-06" - sodipodi:docname="power.svg"> + sodipodi:docname="refresh.svg"> + + + id="g4540" + transform="translate(-1.7645874,2.8544036)"> - + id="path4720" + d="m 29.530545,42.491038 -5.319943,-5.9375 5.28574,-0.0473 c 2.907157,-0.02602 7.653857,-0.02602 10.548223,0 l 5.262483,0.0473 -5.128555,5.926352 c -2.820705,3.259494 -5.173431,5.931369 -5.22828,5.9375 -0.05485,0.0061 -2.4937,-2.660727 -5.419668,-5.926352 z" + style="display:inline;fill:none;stroke:none;stroke-width:0.53600001;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + id="path4722" + d="m 14.960653,26.017824 v -7.232143 h 19.285714 19.285715 v 7.232143 7.232143 H 34.246367 14.960653 Z" + style="display:inline;fill:none;stroke:none;stroke-width:0.53600001;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + + + + + + + + + diff --git a/styles/default/images/refresh.svg b/styles/default/images/refresh.svg index 1cdb0db..3cb02ea 100644 --- a/styles/default/images/refresh.svg +++ b/styles/default/images/refresh.svg @@ -103,7 +103,7 @@ inkscape:transform-center-x="3.8692967" inkscape:transform-center-y="1.5048666" /> + style="fill:none;fill-rule:evenodd;stroke:#ff670f;stroke-width:2.28880167;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;fill-rule:evenodd;stroke:#ff670f;stroke-width:2.95693779;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> diff --git a/styles/default/images/retract.svg b/styles/default/images/retract.svg index 481a0e2..3a5cf89 100644 --- a/styles/default/images/retract.svg +++ b/styles/default/images/retract.svg @@ -107,7 +107,7 @@ inkscape:connector-curvature="0" id="path4710-2" d="m 29.752599,64.146236 3.756999,5.270354 3.638377,-5.270354 z" - style="display:inline;fill:none;fill-rule:evenodd;stroke:#fbb351;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="display:inline;fill:none;fill-rule:evenodd;stroke:#ff670f;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="display:inline;fill:#ff670f;fill-opacity:1;fill-rule:evenodd;stroke:#ff670f;stroke-width:2.73126698;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> diff --git a/styles/default/images/sd.svg b/styles/default/images/sd.svg index 7b866fb..1712312 100644 --- a/styles/default/images/sd.svg +++ b/styles/default/images/sd.svg @@ -83,28 +83,28 @@ height="11" width="2" id="rect4378" - style="fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#fbb351;stroke-width:3;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#ff670f;stroke-width:3;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#ff670f;stroke-width:3;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#ff670f;stroke-width:3;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#ff670f;stroke-width:3;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> diff --git a/styles/default/images/sd_eject.svg b/styles/default/images/sd_eject.svg index fba90f6..781bfea 100644 --- a/styles/default/images/sd_eject.svg +++ b/styles/default/images/sd_eject.svg @@ -83,28 +83,28 @@ height="11" width="2" id="rect4378" - style="fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#fbb351;stroke-width:3;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#ff670f;stroke-width:3;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#ff670f;stroke-width:3;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#ff670f;stroke-width:3;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#ff670f;stroke-width:3;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;fill-rule:evenodd;stroke:#ff670f;stroke-width:1.94661856;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;fill-rule:evenodd;stroke:#ff670f;stroke-width:2.95693779;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> diff --git a/styles/default/images/settings.svg b/styles/default/images/settings.svg index 28cabd9..b226680 100644 --- a/styles/default/images/settings.svg +++ b/styles/default/images/settings.svg @@ -87,7 +87,7 @@ diff --git a/styles/default/images/shutdown.svg b/styles/default/images/shutdown.svg new file mode 100644 index 0000000..6adc336 --- /dev/null +++ b/styles/default/images/shutdown.svg @@ -0,0 +1,90 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/styles/default/images/speed-step.svg b/styles/default/images/speed-step.svg index 8e3b1f8..5ae5964 100644 --- a/styles/default/images/speed-step.svg +++ b/styles/default/images/speed-step.svg @@ -122,7 +122,7 @@ inkscape:connector-curvature="0" id="path4242" d="m 43.310553,48.055281 -1.497561,-3.709086 14.65785,-3.761307 z" - style="fill:#fbb351;fill-opacity:1;fill-rule:evenodd;stroke:#fbb351;stroke-width:1px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1" /> + style="fill:#ff670f;fill-opacity:1;fill-rule:evenodd;stroke:#ff670f;stroke-width:1px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1" /> + style="fill:none;fill-opacity:1;stroke:#ff670f;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;fill-opacity:1;stroke:#ff670f;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;fill-rule:evenodd;stroke:#ff670f;stroke-width:3;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> diff --git a/styles/default/images/stop.svg b/styles/default/images/stop.svg index 101f60e..f940318 100644 --- a/styles/default/images/stop.svg +++ b/styles/default/images/stop.svg @@ -84,7 +84,7 @@ inkscape:connector-curvature="0" id="path4535" d="M 52.545757,29.135597 52.532897,57.079565 27.27567,57.078631 27.28853,29.134663 Z" - style="fill:none;fill-rule:evenodd;stroke:#fbb351;stroke-width:3;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;fill-rule:evenodd;stroke:#ff670f;stroke-width:3;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> diff --git a/styles/default/style.css b/styles/default/style.css index c847e9e..c68601d 100644 --- a/styles/default/style.css +++ b/styles/default/style.css @@ -1,16 +1,42 @@ -.dialog { border: 2px solid black; } +.dialog { border: 2px solid #333333; } .notification { background-clip: padding-box; padding: 5px; - border-radius: 0 0 5px 5px; + border-radius: 0; opacity: 0.8; } .warning { - background-color:rgba(30, 204, 39, 0.7); + background-color:rgba(23, 153, 29, 0.7); } .error { - background-color:rgba(204, 30, 30, 0.7); + background-color:rgba(165, 23, 23, 0.7); } + +GtkWindow { + background-color: #000000; +} + +GtkButton { + background-image: none; + background-color:#101010; + /*border:0;*/ + margin:2px; + border-radius:0; +} + +.scrollbar { + -GtkRange-slider-width: 4px; +} + +.slider{ + border-radius:0; + border-width:0; +} + +.progress, .trough{ + border-radius:0; + border-width:0; +} \ No newline at end of file diff --git a/temp.png b/temp.png new file mode 100644 index 0000000..6124b22 Binary files /dev/null and b/temp.png differ diff --git a/temp2.png b/temp2.png new file mode 100644 index 0000000..e4b0792 Binary files /dev/null and b/temp2.png differ diff --git a/ui/common.go b/ui/common.go index c0f4dc7..914a957 100644 --- a/ui/common.go +++ b/ui/common.go @@ -53,8 +53,6 @@ func (p *CommonPanel) Initialize() { for i := len(p.buttons) + 1; i < last; i++ { p.AddButton(MustBox(gtk.ORIENTATION_HORIZONTAL, 0)) } - - p.AddButton(MustButtonImage("Back", "back.svg", p.UI.GoHistory)) } func (p *CommonPanel) Parent() Panel { diff --git a/ui/control.go b/ui/control.go index bcb7be7..104e4f1 100644 --- a/ui/control.go +++ b/ui/control.go @@ -9,7 +9,7 @@ import ( var control = []*octoprint.ControlDefinition{{ Name: "Motor Off", - Command: "M18", + Command: "M84", }, { Name: "Fan On", Command: "M106", @@ -46,6 +46,7 @@ func (m *controlPanel) initialize() { b := m.createCommandButton(c) m.AddButton(b) } + m.Grid().Attach(MustButtonImage("Back", "back.svg", m.UI.GoHistory), 4, 1, 1, 1) } func (m *controlPanel) getControl() []*octoprint.ControlDefinition { diff --git a/ui/default.go b/ui/default.go index 12e3e89..6e9beb3 100644 --- a/ui/default.go +++ b/ui/default.go @@ -18,12 +18,12 @@ func DefaultPanel(ui *UI) Panel { func (m *defaultPanel) initialize() { m.Grid().Attach(MustButtonImage("Status", "status.svg", m.showStatus), 1, 0, 1, 1) - m.Grid().Attach(MustButtonImage("Heat Up", "heat-up.svg", m.showTemperature), 2, 0, 1, 1) - m.Grid().Attach(MustButtonImage("Move", "move.svg", m.showMove), 3, 0, 1, 1) - m.Grid().Attach(MustButtonImage("Home", "home.svg", m.showHome), 4, 0, 1, 1) - m.Grid().Attach(MustButtonImage("Filament", "filament.svg", m.showFilament), 1, 1, 1, 1) - m.Grid().Attach(MustButtonImage("Control", "control.svg", m.showControl), 2, 1, 1, 1) - m.Grid().Attach(MustButtonImage("Files", "files.svg", m.showFiles), 3, 1, 1, 1) + m.Grid().Attach(MustButtonImage("Files", "files.svg", m.showFiles), 2, 0, 1, 1) + m.Grid().Attach(MustButtonImage("Heat Up", "heat-up.svg", m.showTemperature), 3, 0, 1, 1) + m.Grid().Attach(MustButtonImage("Filament", "filament_clean.svg", m.showFilament), 4, 0, 1, 1) + m.Grid().Attach(MustButtonImage("Home", "home.svg", m.showHome), 1, 1, 1, 1) + m.Grid().Attach(MustButtonImage("Move", "move.svg", m.showMove), 2, 1, 1, 1) + m.Grid().Attach(MustButtonImage("Control", "fan-on.svg", m.showControl), 3, 1, 1, 1) m.Grid().Attach(MustButtonImage("System", "settings.svg", m.showSystem), 4, 1, 1, 1) } @@ -36,7 +36,7 @@ func (m *defaultPanel) showHome() { } func (m *defaultPanel) showTemperature() { - m.UI.Add(TemperaturePanel(m.UI, m)) + m.UI.Add(ProfilesPanel(m.UI, m)) } func (m *defaultPanel) showFilament() { diff --git a/ui/filament.go b/ui/filament.go index b1bc6a1..2476286 100644 --- a/ui/filament.go +++ b/ui/filament.go @@ -28,7 +28,7 @@ func FilamentPanel(ui *UI, parent Panel) Panel { labels: map[string]*LabelWithImage{}, } - m.b = NewBackgroundTask(time.Second*5, m.updateTemperatures) + m.b = NewBackgroundTask(time.Second*2, m.updateTemperatures) m.initialize() filamentPanelInstance = m } @@ -39,8 +39,8 @@ func FilamentPanel(ui *UI, parent Panel) Panel { func (m *filamentPanel) initialize() { defer m.Initialize() - m.Grid().Attach(m.createExtrudeButton("Extrude", "extrude.svg", 1), 1, 0, 1, 1) - m.Grid().Attach(m.createExtrudeButton("Retract", "retract.svg", -1), 4, 0, 1, 1) + m.Grid().Attach(m.createExtrudeButton("Retract", "retract.svg", -1), 1, 0, 1, 1) + m.Grid().Attach(m.createExtrudeButton("Extrude", "extrude.svg", 1), 4, 0, 1, 1) m.box = MustBox(gtk.ORIENTATION_VERTICAL, 5) m.box.SetVAlign(gtk.ALIGN_CENTER) @@ -53,6 +53,8 @@ func (m *filamentPanel) initialize() { m.Grid().Attach(m.createToolButton(), 1, 1, 1, 1) m.Grid().Attach(m.createFlowrateButton(), 3, 1, 1, 1) + + m.Grid().Attach(MustButtonImage("Back", "back.svg", m.UI.GoHistory), 4, 1, 1, 1) } func (m *filamentPanel) updateTemperatures() { @@ -79,7 +81,7 @@ func (m *filamentPanel) loadTemperatureState(s *octoprint.TemperatureState) { } m.previous = s -} +} func (m *filamentPanel) addNewTool(tool string) { m.labels[tool] = MustLabelWithImage("extruder.svg", "") @@ -90,11 +92,11 @@ func (m *filamentPanel) addNewTool(tool string) { } func (m *filamentPanel) loadTemperatureData(tool string, d *octoprint.TemperatureData) { - text := fmt.Sprintf("%s: %.1f°C / %.1f°C", strings.Title(tool), d.Actual, d.Target) + text := fmt.Sprintf("%s: %.1f°C \n⇒ %.1f°C", strings.Title(tool), d.Actual, d.Target) if m.previous != nil && d.Target > 0 { if p, ok := m.previous.Current[tool]; ok { - text = fmt.Sprintf("%s (%.1f°C)", text, d.Actual-p.Actual) + text = fmt.Sprintf("%s\nΔ (%.1f°C)", text, d.Actual-p.Actual) } } diff --git a/ui/files.go b/ui/files.go index 48baeee..3a91115 100644 --- a/ui/files.go +++ b/ui/files.go @@ -3,7 +3,7 @@ package ui import ( "fmt" "sort" - "time" + //"time" "github.com/dustin/go-humanize" "github.com/gotk3/gotk3/gtk" @@ -19,11 +19,11 @@ type filesPanel struct { } func FilesPanel(ui *UI, parent Panel) Panel { - if filesPanelInstance == nil { + // if filesPanelInstance == nil { m := &filesPanel{CommonPanel: NewCommonPanel(ui, parent)} m.initialize() filesPanelInstance = m - } + // } return filesPanelInstance } @@ -52,25 +52,25 @@ func (m *filesPanel) createActionBar() gtk.IWidget { bar.SetMarginEnd(5) bar.Add(m.createRefreshButton()) - bar.Add(m.createInitReleaseSDButton()) - bar.Add(MustButton(MustImageFromFileWithSize("back.svg", 40, 40), m.UI.GoHistory)) + //bar.Add(m.createInitReleaseSDButton()) + bar.Add(MustButton(MustImageFromFileWithSize("back.svg", 35, 35), m.UI.GoHistory)) return bar } func (m *filesPanel) createRefreshButton() gtk.IWidget { - return MustButton(MustImageFromFileWithSize("refresh.svg", 40, 40), m.doLoadFiles) + return MustButton(MustImageFromFileWithSize("refresh.svg", 35, 35), m.doLoadFiles) } func (m *filesPanel) doLoadFiles() { Logger.Info("Refreshing list of files") - m.doRefreshSD() + //m.doRefreshSD() local := m.doLoadFilesFromLocation(octoprint.Local) - sdcard := m.doLoadFilesFromLocation(octoprint.SDCard) + //sdcard := m.doLoadFilesFromLocation(octoprint.SDCard) s := byDate(local) - s = append(s, sdcard...) + //s = append(s, sdcard...) sort.Sort(s) EmptyContainer(&m.list.Container) @@ -85,11 +85,11 @@ func (m *filesPanel) doLoadFiles() { m.list.ShowAll() } -func (m *filesPanel) doRefreshSD() { - if err := (&octoprint.SDRefreshRequest{}).Do(m.UI.Printer); err != nil { - Logger.Error(err) - } -} +// func (m *filesPanel) doRefreshSD() { +// if err := (&octoprint.SDRefreshRequest{}).Do(m.UI.Printer); err != nil { +// Logger.Error(err) +// } +// } func (m *filesPanel) doLoadFilesFromLocation(l octoprint.Location) []*octoprint.FileInformation { r := &octoprint.FilesRequest{Location: l, Recursive: true} @@ -106,31 +106,34 @@ func (m *filesPanel) addFile(b *gtk.Box, f *octoprint.FileInformation) { frame, _ := gtk.FrameNew("") name := MustLabel(f.Name) - name.SetMarkup(fmt.Sprintf("%s", filenameEllipsis(f.Name))) + name.SetMarkup(fmt.Sprintf("%s", filenameEllipsis(f.Name))) name.SetHExpand(true) + name.SetHAlign(gtk.ALIGN_START) + name.SetMarginTop(5) info := MustLabel("") - info.SetMarkup(fmt.Sprintf("Uploaded: %s - Size: %s", + info.SetMarkup(fmt.Sprintf("%s - %s", humanize.Time(f.Date.Time), humanize.Bytes(uint64(f.Size)), )) + info.SetHAlign(gtk.ALIGN_START) labels := MustBox(gtk.ORIENTATION_VERTICAL, 5) labels.Add(name) labels.Add(info) actions := MustBox(gtk.ORIENTATION_HORIZONTAL, 5) - actions.Add(m.createLoadAndPrintButton("load.svg", f, false)) - actions.Add(m.createLoadAndPrintButton("status.svg", f, true)) + actions.Add(m.createLoadAndPrintButton("status.svg", f)) + // actions.Add(m.createLoadAndPrintButton("load.svg", f, false)) + actions.Add(m.createDeleteButton("delete.svg", f)) + actions.SetHAlign(gtk.ALIGN_END) file := MustBox(gtk.ORIENTATION_HORIZONTAL, 5) - file.SetMarginTop(15) - file.SetMarginEnd(15) - file.SetMarginStart(15) - file.SetMarginBottom(15) + file.SetMarginTop(5) + file.SetMarginEnd(5) + file.SetMarginStart(5) + file.SetMarginBottom(5) file.SetHExpand(true) - file.Add(MustImageFromFileWithSize("file.svg", 35, 35)) - file.Add(labels) file.Add(actions) @@ -138,67 +141,127 @@ func (m *filesPanel) addFile(b *gtk.Box, f *octoprint.FileInformation) { b.Add(frame) } -func (m *filesPanel) createLoadAndPrintButton(img string, f *octoprint.FileInformation, print bool) gtk.IWidget { +func (m *filesPanel) createLoadAndPrintButton(img string, f *octoprint.FileInformation) gtk.IWidget { return MustButton( - MustImageFromFileWithSize(img, 30, 30), - MustConfirmDialog(m.UI.w, "Are you sure you want to proceed?", func() { - r := &octoprint.SelectFileRequest{} - r.Location = octoprint.Local - r.Path = f.Path - r.Print = print - - Logger.Infof("Loading file %q, printing: %v", f.Name, print) - if err := r.Do(m.UI.Printer); err != nil { - Logger.Error(err) - return - } - }), + MustImageFromFileWithSize(img, 20, 20), + PrintDialog(m.UI.w, "File loaded. Start printing?\n"+filenameEllipsis_short(f.Name), f.Path, m), ) } -func (m *filesPanel) createInitReleaseSDButton() gtk.IWidget { - release := MustImageFromFileWithSize("sd_eject.svg", 40, 40) - init := MustImageFromFileWithSize("sd.svg", 40, 40) - b := MustButton(release, nil) - - state := func() { - time.Sleep(50 * time.Millisecond) - switch m.isReady() { - case true: - b.SetImage(release) - case false: - b.SetImage(init) - } - } - b.Connect("clicked", func() { - var err error - if !m.isReady() { - err = (&octoprint.SDInitRequest{}).Do(m.UI.Printer) - } else { - err = (&octoprint.SDReleaseRequest{}).Do(m.UI.Printer) - } - if err != nil { - Logger.Error(err) - } +func PrintDialog(parent *gtk.Window, msg string, pfad string, ma *filesPanel) func() { + return func() { + win := gtk.MessageDialogNewWithMarkup( + parent, + gtk.DIALOG_MODAL, + gtk.MESSAGE_INFO, + gtk.BUTTONS_YES_NO, + "", + ) - state() - }) + win.SetMarkup(CleanHTML(msg)) + defer win.Destroy() - return b -} + box, _ := win.GetContentArea() + box.SetMarginStart(15) + box.SetMarginEnd(15) + box.SetMarginTop(15) + box.SetMarginBottom(15) -func (m *filesPanel) isReady() bool { - state, err := (&octoprint.SDStateRequest{}).Do(m.UI.Printer) - if err != nil { - Logger.Error(err) - return false + ctx, _ := win.GetStyleContext() + ctx.AddClass("dialog") + + ergebnis := win.Run() + + if ergebnis == int(gtk.RESPONSE_NO) { + ro := &octoprint.SelectFileRequest{} + ro.Location = octoprint.Local + ro.Path = pfad + ro.Print = false + + Logger.Infof("Loading file %q", ro) + if err := ro.Do(ma.UI.Printer); err != nil { + Logger.Error(err) + return + } + }else if ergebnis == int(gtk.RESPONSE_YES) { + rt := &octoprint.SelectFileRequest{} + rt.Location = octoprint.Local + rt.Path = pfad + rt.Print = true + + Logger.Infof("Printing file %q", rt) + if err := rt.Do(ma.UI.Printer); err != nil { + Logger.Error(err) + return + } + } } +} - return state.Ready +func (m *filesPanel) createDeleteButton(img string, de *octoprint.FileInformation) gtk.IWidget { + return MustButton( + MustImageFromFileWithSize(img, 20, 20), + MustConfirmDialog(m.UI.w, "Delete file?\n"+filenameEllipsis_short(de.Name), func() { + del := &octoprint.DeleteFileRequest{} + del.Location = octoprint.Local + del.Path = de.Path + + Logger.Infof("RM %q FROM %v", de.Path, octoprint.Local) + if err := del.Do(m.UI.Printer); err != nil { + Logger.Error(err) + return + } + + m.doLoadFiles() + }), + ) } +// func (m *filesPanel) createInitReleaseSDButton() gtk.IWidget { +// release := MustImageFromFileWithSize("sd_eject.svg", 40, 40) +// init := MustImageFromFileWithSize("sd.svg", 40, 40) +// b := MustButton(release, nil) + +// state := func() { +// time.Sleep(50 * time.Millisecond) +// switch m.isReady() { +// case true: +// b.SetImage(release) +// case false: +// b.SetImage(init) +// } +// } + +// b.Connect("clicked", func() { +// var err error +// if !m.isReady() { +// err = (&octoprint.SDInitRequest{}).Do(m.UI.Printer) +// } else { +// err = (&octoprint.SDReleaseRequest{}).Do(m.UI.Printer) +// } + +// if err != nil { +// Logger.Error(err) +// } + +// state() +// }) + +// return b +// } + +// func (m *filesPanel) isReady() bool { +// state, err := (&octoprint.SDStateRequest{}).Do(m.UI.Printer) +// if err != nil { +// Logger.Error(err) +// return false +// } + +// return state.Ready +// } + type byDate []*octoprint.FileInformation func (s byDate) Len() int { return len(s) } diff --git a/ui/home.go b/ui/home.go index 66f02d4..6d42a35 100644 --- a/ui/home.go +++ b/ui/home.go @@ -31,12 +31,13 @@ func (m *homePanel) initialize() { m.AddButton(m.createMoveButton("Home X", "home-x.svg", octoprint.XAxis)) m.AddButton(m.createMoveButton("Home Y", "home-y.svg", octoprint.YAxis)) m.AddButton(m.createMoveButton("Home Z", "home-z.svg", octoprint.ZAxis)) + m.Grid().Attach(MustButtonImage("Back", "back.svg", m.UI.GoHistory), 4, 1, 1, 1) } func (m *homePanel) createMoveButton(label, image string, axes ...octoprint.Axis) gtk.IWidget { return MustButtonImage(label, image, func() { cmd := &octoprint.PrintHeadHomeRequest{Axes: axes} - Logger.Warningf("Homing the print head in %s axes", axes) + Logger.Warningf("Homing %s axes", axes) if err := cmd.Do(m.UI.Printer); err != nil { Logger.Error(err) return diff --git a/ui/move.go b/ui/move.go index b199b94..8831c70 100644 --- a/ui/move.go +++ b/ui/move.go @@ -28,17 +28,19 @@ func (m *movePanel) initialize() { defer m.Initialize() m.AddButton(m.createMoveButton("X+", "move-x+.svg", octoprint.XAxis, 1)) - m.AddButton(m.createMoveButton("Y+", "move-y+.svg", octoprint.YAxis, 1)) + m.AddButton(m.createMoveButton("Y-", "move-y+.svg", octoprint.YAxis, -1)) m.AddButton(m.createMoveButton("Z+", "move-z+.svg", octoprint.ZAxis, 1)) m.step = MustStepButton("move-step.svg", - Step{"5mm", 5}, Step{"10mm", 10}, Step{"1mm", 1}, + Step{"20mm", 20}, Step{"10mm", 10}, Step{"1mm", 1}, ) m.AddButton(m.step) m.AddButton(m.createMoveButton("X-", "move-x-.svg", octoprint.XAxis, -1)) - m.AddButton(m.createMoveButton("Y-", "move-y-.svg", octoprint.YAxis, -1)) + m.AddButton(m.createMoveButton("Y+", "move-y-.svg", octoprint.YAxis, 1)) m.AddButton(m.createMoveButton("Z-", "move-z-.svg", octoprint.ZAxis, -1)) + + m.Grid().Attach(MustButtonImage("Back", "back.svg", m.UI.GoHistory), 4, 1, 1, 1) } func (m *movePanel) createMoveButton(label, image string, a octoprint.Axis, dir int) gtk.IWidget { @@ -55,7 +57,7 @@ func (m *movePanel) createMoveButton(label, image string, a octoprint.Axis, dir cmd.Z = distance } - Logger.Warningf("Jogging print head axis %s in %dmm", + Logger.Warningf("Jogging %s axis in %dmm", strings.ToUpper(string(a)), distance, ) diff --git a/ui/status.go b/ui/status.go index 5e11611..d5d1a15 100644 --- a/ui/status.go +++ b/ui/status.go @@ -2,7 +2,6 @@ package ui import ( "fmt" - "strings" "time" "github.com/gotk3/gotk3/gtk" @@ -16,7 +15,7 @@ type statusPanel struct { step *StepButton pb *gtk.ProgressBar - bed, tool0, tool1 *LabelWithImage + bed, tool0 *LabelWithImage file, left *LabelWithImage print, pause, stop *gtk.Button } @@ -36,18 +35,16 @@ func StatusPanel(ui *UI, parent Panel) Panel { func (m *statusPanel) initialize() { defer m.Initialize() - m.Grid().Attach(m.createMainBox(), 1, 0, 4, 1) - m.Grid().Attach(m.createPrintButton(), 1, 1, 1, 1) - m.Grid().Attach(m.createPauseButton(), 2, 1, 1, 1) - m.Grid().Attach(m.createStopButton(), 3, 1, 1, 1) + m.Grid().Attach(m.createMainBox(), 1, 0, 4, 2) } func (m *statusPanel) createProgressBar() *gtk.ProgressBar { m.pb = MustProgressBar() m.pb.SetShowText(true) - m.pb.SetMarginTop(10) - m.pb.SetMarginStart(10) - m.pb.SetMarginEnd(10) + m.pb.SetMarginTop(12) + m.pb.SetMarginStart(5) + m.pb.SetMarginEnd(5) + m.pb.SetMarginBottom(17) return m.pb } @@ -56,50 +53,49 @@ func (m *statusPanel) createMainBox() *gtk.Box { grid := MustGrid() grid.SetHExpand(true) grid.Add(m.createInfoBox()) - grid.Add(m.createTemperatureBox()) + grid.SetVAlign(gtk.ALIGN_START) + grid.SetMarginTop(20) + + butt := MustBox(gtk.ORIENTATION_HORIZONTAL, 5) + butt.SetHAlign(gtk.ALIGN_END) + butt.SetVAlign(gtk.ALIGN_END) + butt.SetVExpand(true) + butt.SetMarginTop(5) + butt.SetMarginEnd(5) + butt.Add(m.createPrintButton()) + butt.Add(m.createPauseButton()) + butt.Add(m.createStopButton()) + butt.Add(MustButton(MustImageFromFileWithSize("back.svg", 40, 40), m.UI.GoHistory)) box := MustBox(gtk.ORIENTATION_VERTICAL, 5) - box.SetVAlign(gtk.ALIGN_CENTER) + box.SetVAlign(gtk.ALIGN_START) box.SetVExpand(true) box.Add(grid) box.Add(m.createProgressBar()) - + box.Add(butt) return box } func (m *statusPanel) createInfoBox() *gtk.Box { m.file = MustLabelWithImage("file.svg", "") m.left = MustLabelWithImage("speed-step.svg", "") + m.bed = MustLabelWithImage("bed.svg", "") + m.tool0 = MustLabelWithImage("extruder.svg", "") info := MustBox(gtk.ORIENTATION_VERTICAL, 5) info.SetHAlign(gtk.ALIGN_START) info.SetHExpand(true) - info.SetVExpand(true) info.Add(m.file) info.Add(m.left) - info.SetMarginStart(10) + info.Add(m.tool0) + info.Add(m.bed) + info.SetMarginStart(20) return info } -func (m *statusPanel) createTemperatureBox() *gtk.Box { - m.bed = MustLabelWithImage("bed.svg", "") - m.tool0 = MustLabelWithImage("extruder.svg", "") - m.tool1 = MustLabelWithImage("extruder.svg", "") - - temp := MustBox(gtk.ORIENTATION_VERTICAL, 5) - temp.SetHAlign(gtk.ALIGN_START) - temp.SetHExpand(true) - temp.SetVExpand(true) - temp.Add(m.bed) - temp.Add(m.tool0) - temp.Add(m.tool1) - - return temp -} - func (m *statusPanel) createPrintButton() gtk.IWidget { - m.print = MustButtonImage("Print", "status.svg", func() { + m.print = MustButton(MustImageFromFileWithSize("status.svg", 40, 40), func() { defer m.updateTemperature() Logger.Warning("Starting a new job") @@ -113,7 +109,7 @@ func (m *statusPanel) createPrintButton() gtk.IWidget { } func (m *statusPanel) createPauseButton() gtk.IWidget { - m.pause = MustButtonImage("Pause", "pause.svg", func() { + m.pause = MustButton(MustImageFromFileWithSize("pause.svg", 40, 40), func() { defer m.updateTemperature() Logger.Warning("Pausing/Resuming job") @@ -128,7 +124,7 @@ func (m *statusPanel) createPauseButton() gtk.IWidget { } func (m *statusPanel) createStopButton() gtk.IWidget { - m.stop = MustButtonImage("Stop", "stop.svg", func() { + m.stop = MustButton(MustImageFromFileWithSize("stop.svg", 40, 40), func() { defer m.updateTemperature() Logger.Warning("Stopping job") @@ -155,17 +151,13 @@ func (m *statusPanel) updateTemperature() { m.doUpdateState(&s.State) - m.tool1.Hide() for tool, s := range s.Temperature.Current { - text := fmt.Sprintf("%s: %.0f°C / %.0f°C", strings.Title(tool), s.Actual, s.Target) + text := fmt.Sprintf("%.0f°C ⇒ %.0f°C ", s.Actual, s.Target) switch tool { case "bed": m.bed.Label.SetLabel(text) case "tool0": m.tool0.Label.SetLabel(text) - case "tool1": - m.tool1.Label.SetLabel(text) - m.tool1.Show() } } } @@ -178,8 +170,7 @@ func (m *statusPanel) doUpdateState(s *octoprint.PrinterState) { m.stop.SetSensitive(true) case s.Flags.Paused: m.print.SetSensitive(false) - m.pause.SetLabel("Resume") - m.pause.SetImage(MustImageFromFile("resume.svg")) + m.pause.SetImage(MustImageFromFileWithSize("resume.svg", 40, 40)) m.pause.SetSensitive(true) m.stop.SetSensitive(true) return @@ -193,8 +184,7 @@ func (m *statusPanel) doUpdateState(s *octoprint.PrinterState) { m.stop.SetSensitive(false) } - m.pause.SetLabel("Pause") - m.pause.SetImage(MustImageFromFile("pause.svg")) + m.pause.SetImage(MustImageFromFileWithSize("pause.svg", 40, 40)) } func (m *statusPanel) updateJob() { @@ -204,12 +194,12 @@ func (m *statusPanel) updateJob() { return } - file := "not-set" + file := "File not set" if s.Job.File.Name != "" { - file = filenameEllipsis(s.Job.File.Name) + file = filenameEllipsis_long(s.Job.File.Name) } - m.file.Label.SetLabel(fmt.Sprintf("File: %s", file)) + m.file.Label.SetLabel(fmt.Sprintf("%s", file)) m.pb.SetFraction(s.Progress.Completion / 100) if m.UI.State.IsOperational() { @@ -220,13 +210,13 @@ func (m *statusPanel) updateJob() { var text string switch s.Progress.Completion { case 100: - text = fmt.Sprintf("Job Completed in %s", time.Duration(int64(s.Job.LastPrintTime)*1e9)) + text = fmt.Sprintf("Completed in %s", time.Duration(int64(s.Job.LastPrintTime)*1e9)) case 0: text = "Warming up ..." default: e := time.Duration(int64(s.Progress.PrintTime) * 1e9) l := time.Duration(int64(s.Progress.PrintTimeLeft) * 1e9) - text = fmt.Sprintf("Elapsed/Left: %s / %s", e, l) + text = fmt.Sprintf("Elapsed: %s / Left: %s", e, l) if l == 0 { text = fmt.Sprintf("Elapsed: %s", e) } @@ -235,9 +225,26 @@ func (m *statusPanel) updateJob() { m.left.Label.SetLabel(text) } +func filenameEllipsis_long(name string) string { + if len(name) > 35 { + return name[:32] + "…" + } + + return name +} + func filenameEllipsis(name string) string { - if len(name) > 26 { - return name[:23] + "..." + if len(name) > 31 { + return name[:28] + "…" + } + + return name +} + + +func filenameEllipsis_short(name string) string { + if len(name) > 27 { + return name[:24] + "…" } return name diff --git a/ui/system.go b/ui/system.go index 6f51367..c5de415 100644 --- a/ui/system.go +++ b/ui/system.go @@ -45,6 +45,9 @@ func (m *systemPanel) createActionBar() gtk.IWidget { bar.SetMarginBottom(5) bar.SetMarginEnd(5) + if d := m.createShutdownButton(); d != nil { + bar.Add(d) + } if b := m.createRestartButton(); b != nil { bar.Add(b) } @@ -75,6 +78,27 @@ func (m *systemPanel) createRestartButton() gtk.IWidget { return m.doCreateButtonFromCommand(cmd) } +func (m *systemPanel) createShutdownButton() gtk.IWidget { + r, err := (&octoprint.SystemCommandsRequest{}).Do(m.UI.Printer) + if err != nil { + Logger.Error(err) + return nil + } + + var cmd *octoprint.CommandDefinition + for _, c := range r.Core { + if c.Action == "shutdown" { + cmd = c + } + } + + if cmd == nil { + return nil + } + + return m.doCreateButtonFromCommand(cmd) +} + func (m *systemPanel) doCreateButtonFromCommand(cmd *octoprint.CommandDefinition) gtk.IWidget { do := func() { r := &octoprint.SystemExecuteCommandRequest{ @@ -101,7 +125,7 @@ func (m *systemPanel) createInfoBox() gtk.IWidget { main.SetHExpand(true) main.SetHAlign(gtk.ALIGN_CENTER) main.SetVExpand(true) - main.Add(MustImageFromFileWithSize("octoprint-logo.png", 140, 140)) + // main.Add(MustImageFromFileWithSize("octoprint-logo.png", 140, 140)) info := MustBox(gtk.ORIENTATION_VERTICAL, 0) info.SetVExpand(true) diff --git a/ui/temperature.go b/ui/temperature.go index 4f9f617..94bc81b 100644 --- a/ui/temperature.go +++ b/ui/temperature.go @@ -39,19 +39,20 @@ func TemperaturePanel(ui *UI, parent Panel) Panel { func (m *temperaturePanel) initialize() { defer m.Initialize() + m.Grid().Attach(m.createChangeButton("Decrease", "decrease.svg", -1), 1, 1, 1, 1) m.Grid().Attach(m.createChangeButton("Increase", "increase.svg", 1), 1, 0, 1, 1) - m.Grid().Attach(m.createChangeButton("Decrease", "decrease.svg", -1), 4, 0, 1, 1) - m.box = MustBox(gtk.ORIENTATION_VERTICAL, 5) + m.box = MustBox(gtk.ORIENTATION_VERTICAL, 8) m.box.SetVAlign(gtk.ALIGN_CENTER) m.box.SetMarginStart(10) - m.Grid().Attach(m.box, 2, 0, 2, 1) + m.Grid().Attach(m.box, 2, 0, 3, 1) - m.Grid().Attach(m.createToolButton(), 1, 1, 1, 1) - m.amount = MustStepButton("move-step.svg", Step{"5°C", 5.}, Step{"10°C", 10.}, Step{"1°C", 1.}) - m.Grid().Attach(m.amount, 2, 1, 1, 1) + m.Grid().Attach(m.createToolButton(), 2, 1, 1, 1) + m.amount = MustStepButton("move-step.svg", Step{"10°C", 10.}, Step{"5°C", 5.}, Step{"1°C", 1.}) + m.Grid().Attach(m.amount, 3, 1, 1, 1) - m.Grid().Attach(MustButtonImage("Profiles", "heat-up.svg", m.profilePanel), 3, 1, 1, 1) + // m.Grid().Attach(MustButtonImage("Profiles", "heat-up.svg", m.profilesPanel), 3, 1, 1, 1) + m.Grid().Attach(MustButtonImage("Back", "back.svg", m.UI.GoHistory), 4, 1, 1, 1) } func (m *temperaturePanel) createToolButton() *StepButton { @@ -89,7 +90,7 @@ func (m *temperaturePanel) increaseTarget(tool string, value float64) error { target = 0 } - Logger.Infof("Setting target temperature for %s to %1.f°C.", tool, target) + Logger.Infof("Setting %s to %1.f°C", tool, target) return m.setTarget(tool, target) } @@ -111,7 +112,7 @@ func (m *temperaturePanel) getToolTarget(tool string) (float64, error) { current, ok := s.Temperature.Current[tool] if !ok { - return -1, fmt.Errorf("unable to find tool %q", tool) + return -1, fmt.Errorf("unable to find %q", tool) } return current.Target, nil @@ -153,19 +154,15 @@ func (m *temperaturePanel) addNewTool(tool string) { m.tool.AddStep(Step{strings.Title(tool), tool}) m.tool.Callback() - Logger.Infof("New tool detected %s", tool) + Logger.Infof("Tool detected: %s", tool) } func (m *temperaturePanel) loadTemperatureData(tool string, d *octoprint.TemperatureData) { - text := fmt.Sprintf("%s: %.1f°C / %.1f°C", strings.Title(tool), d.Actual, d.Target) + text := fmt.Sprintf("%s: %.1f°C ⇒ %.1f°C", strings.Title(tool), d.Actual, d.Target) m.labels[tool].Label.SetText(text) m.labels[tool].ShowAll() } -func (m *temperaturePanel) profilePanel() { - m.UI.Add(ProfilesPanel(m.UI, m)) -} - var profilePanelInstance *profilesPanel type profilesPanel struct { @@ -185,6 +182,9 @@ func ProfilesPanel(ui *UI, parent Panel) Panel { func (m *profilesPanel) initialize() { defer m.Initialize() m.loadProfiles() + + m.Grid().Attach(MustButtonImage("Temp", "settings.svg", m.temperaturePanel), 3, 1, 1, 1) + m.Grid().Attach(MustButtonImage("Back", "back.svg", m.UI.GoHistory), 4, 1, 1, 1) } func (m *profilesPanel) loadProfiles() { @@ -195,11 +195,11 @@ func (m *profilesPanel) loadProfiles() { } for _, profile := range s.Temperature.Profiles { - m.AddButton(m.createProfileButton("filament.svg", profile)) + m.AddButton(m.createProfileButton("heat-up.svg", profile)) } m.AddButton(m.createProfileButton("cool-down.svg", &octoprint.TemperatureProfile{ - Name: "Cool Down", + Name: "Cool", Bed: 0, Extruder: 0, })) @@ -207,24 +207,24 @@ func (m *profilesPanel) loadProfiles() { func (m *profilesPanel) createProfileButton(img string, p *octoprint.TemperatureProfile) gtk.IWidget { return MustButtonImage(p.Name, img, func() { - Logger.Warningf("Setting temperature profile %s.", p.Name) + Logger.Warningf("Setting profile: %s", p.Name) if err := m.setProfile(p); err != nil { Logger.Error(err) } }) } -func (m *profilesPanel) setProfile(p *octoprint.TemperatureProfile) error { - for tool := range temperaturePanelInstance.labels { - temp := p.Extruder - if tool == "bed" { - temp = p.Bed - } - - if err := temperaturePanelInstance.setTarget(tool, temp); err != nil { - return err - } - } +func (m *profilesPanel) setProfile(p *octoprint.TemperatureProfile) error { + + cmd := &octoprint.ToolTargetRequest{Targets: map[string]float64{"tool0": p.Extruder}} + cmd.Do(m.UI.Printer) + cmd_bed := &octoprint.BedTargetRequest{Target: p.Bed} + cmd_bed.Do(m.UI.Printer) return nil } + + +func (m *profilesPanel) temperaturePanel() { + m.UI.Add(TemperaturePanel(m.UI, m)) +} diff --git a/ui/ui.go b/ui/ui.go index e64d518..88b780f 100644 --- a/ui/ui.go +++ b/ui/ui.go @@ -15,8 +15,8 @@ import ( var ( StylePath string WindowName = "OctoPrint-TFT" - WindowHeight = 320 - WindowWidth = 480 + WindowHeight = 240 + WindowWidth = 320 ) const ( @@ -165,7 +165,7 @@ func (ui *UI) errToUser(err error) string { text := err.Error() if strings.Contains(text, "connection refused") { return fmt.Sprintf( - "Unable to connect to %q (Key: %v), \nmaybe OctoPrint not running?", + "Unable to connect to %q (Key: %v)", ui.Printer.Endpoint, ui.Printer.APIKey != "", ) } diff --git a/vendor/github.com/mcuadros/go-octoprint/common.go b/vendor/github.com/mcuadros/go-octoprint/common.go index d6ac22f..b3d4cdd 100644 --- a/vendor/github.com/mcuadros/go-octoprint/common.go +++ b/vendor/github.com/mcuadros/go-octoprint/common.go @@ -389,7 +389,8 @@ type CommandDefinition struct { // Confirm if present and set, this text will be displayed to the user in a // confirmation dialog they have to acknowledge in order to really execute // the command. - Confirm string `json:"confirm"` + RawConfirm json.RawMessage `json:"confirm"` + Confirm string `json:"-"` // Async whether to execute the command asynchronously or wait for its // result before responding to the HTTP execution request. Async bool `json:"async"` @@ -717,7 +718,7 @@ type SerialConfig struct { TriggerOkForM29 bool `json:"triggerOkForM29"` // SupportResendsWIthoutOk whether to support resends without follow-up ok // or not. - SupportResendsWIthoutOk bool `json:"supportResendsWIthoutOk"` + SupportResendsWIthoutOk string `json:"supportResendsWIthoutOk"` // Maps to serial.maxCommunicationTimeouts.idle in config.yaml MaxTimeoutsIdle float64 `json:"maxTimeoutsIdle"` // MaxTimeoutsPrinting maximum number of consecutive communication timeouts diff --git a/vendor/github.com/mcuadros/go-octoprint/system.go b/vendor/github.com/mcuadros/go-octoprint/system.go index e5d9c1e..5aee7f3 100644 --- a/vendor/github.com/mcuadros/go-octoprint/system.go +++ b/vendor/github.com/mcuadros/go-octoprint/system.go @@ -26,7 +26,18 @@ func (cmd *SystemCommandsRequest) Do(c *Client) (*SystemCommandsResponse, error) if err := json.Unmarshal(b, r); err != nil { return nil, err } - + for i := range r.Core { + x := r.Core[i] + if err2 := json.Unmarshal(x.RawConfirm, x.Confirm); err2 != nil { + x.Confirm = "" + } + } + for i := range r.Custom { + x := r.Custom[i] + if err2 := json.Unmarshal(x.RawConfirm, x.Confirm); err2 != nil { + x.Confirm = "" + } + } return r, err }