Trying to make a popup widget but get unknown errors instead - linux

So I've been trying to create a popup widget which should include 3 other widgets inside of it. I had to fix a bunch of things before I could get it to run without spitting out more errors. So I am at the point where I am trying to run it to see if it really is working. I made a button(day_button.lua) which will trigger the visibility of the container(empty-container.lua). So I typed at the top of rc.lua: local customclock = require("day_button") which like I said gave no output of any errors. I tried to place the button in my wibar like so: wibar(you can find it under the widget mytextclock). So by trying to "summon" the button I get these errors. I don't know what to do from this point forward. These errors aren't very helpful and I'm not that experienced.
I will also include day_button.lua and empty-container.lua for better context.
Please help.

The error message tells you that you're indexing a local boolean value v. You may only index table values.
So you're doing someting like v.someKey or v[somekey] or v:someKey in the mentioned line.
v is probably part of a generic for loop. So you probably have a boolean value in a table where you expect a table value.
you know what you're doing wrong and you know where. The only thing that's left is to fix it. So find out why there is a boolean where you expect a table. If it should be a boolean, don't index it. If it should be a table, make sure it actually is a table.

Related

Pyqt Custom QPolygon getting deleted: RuntimeError: wrapped C/C++ object of type ImagePolygon has been deleted

I have a program which loads multiple images and each image has an array of polygons which are represented by a custom QGraphicsPolygon item. I load 1 image at a time with its respective polygons into two QGraphicsScene (new QGraphicsScene on each load). The problem I am encountering is that after switching between image a couple times I get the following error:
"RuntimeError: wrapped C/C++ object of type ImagePolygon has been deleted". This implementation used to work well, but I have added a lot of stuff to the program since and now I get the error.
I know that I am never loosing my references to the custom QGraphicsPolygons and the only thing that is getting deleted inside them is the polygon itself. All other membervariables stay intact. Unfortunately I have not been able to pinpoint the exact region of the code where the polygon inside the QGraphicsPolygon gets deleted and the code is too long to post here.
I have also tried to simple set a new QPolygon to the QGraphicsPolygon item each time I add it to the scene, but this gives me the same error.
Please let me know if anybody knows what could be deleting this item. Keep in my I am never loosing reference to the QGraphicsPolygonItem.
I would also appreciate if somebody knew of a good way to debug this. I am sure I could fix the error if I could find it.
Thank you in advance
After a lot of testing I think I found the problem. Since in my implementation I delete the QGraphicsScene everytime I show a new image, I believe this was deleting the polygons as well. I don't know why this was not happening before, but I managed to fix it by first removing all items from the scene. I had to iterate through the items, because using the clear() method in the scene deletes them.

Android Studio: Adding #+id through Design GUI Generates Errors

I have found a workaround for this, which I will be posting as an answer, but it still raises the question of why it happened in the first place.
When I try to add a new id through the Design GUI, I type the name into the box:
id_sample
As soon as I tab out of the box, it prepends #+id/:
#+id/id_sample
which sounds reasonable enough, because - hey, it's got to put in the instruction to add a new id per the documentation, right?
But when I go into the java code, autocomplete is giving me gibberish on the code side - because of the extra #+id/, autocomplete gives me #+id/id_sample for a grand total of
menu.findItem(R.id.#+id/id_sample);
which has invalid characters; while deleting them:
menu.findItem(R.id.id_sample);
gives the error Cannot resolve symbol 'id_sample' because the xml is insisting that the correct name includes the invalid characters. Catch 22.
So how do I properly reference an id?
Looking in the xml, the #+id/ actually gets added to the #+id/id_sample:
android:id=#+id/#+id/id_sample
which obviously gives the compiler a heart attack. Having figured out what was going on, it is easy (though tedious) enough to jump into the xml and delete the extra #+id/ but I can't see any way to get the designer to put it in right in the first place.
Once this is corrected in the xml, it gets automatically corrected in the GUI, autocomplete will give you the correct name when you go into the java code, and the compiler will recognize it.
All that's left is to wonder if there is something I'm doing wrong that is causing this. Is this a known (or unknown) bug? Knowing what is wrong, it can be fixed in the xml, but it seems the GUI should have gotten it right in the first place. Right?

fabricjs 1.6.3: why active object is always shown on top

good demo of my problem: http://fabricjs.com/hovering
If you select any item, it is displayed on top.
In earlier versions (1.5.0 - 1.6.2) this problem does not exist.
Sorry for bad English.
If you dont want thie behaviour, you can set the preserveObjectStacking to true. Check the docs here: http://fabricjs.com/docs/fabric.Canvas.html
However, there is this one issue with background objects, so beware https://github.com/kangax/fabric.js/issues/3095
Hopefully, they'll push a fix soon otherwise your last resort would be going back to 1.6.2.
I believe that is meant as a convenience for the user. Although the object moves to the front while selected, as soon as it is deselected, it falls back to its original z-order.
You can test this out at the hovering demo you linked. Superimpose two objects and determine which is front of the other then select and deselect the object in the back. When you hover over them, the order should still be observed to be the same.

How do I show all validation errors from the modx register snippet?

How do I show all validation errors from the modx register snippet?
Right now if I want to show all possible errors in my form I have to do something like this:
[[+error.message:notempty=`[[+error.message]]<br>`]]
[[+error.username:notempty=`[[+error.username]]<br>`]]
[[+error.password:notempty=`[[+error.password]]<br>`]]
[[+error.password_confirm:notempty=`[[+error.password_confirm]]<br>`]]
[[+error.email:notempty=`[[+error.email]]<br>`]]
[[+error.salutation:notempty=`[[+error.salutation]]<br>`]]
[[+error.firstname:notempty=`[[+error.firstname]]<br>`]]
[[+error.lastname:notempty=`[[+error.lastname]]<br>`]]
[[+error.institution:notempty=`[[+error.institution]]<br>`]]
[[+error.excountry:notempty=`[[+error.excountry]]<br>`]]
[[+error.province:notempty=`[[+error.province]]<br>`]]
[[+error.provinceother:notempty=`[[+error.provinceother]]<br>`]]
[[+error.excity:notempty=`[[+error.excity]]<br>`]]
[[+error.oncologist-database:notempty=`[[+error.oncologist-database]]<br>`]]
Does anyone know if there is a placeholder that just dumps all errors?
You say little to nothing about how the errors are generated in the snippet.
There are two approcahes to this. You could make the entire error-message into one in the snippet. That way you can simply concatenate them there. It would only require one placeholder in the chunk.
Or you could supply all the error-messages every time the chunk is displayed. The change is that when there are no error-messages, the placeholder is just empty (that way, you don't need to test with notempty). You could also make <br /> a part of the error-string itself. That way you don't need the query at all and you could just list each of the error-messages after each other. It would be "cleaner" in the chunk, but I prefer the first solution.

QMultilineElement not calling QEntryDidEndEditingElement: on delegate

I'm trying to use QuickDialog (github.com/escoz/QuickDialog) to make a tablew view showing some debug info, like the values of constants etc. Most of the values are long URLs so i can't use a QLabelElement. QMultilineElement seems to be perfect for this but i need to know when the user modify the text of the pushed text view and i can't figure out how to do it.
QMultilineElement has a delegate property but i can't get it to get called. Looking in the code it seems to me that that delegate only works with QLabelElement, is it true? what am i missing?
I believe I ended up implementing this one, no? Can you confirm?

Resources