Verified Commit 0528a13a authored by Grégor JOUET's avatar Grégor JOUET 🔧
Browse files

Add check print menu, add not ready

parent 7408273d
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -288,6 +288,7 @@ def update_request(req_id):
    if get_access_level_to_request(req, current_user) < required_access:
        return jsonify({"error": "Access denied"}), status.HTTP_401_UNAUTHORIZED

    # TODO V3: successfull request statistics
    for e in changes:
        setattr(req, e, changes[e])
    req.last_modification = datetime.datetime.now()
+10 −2
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@ from myfab.model import (
    Printer,
    PrinterQueue,
)
from multiprocessing import Lock
import time
import requests as r
import json
@@ -323,6 +324,8 @@ RESET_GENERIC = 4
class OctoPrinter(PrinterBase):
    def __init__(self, printer_obj):
        super().__init__(printer_obj)
        self.cancel_flag = False
        self.printer_lock = Lock()
        self.ready_for_printing = False  # can accept new print
        self.clear_plate_flag = True
        self.printer_state = DEFAULT_PRINTER_STATE
@@ -404,6 +407,7 @@ class OctoPrinter(PrinterBase):
        self.test_and_pull_printer_global_info()

    def cancel_print(self):
        self.cancel_flag = True
        if not self.printer_state['state']['flags']['printing']:
            self.log(f"Nothing to cancel")
            return
@@ -506,14 +510,17 @@ class OctoPrinter(PrinterBase):
    """

    def reset_current_print(self, reason):
        if reason == RESET_CANCEL:
            self.cancel_flag = False
        if(self.current_print == None):
            return
        if reason == RESET_CANCEL or reason == RESET_ERROR or reason == RESET_FAILURE:
            self.printer_obj.current_print.status = 11 # REQUEST_STATUS_PRINT_FAILED
            self.printer_obj.current_print.save()
        if reason == RESET_SUCCESS:
            self.printer_obj.current_print.status = 4 # REQUEST_STATUS_FINISHED
            self.printer_obj.current_print.status = 7 # REQUEST_STATUS_INSPECTING
        # TODO v3 : Printer statistics
        # save printer in request
        self.printer_obj.current_print = None
        self.printer_obj.save()
        self._refresh_printer_status()
@@ -579,6 +586,7 @@ class OctoPrinter(PrinterBase):
            if self.current_print != None:
                # We just finished a print, check the reason;
                # set the print status and remove current print
                if not self.cancel_flag:
                    self.reset_current_print(RESET_ERROR if status["state"]["flags"]["error"] else RESET_SUCCESS)  
            return

+12 −1
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@
            <v-divider></v-divider>
            <v-stepper-step :color="stepper_color(2)" :complete="this.status > 1 && this.status < 10 || this.status == 11" step="2">Slicing</v-stepper-step>
            <v-divider></v-divider>
            <v-stepper-step :color="stepper_color(3)" :complete="(this.status > 3 && this.status < 10)" :rules="[() => this.status != 11]" step="3">Impression</v-stepper-step>
            <v-stepper-step :color="stepper_color(3)" :complete="(this.status > 3 && this.status < 10 && this.status != 7)" :rules="[() => this.status != 11]" step="3">Impression</v-stepper-step>
            <v-divider></v-divider>
            <v-stepper-step :color="stepper_color(4)" step="4">Récupération</v-stepper-step>
        </v-stepper-header>
@@ -81,6 +81,17 @@
              </v-row>
            </v-stepper-content>

            <v-stepper-content step="7">
              <v-card>
                Fin de l'impression
                <v-card-actions>
                </v-card-actions>
                <v-btn color="green" @click="print_success" >Impression réussie</v-btn>
                <v-btn color="red" @click="set_to_print" >Ré-imprimer</v-btn>
                
              </v-card>
            </v-stepper-content>

            <v-stepper-content step="4">
                <v-card>
                  <v-icon>mdi-check-underline-circle</v-icon>&nbsp;Choix manuel
+1 −1
Original line number Diff line number Diff line
<template>
    <v-card max-width="500px">
        <v-card-title>{{ infos.name }}&nbsp;&nbsp;&nbsp;<v-btn :href="octo_path" target="_blank" small>octoprint</v-btn></v-card-title>
        <v-alert v-show="show_printer_ready" type="success"><b>Prêt à imprimer</b></v-alert>
        <v-alert v-show="show_printer_ready" type="success"><b>Prêt à imprimer</b> <v-btn @click="clear_plate_flag_change">Wait !</v-btn></v-alert>
        <v-alert v-show="!is_printer_enabled" type="warning"><center><b>L'imprimante est hors comission</b><br/>Aucune impression n'y sera démarée</center></v-alert>
        <v-alert type="error" v-if="is_errored">Printer error</v-alert>
        
+7 −2
Original line number Diff line number Diff line
@@ -3,6 +3,7 @@ REQUEST_STATUS_PENDING_REVIEW = 0 # initial state
REQUEST_STATUS_APPROVED       = 1  # approved, waiting slicing
REQUEST_STATUS_AWAITING_PRINT = 2  # sliced, in print queur
REQUEST_STATUS_PRINTING       = 3  # currently printing
REQUEST_STATUS_INSPECTING     = 7  # Inspecting finished elment
REQUEST_STATUS_FINISHED       = 4  # done printing, waiting for recuperation
REQUEST_STATUS_CLOSED         = 5  # archived
REQUEST_STATUS_PICKED         = 6  # picked up
@@ -24,7 +25,7 @@ module.exports = {
        return hDisplay + mDisplay + sDisplay; 
    },
    available_status_code () {
        return [0, 1, 2, 3, 4, 5, 10, 11, 12]
        return [0, 1, 2, 3, 7, 4, 5, 10, 11, 12]
    },
    account_type_text (access) {
        switch (access) {
@@ -48,6 +49,8 @@ module.exports = {
                return {text: 'mdi-printer-3d', color: 'indigo'}
            case 3:
                return {text: 'mdi-printer-3d-nozzle', color: 'indigo'}
            case 7:
                return {text: 'mdi-magnify', color: 'blue'}
            case 4:
                return {text: 'mdi-check-circle', color: 'green'}
            case 5:
@@ -71,11 +74,13 @@ module.exports = {
            case 0:
                return "En attente d'approbation"
            case 1:
                return "Préparation de l'impression (slicing)"
                return "Préparation de l'impression"
            case 2:
                return "En attente d'impression"
            case 3:
                return "En cours d'impression"
            case 7:
                return "En cours d'inspection"
            case 4:
                return "Prêt à être récupéré"
            case 5: