• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python wrappermap.wrapper函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中miro.frontends.widgets.gtk.wrappermap.wrapper函数的典型用法代码示例。如果您正苦于以下问题:Python wrapper函数的具体用法?Python wrapper怎么用?Python wrapper使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了wrapper函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: on_net_stop

 def on_net_stop(self, uri):
     if uri in self._downloads:
         path = self._downloads.pop(uri)
         wrappermap.wrapper(self).emit(
             'download-finished', 
             'file://%s' % path.replace(os.sep, '/'))
         return
     wrappermap.wrapper(self).emit('net-stop')
开发者ID:geoffl,项目名称:miro,代码行数:8,代码来源:browser.py


示例2: do_button_release_event

 def do_button_release_event(self, event):
     if event.button != self.drag_button:
         return
     self.in_drag = False
     if (self.is_continuous and
             (0 <= event.x < self.allocation.width) and
             (0 <= event.y < self.allocation.height)):
         wrappermap.wrapper(self).emit('changed', self.get_value())
     wrappermap.wrapper(self).emit('released')
开发者ID:cool-RR,项目名称:Miro,代码行数:9,代码来源:customcontrols.py


示例3: do_button_press_event

 def do_button_press_event(self, event):
     if self.in_drag:
         return
     self.start_value = self.get_value()
     self.in_drag = True
     self.drag_button = event.button
     self.drag_inbounds = True
     self.move_slider_to_mouse(event.x, event.y)
     self.grab_focus()
     wrappermap.wrapper(self).emit('pressed')
开发者ID:cool-RR,项目名称:Miro,代码行数:10,代码来源:customcontrols.py


示例4: do_motion_notify_event

 def do_motion_notify_event(self, event):
     DRAG_THRESHOLD = 15
     if self.button_press_x is None:
         # button not down
         return
     if (self.last_drag_event != 'right' and
             event.x > self.button_press_x + DRAG_THRESHOLD):
         wrappermap.wrapper(self).emit('dragged-right')
         self.last_drag_event = 'right'
     elif (self.last_drag_event != 'left' and
             event.x < self.button_press_x - DRAG_THRESHOLD):
         wrappermap.wrapper(self).emit('dragged-left')
         self.last_drag_event = 'left'
开发者ID:bbucommander,项目名称:miro,代码行数:13,代码来源:customcontrols.py


示例5: on_uri_load

 def on_uri_load(self, uri):
     if wrappermap.wrapper(self).should_download_url(uri):
         parsed = urlparse.urlparse(uri)
         prefix, suffix = os.path.splitext(os.path.basename(parsed.path))
         fd, path = tempfile.mkstemp(suffix=suffix, prefix=prefix)
         os.close(fd)
         self.browser.download_uri(uri, path)
         self._downloads[uri] = path
         return False
     else:
         rv = wrappermap.wrapper(self).should_load_url(uri)
         if rv:
             wrappermap.wrapper(self).url = uri
     return rv
开发者ID:geoffl,项目名称:miro,代码行数:14,代码来源:browser.py


示例6: do_button_press_event

 def do_button_press_event(self, event):
     if self.drag_info is not None:
         return
     current_pos = self.get_slider_pos()
     event_pos = self._event_pos(event)
     pos_difference = abs(current_pos - event_pos)
     # only move the slider if the click was outside its boundaries
     # (#18840)
     if pos_difference > self.slider_size() / 2.0:
         self.move_slider(event_pos)
         current_pos = event_pos
     self.drag_info = _DragInfo(event.button, current_pos, event_pos)
     self.grab_focus()
     wrappermap.wrapper(self).emit('pressed')
开发者ID:CodeforEvolution,项目名称:miro,代码行数:14,代码来源:customcontrols.py


示例7: on_render

    def on_render(self, window, widget, background_area, cell_area, expose_area,
            flags):
        widget_wrapper = wrappermap.wrapper(widget)
        cell_wrapper = wrappermap.wrapper(self)

        selected = (flags & gtk.CELL_RENDERER_SELECTED)
        if selected:
            if widget.flags() & gtk.HAS_FOCUS:
                state = gtk.STATE_SELECTED
            else:
                state = gtk.STATE_ACTIVE
        else:
            state = gtk.STATE_NORMAL
        if cell_wrapper.IGNORE_PADDING:
            area = background_area
        else:
            xpad = self.props.xpad
            ypad = self.props.ypad
            area = gtk.gdk.Rectangle(cell_area.x + xpad, cell_area.y + ypad,
                    cell_area.width - xpad * 2, cell_area.height - ypad * 2)
        context = drawing.DrawingContext(window, area, expose_area)
        if (selected and not widget_wrapper.draws_selection and
                widget_wrapper.use_custom_style):
            # Draw the base color as our background.  This erases the gradient
            # that GTK draws for selected items.
            window.draw_rectangle(widget.style.base_gc[state], True,
                    background_area.x, background_area.y,
                    background_area.width, background_area.height)
        context.style = drawing.DrawingStyle(widget_wrapper,
                use_base_color=True, state=state)
        widget_wrapper.layout_manager.update_cairo_context(context.context)
        hotspot_tracker = widget_wrapper.hotspot_tracker
        if (hotspot_tracker and hotspot_tracker.hit and
                hotspot_tracker.column == self.column and
                hotspot_tracker.path == self.path):
            hotspot = hotspot_tracker.name
        else:
            hotspot = None
        if (self.path, self.column) == widget_wrapper.hover_info:
            hover = widget_wrapper.hover_pos
            hover = (hover[0] - xpad, hover[1] - ypad)
        else:
            hover = None
        # NOTE: CustomCellRenderer.cell_data_func() sets up its attributes
        # from the model itself, so we don't have to worry about setting them
        # here.
        widget_wrapper.layout_manager.reset()
        cell_wrapper.render(context, widget_wrapper.layout_manager, selected,
                hotspot, hover)
开发者ID:bluezone,项目名称:miro,代码行数:49,代码来源:tableviewcells.py


示例8: move_slider_to_mouse

 def move_slider_to_mouse(self, x, y):
     if ((not 0 <= x < self.allocation.width) or
             (not 0 <= y < self.allocation.height)):
         self.handle_drag_out_of_bounds()
         return
     if self.is_horizontal():
         pos = x
         size = self.allocation.width
     else:
         pos = y
         size = self.height
     value = (self.max - self.min) * self.calc_percent(pos, size)
     self.set_value(value)
     wrappermap.wrapper(self).emit('moved', self.get_value())
     if self.is_continuous():
         wrappermap.wrapper(self).emit('changed', self.get_value())
开发者ID:cool-RR,项目名称:Miro,代码行数:16,代码来源:customcontrols.py


示例9: move_slider

    def move_slider(self, new_pos):
        """Move the slider so that it's centered on new_pos."""
        if self.is_horizontal():
            size = self.allocation.width
        else:
            size = self.allocation.height

        slider_size = self.slider_size()
        new_pos -= slider_size / 2
        size -= slider_size
        ratio = max(0, min(1, float(new_pos) / size))
        self.set_value(ratio * (self.max - self.min))

        wrappermap.wrapper(self).emit('moved', self.get_value())
        if self.is_continuous():
            wrappermap.wrapper(self).emit('changed', self.get_value())
开发者ID:CodeforEvolution,项目名称:miro,代码行数:16,代码来源:customcontrols.py


示例10: do_expose_event

 def do_expose_event(self, event):
     wrapper = wrappermap.wrapper(self)
     if self.flags() & gtk.NO_WINDOW:
         drawing_area = self.allocation
     else:
         drawing_area = gtk.gdk.Rectangle(0, 0, 
                 self.allocation.width, self.allocation.height)
     context = DrawingContext(event.window, drawing_area, event.area)
     context.style = DrawingStyle(wrapper)
     if self.flags() & gtk.CAN_FOCUS:
         focus_space = (self.style_get_property('focus-padding') +
                 self.style_get_property('focus-line-width'))
         if not wrapper.squish_width:
             context.width -= focus_space * 2
             translate_x = focus_space
         else:
             translate_x = 0
         if not wrapper.squish_height:
             context.height -= focus_space * 2
             translate_y = focus_space
         else:
             translate_y = 0
         context.translate(translate_x, translate_y)
     wrapper.layout_manager.update_cairo_context(context.context)
     self.draw(wrapper, context)
开发者ID:CodeforEvolution,项目名称:miro,代码行数:25,代码来源:drawing.py


示例11: cell_data_func

 def cell_data_func(self, column, cell, model, it, attr_map):
     item_list = wrappermap.wrapper(model).item_list
     row = model.row_of_iter(it)
     self.info = item_list.get_row(row)
     self.attrs = item_list.get_attrs(self.info.id)
     self.group_info = item_list.get_group_info(row)
     cell.column = column
     cell.path = row
开发者ID:bluezone,项目名称:miro,代码行数:8,代码来源:tableviewcells.py


示例12: on_hierarchy_changed

 def on_hierarchy_changed(self, widget, previous_toplevel):
     toplevel = widget.get_toplevel()
     if not (toplevel.flags() & gtk.TOPLEVEL):
         toplevel = None
     if previous_toplevel != toplevel:
         if self.use_custom_style_callback:
             old_window = wrappermap.wrapper(previous_toplevel)
             old_window.disconnect(self.use_custom_style_callback)
         if toplevel is not None:
             window = wrappermap.wrapper(toplevel)
             callback_id = window.connect("use-custom-style-changed", self.on_use_custom_style_changed)
             self.use_custom_style_callback = callback_id
         else:
             self.use_custom_style_callback = None
         if previous_toplevel is None:
             # Setup our initial state
             self.on_use_custom_style_changed(window)
开发者ID:nxmirrors,项目名称:miro,代码行数:17,代码来源:base.py


示例13: do_key_press_event

 def do_key_press_event(self, event):
     ret = keymap.translate_gtk_event(event)
     if ret == None:
         return gtk.Window.do_key_press_event(self, event)
     key, modifiers = ret
     if wrappermap.wrapper(self).emit('key-press', key, modifiers):
         return # handler returned True, don't process the key more
     return gtk.Window.do_key_press_event(self, event)
开发者ID:cool-RR,项目名称:Miro,代码行数:8,代码来源:window.py


示例14: _on_activate

 def _on_activate(self, menu_item):
     self.emit("activate")
     gtk_menubar = self._find_menubar()
     if gtk_menubar is not None:
         try:
             menubar = wrappermap.wrapper(gtk_menubar)
         except KeyError:
             app.widgetapp.handle_soft_failure("menubar activate", "no wrapper for gtk.MenuBar", with_exception=True)
         else:
             menubar.emit("activate", self.name)
开发者ID:bbucommander,项目名称:miro,代码行数:10,代码来源:gtkmenus.py


示例15: on_get_size

 def on_get_size(self, widget, cell_area=None):
     wrapper = wrappermap.wrapper(self)
     widget_wrapper = wrappermap.wrapper(widget)
     style = drawing.DrawingStyle(widget_wrapper, use_base_color=True)
     # NOTE: CustomCellRenderer.cell_data_func() sets up its attributes
     # from the model itself, so we don't have to worry about setting them
     # here.
     width, height = wrapper.get_size(style, widget_wrapper.layout_manager)
     x_offset = self.props.xpad
     y_offset = self.props.ypad
     width += self.props.xpad * 2
     height += self.props.ypad * 2
     if cell_area:
         x_offset += cell_area.x
         y_offset += cell_area.x
         extra_width = max(0, cell_area.width - width)
         extra_height = max(0, cell_area.height - height)
         x_offset += int(round(self.props.xalign * extra_width))
         y_offset += int(round(self.props.yalign * extra_height))
     return x_offset, y_offset, width, height
开发者ID:bluezone,项目名称:miro,代码行数:20,代码来源:tableviewcells.py


示例16: do_size_request

 def do_size_request(self, requesition):
     wrapper = wrappermap.wrapper(self)
     width, height = wrapper.size_request(wrapper.layout_manager)
     requesition.width = width
     requesition.height = height
     if self.flags() & gtk.CAN_FOCUS:
         focus_space = (self.style_get_property('focus-padding') +
                 self.style_get_property('focus-line-width'))
         if not wrapper.squish_width:
             requesition.width += focus_space * 2
         if not wrapper.squish_height:
             requesition.height += focus_space * 2
开发者ID:CodeforEvolution,项目名称:miro,代码行数:12,代码来源:drawing.py


示例17: change_focus_using_wrapper

 def change_focus_using_wrapper(self, direction):
     my_wrapper = wrappermap.wrapper(self)
     focused_wrapper = self._get_focused_wrapper()
     if direction == gtk.DIR_TAB_FORWARD:
         to_focus = my_wrapper.get_next_tab_focus(focused_wrapper, True)
     elif direction == gtk.DIR_TAB_BACKWARD:
         to_focus = my_wrapper.get_next_tab_focus(focused_wrapper, False)
     else:
         return False
     if to_focus is not None:
         to_focus.focus()
         return True
     return False
开发者ID:codito,项目名称:miro,代码行数:13,代码来源:window.py


示例18: do_key_press_event

    def do_key_press_event(self, event):
        if self.activate_key(event): # event activated a menu item
            return

        if self.propagate_key_event(event): # event handled by widget
            return

        ret = keymap.translate_gtk_event(event)
        if ret is not None:
            key, modifiers = ret
            rv = wrappermap.wrapper(self).emit('key-press', key, modifiers)
            if not rv:
                gtk.Window.do_key_press_event(self, event)
开发者ID:codito,项目名称:miro,代码行数:13,代码来源:window.py


示例19: _get_focused_wrapper

 def _get_focused_wrapper(self):
     """Get the wrapper of the widget with keyboard focus"""
     focused = self.get_focus()
     # some of our widgets created children for their use
     # (GtkSearchTextEntry).  If we don't find a wrapper for
     # focused, try it's parents
     while focused is not None:
         try:
             wrapper = wrappermap.wrapper(focused)
         except KeyError:
             focused = focused.get_parent()
         else:
             return wrapper
     return None
开发者ID:codito,项目名称:miro,代码行数:14,代码来源:window.py


示例20: __init__

 def __init__(self, treeview, event):
     self.treeview = treeview
     self.treeview_wrapper = wrappermap.wrapper(treeview)
     self.hit = False
     self.button = event.button
     path_info = treeview.get_path_at_pos(int(event.x), int(event.y))
     if path_info is None:
         return
     self.path, self.column, background_x, background_y = path_info
     # We always pack 1 renderer for each column
     gtk_renderer = self.column.get_cell_renderers()[0]
     if not isinstance(gtk_renderer, GTKCustomCellRenderer):
         return
     self.renderer = wrappermap.wrapper(gtk_renderer)
     self.attr_map = self.treeview_wrapper.attr_map_for_column[self.column]
     if not rect_contains_point(self.calc_cell_area(), event.x, event.y):
         # Mouse is in the padding around the actual cell area
         return
     self.update_position(event)
     self.iter = treeview.get_model().get_iter(self.path)
     self.name = self.calc_hotspot()
     if self.name is not None:
         self.hit = True
开发者ID:cool-RR,项目名称:Miro,代码行数:23,代码来源:tableview.py



注:本文中的miro.frontends.widgets.gtk.wrappermap.wrapper函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python imagepool.get_surface函数代码示例发布时间:2022-05-27
下一篇:
Python widgetset.Alignment类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap