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)]
Example #2
0
    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'),
            ]
Example #3
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),
					])),
				),
			])
		]
Example #4
0
 def render(self) -> ui.components:
     return [
         ui.Panel(items=[
             ui.Segment(items=[ui.Label('Event Log')]),
             ui.Table(items=self.lines)
         ])
     ]
Example #5
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)]
Example #6
0
    def render(self) -> ui.components:
        items = [ui.Segment(items=[ui.Label('Variables')])
                 ]  #type: List[ui.Component]

        variables = []  #type: List[ui.Component]
        for v in self.variables:
            variables.append(VariableComponent(v))
        items.append(ui.Table(items=variables))

        return [ui.Panel(items=items)]
Example #7
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
Example #8
0
	def render(self) -> ui.components:			
		self.thread_components = []
		for index, thread in enumerate(self.threads):
			assert self.debugger
			item = ThreadComponent(self.debugger, thread)
			self.thread_components.append(item)
		return [
			ui.Panel(items = [
				ui.Segment(items = [
					ui.Label('Call Stack')
				]),
				# FIXME?? Table should not take List
				ui.Table(items = self.thread_components) #type: ignore 
			])
		]
Example #9
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)]
Example #10
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
Example #11
0
    def render(self) -> ui.Block.Children:
        items = []  #type: List[ui.Block]

        scopes_items = []  #type: List[ui.Block]

        # expand the first scope only
        first = True
        for v in self.scopes:
            scopes_item = ScopeComponent(v)
            if first:
                first = False
                scopes_item.scope.toggle_expand()
            scopes_items.append(scopes_item)

        items.append(ui.Table(items=scopes_items))

        return [
            ui.HorizontalSpacer(variables_panel_width(self.layout)),
            ui.Panel(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)]
Example #13
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]
Example #14
0
 def render(self) -> ui.Block.Children:
     self.thread_components = []
     for thread in self.threads:
         item = ThreadComponent(self, thread)
         self.thread_components.append(item)
     return [ui.Table(items=self.thread_components)]
Example #15
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