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

View file

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

View file

@ -61,14 +61,16 @@ class SelectText(urwid.Text):
return True return True
class GuideEntry(urwid.WidgetWrap): class GuideEntry(urwid.WidgetWrap):
def __init__(self, app, reader, topic_name): def __init__(self, app, parent, reader, topic_name):
self.app = app self.app = app
self.parent = parent
self.reader = reader self.reader = reader
self.last_keypress = None self.last_keypress = None
self.topic_name = topic_name
g = self.app.ui.glyphs g = self.app.ui.glyphs
widget = ListEntry(topic_name) 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" style = "topic_list_normal"
focus_style = "list_focus" focus_style = "list_focus"
@ -81,6 +83,17 @@ class GuideEntry(urwid.WidgetWrap):
self.reader.set_content_widgets(attrmaps) 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): def micron_released_focus(self):
self.reader.focus_topics() self.reader.focus_topics()
@ -89,12 +102,14 @@ class TopicList(urwid.WidgetWrap):
self.app = app self.app = app
g = self.app.ui.glyphs g = self.app.ui.glyphs
self.first_run_entry = GuideEntry(self.app, self, guide_display, "First Run")
self.topic_list = [ self.topic_list = [
GuideEntry(self.app, guide_display, "Introduction"), GuideEntry(self.app, self, guide_display, "Introduction"),
# GuideEntry(self.app, guide_display, "Conversations"), # GuideEntry(self.app, self, guide_display, "Conversations"),
GuideEntry(self.app, guide_display, "Markup"), GuideEntry(self.app, self, guide_display, "Markup"),
GuideEntry(self.app, guide_display, "First Run"), self.first_run_entry,
GuideEntry(self.app, guide_display, "Credits & Licenses"), GuideEntry(self.app, self, guide_display, "Credits & Licenses"),
] ]
self.ilb = IndicativeListBox( self.ilb = IndicativeListBox(
@ -135,6 +150,10 @@ class GuideDisplay():
self.shortcuts_display = GuideDisplayShortcuts(self.app) self.shortcuts_display = GuideDisplayShortcuts(self.app)
self.widget = self.columns 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): def set_content_widgets(self, new_content):
options = self.columns.options(width_type="weight", width_amount=1-GuideDisplay.list_width) options = self.columns.options(width_type="weight", width_amount=1-GuideDisplay.list_width)
pile = urwid.Pile(new_content) 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. 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. 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.
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.
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. 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.log_display = LogDisplay(self.app)
self.guide_display = GuideDisplay(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): def active(self):
return self.active_display return self.active_display