示例#1
0
    def _session_changed_cb(self, *args):
        session = self.session
        model = session.get_model()

        iter = session.get_active_iter()
        name = model.get(iter, 0)[0]
        self.config = NXConfig(name)

        self.user.set_text(self.config.username)
        self.password.set_text(self.config.password)
示例#2
0
    def _new_session_cb(self, *args):
        dialog = gtk.Dialog(_('Choose a name...'), self.main_window, 0,
                            (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
                             gtk.STOCK_OK, gtk.RESPONSE_OK))
        dialog.set_modal(True)
        dialog.set_has_separator(False)

        table = gtk.Table(2, 2, False)
        table.set_border_width(6)
        table.set_row_spacings(6)
        table.set_col_spacings(6)
        dialog.vbox.pack_start(table)

        image = gtk.image_new_from_stock(gtk.STOCK_DIALOG_QUESTION,
                                         gtk.ICON_SIZE_DIALOG)
        table.attach(image, 0, 1, 0, 2)

        label = gtk.Label(_('Please, choose a name for your new session:'))
        table.attach(label, 1, 2, 0, 1)

        entry = gtk.Entry()
        table.attach(entry, 1, 2, 1, 2)

        dialog.show_all()
        response = dialog.run()
        if response != gtk.RESPONSE_OK:
            dialog.destroy()
            return

        name = entry.get_text()
        dialog.destroy()

        self.config = NXConfig(name)

        modgui, conf_edit = self._new_session_editing_window()

        conf_edit.show_all()
        gtk.main()

        self.config.save()
        conf_edit.destroy()

        self._update_sessions()
示例#3
0
        response = raw_input(msg).strip()
        if response == 'yes':
            return True
        else:
            return False

    def _update_connection_state(self, state):
        pass


if __name__ == '__main__':
    from nxconfig import NXConfig
    from nxsession import NXSession

    host = raw_input('Host: ')
    port = raw_input('Port: ')
    user = raw_input('User: '******'Password: '******'Session type: ')

    config = NXConfig(host, user, password)
    nc = NXClient(config)

    nc.connect()

    nc.session = NXSession('teste-gnome')
    nc.session.session_type = session_type
    nc.start_session()

    nc.connection.send('\n')