コード例 #1
0
ファイル: LUITabbedFrame.py プロジェクト: pmp-p/LUI
    def __init__(self, **kwargs):
        super(LUITabbedFrame, self).__init__(**kwargs)

        # The main window layout
        bar_spacing = kwargs.get('bar_spacing', 3)
        self.root_layout = LUIVerticalLayout(parent=self, spacing=bar_spacing)
        self.root_layout.height = "100%"
        self.root_layout.width = "100%"
        self.root_layout.margin = 0

        # The header bar
        header_spacing = kwargs.get('header_spacing', 3)
        self.header_bar = LUIHorizontalLayout(
            parent=self.root_layout.cell("?"), spacing=header_spacing)
        self.root_layout.add(self.header_bar, "?")
        self.header_to_frame = {}
        self.current_frame = None

        # The main window contents
        self.main_frame = LUIObject()
        self.main_frame.height = "100%"
        self.main_frame.width = "100%"
        self.main_frame.margin = 0
        # self.main_frame.padding = 0
        self.root_layout.add(self.main_frame, "*")
コード例 #2
0
ファイル: LUILayouts.py プロジェクト: chenhaox/LUI
 def __init__(self, parent=None, prefix="ButtonDefault", **kwargs):
     LUIObject.__init__(self)
     self._layout = LUIHorizontalLayout(self, spacing=0)
     self._layout.width = "100%"
     self._sprite_left = LUISprite(self._layout.cell(), "blank", "skin")
     self._sprite_mid = LUISprite(self._layout.cell('*'), "blank", "skin")
     self._sprite_right = LUISprite(self._layout.cell(), "blank", "skin")
     if parent is not None:
         self.parent = parent
     self.prefix = prefix
     LUIInitialState.init(self, kwargs)
コード例 #3
0
f = DemoFramework()
f.prepare_demo("LUIButton")

# Constructor
f.add_constructor_parameter("text", "u'Button'")
f.add_constructor_parameter("template", "'ButtonDefault'")

# Functions
f.add_public_function("set_text", [("text", "string")])
f.add_public_function("get_text", [], "string")
f.add_property("text", "string")

# Construct source code
f.construct_sourcecode("LUIButton")

# Create 2 new buttons, and store them in a vertical layout
layout = LUIHorizontalLayout(parent=f.get_widget_node(), spacing=10)

button1 = LUIButton(text="Do not click me")
button2 = LUIButton(text="Instead click me", template="ButtonGreen")

layout.add(button1)
layout.add(button2)

f.set_actions({
        "Set Random Text": lambda: button1.set_text("Text: " + str(random.randint(100, 10000000))),
    })

run()