本文整理汇总了Python中MVC.MVC.loadDriver方法的典型用法代码示例。如果您正苦于以下问题:Python MVC.loadDriver方法的具体用法?Python MVC.loadDriver怎么用?Python MVC.loadDriver使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MVC.MVC
的用法示例。
在下文中一共展示了MVC.loadDriver方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: sensor_sht1x
# 需要导入模块: from MVC import MVC [as 别名]
# 或者: from MVC.MVC import loadDriver [as 别名]
def sensor_sht1x():
global verbose
if verbose:
print 'SHTX Sensor'
GPIO = MVC.loadDriver( 'GPIO' )
reading = GPIO.read_sht1x()
return reading
示例2: __init__
# 需要导入模块: from MVC import MVC [as 别名]
# 或者: from MVC.MVC import loadDriver [as 别名]
def __init__( self ):
self.Renderer = MVC.loadDriver('Renderer')
self.Renderer.layout = 'admin/layout.html'
self.Renderer.layout_args = {
'ga_tracker' : '',
'cdn' : MVC.server['cdn'],
'production' : MVC.server['production']
}
示例3: prowl_alerts
# 需要导入模块: from MVC import MVC [as 别名]
# 或者: from MVC.MVC import loadDriver [as 别名]
def prowl_alerts( self, message ):
UserModel = MVC.loadModel( 'User' )
users = UserModel.getUsersWithMeta( 'prowl-apikey' )
Prowl = MVC.loadDriver('Prowl')
for user in users:
Prowl.send( user['meta']['prowl-apikey'], message[0], message[1], 1 )
# End File: models/ModelAlert.py
示例4: messaging
# 需要导入模块: from MVC import MVC [as 别名]
# 或者: from MVC.MVC import loadDriver [as 别名]
def messaging( self, message ):
if Settings.get_option('use-prowl'):
Prowl = MVC.loadDriver('Prowl')
prowl_api_key = Settings.get_option('prowl-apikey')
Prowl.send( prowl_api_key, message[0], message[1], 1 )
# End File: models/ModelAlert.py
示例5: lighting
# 需要导入模块: from MVC import MVC [as 别名]
# 或者: from MVC.MVC import loadDriver [as 别名]
def lighting( self, status ):
Serial = MVC.loadDriver('Serial')
if status == 'on':
status = True
elif status == 'off':
status = False
else:
print 'ERROR must have on/off status'
sys.exit()
for light in self.get_lights():
Serial.outlet( light[3], status )
self.log_use( light[0], 0, status )
示例6: MVC
# 需要导入模块: from MVC import MVC [as 别名]
# 或者: from MVC.MVC import loadDriver [as 别名]
#!/usr/bin/python
# Settings Helper
# @description
# This class aids managing settings in a meta-key / meta-value way
# @requirements ( drivers/DriverMySql )
import sys
import os
sys.path.append( os.path.join(os.path.dirname(__file__), '..', '') )
from MVC import MVC
MVC = MVC()
# End file header
Mysql = MVC.loadDriver('Mysql')
class HelperSettings( object ):
def __init__( self ):
self.table_name = 'options'
def get_option( self, meta_key, bool = False ):
options = Mysql.ex( "SELECT * FROM %s.%s WHERE meta_key = '%s';" % ( MVC.db['name'], self.table_name, meta_key ) )
try:
options[0]
except Exception:
return False
if bool:
if options[0] == '1':
示例7: __init__
# 需要导入模块: from MVC import MVC [as 别名]
# 或者: from MVC.MVC import loadDriver [as 别名]
def __init__( self ):
self.Renderer = MVC.loadDriver('Renderer')
self.Renderer.layout_h = 'admin/layout/header.html'
self.Renderer.layout_f = 'admin/layout/footer.html'
示例8: error_page_404
# 需要导入模块: from MVC import MVC [as 别名]
# 或者: from MVC.MVC import loadDriver [as 别名]
def error_page_404( status, message, traceback, version ):
Renderer = MVC.loadDriver('Renderer')
return Renderer.make( 'errors/404.html', header = False )
示例9: __init__
# 需要导入模块: from MVC import MVC [as 别名]
# 或者: from MVC.MVC import loadDriver [as 别名]
def __init__( self ):
self.Renderer = MVC.loadDriver('Renderer')
示例10: MVC
# 需要导入模块: from MVC import MVC [as 别名]
# 或者: from MVC.MVC import loadDriver [as 别名]
import sys
import os
sys.path.append( '../../', )
from MVC import MVC
MVC = MVC()
# End file header
import re
import urllib
import urllib2
from urlparse import urlparse
from bs4 import BeautifulSoup
from datetime import datetime
Misc = MVC.loadHelper('Misc')
TorScrape = MVC.loadDriver('TorScrape')
class DriverGoogleNews( object ):
def get( self, search_query ):
"""
Fetches RSS query from google news, follows article links
and returns the result out.
@params:
search_query : str()
@return:
[ {
'headline' : str(),
'source' : str(),
'url' : str(),
'pubDate' : str() } ]
示例11: MVC
# 需要导入模块: from MVC import MVC [as 别名]
# 或者: from MVC.MVC import loadDriver [as 别名]
# Here we figure out what we need to run, and we execute it, every 10 minutes
import sys
import os
from datetime import date, datetime, time, timedelta
sys.path.append( os.path.join(os.path.dirname(__file__), '..', '') )
from MVC import MVC
MVC = MVC()
# End file header
import subprocess
from time import strptime
# Read the SHT15 temperature/humidity sensor, log it
Mysql = MVC.loadDriver( 'Mysql' )
I2c = MVC.loadDriver( 'I2c' )
Settings = MVC.loadHelper( 'Settings' )
Logger = MVC.loadHelper( 'Logger' )
weatherunder = Settings.get_option( 'use-network-weatherunderground' )
use_alerts = Settings.get_option( 'use-alert' )
AlertModel = MVC.loadModel( 'Alert' )
WeatherModel = MVC.loadModel( 'Weather' )
WaterModel = MVC.loadModel( 'Water' )
Logger.write( 'Starting Regular Cron', '', 'cron' )
# Check all our sensors and run all our tasks