ActionBar complains about ActionSeparator already having a parent - kivy

When using NavigationToolbar2Kivy from garden.matplotlib in a deeply nested widget (it's why I could not setup a simple working example showing the problem), I am thrown the following exception:
WidgetException: Cannot add <kivy.uix.actionbar.ActionSeparator object at 0x147956fa0>, it already has a parent <kivy.uix.actionbar.ActionOverflow object at 0x1478e44b0>
I could fix it by introducing the following changes in actionbar.py:
In ActionView._layout_random(), replace super_add(child, group_index) by:
if child.parent:
child.parent.remove_widget(child)
super_add(child, group_index)
over_add(child) by:
if child.parent:
child.parent.remove_widget(child)
over_add(child)
and super_add(child) by:
if child.parent:
child.parent.remove_widget(child)
super_add(child)
In ActionView._layout_all(), replace super_add(child) by:
if child.parent:
child.parent.remove_widget(child)
super_add(child)
I think that the problem comes from ActionView.remove_widget() and the complicated interactions between _list_action_item, _list_action_group and hidden_items, that I could not sort out.
As these changes are most probably harmless, I suggest these changes are included to improve ActionBar robustness.

The ActionOverflow widget is not supposed to contain any ActionSeparator, as shown by its overloaded add_widget method.
But in ActionView._layout_random() (in the very last lines), items in hidden_items are added to overflow_group (which is an ActionOverflow widget) using the inherited add_widget method, not the overloaded one.
So, in ActionView._layout_random(), it is necessary to prevent overflow_group to receive any ActionSeparator, so it is necessary to replace:
over_add(child)
by:
if not isinstance(child, ActionSeparator):
over_add(child)
This identifies and fixes the problem.

Related

Combining WareHouseModel and Experiments

I am trying to run experiments using the WarehouseRenderer and AgvRenderer from AgvExample.
I get the following exception:
Exception in thread "main" java.lang.IllegalArgumentException: Could not resolve dependency for implementations of interface com.github.rinde.rinsim.core.model.road.CollisionGraphRoadModel, as requested by WarehouseRenderer.builder().
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:437)
at com.github.rinde.rinsim.core.model.DependencyResolver.constructDependencyGraph(DependencyResolver.java:90)
at com.github.rinde.rinsim.core.model.DependencyResolver.resolve(DependencyResolver.java:115)
at com.github.rinde.rinsim.core.model.ModelManager$Builder.build(ModelManager.java:268)
at com.github.rinde.rinsim.core.Simulator.<init>(Simulator.java:88)
at com.github.rinde.rinsim.core.Simulator$Builder.build(Simulator.java:347)
at com.github.rinde.rinsim.experiment.Experiment.init(Experiment.java:191)
at com.github.rinde.rinsim.experiment.Experiment.perform(Experiment.java:195)
at com.github.rinde.rinsim.experiment.LocalComputer$ExperimentRunner.call(LocalComputer.java:202)
at com.github.rinde.rinsim.experiment.LocalComputer$ExperimentRunner.call(LocalComputer.java:193)
at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:125)
at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:57)
at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:78)
at com.google.common.util.concurrent.MoreExecutors$DirectExecutorService.execute(MoreExecutors.java:258)
at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)
at com.google.common.util.concurrent.AbstractListeningExecutorService.submit(AbstractListeningExecutorService.java:66)
at com.github.rinde.rinsim.experiment.LocalComputer.compute(LocalComputer.java:81)
at com.github.rinde.rinsim.experiment.Experiment$Builder.perform(Experiment.java:684)
at com.github.rinde.rinsim.experiment.Experiment$Builder.perform(Experiment.java:703)
at agv.ExperimentExample.main(ExperimentExample.java:197)
This error indicates that there is a renderer attached to the simulator that expects a model of type CollisionGraphRoadModel. A renderer can only function correctly if there is a corresponding model that contains the data that needs to be rendered.
In AgvExample the following code (see lines 86-90) is used to add the required model:
.addModel(
RoadModelBuilders.dynamicGraph(GraphCreator.createSimpleGraph())
.withCollisionAvoidance()
.withDistanceUnit(SI.METER)
.withVehicleLength(VEHICLE_LENGTH))
You can add similar code if you want to use the WarehouseRenderer in your code.

Possibly Bug in Websharper Zafir-Libraries (Beta)

I'm trying to create a Sitelet with SiteletBuilder in C#:
return WebSharper.Sitelets.Content.Page(...)
However, the class Websharper.Sitelet contains Content both as Struct and Class.
So, this does not compile.
Versions of Zafir-Libraries are
Zafir 4.0.152.29-beta5
Zafir.CSharp 4.0.152.29-beta5
Zafir.Html 4.0.56.95-beta5
Zafir.UI.Next 4.0.102.33-beta5
How to reference WebSharper.Sitelets.Content proberly?
Or is this indeed a bug?
Thanks for the report, created ticket: https://github.com/intellifactory/websharper/issues/645
I have been testing with having using WebSharper.Sitelets; and then using with shorter form Content.Page(...). C# can resolve this for some reason, although the name conflict indeed exists in WebSharper.Sitelets.dll

Element type \"field\" must be followed by either attribute specifications, \">\" or \"/>\"."

I am try to make a collection with my solr
_config. I get the following error:
{
"failure": {
"10.47.24.19:5285_solr": "org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException:Error from server at https://10.47.24.19:5285/solr: Error CREATEing SolrCore 'localWebCollection_shard1_replica2': Unable to create core [localWebCollection_shard1_replica2] Caused by: Element type \"field\" must be followed by either attribute specifications, \">\" or \"/>\".",
"10.44.121.52:6560_solr": "org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException:Error from server at https://10.44.121.52:6560/solr: Error CREATEing SolrCore 'localWebCollection_shard1_replica1': Unable to create core [localWebCollection_shard1_replica1] Caused by: Element type \"field\" must be followed by either attribute specifications, \">\" or \"/>\"."
}
I checked all the fields existing in my schema.xml. They are all closed with "/>". Any Ideas on how to fix this error?
Any helps or ideas would be highly appreciated.
Turned out the 'space' between two of the attributes in one of the fields was removed! Seeing this error you should make sure that in the schema.xml all the attributes of each one of the fields are properly separated and that you have quoted the values of any of the attributes like "body", "false", "true"...etc. properly.

CSOM 2013 error: Unable to cast object of type 'System.Collections.Generic.Dictionary

I'm using this code to loop columns of a SharePoint 2013 List.
currentContext.Load(currentList.Fields);
currentContext.ExecuteQuery();
foreach (Field f in currentList.Fields) {
}
No problem with normal columns. But, when I arrive to a lookup column I have this error:
"Unable to cast object of type
'System.Collections.Generic.Dictionary`2[System.String,System.Object]'
to type 'Microsoft.SharePoint.Client.Field'."
I found for example this discussion
This issue came when we were working with TaxonomyFieldValue fields. For us changing references was not an option. This helped:
TaxonomyItem dummy = new TaxonomyItem(web.Context, null);
It will force program to load adequate libraries forcing correct type in runtime.
I had this same issue and updating the references fixed it for me. This question helped me figure it out.
I went from version 14 of "Microsoft.SharePoint.Client" and "Microsoft.SharePoint.Client.Runtime" to version 16 and no longer had the error.
Latest client download

RLINK32: Error opening file "...\Data.DFM". Occurs the first time I build a project after opening Delphi

I get this error the first time I build/compile a particular project after opening Delphi (D6 Pro). Subsequent builds do not give the error.
I have the same issue, it was fixed by replacing {$R *.dfm} directive in the problem unit (which was not found by Delphi during first compilation) by more specific clause {$R fMain.dfm}.
The error can be caused by an exception being raised in a design component on the form. If the component is running some initialisation code which raises an exception this error will be produced. This can be shown by adding
raise Exception.CreateFmt('Test', []);
into the code of the component. Note that in D6 Pro this does not produce 'Test' in the error message. The underlying exception message is not displayed.
This is probably caused by a control that raises an exception during its creation (when the form is loaded).
How I solved this (this case was specific for me, but a very similar solution may apply to you):
First I loaded the 'broken' unit into the IDE. It didn't caused an error until I pressed F12 to see the form. The error message raised by the IDE was not very helpful, but after changing the {$R *.dfm} to {$R MainForm.dfm}, the error message changed to something more specific. More exactly, in the error report, one line was of special interest:
{MyControls_XE.bpl} StrGrdBase.TBaseStrGrid.FixCursor (Line 569, "StrGrdBase.pas" + 9) + $8
I navigated to that line and I have seen that in some conditions I was trying to set focus on the second row, while the grid had only one row.
I also got the same error on Deplhi 2010, the problem was there was a component which has not been installed in IDE, when I changed the component to the one that exists it is worked as a charm.
I've found an additional reason for this behaviour: DFM files are rejected if a property is placed below any child objects owned by the main object. In other words, a TButton object should be defined below the last property of the TPanel object that the button is placed on. Tested with D2010, compiling with bcc32

Resources