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


Python remote.Remote类代码示例

本文整理汇总了Python中remote.Remote的典型用法代码示例。如果您正苦于以下问题:Python Remote类的具体用法?Python Remote怎么用?Python Remote使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Remote类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: remote

def remote(cmd):
	r=Remote()
	if cmd == "on":
		r.on()
	else:
		r.off()

	return "ok"
开发者ID:ekulrabnud,项目名称:sharpremote,代码行数:8,代码来源:app.py

示例2: join

	def join(self, remote_address = None):
		# initially just set successor
		self.finger_ = map(lambda x: None, range(LOGSIZE))

		self.predecessor_ = None

		if remote_address:
			remote = Remote(remote_address)
			self.finger_[0] = remote.find_successor(self.id())
		else:
			self.finger_[0] = self

		self.log("joined")
开发者ID:sanyam5,项目名称:open-taxi,代码行数:13,代码来源:chord.py

示例3: join

	def join(self, remote_address = None):
		# initially just set successor
		print "joining"
		self.finger_ = [None for x in range(LOGSIZE)]

		self.predecessor_ = None

		if remote_address:
			print "poking", remote_address
			remote = Remote(remote_address)
			print "fingering"
			self.finger_[0] = remote.find_successor(self.id())
		else:
			self.finger_[0] = self
		print "joined"
		self.log("joined")
开发者ID:BrendanBenshoof,项目名称:ChordRelayChat,代码行数:16,代码来源:chord.py

示例4: remotes

 def remotes(self):
     """
     A list of Remote objects allowing to access and manipulate remotes
     
     Returns
         ``git.IterableList(Remote, ...)``
     """
     return Remote.list_items(self)
开发者ID:asavonic,项目名称:moldynam,代码行数:8,代码来源:repo.py

示例5: kill_pid

 def kill_pid(self,p):
     ""
     if p == 'trendnet.ini':
         remote=Remote(self.server)
         print 'kill -9 %s' % self.pids['trendnet.ini']
         remote.execute('kill -9 %s' % self.pids['trendnet.ini'])
     elif p == 'weather.ini':
         remote=Remote(self.source)
         print 'kill -9 %s' % self.pids['weather.ini']
         remote.execute('kill %s' % self.pids['weather.ini'])
     elif p == 'scheduler.ini':
         remote=Remote(self.server)
         print 'kill -9 %s' % self.pids['scheduler.ini']
         remote.execute('kill %s' % self.pids['scheduler.ini'])
开发者ID:yshao,项目名称:weathergit,代码行数:14,代码来源:supervisory.py

示例6: get_pids

    def get_pids(self,target):
        d=Remote.gen_login(target)
        # print d
        remote=Remote(d)

        lines=remote.execute("ps aux | grep python | grep -v grep",d['base_dir'])
        lines=lines.splitlines()
        d={}
        # print res

        for l in lines:
            sl=re.split(r' *', l)
            if len(sl) > 5:
                k=sl[-1]
                v=sl[1]

                d[k]=v

        return d
开发者ID:yshao,项目名称:weathergit,代码行数:19,代码来源:supervisory.py

示例7: create_remote

 def create_remote(self, name, url, **kwargs):
     """
     Create a new remote.
     
     For more information, please see the documentation of the Remote.create 
     methods 
     
     Returns
         Remote reference
     """
     return Remote.create(self, name, url, **kwargs)
开发者ID:asavonic,项目名称:moldynam,代码行数:11,代码来源:repo.py

示例8: Listener

class Listener(threading.Thread):
	def __init__(self, r, channels):
	    threading.Thread.__init__(self)
	    self.redis = redis.Redis()
	    self.pubsub = self.redis.pubsub()
	    self.pubsub.subscribe(channels)
	    self.remote = Remote(app.config["PIONEER"])

	def work(self, item):
			if item["type"] == "message" and item["channel"] == "remote":
				print item['channel'], ":", item['data']
				self.remote.send_cmd(item['data'])

	def run(self):
	    for item in self.pubsub.listen():
	        if item['data'] == "KILL":
	            self.pubsub.unsubscribe()
	            print self, "unsubscribed and finished"
	            break
	        else:
	            self.work(item)
开发者ID:marcboivin,项目名称:pioneer-remote,代码行数:21,代码来源:webapp.py

示例9: main

def main():
    print('Initialising...')
    
    port = '/dev/tty.RN42-B597-SPP'
    
    connected = False
    
    while not connected:
        try:
            rem = Remote(port)
        except RemoteConnectionError:
            print('\x1b[31;1mConnection on port {} unsuccessful\x1b[0m'.format(port))
            port = input('Please enter the right serial port: ')
            print('attempting another connection...')
        else:
            connected = True
    
    while True:
        data = input('Input: ')
        rem.send(data)
        rem.send('0')
开发者ID:notnami,项目名称:remote,代码行数:21,代码来源:run_remote.py

示例10: archive_files

def archive_files():
    ""
    def get_fidx():
        ""

    def get_idx_mock():
        ""
        p=os.curdir()
        return list_files_ext(p,'png')


    # fidx=get_fidx_mock()
    fidx=[]


    # curr_dt=get_timestamp()
    # for f in fidx:
    #     sl.move(f,curr_dt)

    tm=get_current_time()
    remote=Remote(Remote.gen_login('dataserver'))
    remote.execute('mkdir %s'%tm)
开发者ID:yshao,项目名称:weathergit,代码行数:22,代码来源:archiver0.py

示例11: restart

    def restart(self,p):
        self.pids=self.get_all_pids()
        if p == 'trendnet.ini':
            remote=Remote(self.server)
            if p in self.pids.keys():
                self.kill_pid('trendnet.ini')

            remote.daemon('twistd smap trendnet.ini',self.server['base_dir'])
        elif p == 'weather.ini':
            remote=Remote(self.source)
            if p in self.pids.keys():
                self.kill_pid('weather.ini')

            # print
            remote.daemon('twistd smap weather.ini',self.source['base_dir'])
        elif p == 'scheduler.ini':
            remote=Remote(self.server)
            if p in self.pids.keys():
                self.kill_pid('scheduler.ini')

            remote.daemon('twistd --pidfile=scheduler.pid smap scheduler.ini',self.server['base_dir'])
开发者ID:yshao,项目名称:weathergit,代码行数:21,代码来源:supervisory.py

示例12: init_widgets

 def init_widgets(self):
     self.remote = Remote(self.ui.console)
     self.widgets = [
         self.ui.tabWidget,
         self.ui.ccButton,
         self.ui.rcButton,
         self.ui.attackButton,
         self.ui.attackComboBox,
         self.ui.gpsCheckBox,
         self.ui.enclCheckBox,
         self.ui.encrCheckBox,
         self.ui.saveButton,
         self.ui.desiredSpeedLabel,
         self.ui.desiredSpeedEdit,
         self.ui.setSpeedButton,
         self.ui.kpLabel,
         self.ui.kpEdit,
         self.ui.setKPButton,
         self.ui.kiLabel,
         self.ui.kiEdit,
         self.ui.setKIButton,
         self.ui.trimLabel,
         self.ui.trimValueLabel,
         self.ui.setTrimLeftButton,
         self.ui.setTrimRightButton,
         self.ui.actualSpeedLabel,
         self.ui.actualSpeedLCD,
         self.ui.estimatedSpeedLabel,
         self.ui.estimatedSpeedLCD,
         self.ui.outputPlot,
         self.ui.outputPlotLabel,
         self.ui.inputPlot,
         self.ui.inputPlotLabel,
         self.ui.rightPlot,
         self.ui.rightPlotLabel
     ]
     #self.ui.mapView.setScene(MapnikScene(self.ui.mapView))
     #self.ui.mapView = MapView(self.ui.mapWidget)
     self.init_signals()
     self.init_plots()
开发者ID:PRECISE,项目名称:HACMSDemo,代码行数:40,代码来源:hacms.py

示例13: MainWindow

class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
    def __init__(self):
        QtGui.QMainWindow.__init__(self)
        self.setupUi(self)

        # init subsystems
        self.config = Config()
        self.config.read()
        self.config.set_defaults()

        self.remote = Remote(self.config)

        self.updates_layout = QtGui.QVBoxLayout(self.scrollAreaWidgetContents)
        self.updates_layout.setMargin(1)

        self.storage = UpdatesStorage(os.path.expanduser(self.config['qttt']['db_path']),
                self.updates_layout, self.remote)

        # gui options
        self.setAttribute(QtCore.Qt.WA_DeleteOnClose)

        self.tray = QtGui.QSystemTrayIcon(self)
        
        icon = QtGui.QIcon(os.path.join(os.path.dirname(__file__), 'icon.png'))
        self.tray.setIcon(icon)
        self.setWindowIcon(icon)
        
        self.tray.show()
        self.gb_current.hide()

        self.move(  self.config['qttt']['geometry']['left'],
                    self.config['qttt']['geometry']['top'] )
        self.resize(self.config['qttt']['geometry']['width'],
                    self.config['qttt']['geometry']['height'] )

        self.setWindowTitle('QTTT - %s' % self.config['site']['base_url'])

        self.lb_current.setWordWrap(True)


        # connections
        self.connect(self.action_Qt,    QtCore.SIGNAL('activated()'),       QtGui.qApp.aboutQt)
        self.connect(self.pb_update,    QtCore.SIGNAL('clicked()'),         self.sendUpdate)
        self.connect(self.le_update,    QtCore.SIGNAL('returnPressed()'),   self.sendUpdate)
        self.connect(self.pb_stop,      QtCore.SIGNAL('clicked()'),         self.finishLast)
        self.connect(self.tray,         QtCore.SIGNAL('activated(QSystemTrayIcon::ActivationReason)'), self.trayActivated)
        self.connect(QtGui.qApp,        QtCore.SIGNAL('lastWindowClosed()'),self.writeConfig)

        self.refresh_timer = QtCore.QTimer()
        self.refresh_timer.setInterval(5*60*1000) # 5 minutes
        self.connect(self.refresh_timer, QtCore.SIGNAL('timeout()'), self.getUpdates)
        self.refresh_timer.start()

        self.last_update_timer = QtCore.QTimer()
        self.last_update_timer.setInterval(1000) # 1 second
        self.connect(self.last_update_timer, QtCore.SIGNAL('timeout()'), self.refreshLastUpdateTime)
        

        # retrieve data
        try:
            user = self.remote.getUser()
        except:
            QtGui.QMessageBox.warning(self, u"Ошибка", u"Не могу соединиться с сервером")
            # it's hard but it's WORKING! :)
            exit()
        if user.get('error') is not None:
            QtGui.QMessageBox.warning(self, u"Ошибка", u"Неверный api-key указан в .tttrc файле")
            # it's hard but it's WORKING! :)
            exit()
        Update.set_current_user(user['nickname'])

        self.storage.loadUpdatesFromDB()
        self.getUpdates()
        self.getProjects()

    def writeConfig(self):
        self.config['qttt']['geometry']['width'] = self.size().width()
        self.config['qttt']['geometry']['height'] = self.size().height()
        self.config['qttt']['geometry']['left'] = self.pos().x()
        self.config['qttt']['geometry']['top'] = self.pos().y()

        self.config.write()

    def showMessage(self, title, message, status=None, only_status=False):
        self.statusBar().showMessage(status if status else message, 5000)
        if not only_status:
            self.tray.showMessage(title, message)

    def showLastUpdate(self, upd):
        self.lb_current.setText(upd.message)
        self.last_update_started_at = upd.started_at # it's easy to remember this time
        self.refreshLastUpdateTime()
        self.last_update_timer.start()
        self.gb_current.show()
    
    def hideLastUpdate(self):
        self.last_update_timer.stop()
        self.gb_current.hide()
        self.tray.setToolTip('')

#.........这里部分代码省略.........
开发者ID:cypok,项目名称:qttt,代码行数:101,代码来源:qttt.py

示例14: HACMSWindow

class HACMSWindow(QMainWindow):
    def __init__(self):
        super(HACMSWindow, self).__init__()

    def init_window(self):
        self.ui.setupUi(self)
        self.init_data_structs()
        self.init_widgets()

    def init_data_structs(self):
        self.trimIncrement = 0.001
        self.windowSize = 300
        self.in_Base = deque(maxlen=self.windowSize)
        self.in_Ref = deque(maxlen=self.windowSize)
        self.out_Odom = deque(maxlen=self.windowSize)
        self.out_EncL = deque(maxlen=self.windowSize)
        self.out_EncR = deque(maxlen=self.windowSize)
        self.out_GPS = deque(maxlen=self.windowSize)

    def init_widgets(self):
        self.remote = Remote(self.ui.console)
        self.widgets = [
            self.ui.tabWidget,
            self.ui.ccButton,
            self.ui.rcButton,
            self.ui.attackButton,
            self.ui.attackComboBox,
            self.ui.gpsCheckBox,
            self.ui.enclCheckBox,
            self.ui.encrCheckBox,
            self.ui.saveButton,
            self.ui.desiredSpeedLabel,
            self.ui.desiredSpeedEdit,
            self.ui.setSpeedButton,
            self.ui.kpLabel,
            self.ui.kpEdit,
            self.ui.setKPButton,
            self.ui.kiLabel,
            self.ui.kiEdit,
            self.ui.setKIButton,
            self.ui.trimLabel,
            self.ui.trimValueLabel,
            self.ui.setTrimLeftButton,
            self.ui.setTrimRightButton,
            self.ui.actualSpeedLabel,
            self.ui.actualSpeedLCD,
            self.ui.estimatedSpeedLabel,
            self.ui.estimatedSpeedLCD,
            self.ui.outputPlot,
            self.ui.outputPlotLabel,
            self.ui.inputPlot,
            self.ui.inputPlotLabel,
            self.ui.rightPlot,
            self.ui.rightPlotLabel
        ]
        #self.ui.mapView.setScene(MapnikScene(self.ui.mapView))
        #self.ui.mapView = MapView(self.ui.mapWidget)
        self.init_signals()
        self.init_plots()
        #self.init_waypoints()

    def init_signals(self):
        self.ui.actionAbout.triggered.connect(self.about)
        self.ui.actionQuit.triggered.connect(self.fileQuit)
        self.ui.landsharkButton.toggled.connect(self.landshark)
        self.ui.ccButton.toggled.connect(self.cc)
        self.ui.rcButton.toggled.connect(self.rc)
        self.ui.attackButton.toggled.connect(self.attack)
        self.ui.attackComboBox.currentIndexChanged.connect(self.attackMode)
        self.ui.gpsCheckBox.toggled.connect(self.attackSensor)
        self.ui.enclCheckBox.toggled.connect(self.attackSensor)
        self.ui.encrCheckBox.toggled.connect(self.attackSensor)
        self.ui.saveButton.toggled.connect(self.saveData)
        self.ui.setSpeedButton.clicked.connect(self.setLandsharkSpeed)
        self.ui.setKPButton.clicked.connect(self.setKP)
        self.ui.setKIButton.clicked.connect(self.setKI)
        self.ui.setTrimLeftButton.clicked.connect(self.setTrimLeft)
        self.ui.setTrimRightButton.clicked.connect(self.setTrimRight)

        # Set Validator for parameter fields
        self.validator = QDoubleValidator()
        self.validator.setNotation(QDoubleValidator.StandardNotation)
        self.ui.desiredSpeedEdit.setValidator(self.validator)
        self.ui.kpEdit.setValidator(self.validator)
        self.ui.kiEdit.setValidator(self.validator)

    def init_plots(self):
        self.ui.inputPlot.disableAutoRange(pg.ViewBox.YAxis)
        self.ui.inputPlot.setYRange(0, 1.3, 0)
        self.ui.inputPlot.setBackground('w')
        self.ui.inputPlot.hideButtons()
        self.ui.inputPlot.showGrid(False, True)
        #self.ui.inputPlot.addLegend()
        #self.ui.inputPlot.setLabel('left', 'speed')
        self.ui.inputPlot.setLabel('top', ' ')
        self.ui.inputPlot.setLabel('right', ' ')
        self.ui.inputPlot.setLabel('bottom', 'time')
        #self.ui.inputPlot.setTitle('Input')
        self.inputPlotBase = self.ui.inputPlot.plot(self.in_Base, name='CMD')
        self.inputPlotBase.setPen(pg.mkPen(width=3, color='r'))
#.........这里部分代码省略.........
开发者ID:PRECISE,项目名称:HACMSDemo,代码行数:101,代码来源:hacms.py

示例15: page_not_found

import flask
import settings

#Views
from main import Main
from login import Login
from remote import Remote
from music import Music

app = flask.Flask(__name__)
app.secret_key = settings.secret_key

#Routes
app.add_url_rule('/', view_func=Main.as_view('main'), methods=["GET"])
app.add_url_rule('/<page>/', view_func=Main.as_view('main'), methods=["GET"])
app.add_url_rule('/login/', view_func=Login.as_view('login'), methods=["GET", "POST"])
app.add_url_rule('/remote/', view_func=Remote.as_view('remote'), methods=["GET", "POST"])
app.add_url_rule('/music/', view_func=Music.as_view('music'), methods=["GET"])

@app.errorhandler(404)
def page_not_found(error):
	return flask.render_template('404.html'), 404

app.debug = True
app.run()
开发者ID:ovasylev,项目名称:dev-sprint3,代码行数:25,代码来源:app.py


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