<commit_before># PyUI
# Copyright (C) 2001-2002 <NAME>
# 
# This library is free software; you can redistribute it and/or
# modify it under the terms of version 2.1 of the GNU Lesser General Public
# License as published by the Free Software Foundation.
# 
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.
# 
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

"""Pyui Themes.
Themes are a method of customizing the drawing of widgets in a pyui GUI.

This modules keeps NO state for the drable objects - it just draws them on demand
from the widgets themselves which hold all the state.

The constants for the theme objects live in pyui/locals.py

Themes have a default font that is used for any widgets that dont specify a font.
"""

import locals
import pyui
from pyui.desktop import getRenderer, getDesktop

class ThemeBase:
    """Theme objects (like buttons) are drawn through methods for each type of widget.
    It returns the rect that the object draw fit into.

    The rect passed in should always be in window coordinates.
    """

    def __init__(self, renderer, fontFace="times", fontSize=12, fontFlags=0):
        self.renderer = renderer
        self.desktop = getDesktop()

        self.fgColor = renderer.packColor(255,255,255)
        self.bgColor = renderer.packColor(0,0,0)
        
        # setup default font
        self.defaultFontFace = fontFace
        self.defaultFontSize = fontSize
        self.defaultFontFlags = fontFlags
        self.defaultFont = renderer.createFont(fontFace, fontSize, fontFlags)
        #(self.defaultTextWidth, self.defaultTextHeight) = renderer.getTextSize("M", self.defaultFont)
        self.defaultTextHeight = fontSize*2

        # setup widget offsets
        self.frameBorderLeft = 4
        self.frameBorderRight = 4
        self.frameBorderTop = fontSize *2.2
        self.frameBorderBottom = 4
        self.tabsHeight = int(fontSize * 1.3)
        self.scrollerSize = 10
        

    ### Information about the theme..
    def getFrameBorderTop(self):
        return self.frameBorderTop

    def getFrameBorderLeft(self):
        return self.frameBorderLeft
    
    def getFrameBorderRight(self):
        return self.frameBorderRight
    
    def getFrameBorderBottom(self):
        return self.frameBorderBottom
    
    def getTabsHeight(self):<commit_msg>Item wasn't being forced to int.<commit_after># PyUI
# Copyright (C) 2001-2002 <NAME>
# 
# This library is free software; you can redistribute it and/or
# modify it under the terms of version 2.1 of the GNU Lesser General Public
# License as published by the Free Software Foundation.
# 
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.
# 
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

"""Pyui Themes.
Themes are a method of customizing the drawing of widgets in a pyui GUI.

This modules keeps NO state for the drable objects - it just draws them on demand
from the widgets themselves which hold all the state.

The constants for the theme objects live in pyui/locals.py

Themes have a default font that is used for any widgets that dont specify a font.
"""

import locals
import pyui
from pyui.desktop import getRenderer, getDesktop

class ThemeBase:
    """Theme objects (like buttons) are drawn through methods for each type of widget.
    It returns the rect that the object draw fit into.

    The rect passed in should always be in window coordinates.
    """

    def __init__(self, renderer, fontFace="times", fontSize=12, fontFlags=0):
        self.renderer = renderer
        self.desktop = getDesktop()

        self.fgColor = renderer.packColor(255,255,255)
        self.bgColor = renderer.packColor(0,0,0)
        
        # setup default font
        self.defaultFontFace = fontFace
        self.defaultFontSize = fontSize
        self.defaultFontFlags = fontFlags
        self.defaultFont = renderer.createFont(fontFace, fontSize, fontFlags)
        #(self.defaultTextWidth, self.defaultTextHeight) = renderer.getTextSize("M", self.defaultFont)
        self.defaultTextHeight = fontSize*2

        # setup widget offsets
        self.frameBorderLeft = 4
        self.frameBorderRight = 4
        self.frameBorderTop = int(fontSize *2.2)
        self.frameBorderBottom = 4
        self.tabsHeight = int(fontSize * 1.3)
        self.scrollerSize = 10
        

    ### Information about the theme..
    def getFrameBorderTop(self):
        return self.frameBorderTop

    def getFrameBorderLeft(self):
        return self.frameBorderLeft
    
    def getFrameBorderRight(self):
        return self.frameBorderRight
    
    def getFrameBorderBottom(self):
        return self.frameBorderBottom
    
    def getTabsHeight(self):
{'fraction_non_alphanumeric': 0.06488691138301816, 'fraction_numerical': 0.018168335187245088, 'mean_word_length': 3.1340996168582373, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6465376', 'n_tokens_mistral': 1513, 'n_tokens_neox': 1427, 'n_words': 590}