Ejemplo n.º 1
0
 def __init__(self,menu,root=None):
     """ Sets up and populates our gtk.TreeStore """
     TcloudObject.__init__(self)
     self.tree_store = gtk.TreeStore(gtk.gdk.Pixbuf, gobject.TYPE_STRING, gobject.TYPE_STRING)
     self.root = self.init_root(root)
     self.menu = menu
     self.first_row  = None
     self.init_menu(self.menu)
     return
Ejemplo n.º 2
0
 def __init__(self, widget, host, port, conf):
     TcloudObject.__init__(self)
     self.disp_console = widget
     self.session = None
     self.conf = conf
     self.display = None
     self.main_channel = None
     self.audio = None
     self.display_channel = None
     self.connected = False
     self.usbManager = _spice.UsbDeviceManager()
     self.host = host
     self.port = port
Ejemplo n.º 3
0
    def __init__(self, subsystems=["usb"]):
        '''
        Create a new DeviceFinder and attach to the udev system to 
        listen for events.
        '''
        TcloudObject.__init__(self)

        self.client = gudev.Client(subsystems)
        self.subsystems = subsystems
        self.devices_tree = {}
        self.devices_list = []

        self.client.connect('uevent', self.uevent)
Ejemplo n.º 4
0
 def __init__(self,widget,host,port,conf):
     TcloudObject.__init__(self)
     self.disp_console = widget
     self.session = None
     self.conf = conf
     self.display = None
     self.main_channel = None
     self.audio = None
     self.display_channel = None
     self.connected = False
     self.usbManager = _spice.UsbDeviceManager()
     self.host= host
     self.port = port
Ejemplo n.º 5
0
    def __init__(self, root=None, conf=None):
        """ Path is where we wan the tree initialized """

        TcloudObject.__init__(self)
        self.conf = conf
        self.show_hidden = False
        self.show_only_dirs = True
        self.show_rules_hint = True

        self.root = '/'
        if root != None:
            self.check_path(root)

        self.view, self.scrolled = self.make_view()
        self.create_new()
        self.create_popup()
Ejemplo n.º 6
0
 def __init__(self):
     TcloudObject.__init__(self)
     self.base = basepath
Ejemplo n.º 7
0
            LOG.debug("Destroy spice view display......")
            self.display.destroy()

        self.display = None
        self.main_channel = None
        self.display_channel = None

    def on_error_callback_close(self, widget, ignore):
        widget.destroy()
        self.close_rc()

    def close_rc(self):
        LOG.debug("close spice rc by channel closed....")
        self._close_rc()
        self.emit("viewer-closed")

    def connect_host(self, password=None):
        self.settings()
        if password:
            self.session.set_property("password", password)

        gobject.GObject.connect(self.session, "channel-new", self._channel_new)
        self.session.connect()


TcloudObject.type_register(Spice_Viewer)
Spice_Viewer.signal_new(Spice_Viewer, "viewer-closed", [])

if __name__ == '__main__':
    pass
Ejemplo n.º 8
0
    def device_remove(self, device):

        LOG.debug("unplug a usb device")
        pass

    """
        plug device
    """

    def device_added(self, device):

        LOG.debug("plug a usb device")
        self.get_device_info(device)
        pass


TcloudObject.type_register(usbDevice)

if __name__ == '__main__':

    def connect(finder, device):
        print 11

    def discon(finder, device):
        print 22

    usb = usbDevice()
    usb.connect("connected", connect)
    usb.connect("disconnected", discon)
    #    usb.connect('connected', found)
    gobject.MainLoop().run()
Ejemplo n.º 9
0
    def disconnect(self,widget=None):
        LOG.debug("Disconnect vm")
        if self.viewer:
            self.viewer.close()
    def connected(self,widget=None):
        if self.viewer.is_connect():
            return
        else:
            self.show_view()
    def binding_event(self):
        self.mainwin.connect("destroy",self.close)
        self.viewer.connect('viewer-closed',self.sub_close_view)
        self.widget("vm-fullscreen").connect("clicked",self.enter_fullscreen)
        self.widget("vm-disconnect").connect("clicked",self.sub_close_view)

        self.mainwin.connect("key-press-event", self._zoom)

    def no_scroll(self):
        self.widget("view-display").set_policy(gtk.POLICY_NEVER, gtk.POLICY_NEVER)   
        
    def resize_to_vm(self):
        self.widget("view-display").set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
    
TcloudObject.type_register(viewManager)
viewManager.signal_new(viewManager, "manager-closed", [])

if __name__=="__main__":
    t = viewManager()
    t.show()
    gtk.main()   
        
Ejemplo n.º 10
0
        view.connect('cursor-changed', self.cursor_changed)
        view.connect('button_press_event', self.button_pressed)

        col = gtk.TreeViewColumn()

        # The icon
        render_pixbuf = gtk.CellRendererPixbuf()
        col.pack_start(render_pixbuf, expand=False)
        col.add_attribute(render_pixbuf, 'pixbuf', 0)

        # The dir name
        render_text = gtk.CellRendererText()
        col.pack_start(render_text, expand=True)
        col.add_attribute(render_text, 'text', 1)
        view.append_column(col)
        view.show()

        # Create scrollbars around the view
        scrolled = gtk.ScrolledWindow()
        scrolled.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        scrolled.set_shadow_type(gtk.SHADOW_ETCHED_IN)
        scrolled.add(view)
        scrolled.show()

        return view, scrolled


TcloudObject.type_register(TreeFileBrowser)

# End TreeFileBrowser
Ejemplo n.º 11
0
        self.display = None
        self.main_channel = None
        self.display_channel = None


    def on_error_callback_close(self,widget,ignore):
        widget.destroy()
        self.close_rc()


    def close_rc(self):
        LOG.debug("close spice rc by channel closed....")
        self._close_rc()
        self.emit("viewer-closed")


    def connect_host(self,password=None):
        self.settings()
        if password:
            self.session.set_property("password", password)
            
        gobject.GObject.connect(self.session, "channel-new",
                                self._channel_new)
        self.session.connect()

TcloudObject.type_register(Spice_Viewer)
Spice_Viewer.signal_new(Spice_Viewer, "viewer-closed", [])
    
if __name__ == '__main__':
    pass
Ejemplo n.º 12
0
        col.pack_start(render_pixbuf, expand=False)
        col.add_attribute(render_pixbuf, 'pixbuf', 0)
        
        render_text1 = gtk.CellRendererText()
        col.pack_start(render_text1, expand=True)
        col.add_attribute(render_text1, 'text', 1)
        ############# hidden cell ##################
        render_text2 = gtk.CellRendererText()
        #render_text2.set_visible(False)
        col.pack_start(render_text2, expand=False)
        col.add_attribute(render_text2, 'text', 2)
        
        if expend:
            self.view.expand_all()
        else:
            self.make_firs_elem_selected()
        self.view.connect('cursor-changed', self.cursor_changed)
        
        self.view.append_column(col)
        self.view.show()
        
        scrolled = gtk.ScrolledWindow()
        scrolled.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        scrolled.set_shadow_type(gtk.SHADOW_ETCHED_IN)
        scrolled.add(self.view)
        scrolled.show()
        
        return self.view,scrolled
    
TcloudObject.type_register(MenuTree)