Skip to content
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
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ src/locale/backups

# compiled output
/dist
/octoprint_octodash/static
/package
/tmp
/out-tsc
Expand Down Expand Up @@ -53,6 +54,13 @@ speed-measure-plugin.json
/libpeerconnection.log
/typings

# python
__pycache__/
*.py[cod]
*.egg*

build/


docs/images/compilation.psd
scripts/clean-github.sh
Expand Down
4 changes: 4 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
include README.md
recursive-include octoprint_octodash/templates *
recursive-include octoprint_octodash/translations *
recursive-include octoprint_octodash/static *
79 changes: 79 additions & 0 deletions Taskfile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# https://taskfile.dev

version: '3'

env:
LOCALES: [] # list your included locales here, e.g. ["de", "fr"]
TRANSLATIONS: 'octoprint_octodash/translations' # translations folder, do not touch

tasks:
install:
desc: Installs the plugin into the current venv
cmds:
- 'python -m pip install -e .[develop]'

### Build related

build:
desc: Builds sdist & wheel
cmds:
- python -m build --sdist --wheel

build-sdist:
desc: Builds sdist
cmds:
- python -m build --sdist

build-wheel:
desc: Builds wheel
cmds:
- python -m build --wheel

### Translation related

babel-new:
desc: Create a new translation for a locale
cmds:
- task: babel-extract
- |
pybabel init --input-file=translations/messages.pot --output-dir=translations --locale="{{ .CLI_ARGS }}"
babel-extract:
desc: Update pot file from source
cmds:
- pybabel extract --mapping-file=babel.cfg --output-file=translations/messages.pot --msgid-bugs-address=i18n@octoprint.org --copyright-holder="The OctoPrint Project" .

babel-update:
desc: Update translation files from pot file
cmds:
- for:
var: LOCALES
cmd: pybabel update --input-file=translations/messages.pot --output-dir=translations --locale={{ .ITEM }}

babel-refresh:
desc: Update translation files from source
cmds:
- task: babel-extract
- task: babel-update

babel-compile:
desc: Compile translation files
cmds:
- pybabel compile --directory=translations

babel-bundle:
desc: Bundle translations
preconditions:
- test -d {{ .TRANSLATIONS }}
cmds:
- for:
var: LOCALES
cmd: |
locale="{{ .ITEM }}"
source="translations/${locale}"
target="{{ .TRANSLATIONS }}/${locale}"
[ ! -d "${target}" ] || rm -r "${target}"
echo "Copying translations for locale ${locale} from ${source} to ${target}..."
cp -r "${source}" "${target}"
8 changes: 8 additions & 0 deletions babel.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[python: */**.py]

[jinja2: */**.jinja2]
silent=false
extensions=jinja2.ext.do, octoprint.util.jinja.trycatch

[javascript: */**.js]
extract_messages = gettext, ngettext
165 changes: 165 additions & 0 deletions octoprint_octodash/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
# coding=utf-8
from __future__ import absolute_import

from flask import make_response

import octoprint.plugin


class OctodashPlugin(
octoprint.plugin.SettingsPlugin,
):

##~~ SettingsPlugin mixin

def get_settings_defaults(self):
return {
"octoprint": {
"accessToken": "1t9H6i51hQLMm2eZXGAPbvRLv4iJr2Yao_LoxhE_66E",
"url": "http://localhost:8080/",
},
"printer": {
"name": "",
"xySpeed": 150,
"zSpeed": 5,
"disableExtruderGCode": "M18 E",
"zBabystepGCode": "M290 Z",
"defaultTemperatureFanSpeed": {
"hotend": 220,
"heatbed": 70,
"fan": 100,
},
},
"filament": {
"density": 1.25,
"thickness": 1.75,
"feedLength": 0,
"feedSpeed": 20,
"feedSpeedSlow": 3,
"purgeDistance": 30,
"useM600": False,
},
"plugins": {
"companion": {"enabled": True},
"displayLayerProgress": {"enabled": True},
"enclosure": {
"enabled": True,
"ambientSensorID": None,
"filament1SensorID": None,
"filament2SensorID": None,
},
"filamentManager": {"enabled": False},
"spoolManager": {"enabled": False},
"preheatButton": {"enabled": True},
"printTimeGenius": {"enabled": True},
"psuControl": {"enabled": False},
"ophom": {"enabled": False},
"tpLinkSmartPlug": {"enabled": False, "smartPlugIP": "127.0.0.1"},
"tasmota": {"enabled": False, "ip": "127.0.0.1", "index": None},
"tasmotaMqtt": {
"enabled": False,
"topic": "topic",
"relayNumber": None,
},
"tuya": {"enabled": False, "label": "label"},
"wemo": {"enabled": False, "ip": "127.0.0.1", "port": 49152},
},
"octodash": {
"customActions": [
{
"icon": "house",
"command": "G28",
"color": "#dcdde1",
"confirm": False,
"exit": True,
},
{
"icon": "ruler-vertical",
"command": "G29",
"color": "#4bae50",
"confirm": False,
"exit": True,
},
{
"icon": "fire-flame-curved",
"command": "M140 S50; M104 S185",
"color": "#e1b12c",
"confirm": False,
"exit": True,
},
{
"icon": "snowflake",
"command": "M140 S0; M104 S0",
"color": "#0097e6",
"confirm": False,
"exit": True,
},
{
"icon": "rotate-right",
"command": "[!RELOAD]",
"color": "#7f8fa6",
"confirm": True,
"exit": False,
},
{
"icon": "power-off",
"command": "[!SHUTDOWN]",
"color": "#e84118",
"confirm": True,
"exit": False,
},
],
"fileSorting": {"attribute": "name", "order": "asc"},
"invertAxisControl": {"x": False, "y": False, "z": False},
"pollingInterval": 2000,
"touchscreen": True,
"turnScreenOffWhileSleeping": False,
"turnOnPrinterWhenExitingSleep": False,
"preferPreviewWhilePrinting": False,
"previewProgressCircle": False,
"screenSleepCommand": "xset dpms force standby",
"screenWakeupCommand": "xset s off && xset -dpms && xset s noblank",
"showExtruderControl": True,
"showNotificationCenterIcon": True,
"defaultDirectory": "/",
},
}

##~~ Softwareupdate hook

def get_update_information(self):
# Define the configuration for your plugin to use with the Software Update
# Plugin here. See https://docs.octoprint.org/en/master/bundledplugins/softwareupdate.html
# for details.
return {
"octodash": {
"displayName": "Octodash Plugin",
"displayVersion": self._plugin_version,
# version check: github repository
"type": "github_release",
"user": "UnchartedBull",
"repo": "Octodash",
"current": self._plugin_version,
# update method: pip
"pip": "https://github.com/UnchartedBull/Octodash/archive/{target_version}.zip",
}
}


__plugin_name__ = "Octodash Plugin"


# Set the Python version your plugin is compatible with below. Recommended is Python 3 only for all new plugins.
# OctoPrint 1.4.0 - 1.7.x run under both Python 3 and the end-of-life Python 2.
# OctoPrint 1.8.0 onwards only supports Python 3.
__plugin_pythoncompat__ = ">=3,<4" # Only Python 3


def __plugin_load__():
global __plugin_implementation__
__plugin_implementation__ = OctodashPlugin()

global __plugin_hooks__
__plugin_hooks__ = {
"octoprint.plugin.softwareupdate.check_config": __plugin_implementation__.get_update_information
}
3 changes: 3 additions & 0 deletions octoprint_octodash/_static_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
version = "__use_git__"
branch = None
revision = None
Loading