ummm here is the patch :)
From: [email protected]
To: [email protected]
Date: Sun, 15 Jan 2012 08:49:12 +0000
Subject: [Emc-developers] gladevcp sourceview PATCH for 2.5
I noted that gladevcp's hal sourceview has EMC actions that were not available.
EMC actions 'save' and 'save as' allow one to save their edited Gcode file.
Here is a patch to make them available.
I think this should be included in EMC 2.5.
Advice about inclusion or comments on code ?
Chris M
------------------------------------------------------------------------------
RSA(R) Conference 2012
Mar 27 - Feb 2
Save $400 by Jan. 27
Register now!
http://p.sf.net/sfu/rsa-sfdev2dev2
_______________________________________________
Emc-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-developers
From d58650fe483edc762c5a5661d08b4ee2d2d91a8d Mon Sep 17 00:00:00 2001
From: cmorley <[email protected]>
Date: Sun, 15 Jan 2012 00:21:32 -0800
Subject: [PATCH] gladevcp -enable EMC actions save and saveas to sourceview
These actions were coded but not finished. 'save as' needed a little tlc.
one couldn't enter a new filename.
save will save the current file name and reload the file in EMC
save as will save the file under a new filename but does not reload the file.
maybe this should reload the file too.
also added get_filename to return the EMC's current file path.
---
lib/python/gladevcp/hal_python.xml | 7 +++++--
lib/python/gladevcp/hal_sourceview.py | 8 ++++++--
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/lib/python/gladevcp/hal_python.xml b/lib/python/gladevcp/hal_python.xml
index 90e7cb7..a6ddf94 100644
--- a/lib/python/gladevcp/hal_python.xml
+++ b/lib/python/gladevcp/hal_python.xml
@@ -58,8 +58,9 @@ domain="glade-3" depends="gtk+">
<glade-widget-class name="EMC_FileChooserDialog" generic-name="hal_filechooserdialog" title="EMC FileChooserDialog"/>
<glade-widget-class name="EMC_FileChooserButton" generic-name="hal_filechooserbutton" title="EMC FileChooserButton"/>
<glade-widget-class name="EMC_Action_Open" generic-name="hal_action_open" title="EMC Action Open" icon-name='gtk-open'/>
- <glade-widget-class name="EMC_Action_Reload" generic-name="hal_action_reload" title="EMC Action Reload" icon-name='gtk-reload'/>
-
+ <glade-widget-class name="EMC_Action_Reload" generic-name="hal_action_reload" title="EMC Action Reload" icon-name='gtk-refresh'/>
+ <glade-widget-class name="EMC_Action_Save" generic-name="hal_action_save" title="EMC Action Save" icon-name='gtk-save'/>
+ <glade-widget-class name="EMC_Action_SaveAs" generic-name="hal_action_saveas" title="EMC Action Save As" icon-name='gtk-save-as'/>
<glade-widget-class name="EMC_SourceView" generic-name="hal_sourceview" title="EMC SourceView"/>
<glade-widget-class name="EMC_MDIHistory" generic-name="hal_mdihistory" title="EMC MDIHistory"/>
</glade-widget-classes>
@@ -120,6 +121,8 @@ domain="glade-3" depends="gtk+">
<glade-widget-class-ref name="EMC_Action_Open"/>
<glade-widget-class-ref name="EMC_Action_Reload"/>
+ <glade-widget-class-ref name="EMC_Action_Save"/>
+ <glade-widget-class-ref name="EMC_Action_SaveAs"/>
</glade-widget-group>
</glade-catalog>
diff --git a/lib/python/gladevcp/hal_sourceview.py b/lib/python/gladevcp/hal_sourceview.py
index 45690b9..56f7a98 100644
--- a/lib/python/gladevcp/hal_sourceview.py
+++ b/lib/python/gladevcp/hal_sourceview.py
@@ -51,6 +51,9 @@ class EMC_SourceView(gtksourceview.View, _EMC_ActionBase):
self.gstat.connect('file-loaded', lambda w, f: gobject.timeout_add(1, self.load_file, f))
self.gstat.connect('line-changed', self.set_line)
+ def get_filename(self):
+ return self.filename
+
def load_file(self, fn):
self.filename = fn
if not fn:
@@ -134,10 +137,11 @@ class EMC_Action_SaveAs(EMC_Action_Save):
def on_activate(self, w):
if not self.textview:
return
- dialog = gtk.FileChooserDialog(buttons=(gtk.STOCK_CANCEL,gtk.RESPONSE_CANCEL,gtk.STOCK_SAVE,gtk.RESPONSE_OK))
+ dialog = gtk.FileChooserDialog(title="Save As",action=gtk.FILE_CHOOSER_ACTION_SAVE,
+ buttons=(gtk.STOCK_CANCEL,gtk.RESPONSE_CANCEL,gtk.STOCK_SAVE,gtk.RESPONSE_OK))
dialog.set_do_overwrite_confirmation(True)
if self.textview.filename:
- dialog.set_filename(self.textview.filename)
+ dialog.set_current_name(self.textview.filename)
dialog.show()
r = dialog.run()
fn = dialog.get_filename()
--
1.7.0.4
------------------------------------------------------------------------------
RSA(R) Conference 2012
Mar 27 - Feb 2
Save $400 by Jan. 27
Register now!
http://p.sf.net/sfu/rsa-sfdev2dev2
_______________________________________________
Emc-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-developers