commit ff752b34c4e2fc4eb65dd51e89e1c785947a7123 Author: malnvenshorn Date: Fri Aug 18 12:17:26 2017 +0200 Inital commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..22a9a90 --- /dev/null +++ b/.gitignore @@ -0,0 +1,10 @@ +*.pyc +*.swp +.idea +*.iml +build +dist +*.egg* +.DS_Store +*.zip +.atom diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..29f764a --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,4 @@ +include README.md +recursive-include octoprint_webcamtab/templates * +recursive-include octoprint_webcamtab/translations * +recursive-include octoprint_webcamtab/static * diff --git a/README.md b/README.md new file mode 100644 index 0000000..ee20280 --- /dev/null +++ b/README.md @@ -0,0 +1,17 @@ +# OctoPrint-WebcamTab + +**TODO:** Describe what your plugin does. + +## Setup + +Install via the bundled [Plugin Manager](https://github.com/foosel/OctoPrint/wiki/Plugin:-Plugin-Manager) +or manually using this URL: + + https://github.com/malnvenshorn/OctoPrint-WebcamTab/archive/master.zip + +**TODO:** Describe how to install your plugin, if more needs to be done than just installing it via pip or through +the plugin manager. + +## Configuration + +**TODO:** Describe your plugin's configuration options (if any). diff --git a/babel.cfg b/babel.cfg new file mode 100644 index 0000000..b6f5945 --- /dev/null +++ b/babel.cfg @@ -0,0 +1,6 @@ +[python: */**.py] +[jinja2: */**.jinja2] +extensions=jinja2.ext.autoescape, jinja2.ext.with_ + +[javascript: */**.js] +extract_messages = gettext, ngettext diff --git a/octoprint_webcamtab/__init__.py b/octoprint_webcamtab/__init__.py new file mode 100644 index 0000000..fafff9b --- /dev/null +++ b/octoprint_webcamtab/__init__.py @@ -0,0 +1,57 @@ +# coding=utf-8 +from __future__ import absolute_import + +__author__ = "Sven Lohrmann " +__license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html" +__copyright__ = "Copyright (C) 2017 Sven Lohrmann - Released under terms of the AGPLv3 License" + +import octoprint.plugin + + +class WebcamTabPlugin(octoprint.plugin.SettingsPlugin, + octoprint.plugin.AssetPlugin, + octoprint.plugin.TemplatePlugin): + + # SettingsPlugin mixin + + def get_settings_defaults(self): + return dict() + + # AssetPlugin mixin + + def get_assets(self): + return dict( + js=["js/webcamtab.js"] + ) + + # Softwareupdate hook + + def get_update_information(self): + return dict( + webcamtab=dict( + displayName="Webcam Tab", + displayVersion=self._plugin_version, + + # version check: github repository + type="github_release", + user="malnvenshorn", + repo="OctoPrint-WebcamTab", + current=self._plugin_version, + + # update method: pip + pip="https://github.com/malnvenshorn/OctoPrint-WebcamTab/archive/{target_version}.zip" + ) + ) + + +__plugin_name__ = "Webcam Tab" + + +def __plugin_load__(): + global __plugin_implementation__ + __plugin_implementation__ = WebcamTabPlugin() + + global __plugin_hooks__ + __plugin_hooks__ = { + "octoprint.plugin.softwareupdate.check_config": __plugin_implementation__.get_update_information + } diff --git a/octoprint_webcamtab/static/js/webcamtab.js b/octoprint_webcamtab/static/js/webcamtab.js new file mode 100644 index 0000000..6ec1aef --- /dev/null +++ b/octoprint_webcamtab/static/js/webcamtab.js @@ -0,0 +1,28 @@ +/* + * View model for OctoPrint-WebcamTab + * + * Author: Sven Lohrmann + * License: AGPLv3 + */ +$(function() { + function WebcamTabViewModel(parameters) { + var self = this; + + // assign the injected parameters, e.g.: + // self.loginStateViewModel = parameters[0]; + // self.settingsViewModel = parameters[1]; + + // TODO: Implement your plugin's view model here. + } + + // view model class, parameters for constructor, container to bind to + OCTOPRINT_VIEWMODELS.push([ + WebcamTabViewModel, + + // e.g. loginStateViewModel, settingsViewModel, ... + [ /* "loginStateViewModel", "settingsViewModel" */ ], + + // e.g. #settings_plugin_webcamtab, #tab_plugin_webcamtab, ... + [ /* ... */ ] + ]); +}); diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..a1dc463 --- /dev/null +++ b/requirements.txt @@ -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. +### + +. diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..7e92fd5 --- /dev/null +++ b/setup.py @@ -0,0 +1,51 @@ +# coding=utf-8 +from setuptools import setup + +######################################################################################################################## + +plugin_identifier = "webcamtab" +plugin_package = "octoprint_webcamtab" +plugin_name = "OctoPrint-WebcamTab" +plugin_version = "0.1.0" +plugin_description = """Moves webcam stream in own tab""" +plugin_author = "Sven Lohrmann" +plugin_author_email = "malnvenshorn@gmail.com" +plugin_url = "https://github.com/malnvenshorn/OctoPrint-WebcamTab" +plugin_license = "AGPLv3" +plugin_requires = [] +plugin_additional_data = [] +plugin_additional_packages = [] +plugin_ignored_packages = [] +additional_setup_parameters = {} + +######################################################################################################################## + +try: + import octoprint_setuptools +except ImportError: + 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)