Amador Pahim has uploaded a new change for review. Change subject: [userportal-basic-gtk] First commit. ......................................................................
[userportal-basic-gtk] First commit. Change-Id: I90ae1b0f7f734532ea6eb1cd97ab07fed25d55e1 Signed-off-by: Amador Pahim <[email protected]> --- A python-gtk/LICENSE A python-gtk/README.md A python-gtk/dispatcher.py A python-gtk/images/linux.png A python-gtk/images/ovirt.png A python-gtk/images/rhel.png A python-gtk/images/ubuntu.png A python-gtk/images/win.png A python-gtk/userportalgtk.glade A python-gtk/userportalgtk.py 10 files changed, 860 insertions(+), 0 deletions(-) git pull ssh://gerrit.ovirt.org:29418/samples-portals refs/changes/42/28142/1 diff --git a/python-gtk/LICENSE b/python-gtk/LICENSE new file mode 100644 index 0000000..21462f8 --- /dev/null +++ b/python-gtk/LICENSE @@ -0,0 +1,15 @@ +License (GPLv2+) +================ + +This program is free software: you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free Software +Foundation, either version 2 of the License, or (at your option) any later +version. + +This program is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +details. + +You should have received a copy of the GNU General Public License along with +this program. If not, see http://www.gnu.org/licenses/. diff --git a/python-gtk/README.md b/python-gtk/README.md new file mode 100644 index 0000000..fb01a3a --- /dev/null +++ b/python-gtk/README.md @@ -0,0 +1,12 @@ +ovirt-userportal-gtk +==================== + +Dependencies: +~~~ + $ sudo yum install spice-gtk-tools +~~~ + +Run: +~~~ +./userportalgtk.py +~~~ diff --git a/python-gtk/dispatcher.py b/python-gtk/dispatcher.py new file mode 100644 index 0000000..90f879a --- /dev/null +++ b/python-gtk/dispatcher.py @@ -0,0 +1,61 @@ +from ovirtsdk.api import API +from ovirtsdk.infrastructure.errors import RequestError, ConnectionError + +api = None + + +class OvirtApi(object): + def login(self, url, username, password, ca_file): + global api + try: + api = API(url=url, + username=username, + password=password, + ca_file=ca_file) + except RequestError as reqErr: + return False, "Login error" + except ConnectionError as conErr: + return False, "Bad URL" + return True, '' + + def getUserVms(self): + global api + return api.vms.list() + + def getVmById(self, id): + global api + return api.vms.get(id=id) + + def getVmStatus(self, id): + global api + return api.vms.get(id=id).status.state + + def startVm(self, vmid): + global api + try: + api.vms.get(id=vmid).start() + except RequestError as reqErr: + return False, reqErr.reason, reqErr.detail + except ConnectionError as conErr: + return False, 'Connection Error' + return True, None, None + + def stopVm(self, vmid): + global api + try: + api.vms.get(id=vmid).stop() + except RequestError as reqErr: + return False, reqErr.reason, reqErr.detail + except ConnectionError as conErr: + return False, 'Connection Error' + return True, None, None + + def ticketVm(self, vmid): + global api + try: + ticket = api.vms.get(id=vmid).ticket() + return ticket.get_ticket().get_value(), ticket.get_ticket().get_expiry() + except RequestError as reqErr: + raise Exception(reqErr.reason, reqErr.detail) + except ConnectionError as conErr: + raise Exception('Connection Error', '') diff --git a/python-gtk/images/linux.png b/python-gtk/images/linux.png new file mode 100644 index 0000000..132bc3a --- /dev/null +++ b/python-gtk/images/linux.png Binary files differ diff --git a/python-gtk/images/ovirt.png b/python-gtk/images/ovirt.png new file mode 100644 index 0000000..5dd9a48 --- /dev/null +++ b/python-gtk/images/ovirt.png Binary files differ diff --git a/python-gtk/images/rhel.png b/python-gtk/images/rhel.png new file mode 100644 index 0000000..91d13b3 --- /dev/null +++ b/python-gtk/images/rhel.png Binary files differ diff --git a/python-gtk/images/ubuntu.png b/python-gtk/images/ubuntu.png new file mode 100644 index 0000000..de6dd1e --- /dev/null +++ b/python-gtk/images/ubuntu.png Binary files differ diff --git a/python-gtk/images/win.png b/python-gtk/images/win.png new file mode 100644 index 0000000..a43df8a --- /dev/null +++ b/python-gtk/images/win.png Binary files differ diff --git a/python-gtk/userportalgtk.glade b/python-gtk/userportalgtk.glade new file mode 100644 index 0000000..5e84a80 --- /dev/null +++ b/python-gtk/userportalgtk.glade @@ -0,0 +1,565 @@ +<?xml version="1.0" encoding="UTF-8"?> +<glade-interface> + <!-- interface-requires gtk+ 2.20 --> + <!-- interface-naming-policy project-wide --> + <widget class="GtkWindow" id="window1"> + <property name="can_focus">False</property> + <property name="border_width">4</property> + <property name="title" translatable="yes">oVirt User Portal GTK</property> + <property name="resizable">False</property> + <property name="window_position">center-always</property> + <property name="icon">images/ovirt.png</property> + <child> + <widget class="GtkVBox" id="vbox2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child> + <widget class="GtkHBox" id="hbox1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child> + <widget class="GtkLabel" id="label1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Username:</property> + </widget> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <widget class="GtkEntry" id="entry1"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="invisible_char">●</property> + <property name="primary_icon_activatable">False</property> + <property name="secondary_icon_activatable">False</property> + <property name="primary_icon_sensitive">True</property> + <property name="secondary_icon_sensitive">True</property> + </widget> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="pack_type">end</property> + <property name="position">1</property> + </packing> + </child> + </widget> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <widget class="GtkHBox" id="hbox3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child> + <widget class="GtkLabel" id="label2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Password:</property> + </widget> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <widget class="GtkEntry" id="entry2"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="visibility">False</property> + <property name="invisible_char">●</property> + <property name="invisible_char_set">True</property> + <property name="primary_icon_activatable">False</property> + <property name="secondary_icon_activatable">False</property> + <property name="primary_icon_sensitive">True</property> + <property name="secondary_icon_sensitive">True</property> + </widget> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="pack_type">end</property> + <property name="position">1</property> + </packing> + </child> + </widget> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <widget class="GtkHBox" id="hbox4"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child> + <widget class="GtkLabel" id="label3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Server:</property> + </widget> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <widget class="GtkEntry" id="entry3"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="invisible_char">●</property> + <property name="primary_icon_activatable">False</property> + <property name="secondary_icon_activatable">False</property> + <property name="primary_icon_sensitive">True</property> + <property name="secondary_icon_sensitive">True</property> + </widget> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="pack_type">end</property> + <property name="position">1</property> + </packing> + </child> + </widget> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + <child> + <widget class="GtkHSeparator" id="hseparator1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + </widget> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">3</property> + </packing> + </child> + <child> + <widget class="GtkHButtonBox" id="hbuttonbox1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="layout_style">center</property> + <child> + <widget class="GtkButton" id="button1"> + <property name="label" translatable="yes">Connect</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + </widget> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> + </packing> + </child> + <child> + <widget class="GtkButton" id="button2"> + <property name="label" translatable="yes">Cancel</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + </widget> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">1</property> + </packing> + </child> + </widget> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">4</property> + </packing> + </child> + <child> + <widget class="GtkStatusbar" id="statusbar1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="border_width">2</property> + <property name="spacing">2</property> + </widget> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">5</property> + </packing> + </child> + </widget> + </child> + </widget> + <widget class="GtkWindow" id="window2"> + <property name="width_request">600</property> + <property name="height_request">300</property> + <property name="can_focus">False</property> + <property name="border_width">4</property> + <property name="title" translatable="yes">oVirt User Portal GTK</property> + <property name="window_position">center-always</property> + <property name="icon">images/ovirt.png</property> + <child> + <widget class="GtkVBox" id="vbox1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child> + <widget class="GtkHBox" id="hbox2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child> + <widget class="GtkLabel" id="label4"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">VM:</property> + </widget> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> + </packing> + </child> + <child> + <widget class="GtkComboBox" id="combobox1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + </widget> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <widget class="GtkButton" id="button3"> + <property name="label" translatable="yes">Refresh</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + </widget> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">2</property> + </packing> + </child> + </widget> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> + </packing> + </child> + <child> + <widget class="GtkHBox" id="hbox5"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="resize_mode">immediate</property> + <property name="homogeneous">True</property> + <child> + <widget class="GtkFrame" id="Details"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label_xalign">0</property> + <property name="shadow_type">etched-out</property> + <child> + <widget class="GtkAlignment" id="alignment1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="left_padding">12</property> + <child> + <widget class="GtkTable" id="table1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="n_rows">5</property> + <property name="n_columns">2</property> + <child> + <widget class="GtkLabel" id="label6"> + <property name="width_request">50</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">vCPUs:</property> + </widget> + </child> + <child> + <widget class="GtkLabel" id="label7"> + <property name="width_request">50</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">0</property> + <property name="width_chars">16</property> + </widget> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + </packing> + </child> + <child> + <widget class="GtkLabel" id="label8"> + <property name="width_request">50</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">Memory:</property> + </widget> + <packing> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + </packing> + </child> + <child> + <widget class="GtkLabel" id="label9"> + <property name="width_request">50</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">0</property> + </widget> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + </packing> + </child> + <child> + <widget class="GtkLabel" id="label10"> + <property name="width_request">50</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">Display:</property> + </widget> + <packing> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> + </packing> + </child> + <child> + <widget class="GtkLabel" id="label11"> + <property name="width_request">50</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">0</property> + </widget> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> + </packing> + </child> + <child> + <widget class="GtkLabel" id="label12"> + <property name="width_request">50</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">USB:</property> + </widget> + <packing> + <property name="top_attach">3</property> + <property name="bottom_attach">4</property> + </packing> + </child> + <child> + <widget class="GtkLabel" id="label13"> + <property name="width_request">50</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">0</property> + </widget> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">3</property> + <property name="bottom_attach">4</property> + </packing> + </child> + <child> + <widget class="GtkLabel" id="label14"> + <property name="width_request">50</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">Status:</property> + </widget> + <packing> + <property name="top_attach">4</property> + <property name="bottom_attach">5</property> + </packing> + </child> + <child> + <widget class="GtkLabel" id="label15"> + <property name="width_request">50</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">0</property> + <property name="width_chars">16</property> + </widget> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">4</property> + <property name="bottom_attach">5</property> + </packing> + </child> + </widget> + </child> + </widget> + </child> + <child> + <widget class="GtkLabel" id="label5"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes"><b>Details:</b></property> + <property name="use_markup">True</property> + </widget> + <packing> + <property name="type">label_item</property> + </packing> + </child> + </widget> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <widget class="GtkImage" id="image1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + </widget> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <widget class="GtkFrame" id="frame1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label_xalign">0</property> + <property name="shadow_type">etched-out</property> + <child> + <widget class="GtkAlignment" id="alignment2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="left_padding">12</property> + <child> + <widget class="GtkVButtonBox" id="vbuttonbox2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="border_width">5</property> + <property name="layout_style">center</property> + <child> + <widget class="GtkButton" id="button4"> + <property name="label" translatable="yes">Start</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + </widget> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <widget class="GtkButton" id="button6"> + <property name="label" translatable="yes">Shutdown</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + </widget> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <widget class="GtkCheckButton" id="checkbutton1"> + <property name="label" translatable="yes">Fullscreen</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="relief">half</property> + <property name="draw_indicator">True</property> + </widget> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + <child> + <widget class="GtkButton" id="button5"> + <property name="label" translatable="yes">Connect</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + </widget> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">3</property> + </packing> + </child> + </widget> + </child> + </widget> + </child> + <child> + <widget class="GtkLabel" id="label16"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes"><b>Controls:</b></property> + <property name="use_markup">True</property> + </widget> + <packing> + <property name="type">label_item</property> + </packing> + </child> + </widget> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + </widget> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <widget class="GtkStatusbar" id="statusbar2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="border_width">2</property> + <property name="spacing">2</property> + </widget> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">2</property> + </packing> + </child> + </widget> + </child> + </widget> +</glade-interface> diff --git a/python-gtk/userportalgtk.py b/python-gtk/userportalgtk.py new file mode 100755 index 0000000..f0f4ffa --- /dev/null +++ b/python-gtk/userportalgtk.py @@ -0,0 +1,207 @@ +#!/usr/bin/python + +import pygtk +import gtk +import gtk.glade +import gobject +import time +import sys +import os +import subprocess +from threading import Thread +import dispatcher +import urllib2 +import tempfile + +global dispatcher +dispatcher = dispatcher.OvirtApi() +VarSaida = True + + +class Client: + def Quit(*args, **kwargs): + global VarSaida + VarSaida = False + gtk.main_quit(*args, **kwargs) + sys.exit() + + def Connect(self, button=None): + selected_vm = self._cmb_main_vms.get_active_text().split(" :: ")[1] + ticket, expiry = dispatcher.ticketVm(selected_vm) + + port = "port="+str(self._port)+"&" if self._port else "" + sport = "tls-port="+str(self._sport)+"&" if self._sport else "" + uri = "spice://%s/?%s%spassword=%s" % (self._host, + port, + sport, + ticket) + cmd = ["spicy", "--uri", uri] + + if self._ca_file is not None: + cmd.append("--spice-ca-file=%s" % self._ca_file) + + subprocess.Popen(cmd) + + def Auth(self, button=None): + url = self._ent_auth_server.get_text() + username = self._ent_auth_user.get_text() + password = self._ent_auth_pass.get_text() + + try: + cert = urllib2.urlopen(url+"/ovirt-engine/ca.crt").read() + cert_file = tempfile.NamedTemporaryFile(delete=False) + cert_file + cert_file.write(cert) + cert_file.close() + + self._ca_file = cert_file.name + except: + self._ca_file = None + + login, msg = dispatcher.login(url, + username, + password, + self._ca_file) + + if login: + self._window1.hide() + self._window2.show() + self.List() + t = Thread(target=self.Status) + t.start() + else: + self._sta_auth.push(0, msg) + + def List(self, button=None): + self._liststore.clear() + for vm in dispatcher.getUserVms(): + self._liststore.append([vm.name + " :: " + vm.id]) + + self._cmb_main_vms.set_active(0) + + def Status(self, button=None): + global VarSaida + while VarSaida: + selected_vm = self._cmb_main_vms.get_active_text().split(" :: ")[1] + vm = dispatcher.getVmById(selected_vm) + state = vm.status.state + vcpus = vm.cpu.topology + memory = vm.memory + os = vm.os.type_ + if vm.usb.enabled: + usb = "Enabled" + else: + usb = "Disabled" + + display = vm.get_display() + self._port = display.get_port() + self._sport = display.get_secure_port() + self._host = display.get_address() + + self._btn_main_refresh.set_sensitive(True) + self._lab_Smp.set_text(str(vcpus.cores * vcpus.sockets)) + self._lab_Memory.set_text(str(memory / (1024*1024))) + self._lab_Display.set_text(vm.display.type_) + self._lab_Usb.set_text(usb) + self._lab_Status.set_text(state) + + if "rhel" in os: + self._img_So.set_from_file(self._dir + "/images/rhel.png") + elif "ubuntu" in os: + self._img_So.set_from_file(self._dir + "/images/ubuntu.png") + elif "other" in os: + self._img_So.set_from_file(self._dir + "/images/linux.png") + elif "windows" in os: + self._img_So.set_from_file(self._dir + "/images/win.png") + else: + self._img_So.set_from_file(self._dir + "/images/ovirt.png") + + if state == "up" or state == "powering_up": + self._checkbutton1.set_sensitive(True) + self._cmb_main_vms.set_sensitive(True) + self._btn_main_refresh.set_sensitive(True) + self._btn_main_start.set_sensitive(False) + self._btn_main_stop.set_sensitive(True) + self._btn_main_connect.set_sensitive(True) + else: + self._checkbutton1.set_sensitive(True) + self._cmb_main_vms.set_sensitive(True) + self._btn_main_refresh.set_sensitive(True) + self._btn_main_start.set_sensitive(True) + self._btn_main_stop.set_sensitive(False) + self._btn_main_connect.set_sensitive(False) + + time.sleep(2) + + def Start(self, button=None): + selected_vm = self._cmb_main_vms.get_active_text().split(" :: ")[1] + start, msg, details = dispatcher.startVm(selected_vm) + if start: + self._sta_main.push(0, "Success starting VM") + else: + self._sta_main.push(0, "%s: %s" % (msg, details)) + + def Stop(self, button=None): + selected_vm = self._cmb_main_vms.get_active_text().split(" :: ")[1] + stop, msg, details = dispatcher.stopVm(selected_vm) + if stop: + self._sta_main.push(0, "Success stopping VM") + else: + self._sta_main.push(0, "%s: %s" % (msg, details)) + + def __init__(self): + gtk.gdk.threads_init() + self._dir = os.path.dirname(os.path.abspath(__file__)) + self._gladefile = "%s/%s" % (self._dir, "userportalgtk.glade") + self._wTree = gtk.glade.XML(self._gladefile) + + self._window1 = self._wTree.get_widget("window1") + self._window2 = self._wTree.get_widget("window2") + if (self._window1): + self._window1.connect("destroy", self.Quit) + if (self._window2): + self._window2.connect("destroy", self.Quit) + + self._btn_auth_ok = self._wTree.get_widget("button1") + self._btn_auth_cancel = self._wTree.get_widget("button2") + self._ent_auth_user = self._wTree.get_widget("entry1") + self._ent_auth_pass = self._wTree.get_widget("entry2") + self._ent_auth_server = self._wTree.get_widget("entry3") + self._sta_auth = self._wTree.get_widget("statusbar1") + self._sta_main = self._wTree.get_widget("statusbar2") + + self._lab_Smp = self._wTree.get_widget("label7") + self._lab_Memory = self._wTree.get_widget("label9") + self._lab_Display = self._wTree.get_widget("label11") + self._lab_Usb = self._wTree.get_widget("label13") + self._lab_Status = self._wTree.get_widget("label15") + + self._img_So = self._wTree.get_widget("image1") + + self._btn_main_refresh = self._wTree.get_widget("button3") + self._btn_main_start = self._wTree.get_widget("button4") + self._btn_main_connect = self._wTree.get_widget("button5") + self._btn_main_stop = self._wTree.get_widget("button6") + self._checkbutton1 = self._wTree.get_widget("checkbutton1") + + self._cmb_main_vms = self._wTree.get_widget("combobox1") + self._liststore = gtk.ListStore(gobject.TYPE_STRING) + self._cmb_main_vms.set_model(self._liststore) + cell = gtk.CellRendererText() + self._cmb_main_vms.pack_start(cell, True) + self._cmb_main_vms.add_attribute(cell, 'text', 0) + + self._btn_main_refresh.connect("clicked", self.List) + self._btn_main_start.connect("clicked", self.Start) + self._btn_main_stop.connect("clicked", self.Stop) + self._btn_main_connect.connect("clicked", self.Connect) + + self._btn_auth_ok.connect("clicked", self.Auth) + self._btn_auth_cancel.connect("clicked", self.Quit) + + self._window1.show() + + +if __name__ == "__main__": + hwg = Client() + gtk.main() -- To view, visit http://gerrit.ovirt.org/28142 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I90ae1b0f7f734532ea6eb1cd97ab07fed25d55e1 Gerrit-PatchSet: 1 Gerrit-Project: samples-portals Gerrit-Branch: master Gerrit-Owner: Amador Pahim <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
