Magnolia 5.5.5 ModalityLevel of Component Dialog - magnolia

As it is written here
https://documentation.magnolia-cms.com/display/DOCS56/Dialog+definition I assume there is a possibility for every dialog to insert the following line into the yaml:
modalityLevel: non-modal
If I do this to an existing Component-Dialog which could be quite complex (with tabs and so on) the console logs an error.
WARN agnolia.config.source.yaml.YamlConfigurationSource: 1 major and 0 minor problems have been encountered
(Note: if I do modalityLevel: light it works..)
The reason I want to do this is to have more than one dialog opened at once.
Is that possible in Magnolia 5.5.5 (or 5.6)?

Okay there we go, after some investigation it turns out that the problem is within Magnolia. I have created the following issue https://jira.magnolia-cms.com/browse/MGNLUI-4328 for the problem. For now please ignore what the definition app says and we will fix it as soon as possible.
Cheers,

FWIW, I get the same behavior on the current demo ...
It's defined here:
info.magnolia.ui.api.overlay.OverlayLayer
65 /**
66 * The available levels of modality.
67 * Determines how "modal" it is -
68 * -STRONG creates a dark background that prevents clicks.
69 * -LIGHT adds a border, creates a transparent background that prevents clicks.
70 * -NON_MODAL does not prevent clicks.
71 */
72 public static enum ModalityLevel {
73 STRONG("strong", "modality-strong"),
74 LIGHT("light", "modality-light center-vertical"),
75 NON_MODAL("non-modal", "modality-non-modal");
And it's used here:
info.magnolia.ui.framework.overlay.OverlayPresenter
216 final OverlayCloser closer = openOverlay(new ViewAdapter(shortcutPanel), ModalityLevel.NON_MODAL);
And it's used here:
info.magnolia.dam.app.assets.field.UploadAssetActionRenderer
155 progressIndicatorCloseHandle = layer.openOverlay(new ViewAdapter(progressIndicator), ModalityLevel.NON_MODAL);
and etc.
So that seems like a false positive.
Interestingly, I don't see any tests for this ... for example, I see:
assertEquals("light", session.getProperty("/modules/ui-framework/dialogs/rename/modalityLevel").getString());
and
assertEquals("strong", session.getProperty("/modules/pages/dialogs/createPage/modalityLevel").getString());
but nothing with "non-modal"
I thought maybe the "-" character, but this appears, all else equal, to be valid yaml
---
modalityLevels: strong
modalityLeveln: non-modal
modalityLevell: light
Would have to dig deeper to see what is happening here.
UPDATE: if you change it to "non_modal", there's no longer an error in the definitions app.

Related

Can you set the animation speed of a QTreeWidget?

You can set a QTreeWidget to animated with:
tree_widget = QtWidgets.QTreeWidget()
tree_widget.setAnimated(True)
This will make the QTreeWidgetItems animate while they collapse and expand.
Is there a way to access and edit the animation speed, and type, in the same way you would a QtCore.QVariantAnimation()?
I would like to be able to change the speed and animation type (eg, QtCore.QEasingCurve.Linear) if possible.
Let's track the source;
When we look for animated property we can find out it is actually part of QTreeView class.
So first we need to check if they provided a public method (may named set/addAnimation) to access/manipulate this property. But there aren't any. (not totally true, see the update section)
Then we've to look into the source code of QTreeView. The property set at line 910 as animationsEnabled flag.
When we look for where the action taken according to this flag is at line 3096 and line 3113
And unfortunately these methods are part of QTreeViewPrivate class which is not part of Qt API according to the doc-string:
W A R N I N G
This file is not part of the Qt API. It exists purely as an
implementation detail. This header file may change from version to
version without notice, or even be removed.
We mean it.
So, I don't see a direct way to access or change it without touching and building source.
UPDATE
I recently came across to a widget-animation-duration property in Qt Style Sheet Reference to override built-in animation duration values with style sheets and decided to append it here. However, which widgets are supported is poorly documented. Fortunately, I was able to find related commit with help of google hacking:
"widget-animation-duration" inurl:"code.qt.io"
Diffstat
-rw-r--r-- src/widgets/doc/snippets/code/doc_src_stylesheet.qdoc 4
-rw-r--r-- src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc 16
-rw-r--r-- src/widgets/itemviews/qcolumnview.cpp 6
-rw-r--r-- src/widgets/itemviews/qtreeview.cpp 2
-rw-r--r-- src/widgets/styles/qcommonstyle.cpp 5
-rw-r--r-- src/widgets/styles/qstyle.cpp 9
-rw-r--r-- src/widgets/styles/qstyle.h 1
-rw-r--r-- src/widgets/styles/qstylesheetstyle.cpp 4
-rw-r--r-- src/widgets/widgets/qtabbar_p.h 2
-rw-r--r-- src/widgets/widgets/qwidgetanimator.cpp 4
10 files changed, 41 insertions, 12 deletions
QColumnView and QWidgetAnimator classes has these lines and I was able to change duration of QColumnView animations when I tested.
if (const int animationDuration = style()->styleHint(QStyle::SH_Widget_Animation_Duration, 0, this)) {
d->currentAnimation.setDuration(animationDuration);
BUT: QTreeView implementation only checks the flags existence but not using it's value yet because they animate it by rendering tree to pixmap and drawing it by pixels. We can assume they'll use it because this looks like a preparation for it:
animationsEnabled = q->style()->styleHint(QStyle::SH_Widget_Animation_Duration, 0, q) > 0;

Bokeh: Models must be owned by only a single document

I'm working with Bokeh 0.12.2 in a Jupyter notebook and it frequently throws exceptions about "Models must be owned by only a single document":
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
<ipython-input-23-f50ac7abda5e> in <module>()
2 ea.legend.label_text_font_size = '10pt'
3
----> 4 show(column([co2, co, nox, o3]))
C:\Users\pokeeffe\AppData\Local\Continuum\Anaconda3\lib\site-packages\bokeh\io.py in show(obj, browser, new, notebook_handle)
308 '''
309 if obj not in _state.document.roots:
--> 310 _state.document.add_root(obj)
311 return _show_with_state(obj, _state, browser, new, notebook_handle=notebook_handle)
312
C:\Users\pokeeffe\AppData\Local\Continuum\Anaconda3\lib\site-packages\bokeh\document.py in add_root(self, model)
443 self._roots.append(model)
444 finally:
--> 445 self._pop_all_models_freeze()
446 self._trigger_on_change(RootAddedEvent(self, model))
447
C:\Users\pokeeffe\AppData\Local\Continuum\Anaconda3\lib\site-packages\bokeh\document.py in _pop_all_models_freeze(self)
343 self._all_models_freeze_count -= 1
344 if self._all_models_freeze_count == 0:
--> 345 self._recompute_all_models()
346
347 def _invalidate_all_models(self):
C:\Users\pokeeffe\AppData\Local\Continuum\Anaconda3\lib\site-packages\bokeh\document.py in _recompute_all_models(self)
367 d._detach_document()
368 for a in to_attach:
--> 369 a._attach_document(self)
370 self._all_models = recomputed
371 self._all_models_by_name = recomputed_by_name
C:\Users\pokeeffe\AppData\Local\Continuum\Anaconda3\lib\site-packages\bokeh\model.py in _attach_document(self, doc)
89 '''This should only be called by the Document implementation to set the document field'''
90 if self._document is not None and self._document is not doc:
---> 91 raise RuntimeError("Models must be owned by only a single document, %r is already in a doc" % (self))
92 doc.theme.apply_to_model(self)
93 self._document = doc
RuntimeError: Models must be owned by only a single document, <bokeh.models.tickers.DaysTicker object at 0x00000000042540B8> is already in a doc
The trigger is always calling show(...) (although never the first time after kernel start-up, only subsequent calls).
Based on the docs, I thought reset_output() would return my notebook to an operable state but the exception persists. Through trial-and-error, I've determined it's necessary to also re-define everything being passing to show(). That makes interactive work cumbersome and error-prone.
[Ref]:
reset_output(state=None)
  Clear the default state of all output modes.
  Returns: None
Am I right about reset_output() -- is it supposed to resolve the situation causing this exception?
Else, how do I avoid this kind of exception?
It may be because of conflicting objects that has the same name. you need to create completely new objects every time.
Seems it can by fixed by differentiating the source name
Like this:
source1 = df
p1.circle('A', 'B', source=source1)
source2 = df
p2 = figure()
p2.circle('C', 'D', source=source2)
sourceN = df
p2 = figure()
p2.circle('X', 'Y', source=sourceN)
I've been working in a jupyterlab notebook iterating on visualizations of a large amount of data with bokeh, holoviews, and panel, and have been running into this issue periodically.
Here are a couple of additional things that may help. Note that p is used as the bokeh conventional name for the figure. I am posting on this old thread because it was the top result in my Google search for the error message.
Try clearing the document (found in docs):
from bokeh.io import curdoc
curdoc().clear()
I observed that panel was able to display a bokeh object even when bokeh show would not.
import panel as pn
pn.extension()
pn.pane.Bokeh(p)
Digging into how panel is able to display an object even when bokeh is not, I noticed this function, which fixed the problem for me:
import panel as pn
pn.io.model.remove_root(p)
If you don't have panel installed, here is the source code from above:
from bokeh.models import Model
for model in p.select({'type': Model}):
prev_doc = model.document
model._document = None
if prev_doc:
prev_doc.remove_root(model)
Hopefully this helps someone, or future me.
I ran into this error message when using file_html from from bokeh.embed, after i upgraded to bokeh version 1.01. Downgrading again to bokeh version 0.12.16 solved it. (pip install bokeh==0.12.16)
Note sure why.
This solution works without upgrading or downgrading packages.
try:
reset_output()
output_notebook()
show(p)
except:
output_notebook()
show(p)
Solution provided here :
https://github.com/bokeh/bokeh/issues/8579
Try using after creating each plot. add_root will add that model as a root of the current Document, making sure that each Model is added to a single Document:
curdoc().add_root(column([plot]))
curdoc().title = doc_title //Add a title to the doc
show(figure)
Note: column(the list of plots) can be replaced with any object which inherits the Model class.
Refer to the link for more details on add_root and bokeh Documents: https://docs.bokeh.org/en/latest/docs/reference/document.html?highlight=add_root#bokeh.document.document.Document.add_root
column_data_source = ColumnDataSource(dataframe)
After each row in the jupyter notebook that used the column data source we have to make it again simply. The column data source seems like we cant use it many times in the same code.
This seems a little hack but it worked for me when i faced the same error.

106 Pixel Adalight Config

I'm trying to set up a 106 pixel Adalight configuration around the TV in my family room. Anyway, the Processing IDE is telling me there's an unexpected token: { in this line
{0,1,0}, {0,2,0}, {0,3,0}, {0,4,0}, {0,5,0}, {0,6,0}, {0,7,0}, {0,8,0}, {0,9,0}, {0,10,0}, // Top edge
I can't find where there's an out of place {
Here's the entire section of code
http://pastebin.com/ZxiWbTu9 (It wasn't all going in as code, sorry.)
You are missing a comma at the end of the previous line, and on lines 7 and 9.

Problems with 64 bit pointers

I am using Windows 7 and have a 64 bit and a 32 bit version of my program. The 32 bit version works perfectly fine, however, I am having issues with the 64 bit version at runtime. I have a list view item created and am filling the columns with my information. All of them are printing, but one is not printing correctly. This is what it is printing (I apologize for the lack of a picture but as a new member I am unable to post pictures):
Truck
ÍÍÍÍHRZ141
ÍÍÍÍHRZ152
It seems to be placing 4 null characters before the information I actually want it to display. Upon further examination, it appears as though the addressing is incorrect. Here is a section of my code where the error is occurring:
Audit * audit = (Audit *)plvdi->item.lParam;
switch(plvdi->item.iSubItem)
{
case 0:
{
plvdi->item.pszText = audit->Truck;
while(plvdi->item.pszText[0] != 'H')
{
plvdi->item.pszText++;
}
}
return true;
This is a temporary fix due to the fact that all of my truck names start with the character H. plvdi->item.psz text is the text display of the list view item, and audit->Truck is a char[]. It should be as simple as:
sprintf(plvdi->item.pszText, audit->Truck);
but that doesn't seem to work. It leaves me with the same error. When run, the address plvdi->item.pszText is 4 bytes less than the address of audit->Truck, after the assignment statement (breakpoint on the while statement), which I believe is causing the 4 null characters. I am just unsure as to how to resolve this problem without a work around such as the one I posted, why this is happening, and why only in the 64 bit solution. Thank you in advance for any help on this matter.
EDIT: From other similar problems I have found within my program, it seems to have something to do with pointers. Everything in my Audit class that came after a selections vector was having problems and appeared to be off by 4 bytes. In another class, I found that everything coming after a pointer to an Audit failed and I also had some issues with strings (which are technically pointers to char arrays). When I moved the elements with pointers to the end of the class in the header file, everything seemed to work fine again. Any idea if strings, vectors, or other similar structures have pointers that are dependent upon 32 or 64 bit systems?
On 64 bit windows platform, sizeof of a pointer is 8 bytes, while is 4 on a 32 bit configuration. Check your code to avoid the 4 bytes size assumption.

Error reported on a blank line

I am truly stumped this afternoon and have done quite a bit of searching to no avail. I am getting the error
"Object doesn't support this property or method /admin/Upload1_20120508JB.asp, line 91"
From the following code:
90 wf = fso2.CreateTextFile(sWriteFilePath)
91
92 If fso1.FileExists(sReadFilePath) Then ...
Line 91 is blank and Line 90 works as expected, the file gets created in the proper location. Has anyone seen anything like this before? If so, what was the solution?
Thanks!
You must use Set, when you assign an object to a variable.
(see here to realize that today is a bad day for this feature of VBScript.)

Resources