关于SPICE:
spice 是 redhat 的虚拟化远程桌面协议 又叫 独立计算环境初级协议(Simple Protocol for Independent Computing Environments,就不多介绍了,反正做VDI的都知道。
现在spice-gtk 到了 0.14了,功能也算是比较全了,当然大家想要的3d 加速,视频加速还是木有的。
但是作为测试后端kvm,不失为一个好的远程协议,至少比vnc强多了。
对我来说,不过spice-gtk还是稍嫌笨重。好在它有api,还是python的..........
我应该如何调用spice-gtk呢?
我们需要做一些准备工作
a. 编译spice-gtk的时候,带python支持: --with-gtk=2.0
b. 下载和安装python gtk
这些做完后,把生成的 SpiceClientGtk.so 放到你可以访问的地方,然后就开始调用吧
#!/usr/bin/env python
import SpiceClientGtk as _spice
import pygtk
import gtk
import gobject
class T_Window(gtk.Window):
def __init__(self):
super(Tcloud_Window, self).__init__()
self.set_title("tcloud-client")
self.set_size_request(1024, 768)
self.modify_bg(gtk.STATE_NORMAL, gtk.gdk.Color(6400, 6400, 6440))
self.set_position(gtk.WIN_POS_CENTER)
self.session = None
self.display = None
self.display_channel = None
def settings(self,host,port):
self.session = _spice.Session()
uri = "spice://"
uri += str(host) + "?port=" + str(port)
self.session.set_property("uri",uri)
def _channel_new(self, session, channel):
if type(channel) == _spice.MainChannel:
return
if type(channel) == _spice.DisplayChannel:
channel_id = channel.get_property("channel-id")
self.display_channel = channel
self.display = _spice.Display(self.session, channel_id)
self.add(self.display)
self.display.realize()
self.display.show()
return
def main_loop(self,host,port,password=None):
self.settings(host, port)
if password:
self.session.set_property("password", password)
gobject.GObject.connect(self.session, "channel-new",
self._channel_new)
self.session.connect()
def close(self):
if self.session is not None:
self.session.disconnect()
self.session = None
self.audio = None
if self.display:
self.display.destroy()
self.display = None
self.display_channel = None
gtk.main_quit()
self.connect("destroy", close)
self.show_all()
gtk.main();
if __name__ == '__main__':
tw = T_Window()
host = "localhost"
port ="5900"
tw.main_loop(host,port)
嘛 以上都是在linux上做的 亲 故意写最后
分享到:
相关推荐
高强度螺栓连接系统计算-多螺栓连接 VDI2230-Part 02.pdf
实际上自从19世纪中叶发明了摄影用于计量的应用程序和与现有技术的发展。自20世纪60年代所允许的不断发展接收到任何模型和束调整方案排列图像协会和所使用的同步校准记录系统
VDI-In-a-Box and XenDesktop 对比参数
VDI-2230高强度螺栓连接的系统计算-中文版.pdf
VDI 2230 Blatt-2 2014-12.rar
QXL,SPICE,VDI,虚拟桌面
VDI5600 -德国MES标准 在范围广泛的各种功能之外,还明确指出应该包括“横向集成”和“实时性能”。这对于工业4.0同样具有重大意义。从而MES系统在实现工业4.0的具体实践中起到关键作用。
深信服桌面云_极域电子教室部署指导_VDI4.6-5.3.4.pdf
VMware Horizon GRID vGPU图形VDI方案-最佳实践.pptx
VMware Horizon GRID vGPU图形VDI方案-最佳实践.pdf
Linux虚拟机部署_VDI5.2
The VDI Delusion Why desktop virtualization failed to live up to the hype, and what the future enterprise desktop will really look like. Copyright © 2012 Brian Madden, Gabe Knuth, & Jack Madden ...
Citrix VDI-in-a-box桌面虚拟化方案建议书(200并发用户)
2021年VDI-IDV-VOI三种云桌面技术解决方案.pdf
VDI_3834-陆上带齿轮箱风力发电机组及其组件机械振动测量与评估
section1_dojo1 VDI编码-第1部分-Dojo 1
VDI 2230 Blatt-2 2014-12.pdf
VDI2230高强度螺栓计算
VDI-2049干冷塔验收及性能试验导则(中译文)