Added guide on first run

This commit is contained in:
Mark Qvist 2021-09-11 12:21:35 +02:00
parent b49f9e7175
commit 70910ae475
4 changed files with 58 additions and 36 deletions

View File

@ -56,6 +56,8 @@ class NomadNetworkApp:
self.downloads_path = os.path.expanduser("~/Downloads")
self.firstrun = False
if not os.path.isdir(self.storagepath):
os.makedirs(self.storagepath)
@ -91,7 +93,7 @@ class NomadNetworkApp:
else:
RNS.log("Could not load config file, creating default configuration file...")
self.createDefaultConfig()
self.firstrun = True
if os.path.isfile(self.identitypath):
try:
@ -129,7 +131,7 @@ class NomadNetworkApp:
try:
RNS.log("No peer settings file found, creating new...")
self.peer_settings = {
"display_name": "",
"display_name": "Anonymous Peer",
"announce_interval": None,
"last_announce": None,
}
@ -408,15 +410,15 @@ intro_time = 1
# valid colormodes are:
# monochrome, 16, 88, 256 and 24bit
#
# The default is a conservative 16 colors,
# but 256 colors can probably be used on
# most terminals. Some terminals support
# The default is a conservative 256 colors.
# If your terminal does not support this,
# you can lower it. Some terminals support
# 24 bit color.
# colormode = monochrome
colormode = 16
# colormode = 16
# colormode = 88
# colormode = 256
colormode = 256
# colormode = 24bit
# By default, unicode glyphs are used. If

View File

@ -18,22 +18,22 @@ THEMES = {
THEME_DARK: {
"urwid_theme": [
# Style name # 16-color style # Monochrome style # 88, 256 and true-color style
('heading', 'light gray,underline', 'default', 'underline', 'g93,underline', 'default'),
('menubar', 'black', 'light gray', 'standout', '#111', '#bbb'),
('scrollbar', 'light gray', 'default', 'standout', '#444', 'default'),
('shortcutbar', 'black', 'light gray', 'standout', '#111', '#bbb'),
('body_text', 'white', 'default', 'default', '#ddd', 'default'),
('error_text', 'dark red', 'default', 'default', 'dark red', 'default'),
('warning_text', 'yellow', 'default', 'default', '#ba4', 'default'),
('inactive_text', 'dark gray', 'default', 'default', 'dark gray', 'default'),
('buttons', 'light green,bold', 'default', 'default', '#00a533', 'default'),
('msg_editor', 'black', 'light cyan', 'standout', '#111', '#0bb'),
("msg_header_ok", 'black', 'light green', 'standout', '#111', '#6b2'),
("msg_header_caution", 'black', 'yellow', 'standout', '#111', '#fd3'),
("msg_header_sent", 'black', 'light gray', 'standout', '#111', '#ddd'),
("msg_header_delivered", 'black', 'light blue', 'standout', '#111', '#28b'),
("msg_header_failed", 'black', 'dark gray', 'standout', '#000', "#777"),
("msg_warning_untrusted", 'black', 'dark red', 'standout', '#111', 'dark red'),
("heading", "light gray,underline", "default", "underline", "g93,underline", "default"),
("menubar", "black", "light gray", "standout", "#111", "#bbb"),
("scrollbar", "light gray", "default", "standout", "#444", "default"),
("shortcutbar", "black", "light gray", "standout", "#111", "#bbb"),
("body_text", "white", "default", "default", "#ddd", "default"),
("error_text", "dark red", "default", "default", "dark red", "default"),
("warning_text", "yellow", "default", "default", "#ba4", "default"),
("inactive_text", "dark gray", "default", "default", "dark gray", "default"),
("buttons", "light green,bold", "default", "default", "#00a533", "default"),
("msg_editor", "black", "light cyan", "standout", "#111", "#0bb"),
("msg_header_ok", "black", "light green", "standout", "#111", "#6b2"),
("msg_header_caution", "black", "yellow", "standout", "#111", "#fd3"),
("msg_header_sent", "black", "light gray", "standout", "#111", "#ddd"),
("msg_header_delivered", "black", "light blue", "standout", "#111", "#28b"),
("msg_header_failed", "black", "dark gray", "standout", "#000", "#777"),
("msg_warning_untrusted", "black", "dark red", "standout", "#111", "dark red"),
("list_focus", "black", "light gray", "standout", "#111", "#aaa"),
("list_off_focus", "black", "dark gray", "standout", "#111", "#777"),
("list_trusted", "dark green", "default", "default", "#6b2", "default"),
@ -43,7 +43,7 @@ THEMES = {
("list_untrusted", "dark red", "default", "default", "#a22", "default"),
("list_focus_untrusted", "black", "light gray", "standout", "#810", "#aaa"),
("topic_list_normal", "white", "default", "default", "#ddd", "default"),
('browser_controls', "light gray", 'default', 'default', '#bbb', 'default'),
("browser_controls", "light gray", "default", "default", "#bbb", "default"),
("progress_full", "black", "light gray", "standout", "#111", "#bbb"),
("progress_empty", "light gray", "default", "default", "#ddd", "default"),
],

View File

@ -61,14 +61,16 @@ class SelectText(urwid.Text):
return True
class GuideEntry(urwid.WidgetWrap):
def __init__(self, app, reader, topic_name):
def __init__(self, app, parent, reader, topic_name):
self.app = app
self.parent = parent
self.reader = reader
self.last_keypress = None
self.topic_name = topic_name
g = self.app.ui.glyphs
widget = ListEntry(topic_name)
urwid.connect_signal(widget, "click", self.display_topic, topic_name)
urwid.connect_signal(widget, "click", self.display_topic, self.topic_name)
style = "topic_list_normal"
focus_style = "list_focus"
@ -81,6 +83,17 @@ class GuideEntry(urwid.WidgetWrap):
self.reader.set_content_widgets(attrmaps)
topic_position = None
index = 0
for topic in self.parent.topic_list:
widget = topic._original_widget
if widget.topic_name == self.topic_name:
topic_position = index
index += 1
if topic_position != None:
self.parent.ilb.select_item(topic_position)
def micron_released_focus(self):
self.reader.focus_topics()
@ -89,12 +102,14 @@ class TopicList(urwid.WidgetWrap):
self.app = app
g = self.app.ui.glyphs
self.first_run_entry = GuideEntry(self.app, self, guide_display, "First Run")
self.topic_list = [
GuideEntry(self.app, guide_display, "Introduction"),
# GuideEntry(self.app, guide_display, "Conversations"),
GuideEntry(self.app, guide_display, "Markup"),
GuideEntry(self.app, guide_display, "First Run"),
GuideEntry(self.app, guide_display, "Credits & Licenses"),
GuideEntry(self.app, self, guide_display, "Introduction"),
# GuideEntry(self.app, self, guide_display, "Conversations"),
GuideEntry(self.app, self, guide_display, "Markup"),
self.first_run_entry,
GuideEntry(self.app, self, guide_display, "Credits & Licenses"),
]
self.ilb = IndicativeListBox(
@ -135,6 +150,10 @@ class GuideDisplay():
self.shortcuts_display = GuideDisplayShortcuts(self.app)
self.widget = self.columns
if self.app.firstrun:
entry = self.left_area.first_run_entry
entry.display_topic(entry.display_topic, entry.topic_name)
def set_content_widgets(self, new_content):
options = self.columns.options(width_type="weight", width_amount=1-GuideDisplay.list_width)
pile = urwid.Pile(new_content)
@ -415,11 +434,9 @@ Hi there. This first run message will only appear once. It contains a few pointe
You're currently located in the guide section of the program. I'm sorry I had to drag you here by force, but it will only happen this one time, I promise. If you ever get lost, return here and peruse the list of topics you see on the left. I will do my best to fill it with answers to mostly anything about Nomad Network.
To get the most out of Nomad Network, you will need a terminal that supports UTF-8 and at least 256 colors, ideally true-color.
To get the most out of Nomad Network, you will need a terminal that supports UTF-8 and at least 256 colors, ideally true-color. If your terminal supports true-color, you can go to the `![ Config ]`! menu item, launch the editor and change the configuration.
By default, Nomad Network starts in low-color mode. It does this for the sake of compatibility, but it does look rather ugly. If your terminal supports true-color or just 256 colors, you should go to the `![ Config ]`! menu item, launch the editor and change the configuration to use a high-color mode.
If you don't already have a Nerd Font installed (see https://www.nerdfonts.com/), I also highly recommend to do so, since it will greatly expand the amount of glyphs, icons and graphics that Nomad Network can use.
If you don't already have a Nerd Font installed (see https://www.nerdfonts.com/), I also highly recommend to do so, since it will greatly expand the amount of glyphs, icons and graphics that Nomad Network can use. Once you have your terminal set up with a Nerd Font, go to the `![ Config ]`! menu item and enable Nerd Fonts in the configuration instead of normal unicode glyphs.
Nomad Network expects that you are already connected to some form of Reticulum network. That could be as simple as the default UDP-based demo interface on your local ethernet network. This short guide won't go into any details on building, but you will find other entries in the guide that deal with network setup and configuration.

View File

@ -21,7 +21,10 @@ class SubDisplays():
self.log_display = LogDisplay(self.app)
self.guide_display = GuideDisplay(self.app)
self.active_display = self.conversations_display
if app.firstrun:
self.active_display = self.guide_display
else:
self.active_display = self.conversations_display
def active(self):
return self.active_display