Skip to content

Instantly share code, notes, and snippets.

View ilovetogetspamed's full-sized avatar

cfo64nc ilovetogetspamed

  • Rutherfordton, NC
View GitHub Profile
@ilovetogetspamed
ilovetogetspamed / dispatcher.py
Created July 15, 2016 14:43
A Python Command Dispatcher
"""
This is the list of recognized commands.
"""
class Dispatcher():
def __init__(self):
self.cmd_list = {
'0': self.cmd_0,
McuProtocol is a twisted protocol
...
class McuProtocol(basic.LineReceiver):
def
def mcu_requested_shaft_delay_milliseconds(self, *args):
"""
The MCU requested the shaft delay milliseconds from the config.
@ilovetogetspamed
ilovetogetspamed / demo.py
Created September 26, 2016 16:09
Can't get on_current_user to fire. Trying to figure out how to use EventDispatcher class.
from kivy.uix.boxlayout import BoxLayout
from kivy.app import App
from kivy.uix.button import Button
from kivy.event import EventDispatcher
from kivy.properties import DictProperty
class UserManger(EventDispatcher):
current_user = DictProperty({'rfid_tag': '', 'nickname': '', 'logged_in': False})
from kivy.config import Config
Config.set('kivy', 'log_level', 'debug')
from kivy.app import App
from kivy.lang import Builder
from kivy.factory import Factory
from kivy.uix.boxlayout import BoxLayout
from kivy.logger import Logger
from kivy.clock import Clock
@ilovetogetspamed
ilovetogetspamed / py_sendmail.py
Created October 27, 2016 20:36
Sendmail via SMTP using Python smtplib
import smtplib
fromaddr = 'anye...@gmail.com'
toaddrs = 'myfr...@gmail.com'
msg = 'some one is using this app'
username = 'anyem...@gmail.com'
password = 'password'
server = smtplib.SMTP('smtp.gmail.com:587')
server.starttls()
server.login(username,password)
server.sendmail(fromaddr, toaddrs, msg)
bash-3.2$ python main.py 2>&1 1>/tmp/kivy_last_log.txt
[INFO ] [Logger ] Record log in /Users/cfo64nc/.kivy/logs/kivy_16-12-14_56.txt
[INFO ] [Kivy ] v1.9.1
[INFO ] [Python ] v2.7.10 (default, Oct 23 2015, 19:19:21)
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.5)]
Traceback (most recent call last):
File "main.py", line 24, in <module>
install_twisted_reactor()
File "/Library/Python/2.7/site-packages/kivy/support.py", line 164, in install_twisted_reactor
import twisted
[{u'hold_maintenance_reason': u'Breaking Bits', u'id': 4},
{u'hold_maintenance_reason': u'Head Down', u'id': 3},
{u'hold_maintenance_reason': u'Machine will not start', u'id': 1},
{u'hold_maintenance_reason': u'Making Noise', u'id': 5},
{u'hold_maintenance_reason': u'No Power', u'id': 2},
{u'hold_maintenance_reason': u'Panel not functioning', u'id': 6}]
# need to have it look like this for the spinner.values I think.
['Machine will not start',
ButtonFocusRoot:
<ButtonFocusRoot>:
ButtonFocusForm
<ButtonFocusForm>:
orientation: "vertical"
BoxLayout:
height: "40dp"
size_hint_y: None
@ilovetogetspamed
ilovetogetspamed / bad_checkbox.py
Last active March 15, 2017 14:58
Can't Get my checkbox to check/uncheck
#!/usr/bin/env python
from kivy.base import runTouchApp
from kivy.lang import Builder
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.checkbox import CheckBox
class NetworkConfig(BoxLayout):
def __init__(self, *args, **kwargs):
super(NetworkConfig, self).__init__(*args, **kwargs)
#!/usr/bin/env python
from kivy.base import runTouchApp
from kivy.lang import Builder
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.checkbox import CheckBox
class NetworkConfig(BoxLayout):
def __init__(self, *args, **kwargs):
super(NetworkConfig, self).__init__(*args, **kwargs)