Subversion Repositories basico

Rev

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

Rev Author Line No. Line
232 t00m 1
#!/usr/bin/python
2
# -*- coding: utf-8 -*-
3
# File: statusbar.py
4
# Author: Tomás Vírseda
5
# License: GPL v3
6
# Description: Statusbar Widget
7
 
8
from os.path import sep as SEP
9
from cgi import escape
10
import gi
11
gi.require_version('Gtk', '3.0')
12
gi.require_version('Gdk', '3.0')
13
from gi.repository import Gtk
14
from gi.repository import Gdk
15
from gi.repository import Pango
16
 
233 t00m 17
from basico.core.env import ROOT, USER_DIR, APP, LPATH, GPATH, FILE
18
from basico.core.service import Service
232 t00m 19
 
20
 
21
class Statusbar(Gtk.HBox, Service):
22
    def __init__(self, app):
23
        Gtk.HBox.__init__(self)
24
        self.app = app
25
        self.get_services()
26
        self.setup()
27
 
28
    def setup(self):
29
        vbox = Gtk.VBox()
30
        hbox = Gtk.HBox()
31
 
32
        # Status bar
33
        #~ separator = Gtk.Separator(orientation = Gtk.Orientation.HORIZONTAL)
34
        #~ vbox.pack_start(separator, True, False, 3)
35
        viewport = Gtk.Viewport()
36
        viewport.set_shadow_type(Gtk.ShadowType.IN)
37
        self.statusbar = self.gui.add_widget('gtk_label_statusbar', Gtk.Label())
38
        self.statusbar.set_property('margin-left', 6)
39
        self.statusbar.set_property('margin-right', 6)
40
        self.statusbar.set_property('margin-top', 6)
41
        self.statusbar.set_property('margin-bottom', 6)
42
        self.statusbar.set_xalign(0.0)
43
        self.message("<b>Welcome to Basico</b>")
44
        viewport.add(self.statusbar)
45
        hbox.pack_start(viewport, True, True, 0)
46
 
47
        # Progressbar
48
        #~ self.progressbar = Gtk.ProgressBar()
49
        #~ hbox.pack_start(self.progressbar, False, False, 0)
50
 
51
        vbox.pack_start(hbox, True, False, 0)
52
        self.add(vbox)
53
 
54
 
55
    def get_services(self):
56
        """Load services to be used in this class
57
        """
58
        self.gui = self.app.get_service("GUI")
59
 
60
 
61
    def message(self, message):
62
        self.statusbar.set_markup(message)