def test_disable_saving_empty(self): """Test if save and print buttons are disabled on empty report""" rep = OWReport.get_instance() self.assertFalse(rep.save_button.isEnabled()) self.assertFalse(rep.print_button.isEnabled()) table = OWDataTable() table.set_dataset(Table("iris")) table.create_report_html() rep.make_report(table) self.assertTrue(rep.save_button.isEnabled()) self.assertTrue(rep.print_button.isEnabled()) rep.clear() self.assertFalse(rep.save_button.isEnabled()) self.assertFalse(rep.print_button.isEnabled())
import sys from Orange.data import Table from Orange.widgets.data.owfile import OWFile from Orange.widgets.data.owtable import OWDataTable from Orange.widgets.data.owdiscretize import OWDiscretize from Orange.widgets.model.owrandomforest import OWRandomForest iris = Table("iris") app = QApplication(sys.argv) main = OWReport.get_instance() file = OWFile() file.create_report_html() main.make_report(file) table = OWDataTable() table.set_dataset(iris) table.create_report_html() main.make_report(table) main = OWReport.get_instance() disc = OWDiscretize() disc.create_report_html() main.make_report(disc) learner = OWRandomForest() learner.create_report_html() main.make_report(learner) main.show() main.saveSettings()