/usr/share/firewalld/gtk3_niceexpander.py is in firewall-config 0.4.4.6-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | #!/usr/bin/python -Es
# -*- coding: utf-8 -*-
#
# Copyright (C) 2016 Red Hat, Inc.
#
# Authors:
# Thomas Woerner <twoerner@redhat.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
class NiceExpander(object):
def __init__(self, expanded_button, unexpanded_button, paned, child):
self.expanded_button = expanded_button
self.unexpanded_button = unexpanded_button
self.paned = paned
self.child = child
self.sensitive = True
self.expanded = False
self.callback = { }
self.parent = self.expanded_button.get_parent()
self.expanded_button.connect("clicked", self.expand_cb)
self.unexpanded_button.connect("clicked", self.unexpand_cb)
self.set_expanded(True)
def expand_cb(self, *args):
self.expanded = False
self.expanded_button.hide()
self.unexpanded_button.show()
self.child.hide()
width = self.unexpanded_button.get_allocated_width()
width += self.parent.get_border_width()*2
self.paned.set_position(width)
self.call_notify_expanded()
def unexpand_cb(self, *args):
self.expanded = True
self.expanded_button.show()
self.unexpanded_button.hide()
self.child.show()
width = self.expanded_button.get_allocated_width()
width += self.parent.get_border_width()*2
self.paned.set_position(width)
self.call_notify_expanded()
def set_expanded(self, flag):
self.expanded = flag
if flag:
self.unexpand_cb()
else:
self.expand_cb()
def get_expanded(self):
return self.expanded
def connect(self, name, callback, *args):
if name == "notify::expanded":
self.callback[name] = (callback, args)
else:
raise ValueError("Unknown callback name '%s'" % name)
def call_notify_expanded(self):
name = "notify::expanded"
if name in self.callback:
cb = self.callback[name]
try:
cb[0](*cb[1])
except Exception as msg:
print(msg)
def set_sensitive(self, value):
self.expanded_button.set_sensitive(value)
self.unexpanded_button.set_sensitive(value)
self.child.set_sensitive(value)
def get_sensitive(self):
return self.expanded_button.get_sensitive()
def is_sensitive(self):
return self.expanded_button.is_sensitive()
|