Subversion Repositories basico

Rev

Rev 232 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

#!/usr/bin/python
# -*- coding: utf-8 -*-
# File: statusbar.py
# Author: Tomás Vírseda
# License: GPL v3
# Description: Statusbar Widget

from os.path import sep as SEP
from cgi import escape
import gi
gi.require_version('Gtk', '3.0')
gi.require_version('Gdk', '3.0')
from gi.repository import Gtk
from gi.repository import Gdk
from gi.repository import Pango

from basico.core.env import ROOT, USER_DIR, APP, LPATH, GPATH, FILE
from basico.core.service import Service


class Statusbar(Gtk.HBox, Service):
    def __init__(self, app):
        Gtk.HBox.__init__(self)
        self.app = app
        self.get_services()
        self.setup()

    def setup(self):
        vbox = Gtk.VBox()
        hbox = Gtk.HBox()

        # Status bar
        #~ separator = Gtk.Separator(orientation = Gtk.Orientation.HORIZONTAL)
        #~ vbox.pack_start(separator, True, False, 3)
        viewport = Gtk.Viewport()
        viewport.set_shadow_type(Gtk.ShadowType.IN)
        self.statusbar = self.gui.add_widget('gtk_label_statusbar', Gtk.Label())
        self.statusbar.set_property('margin-left', 6)
        self.statusbar.set_property('margin-right', 6)
        self.statusbar.set_property('margin-top', 6)
        self.statusbar.set_property('margin-bottom', 6)
        self.statusbar.set_xalign(0.0)
        self.message("<b>Welcome to Basico</b>")
        viewport.add(self.statusbar)
        hbox.pack_start(viewport, True, True, 0)

        # Progressbar
        #~ self.progressbar = Gtk.ProgressBar()
        #~ hbox.pack_start(self.progressbar, False, False, 0)

        vbox.pack_start(hbox, True, False, 0)
        self.add(vbox)


    def get_services(self):
        """Load services to be used in this class
        """

        self.gui = self.app.get_service("GUI")


    def message(self, message):
        self.statusbar.set_markup(message)