/usr/lib/python2.7/dist-packages/ocfs2interface/guiutil.py is in ocfs2console 1.6.4-3.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 | # OCFS2Console - GUI frontend for OCFS2 management and debugging
# Copyright (C) 2002, 2005 Oracle. All rights reserved.
#
# 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, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 021110-1307, USA.
import gtk
def set_props(obj, **kwargs):
for k, v in kwargs.items():
obj.set_property(k, v)
suffixes = ('K', 'MB', 'GB', 'TB')
def format_bytes(bytes, show_bytes=False):
if bytes == 1:
return '1 byte'
elif bytes < 1024:
return str(bytes) + ' bytes'
fbytes = float(bytes)
i = -1
while i < 3 and fbytes >= 1024:
fbytes /= 1024
i += 1
if show_bytes:
return '%.1f %s (%sb)' % (fbytes, suffixes[i], bytes)
else:
return '%.0f %s' % (fbytes, suffixes[i])
def error_box(parent, msg):
dialog = gtk.MessageDialog(parent=parent,
flags=gtk.DIALOG_DESTROY_WITH_PARENT,
type=gtk.MESSAGE_ERROR,
buttons=gtk.BUTTONS_OK,
message_format=msg)
dialog.run()
dialog.destroy()
def make_callback(obj, callback, sub_callback):
cb = getattr(obj, callback)
if sub_callback:
sub_cb = getattr(obj, sub_callback)
def cb_func(*args):
cb()
sub_cb()
else:
def cb_func(*args):
cb()
return cb_func
if hasattr(gtk.Dialog, 'set_alternative_button_order'):
Dialog = gtk.Dialog
else:
class Dialog(gtk.Dialog):
def set_alternative_button_order(self, new_order=None):
pass
|