Пример #1
0
def startup_message(app, progress, kwargs):
    table = rtable.Table(title="Settings")
    table.add_column("Setting", style="red", no_wrap=True)
    table.add_column("Value", style="blue", no_wrap=True)

    table.add_row("Version", __version__)
    table.add_row("Host", kwargs["host"])
    table.add_row("Webserver port", str(kwargs["port"]))
    table.add_row("RPC Port", str(app.rpcport))
    table.add_row("Update interval", str(app.interval))
    table.add_row("Environment",
                  "Development" if kwargs["dev"] else "Production")
    table.add_row("Logging level", "Debug" if kwargs["debug"] else "Warning")

    progress.print(rule.Rule("Red Discord Bot Dashboard - Webserver"))
    disclaimer = "This is an instance of Red Discord Bot Dashboard,\ncreated by Neuro Assassin. This package is\nprotected under the MIT License. Any action\nthat will breach this license (including but not\nlimited to, removal of credits) may result in a\nDMCA takedown request, or other legal\nconsequences.\n\n\nYou can view the license at\nhttps://github.com/Cog-Creators/\nRed-Dashboard/blob/master/LICENSE."

    vartask = progress.add_task("Update variable task:",
                                status="[bold blue]Starting[/bold blue]")
    cmdtask = progress.add_task("Update command task:",
                                status="[bold blue]Starting[/bold blue]")
    vertask = progress.add_task("Update version task:",
                                status="[bold blue]Starting[/bold blue]")
    contask = progress.add_task("RPC Connected",
                                status="[bold blue]Starting[/bold blue]")

    progress.print(
        columns.Columns(
            [panel.Panel(table), panel.Panel(disclaimer)], equal=True))
    return {"var": vartask, "cmd": cmdtask, "ver": vertask, "con": contask}
Пример #2
0
 def __rich_console__(self, console, options):
     yield panel.Panel("[red]{}[/red] - {}".format(
         self.issue.jira_issue.key, self.issue.jira_issue.fields.summary),
                       border_style="yellow")
     yield "[cyan]Assignee[/cyan] {}".format(
         self.issue.jira_issue.fields.assignee)
     yield "[cyan]Reporter[/cyan] {}".format(
         self.issue.jira_issue.fields.reporter)
     yield "[cyan]Status[/cyan] {}".format(
         self.issue.jira_issue.fields.status)
     yield "[cyan]Created[/cyan] {} / [cyan]Updated[/cyan] {}" \
         .format(self.issue.jira_issue.fields.created, self.issue.jira_issue.fields.updated)
     yield "[cyan]Fix version[/cyan] {}" \
         .format(", ".join([v.name for v in self.issue.jira_issue.fields.fixVersions]))
     yield panel.Panel(format_html(
         self.issue.jira_issue.fields.description))
     if self.issue.jira_issue.fields.comment.comments:
         yield panel.Panel("Comments", border_style="yellow")
     for comment in self.issue.jira_issue.fields.comment.comments:
         if "SCM" in comment.author.name:
             try:
                 commit = Commit.from_description(comment.body)
             except Commit.DescriptionIsCorrupted as e:
                 yield "[cyan]Author[/cyan] {}".format(comment.author)
                 yield "[cyan]Created[/cyan] {}".format(comment.created)
                 yield panel.Panel(format_html(comment.body))
             else:
                 commit.date = comment.created
                 yield from CommitDisplayer(commit).__rich_console__(
                     console, options)
         else:
             yield "[cyan]Author[/cyan] {}".format(comment.author)
             yield "[cyan]Created[/cyan] {}".format(comment.created)
             yield panel.Panel(format_html(comment.body))
Пример #3
0
 def __rich_console__(self, console, options):
     yield "[cyan]Author[/cyan] {}".format(self.commit.author)
     if self.commit.date is not None:
         yield "[cyan]Date[/cyan] {}".format(self.commit.date)
     yield "[cyan]Revision[/cyan] {}".format(self.commit.revision)
     md = "".join(["* {}\n".format(f) for f in self.commit.files])
     yield panel.Panel(markdown.Markdown(md))
Пример #4
0
 def renderable(self) -> r_console.RenderableType:
     _progress = self.progress.renderable
     _status = r_panel.Panel(self.status.renderable, box=r_box.HORIZONTALS)
     _group = r_console.Group(
         _progress, _status
     )
     if self.title is None:
         return _group
     else:
         return r_panel.Panel(
             _group,
             title=self.title,
             border_style="green",
             # padding=(2, 2),
             expand=True,
             box=r_box.ASCII,
         )
Пример #5
0
 def renderable(self) -> r_console.RenderableType:
     if self.title is None:
         return self._progress
     else:
         return r_panel.Panel(
             self._progress, title=self.title,
             border_style="green",
             # padding=(2, 2),
             expand=True,
             box=r_box.ASCII,
         )
Пример #6
0
 def print(self, *args, **kwargs):
     if kwargs and "text" in list(kwargs) and "menu" in list(kwargs):
         if not os.getenv("TEST_MODE"):
             if gtff.ENABLE_RICH_PANEL:
                 self.console.print(
                     panel.Panel(
                         kwargs["text"],
                         title=kwargs["menu"],
                         subtitle_align="right",
                         subtitle="Gamestonk Terminal",
                     ))
             else:
                 self.console.print(kwargs["text"])
         else:
             print(self.filter_rich_tags(kwargs["text"]))
     else:
         if not os.getenv("TEST_MODE"):
             self.console.print(*args, **kwargs)
         else:
             print(*args, **kwargs)
Пример #7
0
    def renderable(self) -> r_console.RenderableType:
        # get spinner
        _ret = self._spinner

        # overall progress
        if self.overall_progress_iterable is not None:
            _ret = r_console.Group(
                self._overall_progress.renderable, _ret,
            )

        # add title
        if self.title is None:
            return _ret
        else:
            return r_panel.Panel(
                _ret, title=self.title,
                border_style="green",
                # padding=(2, 2),
                expand=True,
                box=self.box_type,
            )