Make basic screen with graphs, but lots of bugs.

This commit is contained in:
2019-11-05 13:27:52 -05:00
parent 08b86c44fb
commit 0d29636de7
5 changed files with 102 additions and 7 deletions

View File

@@ -3,13 +3,18 @@ name = "pypi"
url = "https://pypi.org/simple" url = "https://pypi.org/simple"
verify_ssl = true verify_ssl = true
[[source]]
name = "kivy_garden"
url = "https://kivy-garden.github.io/simple"
verify_ssl = true
[dev-packages] [dev-packages]
[packages] [packages]
Pillow = "*" Pillow = "*"
kivy = "*" kivy = "*"
kivymd = "==0.102.0" kivymd = "==0.102.0"
"kivy_garden.graph" = {version="==0.4.dev0", index="kivy_garden"}
[requires] [requires]
python_version = "3" python_version = "3"

14
Pipfile.lock generated
View File

@@ -1,7 +1,7 @@
{ {
"_meta": { "_meta": {
"hash": { "hash": {
"sha256": "7a08f394b44c221105908a4210f052b838128b14f63b2ce999aa9834380d7111" "sha256": "51bf5ddb9e803b22b92e57b842c37b473e82802072cdcb7628b4c6a07370c0c3"
}, },
"pipfile-spec": 6, "pipfile-spec": 6,
"requires": { "requires": {
@@ -12,6 +12,11 @@
"name": "pypi", "name": "pypi",
"url": "https://pypi.org/simple", "url": "https://pypi.org/simple",
"verify_ssl": true "verify_ssl": true
},
{
"name": "kivy_garden",
"url": "https://kivy-garden.github.io/simple",
"verify_ssl": true
} }
] ]
}, },
@@ -73,6 +78,13 @@
], ],
"version": "==0.1.4" "version": "==0.1.4"
}, },
"kivy-garden.graph": {
"hashes": [
"sha256:9d5938b9de98c4af610b72f9d9d2d637c4f0098fbf53278b267870f425e1bd37"
],
"index": "kivy_garden",
"version": "==0.4.dev0"
},
"kivymd": { "kivymd": {
"hashes": [ "hashes": [
"sha256:0b9fa3f5b67c08f607981e49b41f367f35e2c2bca0beffdd0e809246a5d110b7", "sha256:0b9fa3f5b67c08f607981e49b41f367f35e2c2bca0beffdd0e809246a5d110b7",

View File

@@ -3,6 +3,7 @@ kivy.require('1.10.1')
from kivy.config import Config from kivy.config import Config
Config.set('kivy', 'log_enable', 0) Config.set('kivy', 'log_enable', 0)
Config.set('modules','inspector','')
if __name__ in ('__main__', '__android__'): if __name__ in ('__main__', '__android__'):
from qiflora import QiFlora from qiflora import QiFlora

View File

@@ -1,5 +1,9 @@
from math import sin
from kivy.app import App from kivy.app import App
from kivy.clock import Clock
from kivymd.theming import ThemeManager from kivymd.theming import ThemeManager
from kivy_garden.graph import Graph, MeshLinePlot
class QiFlora(App): class QiFlora(App):
@@ -7,3 +11,9 @@ class QiFlora(App):
theme_cls.primary_palette = 'Blue' theme_cls.primary_palette = 'Blue'
theme_cls.accent_palette = 'DeepOrange' theme_cls.accent_palette = 'DeepOrange'
theme_cls.theme_style = 'Light' theme_cls.theme_style = 'Light'
def refresh_data(self, *args):
plot = MeshLinePlot(color=[1,0,0,1])
plot.points = [(x, sin(x / 10.)) for x in range(0, 101)]
self.root.ids.temp_graph.add_plot(plot)
self.root.ids.moist_graph.add_plot(plot)

View File

@@ -6,7 +6,74 @@ BoxLayout:
md_bg_color: app.theme_cls.primary_color md_bg_color: app.theme_cls.primary_color
background_palette: 'Primary' background_palette: 'Primary'
background_hue: '500' background_hue: '500'
AnchorLayout: ScrollView:
anchor_x: 'center' do_scroll_x: False
MDRaisedButton: do_scroll_y: True
text: "Fetch Updates" GridLayout:
id: graphs
padding: [10,10,10,15]
spacing: [5,10]
rows: 5
cols: 1
size_hint_y: None
height: self.minimum_height
AnchorLayout:
anchor_x: "center"
size_hint_y: None
MDRaisedButton:
text: "refresh"
on_press: app.refresh_data()
MDCard:
orientation: "vertical"
size_hint_y: None
MDLabel:
halign: "center"
text: "Temperature"
Graph:
id: temp_graph
padding: 5
xmin: -0
ymin: -1
xmax: 100
ymax: 1
x_ticks_major: 25
y_ticks_major: 1
x_grid_label: True
y_grid_label: True
x_grid: True
y_grid: True
xlabel: "temp (C)"
ylabel: "time"
MDCard:
orientation: "vertical"
size_hint_y: None
MDLabel:
halign: "center"
text: "Moisture"
Graph:
id: moist_graph
padding: 5
xmin: -0
ymin: -1
xmax: 100
ymax: 1
x_ticks_major: 25
y_ticks_major: 1
x_grid_label: True
y_grid_label: True
x_grid: True
y_grid: True
xlabel: "temp (C)"
ylabel: "time"
MDCard:
orientation: "vertical"
size_hint_y: None
MDLabel:
halign: "center"
text: "Conductivity"
MDCard:
orientation: "vertical"
size_hint_y: None
MDLabel:
halign: "center"
text: "Brightness"