-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improved error handling and reporting for ViurForm
- Loading branch information
Showing
6 changed files
with
95 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,45 @@ | ||
from flare import html5 | ||
from flare.i18n import translate | ||
from flare.icons import SvgIcon | ||
|
||
|
||
class ToolTip(html5.Div): | ||
"""Small utility class for providing tooltips.""" | ||
|
||
def __init__(self, shortText="", longText="", *args, **kwargs): | ||
super(ToolTip, self).__init__(*args, **kwargs) | ||
self["class"] = "vi-tooltip msg is-active" | ||
self.sinkEvent("onClick") | ||
|
||
self.prependChild(SvgIcon("icon-arrow-right", title=shortText)) | ||
# fixme: Tooltip should be replaced by Summary-Tag | ||
''' | ||
super(ToolTip, self).__init__( | ||
# language=HTML | ||
""" | ||
<summary class="msg-content" [name]="tooltipMsg"> | ||
<flare-svg-icon icon="icon-arrow-right" title="{{shortText}}"> | ||
<h2 class="msg-headline" [name]="tooltipHeadline">{{shortText or translate("flare.forms.tooltip")}}</h2> | ||
<details class="msg-descr" [name]="tooltipDescr">{{longText}}</details> | ||
</summary> | ||
""", | ||
shortText=shortText, | ||
longText=longText.replace("\n", "<br />") | ||
) | ||
''' | ||
|
||
# language=HTMl | ||
self.fromHTML( | ||
super().__init__( | ||
# language=HTML | ||
""" | ||
<div class="msg-content" [name]="tooltipMsg"> | ||
<h2 class="msg-headline" [name]="tooltipHeadline">{{shortText or translate("flare.forms.tooltip")}}</h2> | ||
<div class="msg-descr" [name]="tooltipDescr">{{longText}}</div> | ||
</div> | ||
""", | ||
<flare-svg-icon value="icon-arrow-right" title="{{shortText}}"> | ||
<div class="msg-content" [name]="tooltipMsg"> | ||
<h2 class="msg-headline" [name]="tooltipHeadline">{{shortText or translate("flare.forms.tooltip")}}</h2> | ||
<div class="msg-descr" [name]="tooltipDescr">{{longText}}</div> | ||
</div> | ||
""", | ||
shortText=shortText, | ||
longText=longText.replace("\n", "<br />") | ||
) | ||
|
||
self["class"] = "vi-tooltip msg is-active" | ||
self.sinkEvent("onClick") # this becomes obsolete when tooltip is a summary... | ||
|
||
def onClick(self, event): | ||
self.toggleClass("is-open") | ||
|
||
def _setDisabled(self, disabled): | ||
# Tooltip cannot be disabled... | ||
return | ||
|
||
def _getDisabled(self): | ||
return False |