# Path: l5r/util/log.py
# def log_setup(base_path, base_name):
# 
# Path: l5r/widgets/requirementwidget.py
# class RequirementsWidget(QtWidgets.QWidget):
# 
#     def __init__(self, parent=None):
#         super(RequirementsWidget, self).__init__(parent)
# 
#         self.vbox = QtWidgets.QVBoxLayout(self)
#         self.vbox.setContentsMargins(0, 0, 0, 0)
# 
#         self.checks = []   # checkbox list
#         self.rpg_placeholders = []
#         self.debug = False
# 
#         fr = QtWidgets.QFrame()
#         ly = QtWidgets.QVBoxLayout(fr)
# 
#         # max 10 checkboxes
#         for i in range(0, 10):
#             ck = QtWidgets.QCheckBox(self)
#             ck.setVisible(False)
#             ly.addWidget(ck)
#             self.checks.append(ck)
# 
#         for i in range(0, 5):
#             lb = QtWidgets.QLabel(self)
#             ck = QtWidgets.QCheckBox(self)
#             ck.setVisible(False)
#             lb.setVisible(False)
# 
#             lb.setWordWrap(True)
#             lb.setAlignment(QtCore.Qt.AlignJustify)
#             lb.setBuddy(ck)
# 
#             ly.addWidget(ck)
#             ly.addWidget(lb)
#             self.rpg_placeholders.append((lb, ck))
# 
#         self.vbox.addWidget(fr)
# 
#         self.setSizePolicy(
#             QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Expanding)
# 
#     def paintEvent(self, ev):
#         if not self.debug:
#             return
#         painter = QtGui.QPainter(self)
#         if self.layout():
#             paintLayout(painter, self.layout())
# 
#     def set_requirements(self, pc, dstore, requirements):
# 
#         self.setUpdatesEnabled(False)
# 
#         for ck in self.checks:
#             ck.setVisible(False)
#         for ph in self.rpg_placeholders:
#             lb, ck = ph
#             lb.setVisible(False)
#             ck.setVisible(False)
# 
#         self.setUpdatesEnabled(False)
#         snap = models.CharacterSnapshot(pc)
# 
#         checks_stack = copy(self.checks)
#         rpg_stack = copy(self.rpg_placeholders)
# 
#         for r in requirements:
# 
#             ck = None
#             lb = None
# 
#             if r.type == 'more':
#                 ph = rpg_stack.pop()
#                 lb, ck = ph
#                 lb.setText(u"<em>{0}</em>".format(r.text))
#                 ck.setText(self.tr("Role play"))
#                 ck.setEnabled(True)
#             else:
#                 ck = checks_stack.pop()
#                 ck.setEnabled(False)
#                 ck.setText(r.text)
#                 ck.setChecked(r.match(snap, dstore))
# 
#             if ck:
#                 ck.setVisible(True)
#             if lb:
#                 lb.setVisible(True)
# 
#         self.setUpdatesEnabled(True)
# 
#     def match(self):
#         for c in self.checks:
#             if not c.isVisible():
#                 continue
#             if not c.isChecked():
#                 return False
#         for p in self.rpg_placeholders:
#             l, c = p
#             if not c.isVisible():
#                 continue
#             if not c.isChecked():
#                 return False
#         return True
# 
#     def match_at_least_one(self):
#         if not self.checks[0].isVisible():
#             return True
#         for c in self.checks:
#             if c.isChecked():
#                 return True
#         return False


from PyQt5 import QtCore, QtGui, QtWidgets
from asq.initiators import query
from asq.selectors import a_
from l5r.util import log
from .requirementwidget import RequirementsWidget
import l5r.api as api
import l5r.api.data
import l5r.api.character
import l5r.api.character.merits
import l5r.api.data.schools
import l5r.api.data.clans
        import logging
    import sys
                                       api.data.schools.get_requirements(school_dal.id))
        if self._show_school_requirements:
            self.set_row_visible(self.pl_requirements,
                                 len(school_dal.require) > 0)
        self.update()

    def update_bonus_trait(self, school_dal):
        bonus_trait = None
        try:
            bonus_trait = school_dal.trait
        except:
            log.ui.error('cannot find bonus trait of {}'.format(self.current_school_id), exc_info=1)

        if not bonus_trait:
            self.lb_trait.setText(red(self.tr("None")))
        else:
            self.lb_trait.setText(green(u"+1 {}").format(api.data.get_trait_or_ring(bonus_trait)))

    def update_book(self, school_data):
        try:
            source_book = school_data.pack
            page_number = school_data.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/widgets/requirementwidget.py
# class RequirementsWidget(QtWidgets.QWidget):
# 
#     def __init__(self, parent=None):
#         super(RequirementsWidget, self).__init__(parent)
# 
#         self.vbox = QtWidgets.QVBoxLayout(self)
#         self.vbox.setContentsMargins(0, 0, 0, 0)
# 
#         self.checks = []   # checkbox list
#         self.rpg_placeholders = []
#         self.debug = False
# 
#         fr = QtWidgets.QFrame()
#         ly = QtWidgets.QVBoxLayout(fr)
# 
#         # max 10 checkboxes
#         for i in range(0, 10):
#             ck = QtWidgets.QCheckBox(self)
#             ck.setVisible(False)
#             ly.addWidget(ck)
#             self.checks.append(ck)
# 
#         for i in range(0, 5):
#             lb = QtWidgets.QLabel(self)
#             ck = QtWidgets.QCheckBox(self)
#             ck.setVisible(False)
#             lb.setVisible(False)
# 
#             lb.setWordWrap(True)
#             lb.setAlignment(QtCore.Qt.AlignJustify)
#             lb.setBuddy(ck)
# 
#             ly.addWidget(ck)
#             ly.addWidget(lb)
#             self.rpg_placeholders.append((lb, ck))
# 
#         self.vbox.addWidget(fr)
# 
#         self.setSizePolicy(
#             QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Expanding)
# 
#     def paintEvent(self, ev):
#         if not self.debug:
#             return
#         painter = QtGui.QPainter(self)
#         if self.layout():
#             paintLayout(painter, self.layout())
# 
#     def set_requirements(self, pc, dstore, requirements):
# 
#         self.setUpdatesEnabled(False)
# 
#         for ck in self.checks:
#             ck.setVisible(False)
#         for ph in self.rpg_placeholders:
#             lb, ck = ph
#             lb.setVisible(False)
#             ck.setVisible(False)
# 
#         self.setUpdatesEnabled(False)
#         snap = models.CharacterSnapshot(pc)
# 
#         checks_stack = copy(self.checks)
#         rpg_stack = copy(self.rpg_placeholders)
# 
#         for r in requirements:
# 
#             ck = None
#             lb = None
# 
#             if r.type == 'more':
#                 ph = rpg_stack.pop()
#                 lb, ck = ph
#                 lb.setText(u"<em>{0}</em>".format(r.text))
#                 ck.setText(self.tr("Role play"))
#                 ck.setEnabled(True)
#             else:
#                 ck = checks_stack.pop()
#                 ck.setEnabled(False)
#                 ck.setText(r.text)
#                 ck.setChecked(r.match(snap, dstore))
# 
#             if ck:
#                 ck.setVisible(True)
#             if lb:
#                 lb.setVisible(True)
# 
#         self.setUpdatesEnabled(True)
# 
#     def match(self):
#         for c in self.checks:
#             if not c.isVisible():
#                 continue
#             if not c.isChecked():
#                 return False
#         for p in self.rpg_placeholders:
#             l, c = p
#             if not c.isVisible():
#                 continue
#             if not c.isChecked():
#                 return False
#         return True
# 
#     def match_at_least_one(self):
#         if not self.checks[0].isVisible():
#             return True
#         for c in self.checks:
#             if c.isChecked():
#                 return True
#         return False


# Path: l5r/widgets/schoolchooser.py
from PyQt5 import QtCore, QtGui, QtWidgets
from asq.initiators import query
from asq.selectors import a_
from l5r.util import log
from .requirementwidget import RequirementsWidget
import l5r.api as api
import l5r.api.data
import l5r.api.character
import l5r.api.character.merits
import l5r.api.data.schools
import l5r.api.data.clans
        import logging
    import sys

                                       api.data.schools.get_requirements(school_dal.id))
        if self._show_school_requirements:
            self.set_row_visible(self.pl_requirements,
                                 len(school_dal.require) > 0)
        self.update()

    def update_bonus_trait(self, school_dal):
        bonus_trait = None
        try:
            bonus_trait = school_dal.trait
        except:
            log.ui.error('cannot find bonus trait of {}'.format(self.current_school_id), exc_info=1)

        if not bonus_trait:
            self.lb_trait.setText(red(self.tr("None")))
        else:
            self.lb_trait.setText(green(u"+1 {}").format(api.data.get_trait_or_ring(bonus_trait)))

    def update_book(self, school_data):
        try:
            source_book = school_data.pack
            page_number = school_data.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 school: {self.current_school_id}', exc_info=1)