[Yt-svn] commit/yt: MatthewTurk: Adding an upload button to reason.

Bitbucket commits-noreply at bitbucket.org
Sun Jun 12 00:51:39 PDT 2011


1 new changeset in yt:

http://bitbucket.org/yt_analysis/yt/changeset/473e51c0d8f5/
changeset:   473e51c0d8f5
branch:      yt
user:        MatthewTurk
date:        2011-06-12 09:51:30
summary:     Adding an upload button to reason.

This closes #286.
affected #:  4 files (1.6 KB)

--- a/yt/gui/reason/extdirect_repl.py	Sat Jun 11 21:59:10 2011 -0700
+++ b/yt/gui/reason/extdirect_repl.py	Sun Jun 12 00:51:30 2011 -0700
@@ -386,7 +386,17 @@
         cs = cStringIO.StringIO()
         cs.write("\n######\n".join(self.executed_cell_texts))
         cs = cs.getvalue()
-        ret = p.pastes.newPaste('pytb', cs, None, '', '', True)
+        ret = p.pastes.newPaste('python', cs, None, '', '', True)
+        site = "http://paste.enzotools.org/show/%s" % ret
+        return {'status': 'SUCCESS', 'site': site}
+
+    @lockit
+    def paste_text(self, to_paste):
+        import xmlrpclib, cStringIO
+        p = xmlrpclib.ServerProxy(
+            "http://paste.enzotools.org/xmlrpc/",
+            allow_none=True)
+        ret = p.pastes.newPaste('python', to_paste, None, '', '', True)
         site = "http://paste.enzotools.org/show/%s" % ret
         return {'status': 'SUCCESS', 'site': site}
 


--- a/yt/gui/reason/html/index.html	Sat Jun 11 21:59:10 2011 -0700
+++ b/yt/gui/reason/html/index.html	Sun Jun 12 00:51:30 2011 -0700
@@ -53,6 +53,9 @@
     .singledownarrow { 
         background-image:url(images/single_down_sm.png) !important;
     }
+    .upload { 
+        background-image:url(images/upload.png) !important;
+    }
     #input_line {
         font-family: monospace;
     }


--- a/yt/gui/reason/html/js/functions.js	Sat Jun 11 21:59:10 2011 -0700
+++ b/yt/gui/reason/html/js/functions.js	Sun Jun 12 00:51:30 2011 -0700
@@ -173,6 +173,29 @@
                     { xtype: 'button',
                       width: 24,
                       height: 24,
+                      iconCls: 'upload',
+                      tooltip: 'Upload to Pastebin',
+                      listeners: {
+                          click: function(f, e) {
+                            yt_rpc.ExtDirectREPL.paste_text({to_paste:raw_input},
+                              function(f, a) {
+                                if (a.result['status'] == 'SUCCESS') {
+                                    var alert_text = 'Pasted cell to:<br>' + 
+                                    a.result['site']
+                                    var alert_text_rec = 'Pasted cell to: ' + 
+                                    a.result['site']
+                                    Ext.Msg.alert('Pastebin', alert_text);
+                                    var record = new logging_store.recordType(
+                                        {record: alert_text_rec });
+                                    logging_store.add(record, number_log_records++);
+                              }
+                            });
+                          }
+                        }
+                    },
+                    { xtype: 'button',
+                      width: 24,
+                      height: 24,
                       iconCls: 'doubleuparrow',
                       tooltip: 'Copy into current cell',
                       listeners: {

Repository URL: https://bitbucket.org/yt_analysis/yt/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.



More information about the yt-svn mailing list