New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TextArea Features #69

Closed
jarvisteach opened this Issue Dec 22, 2016 · 16 comments

Comments

Projects
None yet
3 participants
@jarvisteach
Owner

jarvisteach commented Dec 22, 2016

Useful features:

@maestroi

This comment has been minimized.

Show comment
Hide comment
@maestroi

maestroi Jan 2, 2017

Can you also make it asc or desc, for now if put text inside with app.setTextArea("Log", text) it wil do the oldest at last

maestroi commented Jan 2, 2017

Can you also make it asc or desc, for now if put text inside with app.setTextArea("Log", text) it wil do the oldest at last

@jarvisteach jarvisteach added this to the 0.07 milestone Feb 25, 2017

@jarvisteach jarvisteach modified the milestones: 0.08, 0.07 May 29, 2017

@jarvisteach jarvisteach modified the milestones: 0.08, 1.0 Aug 9, 2017

jarvisteach added a commit that referenced this issue Aug 22, 2017

Updates to TextArea #69 & docstrings #127
Added docs to TextArea functions, tidied up pausing function call with built in functions on TextParent class

Changed setting TextArea to append to end by default with flag to append to beginning
@jarvisteach

This comment has been minimized.

Show comment
Hide comment
@jarvisteach

jarvisteach Aug 22, 2017

Owner

Have made one major change to TextArea - .setTextArea() now appends text to the end.

If you want to keep the original functionality, you'll need to set theend flag to be False

Owner

jarvisteach commented Aug 22, 2017

Have made one major change to TextArea - .setTextArea() now appends text to the end.

If you want to keep the original functionality, you'll need to set theend flag to be False

@jarvisteach

This comment has been minimized.

Show comment
Hide comment
@jarvisteach

jarvisteach Aug 25, 2017

Owner

TextAreas currently wrap lines by splitting words - would be nice to have the option to wrap on spaces...

According to: http://infohost.nmt.edu/tcc/help/pubs/tkinter/web/text.html

There is a wrap config that can be set:

  • the default behavior, wrap=tk.CHAR, any line that gets too long will be broken at any character.
  • set wrap=tk.WORD and it will break the line after the last word that will fit.
Owner

jarvisteach commented Aug 25, 2017

TextAreas currently wrap lines by splitting words - would be nice to have the option to wrap on spaces...

According to: http://infohost.nmt.edu/tcc/help/pubs/tkinter/web/text.html

There is a wrap config that can be set:

  • the default behavior, wrap=tk.CHAR, any line that gets too long will be broken at any character.
  • set wrap=tk.WORD and it will break the line after the last word that will fit.

jarvisteach added a commit that referenced this issue Aug 25, 2017

Stopped TextAreas from breaking words #69
Changed word wrap on text areas - they now wrap at the nearest space

jarvisteach added a commit that referenced this issue Aug 25, 2017

@jarvisteach jarvisteach modified the milestones: 1.0, 1.1 Feb 11, 2018

@MessuKilkain

This comment has been minimized.

Show comment
Hide comment
@MessuKilkain

MessuKilkain Mar 29, 2018

I started to use appJar and I am truly satisfied for what I want to do: write quick and simple GUI for my little scripts. I also come from other languages and am used to Camel case.
Being mostly a programmer, I use python for programming tools.
A nice feature for TextArea would be to have option to enable syntax highlighting. Since it is a not so easy to implement feature, I just drop it here without any urge to have it.
By the way, great job.

MessuKilkain commented Mar 29, 2018

I started to use appJar and I am truly satisfied for what I want to do: write quick and simple GUI for my little scripts. I also come from other languages and am used to Camel case.
Being mostly a programmer, I use python for programming tools.
A nice feature for TextArea would be to have option to enable syntax highlighting. Since it is a not so easy to implement feature, I just drop it here without any urge to have it.
By the way, great job.

@jarvisteach

This comment has been minimized.

Show comment
Hide comment
@jarvisteach

jarvisteach Mar 29, 2018

Owner

Hi @MessuKilkain - I've had a quick look into this, and there are a few options.

It's easy enough to create tags - settings for parts of the text.
Then you just have to tell the text widget where to apply those tags.

I'll add functions to create tags & tag a range as well as a string.

To then create a syntax highlighter, I guess you;d just need to define your tags, and some arrays of strings to apply those tags to. Then keep checking the text area for any matches...

Owner

jarvisteach commented Mar 29, 2018

Hi @MessuKilkain - I've had a quick look into this, and there are a few options.

It's easy enough to create tags - settings for parts of the text.
Then you just have to tell the text widget where to apply those tags.

I'll add functions to create tags & tag a range as well as a string.

To then create a syntax highlighter, I guess you;d just need to define your tags, and some arrays of strings to apply those tags to. Then keep checking the text area for any matches...

jarvisteach added a commit that referenced this issue Mar 29, 2018

@jarvisteach

This comment has been minimized.

Show comment
Hide comment
@jarvisteach

jarvisteach Mar 29, 2018

Owner

@MessuKilkain - OK I've added three functions:

  • .tagtextArea(title, **kwargs) - create the named tag, with the specified arguments
  • .tagTextAreaPattern(title, tag, pattern, regexp=False) apply a previously made tag to the specified pattern (set regexp to True if you want to use a regular expression)
  • .tagTextAreaRange(title, tag, start, end) - apply a previously made tag to the specified range
Owner

jarvisteach commented Mar 29, 2018

@MessuKilkain - OK I've added three functions:

  • .tagtextArea(title, **kwargs) - create the named tag, with the specified arguments
  • .tagTextAreaPattern(title, tag, pattern, regexp=False) apply a previously made tag to the specified pattern (set regexp to True if you want to use a regular expression)
  • .tagTextAreaRange(title, tag, start, end) - apply a previously made tag to the specified range
@jarvisteach

This comment has been minimized.

Show comment
Hide comment
@jarvisteach

jarvisteach Mar 29, 2018

Owner

Then I've tried it out with the following code, which seems t give a very simple syntax highlighter:

from appJar import gui

redWords = ("string", "integer", "boolean", "real")
greenWords = ("print", "input")

def highlightSyntax(param):
    for w in redWords:
        app.tagTextAreaPattern("ta", "red", w)
    for w in greenWords:
        app.tagTextAreaPattern("ta", "green", w)

with gui("Text Editor", "300x400") as app:
    app.text("ta", focus=True, change=highlightSyntax)
    app.tagTextArea("ta", "red", background="red", foreground="white")
    app.tagTextArea("ta", "green", background="green", foreground="white")
Owner

jarvisteach commented Mar 29, 2018

Then I've tried it out with the following code, which seems t give a very simple syntax highlighter:

from appJar import gui

redWords = ("string", "integer", "boolean", "real")
greenWords = ("print", "input")

def highlightSyntax(param):
    for w in redWords:
        app.tagTextAreaPattern("ta", "red", w)
    for w in greenWords:
        app.tagTextAreaPattern("ta", "green", w)

with gui("Text Editor", "300x400") as app:
    app.text("ta", focus=True, change=highlightSyntax)
    app.tagTextArea("ta", "red", background="red", foreground="white")
    app.tagTextArea("ta", "green", background="green", foreground="white")

jarvisteach added a commit that referenced this issue Mar 29, 2018

jarvisteach added a commit that referenced this issue Mar 29, 2018

@jarvisteach jarvisteach modified the milestones: 1.1, 1.0 Mar 29, 2018

@MessuKilkain

This comment has been minimized.

Show comment
Hide comment
@MessuKilkain

MessuKilkain Mar 30, 2018

@jarvisteach Thank you a lot. I don't know yet when I will be able to test that for my little projet but this seems really promising. Good job.

MessuKilkain commented Mar 30, 2018

@jarvisteach Thank you a lot. I don't know yet when I will be able to test that for my little projet but this seems really promising. Good job.

@MessuKilkain

This comment has been minimized.

Show comment
Hide comment
@MessuKilkain

MessuKilkain Apr 1, 2018

@jarvisteach Ok, I tried the tags for what I wanted to do and it does that pretty well with a wise use of regexp. The only down, for now, to my opinion is that to clear the tags, you have to apply a clear tag to all the textArea (or maybe I didn't find the right function). I know I can use directly the tkinter widget bu it would be great to just call a function like clearTagTextArea(title) or removeTagTextArea(title, tag).

MessuKilkain commented Apr 1, 2018

@jarvisteach Ok, I tried the tags for what I wanted to do and it does that pretty well with a wise use of regexp. The only down, for now, to my opinion is that to clear the tags, you have to apply a clear tag to all the textArea (or maybe I didn't find the right function). I know I can use directly the tkinter widget bu it would be great to just call a function like clearTagTextArea(title) or removeTagTextArea(title, tag).

@jarvisteach

This comment has been minimized.

Show comment
Hide comment
@jarvisteach

jarvisteach Apr 1, 2018

Owner
Owner

jarvisteach commented Apr 1, 2018

jarvisteach added a commit that referenced this issue Apr 2, 2018

Updates to text #69
Moved highlightPattern to parent class - so all textAreas inherit it.

Creating a textArea now receives some default text.
@MessuKilkain

This comment has been minimized.

Show comment
Hide comment
@MessuKilkain

MessuKilkain Apr 2, 2018

The next_release branch is good for me. I already use it.

MessuKilkain commented Apr 2, 2018

The next_release branch is good for me. I already use it.

@jarvisteach

This comment has been minimized.

Show comment
Hide comment
@jarvisteach

jarvisteach Apr 8, 2018

Owner

The following functions should be implemented:

  • tag_names() gets a list of all tags
  • tag_remove(start_pos, stop_pos) removes the tag from any text between the two positions
  • tag_delete(*tag_names) removes the tag from the text and also removes the definition of the tag

There is also a SEL tag, referring to the current selected text.

So a tag_selected could be implemented using SEL_FIRST & SEL_LAST as the positions.

Owner

jarvisteach commented Apr 8, 2018

The following functions should be implemented:

  • tag_names() gets a list of all tags
  • tag_remove(start_pos, stop_pos) removes the tag from any text between the two positions
  • tag_delete(*tag_names) removes the tag from the text and also removes the definition of the tag

There is also a SEL tag, referring to the current selected text.

So a tag_selected could be implemented using SEL_FIRST & SEL_LAST as the positions.

@jarvisteach

This comment has been minimized.

Show comment
Hide comment
@jarvisteach

jarvisteach Apr 8, 2018

Owner

A simple search option can be implemented as well:

start = 1.0
while True:
    pos = text.search("o", start, stopindex=END)
    if not pos:
        break
    print pos
    start = pos + "+1c"

stopindex tells it not to wrap.
backwards=True will search backwards (start at END, set stopindex to 1.0, use -1c)

Owner

jarvisteach commented Apr 8, 2018

A simple search option can be implemented as well:

start = 1.0
while True:
    pos = text.search("o", start, stopindex=END)
    if not pos:
        break
    print pos
    start = pos + "+1c"

stopindex tells it not to wrap.
backwards=True will search backwards (start at END, set stopindex to 1.0, use -1c)

jarvisteach added a commit that referenced this issue Apr 8, 2018

Updates to textArea #69
Updates to tagging on the textArea.
Added searching & highlighting.
@jarvisteach

This comment has been minimized.

Show comment
Hide comment
@jarvisteach

jarvisteach Apr 8, 2018

Owner

@MessuKilkain - multiple functions now implemented for tagging.
The naming has also been changed for all tag functions:

  • textAreaCreateTag()
  • textAreaChangeTag()
  • textAreaDeleteTag()
  • textAreaTagPattern()
  • textAreaTagRange()
  • textAreaTagSelected()
  • textAreaUntagRange()
  • textAreaUntagSelected()
  • textAreaToggleTagRange()
  • textAreaToggleTagSelected()
  • getTextAreaTags()
  • getTextAreaTag()

There is also a search * highlight option.

Owner

jarvisteach commented Apr 8, 2018

@MessuKilkain - multiple functions now implemented for tagging.
The naming has also been changed for all tag functions:

  • textAreaCreateTag()
  • textAreaChangeTag()
  • textAreaDeleteTag()
  • textAreaTagPattern()
  • textAreaTagRange()
  • textAreaTagSelected()
  • textAreaUntagRange()
  • textAreaUntagSelected()
  • textAreaToggleTagRange()
  • textAreaToggleTagSelected()
  • getTextAreaTags()
  • getTextAreaTag()

There is also a search * highlight option.

@jarvisteach

This comment has been minimized.

Show comment
Hide comment
@jarvisteach

jarvisteach Apr 8, 2018

Owner

Would like to implement built-in tags for:

  • normal
  • bold
  • italic
  • bold_italic

These will have to be implemented as 4 different fonts.

Additional tags for:

  • underline
Owner

jarvisteach commented Apr 8, 2018

Would like to implement built-in tags for:

  • normal
  • bold
  • italic
  • bold_italic

These will have to be implemented as 4 different fonts.

Additional tags for:

  • underline

jarvisteach added a commit that referenced this issue Apr 8, 2018

jarvisteach added a commit that referenced this issue Apr 11, 2018

Initial support for textArea fonts #69
Introduced BOLD/ITALIC/BOLD_ITALIC fonts as tags, along with UNDERLINE
as tag

jarvisteach added a commit that referenced this issue Apr 11, 2018

jarvisteach added a commit that referenced this issue Apr 11, 2018

@jarvisteach

This comment has been minimized.

Show comment
Hide comment
@jarvisteach

jarvisteach Apr 11, 2018

Owner

Have implemented the above font tags. Except, no NORMAL tag is necessary - just remove the tags already applied...

Owner

jarvisteach commented Apr 11, 2018

Have implemented the above font tags. Except, no NORMAL tag is necessary - just remove the tags already applied...

jarvisteach added a commit that referenced this issue Apr 11, 2018

jarvisteach added a commit that referenced this issue Apr 11, 2018

jarvisteach added a commit that referenced this issue Apr 15, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment