Esempio n. 1
0
	def render(self) -> ui.Block.Children:
		count = self.breakpoint.count or ''
		condition = self.breakpoint.condition or ''
		log = self.breakpoint.log or ''
		return [
			ui.Table([
				ui.block(
					ui.Box(ui.Label('expr', width=6)),
					ui.Input(on_done=self.on_enter_expression, hint='Breaks when expression is true', text=condition, width=50),
				),
				ui.block(
					ui.Box(ui.Label('log', width=6)),
					ui.Input(on_done=self.on_enter_log, hint='Message to log, expressions within {} are interpolated', text=log, width=50),
				),
				ui.block(
					ui.Box(ui.Label('count', width=6)),
					ui.Input(on_done=self.on_enter_count, hint='Break when hit count condition is met', text=count, width=50),
				),
				ui.block(
					ui.Box(ui.Button(self.on_remove, items=[
						ui.Label('Remove', width=6),
					])),
				),
			])
		]
Esempio n. 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)]
Esempio n. 3
0
 def render(self) -> ui.Block.Children:
     return [
         ui.block(
             ui.Padding(ui.Button(self.callback, items=[self.image]),
                        left=0.6,
                        right=0.6))
     ]
Esempio n. 4
0
    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
Esempio n. 5
0
 def render(self) -> ui.Block.Children:
     width = console_panel_width(self.layout)
     if self.variable:
         return [VariableComponent(self.variable)]
     if self.kind == TEXT:
         return [
             ui.block(
                 ui.Label(self.text,
                          width=width,
                          align=0,
                          color='secondary'))
         ]
     if (self.kind == OUTPUT) or (self.kind == NONE):
         return [
             ui.block(
                 ui.Label(self.text, width=width, align=0, color='primary'))
         ]
     if self.kind == ERROR:
         return [
             ui.block(ui.Label(self.text, width=width, align=0,
                               color='red'))
         ]
     assert None, "expected type..."
Esempio n. 6
0
    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]
Esempio n. 7
0
    def render(self) -> ui.Block.Children:
        frame = self.frame
        name = os.path.basename(frame.file)
        if frame.presentation == StackFrame.subtle:
            color = "secondary"
        else:
            color = "primary"

        assert self.layout
        emWidth = self.layout.em_width()
        padding_left = 0.8
        padding_right = 0.8
        max_length = callstack_panel_width(
            self.layout) - padding_left - padding_right - 5
        name_length = len(name) * emWidth

        if name_length > max_length:
            name_length = max_length

        max_length -= name_length
        frame_length = max_length

        fileAndLine = ui.Button(on_click=self.on_click,
                                items=[
                                    ui.Box(
                                        ui.Label(str(frame.line),
                                                 width=3,
                                                 color=color), ),
                                    ui.Label(name,
                                             width=name_length,
                                             padding_left=padding_left,
                                             padding_right=padding_right,
                                             color=color,
                                             align=0),
                                    ui.Label(frame.name,
                                             width=frame_length,
                                             color="secondary",
                                             align=0),
                                ])
        return [ui.block(fileAndLine)]
Esempio n. 8
0
 def render(self) -> ui.Block.Children:
     return [ui.Padding(ui.block(ui.Label(self.text)), left=1, top=-0.125)]
Esempio n. 9
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
Esempio n. 10
0
	def render(self) -> ui.Block.Children:
		return [
			ui.block(ui.Label("  "), ui.Img(ui.Images.shared.right))
		]