Example #1
0
def test_last_opened_gives_path(clean_config):
    test_path = "test_path"
    conf = {"last_opened": test_path}
    Config.save_config(conf)

    last_opened = Config.last_opened()
    assert last_opened is not None
    assert str(last_opened) == test_path
Example #2
0
    def __init__(self):
        super().__init__()

        # Basic window construction
        self.setObjectName("MainWindow")
        self.resize(800, 600)

        self.mdi_areas = []
        self.centralwidget = WorkspaceTabWidget(self)
        self.centralwidget.setObjectName("centralwidget")

        # Create and set icon
        if getattr(sys, "frozen", False):
            icon_path = Path(sys.executable).parent / "resources" / "icon.png"
        else:
            icon_path = Path(__file__).parent / "resources" / "icon.png"
        self.setWindowIcon(QtGui.QIcon(str(icon_path)))

        # Root layout creation
        self.root_layout = QtWidgets.QVBoxLayout(self.centralwidget)
        self.root_layout.setObjectName("root_layout")

        # Populate with starting panes
        self.create_location_pane(area=Qt.LeftDockWidgetArea)
        self.create_note_pane(area=Qt.LeftDockWidgetArea)
        self.create_party_pane(area=Qt.RightDockWidgetArea)
        self.create_npc_pane(area=Qt.RightDockWidgetArea)
        self.create_monsters_pane(area=Qt.RightDockWidgetArea)

        # Create actions, then menu bar using those actions
        self.create_actions()
        self.create_menu_bar()

        # Create errors to live permanently, so user can hide them from
        # appearing if desired
        self.create_error_boxes()

        # Final window setup
        self.setCentralWidget(self.centralwidget)
        self.setWindowState(Qt.WindowMaximized)

        # Check if there's a world to open already
        last_opened = Config.last_opened()
        if last_opened is not None:
            self.open_world(event=None, world_path=last_opened)
Example #3
0
def test_set_last_opened_is_saved(clean_config):
    test_path = "test_path"
    Config.set_last_opened(test_path)
    assert str(Config.last_opened()) == test_path
Example #4
0
def test_no_last_opened_gives_none(clean_config):
    assert Config.last_opened() is None