def show(self):
self._window.show_all()
self._window.maximize()
self._window.get_window().focus(Gdk.CURRENT_TIME)
self._window.present_with_time(Gdk.CURRENT_TIME)
grab_focus = True
if (
self._search_box.entry.get_text() or
common.SETTINGS[common.FOCUS_SEARCH_ON_OPEN]
):
self._search_box.entry.grab_focus()
grab_focus = False
self._items_view.select_first(grab_focus=grab_focus)
python类CURRENT_TIME的实例源码
def show( self ):
self.window.present()
# Hack for opacity not showing on first composited draw
if self.firstTime:
self.firstTime = False
self.window.set_opacity(1.0)
self.window.get_window().focus( Gdk.CURRENT_TIME )
for plugin in self.plugins.values():
if hasattr( plugin, "onShowMenu" ):
plugin.onShowMenu()
if ( "applications" in self.plugins ) and ( hasattr( self.plugins["applications"], "focusSearchEntry" ) ):
if (self.startWithFavorites):
self.plugins["applications"].changeTab(0)
self.plugins["applications"].focusSearchEntry()
def clicked(self, widget):
display = widget.get_display()
if not self.teaching:
if (Gtk.MAJOR_VERSION, Gtk.MINOR_VERSION) >= (3, 20):
seat = display.get_default_seat()
seat.grab(widget.get_window(), Gdk.SeatCapabilities.KEYBOARD, False,
None, None, None, None)
else:
Gdk.keyboard_grab(self.get_window(), False, Gdk.CURRENT_TIME)
self.button.set_label(_("Pick an accelerator"))
self.event_id = self.connect( "key-release-event", self.on_key_release )
self.teaching = True
else:
if self.event_id:
self.disconnect(self.event_id)
self.ungrab(display)
self.set_button_text()
self.teaching = False
def show():
item = get_history_item_for_clipboard()
if not item:
_current_window = EMPTY_WINDOW
else:
_current_window = PREVIEW_WINDOW
_current_window.set_item(item)
_current_window.show_all()
_current_window.maximize()
_current_window.get_window().focus(Gdk.CURRENT_TIME)
_current_window.present_with_time(Gdk.CURRENT_TIME)
def show_preferences():
def on_destroy(window):
global _window
_window = None
global _window
if not _window:
_window = Preferences()
_window.connect('destroy', on_destroy)
_window.show_all()
_window.get_window().focus(Gdk.CURRENT_TIME)
_window.present_with_time(Gdk.CURRENT_TIME)
def show( self ):
for plugin in list(self.plugins.values()):
if hasattr( plugin, "onShowMenu" ):
plugin.onShowMenu()
self.window.present()
self.window.get_window().focus( Gdk.CURRENT_TIME )
for plugin in list(self.plugins.values()):
if hasattr( plugin, "changeTab" ):
plugin.changeTab( 0 )
Gdk.flush()
def clicked(self, widget):
if not self.teaching:
Gdk.keyboard_grab(self.get_window(), False, Gdk.CURRENT_TIME)
self.button.set_label(_("Pick an accelerator"))
self.event_id = self.connect( "key-release-event", self.on_key_release )
self.teaching = True
else:
if self.event_id:
self.disconnect(self.event_id)
self.ungrab()
self.set_button_text()
self.teaching = False
def ungrab(self):
Gdk.keyboard_ungrab(Gdk.CURRENT_TIME)
def on_edit_log(self, action, parameter):
filename = Settings().get_timelog_file()
uri = GLib.filename_to_uri(filename, None)
self.create_if_missing(filename)
Gtk.show_uri(None, uri, Gdk.CURRENT_TIME)
def on_edit_tasks(self, action, parameter):
gsettings = Gio.Settings.new("org.gtimelog")
if gsettings.get_boolean('remote-task-list'):
uri = gsettings.get_string('task-list-edit-url')
if self.get_active_window() is not None:
self.get_active_window().editing_remote_tasks = True
else:
filename = Settings().get_task_list_file()
self.create_if_missing(filename)
uri = GLib.filename_to_uri(filename, None)
Gtk.show_uri(None, uri, Gdk.CURRENT_TIME)
def on_help(self, action, parameter):
if HELP_URI:
uri = HELP_URI
else:
filename = os.path.join(HELP_DIR, 'C', 'index.page')
uri = 'ghelp:' + GLib.filename_to_uri(filename, None).partition(':')[-1]
Gtk.show_uri(None, uri, Gdk.CURRENT_TIME)
def show_uri(parent, uri, timestamp=None):
if timestamp is None:
timestamp = Gdk.CURRENT_TIME
Gtk.show_uri_on_window(parent, uri, timestamp)
def show_uri(parent, uri, timestamp=None):
if timestamp is None:
timestamp = Gdk.CURRENT_TIME
Gtk.show_uri(None, uri, timestamp)
def ungrab(self, display):
if (Gtk.MAJOR_VERSION, Gtk.MINOR_VERSION) >= (3, 20):
seat = display.get_default_seat()
seat.ungrab()
else:
Gdk.keyboard_ungrab(Gdk.CURRENT_TIME)