~grissi/skype-wrapper/wrapper-old

« back to all changes in this revision

Viewing changes to src/uisettings.py

  • Committer: Christian Rupp
  • Date: 2012-09-01 11:17:56 UTC
  • Revision ID: christian@r-k-r.de-20120901111756-67rx12ikixzyrco6
Added first line of text

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env python
 
2
# -*- coding: utf-8; tab-width: 4; mode: python -*-
 
3
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: t -*-
 
4
# vi: set ft=python sts=4 ts=4 sw=4 noet
 
5
#
 
6
# Copyright 2012 Shannon Black
 
7
#
 
8
# Authors:
 
9
#    Christian Rupp <christian@r-k-r.de>
 
10
#
 
11
# This program is free software: you can redistribute it and/or modify it
 
12
# under the terms of either or both of the following licenses:
 
13
#
 
14
# 1) the GNU Lesser General Public License version 3, as published by the
 
15
# Free Software Foundation; and/or
 
16
# 2) the GNU Lesser General Public License version 2.1, as published by
 
17
# the Free Software Foundation.
 
18
#
 
19
# This program is distributed in the hope that it will be useful, but
 
20
# WITHOUT ANY WARRANTY; without even the implied warranties of
 
21
# MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
 
22
# PURPOSE.  See the applicable version of the GNU Lesser General Public
 
23
# License for more details.
 
24
#
 
25
# You should have received a copy of both the GNU Lesser General Public
 
26
# License version 3 and version 2.1 along with this program.  If not, see
 
27
# <http://www.gnu.org/licenses/>
 
28
#
 
29
 
 
30
from gi.repository import Gtk, Gio
 
31
import settings
 
32
import subprocess
 
33
 
 
34
BASE_KEY = "apps.skype-wrapper"
 
35
setting = Gio.Settings.new(BASE_KEY)
 
36
 
 
37
class DialogAdvanced(Gtk.Dialog):
 
38
                                
 
39
                def __init__(self, parent):             
 
40
                                Gtk.Dialog.__init__(self, "Remove sni-qt", parent, 0,(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,Gtk.STOCK_OK, Gtk.ResponseType.OK))
 
41
 
 
42
                        self.set_default_size(300, 100)
 
43
 
 
44
                        label = Gtk.Label("This will remove sni-qt. The Skype-Icon will not be shown in the panel any longer. This may also affects other applications. To revert the change reinstall sni-qt in the software-center")
 
45
                                label.set_line_wrap(True)
 
46
                        box = self.get_content_area()
 
47
                        box.add(label)
 
48
                        self.show_all()
 
49
 
 
50
class uisettings(Gtk.Window):
 
51
        def switch(self, table, label, option):
 
52
                self.row += 1
 
53
                gtk_label = Gtk.Label ( label )
 
54
                gtk_label.set_alignment(0.0,0.5)
 
55
 
 
56
                table.attach ( gtk_label, 0, 3, self.row, self.row+1, xpadding=10, ypadding = 2 )
 
57
                gtk_switch = Gtk.Switch()
 
58
                table.attach ( gtk_switch, 3, 4, self.row, self.row+1, xpadding=10, ypadding = 2 )
 
59
                setting.bind( option, gtk_switch, "active", Gio.SettingsBindFlags.DEFAULT )
 
60
 
 
61
        def __init__(self):
 
62
                Gtk.Window.__init__(self, title="Skype Wrapper Options")
 
63
                table = Gtk.Table(2, 4, True)
 
64
                table.set_row_spacings(5)
 
65
                table.set_col_spacings(1)
 
66
                self.row = -1
 
67
                        self.add(table)
 
68
                        
 
69
                        
 
70
                self.switch( table, "Notify when someone goes on or offline", "notify-on-useronlinestatuschange")
 
71
                self.switch( table, "Notify when you recieve a message","notify-on-messagerecieve")
 
72
                self.switch( table, "Notify about all online contacts during startup", "notify-on-initializing")
 
73
                self.switch( table, "Display avatars next to indicator message", "display-indicator-avatars")
 
74
                self.switch( table, "Display avatars in the notifications", "display-notification-avatars")
 
75
                self.switch( table, "Notify on incoming File Transfer", "notify-on-incoming-filetransfer" )
 
76
                self.switch( table, "Notify on outgoing File Transfer", "notify-on-outgoing-filetransfer" )
 
77
                self.switch( table, "Show outgoing File Transfer progress in the Launcher", "show-outgoing-file-progress" )
 
78
                self.switch( table, "Show incoming File Transfer progress in the Launcher", "show-incoming-file-progress" )
 
79
                self.switch( table, "Use the global online status of the system", "use-global-status" )
 
80
                self.switch( table, "Toggle music playback before and after a call", "control-music-player" )
 
81
                self.switch( table, "Restore the volume to the level prior the call", "restore-volume" )
 
82
 
 
83
                gtk_btn_adv = Gtk.Button("Remove the panel icon")
 
84
                gtk_btn = Gtk.Button("Close")
 
85
                gtk_btn.connect("clicked", Gtk.main_quit)
 
86
                gtk_btn_adv.connect("clicked", self.on_advanced_clicked)
 
87
 
 
88
                self.row += 1
 
89
                table.attach ( gtk_btn, 3, 4, self.row, self.row+1,xpadding=10, ypadding = 2 )
 
90
                table.attach ( gtk_btn_adv, 0, 2, self.row, self.row+1,xpadding=10, ypadding = 2 )
 
91
 
 
92
 
 
93
 
 
94
                def on_advanced_clicked(self, widget):
 
95
                        dialog = DialogAdvanced(self)
 
96
                        response = dialog.run()
 
97
 
 
98
                        if response == Gtk.ResponseType.OK:
 
99
                                subprocess.call(['gksudo','python /usr/share/skype-wrapper/uninstallsni.py'])
 
100
 
 
101
                                                                
 
102
                        elif response == Gtk.ResponseType.CANCEL:
 
103
                        print "The Cancel button was clicked"
 
104
 
 
105
                        dialog.destroy()
 
106
 
 
107
 
 
108
win = uisettings()
 
109
win.set_border_width(10)
 
110
win.connect("delete-event", Gtk.main_quit)
 
111
win.connect("destroy", Gtk.main_quit)
 
112
win.show_all()
 
113
 
 
114
Gtk.main()
 
115
 
 
116