def test_load_node_explicit(self): with open(get_resource("all_legacy.xml"), 'rb') as stream: node = etree.parse(stream).getroot() builder = AppBuilder() builder.load_node(node) self.assertIsInstance(builder.Frame_1, tk.Frame) self.assertEqual(builder.Frame_2["background"], "#e3e3e3")
class Binding(unittest.TestCase): def setUp(self) -> None: self.clicked = False self.builder = AppBuilder(path=get_resource("bindings.xml")) self.builder.connect_callbacks(self) def on_clk(self, *_): self.clicked = True
def preview(self): if self.designer.root_obj is None: # If there is no root object show a warning MessageDialog.show_warning( parent=self, title='Empty design', message='There is nothing to preview. Please add a root widget') return # close previous preview if any self.close_preview() window = self.current_preview = Toplevel(self) window.wm_transient(self) window.build = AppBuilder(window, node=self.designer.to_tree()) name = self.designer.design_path if self.designer.design_path is not None else "Untitled" window.build._app.title(os.path.basename(name))
def setUpClass(cls) -> None: cls.builder = AppBuilder(path=get_resource("common_layout.xml"))
def setUpClass(cls) -> None: cls.builder = AppBuilder(path=get_resource("variables.xml"))
def setUpClass(cls) -> None: cls.builder = AppBuilder(path=get_resource("canvas.xml")) cls.canvas1 = cls.builder.canvas1 cls.canvas2 = cls.builder.canvas2
def setUpClass(cls) -> None: cls.builder = AppBuilder(path=get_resource("all_legacy.xml"))
def test_load_node_explicit(self): node = XMLFormat(path=get_resource("all_legacy.xml")).load() builder = AppBuilder() builder.load_node(node) self.assertIsInstance(builder.Frame_1, tk.Frame) self.assertEqual(builder.Frame_2["background"], "#e3e3e3")
def test_load_string_explicit(self): builder = AppBuilder() builder.load_string(self.xml_string, XMLFormat) self.assertIsInstance(builder.Frame_1, tk.Frame) self.assertEqual(builder.Frame_2["background"], "#e3e3e3")
def test_load_string_implicit_format_requirement(self): self.assertRaises(ValueError, lambda: AppBuilder(string=self.xml_string))
def test_load_path_explicit(self): builder = AppBuilder() builder.load_path(path=get_resource("all_legacy.xml")) self.assertIsInstance(builder.Frame_2, tk.Frame) self.assertEqual(builder.Frame_2["background"], "#e3e3e3")
def setUpClass(cls) -> None: cls.builder = AppBuilder(path=get_resource("meta.xml"))
def setUp(self) -> None: self.clicked = False self.builder = AppBuilder(path=get_resource("bindings.xml")) self.builder.connect_callbacks(self)
def test_load_string_implicit(self): builder = AppBuilder(string=self.xml_string) self.assertIsInstance(builder.Frame_1, tk.Frame) self.assertEqual(builder.Frame_2["background"], "#e3e3e3")
def setUpClass(cls) -> None: cls.builder = AppBuilder(path=get_resource("grid_conf.xml"))