Permalink
Browse files

*** empty log message ***

git-svn-id: file:///Users/arjan/backup/gaphor/trunk/gaphor@486 a8418922-720d-0410-834f-a69b97ada669
  • Loading branch information...
1 parent e529db2 commit 52c889cf33fd802fb3d30f6f9f9a1da74fa28cfc @amolenaar amolenaar committed Nov 17, 2004
View
@@ -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
@@ -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">
<!--
@@ -7,13 +7,31 @@
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")
@@ -12,14 +12,18 @@ def update(self):
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()
@@ -8,8 +8,12 @@
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 @@ def execute(self):
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:
@@ -245,7 +245,6 @@ def update_stereotype(self):
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
@@ -255,7 +255,7 @@ def execute(self):
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
@@ -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

0 comments on commit 52c889c

Please sign in to comment.