本文整理汇总了Python中Orange.canvas.report.owreport.OWReport.setParent方法的典型用法代码示例。如果您正苦于以下问题:Python OWReport.setParent方法的具体用法?Python OWReport.setParent怎么用?Python OWReport.setParent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Orange.canvas.report.owreport.OWReport
的用法示例。
在下文中一共展示了OWReport.setParent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: WidgetsScheme
# 需要导入模块: from Orange.canvas.report.owreport import OWReport [as 别名]
# 或者: from Orange.canvas.report.owreport.OWReport import setParent [as 别名]
#.........这里部分代码省略.........
Parameters
----------
node : Scheme
"""
w = self.widget_for_node(node) # type: OWWidget
return bytes(w.saveGeometryAndLayoutState())
def restore_widget_geometry_for_node(self, node, state):
# type: (SchemeNode, bytes) -> bool
w = self.widget_for_node(node)
if w is not None:
return w.restoreGeometryAndLayoutState(QByteArray(state))
else:
return False
def sync_node_properties(self):
"""
Sync the widget settings/properties with the SchemeNode.properties.
Return True if there were any changes in the properties (i.e. if the
new node.properties differ from the old value) and False otherwise.
"""
changed = False
for node in self.nodes:
settings = self.widget_manager.widget_properties(node)
if settings != node.properties:
node.properties = settings
changed = True
log.debug("Scheme node properties sync (changed: %s)", changed)
return changed
def show_report_view(self):
inst = self.report_view()
inst.show()
inst.raise_()
def has_report(self):
"""
Does this workflow have an associated report
Returns
-------
has_report: bool
"""
return self.__report_view is not None
def report_view(self):
"""
Return a OWReport instance used by the workflow.
If a report window has not been set then the `report_view_requested`
signal is emitted to allow the framework to setup the report window.
If the report window is still not set after the signal is emitted, a
new default OWReport instance is constructed and returned.
Returns
-------
report : OWReport
"""
from Orange.canvas.report.owreport import OWReport
if self.__report_view is None:
self.report_view_requested.emit()
if self.__report_view is None:
parent = self.parent()
if isinstance(parent, QWidget):
window = parent.window() # type: QWidget
else:
window = None
self.__report_view = OWReport()
if window is not None:
self.__report_view.setParent(window, Qt.Window)
return self.__report_view
def set_report_view(self, view):
"""
Set the designated OWReport view for this workflow.
Parameters
----------
view : Optional[OWReport]
"""
self.__report_view = view
def dump_settings(self, node: SchemeNode):
from Orange.widgets.settings import SettingsPrinter
widget = self.widget_for_node(node)
pp = SettingsPrinter(indent=4)
pp.pprint(widget.settingsHandler.pack_data(widget))
def event(self, event):
if event.type() == QEvent.Close and \
self.__report_view is not None:
self.__report_view.close()
return super().event(event)
def close(self):
QCoreApplication.sendEvent(self, QEvent(QEvent.Close))