本文整理汇总了Python中lollypop.pop_next.NextPopover.set_position方法的典型用法代码示例。如果您正苦于以下问题:Python NextPopover.set_position方法的具体用法?Python NextPopover.set_position怎么用?Python NextPopover.set_position使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lollypop.pop_next.NextPopover
的用法示例。
在下文中一共展示了NextPopover.set_position方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: FullScreen
# 需要导入模块: from lollypop.pop_next import NextPopover [as 别名]
# 或者: from lollypop.pop_next.NextPopover import set_position [as 别名]
class FullScreen(Gtk.Window, InfosController,
PlaybackController, ProgressController):
"""
Show a fullscreen window showing current track context
"""
def __init__(self, app, parent):
"""
Init window and set transient for parent
@param app as Gio.Application
@param parent as Gtk.window
"""
Gtk.Window.__init__(self)
PlaybackController.__init__(self)
ProgressController.__init__(self)
self.set_application(app)
self._timeout1 = None
self._timeout2 = None
self._seeking = False
self._signal1_id = None
self._signal2_id = None
self.set_decorated(False)
builder = Gtk.Builder()
builder.add_from_resource('/org/gnome/Lollypop/FullScreen.ui')
builder.connect_signals(self)
# Calculate cover size
screen = Gdk.Screen.get_default()
monitor = screen.get_primary_monitor()
geometry = screen.get_monitor_geometry(monitor)
# We want 500 and 200 in full hd
if geometry.width > geometry.height:
artsize = int(ArtSize.MONSTER*geometry.width/1920)
else:
artsize = int(ArtSize.MONSTER*geometry.height/1920)
InfosController.__init__(self, artsize)
self._play_btn = builder.get_object('play_btn')
self._next_btn = builder.get_object('next_btn')
self._prev_btn = builder.get_object('prev_btn')
self._next_popover = NextPopover()
self._next_popover.set_position(Gtk.PositionType.BOTTOM)
self._play_image = builder.get_object('play_image')
self._pause_image = builder.get_object('pause_image')
close_btn = builder.get_object('close_btn')
close_btn.connect('clicked', self._destroy)
self._cover = builder.get_object('cover')
self._cover_frame = builder.get_object('frame')
self._title_label = builder.get_object('title')
self._artist_label = builder.get_object('artist')
self._album_label = builder.get_object('album')
self._datetime = builder.get_object('datetime')
self._progress = builder.get_object('progress_scale')
self._timelabel = builder.get_object('playback')
self._total_time_label = builder.get_object('duration')
self.connect('key-release-event', self._on_key_release_event)
self.add(builder.get_object('widget'))
def do_show(self):
"""
Init signals, set color and go party mode if nothing is playing
"""
self._signal1_id = Lp().player.connect('current-changed',
self.on_current_changed)
self._signal2_id = Lp().player.connect('status-changed',
self.on_status_changed)
if Lp().player.current_track.id is None:
Lp().player.set_party(True)
else:
self.on_status_changed(Lp().player)
self.on_current_changed(Lp().player)
if self._timeout1 is None:
self._timeout1 = GLib.timeout_add(1000, self._update_position)
Gtk.Window.do_show(self)
now = datetime.now()
self._datetime.set_label(now.strftime('%a %d %b, %X')[:-3])
if self._timeout2 is None:
second = datetime.now().second
if 60 - second > 0:
GLib.timeout_add((60-second)*1000, self._update_datetime)
else:
self._timeout2 = GLib.timeout_add(60000, self._update_datetime)
self._update_position()
self.fullscreen()
self._next_popover.set_relative_to(self._album_label)
if Lp().player.next_track.id != Type.RADIOS:
self._next_popover.show()
def do_hide(self):
"""
Remove signals and unset color
"""
Gtk.Window.do_hide(self)
if self._signal1_id is not None:
Lp().player.disconnect(self._signal1_id)
self._signal1_id = None
if self._signal2_id is not None:
Lp().player.disconnect(self._signal2_id)
#.........这里部分代码省略.........
示例2: FullScreen
# 需要导入模块: from lollypop.pop_next import NextPopover [as 别名]
# 或者: from lollypop.pop_next.NextPopover import set_position [as 别名]
class FullScreen(Gtk.Window):
"""
Show a fullscreen window showing current track context
"""
def __init__(self, app, parent):
"""
Init window and set transient for parent
@param app as Gio.Application
@param parent as Gtk.window
"""
Gtk.Window.__init__(self)
self.set_application(app)
self._timeout1 = None
self._timeout2 = None
self._seeking = False
self._signal1_id = None
self._signal2_id = None
self.set_decorated(False)
builder = Gtk.Builder()
builder.add_from_resource('/org/gnome/Lollypop/FullScreen.ui')
builder.connect_signals(self)
# Calculate cover size
screen = Gdk.Screen.get_default()
monitor = screen.get_primary_monitor()
geometry = screen.get_monitor_geometry(monitor)
# We want 500 and 200 in full hd
if geometry.width > geometry.height:
self._artsize = int(ArtSize.MONSTER*geometry.width/1920)
else:
self._artsize = int(ArtSize.MONSTER*geometry.height/1920)
self._play_btn = builder.get_object('play_btn')
self._next_btn = builder.get_object('next_btn')
self._prev_btn = builder.get_object('prev_btn')
self._next_popover = NextPopover()
self._next_popover.set_position(Gtk.PositionType.BOTTOM)
self._play_image = builder.get_object('play_image')
self._pause_image = builder.get_object('pause_image')
close_btn = builder.get_object('close_btn')
close_btn.connect('clicked', self._destroy)
self._cover = builder.get_object('cover')
self._title = builder.get_object('title')
self._artist = builder.get_object('artist')
self._album = builder.get_object('album')
self._datetime = builder.get_object('datetime')
self._progress = builder.get_object('progress_scale')
self._timelabel = builder.get_object('playback')
self._total_time_label = builder.get_object('duration')
self.connect('key-release-event', self._on_key_release_event)
self.add(builder.get_object('widget'))
def do_show(self):
"""
Init signals, set color and go party mode if nothing is playing
"""
is_playing = Lp().player.is_playing()
self._signal1_id = Lp().player.connect('current-changed',
self._on_current_changed)
self._signal2_id = Lp().player.connect('status-changed',
self._on_status_changed)
if Lp().player.current_track is None:
Lp().player.set_party(True)
else:
if is_playing:
self._change_play_btn_status(self._pause_image, _('Pause'))
else:
self._on_status_changed(Lp().player)
self._on_current_changed(Lp().player)
if self._timeout1 is None:
self._timeout1 = GLib.timeout_add(1000, self._update_position)
Gtk.Window.do_show(self)
now = datetime.now()
self._datetime.set_label(now.strftime('%a %d %b, %X')[:-3])
if self._timeout2 is None:
second = datetime.now().second
if 60 - second > 0:
GLib.timeout_add((60-second)*1000, self._update_datetime)
else:
self._timeout2 = GLib.timeout_add(60000, self._update_datetime)
self._update_position()
self.fullscreen()
self._next_popover.set_relative_to(self._album)
if Lp().player.next_track.id != Type.RADIOS:
self._next_popover.show()
def do_hide(self):
"""
Remove signals and unset color
"""
Gtk.Window.do_hide(self)
if self._signal1_id is not None:
Lp().player.disconnect(self._signal1_id)
self._signal1_id = None
if self._signal2_id is not None:
Lp().player.disconnect(self._signal2_id)
self._signal2_id = None
#.........这里部分代码省略.........