예제 #1
0
 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")
예제 #2
0
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
예제 #3
0
 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))
예제 #4
0
 def setUpClass(cls) -> None:
     cls.builder = AppBuilder(path=get_resource("common_layout.xml"))
예제 #5
0
 def setUpClass(cls) -> None:
     cls.builder = AppBuilder(path=get_resource("variables.xml"))
예제 #6
0
 def setUpClass(cls) -> None:
     cls.builder = AppBuilder(path=get_resource("canvas.xml"))
     cls.canvas1 = cls.builder.canvas1
     cls.canvas2 = cls.builder.canvas2
예제 #7
0
 def setUpClass(cls) -> None:
     cls.builder = AppBuilder(path=get_resource("all_legacy.xml"))
예제 #8
0
 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")
예제 #9
0
 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")
예제 #10
0
 def test_load_string_implicit_format_requirement(self):
     self.assertRaises(ValueError, lambda: AppBuilder(string=self.xml_string))
예제 #11
0
 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")
예제 #12
0
 def setUpClass(cls) -> None:
     cls.builder = AppBuilder(path=get_resource("meta.xml"))
예제 #13
0
 def setUp(self) -> None:
     self.clicked = False
     self.builder = AppBuilder(path=get_resource("bindings.xml"))
     self.builder.connect_callbacks(self)
예제 #14
0
 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")
예제 #15
0
 def setUpClass(cls) -> None:
     cls.builder = AppBuilder(path=get_resource("grid_conf.xml"))