Python gi.repository.Gtk 模块,get_current_event_time() 实例源码

我们从Python开源项目中,提取了以下25个代码示例,用于说明如何使用gi.repository.Gtk.get_current_event_time()

项目:sc-controller    作者:kozec    | 项目源码 | 文件源码
def show_context_menu(self, for_id):
        """ Sets sensitivity of popup menu items and displays it on screen """
        mnuPopup = self.builder.get_object("mnuPopup")
        mnuCopy = self.builder.get_object("mnuCopy")
        mnuClear = self.builder.get_object("mnuClear")
        mnuPaste = self.builder.get_object("mnuPaste")
        mnuEPress = self.builder.get_object("mnuEditPress")
        mnuEPressS = self.builder.get_object("mnuEditPressSeparator")
        self.context_menu_for = for_id
        clp = Gtk.Clipboard.get_default(Gdk.Display.get_default())
        mnuCopy.set_sensitive(bool(self.get_action(self.current, for_id)))
        mnuClear.set_sensitive(bool(self.get_action(self.current, for_id)))
        mnuPaste.set_sensitive(clp.wait_is_text_available())
        mnuEPress.set_visible(for_id in STICKS + PADS)
        mnuEPressS.set_visible(mnuEPress.get_visible())

        mnuPopup.popup(None, None, None, None,
            3, Gtk.get_current_event_time())
项目:poseidon    作者:sidus-dev    | 项目源码 | 文件源码
def vte_menu(widget):

    menu = Gtk.Menu()

    copy = Gtk.ImageMenuItem.new_from_stock("gtk-copy", None)
    copy.connect("activate", lambda x: widget.copy_clipboard())

    paste = Gtk.ImageMenuItem.new_from_stock("gtk-paste", None)
    paste.connect("activate", lambda x: widget.paste_clipboard())

    menu.append(copy)
    menu.append(paste)

    menu.show_all()
    menu.popup(None, None, None, None, 0, Gtk.get_current_event_time())

    return True
项目:king-phisher-plugins    作者:securestate    | 项目源码 | 文件源码
def signal_tv_button_pressed(self, _, event):
        if event.button == Gdk.BUTTON_SECONDARY:
            selected_tasks = self._get_selected_tasks()
            if not selected_tasks:
                self.menu_item_cancel.set_sensitive(False)
                self.menu_item_paused.set_sensitive(False)
            else:
                self.menu_item_cancel.set_sensitive(True)
                self.menu_item_paused.set_sensitive(True)
                tasks_are_paused = [task.state == 'Paused' for task in selected_tasks]
                if any(tasks_are_paused):
                    self.menu_item_paused.set_active(True)
                    self.menu_item_paused.set_inconsistent(not all(tasks_are_paused))
                else:
                    self.menu_item_paused.set_active(False)
                    self.menu_item_paused.set_inconsistent(False)
            self.popup_menu.popup(None, None, None, None, event.button, Gtk.get_current_event_time())
            return True
        return
项目:sc-controller    作者:kozec    | 项目源码 | 文件源码
def on_profile_right_clicked(self, ps):
        for name in ("mnuConfigureController", "mnuTurnoffController"):
            # Disable controller-related menu items if controller is not connected
            obj = self.builder.get_object(name)
            obj.set_sensitive(ps.get_controller() is not None)

        for name in ("mnuProfileNew", "mnuProfileCopy", "mnuProfileRename",
                    "mnuProfileDetails", "mnuProfileSeparator1",
                    "mnuProfileSeparator2"):
            # Hide profile-related menu items for all but 1st profile switcher
            obj = self.builder.get_object(name)
            obj.set_visible(ps == self.profile_switchers[0])

        if ps == self.profile_switchers[0]:
            name = ps.get_profile_name()
            is_override = profile_is_override(name)
            is_default = profile_is_default(name)
            self.builder.get_object("mnuProfileDelete").set_visible(not is_default)
            self.builder.get_object("mnuProfileRevert").set_visible(is_override)
            self.builder.get_object("mnuProfileRename").set_visible(not is_default)
        else:
            self.builder.get_object("mnuProfileDelete").set_visible(False)
            self.builder.get_object("mnuProfileRevert").set_visible(False)

        mnuPS = self.builder.get_object("mnuPS")
        mnuPS.ps = ps
        mnuPS.popup(None, None, None, None,
            3, Gtk.get_current_event_time())
项目:sc-controller    作者:kozec    | 项目源码 | 文件源码
def on_area_click(self, trash, what):
        stDialog = self.builder.get_object("stDialog")
        pages = stDialog.get_children()
        index = pages.index(stDialog.get_visible_child())
        if index == 2:
            if what in STICK_PAD_AREAS:
                area_name, axes = STICK_PAD_AREAS[what]
                mnuStick = self.builder.get_object("mnuStick")
                mnuStick._what = what
                mnuStick._axes = [ self._axis_data[index] for index in axes ]
                mnuStick.popup(None, None, None, None, 1, Gtk.get_current_event_time())
            elif what in TRIGGER_AREAS:
                self._grabber = TriggerGrabber(self, self._axis_data[TRIGGER_AREAS[what]])
            elif hasattr(SCButtons, what):
                self._grabber = InputGrabber(self, getattr(SCButtons, what))
项目:sc-controller    作者:kozec    | 项目源码 | 文件源码
def pressEvent(self, keys):
        for k in keys:
            event = Gdk.Event.new(Gdk.EventType.KEY_PRESS)
            event.time = Gtk.get_current_event_time()
            event.hardware_keycode = KEY_TO_KEYCODE[k]
            event.keyval = KEY_TO_GDK[k]
            event.window = self.mapper.target_window
            event.set_device(self.device)
            Gtk.main_do_event(event)
项目:sc-controller    作者:kozec    | 项目源码 | 文件源码
def releaseEvent(self, keys=[]):
        for k in keys:
            event = Gdk.Event.new(Gdk.EventType.KEY_RELEASE)
            event.time = Gtk.get_current_event_time()
            event.hardware_keycode = KEY_TO_KEYCODE[k]
            event.keyval = KEY_TO_GDK[k]
            event.window = self.mapper.target_window
            event.set_device(self.device)
            Gtk.main_do_event(event)
项目:budgie-extras    作者:UbuntuBudgie    | 项目源码 | 文件源码
def popup_menu(self, *args):
        self.popup.popup(None, None, None, None, 0,
                         Gtk.get_current_event_time())
项目:Ebook-Viewer    作者:michaldaniel    | 项目源码 | 文件源码
def show_menu(self):
        """
        Displays right click context menu
        """
        if self.content_provider.status:
            self.menu.popup(None, None, None, None, 0, Gtk.get_current_event_time())
项目:Ebook-Viewer    作者:michaldaniel    | 项目源码 | 文件源码
def __on_properties_clicked(self, button):
        """
        Handles settings button clicked event and displays context menu
        :param button:
        """
        self.__menu.popup(None, button, None, button, 0, Gtk.get_current_event_time())
项目:Solfege    作者:RannyeriDev    | 项目源码 | 文件源码
def popup_alsa_connection_list(self, widget):
        connection_list = soundcard.alsa_sequencer.get_connection_list()
        if connection_list:
            menu = Gtk.Menu()
            for clientid, portid, clientname, portname, labeltext in connection_list:
                item = Gtk.MenuItem(labeltext)
                menu.append(item)

                def ff(widget, clientid, portid):
                    self.g_alsa_device.set_label(widget.get_child().get_text())
                    self.m_gui_client_port = (clientid, portid)
                    self.g_alsa_radio.set_active(True)
                item.connect('activate', ff, clientid, portid)
            menu.show_all()
            menu.popup(None, None, None, None, 0, Gtk.get_current_event_time())
项目:PyFlowChart    作者:steelcowboy    | 项目源码 | 文件源码
def file_clicked(self, widget):
        self.main_menu.popup( None, None, None, None, 0, Gtk.get_current_event_time())
项目:PyFlowChart    作者:steelcowboy    | 项目源码 | 文件源码
def settings_clicked(self, widget):
        self.settings_menu.popup( None, None, None, None, 0, Gtk.get_current_event_time())
项目:PyFlowChart    作者:steelcowboy    | 项目源码 | 文件源码
def help_clicked(self, widget):
        self.help_menu.popup( None, None, None, None, 0, Gtk.get_current_event_time())
项目:XFWM_theme_creator    作者:Sjc1000    | 项目源码 | 文件源码
def show_menu(self, widget, event):
        """show_menu
        Shows the right click menu of the current item.
        """
        button = event.button
        if button == 3 and self.active != None:
            self.menu.show_all()
            self.menu.popup(None, None, None, None, 0, Gtk.get_current_event_time())
        return None
项目:poseidon    作者:sidus-dev    | 项目源码 | 文件源码
def url_entry_menu(widget):

    menu = Gtk.Menu()

    cut = Gtk.ImageMenuItem.new_from_stock("gtk-cut", None)
    cut.connect("activate", lambda x: widget.cut_clipboard())

    copy = Gtk.ImageMenuItem.new_from_stock("gtk-copy", None)
    copy.connect("activate", lambda x: widget.copy_clipboard())

    paste = Gtk.ImageMenuItem.new_from_stock("gtk-paste", None)
    paste.connect("activate", lambda x: widget.paste_clipboard())

    pastego = Gtk.ImageMenuItem.new_with_mnemonic(_("_Paste & Go"))
    pastego.set_image(Gtk.Image.new_from_stock("gtk-paste", Gtk.IconSize.MENU))
    pastego.connect("activate", lambda x: on_pastego(widget))

    delete = Gtk.ImageMenuItem.new_from_stock("gtk-delete", None)
    delete.connect("activate", lambda x: widget.delete_selection())

    select = Gtk.ImageMenuItem.new_from_stock("gtk-select-all", None)
    select.connect("activate", lambda x: widget.select_region(0, -1))

    menu.append(cut)
    menu.append(copy)
    menu.append(paste)
    menu.append(pastego)
    menu.append(delete)
    menu.append(Gtk.SeparatorMenuItem.new())
    menu.append(select)

    menu.show_all()
    menu.popup(None, None, None, None, 0, Gtk.get_current_event_time())

    return True
项目:ridinghood    作者:Aeva    | 项目源码 | 文件源码
def __call__(self, tab):
        self.tab = tab
        self.menu.show_all()
        self.menu.popup(None, None, None, None, 0, Gtk.get_current_event_time())
项目:ridinghood    作者:Aeva    | 项目源码 | 文件源码
def __call__(self, universe):
        self.universe = universe
        self.menu.show_all()
        self.menu.popup(None, None, None, None, 0, Gtk.get_current_event_time())
项目:king-phisher-plugins    作者:securestate    | 项目源码 | 文件源码
def signal_tv_button_press(self, _, event):
        if event.button == Gdk.BUTTON_SECONDARY:
            _, treeiter = self.treeview.get_selection().get_selected()
            sensitive = treeiter is not None
            for menu_item in self._menu_items_req_selection:
                menu_item.set_sensitive(sensitive)
            self.popup_menu.popup(None, None, None, None, event.button, Gtk.get_current_event_time())
            return True
        return
项目:cozy    作者:geigi    | 项目源码 | 文件源码
def Raise(self):
        self.__app.window.setup_window()
        self.__app.window.present_with_time(Gtk.get_current_event_time())
项目:x-mario-center    作者:fossasia    | 项目源码 | 文件源码
def on_keyboard_clicked(self, button, menu):
        menu.popup(None, None, self.menu_positionner, (button, None), 1,
            Gtk.get_current_event_time())
项目:x-mario-center    作者:fossasia    | 项目源码 | 文件源码
def on_keyboard_clicked(self, button, menu):
        menu.popup(None, None, self.menu_positionner, (button, None), 1,
            Gtk.get_current_event_time())
项目:dockyard    作者:maidstone-hackspace    | 项目源码 | 文件源码
def listbox_row_activated(self, listbox, listboxrow):
        """ docker container has been selected so open terminal """
        self.current_container_id = listboxrow.get_name()
        self.current_container_info = get_container_info(self.current_container_id)

        self.menu.show_all()
        self.menu.popup(None, None, None, None, 0, Gtk.get_current_event_time())
项目:dockyard    作者:maidstone-hackspace    | 项目源码 | 文件源码
def popup_menu(self, widget, event):
        print 'menu'
        if event.button == 3:
            print 'Right Click'
            self.menu.show_all()
            self.menu.popup(None, None, None, None, 0, Gtk.get_current_event_time())
项目:nba-appindicator    作者:AdeleD    | 项目源码 | 文件源码
def open_browser(self, gameinfo_url):
        Gtk.show_uri(
            Gdk.Screen.get_default(),
            gameinfo_url,
            Gtk.get_current_event_time()
        )