# Path: pwm/config.py
# class Config:
#     def __init__(self):
#     def load(self, default=False):
#     def _load_default(self):
#     def _ensure_config_exists(self, path):
#     def __getattr__(self, name):
# def setup_keys():
# def handle_key_press_event(event):
# def create_arguments(func):
#     def wrapper(*args, **kwargs):
# 
# Path: pwm/ffi/xcb.py
# class XcbError(Exception):
# class Cookie:
# class Xcb:
#     def __init__(self, error):
#     def __str__(self):
#     def __init__(self, name, value):
#     def __getattr__(self, name):
#     def reply(self):
#     def check(self):
#     def __init__(self):
#     def __getattr__(self, name):
#         def request(func, *args, **kwargs):
#     def connect(self, display=None):
#     def mask(self, masks):
# 
# Path: pwm/ffi/cairo.py
# class CairoError(Exception):
# class Context:
# class Cairo:
#     def __init__(self, ctx):
#     def __getattr__(self, name):
#     def encode(self, text):
#     def select_font_face(self, face, slant, weight):
#     def text_extents(self, text, extents):
#     def show_text(self, text):
#     def __init__(self):
#     def __getattr__(self, name):
#     def create(self, surface):


from pwm.config import config
from pwm.ffi.xcb import xcb
from pwm.ffi.cairo import cairo
import pwm.color as color
import pwm.events
import pwm.windows
import pwm.widgets

    def draw_background(self):
        self.ctx.set_source_rgb(*color.get_rgb(config.bar.background))
        self.ctx.set_operator(cairo.OPERATOR_SOURCE)
        self.ctx.paint()

    def draw_open_workspaces(self):
        """Draw indicators for all open workspaces.

        Each open workspace is represented by a little box with
        a number in it.
        """

        # Figure out how big the boxes should be
        # Take the size of the text and add padding
        # Note that we have to align everything on 0.5 to avoid blurring
        ws_chars = len("%d" % (len(pwm.workspaces.workspaces)-1))
        padding_left = 5
        box_width = self.extents.max_x_advance*ws_chars + 2*padding_left
        padding_top = 0.5
        box_height = self.height - 2*padding_top

        left = 0.5
        for widx, ws in pwm.workspaces.opened():
            fg = None
            bg = None
            border = None

            if ws.is_urgent():
                fg = config.bar.urgent_workspace_foreground

# Path: pwm/config.py
# class Config:
#     def __init__(self):
#     def load(self, default=False):
#     def _load_default(self):
#     def _ensure_config_exists(self, path):
#     def __getattr__(self, name):
# def setup_keys():
# def handle_key_press_event(event):
# def create_arguments(func):
#     def wrapper(*args, **kwargs):
# 
# Path: pwm/ffi/xcb.py
# class XcbError(Exception):
# class Cookie:
# class Xcb:
#     def __init__(self, error):
#     def __str__(self):
#     def __init__(self, name, value):
#     def __getattr__(self, name):
#     def reply(self):
#     def check(self):
#     def __init__(self):
#     def __getattr__(self, name):
#         def request(func, *args, **kwargs):
#     def connect(self, display=None):
#     def mask(self, masks):
# 
# Path: pwm/ffi/cairo.py
# class CairoError(Exception):
# class Context:
# class Cairo:
#     def __init__(self, ctx):
#     def __getattr__(self, name):
#     def encode(self, text):
#     def select_font_face(self, face, slant, weight):
#     def text_extents(self, text, extents):
#     def show_text(self, text):
#     def __init__(self):
#     def __getattr__(self, name):
#     def create(self, surface):


# Path: pwm/bar.py
from pwm.config import config
from pwm.ffi.xcb import xcb
from pwm.ffi.cairo import cairo
import pwm.color as color
import pwm.events
import pwm.windows
import pwm.widgets


    def draw_background(self):
        self.ctx.set_source_rgb(*color.get_rgb(config.bar.background))
        self.ctx.set_operator(cairo.OPERATOR_SOURCE)
        self.ctx.paint()

    def draw_open_workspaces(self):
        """Draw indicators for all open workspaces.

        Each open workspace is represented by a little box with
        a number in it.
        """

        # Figure out how big the boxes should be
        # Take the size of the text and add padding
        # Note that we have to align everything on 0.5 to avoid blurring
        ws_chars = len("%d" % (len(pwm.workspaces.workspaces)-1))
        padding_left = 5
        box_width = self.extents.max_x_advance*ws_chars + 2*padding_left
        padding_top = 0.5
        box_height = self.height - 2*padding_top

        left = 0.5
        for widx, ws in pwm.workspaces.opened():
            fg = None
            bg = None
            border = None

            if ws.is_urgent():
                fg = config.bar.urgent_workspace_foreground

                bg = config.bar.urgent_workspace_background