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


Python ServerProxy.set方法代码示例

本文整理汇总了Python中xmlrpclib.ServerProxy.set方法的典型用法代码示例。如果您正苦于以下问题:Python ServerProxy.set方法的具体用法?Python ServerProxy.set怎么用?Python ServerProxy.set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在xmlrpclib.ServerProxy的用法示例。


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

示例1: AlarmClock

# 需要导入模块: from xmlrpclib import ServerProxy [as 别名]
# 或者: from xmlrpclib.ServerProxy import set [as 别名]
class AlarmClock(plasmascript.Applet):
    def __init__(self,parent,args=None):
        plasmascript.Applet.__init__(self,parent)
        socket.setdefaulttimeout(0.5)
        self.alarmserver = ServerProxy("http://10.42.3.2:8000")
        self.reset()
 
    def init(self):
        self.setHasConfigurationInterface(False)
        self.setAspectRatioMode(Plasma.IgnoreAspectRatio)

        self.theme = Plasma.Svg(self)
        self.theme.setImagePath("widgets/background")
        self.setBackgroundHints(Plasma.Applet.DefaultBackground)

        self.layout = QGraphicsGridLayout(self.applet)
        self.hour_lbl = Plasma.Label(self.applet)
        self.hour_lbl.setAlignment(Qt.AlignCenter)
        self.hour_lbl.setText("%02d" % self.hour)
        self.layout.addItem(self.hour_lbl, 1, 1)

        #print self.layout.setRowPreferredHeight(1, 20)

        self.minute_lbl = Plasma.Label(self.applet)
        self.minute_lbl.setText("%02d" % self.minute)
        self.minute_lbl.setAlignment(Qt.AlignCenter)
        self.layout.addItem(self.minute_lbl, 1, 2)

        h_plus = Plasma.PushButton(self.applet)
        h_plus.setStyleSheet("color: black")
        h_plus.nativeWidget().setIcon(KIcon("arrow-up"))
        self.layout.addItem(h_plus, 0, 1)
        m_plus = Plasma.PushButton(self.applet)
        m_plus.nativeWidget().setIcon(KIcon("arrow-up"))
        m_plus.setStyleSheet("color: black")
        self.layout.addItem(m_plus, 0, 2)
        h_minus = Plasma.PushButton(self.applet)
        h_minus.nativeWidget().setIcon(KIcon("arrow-down"))
        h_minus.setStyleSheet("color: black")
        self.layout.addItem(h_minus, 2, 1)
        m_minus = Plasma.PushButton(self.applet)
        m_minus.nativeWidget().setIcon(KIcon("arrow-down"))
        m_minus.setStyleSheet("color: black")
        self.layout.addItem(m_minus, 2, 2)


        self.cb = Plasma.CheckBox()
        self.layout.addItem(self.cb, 1, 0)
        self.cb.nativeWidget().setIcon(KIcon("user-busy"))
        self.cb.setChecked(self.enabled)

        self.timer = QTimer()
        self.connect(self.timer, SIGNAL("timeout()"), self.update_time)
        self.timer.start(20000)

        self.connect(self.cb, SIGNAL("toggled(bool)"), self.change_enabled)

        self.connect(h_plus, SIGNAL("clicked()"), self.hour_plus)
        self.connect(h_minus, SIGNAL("clicked()"), self.hour_minus)
        self.connect(m_plus, SIGNAL("clicked()"), self.minute_plus)
        self.connect(m_minus, SIGNAL("clicked()"), self.minute_minus)

        self.setLayout(self.layout)
        self.update_time()
        #self.resize(125, 125)


    def reset(self):
        (self.hour, self.minute, self.enabled) = (-1, -1, False)

    def change_enabled(self, value):
        try:
            self.alarmserver.enable(value)
            self.enabled = self.alarmserver.enabled()
        except socket.error:
            self.reset()
        self.update_time()

    def hour_plus(self):
        self.hour += 1
        self.set_alarm()

    def hour_minus(self):
        self.hour -= 1
        self.set_alarm()

    def minute_plus(self):
        self.minute += 1
        self.set_alarm()

    def minute_minus(self):
        self.minute -= 1
        self.set_alarm()

    def set_alarm(self):
        if self.hour < 0:
            self.hour = 23
        elif self.hour > 23:
            self.hour = 0
        if self.minute < 0:
#.........这里部分代码省略.........
开发者ID:tohojo,项目名称:alarmclock,代码行数:103,代码来源:main.py

示例2:

# 需要导入模块: from xmlrpclib import ServerProxy [as 别名]
# 或者: from xmlrpclib.ServerProxy import set [as 别名]
from xmlrpclib import ServerProxy

_author__ = 'cqh'


s=ServerProxy('http://localhost:15000',allow_none=True)
s.set('foo','bar')
s.set('spam',[1,2,3])
print s.keys()
print s.get('foo')
开发者ID:chen19901225,项目名称:SimplePyCode,代码行数:12,代码来源:rpc_client1.py

示例3: ServerProxy

# 需要导入模块: from xmlrpclib import ServerProxy [as 别名]
# 或者: from xmlrpclib.ServerProxy import set [as 别名]
#!/bin/env python
# -*- coding: utf-8 -*-

from xmlrpclib import ServerProxy

if __name__ == "__main__":
    s = ServerProxy("http://localhost:15000", allow_none=True)
    s.set("foo", "bar")
    s.set("spam", [1, 2, 3])

    compound = {"drain": 1, "gate": 2, "VgRange": [0, 1.5], "VdRange": [0, 3]}

    s.set("compound", compound)
    print s.keys()

    print s.get("foo")
    print s.get("spam")
    print s.get("compound")

    s.delete("spam")
    print s.exists("spam")
开发者ID:sakurahilljp,项目名称:scripts,代码行数:23,代码来源:xmlrpc_kvclient.py


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