*** empty log message ***

git-svn-id: file:///Users/arjan/backup/gaphor/trunk/gaphor@486 a8418922-720d-0410-834f-a69b97ada669
This commit is contained in:
Arjan Molenaar 2004-11-17 07:39:58 +00:00
parent e529db2d65
commit 52c889cf33
8 changed files with 55 additions and 23 deletions

View File

@ -1,3 +1,11 @@
2004-11-17 Arjan Molenaar <arjanmolenaar@hetnet.nl>
* setup.py: bumped version to 0.7.0.
* data/plugins/xmiexport/__init__.py,
data/plugins/svgexport/__init__.py,
data/plugins/pngexport/pngexport.py: add FileChooserDialog. PNG export
marked as experimental.
2004-11-16 Arjan Molenaar <arjanmolenaar@hetnet.nl>
* gaphor/diagram/association.py: do no longer draw arrows if the

View File

@ -22,7 +22,7 @@
Actions should be defined on the module's toplevel (like in __init__.py).
-->
<action id="PNGExport"
label="PNG Export"
label="PNG Export (experimental)"
tooltip="Export the model to PNG"
class="PNGExport" slot="FileExportSlot">
<!--

View File

@ -7,13 +7,31 @@ import gtk
class PNGExport(Action):
def update(self):
tab = self.get_window().get_current_diagram_tab()
self.sensitive = tab and True or False
def execute(self):
view = self.get_window().get_current_diagram_view()
#view=diacanvas.get_active_view()
window = view.window
# Should use canvas geometry:
(x,y,width,height,depth) = window.get_geometry()
pixbuf = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB,False,8,width,height)
buffer = pixbuf.get_from_drawable(window, view.get_colormap(),0,0,0,0,width,height)
buffer.save("/tmp/screenshot.png","png")
if gtk.gtk_version < (2, 4, 0):
filesel = gtk.FileSelection('Export diagram to PNG file')
else:
filesel = gtk.FileChooserDialog(title='Export diagram to PNG file',
action=gtk.FILE_CHOOSER_ACTION_SAVE,
buttons=(gtk.STOCK_CANCEL,gtk.RESPONSE_CANCEL,gtk.STOCK_SAVE,gtk.RESPONSE_OK))
filesel.set_filename((self.get_window().get_current_diagram().name or 'export') + '.png')
response = filesel.run()
filename = filesel.get_filename()
filesel.destroy()
if response == gtk.RESPONSE_OK:
if filename and len(filename) > 0:
view = self.get_window().get_current_diagram_view()
#view=diacanvas.get_active_view()
window = view.window
# Should use canvas geometry:
(x,y,width,height,depth) = window.get_geometry()
pixbuf = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB,False,8,width,height)
buffer = pixbuf.get_from_drawable(window, view.get_colormap(),
0, 0, 0, 0, width, height)
buffer.save(filename, "png")

View File

@ -12,14 +12,18 @@ class SVGExportAction(Action):
self.sensitive = tab and True or False
def execute(self):
filesel = gtk.FileSelection('Export diagram to SVG file')
filesel.set_modal(True)
if gtk.gtk_version < (2, 4, 0):
filesel = gtk.FileSelection('Export diagram to SVG file')
else:
filesel = gtk.FileChooserDialog(title='Export diagram to SVG file',
action=gtk.FILE_CHOOSER_ACTION_SAVE,
buttons=(gtk.STOCK_CANCEL,gtk.RESPONSE_CANCEL,gtk.STOCK_SAVE,gtk.RESPONSE_OK))
filesel.set_filename((self.get_window().get_current_diagram().name or 'export') + '.svg')
response = filesel.run()
filesel.hide()
filename = filesel.get_filename()
filesel.destroy()
if response == gtk.RESPONSE_OK:
filename = filesel.get_filename()
if filename and len(filename) > 0:
log.debug('Exporting SVG image to: %s' % filename)
canvas = self.get_window().get_current_diagram_tab().get_canvas()

View File

@ -8,8 +8,12 @@ from gaphor.plugin import Action
class XMIExportAction(Action):
def execute(self):
filesel = gtk.FileSelection('Export model to XMI file')
filesel.set_modal(True)
if gtk.gtk_version < (2, 4, 0):
filesel = gtk.FileSelection('Export model to XMI file')
else:
filesel = gtk.FileChooserDialog(title='Export model to XMI file',
action=gtk.FILE_CHOOSER_ACTION_SAVE,
buttons=(gtk.STOCK_CANCEL,gtk.RESPONSE_CANCEL,gtk.STOCK_SAVE,gtk.RESPONSE_OK))
filename = self.get_window().get_filename()
if filename:
filename = filename.replace('.gaphor', '.xmi')
@ -18,11 +22,10 @@ class XMIExportAction(Action):
filesel.set_filename(filename)
response = filesel.run()
filesel.hide()
filename = filesel.get_filename()
filesel.destroy()
if response == gtk.RESPONSE_OK:
filename = filesel.get_filename()
if filename and len(filename) > 0:
#self.filename = filename
log.debug('Exporting XMI model to: %s' % filename)
export = XMIExport()
try:

View File

@ -245,7 +245,6 @@ class ClassifierItem(NamedItem):
ExtensionItem.confirm_connect_handle
"""
subject = self.subject
#if not hasattr(subject, 'appliedStereotype'): return
applied_stereotype = subject.appliedStereotype
if applied_stereotype:
# Return a nice name to display as stereotype:

View File

@ -255,7 +255,7 @@ class SaveAsAction(Action):
else:
filesel = gtk.FileChooserDialog(title='Save Gaphor model as',
action=gtk.FILE_CHOOSER_ACTION_SAVE,
buttons=(gtk.STOCK_CANCEL,gtk.RESPONSE_CANCEL,gtk.STOCK_OPEN,gtk.RESPONSE_OK))
buttons=(gtk.STOCK_CANCEL,gtk.RESPONSE_CANCEL,gtk.STOCK_SAVE,gtk.RESPONSE_OK))
filesel.set_filename(filename or '')
response = filesel.run()
filename = None

View File

@ -7,12 +7,12 @@
"""
MAJOR_VERSION = 0
MINOR_VERSION = 6
MICRO_VERSION = 2
MINOR_VERSION = 7
MICRO_VERSION = 0
VERSION = '%d.%d.%d' % ( MAJOR_VERSION, MINOR_VERSION, MICRO_VERSION )
GCONF_DOMAIN='/apps/gaphor/' # don't forget trailing slash
#GCONF_DOMAIN='/apps/gaphor/' # don't forget trailing slash
import sys, os
from glob import glob