- use namespace
- add menu and about box to GNOME client git-svn-id: file:///home/www/usr01/svn/gnuviechadmin/gnuviech.info/gnuviechadmin/trunk@171 a67ec6bc-e5d5-0310-a910-815c51eb3124
This commit is contained in:
parent
d7980414e1
commit
5cbe9deaa3
2 changed files with 45 additions and 19 deletions
|
@ -7,27 +7,53 @@ from soapclient import soapclient
|
||||||
|
|
||||||
class GnuviechAdminGnome:
|
class GnuviechAdminGnome:
|
||||||
"""GnuviechAdmin Gnome Interface"""
|
"""GnuviechAdmin Gnome Interface"""
|
||||||
def hello(self, widget, data = None):
|
_version = '0.1'
|
||||||
print "Hello World"
|
|
||||||
|
|
||||||
def metoo(self, widget, data = None):
|
|
||||||
print "Me 2"
|
|
||||||
|
|
||||||
def delete_event(self, widget, event, data = None):
|
def delete_event(self, widget, event, data = None):
|
||||||
print "delete event occurred"
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def button_press(self, widget, data = None):
|
def duplicate_text(self, widget, data = None):
|
||||||
print "button pressed"
|
text = self.textfield.get_text()
|
||||||
|
|
||||||
def change_event(self, widget, data = None):
|
|
||||||
text = widget.get_text()
|
|
||||||
print text
|
|
||||||
self.label.set_text(self.soapclient.echo(text))
|
self.label.set_text(self.soapclient.echo(text))
|
||||||
|
|
||||||
def destroy_event(self, widget, data = None):
|
def destroy_event(self, widget, data = None):
|
||||||
gtk.main_quit()
|
gtk.main_quit()
|
||||||
|
|
||||||
|
def show_aboutbox(self, widget, data = None):
|
||||||
|
aboutbox = gtk.AboutDialog()
|
||||||
|
aboutbox.set_authors(['Jan Dittberner <jan@dittberner.info>'])
|
||||||
|
aboutbox.set_name("GnuviechAdmin\nGNOME frontend")
|
||||||
|
aboutbox.set_copyright('(c) 2006 Jan Dittberner')
|
||||||
|
aboutbox.set_license('This program is licensed under the terms of the GNU General Public License (GPL) version 2 or later.')
|
||||||
|
aboutbox.set_version(self._version)
|
||||||
|
aboutbox.show()
|
||||||
|
|
||||||
|
def _create_menubar(self):
|
||||||
|
menubar = gtk.MenuBar()
|
||||||
|
menu = gtk.Menu()
|
||||||
|
menuitem = gtk.MenuItem(label = '_Exit')
|
||||||
|
menuitem.connect_object("activate", gtk.Widget.destroy, self.window)
|
||||||
|
|
||||||
|
menu.append(menuitem)
|
||||||
|
|
||||||
|
rootmenu = gtk.MenuItem('_File')
|
||||||
|
rootmenu.set_submenu(menu)
|
||||||
|
|
||||||
|
menubar.append(rootmenu)
|
||||||
|
|
||||||
|
menu = gtk.Menu()
|
||||||
|
menuitem = gtk.MenuItem(label = '_About')
|
||||||
|
menuitem.connect("activate", self.show_aboutbox)
|
||||||
|
|
||||||
|
menu.append(menuitem)
|
||||||
|
|
||||||
|
rootmenu = gtk.MenuItem('_Help')
|
||||||
|
rootmenu.set_right_justified(True)
|
||||||
|
rootmenu.set_submenu(menu)
|
||||||
|
|
||||||
|
menubar.append(rootmenu)
|
||||||
|
return menubar
|
||||||
|
|
||||||
def __init__( self ):
|
def __init__( self ):
|
||||||
self.soapclient = soapclient.SOAPClient()
|
self.soapclient = soapclient.SOAPClient()
|
||||||
|
|
||||||
|
@ -36,17 +62,16 @@ class GnuviechAdminGnome:
|
||||||
self.window.connect("destroy", self.destroy_event)
|
self.window.connect("destroy", self.destroy_event)
|
||||||
|
|
||||||
button = gtk.Button("Hello world")
|
button = gtk.Button("Hello world")
|
||||||
self.handler1 = button.connect("clicked", self.hello, None)
|
#button.connect_object("clicked", gtk.Widget.destroy, self.window)
|
||||||
button.connect("clicked", self.metoo, None)
|
|
||||||
button.connect_object("clicked", gtk.Widget.destroy, self.window)
|
|
||||||
button.connect("pressed", self.button_press, None)
|
|
||||||
|
|
||||||
self.textfield = gtk.Entry()
|
self.textfield = gtk.Entry()
|
||||||
self.textfield.connect("changed", self.change_event)
|
button.connect("clicked", self.duplicate_text)
|
||||||
|
|
||||||
self.label = gtk.Label()
|
self.label = gtk.Label()
|
||||||
|
menubar = self._create_menubar()
|
||||||
|
|
||||||
vbox = gtk.VBox()
|
vbox = gtk.VBox()
|
||||||
|
vbox.add(menubar)
|
||||||
vbox.add(button)
|
vbox.add(button)
|
||||||
vbox.add(self.textfield)
|
vbox.add(self.textfield)
|
||||||
vbox.add(self.label)
|
vbox.add(self.label)
|
||||||
|
|
|
@ -4,7 +4,8 @@ import socket
|
||||||
|
|
||||||
class SOAPClient:
|
class SOAPClient:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.server = SOAPProxy('http://localhost:8080/')
|
self.server = SOAPProxy('http://localhost:8080/',
|
||||||
|
namespace = 'urn:gnuviech-admin-services')
|
||||||
|
|
||||||
def echo(self, value):
|
def echo(self, value):
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in a new issue