~ubuntu-branches/ubuntu/precise/virt-manager/precise-proposed

« back to all changes in this revision

Viewing changes to src/virtManagerTui/changehost.py

  • Committer: Bazaar Package Importer
  • Author(s): Marc Deslauriers
  • Date: 2011-02-03 10:35:22 UTC
  • mfrom: (2.3.3 experimental)
  • Revision ID: james.westby@ubuntu.com-20110203103522-j8and6dsy3taczbj
Tags: 0.8.6-1ubuntu1
* Merge from debian experimental. Remaining changes:
  - Depend on python-appindicator for appindicator support.
  - Add a /usr/share/pixmaps/virt-manager-icon.svg symlink to link icon to
    where the Application Indicator can find it.
  - Add patch da_l10n.patch since it is not integrated. (refreshed)
  - Add patch show_session_or_system_in_console to make the overview
    screen show which local qemu session you're connected to. (refreshed)
  - Add patch more_helpful_error_message to explain to the user why he
    can't connect to qemu:///system and what he can do fix it.
  - Add patch qemu-system-by-default to automatically add qemu:///system
    to the list of hypervisors if the user has write access to the UNIX
    socket.
  - Drop patchsys-quilt include since dpkg-source does the quilt dance for
    us.
  - debian/control: lower libvirt-bin from Recommends to Suggests; seems
    some users (like netbooks) want to manage VMs, but not host them; see
    meta packages (ubuntu-virt, ubuntu-virt-server, ubuntu-virt-mgmt) for
    group installation of virt package sets.
* Removed patches:
  - debian/patches/custom-icon-installation.patch: Upstream.
  - debian/patches/remove-appindicator-workarounds.patch: Upstream.
  - debian/patches/fix-nc-with-zsh.patch: Upstream
* Removed python-ipy dependency as it is in universe:
  - debian/control: remove python-ipy from Depends
  - debian/series: disable 0002-Use-IPy-from-python-ipy.patch patch so
    we use the one that's included in the virt-manager source.
  - debian/rules: don't delete the IPy file.
* debian/patches/fix-cpu-wrong-types.patch: fix "value is of wrong type
  for this column" error by making sure we are using strings in
  src/virtManager/details.py.
* debian/patches/dont-always-launch-consoles.patch: Don't always launch
  consoles for running domains in src/virtManager/manager.py.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# changehost.py - Copyright (C) 2009 Red Hat, Inc.
 
2
# Written by Darryl L. Pierce <dpierce@redhat.com>
 
3
#
 
4
# This program is free software; you can redistribute it and/or modify
 
5
# it under the terms of the GNU General Public License as published by
 
6
# the Free Software Foundation; version 2 of the License.
 
7
#
 
8
# This program is distributed in the hope that it will be useful,
 
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
11
# GNU General Public License for more details.
 
12
#
 
13
# You should have received a copy of the GNU General Public License
 
14
# along with this program; if not, write to the Free Software
 
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 
16
# MA  02110-1301, USA.  A copy of the GNU General Public License is
 
17
# also available at http://www.gnu.org/copyleft/gpl.html.
 
18
 
 
19
from snack import *
 
20
 
 
21
import logging
 
22
import libvirtworker
 
23
from configscreen import *
 
24
 
 
25
CONNECTION_LIST_PAGE = 1
 
26
CONNECTED_PAGE       = 2
 
27
 
 
28
class ChangeHostConfigScreen(HostListConfigScreen):
 
29
    def __init__(self):
 
30
        HostListConfigScreen.__init__(self, "")
 
31
 
 
32
    def get_title(self):
 
33
        return "Currently: %s" % self.get_libvirt().get_url()
 
34
 
 
35
    def get_elements_for_page(self, screen, page):
 
36
        if   page is CONNECTION_LIST_PAGE: return self.get_connection_list_page(screen)
 
37
        elif page is CONNECTED_PAGE:       return self.get_connected_page(screen)
 
38
 
 
39
    def process_input(self, page):
 
40
        if   page is CONNECTION_LIST_PAGE:
 
41
            logging.info("Changing libvirt connection to %s" % self.get_selected_connection())
 
42
            self.get_libvirt().open_connection(self.get_selected_connection())
 
43
        elif page is CONNECTED_PAGE: self.set_finished()
 
44
 
 
45
    def page_has_next(self, page):
 
46
        if page is CONNECTION_LIST_PAGE: return self.has_selectable_connections()
 
47
        return False
 
48
 
 
49
    def page_has_back(self, page):
 
50
        return page > CONNECTION_LIST_PAGE
 
51
 
 
52
    def page_has_finish(self, page):
 
53
        return page is CONNECTED_PAGE
 
54
 
 
55
    def get_connected_page(self, screen):
 
56
        return [Label("Connected to %s" % self.get_selected_connection())]
 
57
 
 
58
def ChangeHost():
 
59
    screen = ChangeHostConfigScreen()
 
60
    screen.start()