1
0
Fork 0
mirror of https://github.com/shlomif/PySolFC.git synced 2025-04-05 00:02:29 -04:00
PySolFC/pysollib/pysolgtk/playeroptionsdialog.py
skomoroh 7b10c8f9ed * improved support GTK (alpha)
git-svn-id: file:///home/shlomif/Backup/svn-dumps/PySolFC/svnsync-repos/pysolfc/PySolFC/trunk@49 efabe8c0-fbe8-4139-b769-b5e6d273206e
2006-08-16 21:20:28 +00:00

113 lines
3.9 KiB
Python

## vim:ts=4:et:nowrap
##
##---------------------------------------------------------------------------##
##
## PySol -- a Python Solitaire game
##
## Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer
## Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer
## Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer
## Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer
## Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer
## Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer
## All Rights Reserved.
##
## 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; see the file COPYING.
## If not, write to the Free Software Foundation, Inc.,
## 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
##
## Markus F.X.J. Oberhumer
## <markus@oberhumer.com>
## http://www.oberhumer.com/pysol
##
##---------------------------------------------------------------------------##
__all__ = ['PlayerOptionsDialog']
# imports
import gobject, gtk
# PySol imports
# Toolkit imports
from tkwidget import MfxDialog
from pysollib.mfxutil import kwdefault
# /***********************************************************************
# //
# ************************************************************************/
class PlayerOptionsDialog(MfxDialog):
def __init__(self, parent, title, app, **kw):
kw = self.initKw(kw)
MfxDialog.__init__(self, parent, title, **kw)
#
top_box, bottom_box = self.createVBox()
#
label = gtk.Label('Please enter your name')
label.show()
top_box.pack_start(label)
self.player_entry = gtk.Entry()
self.player_entry.show()
top_box.pack_start(self.player_entry, expand=False)
completion = gtk.EntryCompletion()
self.player_entry.set_completion(completion)
model = gtk.ListStore(gobject.TYPE_STRING)
print '>>', app.getAllUserNames()
for name in app.getAllUserNames():
iter = model.append()
model.set(iter, 0, name)
completion.set_model(model)
completion.set_text_column(0)
self.player_entry.set_text(app.opt.player)
#
self.confirm_quit_check = gtk.CheckButton(_('Confirm quit'))
self.confirm_quit_check.show()
top_box.pack_start(self.confirm_quit_check)
self.confirm_quit_check.set_active(app.opt.confirm != 0)
#
self.update_stats_check = gtk.CheckButton(_('Update statistics and logs'))
self.update_stats_check.show()
top_box.pack_start(self.update_stats_check)
self.update_stats_check.set_active(app.opt.update_player_stats != 0)
#
self.createButtons(bottom_box, kw)
self.show_all()
gtk.main()
def initKw(self, kw):
kwdefault(kw,
strings=(_('&OK'), _('&Cancel'),),
default=0,
#resizable=1,
#font=None,
padx=10, pady=10,
#width=600, height=400,
##~ buttonpadx=10, buttonpady=5,
)
return MfxDialog.initKw(self, kw)
def done(self, button):
self.button = button.get_data('user_data')
self.player = self.player_entry.get_text()
self.confirm = self.confirm_quit_check.get_active()
self.update_stats = self.update_stats_check.get_active()
self.win_animation = False
self.quit()