Back to index

gcompris  8.2.2
Public Member Functions | Public Attributes
tuxpaint.Gcompris_tuxpaint Class Reference

List of all members.

Public Member Functions

def __init__
def configuration
def start
def end
def set_level
def ok
def key_press
def repeat
def pause
def config
def config_stop
def config_start
def stamps_changed
def apply_callback
def init_config

Public Attributes

 gcomprisBoard
 window
 config_dict
 rootitem
 configure_profile
 main_vbox
 stamps_control

Detailed Description

TuxPaint Launcher

Definition at line 37 of file tuxpaint.py.


Constructor & Destructor Documentation

def tuxpaint.Gcompris_tuxpaint.__init__ (   self,
  gcomprisBoard 
)

Definition at line 41 of file tuxpaint.py.

00041 
00042   def __init__(self, gcomprisBoard):
00043     self.gcomprisBoard = gcomprisBoard
00044     pass


Member Function Documentation

def tuxpaint.Gcompris_tuxpaint.apply_callback (   self,
  table 
)

Definition at line 212 of file tuxpaint.py.

00212 
00213   def apply_callback(self,table):
00214     print table
00215     for key,value in table.iteritems():
00216       gcompris.set_board_conf(self.configure_profile, self.gcomprisBoard, key, value)

Definition at line 166 of file tuxpaint.py.

00166 
00167   def config(self):
00168     print "Config"
00169     pass

def tuxpaint.Gcompris_tuxpaint.config_start (   self,
  profile 
)

Definition at line 174 of file tuxpaint.py.

00174 
00175   def config_start(self, profile):
00176     self.configure_profile = profile
00177 
00178     #get default values
00179     self.config_dict = self.init_config()
00180 
00181     #set already configured values
00182     self.config_dict.update(gcompris.get_conf(profile, self.gcomprisBoard))
00183 
00184     self.main_vbox = gcompris.configuration_window(_('<b>%s</b> configuration\n for profile <b>%s</b>') % ('Tuxpaint', profile.name ),
00185                                                    self.apply_callback)
00186 
00187 
00188     gcompris.boolean_box(_('Inherit fullscreen setting from GCompris'), 'fullscreen', eval(self.config_dict['fullscreen']))
00189 
00190     gcompris.separator()
00191 
00192     gcompris.boolean_box(_('Inherit size setting from GCompris (800x600, 640x480)'), 'size', eval(self.config_dict['size']))
00193 
00194     gcompris.separator()
00195 
00196     gcompris.boolean_box(_('Disable shape rotation'), 'disable_shape_rotation', eval(self.config_dict['disable_shape_rotation']))
00197 
00198     gcompris.separator()
00199 
00200     gcompris.boolean_box(_('Show Uppercase text only'), 'uppercase_text', eval(self.config_dict['uppercase_text']))
00201 
00202     gcompris.separator()
00203 
00204     stamps = gcompris.boolean_box(_('Disable stamps'), 'disable_stamps', eval(self.config_dict['disable_stamps']))
00205     stamps.connect("toggled", self.stamps_changed)
00206 
00207     self.stamps_control = gcompris.boolean_box('Disable stamps control', 'disable_stamps_control', eval(self.config_dict['disable_stamps_control']))
00208     self.stamps_control.set_sensitive(not eval(self.config_dict['disable_stamps']))

Definition at line 170 of file tuxpaint.py.

00170 
00171   def config_stop(self):
00172     print "config_stop", self
00173     pass

def tuxpaint.Gcompris_tuxpaint.configuration (   self,
  value,
  init 
)

Definition at line 45 of file tuxpaint.py.

00045 
00046   def configuration(self, value, init):
00047     if self.config_dict.has_key(value):
00048       return eval(self.config_dict[value])
00049     else:
00050       return init

Here is the call graph for this function:

Definition at line 139 of file tuxpaint.py.

00139 
00140   def end(self):
00141     gcompris.sound.reopen()
00142     global pid
00143     # force kill - data loss
00144     if pid != None:
00145       print "Tuxpaint not killed", self.pid
00146     #import os
00147     #os.kill(self.pid, signal.SIGKILL)
00148     if self.rootitem != None:
00149       self.rootitem.destroy()
00150       self.rootitem = None

Definition at line 217 of file tuxpaint.py.

00217 
00218   def init_config(self):
00219     default_config_dict = { 'fullscreen'             : 'True',
00220                             'disable_shape_rotation' : 'False',
00221                             'uppercase_text'         : 'False',
00222                             'disable_stamps'         : 'False',
00223                             'disable_stamps_control' : 'False',
00224                             'size'                   : 'True'
00225       }
00226     return default_config_dict

def tuxpaint.Gcompris_tuxpaint.key_press (   self,
  keyval,
  commit_str,
  preedit_str 
)

Definition at line 157 of file tuxpaint.py.

00157 
00158   def key_press(self, keyval, commit_str, preedit_str):
00159     return False

Definition at line 154 of file tuxpaint.py.

00154 
00155   def ok(self):
00156     pass

def tuxpaint.Gcompris_tuxpaint.pause (   self,
  pause 
)

Definition at line 163 of file tuxpaint.py.

00163 
00164   def pause(self, pause):
00165     pass

Definition at line 160 of file tuxpaint.py.

00160 
00161   def repeat(self):
00162     pass

def tuxpaint.Gcompris_tuxpaint.set_level (   self,
  level 
)

Definition at line 151 of file tuxpaint.py.

00151 
00152   def set_level(self,level):
00153     pass

def tuxpaint.Gcompris_tuxpaint.stamps_changed (   self,
  button 
)

Definition at line 209 of file tuxpaint.py.

00209 
00210   def stamps_changed(self, button):
00211     self.stamps_control.set_sensitive(not button.get_active())

Definition at line 51 of file tuxpaint.py.

00051 
00052   def start(self):
00053 #    line = os.sys.stdin.readline()
00054 #    while (len(line) >1):
00055 #      exec(line)
00056 #      line = os.sys.stdin.readline()
00057 
00058     self.window = self.gcomprisBoard.canvas.get_toplevel()
00059 
00060     #global board
00061     #board = self
00062 
00063     Prop = gcompris.get_properties()
00064 
00065     #get default values
00066     self.config_dict = self.init_config()
00067 
00068     #replace configured values
00069     self.config_dict.update(gcompris.get_board_conf())
00070 
00071     self.rootitem = self.gcomprisBoard.canvas.root().add(
00072       gnomecanvas.CanvasGroup,
00073       x=0.0,
00074       y=0.0
00075       )
00076 
00077     options = ['tuxpaint']
00078 
00079     if (Prop.fullscreen and eval(self.config_dict['fullscreen'])):
00080       options.append('--fullscreen')
00081 
00082     # tuxpaint size are 800x600 and 640x480 in 9.14
00083     # in cvs (future 9.15) it will be
00084     # [--640x480   | --800x600   | --1024x768 |
00085     #  --1280x1024 | --1400x1050 | --1600x1200]
00086     if (Prop.screensize and eval(self.config_dict['size'])):
00087       if (Prop.screensize >=1):
00088         print 'Prop.screensize', Prop.screensize
00089         options.append('--800x600')
00090       else:
00091         options.append('--640x480')
00092 
00093     if eval(self.config_dict['disable_shape_rotation']):
00094       options.append('--simpleshapes')
00095 
00096     if eval(self.config_dict['uppercase_text']):
00097       options.append('--uppercase')
00098 
00099     if eval(self.config_dict['disable_stamps']):
00100       options.append('--nostamps')
00101 
00102     if eval(self.config_dict['disable_stamps_control']):
00103       options.append('--nostampcontrols')
00104 
00105     gcompris.sound.close()
00106 
00107     # release pointergrab if running fullscreen, tuxpaint wants to grab the
00108     # pointer itself
00109     if (Prop.fullscreen and not Prop.noxf86vm):
00110       gtk.gdk.pointer_ungrab()
00111 
00112     #self.window.set_property("accept-focus", 0)
00113     #self.window.set_keep_below(False)
00114 
00115     try:
00116       # gobject.SPAWN_DO_NOT_REAP_CHILD|gobject.SPAWN_SEARCH_PATH = 2 | 4
00117       pid,stdin, stdout, stderr = gcompris.spawn_async(
00118         options, flags=2|4)
00119     except:
00120       gcompris.utils.dialog(_("Cannot find Tuxpaint.\nInstall it to use this activity !"),stop_board)
00121       return
00122 
00123     gcompris.child_watch_add(pid, child_callback, self)
00124 
00125     gcompris.bar_set(0)
00126     gcompris.bar_hide(1)
00127 
00128     gcompris.set_background(self.rootitem,
00129                             gcompris.skin.image_to_skin("gcompris-bg.jpg"))
00130 
00131     textItem = self.rootitem.add(
00132       gnomecanvas.CanvasText,
00133       text = _("Waiting for Tuxpaint to finish"),
00134       x = gcompris.BOARD_WIDTH/2,
00135       y = 185,
00136       fill_color_rgba = 0x000000ffL,
00137       font = gcompris.skin.get_font("gcompris/board/title bold"),
00138       )


Member Data Documentation

Definition at line 65 of file tuxpaint.py.

Definition at line 175 of file tuxpaint.py.

Definition at line 42 of file tuxpaint.py.

Definition at line 183 of file tuxpaint.py.

Definition at line 70 of file tuxpaint.py.

Definition at line 206 of file tuxpaint.py.

Definition at line 57 of file tuxpaint.py.


The documentation for this class was generated from the following file: