Clean up main.py and move code to __main__.py and utils/main.py.
fix gui/portable for pull request #903
Some changes in __main__.py and utils.main and other.

Reinsert --no-browser option.

Move some code to utils.main.

Some other small style changes.

Fix merge conflict misstakes.

Change settings behavior. Add tests.

Fix rebase problems.