2
# -*- coding: utf-8 -*-
4
# preferences_dialog.py
6
# This file is part of PushBullet-Indicator
9
# Lorenzo Carbonell Cerezo <lorenzo.carbonell.cerezo@gmail.com>
11
# This program is free software: you can redistribute it and/or modify
12
# it under the terms of the GNU General Public License as published by
13
# the Free Software Foundation, either version 3 of the License, or
14
# (at your option) any later version.
16
# This program is distributed in the hope that it will be useful,
17
# but WITHOUT ANY WARRANTY; without even the implied warranty of
18
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
# GNU General Public License for more details.
21
# You should have received a copy of the GNU General Public License
22
# along with this program. If not, see <http://www.gnu.org/licenses/>.
25
gi.require_version('Gtk', '3.0')
26
from gi.repository import Gtk
27
from gi.repository import Gdk
31
class SearchAndReplaceDialog(Gtk.Dialog):
34
Gtk.Dialog.__init__(self, 'uText | '+_('Search and replace'),None,Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT,(Gtk.STOCK_CANCEL, Gtk.ResponseType.REJECT,Gtk.STOCK_OK, Gtk.ResponseType.ACCEPT))
35
self.set_position(Gtk.WindowPosition.CENTER_ALWAYS)
36
#self.set_size_request(400, 230)
37
self.connect('close', self.close_application)
38
self.set_icon_from_file(comun.ICON)
40
vbox0 = Gtk.VBox(spacing = 5)
41
vbox0.set_border_width(5)
42
self.get_content_area().add(vbox0)
43
#***************************************************************
44
#***************************************************************
46
vbox0.pack_start(frame1,False,True,1)
47
table1 = Gtk.Table(2, 2, False)
49
#***************************************************************
50
label1 = Gtk.Label(_('Search')+':')
51
label1.set_alignment(0, 0.5)
52
table1.attach(label1,0,1,0,1, xpadding=5, ypadding=5)
53
self.search_text = Gtk.Entry()
54
table1.attach(self.search_text,1,2,0,1, xpadding=5, ypadding=5)
55
label2 = Gtk.Label(_('Replace with')+':')
56
label2.set_alignment(0, 0.5)
57
table1.attach(label2,0,1,1,2, xpadding=5, ypadding=5)
58
self.replace_text = Gtk.Entry()
59
table1.attach(self.replace_text,1,2,1,2, xpadding=5, ypadding=5)
64
def close_application(self, widget, event):
67
if __name__ == "__main__":
68
cm = SearchAndReplaceDialog()
69
if cm.run() == Gtk.ResponseType.ACCEPT:
70
print(cm.search_text.get_text())
71
print(cm.replace_text.get_text())