Package iceprod :: Package client :: Package gtk :: Module GtkAddSimCat
[hide private]
[frames] | no frames]

Source Code for Module iceprod.client.gtk.GtkAddSimCat

 1  #!/bin/env python 
 2  # 
 3  """ 
 4    Add Simulation Category Window 
 5    copyright  (c) 2005 the icecube collaboration 
 6   
 7    @version: $Revision: $ 
 8    @date: $Date:  $ 
 9    @author: Juan Carlos Diaz Velez <juancarlos@icecube.wisc.edu> 
10  """ 
11   
12  import pygtk 
13  pygtk.require("2.0") 
14  import gtk, gobject 
15  from iceprod.core.dataclasses import Parameter 
16  import logging 
17   
18  logger = logging.getLogger('GtkAddSimCat') 
19   
20 -class GtkAddSimCat:
21 """ The GUI class is the controller for our application """
22 - def __init__(self,parent):
23 24 # setup the main window 25 self.parent = parent 26 self.root = gtk.Window(type=gtk.WINDOW_TOPLEVEL) 27 self.root.set_title("Add Simulation Category") 28 self.root.set_size_request(210, 100) 29 30 self.vbox = gtk.VBox() 31 32 self.bok = gtk.Button(stock=gtk.STOCK_APPLY) 33 self.bcancel = gtk.Button(stock=gtk.STOCK_CANCEL) 34 self.bok.connect('clicked', self.commit) 35 self.bcancel.connect('clicked', self.cancel) 36 self.hbok = gtk.HButtonBox() 37 self.hbok.pack_start(self.bok) 38 self.hbok.pack_start(self.bcancel) 39 40 self.simulation_category_entry = gtk.Entry() 41 self.simulation_category_entry.connect("activate", self.commit) 42 self.simcatframe = gtk.Frame("Simulation Category") 43 self.simcatframe.add(self.simulation_category_entry) 44 self.vbox.pack_start(self.simcatframe,False,False,1) 45 self.vbox.pack_start(self.hbok,False,False,1) 46 47 # Add our view into the main window 48 self.root.add(self.vbox) 49 self.root.show_all() 50 return
51 52
53 - def commit( self, widget ):
54 cat = self.simulation_category_entry.get_text() 55 if cat: 56 self.parent.add_simulation_category(cat) 57 self.root.destroy()
58
59 - def cancel( self, widget ):
60 self.root.destroy()
61