* fixed line endings

* fix stock icon loading so it works in conjunction with plugins.

git-svn-id: file:///Users/arjan/backup/gaphor/gaphor/trunk@1806 a8418922-720d-0410-834f-a69b97ada669
This commit is contained in:
Arjan Molenaar 2007-08-01 13:59:01 +00:00
parent 58e9b4e87e
commit c1bb0713a6
3 changed files with 46 additions and 43 deletions

View File

@ -1,39 +1,39 @@
""" """
The Core module provides an entry point for Gaphor's core constructs. The Core module provides an entry point for Gaphor's core constructs.
An average module should only need to import this module. An average module should only need to import this module.
""" """
from gaphor.application import Application as _Application from gaphor.application import Application as _Application
from gaphor.transaction import Transaction, transactional from gaphor.transaction import Transaction, transactional
from gaphor.action import action, toggle_action, radio_action, build_action_group from gaphor.action import action, toggle_action, radio_action, build_action_group
from gaphor.i18n import _ from gaphor.i18n import _
class inject(object): class inject(object):
""" """
Simple descriptor for dependency injection. Simple descriptor for dependency injection.
This is technically a wrapper around Application.get_service(). This is technically a wrapper around Application.get_service().
Usage:: Usage::
class A(object): class A(object):
gui_manager = inject('gui_manager') gui_manager = inject('gui_manager')
""" """
def __init__(self, name): def __init__(self, name):
self._name = name self._name = name
self._inj = None self._inj = None
def __get__(self, obj, class_=None): def __get__(self, obj, class_=None):
""" """
Resolve a dependency, but only if we're called from an object instance. Resolve a dependency, but only if we're called from an object instance.
""" """
if not obj: if not obj:
return self return self
if self._inj is None: if self._inj is None:
self._inj = _Application.get_service(self._name) self._inj = _Application.get_service(self._name)
return self._inj return self._inj
# vim:sw=4:et:ai # vim:sw=4:et:ai

View File

@ -116,7 +116,7 @@ def load_stock_icons():
""" """
from xml.sax import make_parser from xml.sax import make_parser
parser = make_parser() parser = make_parser()
icon_dir = os.path.abspath(pkg_resources.resource_filename('gaphor', 'ui/pixmaps')) icon_dir = os.path.abspath(pkg_resources.resource_filename('gaphor.ui', 'pixmaps'))
log.info('Icon dir: %s' % icon_dir) log.info('Icon dir: %s' % icon_dir)
#icon_dir = 'gaphor/data/pixmaps' #icon_dir = 'gaphor/data/pixmaps'
loader = StockIconLoader(icon_dir) loader = StockIconLoader(icon_dir)
@ -124,7 +124,7 @@ def load_stock_icons():
parser.setFeature(handler.feature_namespaces, 1) parser.setFeature(handler.feature_namespaces, 1)
parser.setContentHandler(loader) parser.setContentHandler(loader)
filename = pkg_resources.resource_filename('gaphor', 'ui/icons.xml') filename = pkg_resources.resource_filename('gaphor.ui', 'icons.xml')
if os.name == 'nt': if os.name == 'nt':
# Make the filename a full URL # Make the filename a full URL
filename = 'file:' + filename.replace('\\\\', '/') filename = 'file:' + filename.replace('\\\\', '/')

View File

@ -89,8 +89,11 @@ setup(
author_email='arjanmol@users.sourceforge.net', author_email='arjanmol@users.sourceforge.net',
license='GNU General Public License', license='GNU General Public License',
description='Gaphor is a UML modeling tool', description='Gaphor is a UML modeling tool',
long_description="Gaphor is a UML modeling tool written in Python. " long_description="""
"It uses the GTK+ environment for user interaction.", Gaphor is a UML modeling tool written in Python.
It uses the GTK+ environment for user interaction.
""",
classifiers = [ classifiers = [
'Development Status :: 4 - Beta', 'Development Status :: 4 - Beta',
'Environment :: X11 Applications :: GTK', 'Environment :: X11 Applications :: GTK',