def render(self) -> ui.components:
        v = self.variable

        if v.reference == 0:
            return [
                ui.Label(v.name, padding_left=0.5, padding_right=1),
                ui.Label(v.value, color='secondary'),
            ]

        if self.expanded:
            inner = []  #type: List[ui.Component]
            for variable in self.variables:
                inner.append(VariableComponent(variable))
            table = ui.Table(items=inner)
            table.add_class('inset')
            items = [
                ui.Button(self.toggle, items=[ui.Img(ui.Images.shared.down)]),
                ui.Label(v.name, padding_right=1),
                ui.Label(v.value, color='secondary'), table
            ]
            return items
        else:
            return [
                ui.Button(self.toggle, items=[ui.Img(ui.Images.shared.right)]),
                ui.Label(v.name, padding_right=1),
                ui.Label(v.value, color='secondary'),
            ]
Beispiel #2
0
    def render(self) -> ui.Block.Children:
        items = []  #type: List[ui.TableItem]
        for filter in self.breakpoints.filters:

            def on_click(filter=filter):
                self.breakpoints.toggle_filter(filter)  #type: ignore

            items.append(
                ui.block(
                    ui.Button(on_click=on_click,
                              items=[
                                  ui.Img((ui.Images.shared.dot,
                                          ui.Images.shared.dot_disabled
                                          )[not filter.enabled]),
                              ]),
                    ui.Label(filter.name,
                             color='secondary',
                             padding_left=0.25,
                             width=15,
                             align=0)))
        for breakpoint in self.breakpoints.breakpoints:
            base, name = os.path.split(breakpoint.file)

            if breakpoint == self.breakpoints.selected_breakpoint:
                color = 'primary'
            else:
                color = 'secondary'

            def on_toggle(bp=breakpoint):
                return self.on_toggle(bp)  #type: ignore

            def on_click(bp=breakpoint):
                return self.onClicked(bp)  #type: ignore

            toggle_button = ui.Button(on_click=on_toggle,
                                      items=[
                                          ui.Img(breakpoint.image()),
                                      ])
            fileAndLine = ui.Button(
                on_click=on_click,
                items=[
                    # line number
                    ui.Padding(ui.Box(
                        ui.Label(str(breakpoint.line), color=color, width=3)),
                               left=0.5,
                               right=0.5),
                    # filename
                    ui.Label(name,
                             color=color,
                             padding_left=0.25,
                             width=15,
                             align=0),
                ])
            items.append(
                ui.Padding(ui.block(toggle_button, fileAndLine),
                           top=0.1,
                           bottom=0.1))
        return [ui.Table(items)]
Beispiel #3
0
    def __init__(self) -> None:
        super().__init__()
        self.timer = ui.Timer(0.3, self.on_timer)
        self.tick = 0
        self.images = []  #type: List[ui.Component]

        image = ui.Image.named('dot0.png')
        self.images.append(ui.Img(image))

        image = ui.Image.named('dot3.png')
        self.images.append(ui.Img(image))
        self.images.append(ui.Img(image))
    def __init__(self) -> None:
        super().__init__()
        self.timer = None  #type: Optional[ui.Timer]
        self.tick = 0
        self.images = []  #type: List[ui.Img]

        image = ui.Image.named('dot0.png')
        self.images.append(ui.Img(image))

        image = ui.Image.named('dot3.png')
        self.images.append(ui.Img(image))
        self.images.append(ui.Img(image))
Beispiel #5
0
    def render(self) -> ui.components:
        if self.thread.stopped:
            items = [
                ui.Button(
                    self.toggle,
                    items=[
                        ui.Img((ui.Images.shared.right,
                                ui.Images.shared.down)[self.thread.expanded]),
                    ]),
                ui.Button(self.on_select_thread,
                          items=[
                              ui.Box(items=[
                                  ui.Label("", padding_left=0.8),
                                  ui.Img(ui.Images.shared.thread),
                                  ui.Label("", padding_left=0.8),
                              ]),
                              ui.Label(self.thread.name, padding_left=0.8),
                          ])
            ]  #type: List[ui.Component]
        else:
            items = [
                ui.Button(self.on_select_thread,
                          items=[
                              ui.Img(ui.Images.shared.thread_running),
                              ui.Box(items=[
                                  ui.Label("", padding_left=0.8),
                                  ui.Img(ui.Images.shared.thread),
                                  ui.Label("", padding_left=0.8),
                              ]),
                              ui.Label(self.thread.name,
                                       padding_left=0.8,
                                       padding_right=0.8),
                              ui.Label('running', color="secondary"),
                          ]),
            ]

        if self.thread.expanded and self.thread.stopped:
            frames = []  #type: List[ui.Component]
            selected_index = -1
            for index, frame in enumerate(self.frames):
                on_click = lambda index=index: self.onClicked(index
                                                              )  #type: ignore
                component = StackFrameComponent(self.debugger, frame, on_click)
                if self.debugger.selected_frame and frame.id == self.debugger.selected_frame.id:
                    selected_index = index

                frames.append(component)

            table = ui.Table(items=frames, selected_index=selected_index)
            items.append(table)

        return items
    def render(self) -> ui.components:
        items = []  #type: List[ui.TableItem]
        for breakpoint in self.breakpoints.breakpoints:
            base, name = os.path.split(breakpoint.file)

            if breakpoint == self.breakpoints.selected_breakpoint:
                color = 'primary'
            else:
                color = 'secondary'

            on_toggle = lambda bp=breakpoint: self.on_toggle(bp)  #type: ignore
            on_click = lambda bp=breakpoint: self.onClicked(bp)  #type: ignore

            toggle_button = ui.Button(on_click=on_toggle,
                                      items=[
                                          ui.Img(breakpoint.image()),
                                      ])
            fileAndLine = ui.Button(
                on_click=on_click,
                items=[
                    # filename
                    ui.Label(name,
                             color=color,
                             padding_left=0.25,
                             width=15,
                             align=0),
                    # line number
                    ui.Box(items=[
                        ui.Label(str(breakpoint.line), color=color, width=3),
                    ]),
                ])
            items.append(ui.TableItem(items=[toggle_button, fileAndLine]))
        return [ui.Table(table_items=items)]
    def render(self) -> ui.Block.Children:
        v = self.variable
        name = v.name
        value = v.value

        if self.syntax_highlight:
            value_item = ui.CodeBlock(value)
        else:
            value_item = ui.Label(value)

        if not self.variable.expandable:
            return [
                ui.block(
                    ui.ButtonDoubleClick(self.on_edit, None, [
                        ui.Label(name, padding_left=0.5, padding_right=1),
                        value_item
                    ]))
            ]

        if self.variable.expanded:
            image = ui.Img(ui.Images.shared.down)
        else:
            image = ui.Img(ui.Images.shared.right)

        items = [
            ui.block(
                ui.Button(self.variable.toggle_expand, [image]),
                ui.ButtonDoubleClick(self.on_edit, None, [
                    ui.Label(name, padding_right=1),
                    value_item,
                ]))
        ]  #type: List[ui.Block]

        if self.variable.expanded:
            inner = []  #type: List[ui.Block]
            syntax_highlight = len(self.variable.variables) < 100
            for variable in self.variable.variables:
                inner.append(VariableComponent(variable, syntax_highlight))
            table = ui.Table(items=inner)
            table.add_class('inset')
            items.append(table)

        return items
    def render(self) -> ui.Block.Children:
        if self.scope.expanded:
            image = ui.Img(ui.Images.shared.down)
        else:
            image = ui.Img(ui.Images.shared.right)

        scope_item = ui.block(
            ui.Button(self.scope.toggle_expand, items=[image]),
            ui.Label(self.scope.name, padding_left=0.5, padding_right=1),
        )

        if self.scope.expanded:
            variables = []  #type: List[ui.Block]
            syntax_highlight = len(self.scope.variables) < 100
            for variable in self.scope.variables:
                variables.append(VariableComponent(variable, syntax_highlight))
            table = ui.Table(items=variables)
            table.add_class('inset')
            return [scope_item, table]

        return [scope_item]
Beispiel #9
0
	def add_selected_stack_frame_component(self, view: sublime.View, line: int) -> None:
		if self.selectedFrameComponent:
			self.selectedFrameComponent.dispose()
			self.selectedFrameComponent = None

		if not self.debugAdapterClient:
			return
		if not self.debugAdapterClient.selected_frame:
			return

		pt = view.text_point(line + 1, 0)

		max = view.viewport_extent()[0]/view.em_width() - 3

		pt_current_line = view.text_point(line, 0)
		line_current = view.line(pt_current_line)
		region =  sublime.Region(pt-1, pt-1)

		layout = sublime.LAYOUT_INLINE
		if line_current.b - line_current.a > max:
			pt = view.text_point(line - 1, 0)
			region =  sublime.Region(pt, pt)
			layout = sublime.LAYOUT_BELOW

		variables = ui.Segment(items = [
			ui.Button(self.OnResume, items = [
				ui.Img(ui.Images.shared.play)
			]),
			ui.Button(self.OnStepOver, items = [
				ui.Img(ui.Images.shared.down)
			]),
			ui.Button(self.OnStepOut, items = [
				ui.Img(ui.Images.shared.left)
			]),
			ui.Button(self.OnStepIn, items = [
				ui.Img(ui.Images.shared.right)
			]),
			ui.Label(self.stopped_reason, padding_left = 1,  padding_right = 1, color = 'secondary')
		])
		self.selectedFrameComponent = ui.Phantom(variables, view, region, layout)
Beispiel #10
0
    def render(self) -> ui.Block.Children:
        count = int(self.layout.height() / 1.65)
        items = []

        for item in reversed(self.items):
            if len(items) >= count:
                break
            if item.kind & self.filter:
                items.append(item)
        items.reverse()
        items.append(
            ui.Button(self.on_click, items=[
                ui.Img(ui.Images.shared.right),
            ]))
        return [ui.Table(items=items)]
    def render(self) -> ui.components:
        items = []  #type: List[ui.TableItem]
        for filter in self.breakpoints.filters:
            on_click = lambda filter=filter: self.onClicked(filter
                                                            )  #type: ignore

            items.append(
                ui.TableItem(items=[
                    ui.Button(on_click=on_click,
                              items=[
                                  ui.Img((ui.Images.shared.dot,
                                          ui.Images.shared.dot_disabled
                                          )[not filter.enabled]),
                              ]),
                    ui.Label(filter.name,
                             color='secondary',
                             padding_left=0.25,
                             width=15,
                             align=0)
                ]))
        return [ui.Table(table_items=items)]
    def render(self) -> ui.components:
        buttons = []  #type: List[ui.Component]
        if self.state == RUNNING:
            buttons = [
                ui.Label("Running", width=6),
                ui.Button(self.listener.OnSettings,
                          items=[ui.Img(ui.Images.shared.settings)]),
                ui.Button(self.listener.OnStop,
                          items=[ui.Img(ui.Images.shared.stop)]),
                ui.Button(self.listener.OnPause,
                          items=[ui.Img(ui.Images.shared.pause)]),
            ]
        if self.state == PAUSED:
            buttons = [
                ui.Label("Paused", width=6),
                ui.Button(self.listener.OnSettings,
                          items=[ui.Img(ui.Images.shared.settings)]),
                ui.Button(self.listener.OnStop,
                          items=[ui.Img(ui.Images.shared.stop)]),
                ui.Button(self.listener.OnResume,
                          items=[ui.Img(ui.Images.shared.play)]),
                ui.Button(self.listener.OnStepOver,
                          items=[ui.Img(ui.Images.shared.down)]),
                ui.Button(self.listener.OnStepOut,
                          items=[ui.Img(ui.Images.shared.left)]),
                ui.Button(self.listener.OnStepIn,
                          items=[ui.Img(ui.Images.shared.right)]),
            ]
        if self.state == STOPPED:
            buttons = [
                ui.Label(self.name, width=6),
                ui.Button(self.listener.OnSettings,
                          items=[ui.Img(ui.Images.shared.settings)]),
                ui.Button(self.listener.OnPlay,
                          items=[ui.Img(ui.Images.shared.play)]),
            ]
        if self.state == LOADING:
            buttons = [
                ui.Label(self.name, width=6),
                ui.Button(self.listener.OnSettings,
                          items=[ui.Img(ui.Images.shared.settings)]),
                ui.Button(self.listener.OnStop,
                          items=[ui.Img(ui.Images.shared.stop)]),
                LoadingComponent()
            ]

        return [
            ui.Panel(items=[
                ui.Segment(items=buttons),
                FiltersComponent(self.breakpoints),
                BreakpintsComponent(self.breakpoints,
                                    self.listener.OnExpandBreakpoint),
            ]),
        ]
Beispiel #13
0
    def render(self) -> ui.Block.Children:
        max_length = callstack_panel_width(self.layout) - 5
        if self.thread.stopped:
            item = ui.block(
                ui.Button(
                    self.toggle,
                    items=[
                        ui.Img((ui.Images.shared.right,
                                ui.Images.shared.down)[self.thread.expanded]),
                    ]),
                ui.Button(self.on_select_thread,
                          items=[
                              ui.Box(
                                  ui.Padding(ui.Img(ui.Images.shared.thread),
                                             left=0.8,
                                             right=0.8)),
                              ui.Label(self.thread.name,
                                       padding_left=0.8,
                                       width=max_length,
                                       align=0),
                          ]))
        else:
            item = ui.block(
                ui.Button(self.on_select_thread,
                          items=[
                              ui.Img(ui.Images.shared.thread_running),
                              ui.Box(
                                  ui.Label("", padding_left=0.8),
                                  ui.Img(ui.Images.shared.thread),
                                  ui.Label("", padding_left=0.8),
                              ),
                              ui.Label(self.thread.name,
                                       padding_left=0.8,
                                       width=max_length,
                                       align=0),
                          ]), )

        item = ui.Padding(item, top=0.1, bottom=0.1)
        items = [item]  #type: List[ui.Block]

        if self.thread.expanded and self.thread.stopped:
            frames = []  #type: List[ui.Block]
            selected_index = -1
            if self.panel.selected_thread == self.thread and self.panel.has_selection_frame(
            ):
                selected_index = self.panel.selected_frame_index

            for index, frame in enumerate(self.frames):

                def on_click(index=index):
                    self.onClicked(index)

                component = ui.Padding(StackFrameComponent(
                    self.debugger, frame, on_click),
                                       top=0.1,
                                       bottom=0.2)
                frames.append(component)

            table = ui.Table(items=frames, selected_index=selected_index)
            items.append(table)

        if self.panel.selected_thread == self.thread and not self.panel.has_selection_frame(
        ):
            item.add_class('selected_stack_frame')

        return items
Beispiel #14
0
    def render(self) -> ui.Block.Children:
        buttons = []  #type: List[ui.Block]

        play = False
        stop = False
        pause = False
        controls = False

        if self.state == RUNNING:
            stop = True
            play = True
            pause = True
            controls = True

        if self.state == PAUSED:
            stop = True
            play = True
            pause = False
            controls = True

        if self.state == STOPPED:
            stop = False
            play = True
            controls = False

        if self.state == LOADING:
            stop = True
            play = True
            controls = False

        items = []

        if play:
            items.append(
                DebuggerItem(self.callbacks.on_play,
                             ui.Img(ui.Images.shared.play)))
        else:
            items.append(
                DebuggerItem(self.callbacks.on_play,
                             ui.Img(ui.Images.shared.play)))
        if stop:
            items.append(
                DebuggerItem(self.callbacks.on_stop,
                             ui.Img(ui.Images.shared.stop)))
        else:
            items.append(
                DebuggerItem(self.callbacks.on_stop,
                             ui.Img(ui.Images.shared.stop_disable)))

        if not controls:
            items.append(
                DebuggerItem(self.callbacks.on_pause,
                             ui.Img(ui.Images.shared.pause_disable)))
        elif pause:
            items.append(
                DebuggerItem(self.callbacks.on_pause,
                             ui.Img(ui.Images.shared.pause)))
        else:
            items.append(
                DebuggerItem(self.callbacks.on_resume,
                             ui.Img(ui.Images.shared.resume)))

        if controls:
            items.extend([
                DebuggerItem(self.callbacks.on_step_over,
                             ui.Img(ui.Images.shared.down)),
                DebuggerItem(self.callbacks.on_step_out,
                             ui.Img(ui.Images.shared.left)),
                DebuggerItem(self.callbacks.on_step_in,
                             ui.Img(ui.Images.shared.right)),
            ])
        else:
            items.extend([
                DebuggerItem(self.callbacks.on_step_over,
                             ui.Img(ui.Images.shared.down_disable)),
                DebuggerItem(self.callbacks.on_step_out,
                             ui.Img(ui.Images.shared.left_disable)),
                DebuggerItem(self.callbacks.on_step_in,
                             ui.Img(ui.Images.shared.right_disable)),
            ])

        items_new = []
        for item in items:
            items_new.append(ui.Padding(item, bottom=0.2))
        return [
            ui.Panel(items=items_new),
        ]
Beispiel #15
0
	def render(self) -> ui.Block.Children:
		return [
			ui.block(ui.Label("  "), ui.Img(ui.Images.shared.right))
		]