*** empty log message ***

git-svn-id: file:///Users/arjan/backup/gaphor/trunk/gaphor@384 a8418922-720d-0410-834f-a69b97ada669
This commit is contained in:
Arjan Molenaar 2004-09-01 07:31:14 +00:00
parent a73fcba9ae
commit 5822567557
10 changed files with 136 additions and 58 deletions

View File

@ -1,3 +1,18 @@
2004-09-01 Arjan Molenaar <arjanmolenaar@hetnet.nl>
* utils/install_mo.py: fixed bug in installation
* gaphor/i18n.py: make i18n support work
2004-08-31 Arjan Molenaar <arjanmolenaar@hetnet.nl>
* setup.py: fix bug in plugin installation.
* gaphor/pluginmanager.py: add the plugin directories to sys.path,
the plugins will not be loaded after installing gaphor.
* data/plugins/plugineditor: new. was pluginmanager, but that gives
naming conflicts with the gaphor.pluginmanager module.
* gaphor/ui/mainwindow.py: do not put the main window's accel group
on any transient window.
2004-07-22 Arjan Molenaar <arjanmolenaar@hetnet.nl>
* gaphor/ui/mainactions.py: Added DeleteDiagram action.

6
TODO
View File

@ -2,7 +2,7 @@ As always, there is much to do...
- Storing last open files or having a quick-list of most important
directories or so would be great
Problem: the existing <Placeholder> stuff works only on onstrcution time.
Problem: the existing <Placeholder> stuff works only on constrcution time.
For this we need a menu that can change during the life of the application.
@ -15,14 +15,14 @@ As always, there is much to do...
- Undo/redo functionality doesn;t work as espected
- Exporting diagrams to UML XMI, code, images (SVG/png), etc. - make a plugin!
#- Make text selected when starting to edit it: fixed in DiaCanvas2
#- Stereotypes: check documentation page 581 (597 absolute). Fixed. An extra
association has been created between Stereotype and Class, Interface and
Package.
- Exporting diagrams to UML XMI, code, images (SVG/png), etc. - make a plugin!
#- Set up a plugin architecture. Since the internals of gaphor are pretty
modular, plugins should not be that hard.

View File

@ -41,11 +41,13 @@ class GaphorError(Exception):
def main():
"""Start the interactive application.
This involves importing plugins and creating the main window.
"""
# Import stuff here, since the user might not need all the GUI stuff
import gtk
# Load plugin definitions:
import diagram
# Load plugin definitions:
import pluginmanager
from ui.mainwindow import MainWindow

View File

@ -13,7 +13,9 @@ import gettext
try:
catalog = gettext.Catalog('gaphor')
#log.info('catalog = %s' % catalog.info())
_ = catalog.gettext
except IOError:
except IOError, e:
#log.error('Could not load locale catalog', e)
def _(s): return s

View File

@ -18,10 +18,13 @@ Plugin - This class represents a plugin. It contains data from plugin.xml
PluginAction - Defines an gaphor.plugin.Action instance.
PluginLoader - SAX parser used to read the plugin.xml file of a plugin. This
class creates a Plugin instance from the xml file.
"""
User provided plugins overrule the system provided plugins.
"""
import os
import os.path
import glob
import sys
from xml.sax import handler, make_parser
from gaphor import resource
from gaphor.parser import ParserException
@ -30,9 +33,15 @@ from gaphor.misc.odict import odict
XMLNS='http://gaphor.sourceforge.net/gaphor/plugin'
# Directories to look for plugins
DEFAULT_PLUGIN_DIRS = [os.path.join(resource('DataDir'), 'plugins'),
os.path.join(resource('UserDataDir'), 'plugins')]
# Directories to look for plugins. These sirectories are added to the
# search path. User provided plugins overrule system plugins.
DEFAULT_PLUGIN_DIRS = [os.path.join(resource('UserDataDir'), 'plugins'),
os.path.join(resource('DataDir'), 'plugins')]
sys.path.extend(DEFAULT_PLUGIN_DIRS)
#log.debug('sys.path=' + str(sys.path))
#log.debug('DEFAULT_PLUGIN_DIRS=' + str(DEFAULT_PLUGIN_DIRS))
class Plugin(object):
"""A plugin represents one plugin loaded from the file system.
@ -79,7 +88,7 @@ class Plugin(object):
def import_plugin(self):
"""Do the actual import of the plugin module.
"""
mod = __import__(self.path, globals(), locals(), [])
mod = __import__(self.path.split(os.sep)[-1], globals(), locals(), [])
self.module = mod
self.initialized = True
if mod:
@ -244,7 +253,12 @@ class PluginManager(object):
if self.bootstrapped:
return
for plugin_dir in DEFAULT_PLUGIN_DIRS:
# Load the plugins in reverse order, so the user plugins will
# overwrite the default plugins. (they are imported in sys.path as
# [user plugins, default plugins]).
default_plugin_dirs = list(DEFAULT_PLUGIN_DIRS)
default_plugin_dirs.reverse()
for plugin_dir in default_plugin_dirs:
self.load_plugins_from_dir(plugin_dir)
import_done = True
@ -272,6 +286,7 @@ class PluginManager(object):
self.plugins[plugin.name] = plugin
def load_plugins_from_dir(self, plugin_dir):
log.debug('Loading plugins from %s' % plugin_dir)
if not os.path.isdir(plugin_dir):
return
for plugin_xml in glob.glob(os.path.join(plugin_dir, '*', 'plugin.xml')):

View File

@ -5,6 +5,7 @@ import gtk
import namespace
import gaphor
import gaphor.UML as UML
from gaphor.i18n import _
from abstractwindow import AbstractWindow
from diagramtab import DiagramTab
from toolbox import Toolbox
@ -17,18 +18,18 @@ class MainWindow(AbstractWindow):
It contains a Namespace-based tree view and a menu and a statusbar.
"""
menu = ('_File', (
menu = (_('_File'), (
'FileNew',
'FileOpen',
'Recent files', (
'To be implemented',),
_('Recent files'), (
_('To be implemented'),),
'<FileOpenSlot>',
'separator',
'FileSave',
'FileSaveAs',
'<FileSaveSlot>',
'separator',
'_Export', (
_('_Export'), (
'FileExportSVG',
'<FileExportSlot>'),
'separator',
@ -36,7 +37,7 @@ class MainWindow(AbstractWindow):
'<FileSlot>',
'separator',
'FileQuit'),
'_Edit', (
_('_Edit'), (
'EditUndo',
'EditRedo',
'separator',
@ -45,7 +46,7 @@ class MainWindow(AbstractWindow):
'EditSelectAll',
'EditDeselectAll',
'<EditSlot>'),
'_Diagram', (
_('_Diagram'), (
'ViewZoomIn',
'ViewZoomOut',
'ViewZoom100',
@ -56,11 +57,11 @@ class MainWindow(AbstractWindow):
'CreateDiagram',
'DeleteDiagram',
'<DiagramSlot>'),
'_Window', (
_('_Window'), (
'OpenEditorWindow',
'OpenConsoleWindow',
'<WindowSlot>'),
'_Help', (
_('_Help'), (
'About',
'<HelpSlot>')
)
@ -82,7 +83,7 @@ class MainWindow(AbstractWindow):
'Pointer',
'InsertComment',
'InsertCommentLine')),
("Classes", (
(_("Classes"), (
'InsertClass',
'InsertInterface',
'InsertPackage',
@ -90,21 +91,21 @@ class MainWindow(AbstractWindow):
'InsertDependency',
'InsertGeneralization',
'InsertImplementation')),
("Actions", (
(_("Actions"), (
'InsertAction',
'InsertInitialNode',
'InsertActivityFinalNode',
'InsertDecisionNode',
'InsertFlow')),
("Components", (
(_("Components"), (
'InsertComponent',)),
("Use Cases", (
(_("Use Cases"), (
'InsertUseCase',
'InsertActor',
'InsertUseCaseAssociation',
'InsertInclude',
'InsertExtend')),
("Profiles", (
(_("Profiles"), (
'InsertProfile',
'InsertMetaClass',
'InsertStereotype',
@ -225,7 +226,7 @@ class MainWindow(AbstractWindow):
"""Add a window as a sub-window of the main application.
"""
# Assign the window the accelerators od the main window too
window.get_window().add_accel_group(self.accel_group)
pass #window.get_window().add_accel_group(self.accel_group)
#self.__transient_windows.append(window)
#window.connect(self.on_transient_window_closed)

View File

@ -346,6 +346,7 @@ class NamespaceModel(gtk.GenericTreeModel):
return self.node_from_element(node[0].namespace)
class NamespaceView(gtk.TreeView):
TARGET_STRING = 0
TARGET_ELEMENT_ID = 1
DND_TARGETS = [
@ -392,16 +393,16 @@ class NamespaceView(gtk.TreeView):
self.drag_source_set(gtk.gdk.BUTTON1_MASK | gtk.gdk.BUTTON3_MASK,
NamespaceView.DND_TARGETS,
gtk.gdk.ACTION_COPY | gtk.gdk.ACTION_LINK)
self.connect('drag-data-get', NamespaceView.do_drag_data_get)
self.connect('drag-data-get', NamespaceView.on_drag_data_get)
# drop
#self.drag_dest_set (gtk.DEST_DEFAULT_ALL, [NamespaceView.DND_TARGETS[-1]],
# gtk.gdk.ACTION_DEFAULT)
self.enable_model_drag_dest([NamespaceView.DND_TARGETS[-1]],
gtk.gdk.ACTION_DEFAULT)
self.connect('drag-data-received', NamespaceView.do_drag_data_received)
self.connect('drag-drop', NamespaceView.do_drag_drop)
self.connect('drag-data-delete', NamespaceView.do_drag_data_delete)
self.connect('drag-data-received', NamespaceView.on_drag_data_received)
self.connect('drag-drop', NamespaceView.on_drag_drop)
self.connect('drag-data-delete', NamespaceView.on_drag_data_delete)
def get_selected_element(self):
selection = self.get_selection()
@ -445,11 +446,11 @@ class NamespaceView(gtk.TreeView):
# def do_drag_begin (self, context):
# print 'do_drag_begin'
def do_drag_data_get(self, context, selection_data, info, time):
"""Get the data to be dropped by do_drag_data_received().
def on_drag_data_get(self, context, selection_data, info, time):
"""Get the data to be dropped by on_drag_data_received().
We send the id of the dragged element.
"""
#log.debug('do_drag_data_get')
#log.debug('on_drag_data_get')
selection = self.get_selection()
model, iter = selection.get_selected()
if iter:
@ -459,14 +460,14 @@ class NamespaceView(gtk.TreeView):
else:
selection_data.set(selection_data.target, 8, element.name)
def do_drag_data_delete (self, context):
def on_drag_data_delete (self, context):
"""DnD magic. do not touch
"""
self.emit_stop_by_name('drag-data-delete')
# Drop
def do_drag_data_received(self, context, x, y, selection, info, time):
"""Drop the data send by do_drag_data_get().
def on_drag_data_received(self, context, x, y, selection, info, time):
"""Drop the data send by on_drag_data_get().
"""
self.emit_stop_by_name('drag-data-received')
#print 'drag_data_received'
@ -510,7 +511,7 @@ class NamespaceView(gtk.TreeView):
selection = self.get_selection()
selection.select_path(path)
def do_drag_drop(self, context, x, y, time):
def on_drag_drop(self, context, x, y, time):
"""DnD magic. do not touch
"""
self.emit_stop_by_name('drag-drop')

View File

@ -4,19 +4,19 @@
#
msgid ""
msgstr ""
"Project-Id-Version: 0.4.0\n"
"POT-Creation-Date: Thu Jun 10 07:47:32 2004\n"
"Project-Id-Version: 0.5.1\n"
"POT-Creation-Date: Tue Aug 31 17:32:43 2004\n"
"PO-Revision-Date: 2004-06-10 08:00+001\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Last-Translator: Arjan Molenaar <arjanmol_at_users.sourceforge.org>\n"
"Language-Team: nl\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: pygettext.py 1.4\n"
#: gaphor/diagram/klass.py:259
#: gaphor/diagram/klass.py:320
msgid "(from %s)"
msgstr ""
msgstr "(van %s)"
#: gaphor/storage.py:143
msgid "Loading %d elements..."
@ -38,18 +38,54 @@ msgstr "Laden van model %s"
msgid "Loading..."
msgstr "Bezig met laden..."
#: gaphor/ui/stereotypewindow.py:51
msgid "Stereotypes"
msgstr ""
#: gaphor/ui/mainwindow.py:21
msgid "_File"
msgstr "_Bestand"
#: gaphor/ui/stereotypewindow.py:60
msgid "Base class:"
msgstr ""
#: gaphor/ui/mainwindow.py:24
msgid "Recent files"
msgstr "Recente bestanden"
#: gaphor/ui/stereotypewindow.py:65
msgid "Description:"
msgstr ""
#: gaphor/ui/mainwindow.py:25
msgid "To be implemented"
msgstr "Not niet gemaakt"
#: gaphor/ui/stereotypewindow.py:70
msgid "Constraints:"
msgstr ""
#: gaphor/ui/mainwindow.py:32
msgid "_Export"
msgstr "_Exporteer"
#: gaphor/ui/mainwindow.py:40
msgid "_Edit"
msgstr "_Wijzig"
#: gaphor/ui/mainwindow.py:49
msgid "_Diagram"
msgstr "_Diagram"
#: gaphor/ui/mainwindow.py:60
msgid "_Window"
msgstr "_Venster"
#: gaphor/ui/mainwindow.py:64
msgid "_Help"
msgstr "_Help"
#: gaphor/ui/mainwindow.py:86
msgid "Classes"
msgstr "Klassen"
#: gaphor/ui/mainwindow.py:94
msgid "Actions"
msgstr "Akties"
#: gaphor/ui/mainwindow.py:100
msgid "Components"
msgstr "Componenten"
#: gaphor/ui/mainwindow.py:102
msgid "Use Cases"
msgstr "Use cases"
#: gaphor/ui/mainwindow.py:108
msgid "Profiles"
msgstr "Profilen"

View File

@ -8,7 +8,7 @@
MAJOR_VERSION = 0
MINOR_VERSION = 5
MICRO_VERSION = 0
MICRO_VERSION = 1
VERSION = '%d.%d.%d' % ( MAJOR_VERSION, MINOR_VERSION, MICRO_VERSION )
@ -147,7 +147,7 @@ class version_py:
f.write('VERSION=\'%s\'\n' % VERSION)
f.write('DATA_DIR=\'%s\'\n' % data_dir)
f.write('import os\n')
f.write('USER_DATA_DIR=os.getenv(\'HOME\') + \'.gaphor\'\n')
f.write('USER_DATA_DIR=os.path.join(os.getenv(\'HOME\'), \'.gaphor\')\n')
f.write('del os\n')
f.close()
self.byte_compile([outfile])
@ -355,7 +355,8 @@ setup(name='gaphor',
# data files are relative to <prefix>/share/gaphor (see setup.cfg)
data_files=[('', ['data/icons.xml']),
('pixmaps', glob('data/pixmaps/*.png')),
('plugins', glob('data/plugins/**'))
('plugins/plugineditor', glob('data/plugins/plugineditor/*.*')),
('plugins/checkmetamodel', glob('data/plugins/checkmetamodel/*.*'))
],
scripts=['bin/gaphor'],

View File

@ -23,7 +23,7 @@ class install(_install):
def finalize_options(self):
_install.finalize_options(self)
#if not self.install_locales:
self.install_locales = os.path.join(change_root(self.root or '', self.install_base), 'share', 'locale')
self.install_locales = os.path.join(self.install_base, 'share', 'locale')
install.sub_commands.append(('install_mo', None))
@ -38,16 +38,21 @@ class install_mo(Command):
def initialize_options(self):
self.install_dir = None
self.build_dir = None
self.root = None
def finalize_options(self):
self.set_undefined_options('build',
('build_locales', 'build_dir'))
self.set_undefined_options('install',
('install_locales', 'install_dir'))
('install_locales', 'install_dir'),
('root', 'root'))
self.all_linguas = self.distribution.get_all_linguas()
self.name = self.distribution.get_name()
if self.root:
self.install_dir = change_root(self.root, self.install_dir)
def run(self):
if not self.all_linguas:
return