Inital commit
This commit is contained in:
		
							
								
								
									
										10
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,10 @@
 | 
			
		||||
*.pyc
 | 
			
		||||
*.swp
 | 
			
		||||
.idea
 | 
			
		||||
*.iml
 | 
			
		||||
build
 | 
			
		||||
dist
 | 
			
		||||
*.egg*
 | 
			
		||||
.DS_Store
 | 
			
		||||
*.zip
 | 
			
		||||
.atom
 | 
			
		||||
							
								
								
									
										4
									
								
								MANIFEST.in
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								MANIFEST.in
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,4 @@
 | 
			
		||||
include README.md
 | 
			
		||||
recursive-include octoprint_webcamtab/templates *
 | 
			
		||||
recursive-include octoprint_webcamtab/translations *
 | 
			
		||||
recursive-include octoprint_webcamtab/static *
 | 
			
		||||
							
								
								
									
										17
									
								
								README.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								README.md
									
									
									
									
									
										Normal file
									
								
							@@ -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).
 | 
			
		||||
							
								
								
									
										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
 | 
			
		||||
							
								
								
									
										57
									
								
								octoprint_webcamtab/__init__.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										57
									
								
								octoprint_webcamtab/__init__.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,57 @@
 | 
			
		||||
# coding=utf-8
 | 
			
		||||
from __future__ import absolute_import
 | 
			
		||||
 | 
			
		||||
__author__ = "Sven Lohrmann <malnvenshorn@gmail.com>"
 | 
			
		||||
__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
 | 
			
		||||
    }
 | 
			
		||||
							
								
								
									
										28
									
								
								octoprint_webcamtab/static/js/webcamtab.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								octoprint_webcamtab/static/js/webcamtab.js
									
									
									
									
									
										Normal file
									
								
							@@ -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, ...
 | 
			
		||||
        [ /* ... */ ]
 | 
			
		||||
    ]);
 | 
			
		||||
});
 | 
			
		||||
							
								
								
									
										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.
 | 
			
		||||
###
 | 
			
		||||
 | 
			
		||||
.
 | 
			
		||||
							
								
								
									
										51
									
								
								setup.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										51
									
								
								setup.py
									
									
									
									
									
										Normal file
									
								
							@@ -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)
 | 
			
		||||
		Reference in New Issue
	
	Block a user