Просмотр исходного кода

Merge pull request #9 from swimIan/master

update 9/6/17
pull/105/head
swimIan GitHub 8 лет назад
Родитель
Сommit
dc908268dd
12 измененных файлов: 88 добавлений и 6126 удалений
  1. +5
    -0
      .gitignore
  2. +3
    -1
      modules/__init__.py
  3. +2
    -3
      modules/addon/endpoints.py
  4. +1
    -0
      modules/base_plugins/one_wire/__init__.py
  5. +3
    -3
      modules/core/core.py
  6. +2
    -1
      modules/core/props.py
  7. +3
    -2
      modules/ui/endpoints.py
  8. +0
    -6006
      modules/ui/package-lock.json
  9. +22
    -5
      modules/ui/src/App.css
  10. +3
    -3
      modules/ui/src/index.css
  11. +44
    -47
      modules/ui/static/bundle.js
  12. +0
    -55
      modules/ui/static/index.html

+ 5
- 0
.gitignore Просмотреть файл

@@ -9,6 +9,11 @@ modules/plugins/*
!modules/plugins/__init__.py !modules/plugins/__init__.py
*.pyc *.pyc
*.js *.js
*.css
modules/ui/package.json modules/ui/package.json


modules/ui/.babelrc modules/ui/.babelrc
yarn.lock


modules/ui/package-lock.json

+ 3
- 1
modules/__init__.py Просмотреть файл

@@ -29,7 +29,7 @@ import modules.sensors
import modules.actor import modules.actor
import modules.notification import modules.notification
import modules.fermenter import modules.fermenter
import modules.addon
from modules.addon.endpoints import initPlugins
import modules.ui import modules.ui
import modules.system import modules.system
import modules.buzzer import modules.buzzer
@@ -37,6 +37,7 @@ import modules.stats
import modules.kettle import modules.kettle
import modules.recipe_import import modules.recipe_import
import modules.core.db_mirgrate import modules.core.db_mirgrate
from app_config import cbpi from app_config import cbpi
# Build the database: # Build the database:
# This will create the database file using SQLAlchemy # This will create the database file using SQLAlchemy
@@ -59,6 +60,7 @@ def init_db():
pass pass
init_db() init_db()
initPlugins()
cbpi.run_init() cbpi.run_init()
cbpi.run_background_processes() cbpi.run_background_processes()


+ 2
- 3
modules/addon/endpoints.py Просмотреть файл

@@ -188,9 +188,8 @@ def loadPlugins():
cbpi.notify("Failed to load plugin %s " % filename, str(e), type="danger", timeout=None) cbpi.notify("Failed to load plugin %s " % filename, str(e), type="danger", timeout=None)
cbpi.app.logger.error(e) cbpi.app.logger.error(e)


@cbpi.initalizer(order=1)
def initPlugins(app):

#@cbpi.initalizer(order=1)
def initPlugins():
loadCorePlugins() loadCorePlugins()
loadPlugins() loadPlugins()




+ 1
- 0
modules/base_plugins/one_wire/__init__.py Просмотреть файл

@@ -18,6 +18,7 @@ def getSensors():
arr = [] arr = []
for dirname in os.listdir('/sys/bus/w1/devices'): for dirname in os.listdir('/sys/bus/w1/devices'):
if (dirname.startswith("28") or dirname.startswith("10")): if (dirname.startswith("28") or dirname.startswith("10")):
cbpi.app.logger.info("Device %s Found (Family: 28/10, Thermometer on GPIO4 (w1))" % dirname)
arr.append(dirname) arr.append(dirname)
return arr return arr
except: except:


+ 3
- 3
modules/core/core.py Просмотреть файл

@@ -274,11 +274,11 @@ class CraftBeerPi(ActorAPI, SensorAPI):
if isinstance(tmpObj.__getattribute__(m), Property.Number): if isinstance(tmpObj.__getattribute__(m), Property.Number):
t = tmpObj.__getattribute__(m) t = tmpObj.__getattribute__(m)
self.cache[key][name]["properties"].append( self.cache[key][name]["properties"].append(
{"name": m, "label": t.label, "type": "number", "configurable": t.configurable, "description": t.description})
{"name": m, "label": t.label, "type": "number", "configurable": t.configurable, "description": t.description, "default_value": t.default_value})
elif isinstance(tmpObj.__getattribute__(m), Property.Text): elif isinstance(tmpObj.__getattribute__(m), Property.Text):
t = tmpObj.__getattribute__(m) t = tmpObj.__getattribute__(m)
self.cache[key][name]["properties"].append( self.cache[key][name]["properties"].append(
{"name": m, "label": t.label, "type": "text", "configurable": t.configurable, "description": t.description})
{"name": m, "label": t.label, "type": "text", "configurable": t.configurable, "default_value": t.default_value, "description": t.description})
elif isinstance(tmpObj.__getattribute__(m), Property.Select): elif isinstance(tmpObj.__getattribute__(m), Property.Select):
t = tmpObj.__getattribute__(m) t = tmpObj.__getattribute__(m)
self.cache[key][name]["properties"].append( self.cache[key][name]["properties"].append(
@@ -356,7 +356,7 @@ class CraftBeerPi(ActorAPI, SensorAPI):
self.cache[key][name]["properties"].append({"name": m, "label": t.label, "type": "number", "configurable": t.configurable, "default_value": t.default_value, "description": t.description}) self.cache[key][name]["properties"].append({"name": m, "label": t.label, "type": "number", "configurable": t.configurable, "default_value": t.default_value, "description": t.description})
elif isinstance(tmpObj.__getattribute__(m), StepProperty.Text): elif isinstance(tmpObj.__getattribute__(m), StepProperty.Text):
t = tmpObj.__getattribute__(m) t = tmpObj.__getattribute__(m)
self.cache[key][name]["properties"].append({"name": m, "label": t.label, "type": "text", "configurable": t.configurable, "description": t.description})
self.cache[key][name]["properties"].append({"name": m, "label": t.label, "type": "text", "configurable": t.configurable, "default_value": t.default_value, "description": t.description})
elif isinstance(tmpObj.__getattribute__(m), StepProperty.Select): elif isinstance(tmpObj.__getattribute__(m), StepProperty.Select):
t = tmpObj.__getattribute__(m) t = tmpObj.__getattribute__(m)
self.cache[key][name]["properties"].append({"name": m, "label": t.label, "type": "select", "configurable": True, "options": t.options, "description": t.description}) self.cache[key][name]["properties"].append({"name": m, "label": t.label, "type": "select", "configurable": True, "options": t.options, "description": t.description})


+ 2
- 1
modules/core/props.py Просмотреть файл

@@ -22,6 +22,7 @@ class Property(object):
PropertyType.__init__(self) PropertyType.__init__(self)
self.label = label self.label = label
self.configurable = configurable self.configurable = configurable
self.default_value = default_value
self.description = description self.description = description


class Actor(PropertyType): class Actor(PropertyType):
@@ -64,4 +65,4 @@ class StepProperty(Property):
PropertyType.__init__(self) PropertyType.__init__(self)
self.label = label self.label = label
self.configurable = True self.configurable = True
self.description = description
self.description = description

+ 3
- 2
modules/ui/endpoints.py Просмотреть файл

@@ -1,5 +1,6 @@
from flask import Blueprint, render_template, request
from modules import cbpi
from flask import Blueprint

from modules import cbpi


react = Blueprint('react', __name__, template_folder='templates', static_folder='static') react = Blueprint('react', __name__, template_folder='templates', static_folder='static')




+ 0
- 6006
modules/ui/package-lock.json
Разница между файлами не показана из-за своего большого размера
Просмотреть файл


+ 22
- 5
modules/ui/src/App.css Просмотреть файл

@@ -1,6 +1,3 @@
.App {

}


.container { .container {
padding-right: 5px; padding-right: 5px;
@@ -10,7 +7,27 @@
} }


.container-fluid { .container-fluid {
padding-right: 5px;
padding-left: 5px;
padding-right: 5px;
padding-left: 5px;


} }

.col-xs-1, .col-sm-1, .col-md-1, .col-lg-1, .col-xs-2, .col-sm-2, .col-md-2, .col-lg-2, .col-xs-3, .col-sm-3, .col-md-3, .col-lg-3, .col-xs-4, .col-sm-4, .col-md-4, .col-lg-4, .col-xs-5, .col-sm-5, .col-md-5, .col-lg-5, .col-xs-6, .col-sm-6, .col-md-6, .col-lg-6, .col-xs-7, .col-sm-7, .col-md-7, .col-lg-7, .col-xs-8, .col-sm-8, .col-md-8, .col-lg-8, .col-xs-9, .col-sm-9, .col-md-9, .col-lg-9, .col-xs-10, .col-sm-10, .col-md-10, .col-lg-10, .col-xs-11, .col-sm-11, .col-md-11, .col-lg-11, .col-xs-12, .col-sm-12, .col-md-12, .col-lg-12 {
position: relative;
min-height: 1px;
padding-right: 8px;
padding-left: 8px;
}

.panel-heading {
padding: 5px 5px;
}

.panel-footer {
padding: 2px 2px;
}

.modal-footer {
padding: 5px;
}


+ 3
- 3
modules/ui/src/index.css Просмотреть файл

@@ -1,5 +1,5 @@
body { body {
margin: 0;
padding: 0;
font-family: sans-serif;
margin: 0;
padding: 0;
font-family: sans-serif;
} }

+ 44
- 47
modules/ui/static/bundle.js
Разница между файлами не показана из-за своего большого размера
Просмотреть файл


+ 0
- 55
modules/ui/static/index.html Просмотреть файл

@@ -10,67 +10,12 @@
<link rel="stylesheet" href="static/bootstrap.dark.css"> <link rel="stylesheet" href="static/bootstrap.dark.css">




<style>





.col-xs-1, .col-sm-1, .col-md-1, .col-lg-1, .col-xs-2, .col-sm-2, .col-md-2, .col-lg-2, .col-xs-3, .col-sm-3, .col-md-3, .col-lg-3, .col-xs-4, .col-sm-4, .col-md-4, .col-lg-4, .col-xs-5, .col-sm-5, .col-md-5, .col-lg-5, .col-xs-6, .col-sm-6, .col-md-6, .col-lg-6, .col-xs-7, .col-sm-7, .col-md-7, .col-lg-7, .col-xs-8, .col-sm-8, .col-md-8, .col-lg-8, .col-xs-9, .col-sm-9, .col-md-9, .col-lg-9, .col-xs-10, .col-sm-10, .col-md-10, .col-lg-10, .col-xs-11, .col-sm-11, .col-md-11, .col-lg-11, .col-xs-12, .col-sm-12, .col-md-12, .col-lg-12 {
position: relative;
min-height: 1px;
padding-right: 8px;
padding-left: 8px;
}

.panel-heading {
padding: 5px 5px;

}

.panel-footer {
padding: 2px 2px;

}

.modal-footer {
padding: 5px;


}
.row {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex !important;
flex-wrap: wrap;
}

.row > [class*='col-'] {
display: flex;
flex-direction: column;
}



/* Einschränken des sichtbaren Ausschnitts */



</style>
<title>CraftBeerPi 3.0</title> <title>CraftBeerPi 3.0</title>
</head> </head>
<body> <body>
<div id="root" ></div> <div id="root" ></div>
<script src="static/bundle.js" type="text/javascript"></script> <script src="static/bundle.js" type="text/javascript"></script>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.

You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.


To begin the development, run `npm start`.
To create a production bundle, use `npm run build`.
-->
</body> </body>
</html> </html>

Загрузка…
Отмена
Сохранить