Exemplo n.º 1
0
    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, "*")
Exemplo n.º 2
0
    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, "*")
Exemplo n.º 3
0
# Constructor
f.add_constructor_parameter("filled", "False")
f.add_constructor_parameter("min_value", "0.0")
f.add_constructor_parameter("max_value", "0.0")
f.add_constructor_parameter("value", "None")

# Functions
f.add_public_function("get_value", [], "float")
f.add_public_function("set_value", [("value", "float")])

f.add_property("value", "float")

# Events
f.add_event("changed")
f.construct_sourcecode("LUISlider")

# Create the checkbox
layout = LUIVerticalLayout(parent=f.get_widget_node(), spacing=10)

LUILabel(parent=layout.cell(), text="This is a filled slider:", color=(1, 1, 1, 0.4))
slider = LUISlider(parent=layout.cell(), width=200.0)

LUILabel(parent=layout.cell(), text="This is a regular slider:", color=(1, 1, 1, 0.4))
slider_nofill = LUISlider(parent=layout.cell(), width=200.0, filled=False)

f.set_actions({
        "Set to 30%": lambda: slider.set_value(0.3),
    })

run()
Exemplo n.º 4
0
    def prepare_demo(self, demo_title=u"Some Demo"):

        # Background
        self._background = LUISprite(self._root, "res/DemoBackground.png")
        # Make the background solid and recieve events
        self._background.solid = True

        # Logo
        self._logo = LUISprite(self._root, "res/LUILogo.png")
        self._logo.top_left = 15, 20

        # Title
        self._title_label = LUILabel(parent=self._root,
                                     text=demo_title,
                                     font_size=40,
                                     font="header",
                                     pos=(120, 27))
        self._subtitle_label = LUILabel(parent=self._root,
                                        text="Widget Demo",
                                        font_size=14,
                                        font="default",
                                        pos=(121, 70),
                                        alpha=0.3)

        # Right bar

        self._right_bar = LUIVerticalLayout(parent=self._root)
        self._left_bar = LUIVerticalLayout(parent=self._root)
        self._right_bar.width = 350
        self._right_bar.pos = (410, 120)
        self._right_bar.spacing = 10
        self._left_bar.width = 350
        self._left_bar.pos = (20, 120)
        self._left_bar.spacing = 10

        # Public functions
        self._public_functions = LUIFrame(width=340, style=LUIFrame.FS_sunken)
        self._functions_label = LUILabel(text=U"Additional Public functions")
        self._functions_layout = LUIVerticalLayout(
            parent=self._public_functions)
        self._functions_layout.add(self._functions_label, 30)

        # Events
        self._events = LUIFrame(width=340, style=LUIFrame.FS_sunken)
        self._events_label = LUILabel(text=U"Additional Events")
        self._events_layout = LUIVerticalLayout(parent=self._events)
        self._events_layout.add(self._events_label, 30)

        # Actions
        self._actions = LUIFrame(width=340, style=LUIFrame.FS_sunken)
        self._actions_label = LUILabel(parent=self._actions,
                                       text=U"Demo-Actions")
        self._actions_select = LUISelectbox(parent=self._actions,
                                            width=225,
                                            top=30)
        self._actions_btn = LUIButton(parent=self._actions,
                                      right=0,
                                      top=30,
                                      text=u"Execute",
                                      template="ButtonGreen")
        self._actions_btn.bind("click", self._exec_action)

        # Properties
        self._properties = LUIFrame(width=340, style=LUIFrame.FS_sunken)
        self._properties_label = LUILabel(text=u"Additional Properties")
        self._properties_layout = LUIVerticalLayout(parent=self._properties)
        self._properties_layout.add(self._properties_label, 30)

        self._right_bar.add(self._actions)
        self._right_bar.add(self._public_functions)
        self._right_bar.add(self._properties)
        self._right_bar.add(self._events)

        # Widget
        self._widget_container = LUIFrame(width=360,
                                          height=250,
                                          style=LUIFrame.FS_sunken)
        self._widget_label = LUILabel(parent=self._widget_container,
                                      text=u"Widget Demo")
        self._left_bar.add(self._widget_container)

        # Source Code
        self._source_container = LUIFrame(width=360,
                                          height=190,
                                          style=LUIFrame.FS_sunken)
        self._source_label = LUILabel(parent=self._source_container,
                                      text=u"Default Constructor")
        self._copy_code_button = LUIButton(parent=self._source_container,
                                           text=u"Copy to Clipboard",
                                           template="ButtonGreen",
                                           bottom_right=(0, 0))
        self._source_content = LUIObject(self._source_container)
        self._source_content.top = 40
        self._left_bar.add(self._source_container)

        self._widget_node = LUIObject(self._widget_container, x=0, y=40)
Exemplo n.º 5
0
class DemoFramework:
    """ This is a small helper class to setup common stuff for the demos """
    def __init__(self):
        """ Constructs the demo framework """

        if False:
            self._skin = LUIMetroSkin()
            base.win.set_clear_color(Vec4(1))
        else:
            self._skin = LUIDefaultSkin()
            base.win.set_clear_color(Vec4(0.1, 0.0, 0.0, 1))
        self._skin.load()

        # Construct the LUIRegion
        region = LUIRegion.make("LUI", base.win)
        handler = LUIInputHandler()
        base.mouseWatcher.attach_new_node(handler)
        region.set_input_handler(handler)

        self._root = region.root
        self._constructor_params = []

    def prepare_demo(self, demo_title=u"Some Demo"):

        # Background
        self._background = LUISprite(self._root, "res/DemoBackground.png")
        # Make the background solid and recieve events
        self._background.solid = True

        # Logo
        self._logo = LUISprite(self._root, "res/LUILogo.png")
        self._logo.top_left = 15, 20

        # Title
        self._title_label = LUILabel(parent=self._root,
                                     text=demo_title,
                                     font_size=40,
                                     font="header",
                                     pos=(120, 27))
        self._subtitle_label = LUILabel(parent=self._root,
                                        text="Widget Demo",
                                        font_size=14,
                                        font="default",
                                        pos=(121, 70),
                                        alpha=0.3)

        # Right bar

        self._right_bar = LUIVerticalLayout(parent=self._root)
        self._left_bar = LUIVerticalLayout(parent=self._root)
        self._right_bar.width = 350
        self._right_bar.pos = (410, 120)
        self._right_bar.spacing = 10
        self._left_bar.width = 350
        self._left_bar.pos = (20, 120)
        self._left_bar.spacing = 10

        # Public functions
        self._public_functions = LUIFrame(width=340, style=LUIFrame.FS_sunken)
        self._functions_label = LUILabel(text=U"Additional Public functions")
        self._functions_layout = LUIVerticalLayout(
            parent=self._public_functions)
        self._functions_layout.add(self._functions_label, 30)

        # Events
        self._events = LUIFrame(width=340, style=LUIFrame.FS_sunken)
        self._events_label = LUILabel(text=U"Additional Events")
        self._events_layout = LUIVerticalLayout(parent=self._events)
        self._events_layout.add(self._events_label, 30)

        # Actions
        self._actions = LUIFrame(width=340, style=LUIFrame.FS_sunken)
        self._actions_label = LUILabel(parent=self._actions,
                                       text=U"Demo-Actions")
        self._actions_select = LUISelectbox(parent=self._actions,
                                            width=225,
                                            top=30)
        self._actions_btn = LUIButton(parent=self._actions,
                                      right=0,
                                      top=30,
                                      text=u"Execute",
                                      template="ButtonGreen")
        self._actions_btn.bind("click", self._exec_action)

        # Properties
        self._properties = LUIFrame(width=340, style=LUIFrame.FS_sunken)
        self._properties_label = LUILabel(text=u"Additional Properties")
        self._properties_layout = LUIVerticalLayout(parent=self._properties)
        self._properties_layout.add(self._properties_label, 30)

        self._right_bar.add(self._actions)
        self._right_bar.add(self._public_functions)
        self._right_bar.add(self._properties)
        self._right_bar.add(self._events)

        # Widget
        self._widget_container = LUIFrame(width=360,
                                          height=250,
                                          style=LUIFrame.FS_sunken)
        self._widget_label = LUILabel(parent=self._widget_container,
                                      text=u"Widget Demo")
        self._left_bar.add(self._widget_container)

        # Source Code
        self._source_container = LUIFrame(width=360,
                                          height=190,
                                          style=LUIFrame.FS_sunken)
        self._source_label = LUILabel(parent=self._source_container,
                                      text=u"Default Constructor")
        self._copy_code_button = LUIButton(parent=self._source_container,
                                           text=u"Copy to Clipboard",
                                           template="ButtonGreen",
                                           bottom_right=(0, 0))
        self._source_content = LUIObject(self._source_container)
        self._source_content.top = 40
        self._left_bar.add(self._source_container)

        self._widget_node = LUIObject(self._widget_container, x=0, y=40)

    def _exec_action(self, event):
        selected = self._actions_select.get_selected_option()
        if selected is not None:
            selected()

    def set_actions(self, actions):
        opts = []

        for name, action in actions.items():
            opts.append((action, name))

        self._actions_select.set_options(opts)

    def add_public_function(self, name, parameters=None, return_type="void"):
        label = LUIFormattedLabel()
        label.add(text=return_type + " ",
                  color=(102 / 255.0, 217 / 255.0, 239 / 255.0))
        label.add(text=name + " ",
                  color=(166 / 255.0, 226 / 255.0, 46 / 255.0))

        label.add(text="( ", color=(0.9, 0.9, 0.9))

        if parameters is not None:
            for index, (pname, ptype) in enumerate(parameters):
                label.add(text=pname,
                          color=(255 / 255.0, 151 / 255.0, 31 / 255.0))
                label.add(text=" : ", color=(0.9, 0.9, 0.9))
                label.add(text=ptype,
                          color=(102 / 255.0, 217 / 255.0, 239 / 255.0))

                if index < len(parameters) - 1:
                    label.add(text=",", color=(0.9, 0.9, 0.9))
        label.add(text=" )", color=(0.9, 0.9, 0.9))
        self._functions_layout.add(label)
        self.update_layouts()

    def add_constructor_parameter(self, name, default):
        self._constructor_params.append((name, default))
        self.update_layouts()

    def add_event(self, event_name):
        label = LUILabel(text=event_name)
        label.color = (1, 1, 1, 0.5)
        self._events_layout.add(label)
        self.update_layouts()

    def add_property(self, property_name, property_type):
        label = LUIFormattedLabel()
        label.add(text=property_name,
                  color=(255 / 255.0, 151 / 255.0, 31 / 255.0))
        label.add(" : ", color=(0.9, 0.9, 0.9))
        label.add(text=property_type + " ",
                  color=(102 / 255.0, 217 / 255.0, 239 / 255.0))
        self._properties_layout.add(label)
        self.update_layouts()

    def update_layouts(self):
        pass

    def construct_sourcecode(self, classname):
        self._source_content.remove_all_children()
        label = LUIFormattedLabel(parent=self._source_content)
        label.add(text="element ", color=(0.9, 0.9, 0.9))
        label.add(text="= ", color=(249 / 255.0, 38 / 255.0, 114 / 255.0))
        label.add(text=classname, color=(166 / 255.0, 226 / 255.0, 46 / 255.0))
        label.add(text="(", color=(0.9, 0.9, 0.9))

        for index, (pname, pvalue) in enumerate(self._constructor_params):
            label.newline()
            label.add(text=" " * 15)
            label.add(text=pname, color=(255 / 255.0, 151 / 255.0, 31 / 255.0))
            label.add(text=" = ")
            label.add(text=pvalue,
                      color=(153 / 255.0, 129 / 255.0, 255 / 255.0))

            if index < len(self._constructor_params) - 1:
                label.add(text=",")

        label.add(text=")")

        copy_text = "element = " + classname + "("

        for index, (pname, pvalue) in enumerate(self._constructor_params):
            copy_text += pname + "=" + pvalue

            if index < len(self._constructor_params) - 1:
                copy_text += ", "
        copy_text += ")"

        def copy_code(event):
            # Copies the source code to clipboard
            from Tkinter import Tk
            r = Tk()
            r.withdraw()
            r.clipboard_clear()
            r.clipboard_append(copy_text)
            r.destroy()

        self._copy_code_button.bind("click", copy_code)

        # self._source_content.fit_height_to_children()
        # self._source_container.fit_height_to_children()
        self._source_container.height += 40

    def get_widget_node(self):
        return self._widget_node
Exemplo n.º 6
0
    def prepare_demo(self, demo_title=u"Some Demo"):

        # Background
        self._background = LUISprite(self._root, "res/DemoBackground.png")
        # Make the background solid and recieve events
        self._background.solid = True

        # Logo
        self._logo = LUISprite(self._root, "res/LUILogo.png")
        self._logo.top_left = 15, 20

        # Title
        self._title_label = LUILabel(parent=self._root, text=demo_title, font_size=40,
                                     font="header", pos=(120, 27))
        self._subtitle_label = LUILabel(parent=self._root, text="Widget Demo", font_size=14,
                                        font="default", pos=(121, 70), alpha=0.3)

        # Right bar

        self._right_bar = LUIVerticalLayout(parent=self._root)
        self._left_bar = LUIVerticalLayout(parent=self._root)
        self._right_bar.width = 350
        self._right_bar.pos = (410, 120)
        self._right_bar.spacing = 10
        self._left_bar.width = 350
        self._left_bar.pos=(20, 120)
        self._left_bar.spacing = 10

        # Public functions
        self._public_functions = LUIFrame(width=340, style=LUIFrame.FS_sunken)
        self._functions_label = LUILabel(text=U"Additional Public functions")
        self._functions_layout = LUIVerticalLayout(parent=self._public_functions)
        self._functions_layout.add(self._functions_label, 30)

        # Events
        self._events = LUIFrame(width=340, style=LUIFrame.FS_sunken)
        self._events_label = LUILabel(text=U"Additional Events")
        self._events_layout = LUIVerticalLayout(parent=self._events)
        self._events_layout.add(self._events_label, 30)

        # Actions
        self._actions = LUIFrame(width=340, style=LUIFrame.FS_sunken)
        self._actions_label = LUILabel(parent=self._actions, text=U"Demo-Actions")
        self._actions_select = LUISelectbox(parent=self._actions, width=225, top=30)
        self._actions_btn = LUIButton(parent=self._actions, right=0, top=30, text=u"Execute", template="ButtonGreen")
        self._actions_btn.bind("click", self._exec_action)

        # Properties
        self._properties = LUIFrame(width=340, style=LUIFrame.FS_sunken)
        self._properties_label = LUILabel(text=u"Additional Properties")
        self._properties_layout = LUIVerticalLayout(parent=self._properties)
        self._properties_layout.add(self._properties_label, 30)

        self._right_bar.add(self._actions)
        self._right_bar.add(self._public_functions)
        self._right_bar.add(self._properties)
        self._right_bar.add(self._events)

        # Widget
        self._widget_container = LUIFrame(width=360, height=250, style=LUIFrame.FS_sunken)
        self._widget_label = LUILabel(parent=self._widget_container, text=u"Widget Demo")
        self._left_bar.add(self._widget_container)

        # Source Code
        self._source_container = LUIFrame(width=360, height=190, style=LUIFrame.FS_sunken)
        self._source_label = LUILabel(parent=self._source_container, text=u"Default Constructor")
        self._copy_code_button = LUIButton(parent=self._source_container,
                text=u"Copy to Clipboard", template="ButtonGreen", bottom_right=(0, 0))
        self._source_content = LUIObject(self._source_container)
        self._source_content.top = 40
        self._left_bar.add(self._source_container)

        self._widget_node = LUIObject(self._widget_container, x=0, y=40)
Exemplo n.º 7
0
class DemoFramework:

    """ This is a small helper class to setup common stuff for the demos """

    def __init__(self):
        """ Constructs the demo framework """

        if False:
            self._skin = LUIMetroSkin()
            base.win.set_clear_color(Vec4(1))
        else:
            self._skin = LUIDefaultSkin()
            base.win.set_clear_color(Vec4(0.1, 0.0, 0.0, 1))
        self._skin.load()

        # Construct the LUIRegion
        region = LUIRegion.make("LUI", base.win)
        handler = LUIInputHandler()
        base.mouseWatcher.attach_new_node(handler)
        region.set_input_handler(handler)

        self._root = region.root
        self._constructor_params = []

    def prepare_demo(self, demo_title=u"Some Demo"):

        # Background
        self._background = LUISprite(self._root, "res/DemoBackground.png")
        # Make the background solid and recieve events
        self._background.solid = True

        # Logo
        self._logo = LUISprite(self._root, "res/LUILogo.png")
        self._logo.top_left = 15, 20

        # Title
        self._title_label = LUILabel(parent=self._root, text=demo_title, font_size=40,
                                     font="header", pos=(120, 27))
        self._subtitle_label = LUILabel(parent=self._root, text="Widget Demo", font_size=14,
                                        font="default", pos=(121, 70), alpha=0.3)

        # Right bar

        self._right_bar = LUIVerticalLayout(parent=self._root)
        self._left_bar = LUIVerticalLayout(parent=self._root)
        self._right_bar.width = 350
        self._right_bar.pos = (410, 120)
        self._right_bar.spacing = 10
        self._left_bar.width = 350
        self._left_bar.pos=(20, 120)
        self._left_bar.spacing = 10

        # Public functions
        self._public_functions = LUIFrame(width=340, style=LUIFrame.FS_sunken)
        self._functions_label = LUILabel(text=U"Additional Public functions")
        self._functions_layout = LUIVerticalLayout(parent=self._public_functions)
        self._functions_layout.add(self._functions_label, 30)

        # Events
        self._events = LUIFrame(width=340, style=LUIFrame.FS_sunken)
        self._events_label = LUILabel(text=U"Additional Events")
        self._events_layout = LUIVerticalLayout(parent=self._events)
        self._events_layout.add(self._events_label, 30)

        # Actions
        self._actions = LUIFrame(width=340, style=LUIFrame.FS_sunken)
        self._actions_label = LUILabel(parent=self._actions, text=U"Demo-Actions")
        self._actions_select = LUISelectbox(parent=self._actions, width=225, top=30)
        self._actions_btn = LUIButton(parent=self._actions, right=0, top=30, text=u"Execute", template="ButtonGreen")
        self._actions_btn.bind("click", self._exec_action)

        # Properties
        self._properties = LUIFrame(width=340, style=LUIFrame.FS_sunken)
        self._properties_label = LUILabel(text=u"Additional Properties")
        self._properties_layout = LUIVerticalLayout(parent=self._properties)
        self._properties_layout.add(self._properties_label, 30)

        self._right_bar.add(self._actions)
        self._right_bar.add(self._public_functions)
        self._right_bar.add(self._properties)
        self._right_bar.add(self._events)

        # Widget
        self._widget_container = LUIFrame(width=360, height=250, style=LUIFrame.FS_sunken)
        self._widget_label = LUILabel(parent=self._widget_container, text=u"Widget Demo")
        self._left_bar.add(self._widget_container)

        # Source Code
        self._source_container = LUIFrame(width=360, height=190, style=LUIFrame.FS_sunken)
        self._source_label = LUILabel(parent=self._source_container, text=u"Default Constructor")
        self._copy_code_button = LUIButton(parent=self._source_container,
                text=u"Copy to Clipboard", template="ButtonGreen", bottom_right=(0, 0))
        self._source_content = LUIObject(self._source_container)
        self._source_content.top = 40
        self._left_bar.add(self._source_container)

        self._widget_node = LUIObject(self._widget_container, x=0, y=40)

    def _exec_action(self, event):
        selected = self._actions_select.get_selected_option()
        if selected is not None:
            selected()

    def set_actions(self, actions):
        opts = []

        for name, action in actions.items():
            opts.append((action, name))

        self._actions_select.set_options(opts)

    def add_public_function(self, name, parameters=None, return_type="void"):
        label = LUIFormattedLabel()
        label.add(text=return_type + " ", color = (102/255.0, 217/255.0, 239/255.0))
        label.add(text=name + " ", color = (166/255.0, 226/255.0, 46/255.0))

        label.add(text="( ", color=(0.9,0.9,0.9))

        if parameters is not None:
            for index, (pname, ptype) in enumerate(parameters):
                label.add(text=pname, color=(255/255.0, 151/255.0, 31/255.0))
                label.add(text=" : ", color=(0.9,0.9,0.9))
                label.add(text=ptype, color=(102/255.0, 217/255.0, 239/255.0))

                if index < len(parameters) - 1:
                    label.add(text=",", color=(0.9,0.9,0.9))
        label.add(text=" )", color=(0.9,0.9,0.9))
        self._functions_layout.add(label)
        self.update_layouts()

    def add_constructor_parameter(self, name, default):
        self._constructor_params.append((name, default))
        self.update_layouts()

    def add_event(self, event_name):
        label = LUILabel(text=event_name)
        label.color = (1,1,1,0.5)
        self._events_layout.add(label)
        self.update_layouts()

    def add_property(self, property_name, property_type):
        label = LUIFormattedLabel()
        label.add(text=property_name, color=(255/255.0, 151/255.0, 31/255.0) )
        label.add(" : ", color=(0.9,0.9,0.9) )
        label.add(text=property_type + " ", color=(102/255.0, 217/255.0, 239/255.0) )
        self._properties_layout.add(label)
        self.update_layouts()

    def update_layouts(self):
        pass

    def construct_sourcecode(self, classname):
        self._source_content.remove_all_children()
        label = LUIFormattedLabel(parent=self._source_content)
        label.add(text="element ", color=(0.9,0.9,0.9))
        label.add(text="= ", color=(249/255.0, 38/255.0, 114/255.0))
        label.add(text=classname, color=(166/255.0, 226/255.0, 46/255.0))
        label.add(text="(", color=(0.9,0.9,0.9))

        for index, (pname, pvalue) in enumerate(self._constructor_params):
            label.newline()
            label.add(text=" " * 15)
            label.add(text=pname, color=(255/255.0, 151/255.0, 31/255.0))
            label.add(text=" = ")
            label.add(text=pvalue, color=(153/255.0, 129/255.0, 255/255.0))

            if index < len(self._constructor_params) - 1:
                label.add(text=",")

        label.add(text=")")

        copy_text = "element = " + classname + "("

        for index, (pname, pvalue) in enumerate(self._constructor_params):
            copy_text += pname + "=" + pvalue

            if index < len(self._constructor_params) - 1:
                copy_text += ", "
        copy_text += ")"

        def copy_code(event):
            # Copies the source code to clipboard
            from Tkinter import Tk
            r = Tk()
            r.withdraw()
            r.clipboard_clear()
            r.clipboard_append(copy_text)
            r.destroy()

        self._copy_code_button.bind("click", copy_code)

        # self._source_content.fit_height_to_children()
        # self._source_container.fit_height_to_children()
        self._source_container.height += 40


    def get_widget_node(self):
        return self._widget_node
Exemplo n.º 8
0
    style = LUIFrame.FS_sunken)


# label_tl = LUILabel(parent=container, text="Top Left", top_left=(0,0))
# label_tr = LUILabel(parent=container, text="Top Right", top_right=(0,0))
# label_bl = LUILabel(parent=container, text="Bottom Left", bottom_left=(0,0))
# label_br = LUILabel(parent=container, text="Bottom Right", bottom_right=(0,0))

# button = LUIButton(parent=container, top_left=(0, 0), text="Well this one .. is a long button! (A really long one!) ............ really long!")
# button.bind("click", lambda event: button.set_text("Hello!"))
container.size = 300, 300
# group = LUIRadioboxGroup()
# box = LUIRadiobox(parent=container, group=group, top=50)
# box2 = LUICheckbox(parent=container, top=100)

layout = LUIVerticalLayout(parent=container)
# layout.height = 280
# layout.width = 300

LUILabel(parent=layout.cell(),      text="Hello")
LUILabel(parent=layout.cell(),      text="World")
LUILabel(parent=layout.cell(100),   text="100px row")
LUILabel(parent=layout.cell(),      text="Next")
LUIButton(parent=layout.cell(),     text="SomeButton")
LUILabel(parent=layout.cell('*'),   text="Fill column")
LUILabel(parent=layout.cell(),      text="Last column")

for i in range(5):
    base.graphicsEngine.render_frame()

region.root.ls()
Exemplo n.º 9
0
                     height=300,
                     style=LUIFrame.FS_sunken)

# label_tl = LUILabel(parent=container, text="Top Left", top_left=(0,0))
# label_tr = LUILabel(parent=container, text="Top Right", top_right=(0,0))
# label_bl = LUILabel(parent=container, text="Bottom Left", bottom_left=(0,0))
# label_br = LUILabel(parent=container, text="Bottom Right", bottom_right=(0,0))

# button = LUIButton(parent=container, top_left=(0, 0), text="Well this one .. is a long button! (A really long one!) ............ really long!")
# button.bind("click", lambda event: button.set_text("Hello!"))
container.size = 300, 300
# group = LUIRadioboxGroup()
# box = LUIRadiobox(parent=container, group=group, top=50)
# box2 = LUICheckbox(parent=container, top=100)

layout = LUIVerticalLayout(parent=container)
# layout.height = 280
# layout.width = 300

LUILabel(parent=layout.cell(), text="Hello")
LUILabel(parent=layout.cell(), text="World")
LUILabel(parent=layout.cell(100), text="100px row")
LUILabel(parent=layout.cell(), text="Next")
LUIButton(parent=layout.cell(), text="SomeButton")
LUILabel(parent=layout.cell('*'), text="Fill column")
LUILabel(parent=layout.cell(), text="Last column")

for i in range(5):
    base.graphicsEngine.render_frame()

region.root.ls()
Exemplo n.º 10
0
f = DemoFramework()
f.prepare_demo("LUIProgressbar")

# Constructor
f.add_constructor_parameter("show_label", "False")

# Functions
f.add_public_function("get_value", [], "float")
f.add_public_function("set_value", [("value", "float")])

f.add_property("value", "float")

# Events
f.construct_sourcecode("LUIProgressbar")

# Create the checkbox
layout = LUIVerticalLayout(parent=f.get_widget_node(), spacing=10)

LUILabel(parent=layout.cell(), text="This is a progressbar:", color=(1, 1, 1, 0.4))
bar = LUIProgressbar(parent=layout.cell(), width=200.0)

LUILabel(parent=layout.cell(), text="You can control it with this slider:", color=(1, 1, 1, 0.4))
slider = LUISlider(parent=layout.cell(), width=200.0, filled=True)
slider.bind("changed", lambda event: bar.set_value(slider.value * 100.0))

f.set_actions({
        "Set to 30%": lambda: bar.set_value(30),
    })

run()
Exemplo n.º 11
0
f.prepare_demo("LUIProgressbar")

# Constructor
f.add_constructor_parameter("show_label", "False")

# Functions
f.add_public_function("get_value", [], "float")
f.add_public_function("set_value", [("value", "float")])

f.add_property("value", "float")

# Events
f.construct_sourcecode("LUIProgressbar")

# Create the checkbox
layout = LUIVerticalLayout(parent=f.get_widget_node(), spacing=10)

LUILabel(parent=layout.cell(),
         text="This is a progressbar:",
         color=(1, 1, 1, 0.4))
bar = LUIProgressbar(parent=layout.cell(), width=200.0)

LUILabel(parent=layout.cell(),
         text="You can control it with this slider:",
         color=(1, 1, 1, 0.4))
slider = LUISlider(parent=layout.cell(), width=200.0, filled=True)
slider.bind("changed", lambda event: bar.set_value(slider.value * 100.0))

f.set_actions({
    "Set to 30%": lambda: bar.set_value(30),
})
Exemplo n.º 12
0
class LUITabbedFrame(LUIFrame):
    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, "*")

    def add(self, header, frame):
        # header
        if isinstance(header, str):
            header = LUILabel(text=header)
        self.header_bar.add(header, "?")
        self.header_to_frame[header] = frame
        header.solid = True
        header.bind("click", self._change_to_tab)
        # Frame
        frame.parent = self.main_frame
        frame.width = "100%"
        frame.height = "100%"
        # Put frame in front
        if self.current_frame is None:
            self.current_frame = frame
            self.current_frame.show()
        else:
            frame.hide()

    #def remove(self, header):
    #    if header in self.header_to_frame.keys():
    #        idx_dict = {idx: elem
    #                    for idx, elem in zip(range(self.header_bar.child_count),
    #                                         self.header_bar.children)}
    #        idx = idx_dict[header]
    #        print(idx)
    #        self.header_bar.remove_cell(idx)
    #        frame = self.header_to_frame[header]
    #        frame.parent = None
    #        del self.header_to_frame[header]
    #        if self.current_frame == frame:
    #            self.current_frame = None
    #        return True
    #    else:
    #        return False

    def _change_to_tab(self, lui_event):
        header = lui_event.sender
        if self.current_frame is not None:
            self.current_frame.hide()
        self.current_frame = self.header_to_frame[header]
        self.current_frame.show()
Exemplo n.º 13
0
class LUITabbedFrame(LUIFrame):
    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, "*")

    def add(self, header, frame):
        # header
        if isinstance(header, str):
            header = LUILabel(text = header)
        self.header_bar.add(header, "?")
        self.header_to_frame[header] = frame
        header.solid = True
        header.bind("click", self._change_to_tab)
        # Frame
        frame.parent = self.main_frame
        frame.width = "100%"
        frame.height = "100%"
        # Put frame in front
        if self.current_frame is None:
            self.current_frame = frame
            self.current_frame.show()
        else:
            frame.hide()

    #def remove(self, header):
    #    if header in self.header_to_frame.keys():
    #        idx_dict = {idx: elem
    #                    for idx, elem in zip(range(self.header_bar.child_count),
    #                                         self.header_bar.children)}
    #        idx = idx_dict[header]
    #        print(idx)
    #        self.header_bar.remove_cell(idx)
    #        frame = self.header_to_frame[header]
    #        frame.parent = None
    #        del self.header_to_frame[header]
    #        if self.current_frame == frame:
    #            self.current_frame = None
    #        return True
    #    else:
    #        return False

    def _change_to_tab(self, lui_event):
        header = lui_event.sender
        if self.current_frame is not None:
            self.current_frame.hide()
        self.current_frame = self.header_to_frame[header]
        self.current_frame.show()
Exemplo n.º 14
0
class LUITabbedFrame(LUIFrame):
    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, "*")
        self.bind("expose", self.on_expose)
        self.bind("unexpose", self.on_unexpose)

    def add(self, header, frame):
        # header
        if isinstance(header, str):
            header = LUILabel(text = header)
        self.header_bar.add(header, "?")
        self.header_to_frame[header] = frame
        header.solid = True
        header.bind("click", self._change_to_tab)
        # Frame
        frame.parent = self.main_frame
        frame.width = "100%"
        frame.height = "100%"
        # Put frame in front
        if self.current_frame is None:
            self.current_frame = frame
            self.current_frame.show()
        else:
            frame.hide()
        return header

    def _find_header_index(self, header):
        for idx, child in enumerate(self.header_bar.children):
            if any([grandchild == header for grandchild in child.children]):
                break
        else:
            raise ValueError("Given object is not a header bar item.")
        return idx

    def remove(self, header):
        idx = self._find_header_index(header)
        self.header_bar.remove_cell(idx)
        frame = self.header_to_frame[header]
        frame.parent = None
        del self.header_to_frame[header]
        if self.current_frame == frame:
            self.current_frame = None

    def _change_to_tab(self, lui_event):
        header = lui_event.sender
        if self.current_frame is not None:
            self.current_frame.trigger_event("unexpose")
            self.current_frame.hide()
        self.current_frame = self.header_to_frame[header]
        self.current_frame.show()
        self.current_frame.trigger_event("expose")

    def on_expose(self, event):
        self.current_frame.trigger_event("expose")

    def on_unexpose(self, event):
        self.current_frame.trigger_event("unexpose")
Exemplo n.º 15
0
f.add_public_function("get_value", [], "object")
f.add_public_function("get_label", [], "LUILabel")
f.add_public_function("set_active", [], "void")

f.add_property("value", "object")
f.add_property("label", "LUILabel")

# Events
f.add_event("changed")
f.construct_sourcecode("LUIRadiobox")

# Create a group to connect the boxes
group = LUIRadioboxGroup()

# Create a layout for the boxes
grid = LUIVerticalLayout(parent=f.get_widget_node(), spacing=5)

# Create the boxes
boxes = []
for i in range(1, 4):
    boxes.append(LUIRadiobox(group=group, value=i, label="Radiobox {0}".format(i), active=i==2))
    grid.add(boxes[-1])

f.set_actions({
        "Select Box 1": lambda: boxes[0].set_active(),
        "Select Box 2": lambda: boxes[1].set_active(),
        "Select Box 3": lambda: boxes[2].set_active(),
        "Set Random Text": lambda: boxes[0].label.set_text(u"Text: " + unicode(random.randint(100, 10000))),
    })

run()
Exemplo n.º 16
0
class LUIColorpickerPopup(LUIPopup, LUICallback):
    def __init__(self, parent=None):
        LUIPopup.__init__(self, parent=parent, width=240, height=146)
        LUICallback.__init__(self)

        self.field = LUIObject(self.content, x=0, y=0, w=128, h=128)

        self.fieldBG = LUISprite(self.field, "blank", "skin")
        self.fieldBG.size = (128, 128)
        self.fieldBG.color = (0.2, 0.6, 1.0)
        self.fieldFG = LUISprite(self.field, "ColorpickerFieldOverlay", "skin")
        self.fieldFG.pos = (-2, 0)

        self.fieldBG.bind("mousedown", self._start_field_dragging)
        self.fieldBG.bind("mouseup", self._stop_field_dragging)

        self.fieldHandle = LUISprite(self.field, "ColorpickerFieldHandle",
                                     "skin")
        self.fieldHandle.bind("mousedown", self._start_field_dragging)
        self.fieldHandle.bind("mouseup", self._stop_field_dragging)

        self.fieldDragging = False

        self.hueSlider = LUIObject(self.content, x=140, y=0, w=40, h=128)
        self.hueSliderFG = LUISprite(self.hueSlider, "ColorpickerHueSlider",
                                     "skin")

        self.hueHandle = LUISprite(self.hueSlider, "ColorpickerHueHandle",
                                   "skin")
        self.hueHandle.left = (self.hueSliderFG.width -
                               self.hueHandle.width) / 2.0
        self.hueHandle.top = 50

        self.hueDragging = False
        self.hueSlider.bind("mousedown", self._start_hue_dragging)
        self.hueSlider.bind("mouseup", self._stop_hue_dragging)

        self.labels = LUIVerticalLayout(self.content, width=40)
        self.labels.pos = (177, 42)

        colors = [u"R", u"G", u"B"]
        self.colorLabels = []

        for color in colors:
            label = LUILabel(text=color, shadow=True)
            label.color = (1, 1, 1, 0.3)

            valueLabel = LUILabel(text=u"255", shadow=True)
            valueLabel.right = 0
            self.labels.add(label, valueLabel)
            self.colorLabels.append(valueLabel)

        self.activeColor = LUIObject(self.content, x=177, y=0)
        self.activeColorBG = LUISprite(self.activeColor, "blank", "skin")
        self.activeColorFG = LUISprite(self.activeColor,
                                       "ColorpickerActiveColorOverlay", "skin")

        self.activeColorBG.size = (40, 40)
        self.activeColorBG.pos = (2, 0)
        self.activeColorBG.color = (0.2, 0.6, 1.0, 1.0)

        self.closeButton = LUIButton(parent=self.content,
                                     text=u"Done",
                                     width=45,
                                     template="ButtonGreen")
        self.closeButton.left = 177
        self.closeButton.top = 98
        self.closeButton.bind("click", self._close_popup)

        self._set_hue(0.5)
        self._set_sat_val(0.5, 0.5)

        self.widget = parent

    def _load_rgb(self, rgb):
        hsv = colorsys.rgb_to_hsv(*rgb)
        self._set_hue(hsv[0])
        self._set_sat_val(hsv[1], hsv[2])

    def _close_popup(self, event):
        self.widget._on_popup_closed()
        self.close()

    def _update(self, event):
        if self.hueDragging:
            offset = event.coordinates.y - self.hueSliderFG.abs_pos.y
            offset /= 128.0
            offset = 1.0 - max(0.0, min(1.0, offset))
            self._set_hue(offset)

        if self.fieldDragging:
            offset = event.coordinates - self.fieldBG.abs_pos
            saturation = max(0.0, min(1.0, offset.x / 128.0))
            value = 1.0 - max(0.0, min(1.0, offset.y / 128.0))
            self._set_sat_val(saturation, value)

        self._update_color()

    def _set_sat_val(self, sat, val):
        self.saturation = sat
        self.valueValue = val

        self.fieldHandle.top = (
            1.0 - self.valueValue) * 128.0 - self.fieldHandle.height / 2.0
        self.fieldHandle.left = self.saturation * 128.0 - self.fieldHandle.width / 2.0

    def _set_hue(self, hue):
        self.hueValue = min(0.999, hue)
        self.hueHandle.top = (1.0 - hue) * 128.0 - self.hueHandle.height / 2
        self.fieldBG.color = colorsys.hsv_to_rgb(self.hueValue, 1, 1)

    def _update_color(self):
        rgb = colorsys.hsv_to_rgb(self.hueValue, self.saturation,
                                  self.valueValue)
        self.activeColorBG.color = rgb

        self.colorLabels[0].set_text(str(int(rgb[0] * 255.0)).encode('utf-8'))
        self.colorLabels[1].set_text(str(int(rgb[1] * 255.0)).encode('utf-8'))
        self.colorLabels[2].set_text(str(int(rgb[2] * 255.0)).encode('utf-8'))

        self._trigger_callback(rgb)

    def _start_field_dragging(self, event):
        if not self.fieldDragging:
            self.fieldDragging = True

    def _stop_field_dragging(self, event):
        if self.fieldDragging:
            self.fieldDragging = False

    def _start_hue_dragging(self, event):
        if not self.hueDragging:
            self.hueDragging = True

    def _stop_hue_dragging(self, event):
        if self.hueDragging:
            self.hueDragging = False
Exemplo n.º 17
0
# Constructor
f.add_constructor_parameter("width", "200")
f.add_constructor_parameter("height", "200")
f.add_constructor_parameter("innerPadding", "5")
f.add_constructor_parameter("scrollable", "False")
f.add_constructor_parameter("style", "UIFrame.Raised")

# Functions

# Events
f.construct_sourcecode("LUIFrame")

# Construct a new frame
frame = LUIFrame(parent=f.get_widget_node())

layout = LUIVerticalLayout(parent=frame, spacing=5)
layout.add(LUILabel(text="This is some frame ..", color=(0.2, 0.6, 1.0, 1.0), font_size=20))
layout.add(LUILabel(text="It can contain arbitrary elements."))
layout.add(LUILabel(text="For example this button:"))
layout.add(LUIButton(text="Fancy button"))

# frame.fit_to_children()

f.set_actions({
        "Resize to 300x160": lambda: frame.set_size(300, 160),
        "Fit to children": lambda: frame.clear_size(),
    })

run()
Exemplo n.º 18
0
    def __init__(self, parent=None):
        LUIPopup.__init__(self, parent=parent, width=240, height=146)
        LUICallback.__init__(self)

        self.field = LUIObject(self.content, x=0, y=0, w=128, h=128)

        self.fieldBG = LUISprite(self.field, "blank", "skin")
        self.fieldBG.size = (128, 128)
        self.fieldBG.color = (0.2, 0.6, 1.0)
        self.fieldFG = LUISprite(self.field, "ColorpickerFieldOverlay", "skin")
        self.fieldFG.pos = (-2, 0)

        self.fieldBG.bind("mousedown", self._start_field_dragging)
        self.fieldBG.bind("mouseup", self._stop_field_dragging)

        self.fieldHandle = LUISprite(self.field, "ColorpickerFieldHandle",
                                     "skin")
        self.fieldHandle.bind("mousedown", self._start_field_dragging)
        self.fieldHandle.bind("mouseup", self._stop_field_dragging)

        self.fieldDragging = False

        self.hueSlider = LUIObject(self.content, x=140, y=0, w=40, h=128)
        self.hueSliderFG = LUISprite(self.hueSlider, "ColorpickerHueSlider",
                                     "skin")

        self.hueHandle = LUISprite(self.hueSlider, "ColorpickerHueHandle",
                                   "skin")
        self.hueHandle.left = (self.hueSliderFG.width -
                               self.hueHandle.width) / 2.0
        self.hueHandle.top = 50

        self.hueDragging = False
        self.hueSlider.bind("mousedown", self._start_hue_dragging)
        self.hueSlider.bind("mouseup", self._stop_hue_dragging)

        self.labels = LUIVerticalLayout(self.content, width=40)
        self.labels.pos = (177, 42)

        colors = [u"R", u"G", u"B"]
        self.colorLabels = []

        for color in colors:
            label = LUILabel(text=color, shadow=True)
            label.color = (1, 1, 1, 0.3)

            valueLabel = LUILabel(text=u"255", shadow=True)
            valueLabel.right = 0
            self.labels.add(label, valueLabel)
            self.colorLabels.append(valueLabel)

        self.activeColor = LUIObject(self.content, x=177, y=0)
        self.activeColorBG = LUISprite(self.activeColor, "blank", "skin")
        self.activeColorFG = LUISprite(self.activeColor,
                                       "ColorpickerActiveColorOverlay", "skin")

        self.activeColorBG.size = (40, 40)
        self.activeColorBG.pos = (2, 0)
        self.activeColorBG.color = (0.2, 0.6, 1.0, 1.0)

        self.closeButton = LUIButton(parent=self.content,
                                     text=u"Done",
                                     width=45,
                                     template="ButtonGreen")
        self.closeButton.left = 177
        self.closeButton.top = 98
        self.closeButton.bind("click", self._close_popup)

        self._set_hue(0.5)
        self._set_sat_val(0.5, 0.5)

        self.widget = parent
Exemplo n.º 19
0
base.mouseWatcher.attach_new_node(handler)
region.set_input_handler(handler)

# Title
title_label = LUILabel(parent=region.root, text="LUI Console Example", font_size=40,
                       font="header", pos=(25, 17))

# Container
container = LUIFrame(parent = region.root, width=700, height=500,
    style=LUIFrame.FS_sunken, margin=30, top=50)

text_container = LUIScrollableRegion(parent=container, width=675, height=440,
    padding=0)

base.win.set_clear_color(Vec4(0.1, 0.1, 0.1, 1.0))
layout = LUIVerticalLayout(parent=text_container.content_node)

def send_command(event):
    """ Called when the user presses enter in the input field, submits the
    command and prints something on the console """
    label = LUIFormattedLabel()
    color = (0.9, 0.9, 0.9, 1.0)
    if event.message.startswith(u"/"):
        color = (0.35, 0.65, 0.24, 1.0)
    label.add(text=">>>  ", color=(0.35, 0.65, 0.24, 1.0))
    label.add(text=event.message, color=color)
    layout.add(label)

    result = LUIFormattedLabel()
    result.add("Your command in rot13: " + event.message.encode("rot13"), color=(0.4, 0.4, 0.4, 1.0))
    layout.add(result)
Exemplo n.º 20
0
class LUITabbedFrame(LUIFrame):
    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, "*")
        self.bind("expose", self.on_expose)
        self.bind("unexpose", self.on_unexpose)

    def add(self, header, frame):
        # header
        if isinstance(header, str):
            header = LUILabel(text=header)
        self.header_bar.add(header, "?")
        self.header_to_frame[header] = frame
        header.solid = True
        header.bind("click", self._change_to_tab)
        # Frame
        frame.parent = self.main_frame
        frame.width = "100%"
        frame.height = "100%"
        # Put frame in front
        if self.current_frame is None:
            self.current_frame = frame
            self.current_frame.show()
        else:
            frame.hide()
        return header

    def _find_header_index(self, header):
        for idx, child in enumerate(self.header_bar.children):
            if any([grandchild == header for grandchild in child.children]):
                break
        else:
            raise ValueError("Given object is not a header bar item.")
        return idx

    def remove(self, header):
        idx = self._find_header_index(header)
        self.header_bar.remove_cell(idx)
        frame = self.header_to_frame[header]
        frame.parent = None
        del self.header_to_frame[header]
        if self.current_frame == frame:
            self.current_frame = None

    def _change_to_tab(self, lui_event):
        header = lui_event.sender
        if self.current_frame is not None:
            self.current_frame.trigger_event("unexpose")
            self.current_frame.hide()
        self.current_frame = self.header_to_frame[header]
        self.current_frame.show()
        self.current_frame.trigger_event("expose")

    def on_expose(self, event):
        self.current_frame.trigger_event("expose")

    def on_unexpose(self, event):
        self.current_frame.trigger_event("unexpose")