473,379 Members | 1,191 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

firefox add-on to grab python code handily?

CM
I encounter a fair number of small Python scripts online, and usually
try them out by copying them to the clipboard, pasting into Notepad,
saving them, and either running them directly or opening them in
IDLE.

And so I was wondering if anyone knew of an extension/add-on/script
for Firefox which would allow a way to do something like this:

user highlights Python code on a webpage
right clicks
selects a menu item, "Save as Python code"
FF pops up a filename dialog or popup for filename
(and, though I don't know if this is possible, runs Python code)

Not an important thing by any means, but it would be a nice
convenience.
I know there are similar add-ons in FF for grabbing highlighted text
and
saving, but they are not good, as they don't seem to preserve line
breaks
properly or append the .py extension, etc. I've Googled for this and
so far
it seems it doesn't exist. Anyone know?
Jun 27 '08 #1
4 1355
CM wrote:
I encounter a fair number of small Python scripts online, and usually
try them out by copying them to the clipboard, pasting into Notepad,
saving them, and either running them directly or opening them in
IDLE.

And so I was wondering if anyone knew of an extension/add-on/script
for Firefox which would allow a way to do something like this:

user highlights Python code on a webpage
right clicks
selects a menu item, "Save as Python code"
FF pops up a filename dialog or popup for filename
(and, though I don't know if this is possible, runs Python code)

Not an important thing by any means, but it would be a nice
convenience.
I know there are similar add-ons in FF for grabbing highlighted text
and
saving, but they are not good, as they don't seem to preserve line
breaks
properly or append the .py extension, etc. I've Googled for this and
so far
it seems it doesn't exist. Anyone know?

Since most of us keep Idle or some other Python IDE open nearly 100% of the time
we just copy from webpage, paste into new Python document, and run in the IDE.
While you could clearly write a plug-in for FF to achieve this, IMHO I doubt
many people would actually use it.

-Larry
Jun 27 '08 #2
On Behalf Of Larry Bates
Since most of us keep Idle or some other Python IDE open
nearly 100% of the time we just copy from webpage, paste into
new Python document, and run in the IDE.
While you could clearly write a plug-in for FF to achieve
this, IMHO I doubt many people would actually use it.
Not that I'm going to implement it, but it would be really neat to tie
something together with codepad[1]

[1] http://codepad.org/
(With the site owner's permission, of course!)

Regards,
Ryan Ginstrom

Jun 27 '08 #3
On May 10, 8:58 am, CM <cmpyt...@gmail.comwrote:
I encounter a fair number of small Python scripts online, and usually
try them out by copying them to the clipboard, pasting into Notepad,
saving them, and either running them directly or opening them in
IDLE.

And so I was wondering if anyone knew of an extension/add-on/script
for Firefox which would allow a way to do something like this:

user highlights Python code on a webpage
right clicks
selects a menu item, "Save as Python code"
FF pops up a filename dialog or popup for filename
(and, though I don't know if this is possible, runs Python code)

Not an important thing by any means, but it would be a nice
convenience.
I know there are similar add-ons in FF for grabbing highlighted text
and
saving, but they are not good, as they don't seem to preserve line
breaks
properly or append the .py extension, etc. I've Googled for this and
so far
it seems it doesn't exist. Anyone know?
Take a look at the crunchy project: http://crunchy.sourceforge.net/

- Paddy.
Jun 27 '08 #4
On Sat, 10 May 2008 17:58:12 +1000, CM <cm******@gmail.comwrote:
I encounter a fair number of small Python scripts online, and usually
try them out by copying them to the clipboard, pasting into Notepad,
saving them, and either running them directly or opening them in
IDLE.

And so I was wondering if anyone knew of an extension/add-on/script
for Firefox which would allow a way to do something like this:

user highlights Python code on a webpage
right clicks
selects a menu item, "Save as Python code"
FF pops up a filename dialog or popup for filename
(and, though I don't know if this is possible, runs Python code)

Not an important thing by any means, but it would be a nice
convenience.
I know there are similar add-ons in FF for grabbing highlighted text
and
saving, but they are not good, as they don't seem to preserve line
breaks
properly or append the .py extension, etc. I've Googled for this and
so far
it seems it doesn't exist. Anyone know?

Not a Firefox add-on, but I found GnuWin32's "getclip" and "putclip" tools
useful. If you are familiar with shell tools, you can use "sed" to remove
leading indentation marks such as "" before you paste sample code into
your IDE:

getclip | sed "s///" | putclip

See http://kamhungsoh.com/blog/2008/05/m...p-putclip.html

--
Kam-Hung Soh <a href="http://kamhungsoh.com/blog">Software Salariman</a>
Jun 27 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: sonic_soul | last post by:
Hi, I was curious if I could make my webservice work with firefox client webservice functionality. (i got it to work with webservice.htc) I am able to get firefox to see my serverside web...
7
by: Tom Petersen | last post by:
I must have the format of the below line wrong for IE: click <a href="cal.asp?sdate=<% =strDate1 %>&location=<% =strLocation %>&eTime=<% =strDate2 %>">here</a> to add this information to your...
4
by: YeeCN | last post by:
Hi, To my great dismay and disgust - I just discovered that ASP.NET is rendering the aspx pages differently for the Firefox browser - with disastrous results. Below are the renderings of a...
5
by: sonic_soul | last post by:
Hi, I was curious if I could make my webservice work with firefox client webservice functionality. (i got it to work with webservice.htc) I am able to get firefox to see my serverside web...
10
by: Jake Barnes | last post by:
This weekend I wanted to learn AJAX, so I set up a little toy page where I could experiment. The idea of this page is that you click in one of the boxes to get some controls, at which point you can...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.