当前位置: 首页>>代码示例>>Python>>正文


Python Keybinder.get_current_event_time方法代码示例

本文整理汇总了Python中gi.repository.Keybinder.get_current_event_time方法的典型用法代码示例。如果您正苦于以下问题:Python Keybinder.get_current_event_time方法的具体用法?Python Keybinder.get_current_event_time怎么用?Python Keybinder.get_current_event_time使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gi.repository.Keybinder的用法示例。


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

示例1: on_activate

# 需要导入模块: from gi.repository import Keybinder [as 别名]
# 或者: from gi.repository.Keybinder import get_current_event_time [as 别名]
 def on_activate(self, app):
     '''
     This method will activate the window, most of the time.
     This method gets called when the application is first run, so it needs
     to check if the hide flag was specified, if it was, it won't actually
     activate the window, and it won't populate the window with any data.
     The reason for this is because the data that needs to be displayed is
     inside a collection, which may be locked, asking the user for a
     password on login, which is when by default the application is run,
     will be an unintuitive experience. The password may be in the 'Login'
     keyring, in which case the collection will be unlocked automatically,
     but we can't rely on that, and so the data is only unlocked and loaded
     when the application is first shown. This will slow the first show a
     bit, but if the password to unlock the collection is required, the user
     will know why that popup asking for a password is showing.
     Also when the collection is first unlock, and the user doesn't input
     the correct password, or just cancels the popup, there will be
     different behaviour depending on whether the application was run
     initially hidden or not. We feel it's best to return the window to the
     previous state to deliver a more intuitive experience to the user.
     So if the window is hidden, then it's shown, and needs a password to
     unlock the collection, if that password query fails, it returns to
     being hidden. If the application is being started without the hide flag
     and a password query fails, then the application is shutdown.
     '''
     if self.hide_flag:
         self.hide_flag = False
         return
     # If the collection wasn't created quit
     if not self.main_view.secret.collection:
         self.quit()
         return
     if self.main_view.secret.unlock():
         # The app can start hidden to speed up showing it later,
         # but I wouldn't want to ask for a collection password right after
         # the user logs in, particularly because the collection would be
         # locked and the user would have to input the password again later
         # when showing the window. So I populate the buttons on the first
         # show instead. I also set the started_hidden flag, this makes the
         # app never quit when coming from hiding and the unlock fails,
         # it will just keep hidden.
         if self.first_run:
             self.first_run = False
             self.started_hidden = True
             self.main_view.init_buttons()
         self.window.show()
         if platform.system() == 'Windows':
             current_event_time = 0
         else:
             current_event_time = Keybinder.get_current_event_time()
         # This line will produce warnings on journalctl when passman
         # is activated without using the keyboard shortcut.
         # This happens because Gtk doesn't set this as the current event,
         # and so we have no object to get the time from.
         self.window.get_window().focus(current_event_time)
     else:
         # If the application starts hidden, I prefer to return the app to
         # the previous state, hidden, instead of quitting.
         if not self.started_hidden:
             self.quit()
开发者ID:gbtami,项目名称:passman,代码行数:62,代码来源:application.py

示例2: hide_app

# 需要导入模块: from gi.repository import Keybinder [as 别名]
# 或者: from gi.repository.Keybinder import get_current_event_time [as 别名]
    def hide_app(self, key_bind_hide, user_data):
        self.last_event_time = Keybinder.get_current_event_time()
        print("Event time:", self.last_event_time)

        self.wnck.force_update()
        self.active_workspace = self.wnck.get_active_workspace()
        # 		print("Workspaces:", self.wnck.get_workspaces())
        # 		print("Active workspace:", self.active_workspace)
        # 		print("Last active workspace:", self.last_active_workspace)
        #
        if self.is_present:
            print("Hiding app")
            if self.parent.is_drop_down:
                self.hide()
            else:
                self.iconify()
            self.is_present = False

        else:
            print("Showing app")
            if self.parent.is_drop_down:
                if self.last_active_workspace != self.active_workspace:
                    self.last_active_workspace = self.active_workspace
                    self.hide()

                self.show()
            # 				self.present()
            # 				self.set_icon_from_file(config.file_program_icon)

            self.present_with_time(self.last_event_time)
            self.main_box.active_term.grab_focus()
            self.is_present = True
开发者ID:keiwop,项目名称:test_gtk3_terminal,代码行数:34,代码来源:nameless_main_window.py

示例3: relay_key

# 需要导入模块: from gi.repository import Keybinder [as 别名]
# 或者: from gi.repository.Keybinder import get_current_event_time [as 别名]
def relay_key(key):
    print("Relaying", key)
    time = keybinder.get_current_event_time()
    s_id = "kupfer-%d_TIME%s" % (os.getpid(), time)
    bus = dbus.Bus()
    obj = bus.get_object(SERV, OBJ, introspect=False)
    iface = dbus.Interface(obj, IFACE)
    iface.RelayKeysFromDisplay(key, os.getenv("DISPLAY", ":0"), s_id)
开发者ID:engla,项目名称:kupfer,代码行数:10,代码来源:keyrelay.py

示例4: show_window

# 需要导入模块: from gi.repository import Keybinder [as 别名]
# 或者: from gi.repository.Keybinder import get_current_event_time [as 别名]
    def show_window(self):
        # works only when the following methods are called in that exact order
        self.position_window()
        self.window.set_sensitive(True)
        self.window.present()
        if not is_wayland_compatibility_on():
            self.present_with_time(Keybinder.get_current_event_time())

        if not self.input.get_text():
            # make sure frequent apps are shown if necessary
            self.show_results([])
        elif self.settings.get_property('clear-previous-query'):
            self.input.set_text('')
        else:
            self.input.grab_focus()
开发者ID:Ulauncher,项目名称:Ulauncher,代码行数:17,代码来源:UlauncherWindow.py

示例5: callback

# 需要导入模块: from gi.repository import Keybinder [as 别名]
# 或者: from gi.repository.Keybinder import get_current_event_time [as 别名]
def callback(keystr, user_data):
    print ("Handling", user_data)
    print ("Event time:", Keybinder.get_current_event_time())
    Gtk.main_quit()
开发者ID:aking1012,项目名称:keybinder,代码行数:6,代码来源:example-gi-py3.py

示例6: get_current_event_time

# 需要导入模块: from gi.repository import Keybinder [as 别名]
# 或者: from gi.repository.Keybinder import get_current_event_time [as 别名]
def get_current_event_time():
    "Return current event time as given by keybinder"
    if Keybinder is None:
        return 0
    return Keybinder.get_current_event_time()
开发者ID:engla,项目名称:kupfer,代码行数:7,代码来源:keybindings.py

示例7: _keybinding

# 需要导入模块: from gi.repository import Keybinder [as 别名]
# 或者: from gi.repository.Keybinder import get_current_event_time [as 别名]
 def _keybinding(self, target):
     time = Keybinder.get_current_event_time()
     self.emit("keybinding", target, "", time)
开发者ID:engla,项目名称:kupfer,代码行数:5,代码来源:keybindings.py


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