/usr/share/pyshared/etk/docking/dockframe.py is in python-etk.docking 0.2-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 | # -*- coding: utf-8 -*-
# vim:sw=4:et:ai
# Copyright © 2010 etk.docking Contributors
#
# This file is part of etk.docking.
#
# etk.docking is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# etk.docking 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 Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with etk.docking. If not, see <http://www.gnu.org/licenses/>.
from __future__ import absolute_import
from logging import getLogger
import gtk
import gtk.gdk as gdk
class DockFrame(gtk.Bin):
'''
The etk.DockFrame widget is a gtk.Bin that acts as the toplevel widget
for a dock layout hierarchy.
'''
__gtype_name__ = 'EtkDockFrame'
def __init__(self):
gtk.Bin.__init__(self)
# Initialize logging
self.log = getLogger('%s.%s' % (self.__gtype_name__, hex(id(self))))
# Internal housekeeping
self._placeholder = None
############################################################################
# GtkWidget
############################################################################
def do_size_request(self, requisition):
requisition.width = 0
requisition.height = 0
if self.child and self.child.flags() & gtk.VISIBLE:
(requisition.width, requisition.height) = self.child.size_request()
requisition.width += self.border_width * 2
requisition.height += self.border_width * 2
def do_size_allocate(self, allocation):
self.allocation = allocation
if self.child and self.child.flags() & gtk.VISIBLE:
child_allocation = gdk.Rectangle()
child_allocation.x = allocation.x + self.border_width
child_allocation.y = allocation.y + self.border_width
child_allocation.width = allocation.width - (2 * self.border_width)
child_allocation.height = allocation.height - (2 * self.border_width)
self.child.size_allocate(child_allocation)
############################################################################
# EtkDockFrame
############################################################################
def set_placeholder(self, placeholder):
"""
Set a new placeholder widget on the frame. The placeholder is drawn on top
of the dock items.
If a new placeholder is set, an existing placeholder is destroyed.
"""
if self._placeholder:
self._placeholder.unparent()
self._placeholder.destroy()
self._placeholder = None
if placeholder:
self._placeholder = placeholder
self._placeholder.set_parent(self)
|