Considering myself a JS guy itās just
[code]
// or, if you must
//
Considering myself a JS guy itās just
[code]
// or, if you must
//
[quote=āagibsonswā]Considering myself a JS guy itās just
[code]
// or, if you must
//
Iām keen on JS (wrote my own library ) which makes me dislike all the fake Python assignments ( something = why! ). So let me know if you need a second opinion at any stage.
Andy.
[quote=āagibsonswā]Iām keen on JS (wrote my own library ) which makes me dislike all the fake Python assignments ( something = why! ). So let me know if you need a second opinion at any stage.
Andy.[/quote]
Thanks, I will let you know if I have any specific questions. That TonidoPlug plugin I mentioned, it has my javascript library built into it too (I got really in to JS for that span of time). But as with anything use it or lose it. The good thing about this plugin, it should be very light on JS. I think I really on have two small applications for it right now: open browser print dialog, and wrap html at XXX px. I want to keep it very very light.
@facelessuser: Wonāt be as light as mine - Iāve finished for the moment
[quote] def write_header(self, the_html):
header = CSS % (
path.basename(the_html.name), # Title
str(self.font_size), # Code font size
self.font_face, # Code font face
self.bground, # Page background color
self.gbground, # Gutter background color
self.fground # Default text color
)
the_html.write(header)[/quote]
Named parameters are cool:
print '<a href="%(url)s">%(url)s</a>' % {'url': my_url}
but itās probably not worth amending. It just means you/we wouldnāt have to worry about the order, or comments.
I will have to check it out . Since my requirements are slightly different, I probably cannot pull in your format, but if it works better and fulfills my requirementsā¦I do like lighter.
[quote=āagibsonswā]
[quote] def write_header(self, the_html):
header = CSS % (
path.basename(the_html.name), # Title
str(self.font_size), # Code font size
self.font_face, # Code font face
self.bground, # Page background color
self.gbground, # Gutter background color
self.fground # Default text color
)
the_html.write(header)[/quote]
Named parameters are cool:
print '<a href="%(url)s">%(url)s</a>' % {'url': my_url}
but itās probably not worth amending. It just means you/we wouldnāt have to worry about the order, or comments.[/quote]
That would be pretty useful. Man , why didnāt I realize I could do that. I will pick that up for sure.
You can also repeat an argument
(some_fn(), ) * x
(Iām sure you know thisā¦) but I donāt think itās relevant.
**
Well hereās my updated repository on GitHub.
@facelessuser: They only minor changes worth mentioning are that:
Iāve set ācurr_row = 1ā for numbers/not partial, just to leave the future possibility that I might want to number them differently.
And, borrowing from syntax you introduced me to:
# Get general theme colors from color scheme file
self.bground = colour_settings"background"] if "background" \
in colour_settings else '#FFFFFF'
self.fground = colour_settings"foreground"] if "foreground" \
in colour_settings else '#000000'
self.gfground = colour_settings"gutterForeground"] if "gutterForeground" \
in colour_settings else self.fground
This also means I donāt have to check āif self.fground == āāā when creating the style-rules (or initialize them to āā ).
Just trivia:
I spent ages racking my brain to obtain a neat way of replacing the spaces, but only at the beginning of a string. After a few attempts I ended up with:
if len(tidied_text):
init_spaces = len(tidied_text) - len(tidied_text.lstrip(' '))
if init_spaces:
tidied_text = (init_spaces * ' ') + tidied_text.lstrip(' ')
But it made me smile as this was practically the very first (and best) method that I had tried
[quote=āagibsonswā]Well hereās my updated repository on GitHub.
@facelessuser: They only minor changes worth mentioning are that:
Iāve set ācurr_row = 1ā for numbers/not partial, just to leave the future possibility that I might want to number them differently.
And, borrowing from syntax you introduced me to:
# Get general theme colors from color scheme file
self.bground = colour_settings"background"] if "background" \
in colour_settings else '#FFFFFF'
self.fground = colour_settings"foreground"] if "foreground" \
in colour_settings else '#000000'
self.gfground = colour_settings"gutterForeground"] if "gutterForeground" \
in colour_settings else self.fground
This also means I donāt have to check āif self.fground == āāā when creating the style-rules (or initialize them to āā ).[/quote]
Cool, I will check it out.
Here is a preview of multi-select support ā¦
@facelessuser: Oh, I see Very clever, and useful!
I misunderstood; I was thinking, previously, of highlighting the text that they have selected (with their selection colour) - but are you doing this as well?
As youāve mentioned JS a silly, but interesting idea is to allow text to be highlighted and annotations added using the input panel. These could then become tooltips, or popup boxes in the HTML - even just with CSS. This would make the page dynamicā¦ and cool. But I donāt want you to have another sleepless night.
BTW I might look at Word at the weekend. Not because itāll be useful, but purely for my Python education. Alternatively, an Outlook/ send to option - which begins an email with the HTML in the body - should not be too tricky. In fact, it may only require a handful of code-lines.
Andy.
Actually, doesnāt have to be Outlook.
Iāll pursue this a little bit. Thereās a mailer module which is a simple wrapper around the āemailā module. Itās under an MIT licence but if itās possible I could copy the source-code and remove the bits I donāt need (as itās for a quite specific purpose).
If I canāt just *rip *the code then Iāll have to study the email module and build a wrapper myself (I suppose).
Otherwise, should be a breeze. Andy.
Actually, I need to tear off the header, etc., from the_html - leaving just a list or table.
[quote=āagibsonswā]@facelessuser: Oh, I see Very clever, and useful!
I misunderstood; I was thinking, previously, of highlighting the text that they have selected (with their selection colour) - but are you doing this as well?
[/quote]
I meant both:
[quote=āagibsonswā]
As youāve mentioned JS a silly, but interesting idea is to allow text to be highlighted and annotations added using the input panel. These could then become tooltips, or popup boxes in the HTML - even just with CSS. This would make the page dynamicā¦ and cool. But I donāt want you to have another sleepless night.
BTW I might look at Word at the weekend. Not because itāll be useful, but purely for my Python education. Alternatively, an Outlook/ send to option - which begins an email with the HTML in the body - should not be too tricky. In fact, it may only require a handful of code-lines.
Andy.[/quote]
That would be interesting. Especially if you were looking for an annotated document of your code. I am wondering how useful it would be? It is kind of a cool idea though. Donāt worry about me not sleeping. I am almost done with all features on my immediate todo list. Anything like this would come after I take a nice long break . I just want to round out the basic features and put it through some good testing and give it a 1.0.0 release version.
[quote=āagibsonswā]Actually, doesnāt have to be Outlook.
Iāll pursue this a little bit. Thereās a mailer module which is a simple wrapper around the āemailā module. Itās under an MIT licence but if itās possible I could copy the source-code and remove the bits I donāt need (as itās for a quite specific purpose).
If I canāt just *rip *the code then Iāll have to study the email module and build a wrapper myself (I suppose).
Otherwise, should be a breeze. Andy.
Actually, I need to tear off the header, etc., from the_html - leaving just a list or table.[/quote]
MIT is pretty forgiving. You can use it and even modify it as I understand, but you must not claim it as your own and you must provide the license as well or at least have it in the code file. GNU GPL is a bit more annoying (though there are a couple of versions) but in general it kind of infects your project, and the project including it must also be released under the same license. Technically, I think the desktop module that we are including is GNU GPL (that is the one downside of it). But keep in mind, I am no expert in all of this license stuff. For anything we are doing, I donāt think it matters, but combining MIT and GPL, I am not sure how that works together or if it can.
It appears the Desktop module is the Lesser GPL which I think is compatible with MIT. So I think you would be fine.
@facelessuser: Thought you were doing both, as I noticed you storing the āselectionā colour. Been a bit pre-occupied to study your code in more detail though
The mailer source code includes the following comment:
[quote]A lot of this code was taken from the online examples in the
email module documentation:
docs.python.org/library/email-examples.html
Released under MIT license.[/quote]
which seems very noble. At the end of the day, we are ALL *borrowing *code from somewhere
Actuallyā¦ just had an inspiring idea about the tooltips/ popup boxes. They could be (editable - TextArea) to-do items/ comments. What a cool idea . But Iām getting a little carried away nowā¦
Andy.
@facelessuser: Signing off now, youāll be pleased to hear.
Iām v. happy with my code but I think Iāll explore a couple of ideas tomorrow evening - just for my own Python education:
Iām storing the spans in a temporary string before writing to the file. If, instead, I store a list of tuples (tidied_text, the_colour) then I can perform the entity-escaping, etc., in one fell swoop, perhaps with a list comprehension.
Iād like to gain a better understanding of generators. Itās screaming at me that processing spans within a line could be a good example for this. (This is probably an alternative to 1.)
BTW A while ago (yesterday? canāt remember) I did notice ā\rā popping up on occasion, but presumably split_by_newlines has removed this issue. Personally, Iām using:
tidied_text = tidied_text.replace('\t', ' ' * self.tab_size).strip('\r\n')
But, as I say, itās probably no longer an issue.
Laterz, Andy.
[quote=āagibsonswā]@facelessuser: Signing off now, youāll be pleased to hear.
Iām v. happy with my code but I think Iāll explore a couple of ideas tomorrow evening - just for my own Python education:
Iām storing the spans in a temporary string before writing to the file. If, instead, I store a list of tuples (tidied_text, the_colour) then I can perform the entity-escaping, etc., in one fell swoop, perhaps with a list comprehension.
Iād like to gain a better understanding of generators. Itās screaming at me that processing spans within a line could be a good example for this. (This is probably an alternative to 1.)
BTW A while ago (yesterday? canāt remember) I did notice ā\rā popping up on occasion, but presumably split_by_newlines has removed this issue. Personally, Iām using:
tidied_text = tidied_text.replace('\t', ' ' * self.tab_size).strip('\r\n')
But, as I say, itās probably no longer an issue.
Laterz, Andy.[/quote]
I think the \r is a non-issue, but as stated earlier, it hurts nothing to try to strip them.
I went ahead and posted the last currently planned features.
-color and black and white default color schemes.
-quick panel access to configurations stored in settings file.
-multi-select available
-option to turn off gutter styling (mainly for when you want to print)
-code cleanup
At this point I just need to do some good testing and write up the documentation.
@agibsonsw
I will keep an eye on what you are working on. Good luck!