Exemplo n.º 1
0
    def __init__(
        self,
        wrap_window_type,
        focus_out_callback=None,
        handle_input_method=False,
    ):
        '''
        Initialize PopupGrabWindow class.

        @param wrap_window_type: The type of wrap window to response event.
        @param wrap_window_type: The callback for focus-out signal, default is None.
        @param handle_input_method: Whether handle input method, default is False.
        '''
        # Init.
        gtk.Window.__init__(self, gtk.WINDOW_POPUP)
        self.wrap_window_type = wrap_window_type
        self.focus_out_callback = focus_out_callback
        self.handle_input_method = handle_input_method
        self.in_focus_out_callbacking = False
        self.popup_windows = []
        self.press_flag = False

        if self.handle_input_method:
            self.im = gtk.IMMulticontext()
            self.im.connect("commit", self.input_method_commit)

        invisible_window(self)

        self.connect("button-press-event", self.popup_grab_window_button_press)
        self.connect("button-release-event",
                     self.popup_grab_window_button_release)
        self.connect("motion-notify-event",
                     self.popup_grab_window_motion_notify)
        self.connect("enter-notify-event", self.popup_grab_window_enter_notify)
        self.connect("leave-notify-event", self.popup_grab_window_leave_notify)
        self.connect("scroll-event", self.popup_grab_window_scroll_event)
        self.connect("key-press-event", self.popup_grab_window_key_press)
        self.connect("key-release-event", self.popup_grab_window_key_release)

        self.show()
Exemplo n.º 2
0
 def __init__(self, 
              wrap_window_type,
              focus_out_callback=None,
              handle_input_method=False,
              ):
     '''
     Initialize PopupGrabWindow class.
     
     @param wrap_window_type: The type of wrap window to response event.
     @param wrap_window_type: The callback for focus-out signal, default is None.
     @param handle_input_method: Whether handle input method, default is False.
     '''
     # Init.
     gtk.Window.__init__(self, gtk.WINDOW_POPUP)
     self.wrap_window_type = wrap_window_type
     self.focus_out_callback = focus_out_callback
     self.handle_input_method = handle_input_method
     self.in_focus_out_callbacking = False
     self.popup_windows = []
     self.press_flag = False
     
     if self.handle_input_method:
         self.im = gtk.IMMulticontext()
         self.im.connect("commit", self.input_method_commit)
     
     invisible_window(self)
     
     self.connect("button-press-event", self.popup_grab_window_button_press)
     self.connect("button-release-event", self.popup_grab_window_button_release)
     self.connect("motion-notify-event", self.popup_grab_window_motion_notify)
     self.connect("enter-notify-event", self.popup_grab_window_enter_notify)
     self.connect("leave-notify-event", self.popup_grab_window_leave_notify)
     self.connect("scroll-event", self.popup_grab_window_scroll_event)
     self.connect("key-press-event", self.popup_grab_window_key_press)
     self.connect("key-release-event", self.popup_grab_window_key_release)
     
     self.show()
Exemplo n.º 3
0
from draw import draw_vlinear, draw_text
from keymap import get_keyevent_name
from line import HSeparator
from scrolled_window import ScrolledWindow
from theme import ui_theme
import gobject
import gtk
from utils import (is_in_rect, get_content_size, propagate_expose,
                   get_widget_root_coordinate, get_screen_size,
                   alpha_color_hex_to_cairo, invisible_window,
                   cairo_disable_antialias, color_hex_to_cairo)

__all__ = ["DroplistScrolledWindow", "Droplist", "DroplistItem"]

droplist_grab_window = gtk.Window(gtk.WINDOW_POPUP)
invisible_window(droplist_grab_window)
droplist_grab_window.show()
droplist_active_item = None
droplist_grab_window_press_flag = False

root_droplists = []

def droplist_grab_window_focus_in():
    '''
    Handle `focus-in` signal of droplist_grab_window.
    '''
    droplist_grab_window.grab_add()
    gtk.gdk.pointer_grab(
        droplist_grab_window.window,
        True,
        gtk.gdk.POINTER_MOTION_MASK | gtk.gdk.BUTTON_PRESS_MASK | gtk.gdk.BUTTON_RELEASE_MASK | gtk.gdk.ENTER_NOTIFY_MASK | gtk.gdk.LEAVE_NOTIFY_MASK,
Exemplo n.º 4
0
import gtk
from utils import (
    is_in_rect,
    get_content_size,
    propagate_expose,
    get_widget_root_coordinate,
    get_screen_size,
    invisible_window,
    alpha_color_hex_to_cairo,
    get_window_shadow_size,
)

__all__ = ["Menu", "MenuItem"]

menu_grab_window = gtk.Window(gtk.WINDOW_POPUP)
invisible_window(menu_grab_window)
menu_grab_window.show()
menu_active_item = None

root_menus = []


def menu_grab_window_focus_in():
    menu_grab_window.grab_add()
    gtk.gdk.pointer_grab(
        menu_grab_window.window,
        True,
        gtk.gdk.POINTER_MOTION_MASK
        | gtk.gdk.BUTTON_PRESS_MASK
        | gtk.gdk.BUTTON_RELEASE_MASK
        | gtk.gdk.ENTER_NOTIFY_MASK
Exemplo n.º 5
0
from draw import draw_vlinear, draw_pixbuf, draw_text, draw_hlinear
from line import HSeparator
from theme import ui_theme
from window import Window
from keymap import get_keyevent_name
import gobject
import gtk
from utils import (is_in_rect, get_content_size, propagate_expose,
                   get_widget_root_coordinate, get_screen_size,
                   invisible_window, alpha_color_hex_to_cairo,
                   get_window_shadow_size)

__all__ = ["Menu", "MenuItem"]

menu_grab_window = gtk.Window(gtk.WINDOW_POPUP)
invisible_window(menu_grab_window)
menu_grab_window.show()
menu_active_item = None

root_menus = []


def menu_grab_window_focus_in():
    menu_grab_window.grab_add()
    gtk.gdk.pointer_grab(
        menu_grab_window.window, True, gtk.gdk.POINTER_MOTION_MASK
        | gtk.gdk.BUTTON_PRESS_MASK | gtk.gdk.BUTTON_RELEASE_MASK
        | gtk.gdk.ENTER_NOTIFY_MASK | gtk.gdk.LEAVE_NOTIFY_MASK, None, None,
        gtk.gdk.CURRENT_TIME)

Exemplo n.º 6
0
from draw import draw_vlinear, draw_text
from keymap import get_keyevent_name
from line import HSeparator
from scrolled_window import ScrolledWindow
from theme import ui_theme
import gobject
import gtk
from utils import (is_in_rect, get_content_size, propagate_expose,
                   get_widget_root_coordinate, get_screen_size,
                   alpha_color_hex_to_cairo, invisible_window,
                   cairo_disable_antialias, color_hex_to_cairo)

__all__ = ["DroplistScrolledWindow", "Droplist", "DroplistItem"]

droplist_grab_window = gtk.Window(gtk.WINDOW_POPUP)
invisible_window(droplist_grab_window)
droplist_grab_window.show()
droplist_active_item = None
droplist_grab_window_press_flag = False

root_droplists = []


def droplist_grab_window_focus_in():
    '''
    Handle `focus-in` signal of droplist_grab_window.
    '''
    droplist_grab_window.grab_add()
    gtk.gdk.pointer_grab(
        droplist_grab_window.window, True, gtk.gdk.POINTER_MOTION_MASK
        | gtk.gdk.BUTTON_PRESS_MASK | gtk.gdk.BUTTON_RELEASE_MASK