~nhanb/mcross

558d851534c1a3773ce7986a5fa1fa970f99354e — Bùi Thành Nhân 11 months ago 3e25052 0.5.12
move CLI parsing out of controller, bump 0.5.12
4 files changed, 24 insertions(+), 13 deletions(-)

M README.md
M pyproject.toml
M src/mcross/__init__.py
M src/mcross/gui/controller.py
M README.md => README.md +10 -0
@@ 29,6 29,16 @@ mcross
Better distribution methods to be explored later.
Maybe it's finally time to try nuitka?

# Usage

CLI arguments: `--textfont`, `--monofont`

Keyboard shortcuts:

- `Ctrl-l`: jump to address bar.
- Hold `Alt` to see possible button shortcuts underlined. This is what Qt calls
  [Accelerator Keys](https://doc.qt.io/qt-5/accelerators.html).


# Development


M pyproject.toml => pyproject.toml +1 -1
@@ 1,6 1,6 @@
[tool.poetry]
name = "mcross"
version = "0.5.11"
version = "0.5.12"
description = "Do you remember www?"
authors = ["nhanb <hi@imnhan.com>"]
license = "MIT"

M src/mcross/__init__.py => src/mcross/__init__.py +11 -1
@@ 1,6 1,16 @@
import argparse

from .gui.controller import Controller


def run():
    c = Controller()

    # Parse CLI arguments
    argparser = argparse.ArgumentParser()
    argparser.add_argument("--textfont")
    argparser.add_argument("--monofont")
    args = argparser.parse_args()

    # Actually start the program
    c = Controller(args)
    c.run()

M src/mcross/gui/controller.py => src/mcross/gui/controller.py +2 -11
@@ 2,7 2,6 @@ import logging
import threading
import time
import traceback
import argparse
from ssl import SSLCertVerificationError
from tkinter import READABLE, Tk, messagebox



@@ 20,21 19,13 @@ from .view import WAITING_CURSOR, View

statusbar_logger = logging.getLogger("statusbar")

argparser = argparse.ArgumentParser()
argparser.add_argument("--textfont")
argparser.add_argument("--monofont")
args = argparser.parse_args()

class Controller:
    def __init__(self):
    def __init__(self, args):
        self.root = Tk()
        self.root.alt_shortcuts = set()
        self.model = Model()
        self.view = View(
            self.root,
            self.model,
            fonts=(args.textfont, args.monofont)
        )
        self.view = View(self.root, self.model, fonts=(args.textfont, args.monofont))
        self.root.title("McRoss Browser")
        self.root.geometry("800x600")