コード例 #1
0
def get_borders(window):
    """
    Returns the left, right, top and bottem border width in pixel from
    the specified window.
    """
    border_list = window.property_get(gdk.atom_intern("_NET_FRAME_EXTENTS"))[2]
    return ([border_list[0], border_list[1], border_list[2], border_list[3]])
コード例 #2
0
def get_workarea():
    """
    List with x-offset, y-offset, width and height in pixel of the first desktop
    workarea relative to the root window.
    TODO: take not the first, but the current desktop (right now, all
    desktops are the same size, so it doesn't bother me)
    """
    root_win = gdk.get_default_root_window()
    win_property = gdk.atom_intern("_NET_WORKAREA")
    wa_list = root_win.property_get(win_property)[2]
    return ([wa_list[0], wa_list[1], wa_list[2], wa_list[3]])
コード例 #3
0
ファイル: adjbases.py プロジェクト: deepenmhrj/mypaint
 def drag_data_get_cb(self, widget, context, selection, target_type, time):
     """Gets the current color when a drop happens somewhere"""
     if "application/x-color" not in map(str, context.list_targets()):
         return False
     color = self.get_managed_color()
     data = gui.uicolor.to_drag_data(color)
     selection.set(gdk.atom_intern("application/x-color", False), 16, data)
     logger.debug("drag-data-get: sending type=%r",
                  selection.get_data_type())
     logger.debug("drag-data-get: sending fmt=%r", selection.get_format())
     logger.debug("drag-data-get: sending data=%r len=%r",
                  selection.get_data(), len(selection.get_data()))
     return True
コード例 #4
0
ファイル: adjbases.py プロジェクト: gwojcik/mypaint
 def drag_data_get_cb(self, widget, context, selection, target_type,
                      time):
     """Gets the current color when a drop happens somewhere"""
     if "application/x-color" not in map(str, context.list_targets()):
         return False
     color = self.get_managed_color()
     data = color.to_drag_data()
     selection.set(gdk.atom_intern("application/x-color", False),
                   16, data)
     logger.debug("drag-data-get: sending type=%r", selection.get_data_type())
     logger.debug("drag-data-get: sending fmt=%r", selection.get_format())
     logger.debug("drag-data-get: sending data=%r len=%r",
                  selection.get_data(), len(selection.get_data()))
     return True
コード例 #5
0
ファイル: pulseaudio_util.py プロジェクト: rudresh2319/Xpra
def get_x11_property(atom_name):
    if sys.platform.startswith("win"):
        return ""
    try:
        from gtk import gdk
        root = gdk.get_default_root_window()
        pulse_server_atom = gdk.atom_intern(atom_name)
        p = root.property_get(pulse_server_atom)
        if p is None:
            return ""
        v = p[2]
        log("%s=%s", atom_name, v)
        return v
    except:
        return ""
コード例 #6
0
ファイル: pulseaudio_util.py プロジェクト: Brainiarc7/xpra
def get_x11_property(atom_name):
    if sys.platform.startswith("win"):
        return ""
    try:
        from gtk import gdk
        root = gdk.get_default_root_window()
        pulse_server_atom = gdk.atom_intern(atom_name)
        p = root.property_get(pulse_server_atom)
        if p is None:
            return ""
        v = p[2]
        debug("get_x11_property(%s)=%s", atom_name, v)
        return v
    except:
        return ""
コード例 #7
0
def get_x11_property(atom_name):
    from xpra.os_util import WIN32, OSX
    if WIN32 or OSX:
        return ""
    try:
        from gtk import gdk
        root = gdk.get_default_root_window()
        atom = gdk.atom_intern(atom_name)
        p = root.property_get(atom)
        if p is None:
            return ""
        v = p[2]
        log("get_x11_property(%s)=%s", atom_name, v)
        return v
    except:
        return ""
コード例 #8
0
ファイル: docklayout.py プロジェクト: dieterv/etk.docking
    def on_widget_drag_drop(self, widget, context, x, y, timestamp):
        self.log.debug('drag_drop %s %s %s %s', context, x, y, timestamp)

        if DRAG_TARGET_ITEM_LIST[0] in context.targets:
            drag_data = self._drag_data

            if drag_data and drag_data.drop_widget:
                target = gdk.atom_intern(DRAG_TARGET_ITEM_LIST[0])
                drag_data.drop_widget.drag_get_data(context, target, timestamp)
                return True

            # act as if drag failed:
            source = context.get_source_widget()
            source.emit('drag-failed', context, 1)
            cleanup(source, self)

        return False
コード例 #9
0
ファイル: docklayout.py プロジェクト: danyeaw/etk.docking
    def on_widget_drag_drop(self, widget, context, x, y, timestamp):
        self.log.debug('drag_drop %s %s %s %s', context, x, y, timestamp)

        if DRAG_TARGET_ITEM_LIST[0] in context.targets:
            drag_data = self._drag_data

            if drag_data and drag_data.drop_widget:
                target = gdk.atom_intern(DRAG_TARGET_ITEM_LIST[0])
                drag_data.drop_widget.drag_get_data(context, target, timestamp)
                return True

            # act as if drag failed:
            source = context.get_source_widget()
            source.emit('drag-failed', context, 1)
            cleanup(source, self)

        return False
コード例 #10
0
ファイル: dockgroup.py プロジェクト: danyeaw/etk.docking
    def do_drag_data_get(self, context, selection_data, info, timestamp):
        '''
        :param context: the gdk.DragContext
        :param selection_data: a gtk.SelectionData object
        :param info: an integer ID for the drag
        :param timestamp: the time of the drag event

        The do_drag_data_get() signal handler is executed when a drag operation
        completes that copies data or when a drag drop occurs using the
        gdk.DRAG_PROTO_ROOTWIN protocol. The drag source executes this
        handler when the drag destination requests the data using the
        drag_get_data() method. This handler needs to fill selection_data
        with the data in the format specified by the target associated with
        info.

        For tab movement, here the tab is removed from the group. If the
        drop fails, the tab is restored in do_drag_failed().

        For group movement, no special action is taken.
        '''
        # Set some data so the DnD process continues
        selection_data.set(gdk.atom_intern(DRAG_TARGET_ITEM_LIST[0]), 8,
                           '%d tabs' % len(self.dragcontext.dragged_object))
コード例 #11
0
    def do_drag_data_get(self, context, selection_data, info, timestamp):
        """
        :param context: the gdk.DragContext
        :param selection_data: a gtk.SelectionData object
        :param info: an integer ID for the drag
        :param timestamp: the time of the drag event

        The do_drag_data_get() signal handler is executed when a drag operation
        completes that copies data or when a drag drop occurs using the
        gdk.DRAG_PROTO_ROOTWIN protocol. The drag source executes this
        handler when the drag destination requests the data using the
        drag_get_data() method. This handler needs to fill selection_data
        with the data in the format specified by the target associated with
        info.

        For tab movement, here the tab is removed from the group. If the
        drop fails, the tab is restored in do_drag_failed().

        For group movement, no special action is taken.
        """
        # Set some data so the DnD process continues
        selection_data.set(
            gdk.atom_intern(DRAG_TARGET_ITEM_LIST[0]), 8, "%d tabs" % len(self.dragcontext.dragged_object)
        )