Package qubx :: Module splash_main
[hide private]
[frames] | no frames]

Source Code for Module qubx.splash_main

 1  """Components for the top level of the QUB Express or Fitness. 
 2   
 3  Copyright 2008-2012 Research Foundation State University of New York  
 4  This file is part of QUB Express.                                           
 5   
 6  QUB Express is free software; you can redistribute it and/or modify           
 7  it under the terms of the GNU General Public License as published by  
 8  the Free Software Foundation, either version 3 of the License, or     
 9  (at your option) any later version.                                   
10   
11  QUB Express is distributed in the hope that it will be useful,                
12  but WITHOUT ANY WARRANTY; without even the implied warranty of        
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         
14  GNU General Public License for more details.                          
15   
16  You should have received a copy of the GNU General Public License,    
17  named LICENSE.txt, in the QUB Express program directory.  If not, see         
18  <http://www.gnu.org/licenses/>.                                       
19   
20   
21  """ 
22   
23  # py2exe: add dist\ to python path, for OpenGL 
24  import gtk 
25  import gobject 
26   
27 -def pack_item(item, container, expand=False, fill=True):
28 item.show() 29 container.pack_start(item, expand, fill) 30 return item
31 -def pack_space(container, x=100, y=40, expand=False, fill=True):
32 space = pack_item(gtk.EventBox(), container, expand, fill) 33 space.set_size_request(x, y) 34 return space
35 36 Splash = None
37 -def show_splash(message='Loading...'):
38 global Splash 39 Splash = gtk.Window(gtk.WINDOW_TOPLEVEL) 40 #Splash.set_size_request(500, 200) 41 Splash.set_position(gtk.WIN_POS_CENTER) 42 Splash.set_decorated(False) 43 v = gtk.VBox() 44 v.show() 45 Splash.add(v) 46 pack_space(v) 47 h = pack_item(gtk.HBox(), v, expand=True) 48 pack_space(h) 49 Splash.lblMessage = pack_item(gtk.Label(message), h, expand=True) 50 pack_space(h) 51 pack_space(v) 52 # render Splash immediately 53 Splash.show() 54 while gtk.events_pending(): 55 gtk.main_iteration() 56 return Splash
57 # someone call Splash.destroy()... 58