# Path: l5r/util/log.py
# def log_setup(base_path, base_name):


import l5r.api as api
import l5r.models as models
import l5r.widgets as widgets
import l5r.api.character
from l5r.util import log
from PyQt5 import QtCore, QtGui, QtWidgets
                self.perk_nm, self.item.rank, self.item.cost)

            if self.item.cost > api.character.xp_left():
                QtWidgets.QMessageBox.warning(self, self.tr("Not enough XP"),
                                          self.tr("Cannot purchase.\nYou've reached the XP Limit."))
                return
        else:
            self.item.desc = self.tr("%s Rank %d, XP Gain: %d") % (
                self.perk_nm, self.item.rank, abs(self.item.cost))

        if self.tag == 'flaw':
            self.item.cost *= -1

        self.item.tag = self.tag
        api.character.append_advancement(self.item)

        self.accept()

    def update_book(self, perk_data):
        try:
            source_book = perk_data.source_pack
            page_number = perk_data.book_page

            if not source_book:
                self.lb_book.setText("")
            elif not page_number:                
                self.lb_book.setText(em(source_book.display_name))
            else:
                self.lb_book.setText(em(self.tr(f"{source_book.display_name}, page {page_number}")))
        except:

# Path: l5r/util/log.py
# def log_setup(base_path, base_name):


# Path: l5r/dialogs/perkseldlg.py
import l5r.api as api
import l5r.models as models
import l5r.widgets as widgets
import l5r.api.character
from l5r.util import log
from PyQt5 import QtCore, QtGui, QtWidgets

                self.perk_nm, self.item.rank, self.item.cost)

            if self.item.cost > api.character.xp_left():
                QtWidgets.QMessageBox.warning(self, self.tr("Not enough XP"),
                                          self.tr("Cannot purchase.\nYou've reached the XP Limit."))
                return
        else:
            self.item.desc = self.tr("%s Rank %d, XP Gain: %d") % (
                self.perk_nm, self.item.rank, abs(self.item.cost))

        if self.tag == 'flaw':
            self.item.cost *= -1

        self.item.tag = self.tag
        api.character.append_advancement(self.item)

        self.accept()

    def update_book(self, perk_data):
        try:
            source_book = perk_data.source_pack
            page_number = perk_data.book_page

            if not source_book:
                self.lb_book.setText("")
            elif not page_number:                
                self.lb_book.setText(em(source_book.display_name))
            else:
                self.lb_book.setText(em(self.tr(f"{source_book.display_name}, page {page_number}")))
        except:

            log.ui.error(f'cannot load source book for perk: {perk_data.id}', exc_info=1)