Deleting lines in VisPy - vispy

How can one delete visuals(e.g. lines) from a PlotWidget?
I have tried explicitly removing a Line from everywhere the PlotWidget adds the Line object when you call plot(), but this does not change anything on the displayed canvas.

Set its parent to None:
line_obj.parent = None

Related

how do i set variable in toolbar_sticky_offset option of tiny editor

i'm using vue2 with #vue/composition-api
in some reason i have to use display:none to component that have tinyEditor.
The problem arises when i disabled display:none. tinyEditor not deleted but just disappearing so when i scrolling, event still work in tinyEditor.
so 'tox-tinymce--toolbar-sticky-on' <- keep stick to tinyEditor.
i've tried use computed to option, watched params(the variable value is params) and add variable class none of them work. obviously my approach doesn't effect to tinyEditor.
how do i set some variable value in toolbar_sticky_offset option?

How to get current list of decorations OR handle decoration position change in VSCode Extension?

Lets take this example into account.
I have a file with contents:
1: one
2: two
3: three
and I create a line decoration for line "two":
const position = new vscode.Position(1, 0);
const range = new vscode.Range(position, position);
const decoration = vscode.window.createTextEditorDecorationType({
gutterIconPath: context.asAbsolutePath('images/icon.svg')
});
vscode.window.activeTextEditor?.setDecorations(decoration, [range]);
that gives me
1: one
* 2: two
3: three
Next step:
I am changing file contents by adding a new line before line "two".
After that file looks like this:
1: one
2:
* 3: two
4: three
As you can see VSCode has updated my line decoration and now it is positioned on line 3 (instead of 2) which is totally correct and I've expected that.
And now the question:
how can I get this current updated position of my line decoration?
If I hold the range reference - it is still pointing to line 2.
What is the right way to handle this decoration changes?
Either of these 2 options would satisfy me:
a way to query all the current decoration positions displayed for currently open file
a way to subscribe to decoration / range changes so that I can handle those manually.
Maybe I am totally wrong and it should be done in another way.
Please advise!
So apparently there is no way to get all the current decorations for open file in VSCode. Here is an old issue without clear plans to be resolved https://github.com/microsoft/vscode/issues/54147.
I've found an internal method getLineDecorations - https://github.com/microsoft/vscode/blob/master/src/vs/editor/browser/widget/codeEditorWidget.ts#L1118 - and I was trying to reach to it via
vscode.window.activeTextEditor?._proxy
vscode.window.activeTextEditor?._runOnProxy
but I did not succeed.
So for now probably the only option that we have mentioned here https://github.com/microsoft/vscode/issues/54147#issuecomment-439177546 is:
to store a copy of all decoration positions
to update it manually on each text update via vscode.workspace.onDidChangeTextDocument handler
It is doable but very annoying that we have to do this stuff manually. ¯_(ツ)_/¯
Also very error prone )

Changing node icon to "folder" when adding child in fancyTree

It seems to me that the standard behaviour in fancyTree, when adding child nodes is NOT to change the parent node to have a folder icon.
For example, see http://wwwendt.de/tech/fancytree/demo/index.html#sample-multi-ext.html and try adding a child node.
How is it possible to dynamically change the icon of the parent to a "folder" when adding a child?
I thought that I could apply renderTitle() to the parent node, but this did not do anything.
This question Dynamically change icon in fancy tree is similar, but (a) I could not get it to work, and also (b) I wanted a solution that didn't involve having to create new icons.
Folders may be empty, so this status is defined by node.folder = true (not by the fact that children are present or not).
So you could set node.folder and call node.render().
Note that setting an additional class may give the same effect, but may get lost when the tree is updated.
In jquery.fancytree.edit.js I added the following line
newNode.parent.addClass("fancytree-ico-ef");
The code snippet is as follows:
newNode.makeVisible(/*{noAnimation: true}*/).done(function(){
$(newNode[tree.statusClassPropName]).addClass("fancytree-edit-new");
self.tree.ext.edit.relatedNode = self;
newNode.parent.addClass("fancytree-ico-ef");
newNode.editStart();
});

Why does my script parameter get deselected when being run?

https://imgur.com/a/07o3m
Why is my point light script parameter being deactivated when I run unity..??
Your problem is in the line:
GetComponent<Light>();
You are setting it in the inspector, so no need to set it in the Start() method (also the Light is in the child object).
Delete that line and you're set.
(next time post the code in text not image.

Pygtk: Disable moving separator in a gtk.Paned (HPaned/VPaned)

Is there a way I can stop the user from dragging around the separator in a gtk.Paned? I don't want to disable it completely... if any child resized or set_position() was called, the separator should still change position.
Thanks!
One possible (dirty :)) way would be to track Paned' events and re-set its size:
def handle_cb (pane, param):
# detect if paned is locked
# or its position has changed - ommited
pane.set_position(10)
return True
pane = gtk.VPaned()
...
pane.connect("notify", handle_cb)
I'd try to set child widgets unshrinkable first, though.