initial upload
This commit is contained in:
commit
2d82a4561a
17
.editorconfig
Normal file
17
.editorconfig
Normal file
@ -0,0 +1,17 @@
|
||||
# This file is for unifying the coding style for different editors and IDEs
|
||||
# editorconfig.org
|
||||
|
||||
root = true
|
||||
|
||||
[*]
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[**.py]
|
||||
indent_style = tab
|
||||
|
||||
[**.js]
|
||||
indent_style = space
|
||||
indent_size = 4
|
9
.gitignore
vendored
Normal file
9
.gitignore
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
*.pyc
|
||||
*.swp
|
||||
.idea
|
||||
*.iml
|
||||
build
|
||||
dist
|
||||
*.egg*
|
||||
.DS_Store
|
||||
*.zip
|
4
MANIFEST.in
Normal file
4
MANIFEST.in
Normal file
@ -0,0 +1,4 @@
|
||||
include README.md
|
||||
recursive-include octoprint_unknown/templates *
|
||||
recursive-include octoprint_unknown/translations *
|
||||
recursive-include octoprint_unknown/static *
|
13
README.md
Normal file
13
README.md
Normal file
@ -0,0 +1,13 @@
|
||||
# Extra Movement Distance Buttons
|
||||
|
||||
Adds more buttons to the movement distance section
|
||||
|
||||
Distances available: 0.01, 0.1, 1, 5, 10, 50, 100, 150
|
||||
|
||||
## Setup
|
||||
|
||||
Install ~~via the bundled [Plugin Manager](https://github.com/foosel/OctoPrint/wiki/Plugin:-Plugin-Manager)
|
||||
or~~ manually using this URL:
|
||||
|
||||
https://github.com/ntoff/OctoPrint-ExtraDistance/archive/master.zip
|
||||
|
6
babel.cfg
Normal file
6
babel.cfg
Normal file
@ -0,0 +1,6 @@
|
||||
[python: */**.py]
|
||||
[jinja2: */**.jinja2]
|
||||
extensions=jinja2.ext.autoescape, jinja2.ext.with_
|
||||
|
||||
[javascript: */**.js]
|
||||
extract_messages = gettext, ngettext
|
8
extras/README.txt
Normal file
8
extras/README.txt
Normal file
@ -0,0 +1,8 @@
|
||||
Currently Cookiecutter generates the following helpful extras to this folder:
|
||||
|
||||
unknown.md
|
||||
Data file for plugins.octoprint.org. Fill in the missing TODOs once your
|
||||
plugin is ready for release and file a PR as described at
|
||||
http://plugins.octoprint.org/help/registering/ to get it published.
|
||||
|
||||
This folder may be safely removed if you don't need it.
|
89
extras/unknown.md
Normal file
89
extras/unknown.md
Normal file
@ -0,0 +1,89 @@
|
||||
---
|
||||
layout: plugin
|
||||
|
||||
id: unknown
|
||||
title: OctoPrint-Unknown
|
||||
description: TODO
|
||||
author: ntoff
|
||||
license: AGPLv3
|
||||
|
||||
# TODO
|
||||
date: today's date in format YYYY-MM-DD, e.g. 2015-04-21
|
||||
|
||||
homepage: https://github.com/ntoff/OctoPrint-Unknown
|
||||
source: https://github.com/ntoff/OctoPrint-Unknown
|
||||
archive: https://github.com/ntoff/OctoPrint-Unknown/archive/master.zip
|
||||
|
||||
# TODO
|
||||
# Set this to true if your plugin uses the dependency_links setup parameter to include
|
||||
# library versions not yet published on PyPi. SHOULD ONLY BE USED IF THERE IS NO OTHER OPTION!
|
||||
#follow_dependency_links: false
|
||||
|
||||
# TODO
|
||||
tags:
|
||||
- a list
|
||||
- of tags
|
||||
- that apply
|
||||
- to your plugin
|
||||
- (take a look at the existing plugins for what makes sense here)
|
||||
|
||||
# TODO
|
||||
screenshots:
|
||||
- url: url of a screenshot, /assets/img/...
|
||||
alt: alt-text of a screenshot
|
||||
caption: caption of a screenshot
|
||||
- url: url of another screenshot, /assets/img/...
|
||||
alt: alt-text of another screenshot
|
||||
caption: caption of another screenshot
|
||||
- ...
|
||||
|
||||
# TODO
|
||||
featuredimage: url of a featured image for your plugin, /assets/img/...
|
||||
|
||||
# TODO
|
||||
# You only need the following if your plugin requires specific OctoPrint versions or
|
||||
# specific operating systems to function - you can safely remove the whole
|
||||
# "compatibility" block if this is not the case.
|
||||
|
||||
compatibility:
|
||||
|
||||
# List of compatible versions
|
||||
#
|
||||
# A single version number will be interpretated as a minimum version requirement,
|
||||
# e.g. "1.3.1" will show the plugin as compatible to OctoPrint versions 1.3.1 and up.
|
||||
# More sophisticated version requirements can be modelled too by using PEP440
|
||||
# compatible version specifiers.
|
||||
#
|
||||
# You can also remove the whole "octoprint" block. Removing it will default to all
|
||||
# OctoPrint versions being supported.
|
||||
|
||||
octoprint:
|
||||
- 1.2.0
|
||||
|
||||
# List of compatible operating systems
|
||||
#
|
||||
# Valid values:
|
||||
#
|
||||
# - windows
|
||||
# - linux
|
||||
# - macos
|
||||
# - freebsd
|
||||
#
|
||||
# There are also two OS groups defined that get expanded on usage:
|
||||
#
|
||||
# - posix: linux, macos and freebsd
|
||||
# - nix: linux and freebsd
|
||||
#
|
||||
# You can also remove the whole "os" block. Removing it will default to all
|
||||
# operating systems being supported.
|
||||
|
||||
os:
|
||||
- linux
|
||||
- windows
|
||||
- macos
|
||||
- freebsd
|
||||
|
||||
---
|
||||
|
||||
**TODO**: Longer description of your plugin, configuration examples etc. This part will be visible on the page at
|
||||
http://plugins.octoprint.org/plugin/unknown/
|
64
octoprint_extradistance/__init__.py
Normal file
64
octoprint_extradistance/__init__.py
Normal file
@ -0,0 +1,64 @@
|
||||
# coding=utf-8
|
||||
from __future__ import absolute_import
|
||||
|
||||
import octoprint.plugin
|
||||
|
||||
class ExtraDistancePlugin(octoprint.plugin.SettingsPlugin,
|
||||
octoprint.plugin.AssetPlugin,
|
||||
octoprint.plugin.TemplatePlugin):
|
||||
|
||||
##~~ SettingsPlugin mixin
|
||||
|
||||
def get_settings_defaults(self):
|
||||
return dict(
|
||||
# put your plugin's default settings here
|
||||
)
|
||||
|
||||
##~~ AssetPlugin mixin
|
||||
|
||||
def get_assets(self):
|
||||
# Define your plugin's asset files to automatically include in the
|
||||
# core UI here.
|
||||
return dict(
|
||||
js=["js/extradistance.js"],
|
||||
css=["css/extradistance.css"],
|
||||
less=["less/extradistance.less"]
|
||||
)
|
||||
|
||||
##~~ Softwareupdate hook
|
||||
|
||||
def get_update_information(self):
|
||||
# Define the configuration for your plugin to use with the Software Update
|
||||
# Plugin here. See https://github.com/foosel/OctoPrint/wiki/Plugin:-Software-Update
|
||||
# for details.
|
||||
return dict(
|
||||
unknown=dict(
|
||||
displayName="Extra Distance Buttons",
|
||||
displayVersion=self._plugin_version,
|
||||
|
||||
# version check: github repository
|
||||
type="github_release",
|
||||
user="ntoff",
|
||||
repo="OctoPrint-ExtraDistance",
|
||||
current=self._plugin_version,
|
||||
|
||||
# update method: pip
|
||||
pip="https://github.com/ntoff/OctoPrint-ExtraDistance/archive/{target_version}.zip"
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
# If you want your plugin to be registered within OctoPrint under a different name than what you defined in setup.py
|
||||
# ("OctoPrint-PluginSkeleton"), you may define that here. Same goes for the other metadata derived from setup.py that
|
||||
# can be overwritten via __plugin_xyz__ control properties. See the documentation for that.
|
||||
__plugin_name__ = "Extra Distance Buttons"
|
||||
|
||||
def __plugin_load__():
|
||||
global __plugin_implementation__
|
||||
__plugin_implementation__ = ExtraDistancePlugin()
|
||||
|
||||
global __plugin_hooks__
|
||||
__plugin_hooks__ = {
|
||||
"octoprint.plugin.softwareupdate.check_config": __plugin_implementation__.get_update_information
|
||||
}
|
||||
|
17
octoprint_extradistance/static/css/extradistance.css
Normal file
17
octoprint_extradistance/static/css/extradistance.css
Normal file
@ -0,0 +1,17 @@
|
||||
#distance-selector {
|
||||
width: 171px;
|
||||
}
|
||||
#jog_distance {
|
||||
width: 171px;
|
||||
padding-left: 0px;
|
||||
padding-bottom: 0px;
|
||||
margin-left: 0px;
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
#jog_distance2 {
|
||||
width: 171px;
|
||||
padding-top: 0px;
|
||||
padding-left: 0px;
|
||||
margin-top: 0px;
|
||||
margin-left: 0px;
|
||||
}
|
37
octoprint_extradistance/static/js/extradistance.js
Normal file
37
octoprint_extradistance/static/js/extradistance.js
Normal file
@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Author: ntoff
|
||||
* License: AGPLv3
|
||||
*/
|
||||
$(function() {
|
||||
function ExtraDistanceViewModel(parameters) {
|
||||
var self = this;
|
||||
|
||||
self.control = parameters[0];
|
||||
|
||||
self.control.distances1 = ko.observableArray([0.01, 0.1, 1, 10]);
|
||||
self.control.distances2 = ko.observableArray([5, 50, 100, 150]);
|
||||
|
||||
if ($("#touch body").length == 0) {
|
||||
$(".distance").remove();
|
||||
$("#control-jog-z").after("\
|
||||
<div class=\"distance\" id=\"distance-selector\">\
|
||||
<div class=\"btn-group\" data-toggle=\"buttons-radio\" id=\"jog_distance1\">\
|
||||
<!-- ko foreach: distances1 -->\
|
||||
<button type=\"button\" class=\"btn distance\" data-bind=\"enable: $root.isOperational() && !$root.isPrinting() && $root.loginState.isUser(), text: $data, click: function() { $root.distance($data) }, css: { active: $root.distance() === $data }, attr: { id: 'control-distance' + $root.stripDistanceDecimal($data) }\"></button>\
|
||||
<!-- /ko -->\
|
||||
</div>\
|
||||
<div class=\"btn-group\" data-toggle=\"buttons-radio\" id=\"jog_distance2\">\
|
||||
<!-- ko foreach: distances2 -->\
|
||||
<button type=\"button\" class=\"btn distance\" data-bind=\"enable: $root.isOperational() && !$root.isPrinting() && $root.loginState.isUser(), text: $data, click: function() { $root.distance($data) }, css: { active: $root.distance() === $data }, attr: { id: 'control-distance' + $root.stripDistanceDecimal($data) }\"></button>\
|
||||
<!-- /ko -->\
|
||||
</div>\
|
||||
</div>\
|
||||
");
|
||||
}
|
||||
}
|
||||
|
||||
OCTOPRINT_VIEWMODELS.push({
|
||||
construct: ExtraDistanceViewModel,
|
||||
dependencies: [ "controlViewModel"]
|
||||
});
|
||||
});
|
18
octoprint_extradistance/static/less/extradistance.less
Normal file
18
octoprint_extradistance/static/less/extradistance.less
Normal file
@ -0,0 +1,18 @@
|
||||
// TODO: Put your plugin's LESS here, have it generated to ../css.
|
||||
#distance-selector {
|
||||
width: 171px;
|
||||
}
|
||||
#jog_distance {
|
||||
width: 171px;
|
||||
padding-left: 0px;
|
||||
padding-bottom: 0px;
|
||||
margin-left: 0px;
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
#jog_distance2 {
|
||||
width: 171px;
|
||||
padding-top: 0px;
|
||||
padding-left: 0px;
|
||||
margin-top: 0px;
|
||||
margin-left: 0px;
|
||||
}
|
1
octoprint_extradistance/templates/README.txt
Normal file
1
octoprint_extradistance/templates/README.txt
Normal file
@ -0,0 +1 @@
|
||||
Put your plugin's Jinja2 templates here.
|
9
requirements.txt
Normal file
9
requirements.txt
Normal file
@ -0,0 +1,9 @@
|
||||
###
|
||||
# This file is only here to make sure that something like
|
||||
#
|
||||
# pip install -e .
|
||||
#
|
||||
# works as expected. Requirements can be found in setup.py.
|
||||
###
|
||||
|
||||
.
|
63
setup.py
Normal file
63
setup.py
Normal file
@ -0,0 +1,63 @@
|
||||
# coding=utf-8
|
||||
|
||||
|
||||
plugin_identifier = "extradistance"
|
||||
|
||||
plugin_package = "octoprint_extradistance"
|
||||
|
||||
plugin_name = "OctoPrint-ExtraDistance"
|
||||
|
||||
plugin_version = "0.1.0"
|
||||
|
||||
plugin_description = """Adds extra movement distance buttons."""
|
||||
|
||||
plugin_author = "ntoff"
|
||||
|
||||
plugin_author_email = ""
|
||||
|
||||
plugin_url = "https://github.com/ntoff/OctoPrint-ExtraDistance"
|
||||
|
||||
|
||||
plugin_license = "AGPLv3"
|
||||
|
||||
plugin_requires = []
|
||||
|
||||
plugin_additional_data = []
|
||||
|
||||
plugin_additional_packages = []
|
||||
|
||||
plugin_ignored_packages = []
|
||||
|
||||
additional_setup_parameters = {}
|
||||
|
||||
from setuptools import setup
|
||||
|
||||
try:
|
||||
import octoprint_setuptools
|
||||
except:
|
||||
print("Could not import OctoPrint's setuptools, are you sure you are running that under "
|
||||
"the same python installation that OctoPrint is installed under?")
|
||||
import sys
|
||||
sys.exit(-1)
|
||||
|
||||
setup_parameters = octoprint_setuptools.create_plugin_setup_parameters(
|
||||
identifier=plugin_identifier,
|
||||
package=plugin_package,
|
||||
name=plugin_name,
|
||||
version=plugin_version,
|
||||
description=plugin_description,
|
||||
author=plugin_author,
|
||||
mail=plugin_author_email,
|
||||
url=plugin_url,
|
||||
license=plugin_license,
|
||||
requires=plugin_requires,
|
||||
additional_packages=plugin_additional_packages,
|
||||
ignored_packages=plugin_ignored_packages,
|
||||
additional_data=plugin_additional_data
|
||||
)
|
||||
|
||||
if len(additional_setup_parameters):
|
||||
from octoprint.util import dict_merge
|
||||
setup_parameters = dict_merge(setup_parameters, additional_setup_parameters)
|
||||
|
||||
setup(**setup_parameters)
|
28
translations/README.txt
Normal file
28
translations/README.txt
Normal file
@ -0,0 +1,28 @@
|
||||
Your plugin's translations will reside here. The provided setup.py supports a
|
||||
couple of additional commands to make managing your translations easier:
|
||||
|
||||
babel_extract
|
||||
Extracts any translateable messages (marked with Jinja's `_("...")` or
|
||||
JavaScript's `gettext("...")`) and creates the initial `messages.pot` file.
|
||||
babel_refresh
|
||||
Reruns extraction and updates the `messages.pot` file.
|
||||
babel_new --locale=<locale>
|
||||
Creates a new translation folder for locale `<locale>`.
|
||||
babel_compile
|
||||
Compiles the translations into `mo` files, ready to be used within
|
||||
OctoPrint.
|
||||
babel_pack --locale=<locale> [ --author=<author> ]
|
||||
Packs the translation for locale `<locale>` up as an installable
|
||||
language pack that can be manually installed by your plugin's users. This is
|
||||
interesting for languages you can not guarantee to keep up to date yourself
|
||||
with each new release of your plugin and have to depend on contributors for.
|
||||
|
||||
If you want to bundle translations with your plugin, create a new folder
|
||||
`octoprint_unknown/translations`. When that folder exists,
|
||||
an additional command becomes available:
|
||||
|
||||
babel_bundle --locale=<locale>
|
||||
Moves the translation for locale `<locale>` to octoprint_unknown/translations,
|
||||
effectively bundling it with your plugin. This is interesting for languages
|
||||
you can guarantee to keep up to date yourself with each new release of your
|
||||
plugin.
|
Loading…
Reference in New Issue
Block a user