def __init__(self, widget):
        self.main_stack = StackWidget()
        self.main_stack.push(widget)


        from loop import loop
        keys_reflection_widget = KeysReflectionWidget(loop.global_keymap,
                                                      style.key_name,
                                                      style.keydoc_name)
        keys_reflection_widget.bg_color = (20,20,50)

        self.info_list = List([keys_reflection_widget])
        info_box = HBox(self.info_list)
        info_box.selectable.set(False)
        info_box.bg_color = (20,50,20)

        VBox.__init__(self, List([
            self.main_stack,
            SpacerWidget((10, 0)),
            info_box,
        ]), relay_focus=True)

        register_key = self.keymap.register_key
        register_key(self.offset_right_key, Keymap.keydown_noarg(self._offset_right))
        register_key(self.offset_left_key, Keymap.keydown_noarg(self._offset_left))
        register_key(self.offset_up_key, Keymap.keydown_noarg(self._offset_down))
        register_key(self.offset_down_key, Keymap.keydown_noarg(self._offset_up))
    def __init__(self, variable_proxy):
        self.variable_proxy = variable_proxy
        self.variable = variable_proxy.get()

        HBox.__init__(self, List([
            TypeWidgetMaker.make(self.variable.type, self.variable_proxy),
        ]))
 def __init__(self, _type_proxy, variable_proxy):
     self.type = _type_proxy.get()
     HBox.__init__(self, List([
         make_label(style.paren, '('),
         make_label(style.type_, '*'),
         PostTypeWidgetMaker.make(self.type.pointed_type, variable_proxy),
         make_label(style.paren, ')'),
     ]))
     self.is_centered = True
    def __init__(self, array_deref_proxy):
        self.array_deref = array_deref_proxy.get()

        HBox.__init__(self, List([
            NormalWidgetMaker.make(self.array_deref.expr),
            make_label(style.bracket, "["),
            NormalWidgetMaker.make(self.array_deref.index),
            make_label(style.bracket, "]"),
        ]))
    def __init__(self, node_proxy):
        self.node = node_proxy.get()

        left, right = self.operand_attrs
        HBox.__init__(self, List([
            NormalWidgetMaker.make(getattr(self.node, left)),
            make_label(style.operator, ' ' + self.op_string + ' '),
            NormalWidgetMaker.make(getattr(self.node, right)),
        ]))
        self.is_centered = True
    def __init__(self, define_proxy):
        self.define = define_proxy.get()

        HBox.__init__(self, List([
            make_label(style.define, '#define'),
            make_label(style.space, ' '),
            TextEdit(style.define_value, partial(loop.namer.get_name, self.define)),
            make_label(style.space, ' '),
            NormalWidgetMaker.make(self.define.expr),
        ]), relay_focus=True)
Beispiel #7
0
    def _make(cls, type_proxy, variable_proxy, type_, variable):
        basetype_widget = IdentifierWidget(ccode.find_basetype(type_proxy), style.base_type)

        type_widget = HBox(List([
            basetype_widget,
            make_label(style.space, ' '),
            PostTypeWidgetMaker.make(type_proxy, variable_proxy),
        ]))
        type_widget.is_centered = True
        return type_widget
    def __init__(self, _type_proxy, variable_proxy):
        self.type = _type_proxy.get()

        HBox.__init__(self, List([
            make_label(style.paren, '('),
            PostTypeWidgetMaker.make(self.type.element_type, variable_proxy),
            make_label(style.bracket, '['),
            NormalWidgetMaker.make(self.type.size),
            make_label(style.bracket, ']'),
            make_label(style.paren, ')'),
        ]))
        self.is_centered = True
Beispiel #9
0
    def __init__(self, call_proxy):
        self.call = call_proxy.get()

        comma = make_label(style.comma, ', ')
        args_box = HBox(CacheMap(NormalWidgetMaker.make, self.call.args), relay_focus=True)
        args_box.padding_widget = comma
        HBox.__init__(self, List([
            NormalWidgetMaker.make(self.call.func),
            make_label(style.paren, "("),
            args_box,
            make_label(style.paren, ")"),
        ]))
Beispiel #10
0
    def __init__(self, return_proxy):
        self.return_ = return_proxy.get()

        HBox.__init__(
            self,
            List(
                [
                    make_label(style.return_, "return "),
                    NormalWidgetMaker.make(self.return_.expr),
                    make_label(style.semicolon, ";"),
                ]
            ),
        )
    def __init__(self, function_type_proxy, variable_proxy):
        self.function_type = function_type_proxy.get()

        comma = make_label(style.comma, ', ')
        
        self.parameters_widget = HBox(CacheMap(DeclarationWidgetMaker.make,
                                               self.function_type.parameters))
        self.parameters_widget.padding_widget = comma
        self.parameters_widget.is_centered = True

        HBox.__init__(self, List([
            PostTypeWidgetMaker.make(self.function_type.return_type, variable_proxy),
            make_label(style.paren, '('),
            self.parameters_widget,
            make_label(style.paren, ')'),
        ]))
Beispiel #12
0
    def __init__(self, node_proxy):
        self.node_proxy = node_proxy
        self.node = node_proxy.get()

        cond_part = HBox(List([
            make_label(style.while_, 'while'),
            make_label(style.paren, '('),
            NormalWidgetMaker.make(self.node.expr),
            make_label(style.paren, ')'),
        ]), relay_focus=True)
        cond_part.is_centered = True

        VBox.__init__(self, List([
            cond_part,
            NormalWidgetMaker.make(self.node.block),
        ]))

        self.focus_keymap.register_key(
            self.convert_to_if_key,
            Keymap.keydown_noarg(self._convert_to_if)
        )
Beispiel #13
0
def indented(widget):
    from gui.SpacerWidget import SpacerWidget
    box = HBox(List([SpacerWidget((style.indent_width, 0)), widget]), relay_focus=True)
    box.is_centered = True
    box.frame_color = None
    return box