From: <umg...@us...> - 2007-04-03 11:45:39
|
Revision: 393 http://svn.sourceforge.net/pybridge/?rev=393&view=rev Author: umgangee Date: 2007-04-03 04:45:40 -0700 (Tue, 03 Apr 2007) Log Message: ----------- Move UI-wide Settings instance to pybridge.ui; remove utils. Modified Paths: -------------- trunk/pybridge/pybridge/ui/__init__.py Removed Paths: ------------- trunk/pybridge/pybridge/ui/utils.py Modified: trunk/pybridge/pybridge/ui/__init__.py =================================================================== --- trunk/pybridge/pybridge/ui/__init__.py 2007-04-03 11:42:56 UTC (rev 392) +++ trunk/pybridge/pybridge/ui/__init__.py 2007-04-03 11:45:40 UTC (rev 393) @@ -16,26 +16,34 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +from twisted.internet import gtk2reactor +gtk2reactor.install() +import gtk + +from twisted.internet import reactor + +import pybridge.environment as env +from pybridge.settings import Settings + +import locale +import gettext +locale.setlocale(locale.LC_ALL, '') +gettext.bindtextdomain('pybridge', env.get_localedir()) +gettext.textdomain('pybridge') +gettext.install('pybridge') + +filename = env.find_config_client('client.cfg') +settings = Settings(filename, ['Connection', 'General']) + + def run(): - """""" - from twisted.internet import gtk2reactor - gtk2reactor.install() - - import gtk - from twisted.internet import reactor - - import locale - import gettext - import pybridge.environment as env - locale.setlocale(locale.LC_ALL, '') - gettext.bindtextdomain('pybridge', env.get_localedir()) - gettext.textdomain('pybridge') - gettext.install('pybridge') - - import utils - utils.windows.open('dialog_connection') - - # Start the program. + """Starts the PyBridge client UI.""" + + from manager import wm + from window_main import WindowMain + wm.open(WindowMain) + + # Start the event loop. reactor.run() gtk.main() Deleted: trunk/pybridge/pybridge/ui/utils.py =================================================================== --- trunk/pybridge/pybridge/ui/utils.py 2007-04-03 11:42:56 UTC (rev 392) +++ trunk/pybridge/pybridge/ui/utils.py 2007-04-03 11:45:40 UTC (rev 393) @@ -1,86 +0,0 @@ -# PyBridge -- online contract bridge made easy. -# Copyright (C) 2004-2007 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. - - -# Set up client with UI event handler. -from pybridge.network.client import client -from eventhandler import eventhandler -client.setEventHandler(eventhandler) - -PORT = 5040 # Default port for PyBridge. - - -import pybridge.environment as env -from pybridge.settings import Settings - -file = env.find_config_client('client.cfg') -settings = Settings(file, ['Connection', 'General']) - - -import imp -from UserDict import UserDict - - -class WindowManager(UserDict): - - - def open(self, windowname, parent=None): - """Creates a new instance of a GladeWrapper window. - - @param windowname: the module name of the window. - @param parent: if specified, a parent window to set transient property. - """ - classname = ''.join([x.capitalize() for x in windowname.split('_')]) - exec("from %s import %s" % (windowname, classname)) - instance = eval(classname)(parent) - self[windowname] = instance - return instance - - - def close(self, windowname, instance=None): - """Closes an existing instance of a GladeWrapper window. - - @param windowname: the module name of the window. - @param instance: if provided, the specific window object to close. - """ - if instance or self.get(windowname): - if instance is None: - instance = self[windowname] - instance.window.destroy() - instance.cleanup() - if self.get(windowname) == instance: - del self[windowname] - return True - return False - - -windows = WindowManager() - - - - -import gtk -from twisted.internet import reactor - - -def quit(): - """Shutdown gracefully.""" - client.disconnect() - settings.save() # Save settings. - reactor.stop() - gtk.main_quit() - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |