本文整理汇总了Python中stage.Stage.transition_out方法的典型用法代码示例。如果您正苦于以下问题:Python Stage.transition_out方法的具体用法?Python Stage.transition_out怎么用?Python Stage.transition_out使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类stage.Stage
的用法示例。
在下文中一共展示了Stage.transition_out方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ScreensaverManager
# 需要导入模块: from stage import Stage [as 别名]
# 或者: from stage.Stage import transition_out [as 别名]
#.........这里部分代码省略.........
return
if status.Locked and self.stage.initialize_pam():
self.stage.raise_unlock_widget()
self.grab_helper.release_mouse()
self.stage.maybe_update_layout()
else:
GObject.idle_add(self.idle_deactivate)
def idle_deactivate(self):
self.set_active(False)
return False
def spawn_stage(self, away_message, effect_time=c.STAGE_SPAWN_TRANSITION, callback=None):
"""
Create the Stage and begin fading it in. This may run quickly, in the case of
user-initiated activation, or slowly, when the session has gone idle.
"""
try:
self.stage = Stage(self.screen, self, away_message)
self.stage.transition_in(effect_time, callback)
except Exception:
print("Could not spawn screensaver stage:\n")
traceback.print_exc()
self.grab_helper.release()
status.Active = False
self.cancel_timers()
def despawn_stage(self, effect_time=c.STAGE_DESPAWN_TRANSITION, callback=None):
"""
Begin destruction of the stage.
"""
self.stage.cancel_unlocking()
self.stage.transition_out(effect_time, callback)
def on_spawn_stage_complete(self):
"""
Called after the stage has faded in. All user events are now
redirected to GrabHelper, our status is updated, our active timer
is started, and emit an active-changed signal (Which is listened to
by our ConsoleKit client if we're using it, and our own ScreensaverService.)
"""
self.grab_stage()
status.Active = True
self.emit("active-changed", True)
self.start_timers()
def on_despawn_stage_complete(self):
"""
Called after the stage has faded out - the stage is destroyed, our status
is updated, timer is canceled and active-changed is fired.
"""
was_active = status.Active == True
status.Active = False
if was_active:
self.emit("active-changed", False)
self.cancel_timers()
self.stage.destroy_stage()
self.stage = None
示例2: ScreensaverManager
# 需要导入模块: from stage import Stage [as 别名]
# 或者: from stage.Stage import transition_out [as 别名]
#.........这里部分代码省略.........
def get_active_time(self):
if self.activated_timestamp != 0:
return int(time.time() - self.activated_timestamp)
else:
return 0
def simulate_user_activity(self):
if not status.Active:
return
if status.Locked:
self.stage.raise_unlock_widget()
self.grab_helper.release_mouse()
else:
self.set_active(False)
self.stage.maybe_update_layout()
#####
def spawn_stage(self, away_message, effect_time=c.STAGE_SPAWN_TRANSITION, callback=None):
try:
self.stage = Stage(self.screen, self, away_message)
self.stage.transition_in(effect_time, callback)
except Exception:
print("Could not spawn screensaver stage:\n")
traceback.print_exc()
self.grab_helper.release()
status.Active = False
self.cancel_timers()
def despawn_stage(self, effect_time=c.STAGE_DESPAWN_TRANSITION, callback=None):
self.stage.transition_out(effect_time, callback)
def on_spawn_stage_complete(self):
self.grab_stage()
status.Active = True
self.emit("active-changed", True)
self.start_timers()
def on_despawn_stage_complete(self):
was_active = status.Active == True
status.Active = False
if was_active:
self.emit("active-changed", False)
self.cancel_timers()
self.stage.destroy_stage()
self.stage = None
def grab_stage(self):
self.grab_helper.move_to_window(self.stage.get_window(), True)
def start_timers(self):
self.activated_timestamp = time.time()
self.start_lock_delay()
def cancel_timers(self):
self.activated_timestamp = 0
self.stop_lock_delay()