# How do I see help of activeEditViewController()?

**URL:** <https://forum.glyphsapp.com/t/how-do-i-see-help-of-activeeditviewcontroller/2399>\
**Category:** Scripting\
**Created:** [June 9, 2015, 8:32pm UTC](https://forum.glyphsapp.com/t/how-do-i-see-help-of-activeeditviewcontroller/2399 "2015-06-09T20:32:06Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tosche](https://forum.glyphsapp.com/user_avatar/forum.glyphsapp.com/tosche/32/412_2.png) [@Tosche](https://forum.glyphsapp.com/u/Tosche)\
**Post date:** [June 9, 2015, 8:32pm UTC](https://forum.glyphsapp.com/t/how-do-i-see-help-of-activeeditviewcontroller/2399/1 "2015-06-09T20:32:06Z")

</div>

I am trying to learn what I can do with activeEditViewController() and graphicView() but I have no idea how to see the help of them. I saw Core section of Glyphs reference but it didn’t help much. How should I do it?

I specifically want to know how to display text in an edit view with different layers. I know how to set a plain text, but don’t know how to change the layer in each glyph.

---

<div class="post-metadata">

**Author:** ![GeorgSeifert](https://forum.glyphsapp.com/user_avatar/forum.glyphsapp.com/georgseifert/32/259_2.png) [@GeorgSeifert](https://forum.glyphsapp.com/u/GeorgSeifert)\
**Post date:** [June 9, 2015, 8:56pm UTC](https://forum.glyphsapp.com/t/how-do-i-see-help-of-activeeditviewcontroller/2399/2 "2015-06-09T20:56:33Z")

</div>

We are working on improving the python documentation and the editviewcontroller and graphicView will be covered a bit.

Here is an example. It is a small piece of code from Glyphs I just ported to python:

```
graphicView = Font.parent.windowControllers()[0].activeEditViewController().graphicView()

Attributes = { "GSLayerIdAttrib" : Font.masters[1].id }
selectedRange = graphicView.textStorage().selectedRange()
if selectedRange.length == 0: # only a cursor
	selectedRange.length = 1

graphicView.textStorage().willChangeValueForKey_("text")
graphicView.textStorage().text().addAttributes_range_(Attributes, selectedRange)
graphicView.textStorage().didChangeValueForKey_("text")

```

The .text() is a [NSMutableAttributedString](https://developer.apple.com/library/ios/documentation/Cocoa/Reference/Foundation/Classes/NSMutableAttributedString_Class/index.html)  
We will see if we can make that a bit friendlier for scripts.

---

<div class="post-metadata">

**Author:** ![Tosche](https://forum.glyphsapp.com/user_avatar/forum.glyphsapp.com/tosche/32/412_2.png) [@Tosche](https://forum.glyphsapp.com/u/Tosche)\
**Post date:** [June 9, 2015, 10:18pm UTC](https://forum.glyphsapp.com/t/how-do-i-see-help-of-activeeditviewcontroller/2399/3 "2015-06-09T22:18:59Z")

</div>

Thanks. Wow, this is complicated. It seems that it depends on the cursor position?

What I want to do is to throw a new text in a tab; textA in the first master/layer and textB in the second, in the same tab. Like line 1 in Regular and line 2 in Bold. How can I do that?

---

<div class="post-metadata">

**Author:** ![GeorgSeifert](https://forum.glyphsapp.com/user_avatar/forum.glyphsapp.com/georgseifert/32/259_2.png) [@GeorgSeifert](https://forum.glyphsapp.com/u/GeorgSeifert)\
**Post date:** [June 10, 2015, 5:33am UTC](https://forum.glyphsapp.com/t/how-do-i-see-help-of-activeeditviewcontroller/2399/4 "2015-06-10T05:33:46Z")

</div>

Te examle happens to use the cursor position. But you can iterate over the string and set the layerID for each glyph.

---

<div class="post-metadata">

**Author:** ![Tosche](https://forum.glyphsapp.com/user_avatar/forum.glyphsapp.com/tosche/32/412_2.png) [@Tosche](https://forum.glyphsapp.com/u/Tosche)\
**Post date:** [June 11, 2015, 11:00pm UTC](https://forum.glyphsapp.com/t/how-do-i-see-help-of-activeeditviewcontroller/2399/5 "2015-06-11T23:00:54Z")

</div>

Thanks. What are the will/didChangeValueForKey\_(“text”) doing? What’s “text” referring to?

---

<div class="post-metadata">

**Author:** ![Tosche](https://forum.glyphsapp.com/user_avatar/forum.glyphsapp.com/tosche/32/412_2.png) [@Tosche](https://forum.glyphsapp.com/u/Tosche)\
**Post date:** [June 12, 2015, 1:08am UTC](https://forum.glyphsapp.com/t/how-do-i-see-help-of-activeeditviewcontroller/2399/6 "2015-06-12T01:08:52Z")

</div>

At least I got my stuff done though, by removing those two lines.

---

<div class="post-metadata">

**Author:** ![yanone](https://forum.glyphsapp.com/user_avatar/forum.glyphsapp.com/yanone/32/584_2.png) [@yanone](https://forum.glyphsapp.com/u/yanone)\
**Post date:** [June 13, 2015, 10:52am UTC](https://forum.glyphsapp.com/t/how-do-i-see-help-of-activeeditviewcontroller/2399/7 "2015-06-13T10:52:36Z")

</div>

Hi Tosche.  
Could you please post the entire code of your solution?  
I’m currently working on improving the Python documentation, and maybe I can even make some form of a shortcut for your problem. Seems like a good idea.  
Thanks.

---

<div class="post-metadata">

**Author:** ![Tosche](https://forum.glyphsapp.com/user_avatar/forum.glyphsapp.com/tosche/32/412_2.png) [@Tosche](https://forum.glyphsapp.com/u/Tosche)\
**Post date:** [June 13, 2015, 4:30pm UTC](https://forum.glyphsapp.com/t/how-do-i-see-help-of-activeeditviewcontroller/2399/8 "2015-06-13T16:30:51Z")

</div>

Thanks for the interest, Yanone. I want to post it on Github next week but the script contains other person’s work, which I am waiting for approval. So, please wait for a little while.

---

<div class="post-metadata">

**Author:** ![yanone](https://forum.glyphsapp.com/user_avatar/forum.glyphsapp.com/yanone/32/584_2.png) [@yanone](https://forum.glyphsapp.com/u/yanone)\
**Post date:** [June 13, 2015, 4:33pm UTC](https://forum.glyphsapp.com/t/how-do-i-see-help-of-activeeditviewcontroller/2399/9 "2015-06-13T16:33:47Z")

</div>

Okay.  
Meanwhile Georg has agreed on a completely new implementation of something like font.tabs, something which was missing for a while, and which we’ll cover in the Python API, of course, as soon as possible.

---

<div class="post-metadata">

**Author:** ![Tosche](https://forum.glyphsapp.com/user_avatar/forum.glyphsapp.com/tosche/32/412_2.png) [@Tosche](https://forum.glyphsapp.com/u/Tosche)\
**Post date:** [June 25, 2015, 12:23pm UTC](https://forum.glyphsapp.com/t/how-do-i-see-help-of-activeeditviewcontroller/2399/10 "2015-06-25T12:23:37Z")

</div>

Congratulations on the update to 2.1 and the Python wrapper! Unfortunately I have a problem using tabs the new way. When I run a code like this ( print font.tabs[0].text ), it says “AttributeError: ‘NSKVONotifying\_GSFont’ object has no attribute ‘tabs’”. I’m using build 267. Can you help?

---

<div class="post-metadata">

**Author:** ![mekkablue](https://forum.glyphsapp.com/user_avatar/forum.glyphsapp.com/mekkablue/32/23_2.png) [@mekkablue](https://forum.glyphsapp.com/u/mekkablue)\
**Post date:** [June 25, 2015, 2:57pm UTC](https://forum.glyphsapp.com/t/how-do-i-see-help-of-activeeditviewcontroller/2399/11 "2015-06-25T14:57:16Z")

</div>

I hope you are using 767. 😄  
Perhaps, in your Scripts folder, delete outdated .pyc files. Does that help?

---

<div class="post-metadata">

**Author:** ![Tosche](https://forum.glyphsapp.com/user_avatar/forum.glyphsapp.com/tosche/32/412_2.png) [@Tosche](https://forum.glyphsapp.com/u/Tosche)\
**Post date:** [June 25, 2015, 3:06pm UTC](https://forum.glyphsapp.com/t/how-do-i-see-help-of-activeeditviewcontroller/2399/12 "2015-06-25T15:06:29Z")

</div>

Yes I’m using 767. I had .pyc files indeed, but still the same. I only need to delete them from the Scripts folder, right?

---

<div class="post-metadata">

**Author:** ![GeorgSeifert](https://forum.glyphsapp.com/user_avatar/forum.glyphsapp.com/georgseifert/32/259_2.png) [@GeorgSeifert](https://forum.glyphsapp.com/u/GeorgSeifert)\
**Post date:** [June 25, 2015, 4:09pm UTC](https://forum.glyphsapp.com/t/how-do-i-see-help-of-activeeditviewcontroller/2399/13 "2015-06-25T16:09:09Z")

</div>

If you have a .pyc file, you might have an glyphsapp.py file, too?

---

<div class="post-metadata">

**Author:** ![GeorgSeifert](https://forum.glyphsapp.com/user_avatar/forum.glyphsapp.com/georgseifert/32/259_2.png) [@GeorgSeifert](https://forum.glyphsapp.com/u/GeorgSeifert)\
**Post date:** [June 25, 2015, 4:11pm UTC](https://forum.glyphsapp.com/t/how-do-i-see-help-of-activeeditviewcontroller/2399/14 "2015-06-25T16:11:44Z")

</div>

And did you restart after deleting the files?

---

<div class="post-metadata">

**Author:** ![Tosche](https://forum.glyphsapp.com/user_avatar/forum.glyphsapp.com/tosche/32/412_2.png) [@Tosche](https://forum.glyphsapp.com/u/Tosche)\
**Post date:** [June 25, 2015, 4:52pm UTC](https://forum.glyphsapp.com/t/how-do-i-see-help-of-activeeditviewcontroller/2399/15 "2015-06-25T16:52:36Z")

</div>

Thanks, after deleting glyphsapp.py it started to work. I have some other py files (GSPen.py, objectsGS.py). I have my problem solved, but do they need to be thrown away too?

---

<div class="post-metadata">

**Author:** ![Tosche](https://forum.glyphsapp.com/user_avatar/forum.glyphsapp.com/tosche/32/412_2.png) [@Tosche](https://forum.glyphsapp.com/u/Tosche)\
**Post date:** [June 25, 2015, 6:57pm UTC](https://forum.glyphsapp.com/t/how-do-i-see-help-of-activeeditviewcontroller/2399/16 "2015-06-25T18:57:48Z")

</div>

Actually it accepts the code but all sorts of weird things are happening around the tab.  
font.tabs[-1].text=“abc” correctly displays abc in the last tab. I can print the tabs[-1].text too.  
font.newTab(“abc”) results in instant crash.  
font.newTab("") sometimes opens a new tab, but opens a grey blank tab, not white, where you can do nothing until you change zoom size. Other times it crashes (seems to depend on what tool you are using at the moment?)

Other times it makes the entire window grey blank, or UI keep extending rapidly in horizontal, slowly in vertical direction, or causes all sorts of weird stuff, so much so it’s rather entertaining.

---

<div class="post-metadata">

**Author:** ![GeorgSeifert](https://forum.glyphsapp.com/user_avatar/forum.glyphsapp.com/georgseifert/32/259_2.png) [@GeorgSeifert](https://forum.glyphsapp.com/u/GeorgSeifert)\
**Post date:** [June 25, 2015, 8:07pm UTC](https://forum.glyphsapp.com/t/how-do-i-see-help-of-activeeditviewcontroller/2399/17 "2015-06-25T20:07:05Z")

</div>

I can’t reproduce your problems.

---

<div class="post-metadata">

**Author:** ![Tosche](https://forum.glyphsapp.com/user_avatar/forum.glyphsapp.com/tosche/32/412_2.png) [@Tosche](https://forum.glyphsapp.com/u/Tosche)\
**Post date:** [June 25, 2015, 10:55pm UTC](https://forum.glyphsapp.com/t/how-do-i-see-help-of-activeeditviewcontroller/2399/18 "2015-06-25T22:55:01Z")

</div>

Problem identified after some chat with Georg. It was happening only in Macro window.

---

<div class="post-metadata">

**Author:** ![oneweioranother](https://forum.glyphsapp.com/user_avatar/forum.glyphsapp.com/oneweioranother/32/273_2.png) [@oneweioranother](https://forum.glyphsapp.com/u/oneweioranother)\
**Post date:** [February 3, 2016, 3:16pm UTC](https://forum.glyphsapp.com/t/how-do-i-see-help-of-activeeditviewcontroller/2399/19 "2016-02-03T15:16:09Z")

</div>

Hey @Tosche did you ever upload this script? I thought it was available for a while but I can’t find it anymore.

---

<div class="post-metadata">

**Author:** ![Tosche](https://forum.glyphsapp.com/user_avatar/forum.glyphsapp.com/tosche/32/412_2.png) [@Tosche](https://forum.glyphsapp.com/u/Tosche)\
**Post date:** [February 3, 2016, 5:58pm UTC](https://forum.glyphsapp.com/t/how-do-i-see-help-of-activeeditviewcontroller/2399/20 "2016-02-03T17:58:01Z")

</div>

I think this was about “Display Unlocked Kerning Pairs”.
