本文整理汇总了Python中gi.repository.GdkX11.x11_get_server_time方法的典型用法代码示例。如果您正苦于以下问题:Python GdkX11.x11_get_server_time方法的具体用法?Python GdkX11.x11_get_server_time怎么用?Python GdkX11.x11_get_server_time使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gi.repository.GdkX11
的用法示例。
在下文中一共展示了GdkX11.x11_get_server_time方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: button_press
# 需要导入模块: from gi.repository import GdkX11 [as 别名]
# 或者: from gi.repository.GdkX11 import x11_get_server_time [as 别名]
def button_press(self, terminal, event):
"""Handles the button press event in the terminal widget. If
any match string is caught, another aplication is open to
handle the matched resource uri.
"""
self.matched_value = ''
matched_string = self.match_check(
int(event.x / self.get_char_width()),
int(event.y / self.get_char_height()))
value, tag = matched_string
if event.button == 1 \
and event.get_state() & Gdk.ModifierType.CONTROL_MASK \
and value:
if TERMINAL_MATCH_TAGS[tag] == 'schema':
# value here should not be changed, it is right and
# ready to be used.
pass
elif TERMINAL_MATCH_TAGS[tag] == 'http':
value = 'http://%s' % value
elif TERMINAL_MATCH_TAGS[tag] == 'email':
value = 'mailto:%s' % value
Gtk.show_uri(self.get_screen(), value,
GdkX11.x11_get_server_time(self.get_window()))
elif event.button == 3 and matched_string:
self.matched_value = matched_string[0]
示例2: getXTime
# 需要导入模块: from gi.repository import GdkX11 [as 别名]
# 或者: from gi.repository.GdkX11 import x11_get_server_time [as 别名]
def getXTime(self):
try:
time = GdkX11.x11_get_server_time(self.get_window())
except:
time = 0
return time
示例3: __map_event_cb
# 需要导入模块: from gi.repository import GdkX11 [as 别名]
# 或者: from gi.repository.GdkX11 import x11_get_server_time [as 别名]
def __map_event_cb(self, window, event):
# have to make the desktop window active
# since metacity doesn't make it on startup
timestamp = event.get_time()
x11_window = self.get_window()
if not timestamp:
timestamp = GdkX11.x11_get_server_time(x11_window)
x11_window.focus(timestamp)
示例4: get_server_time
# 需要导入模块: from gi.repository import GdkX11 [as 别名]
# 或者: from gi.repository.GdkX11 import x11_get_server_time [as 别名]
def get_server_time(widget):
try:
return GdkX11.x11_get_server_time(widget.get_window())
except (TypeError, AttributeError):
# Issue: https://github.com/Guake/guake/issues/1071
# Wayland does not seem to like `x11_get_server_time`.
# Use local timestamp instead
return get_local_timestamp()
示例5: main
# 需要导入模块: from gi.repository import GdkX11 [as 别名]
# 或者: from gi.repository.GdkX11 import x11_get_server_time [as 别名]
def main(argv):
# No arg list, pass out help
if len(argv) == 0:
printHelp()
sys.exit(2)
buff = 20
try:
opts, args = getopt.getopt(argv,"hudlrb:v")
except getopt.GetoptError as err:
printHelp()
sys.exit(2)
direction = ""
verbose = False
for opt, arg in opts:
if opt == "-h":
printHelp()
sys.exit()
elif opt == "-u":
direction = "UP"
elif opt == "-d":
direction = "DOWN"
elif opt == "-l":
direction = "LEFT"
elif opt == "-r":
direction = "RIGHT"
elif opt == "-b":
buff = int(arg)
elif opt == "-v":
verbose = True
# Grab window list and geo
Gtk.init([]) # necessary if not using a Gtk.main() loop
screen = Wnck.Screen.get_default()
screen.force_update() # recommended per Wnck documentation
window_list = screen.get_windows()
active_window = screen.get_active_window()
workspace_id = screen.get_active_workspace().get_number()
if len(window_list) > 0:
window = findWindow( direction, window_list, workspace_id, active_window, buff, verbose )
else:
print( "Empty window list!" )
sys.exit(2)
if window != None:
now = GdkX11.x11_get_server_time(Gdk.get_default_root_window())
window.activate(now)
window = None
screen = None
Wnck.shutdown()
示例6: _activateCb
# 需要导入模块: from gi.repository import GdkX11 [as 别名]
# 或者: from gi.repository.GdkX11 import x11_get_server_time [as 别名]
def _activateCb(self, unused_app):
if self.gui:
# The app is already started and the window already created.
# Present the already existing window.
# TODO: Use present() instead of present_with_time() when
# https://bugzilla.gnome.org/show_bug.cgi?id=688830 is fixed.
x11_server_time = GdkX11.x11_get_server_time(self.gui.get_window())
self.gui.present_with_time(x11_server_time)
# No need to show the welcome wizard.
return
self.createMainWindow()
self.welcome_wizard = StartUpWizard(self)
self.welcome_wizard.show()
示例7: on_window_losefocus
# 需要导入模块: from gi.repository import GdkX11 [as 别名]
# 或者: from gi.repository.GdkX11 import x11_get_server_time [as 别名]
def on_window_losefocus(self, window, event):
if self.slide_effect_running:
return
if ConfigManager.disable_losefocus_temporary:
return
if not ConfigManager.get_conf('losefocus-hiding'):
return
if self.get_property('visible'):
self.losefocus_time = GdkX11.x11_get_server_time(self.get_window())
if ConfigManager.get_conf('use-animation'):
self.slide_up()
self.unrealize()
self.hide()
示例8: reveal
# 需要导入模块: from gi.repository import GdkX11 [as 别名]
# 或者: from gi.repository.GdkX11 import x11_get_server_time [as 别名]
def reveal(self):
""" Make window active
In contrast with present(), brings window to the top
even after invoking on response on non-gtk events.
See #1423.
"""
window = self.get_window()
if window is None:
self.show()
return
timestamp = Gtk.get_current_event_time()
if not timestamp:
timestamp = GdkX11.x11_get_server_time(window)
window.focus(timestamp)
示例9: reveal
# 需要导入模块: from gi.repository import GdkX11 [as 别名]
# 或者: from gi.repository.GdkX11 import x11_get_server_time [as 别名]
def reveal(self):
"""
Make window active.
Brings the window to the top and makes it active, even after
invoking on response to non-GTK events (in contrast to
present()). See bug #1423
"""
window = self.get_window()
if window is None:
self.show()
return
timestamp = Gtk.get_current_event_time()
if not timestamp:
timestamp = GdkX11.x11_get_server_time(window)
window.focus(timestamp)
示例10: present
# 需要导入模块: from gi.repository import GdkX11 [as 别名]
# 或者: from gi.repository.GdkX11 import x11_get_server_time [as 别名]
def present(self):
"""A version of present that also works if not called from an event
handler (there is no active input event).
See https://bugzilla.gnome.org/show_bug.cgi?id=688830
"""
try:
from gi.repository import GdkX11
except ImportError:
super(Window, self).present()
else:
window = self.get_window()
if window and isinstance(window, GdkX11.X11Window):
timestamp = GdkX11.x11_get_server_time(window)
self.present_with_time(timestamp)
else:
super(Window, self).present()
示例11: on_hide_window
# 需要导入模块: from gi.repository import GdkX11 [as 别名]
# 或者: from gi.repository.GdkX11 import x11_get_server_time [as 别名]
def on_hide_window(self, data=None):
"""Handle a request to hide/show the window"""
if not self.get_property('visible'):
#Don't show if window has just been hidden because of
#lost focus
if (time.time() - self.losefocus_time < 0.1) and \
self.config['hide_on_lose_focus']:
return
if self.position:
self.move(self.position[0], self.position[1])
self.show()
self.grab_focus()
try:
t = GdkX11.x11_get_server_time(self.get_window())
except (TypeError, AttributeError):
t = 0
self.get_window().focus(t)
else:
self.position = self.get_position()
self.hidefunc()
示例12: show_hide
# 需要导入模块: from gi.repository import GdkX11 [as 别名]
# 或者: from gi.repository.GdkX11 import x11_get_server_time [as 别名]
def show_hide(self):
if self.slide_effect_running:
return
event_time = self.hotkey.get_current_event_time()
if(self.losefocus_time and self.losefocus_time >= event_time):
return
if self.get_visible():
if ConfigManager.get_conf('use-animation'):
self.slide_up()
else:
self.hide()
return
else:
self.update_ui()
self.show()
x11_win = self.get_window()
x11_time = GdkX11.x11_get_server_time(x11_win)
x11_win.focus(x11_time)
if ConfigManager.get_conf('use-animation'):
self.slide_down()
示例13: on_button_release
# 需要导入模块: from gi.repository import GdkX11 [as 别名]
# 或者: from gi.repository.GdkX11 import x11_get_server_time [as 别名]
def on_button_release(self, widget, event):
self.get_container().active_terminal = self
self.matched_value = ''
matched_string = self.vte.match_check(int(event.x / self.vte.get_char_width()), int(event.y / self.vte.get_char_height()))
value, tag = matched_string
if event.button == 3:
self.menu = Gtk.Menu()
self.menu.connect('deactivate', lambda w: setattr(ConfigManager, 'disable_losefocus_temporary', False))
if value:
self.menu_open_link = Gtk.MenuItem(_("Open Link"))
self.menu_open_link.connect("activate", lambda w: Gtk.show_uri(self.get_screen(), value, GdkX11.x11_get_server_time(self.get_window())))
self.menu.append(self.menu_open_link)
self.menu_copy_link = Gtk.MenuItem(_("Copy Link Address"))
self.menu_copy_link.connect("activate", lambda w: Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD).set_text(value, -1))
self.menu.append(self.menu_copy_link)
self.menu.append(Gtk.SeparatorMenuItem.new())
else:
self.menu_copy = Gtk.MenuItem(_("Copy"))
self.menu_copy.connect("activate", lambda w: self.vte.copy_clipboard())
self.menu.append(self.menu_copy)
self.menu_paste = Gtk.MenuItem(_("Paste"))
self.menu_paste.connect("activate", lambda w: self.vte.paste_clipboard())
self.menu.append(self.menu_paste)
self.menu_select_all = Gtk.MenuItem(_("Select All"))
self.menu_select_all.connect("activate", lambda w: self.vte.select_all())
self.menu.append(self.menu_select_all)
self.menu.append(Gtk.SeparatorMenuItem.new())
self.menu_v_split = Gtk.MenuItem(_("Split Vertical"))
self.menu_v_split.connect("activate", self.split_axis, 'h')
self.menu.append(self.menu_v_split)
self.menu_h_split = Gtk.MenuItem(_("Split Horizontal"))
self.menu_h_split.connect("activate", self.split_axis, 'v')
self.menu.append(self.menu_h_split)
self.term_menu = Gtk.Menu()
self.term = Gtk.MenuItem(_("Terminals"))
self.term.set_submenu(self.term_menu)
self.menu_new = Gtk.MenuItem(_("New Terminal"))
self.submenu_item_connect_hack(self.menu_new, self.new_app, self.menu_new)
self.set_new_prog = Gtk.MenuItem(_("Set ProgName"))
self.submenu_item_connect_hack(self.set_new_prog, self.save_progname, self.set_new_prog)
self.reset_prog = Gtk.MenuItem(_("Reset Default Progname"))
self.submenu_item_connect_hack(self.reset_prog, self.reset_progname, self.reset_prog)
self.term_menu.append(self.menu_new)
self.term_menu.append(self.set_new_prog)
self.term_menu.append(self.reset_prog)
self.menu.append(self.term)
self.menu_new = Gtk.MenuItem(_("Save Configuration"))
self.menu_new.connect("activate", self.save_conf)
self.menu.append(self.menu_new)
self.menu_close = Gtk.MenuItem(_("Close"))
self.menu_close.connect("activate", self.close_node)
self.menu.append(self.menu_close)
self.menu.append(Gtk.SeparatorMenuItem.new())
self.menu_preferences = Gtk.MenuItem(_("Preferences"))
self.menu_preferences.connect("activate", self.open_preferences)
self.menu.append(self.menu_preferences)
self.menu_quit = Gtk.MenuItem(_("Quit"))
self.menu_quit.connect("activate", lambda w: self.get_toplevel().exit())
self.menu.append(self.menu_quit)
self.menu.show_all()
ConfigManager.disable_losefocus_temporary = True
self.menu.popup(None, None, None, None, event.button, event.time)
elif value:
Gtk.show_uri(self.get_screen(), value, GdkX11.x11_get_server_time(self.get_window()))
示例14: init_ui
# 需要导入模块: from gi.repository import GdkX11 [as 别名]
# 或者: from gi.repository.GdkX11 import x11_get_server_time [as 别名]
#.........这里部分代码省略.........
self.global_key.set_text(ConfigManager.get_conf('global-key'))
key_entries.append(self.global_key)
self.select_all_key = builder.get_object('select_all_key')
self.select_all_key.set_text(ConfigManager.get_conf('select-all-key'))
key_entries.append(self.select_all_key)
self.copy_key = builder.get_object('copy_key')
self.copy_key.set_text(ConfigManager.get_conf('copy-key'))
key_entries.append(self.copy_key)
self.paste_key = builder.get_object('paste_key')
self.paste_key.set_text(ConfigManager.get_conf('paste-key'))
key_entries.append(self.paste_key)
self.split_v_key = builder.get_object('split_v_key')
self.split_v_key.set_text(ConfigManager.get_conf('split-v-key'))
key_entries.append(self.split_v_key)
self.split_h_key = builder.get_object('split_h_key')
self.split_h_key.set_text(ConfigManager.get_conf('split-h-key'))
key_entries.append(self.split_h_key)
self.close_node_key = builder.get_object('close_node_key')
self.close_node_key.set_text(ConfigManager.get_conf('close-node-key'))
key_entries.append(self.close_node_key)
self.move_up_key = builder.get_object('move_up_key')
self.move_up_key.set_text(ConfigManager.get_conf('move-up-key'))
key_entries.append(self.move_up_key)
self.move_down_key = builder.get_object('move_down_key')
self.move_down_key.set_text(ConfigManager.get_conf('move-down-key'))
key_entries.append(self.move_down_key)
self.restore_defaults = builder.get_object('restore_defaults')
self.restore_defaults.connect('clicked', lambda w: self.restore_defaults_cb())
self.move_left_key = builder.get_object('move_left_key')
self.move_left_key.set_text(ConfigManager.get_conf('move-left-key'))
key_entries.append(self.move_left_key)
self.move_right_key = builder.get_object('move_right_key')
self.move_right_key.set_text(ConfigManager.get_conf('move-right-key'))
key_entries.append(self.move_right_key)
self.toggle_scrollbars_key = builder.get_object('toggle_scrollbars_key')
self.toggle_scrollbars_key.set_text(ConfigManager.get_conf('toggle-scrollbars-key'))
key_entries.append(self.toggle_scrollbars_key)
self.chk_run_on_startup = builder.get_object('chk_run_on_startup')
self.chk_run_on_startup.set_active(os.path.exists(os.environ['HOME'] + '/.config/autostart/terra.desktop'))
self.open_translation_page = builder.get_object('open_translation_page')
self.open_translation_page.connect('clicked', lambda w: Gtk.show_uri(self.window.get_screen(), 'https://translations.launchpad.net/terra', GdkX11.x11_get_server_time(self.window.get_window())))
self.report_bug = builder.get_object('report_bug')
self.report_bug.connect('clicked', lambda w: Gtk.show_uri(self.window.get_screen(), 'https://github.com/Sixdsn/terra-terminal/issues', GdkX11.x11_get_server_time(self.window.get_window())))
self.webpage = builder.get_object('webpage')
self.webpage.connect('clicked', lambda w: Gtk.show_uri(self.window.get_screen(), 'http://terraterminal.org', GdkX11.x11_get_server_time(self.window.get_window())))
self.entry_scrollback_lines = builder.get_object('entry_scrollback_lines')
self.entry_scrollback_lines.set_text(str(ConfigManager.get_conf('scrollback-lines')))
self.chk_scrollback_unlimited = builder.get_object('chk_scrollback_unlimited')
self.chk_scrollback_unlimited.connect('toggled', lambda w: self.toggle_sensitive(self.chk_scrollback_unlimited, [self.entry_scrollback_lines]))
self.chk_scrollback_unlimited.set_active(ConfigManager.get_conf('infinite-scrollback'))
self.chk_scroll_on_output = builder.get_object('chk_scroll_on_output')
self.chk_scroll_on_output.set_active(ConfigManager.get_conf('scroll-on-output'))
self.chk_scroll_on_keystroke = builder.get_object('chk_scroll_on_keystroke')
self.chk_scroll_on_keystroke.set_active(ConfigManager.get_conf('scroll-on-keystroke'))
self.chk_hide_tab_bar = builder.get_object('chk_hide_tab_bar')
self.chk_hide_tab_bar.set_active(ConfigManager.get_conf('hide-tab-bar'))
self.chk_hide_tab_bar_fullscreen = builder.get_object('chk_hide_tab_bar_fullscreen')
self.chk_hide_tab_bar_fullscreen.set_active(ConfigManager.get_conf('hide-tab-bar-fullscreen'))
self.chk_prompt_on_quit = builder.get_object('chk_prompt_on_quit')
self.chk_prompt_on_quit.set_active(ConfigManager.get_conf('prompt-on-quit'))
self.spawn_term_on_last_close = builder.get_object('spawn-term-on-last-close')
self.spawn_term_on_last_close.set_active(ConfigManager.get_conf('spawn-term-on-last-close'))
self.entry_step_count = builder.get_object('entry_step_count')
self.entry_step_count.set_text(str(ConfigManager.get_conf('step-count')))
self.entry_step_time = builder.get_object('entry_step_time')
self.entry_step_time.set_text(str(ConfigManager.get_conf('step-time')))
self.chk_use_animation = builder.get_object('chk_use_animation')
self.chk_use_animation.set_active(ConfigManager.get_conf('use-animation'))
self.chk_use_animation.connect('toggled', lambda w: self.toggle_sensitive(self.chk_use_animation, [self.entry_step_time, self.entry_step_count]))
for key_entry in key_entries:
key_entry.connect('button-press-event', self.clear_key_entry)
key_entry.connect('key-press-event', self.generate_key_string)
示例15: layout_done
# 需要导入模块: from gi.repository import GdkX11 [as 别名]
# 或者: from gi.repository.GdkX11 import x11_get_server_time [as 别名]
def layout_done(self):
"""Layout operations have finished, record that fact"""
self.doing_layout = False
maker = Factory()
window_last_active_term_mapping = {}
for window in self.windows:
if window.is_child_notebook():
source = window.get_toplevel().get_children()[0]
else:
source = window
window_last_active_term_mapping[window] = copy.copy(source.last_active_term)
for terminal in self.terminals:
if not terminal.pid:
terminal.spawn_child()
for window in self.windows:
if window.is_child_notebook():
# For windows with a notebook
notebook = window.get_toplevel().get_children()[0]
# Cycle through pages by number
for page in xrange(0, notebook.get_n_pages()):
# Try and get the entry in the previously saved mapping
mapping = window_last_active_term_mapping[window]
page_last_active_term = mapping.get(notebook.get_nth_page(page), None)
if page_last_active_term is None:
# Couldn't find entry, so we find the first child of type Terminal
children = notebook.get_nth_page(page).get_children()
for page_last_active_term in children:
if maker.isinstance(page_last_active_term, 'Terminal'):
page_last_active_term = page_last_active_term.uuid
break
else:
err('Should never reach here!')
page_last_active_term = None
if page_last_active_term is None:
# Bail on this tab as we're having no luck here, continue with the next
continue
# Set the notebook entry, then ensure Terminal is visible and focussed
urn = page_last_active_term.urn
notebook.last_active_term[notebook.get_nth_page(page)] = page_last_active_term
if urn:
term = self.find_terminal_by_uuid(urn)
if term:
term.ensure_visible_and_focussed()
else:
# For windows without a notebook ensure Terminal is visible and focussed
if window_last_active_term_mapping[window]:
term = self.find_terminal_by_uuid(window_last_active_term_mapping[window].urn)
term.ensure_visible_and_focussed()
# Build list of new windows using prelayout list
new_win_list = []
for window in self.windows:
if window not in self.prelayout_windows:
new_win_list.append(window)
# Make sure all new windows get bumped to the top
for window in new_win_list:
window.show()
window.grab_focus()
try:
t = GdkX11.x11_get_server_time(window.get_window())
except (TypeError, AttributeError):
t = 0
window.get_window().focus(t)
# Awful workaround to be sure that the last focused window is actually the one focused.
# Don't ask, don't tell policy on this. Even this is not 100%
if self.last_active_window:
window = self.find_window_by_uuid(self.last_active_window.urn)
count = 0
while count < 1000 and Gtk.events_pending():
count += 1
Gtk.main_iteration_do(False)
window.show()
window.grab_focus()
try:
t = GdkX11.x11_get_server_time(window.get_window())
except (TypeError, AttributeError):
t = 0
window.get_window().focus(t)
self.prelayout_windows = None