From: <umg...@us...> - 2006-10-09 17:45:29
|
Revision: 350 http://svn.sourceforge.net/pybridge/?rev=350&view=rev Author: umgangee Date: 2006-10-09 10:44:51 -0700 (Mon, 09 Oct 2006) Log Message: ----------- Add DialogPreferences window class. Modified Paths: -------------- trunk/pybridge/pybridge/ui/window_main.py Added Paths: ----------- trunk/pybridge/pybridge/ui/dialog_preferences.py Added: trunk/pybridge/pybridge/ui/dialog_preferences.py =================================================================== --- trunk/pybridge/pybridge/ui/dialog_preferences.py (rev 0) +++ trunk/pybridge/pybridge/ui/dialog_preferences.py 2006-10-09 17:44:51 UTC (rev 350) @@ -0,0 +1,62 @@ +# PyBridge -- online contract bridge made easy. +# Copyright (C) 2004-2006 PyBridge Project. +# +# 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; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + +import gtk +import os +from wrapper import GladeWrapper + +from pybridge.environment import environment +import utils + + +class DialogPreferences(GladeWrapper): + + glade_name = 'dialog_preferences' + + + def new(self): + model = gtk.ListStore(str) + self.carddeck.set_model(model) + cell = gtk.CellRendererText() + self.carddeck.pack_start(cell, True) + self.carddeck.add_attribute(cell, 'text', 0) + # Populate list of card decks. + path = environment.find_pixmap('') + for filename in os.listdir(path): + if filename.endswith('.png'): + iter = model.append((filename,)) + if filename == 'bonded.png': + self.carddeck.set_active_iter(iter) + + +# Signal handlers. + + + def on_carddeck_changed(self, widget, *args): + print "changed" + + + def on_cancelbutton_clicked(self, widget, *args): + print "cancel" + utils.windows.close(self.glade_name) + + + def on_okbutton_clicked(self, widget, *args): + print "ok" + utils.windows.close(self.glade_name) + Modified: trunk/pybridge/pybridge/ui/window_main.py =================================================================== --- trunk/pybridge/pybridge/ui/window_main.py 2006-10-09 17:41:57 UTC (rev 349) +++ trunk/pybridge/pybridge/ui/window_main.py 2006-10-09 17:44:51 UTC (rev 350) @@ -172,9 +172,7 @@ self.frame_personinfo.set_property('sensitive', False) self.label_personname.set_text('') - - def on_window_main_delete_event(self, widget, *args): utils.quit() # return True @@ -200,6 +198,10 @@ utils.quit() + def on_preferences_activate(self, widget, *args): + utils.windows.open('dialog_preferences') + + def on_homepage_activate(self, widget, *args): webbrowser.open('http://pybridge.sourceforge.net/') This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |