import cairo
from .page import Page

class Solar(Page):


    def draw_solar(self, ctx, x, y, w, h):
        pass
        """
        // Solar graphic with fill level
        void solarGraphic(uint x, uint y, int pcolor, int bcolor){
            // Show solar modul
                int xb = x;     // X position
                int yb = y;     // Y position
                int t = 4;      // Line thickness
                int percent = 0;
                // Solar corpus 100x80
                int level = int((100.0 - percent) * (80-(2*t)) / 100.0);
                getdisplay().fillRect(xb, yb, 100, 80, pcolor);
                if(percent < 99){
                    getdisplay().fillRect(xb+t, yb+t, 100-(2*t), level, bcolor);
                }
                // Draw horizontel lines
                getdisplay().fillRect(xb, yb+28-t, 100, t, pcolor);
                getdisplay().fillRect(xb, yb+54-t, 100, t, pcolor);
                // Draw vertical lines
                getdisplay().fillRect(xb+19+t, yb, t, 80, pcolor);
                getdisplay().fillRect(xb+39+2*t, yb, t, 80, pcolor);
                getdisplay().fillRect(xb+59+3*t, yb, t, 80, pcolor);

        }
        """

    def draw(self, ctx):
        # Name
        ctx.select_font_face("Ubuntu", cairo.FontSlant.NORMAL, cairo.FontWeight.BOLD)
        ctx.set_font_size(60) 
        ctx.move_to(20, 100)
        ctx.show_text("Solar")

