当前位置: 首页>>代码示例>>Python>>正文


Python MVC.loadDriver方法代码示例

本文整理汇总了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
开发者ID:politeauthority,项目名称:garden_pi,代码行数:9,代码来源:hardware.py

示例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']
   }    
开发者ID:politeauthority,项目名称:good-consumer,代码行数:10,代码来源:ControllerAdminHome.py

示例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
开发者ID:politeauthority,项目名称:garden_pi,代码行数:10,代码来源: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
开发者ID:politeauthority,项目名称:CherryPyMvc,代码行数:10,代码来源: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 )
开发者ID:politeauthority,项目名称:garden_pi,代码行数:15,代码来源:ModelDevices.py

示例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':
开发者ID:politeauthority,项目名称:garden_pi,代码行数:33,代码来源:HelperSettings.py

示例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'
开发者ID:politeauthority,项目名称:CherryPyMvc,代码行数:6,代码来源:ControllerAdminSettings.py

示例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 )
开发者ID:politeauthority,项目名称:CherryPyMvc,代码行数:5,代码来源:ControllerHome.py

示例9: __init__

# 需要导入模块: from MVC import MVC [as 别名]
# 或者: from MVC.MVC import loadDriver [as 别名]
 def __init__( self ):
   self.Renderer          = MVC.loadDriver('Renderer')
开发者ID:politeauthority,项目名称:CherryPyMvc,代码行数:4,代码来源:ControllerHome.py

示例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() } ]
开发者ID:politeauthority,项目名称:good-consumer,代码行数:33,代码来源:DriverGoogleNews.py

示例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
开发者ID:politeauthority,项目名称:garden_pi,代码行数:33,代码来源:main.py


注:本文中的MVC.MVC.loadDriver方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。