Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Printer Control #80

Merged
merged 11 commits into from
Aug 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion icons.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,9 @@
"Close" by Danny Lelieveld from thenounproject.com
"Pause" by Danny Lelieveld from thenounproject.com
"Play" by Danny Lelieveld from the Noun Project
"Thermometer" by Andrejs Kirma from the Noun Project
"Thermometer" by Andrejs Kirma from the Noun Project
"3d printer filament" by Cono Studio Milano from the Noun Project
"Folder" by romzicon from the Noun Project
"joystick" by ProSymbols from the Noun Project
"Settings" by Karan from the Noun Project
"help" by Rainbow Designs from the Noun Project
15 changes: 8 additions & 7 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,9 @@ function createWindow() {
} = require('electron')
const mainScreen = screen.getPrimaryDisplay();
window = new BrowserWindow({
width: dev ? big ? 1080 : 1400 : mainScreen.size.width,
height: dev ? big ? 342 : 502 : mainScreen.size.height,
width: dev ? big ? 1400 : 1080 : mainScreen.size.width,
height: dev ? big ? 502 : 342 : mainScreen.size.height,
frame: dev ? true : false,
fullscreen: dev ? false : true,
webPreferences: {
nodeIntegration: true
}
Expand All @@ -50,7 +49,11 @@ function createWindow() {
}));
}

if (dev) window.webContents.openDevTools();
if (!dev) {
window.setFullScreen(true)
} else {
window.webContents.openDevTools();
}

if (config && config.octodash && config.octodash.temperatureSensor !== null) {
queryTemperatureSensor();
Expand Down Expand Up @@ -92,9 +95,7 @@ function queryTemperatureSensor() {
app.on('ready', createWindow)

app.on("window-all-closed", () => {
if (process.platform !== "darwin") {
app.quit();
}
app.quit()
});

app.on("activate", () => {
Expand Down
29 changes: 29 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 12 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,15 @@
"output": "package"
},
"linux": {
"target": [{
"target": "deb",
"arch": [
"armv7l",
"arm64"
]
}],
"target": [
{
"target": "deb",
"arch": [
"armv7l",
"arm64"
]
}
],
"category": "Utility"
}
},
Expand Down Expand Up @@ -69,6 +71,9 @@
"@angular/platform-browser": "~8.0.0",
"@angular/platform-browser-dynamic": "~8.0.0",
"@angular/router": "~8.0.0",
"@fortawesome/angular-fontawesome": "^0.4.0",
"@fortawesome/fontawesome-svg-core": "^1.2.21",
"@fortawesome/free-solid-svg-icons": "^5.10.1",
"ajv": "^6.10.2",
"angular-svg-round-progressbar": "^3.0.1",
"electron-store": "^4.0.0",
Expand Down
23 changes: 23 additions & 0 deletions scripts/install-no-autostart.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

release = curl --silent "https://api.github.com/repos/UnchartedBull/OctoDash/releases/latest" | jq -r '.assets[] | select(.name | endswith("armv7l.deb")).browser_download_url'
dependencies="libsecret-common libgnome-keyring-common libgnome-keyring0 libnotify4 libindicator3-7 libappindicator3-1 libdbusmenu-gtk3-4 libdbusmenu-glib4 libsecret-1-0 indicator-application indicator-common gir1.2-gnomekeyring-1.0"

echo "Installing OctoPrint Plugins"
~/OctoPrint/venv/bin/pip install "https://github.com/UnchartedBull/OctoPrint-DisplayLayerProgress/archive/master.zip"
~/OctoPrint/venv/bin/pip install "https://github.com/eyal0/OctoPrint-PrintTimeGenius/archive/master.zip"

echo "Installing Dependencies"
apt update
apt install $dependencies -y

cd ~

echo "Installing OctoDash"
wget -O octodash.deb $release

sudo dpkg -i octodash.deb

rm octodash.deb

echo "Done. You can now start OctoDash via the command octodash."
45 changes: 45 additions & 0 deletions scripts/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/bash

release = curl --silent "https://api.github.com/repos/UnchartedBull/OctoDash/releases/latest" | jq -r '.assets[] | select(.name | endswith("armv7l.deb")).browser_download_url'
dependencies="xserver-xorg --no-install-recommends ratpoison x11-xserver-utils xinit libsecret-common libgnome-keyring-common libgnome-keyring0 libnotify4 libindicator3-7 libappindicator3-1 libdbusmenu-gtk3-4 libdbusmenu-glib4 libsecret-1-0 indicator-application indicator-common gir1.2-gnomekeyring-1.0"

echo "Installing OctoPrint Plugins"
~/OctoPrint/venv/bin/pip install "https://github.com/UnchartedBull/OctoPrint-DisplayLayerProgress/archive/master.zip"
~/OctoPrint/venv/bin/pip install "https://github.com/eyal0/OctoPrint-PrintTimeGenius/archive/master.zip"

echo "Installing Dependencies"
apt update
apt install $dependencies -y

cd ~

echo "Installing OctoDash"
wget -O octodash.deb $release

sudo dpkg -i octodash.deb

rm octodash.deb

echo "Setting up Autostart"
cat <<EOF > ~/.xinitrc
#!/bin/sh

xset s off
xset s noblank
xset -dpms

ratpoison&
octodash
EOF

cat <<EOF >> ~/.bashrc
if [ -z "$SSH_CLIENT" ] || [ -z "$SSH_TTY" ]; then
xinit -- -nocursor
fi
EOF

echo "Setting Permission"
chmod +x ~/.xinitrc
chmod ug+s /usr/lib/xorg/Xorg

echo "Done. OctoDash will start automatically on next reboot."
13 changes: 13 additions & 0 deletions scripts/update.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
release = curl --silent "https://api.github.com/repos/UnchartedBull/OctoDash/releases/latest" | jq -r '.assets[] | select(.name | endswith("armv7l.deb")).browser_download_url'

echo "Updating OctoDash"

cd ~

wget -O octodash.deb $release

sudo dpkg -i octodash.deb

rm octodash.deb

echo "Done. Restart your Raspberry Pi to start the newest version!"
28 changes: 3 additions & 25 deletions src/app/app.component.html
Original file line number Diff line number Diff line change
@@ -1,26 +1,4 @@
<div *ngIf="configService.config" class="container">
<div *ngIf="configService.valid">
<div *ngIf="!configService.config.octodash.touchscreen">
<app-job-status></app-job-status>
<app-printer-status></app-printer-status>
<app-layer-progress></app-layer-progress>
<app-bottom-bar></app-bottom-bar>
</div>
<div *ngIf="configService.config.octodash.touchscreen">
<app-error></app-error>
<!-- <div *ngIf="printing"> -->
<app-print-control></app-print-control>
<app-job-status></app-job-status>
<app-printer-status></app-printer-status>
<app-layer-progress></app-layer-progress>
<app-bottom-bar></app-bottom-bar>
<!-- </div> -->
</div>
</div>
<div *ngIf="!configService.valid">
<app-invalid-config></app-invalid-config>
</div>
</div>
<div *ngIf="!configService.config">
<app-no-config></app-no-config>
<app-error></app-error>
<div class="container">
<router-outlet></router-outlet>
</div>
49 changes: 33 additions & 16 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,47 @@
import { Component, OnDestroy, OnInit } from '@angular/core';
import _ from 'lodash';
import { AppService } from './app.service';
import { Component, } from '@angular/core';
import { ConfigService } from './config/config.service';
import { JobService, Job } from './job.service';
import { Subscription } from 'rxjs';
import { Router } from '@angular/router';

@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})

export class AppComponent implements OnInit, OnDestroy {
export class AppComponent {

private subscriptions: Subscription = new Subscription();
public printing = false;

constructor(public configService: ConfigService, private jobService: JobService) {
constructor(private configService: ConfigService, private service: AppService, private router: Router) {
this.initialize();
}

ngOnInit() {
// FIXME: Adds second subscription
if (this.configService.valid && this.configService.config.octodash.touchscreen) {
this.subscriptions.add(this.jobService.getObservable().subscribe((job: Job) => this.printing = job !== null));
initialize() {
if (this.configService && this.configService.isInitialized()) {
if (this.configService.config) {
if (this.configService.isValid()) {
if (this.configService.isTouchscreen()) {
this.router.navigate(['/main-screen']);
} else {
this.router.navigate(['/main-screen-no-touch']);
}
} else {
if (_.isEqual(this.configService.getErrors(), this.service.getUpdateError())) {
if (this.service.autoFixError()) {
this.initialize();
} else {
this.configService.setUpdate();
this.router.navigate(['/no-config']);
}
} else {
this.router.navigate(['/invalid-config']);
}
}
} else {
this.router.navigate(['/no-config']);
}
} else {
setTimeout(this.initialize.bind(this), 1000);
}
}

ngOnDestroy() {
this.subscriptions.unsubscribe();
}
}
33 changes: 29 additions & 4 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,19 @@ import { PrintControlComponent } from './print-control/print-control.component';
import { ErrorComponent } from './error/error.component';
import { ErrorService } from './error/error.service';
import { PrinterService } from './printer.service';
import { MainMenuComponent } from './main-menu/main-menu.component';

import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
import { library } from '@fortawesome/fontawesome-svg-core';
import { fas } from '@fortawesome/free-solid-svg-icons';
import { ControlComponent } from './control/control.component';
import { AppRoutingModule } from './app.routing.module';
import { MainScreenComponent } from './main-screen/main-screen.component';
import { MainScreenNoTouchComponent } from './main-screen/no-touch/main-screen-no-touch.component';
import { JobService } from './job.service';
import { FilamentComponent } from './filament/filament.component';
import { FilesComponent } from './files/files.component';


@NgModule({
declarations: [
Expand All @@ -28,15 +41,27 @@ import { PrinterService } from './printer.service';
InvalidConfigComponent,
NoConfigComponent,
PrintControlComponent,
ErrorComponent
ErrorComponent,
MainMenuComponent,
ControlComponent,
MainScreenComponent,
MainScreenNoTouchComponent,
FilamentComponent,
FilesComponent
],
imports: [
BrowserModule,
HttpClientModule,
AppRoutingModule,
RoundProgressModule,
FormsModule
FormsModule,
FontAwesomeModule
],
providers: [AppService, ConfigService, ErrorService, PrinterService],
providers: [AppService, ConfigService, ErrorService, PrinterService, JobService],
bootstrap: [AppComponent]
})
export class AppModule { }
export class AppModule {
constructor() {
library.add(fas);
}
}
Loading