Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorflavio <fdanesse@gmail.com>2012-12-12 20:46:13 (GMT)
committer flavio <fdanesse@gmail.com>2012-12-12 20:46:13 (GMT)
commitf278aada906532dcc4f9f72e31ec90a9bb1a6b77 (patch)
tree3de645a77203dca6b4b7a3b80da918140befac8f
parentd0c38d51b8a24ebf921921e7f0c6b80028017e6b (diff)
Replace Gtk.Container by Gtk.Box
-rw-r--r--record.py131
1 files changed, 0 insertions, 131 deletions
diff --git a/record.py b/record.py
index 978873a..a1ee967 100644
--- a/record.py
+++ b/record.py
@@ -676,138 +676,7 @@ class RecordContainer(Gtk.VBox):
self.pack_start(self._media_view, True, True, 0)
self.pack_start(self._controls_hbox, True, True, 0)
- '''
- for widget in (self._media_view, self._controls_hbox):
- if widget.get_state_flags() & widget.get_realized():
- widget.set_parent_window(self.get_property('window'))
-
- widget.set_parent(self)'''
-
self.show_all()
- '''
- def do_realize(self):
-
- self.set_realized(True)
-
- rect = self.get_allocation()
-
- attr = Gdk.WindowAttr()
-
- attr.window_type = Gdk.WindowType.CHILD
- attr.wclass = Gdk.WindowWindowClass.INPUT_OUTPUT
-
- attr.event_mask = self.get_events() | \
- Gdk.EventMask.VISIBILITY_NOTIFY_MASK | \
- Gdk.EventMask.EXPOSURE_MASK
-
- attr.visual = self.get_visual()
-
- attr.x = rect.x
- attr.y = rect.y
- attr.width = rect.width
- attr.height = rect.height
-
- mask = Gdk.WindowAttributesType.VISUAL | \
- Gdk.WindowAttributesType.X | \
- Gdk.WindowAttributesType.Y
-
- window = Gdk.Window.new(self.get_parent_window(), attr, mask)
- window.set_user_data(self)
-
- self.set_window(window)
-
- for widget in (self._media_view, self._controls_hbox):
- widget.set_parent_window(window)
-
- self.queue_resize()
-
- # GTK+ contains on exit if remove is not implemented
- def do_remove(self, widget):
- pass
-
- def do_size_request(self, req):
- # always request 320x240 (as a minimum for video)
- req.width = 320
- req.height = 240
-
- self._media_view.size_request()
-
- w, h = self._controls_hbox.size_request()
-
- # add on height requested by controls hbox
- if self._controls_hbox_height == 0:
- self._controls_hbox_height = h
-
- req.height += self._controls_hbox_height
-
- @staticmethod
- def _constrain_4_3(width, height):
- if (width % 4 == 0) and (height % 3 == 0) and ((width / 4) * 3) == height:
- return width, height # nothing to do
-
- ratio = 4.0 / 3.0
- if ratio * height > width:
- width = (width / 4) * 4
- height = int(width / ratio)
-
- else:
- height = (height / 3) * 3
- width = int(ratio * height)
-
- return width, height
-
- @staticmethod
- def _center_in_plane(plane_size, size):
-
- return (plane_size - size) / 2
-
- def do_size_allocate(self, allocation):
-
- self.allocation = allocation
-
- # give the controls hbox the height that it requested
- remaining_height = self.allocation.height - self._controls_hbox_height
-
- # give the mediaview the rest, constrained to 4/3 and centered
- media_view_width, media_view_height = self._constrain_4_3(self.allocation.width, remaining_height)
- media_view_x = self._center_in_plane(self.allocation.width, media_view_width)
- media_view_y = self._center_in_plane(remaining_height, media_view_height)
-
- if self._show_title:
- # position the controls hbox at the top of the window
- # and the same width as the media view
- controls_box_y = 0
- # put the mediaview after the title
- media_view_y = media_view_y + self._controls_hbox_height
-
- else:
- # position hbox at the bottom of the window,
- # with the requested height,
- # and the same width as the media view
- controls_box_y = self.allocation.height - self._controls_hbox_height
-
- # send allocation to mediaview
- alloc = Gdk.Rectangle()
- alloc.width = media_view_width
- alloc.height = media_view_height
- alloc.x = media_view_x
- alloc.y = media_view_y
- self._media_view.size_allocate(alloc)
-
- alloc = Gdk.Rectangle()
- alloc.x = media_view_x
- alloc.y = controls_box_y
- alloc.width = media_view_width
- alloc.height = self._controls_hbox_height
- self._controls_hbox.size_allocate(alloc)
-
- if self.get_state_flags() & self.get_realized():
- self.get_property('window').move_resize(*allocation)
-
- # FIXME: TypeError: do_forall() takes exactly 4 arguments (3 given)
- #def do_forall(self, include_internals, callback, data):
- # for widget in (self._media_view, self._controls_hbox):
- # callback(widget, data)'''
def set_title_visible(self, visible):