~ubuntu-branches/debian/sid/guake/sid

« back to all changes in this revision

Viewing changes to src/dbusiface.py

  • Committer: Package Import Robot
  • Author(s): Daniel Echeverry
  • Date: 2015-04-26 19:15:06 UTC
  • mfrom: (1.1.7)
  • mto: This revision was merged to the branch mainline in revision 26.
  • Revision ID: package-import@ubuntu.com-20150426191506-mo8037vk6pueer5b
Tags: upstream-0.7.0
ImportĀ upstreamĀ versionĀ 0.7.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# -*- coding: utf-8; -*-
2
 
"""
3
 
Copyright (C) 2007-2013 Guake authors
4
 
 
5
 
This program is free software; you can redistribute it and/or
6
 
modify it under the terms of the GNU General Public License as
7
 
published by the Free Software Foundation; either version 2 of the
8
 
License, or (at your option) any later version.
9
 
 
10
 
This program is distributed in the hope that it will be useful,
11
 
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
 
General Public License for more details.
14
 
 
15
 
You should have received a copy of the GNU General Public
16
 
License along with this program; if not, write to the
17
 
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18
 
Boston, MA 02110-1301 USA
19
 
"""
20
 
import dbus
21
 
import dbus.glib
22
 
import dbus.service
23
 
dbus.glib.threads_init()
24
 
 
25
 
DBUS_PATH = '/org/guake/RemoteControl'
26
 
DBUS_NAME = 'org.guake.RemoteControl'
27
 
 
28
 
 
29
 
class DbusManager(dbus.service.Object):
30
 
 
31
 
    def __init__(self, guakeinstance):
32
 
        self.guake = guakeinstance
33
 
        self.bus = dbus.SessionBus()
34
 
        bus_name = dbus.service.BusName(DBUS_NAME, bus=self.bus)
35
 
        super(DbusManager, self).__init__(bus_name, DBUS_PATH)
36
 
 
37
 
    @dbus.service.method(DBUS_NAME)
38
 
    def show_hide(self):
39
 
        self.guake.show_hide()
40
 
 
41
 
    @dbus.service.method(DBUS_NAME)
42
 
    def show(self):
43
 
        self.guake.show()
44
 
        self.guake.set_terminal_focus()
45
 
 
46
 
    @dbus.service.method(DBUS_NAME)
47
 
    def hide(self):
48
 
        self.guake.hide()
49
 
 
50
 
    @dbus.service.method(DBUS_NAME, in_signature='s')
51
 
    def add_tab(self, directory=''):
52
 
        self.guake.add_tab(directory)
53
 
 
54
 
    @dbus.service.method(DBUS_NAME, in_signature='i')
55
 
    def select_tab(self, tab_index=0):
56
 
        self.guake.select_tab(int(tab_index))
57
 
 
58
 
    @dbus.service.method(DBUS_NAME, out_signature='i')
59
 
    def get_selected_tab(self):
60
 
        return self.guake.get_selected_tab()
61
 
 
62
 
    @dbus.service.method(DBUS_NAME, out_signature='i')
63
 
    def get_tab_count(self):
64
 
        return len(self.guake.term_list)
65
 
 
66
 
    @dbus.service.method(DBUS_NAME, in_signature='s')
67
 
    def set_bgcolor(self, bgcolor):
68
 
        self.guake.set_bgcolor(bgcolor)
69
 
 
70
 
    @dbus.service.method(DBUS_NAME, in_signature='s')
71
 
    def set_fgcolor(self, fgcolor):
72
 
        self.guake.set_fgcolor(fgcolor)
73
 
 
74
 
    @dbus.service.method(DBUS_NAME, in_signature='s')
75
 
    def execute_command(self, command):
76
 
        self.guake.execute_command(command)
77
 
 
78
 
    @dbus.service.method(DBUS_NAME, in_signature='i', out_signature='s')
79
 
    def get_tab_name(self, tab_index=0):
80
 
        return self.guake.term_list[int(tab_index)].get_window_title() or ''
81
 
 
82
 
    @dbus.service.method(DBUS_NAME, in_signature='is')
83
 
    def rename_tab(self, tab_index, new_text):
84
 
        self.guake.rename_tab(tab_index, new_text)
85
 
 
86
 
    @dbus.service.method(DBUS_NAME, in_signature='s')
87
 
    def rename_current_tab(self, new_text):
88
 
        self.guake.rename_current_tab(new_text)
89
 
 
90
 
    @dbus.service.method(DBUS_NAME)
91
 
    def show_about(self):
92
 
        self.guake.show_about()
93
 
 
94
 
    @dbus.service.method(DBUS_NAME)
95
 
    def show_prefs(self):
96
 
        self.guake.show_prefs()
97
 
 
98
 
    @dbus.service.method(DBUS_NAME)
99
 
    def quit(self):
100
 
        self.guake.quit()