Subversion Repositories basico

Rev

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

Rev Author Line No. Line
4 t00mlabs 1
#!/usr/bin/python
2
# -*- coding: utf-8 -*-
3
# File: uiapp.py
4
# Author: Tomás Vírseda
5
# License: GPL v3
6
# Description: Gtk.Application instance
7
 
8
import os
9
import sys
10
import subprocess
11
from datetime import datetime
12
 
13
from gi.repository import Gtk
14
from gi.repository import Gdk
15
from gi.repository.GdkPixbuf import Pixbuf
16
from gi.repository import Pango
17
from gi.repository import GLib
18
from gi.repository import GObject
19
from gi.repository import Gio
20
 
233 t00m 21
from basico.core.service import Service
22
from basico.core.window import GtkAppWindow
23
from basico.core.env import FILE, APP
4 t00mlabs 24
 
25
class UIApp(Gtk.Application):
26
    """
27
    """
28
    def __init__(self, controller):
29
        Gtk.Application.__init__(self,
30
                                 application_id="net.t00mlabs.basico",
31
                                 flags=Gio.ApplicationFlags.FLAGS_NONE)
32
        GLib.set_application_name("Basico")
33
        GLib.set_prgname('basico')
34
        self.controller = controller
35
        self.get_services()
36
 
37
 
38
    def get_services(self):
39
        self.gui = self.controller.get_service('GUI')
40
        self.im = self.controller.get_service('IM')
41
        self.cb = self.controller.get_service('Callbacks')
42
 
43
 
44
    def do_activate(self):
213 t00m 45
        self.window = self.gui.add_widget('gtk_app_window_main', GtkAppWindow(self))
4 t00mlabs 46
        self.window.connect("delete-event", self.gui.quit)
47
        self.window.show()
48
 
49
 
50
    def do_startup(self):
51
        Gtk.Application.do_startup(self)
52
 
53
        # show icons on the buttons
54
        #~ settings = Gtk.Settings.get_default()
55
        #~ DEPRECATED: settings.props.gtk_button_images = True
56
 
57
        # actions that control the application: create, connect their
58
        # signal to a callback method (see below), add the action to the
59
        # application
60
 
61
 
62
    def get_window(self):
203 t00m 63
        return self.window
4 t00mlabs 64
 
65
 
66
    def get_controller(self):
67
        return self.controller
68
 
69
 
70
    def cb_hide_about(self, aboutdialog, user_data):
71
        aboutdialog.destroy()
72
 
73
 
74
    def cb_toggle_fullscreen(self, tgbutton, user_data=None):
75
        if tgbutton.get_active():
76
            self.window.fullscreen()
77
        else:
78
            self.window.unfullscreen()
79