How to use the octoprint.plugin.AssetPlugin function in OctoPrint

To help you get started, we’ve selected a few OctoPrint examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github xyzaxyz / OctoPrint-Finetunerptr / octoprint_finetunerptr / __init__.py View on Github external
# coding=utf-8
from __future__ import absolute_import
import octoprint.plugin
import octoprint.server

class FineTuneRptrPlugin(octoprint.plugin.AssetPlugin,
                         octoprint.plugin.TemplatePlugin):
    def get_assets(self):
        return dict( js=[
            "js/util.js",
            "js/categorizedEeprom.js",
            "js/finetunerptr.js"],
            css=["css/style.css"]
        )

    def get_template_configs(self):
        return [ dict(type="navbar", template="finetunerptr.html.j2", custom_bindings=True) ]

    def get_update_information(self):
    	return dict(
            RepetierMaintenanceHelper=dict(
                displayName="FineTuneRptr",
github vitormhenrique / OctoPrint-Enclosure / octoprint_enclosure / __init__.py View on Github external
import time
import sys
import glob
import os
from datetime import datetime
from datetime import timedelta
import octoprint.util
import requests
import inspect
import threading
import json
import copy


class EnclosurePlugin(octoprint.plugin.StartupPlugin, octoprint.plugin.TemplatePlugin, octoprint.plugin.SettingsPlugin,
                      octoprint.plugin.AssetPlugin, octoprint.plugin.BlueprintPlugin,
                      octoprint.plugin.EventHandlerPlugin):
    rpi_outputs = []
    rpi_inputs = []
    waiting_temperature = []
    rpi_outputs_not_changed = []
    notifications = []
    pwm_instances = []
    event_queue = []
    temp_hum_control_status = []
    temperature_sensor_data = []
    last_filament_end_detected = []
    print_complete = False
    development_mode = False
    dummy_value = 30.0
    dummy_delta = 0.5
github gdombiak / OctoPrint-OctoPod / octoprint_octopod / __init__.py View on Github external
from octoprint.events import eventManager, Events
from octoprint.server import user_permission
from octoprint.util import RepeatedTimer
from .job_notifications import JobNotifications
from .bed_notifications import BedNotifications
from .tools_notifications import ToolsNotifications
from .mmu import MMUAssistance
from .paused_for_user import PausedForUser
from .palette2 import Palette2Notifications


# Plugin that stores APNS tokens reported from iOS devices to know which iOS devices to alert
# when print is done or other relevant events

class OctopodPlugin(octoprint.plugin.SettingsPlugin,
					octoprint.plugin.AssetPlugin,
					octoprint.plugin.TemplatePlugin,
					octoprint.plugin.StartupPlugin,
					octoprint.plugin.SimpleApiPlugin,
					octoprint.plugin.EventHandlerPlugin):

	def __init__(self):
		super(OctopodPlugin, self).__init__()
		self._logger = logging.getLogger("octoprint.plugins.octopod")
		self._checkTempTimer = None
		self._job_notifications = JobNotifications(self._logger)
		self._tool_notifications = ToolsNotifications(self._logger)
		self._bed_notifications = BedNotifications(self._logger)
		self._mmu_assitance = MMUAssistance(self._logger)
		self._paused_for_user = PausedForUser(self._logger)
		self._palette2 = Palette2Notifications(self._logger)
github ieatacid / OctoPrint-TerminalCommands / octoprint_TerminalCommands / __init__.py View on Github external
# coding=utf-8
from __future__ import absolute_import

import octoprint.plugin

class TerminalCommandsPlugin(octoprint.plugin.SettingsPlugin,
                             octoprint.plugin.AssetPlugin,
                             octoprint.plugin.TemplatePlugin):

	def get_settings_defaults(self):
		return dict(
			controls=[]
		)

	def get_assets(self):
		return dict(
			js=["js/TerminalCommands.js"],
			css=["css/TerminalCommands.css"]
		)

	def get_template_configs(self):
		return [
            dict(type="settings", custom_bindings=True)
github michaelnew / Octoprint-Print-Queue / octoprint_print_queue / __init__.py View on Github external
# coding=utf-8
from __future__ import absolute_import

import octoprint.plugin
from pprint import pprint
from octoprint.server import printer, NO_CONTENT
import flask, json
import os

class PrintQueuePlugin(octoprint.plugin.StartupPlugin,
    octoprint.plugin.TemplatePlugin,
    octoprint.plugin.SettingsPlugin,
    octoprint.plugin.AssetPlugin,
    octoprint.plugin.BlueprintPlugin,
    octoprint.plugin.EventHandlerPlugin):

    printqueue = []
    selected_file = ""
    uploads_dir = "/home/pi/.octoprint/uploads/"

# StartupPlugin
    def on_after_startup(self):
        self._print_queue_file_path = os.path.join(self.get_plugin_data_folder(), "print_queue.yaml")
        self._configuration_dict = None
        self._getConfigurationFile()

# BluePrintPlugin (api requests)
    @octoprint.plugin.BlueprintPlugin.route("/scriptget", methods=["GET"])
    def getMaterialsData(self):
github tohara / OctoPrint-BigBoxFirmware / octoprint_bigboxfirmware / __init__.py View on Github external
import flask
import json
import os
import octoprint.plugin
import httplib2
import octoprint.server.util.flask
from octoprint.server import admin_permission
from octoprint.events import Events
from subprocess import call, Popen, PIPE
import threading
import time
import re

class BigBoxFirmwarePlugin(octoprint.plugin.BlueprintPlugin,
                           octoprint.plugin.TemplatePlugin,
                           octoprint.plugin.AssetPlugin,
                           octoprint.plugin.SettingsPlugin,
                           octoprint.plugin.EventHandlerPlugin,
                           octoprint.plugin.StartupPlugin):
    
    def __init__(self):
        self.templates = ('Configuration.h', 'Configuration_adv.h', 'pins_RUMBA.h')
        self.depList = ['avr-libc', 'avrdude', 'make']
        self.depInstalled = False
        
    def on_startup(self, host, port):
        self.depInstalled = self.check_dep()
        self.getDefLib()
               
    def on_after_startup(self):
        dataFolder = self.get_plugin_data_folder()
        profileFolder = dataFolder + '/profiles'
github dieki-n / Octoprint-Filament-Scale / octoprint_filament_scale / __init__.py View on Github external
# coding=utf-8
from __future__ import absolute_import
import sys


import octoprint.plugin
import flask
import threading
from .hx711 import HX711
import RPi.GPIO as GPIO

class Filament_scalePlugin(octoprint.plugin.SettingsPlugin,
						   octoprint.plugin.AssetPlugin,
						   octoprint.plugin.TemplatePlugin,
						   octoprint.plugin.StartupPlugin):


	def get_template_configs(self):
		return [
			dict(type="settings", custom_bindings=True)
		]
	
	def get_settings_defaults(self):
		return dict(
			tare = 8430152,
			reference_unit=-411,
			spool_weight=200,
			clockpin=21,
			datapin=20,
github ntoff / OctoPrint-FanSpeedSlider / octoprint_fanspeedslider / __init__.py View on Github external
# coding=utf-8
from __future__ import absolute_import

from decimal import *
import re
import octoprint.plugin

class FanSliderPlugin(octoprint.plugin.StartupPlugin,
					octoprint.plugin.TemplatePlugin,
					octoprint.plugin.SettingsPlugin,
					octoprint.plugin.AssetPlugin):
					
	def __init__(self):
		self.minPWM=0,
		self.maxPWM=255,
		self.lockfan=False

	def on_after_startup(self):
		self.get_settings_updates()

	def get_settings_defaults(self):
		return dict(
			defaultFanSpeed=100,
			minSpeed=0,
			maxSpeed=100,
			notifyDelay=4000,
			lockfan=False,
github synman / Octoprint-Bettergrblsupport / octoprint_bettergrblsupport / __init__.py View on Github external
# import sys
import time
import math
import os
import subprocess

import octoprint.plugin
import re
import logging
import json
import flask

class BetterGrblSupportPlugin(octoprint.plugin.SettingsPlugin,
                              octoprint.plugin.SimpleApiPlugin,
                              octoprint.plugin.AssetPlugin,
                              octoprint.plugin.TemplatePlugin,
                              octoprint.plugin.StartupPlugin,
                              octoprint.plugin.EventHandlerPlugin):

    def __init__(self):
        self.hideTempTab = True
        self.hideControlTab = True
        self.hideGCodeTab = True
        self.customControls = False
        self.helloCommand = "M5"
        self.statusCommand = "?$G"
        self.dwellCommand = "G4 P0"
        self.positionCommand = "?"
        self.suppressM114 = True
        self.suppressM400 = True
        self.suppressM105 = True