Subversion Repositories basico

Rev

Rev 233 | 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

import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
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):
    def __init__(self, app):
        Gtk.HBox.__init__(self)
        self.app = app
        self.get_services()
        self.setup()


    def setup(self):
        vbox = Gtk.VBox()
        viewport = Gtk.Viewport()
        viewport.set_shadow_type(Gtk.ShadowType.NONE)
        self.statusbar = self.gui.add_widget('gtk_label_statusbar', Gtk.Label())
        self.statusbar.set_property('ellipsize', Pango.EllipsizeMode.MIDDLE)
        self.statusbar.set_property('selectable', True)
        self.statusbar.set_property('margin-left', 6)
        self.statusbar.set_property('margin-right', 6)
        self.statusbar.set_property('margin-top', 0)
        self.statusbar.set_property('margin-bottom', 6)
        self.statusbar.set_xalign(0.0)
        self.message("<b>Welcome to Basico</b>")
        viewport.add(self.statusbar)
        vbox.pack_start(viewport, True, False, 0)
        self.add(vbox)


    def get_services(self):
        self.gui = self.app.get_service("GUI")


    def message(self, message):
        self.statusbar.set_markup("<b>%s</b>" % message)