本文整理汇总了Python中foobnix.helpers.image.ImageBase.set_from_pixbuf方法的典型用法代码示例。如果您正苦于以下问题:Python ImageBase.set_from_pixbuf方法的具体用法?Python ImageBase.set_from_pixbuf怎么用?Python ImageBase.set_from_pixbuf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类foobnix.helpers.image.ImageBase
的用法示例。
在下文中一共展示了ImageBase.set_from_pixbuf方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: CoverLyricsPanel
# 需要导入模块: from foobnix.helpers.image import ImageBase [as 别名]
# 或者: from foobnix.helpers.image.ImageBase import set_from_pixbuf [as 别名]
class CoverLyricsPanel(Gtk.Frame):
def __init__(self, controls):
Gtk.Frame.__init__(self)
self.controls = controls
self.set_size_request(100, 200)
self.album_title = Gtk.Label(_("Album title"))
self.set_label_align(0.5, 0.5)
self.image = ImageBase(ICON_BLANK_DISK, size=FC().info_panel_image_size)
self.image.set_from_pixbuf(self.get_pixbuf())
image_frame = FrameDecorator(_("Cover"), self.image, 0.5, 0.5)
self.lyrics = TextArea()
lyrics_frame = FrameDecorator(_("Lyric"), self.lyrics, 0.5, 0.5)
vbox = Gtk.Box.new(Gtk.Orientation.VERTICAL, 5)
vbox.pack_start(image_frame, False, False, 0)
vbox.pack_start(lyrics_frame, True, True, 0)
self.add(vbox)
self.set_label_widget(self.album_title)
self.show_all()
def get_pixbuf(self):
return self.controls.perspectives.get_perspective('info').get_widget().image.pixbuf
def set_cover(self):
self.image.size = FC().info_panel_image_size
self.image.set_from_pixbuf(self.get_pixbuf())
示例2: CoverLyricsPanel
# 需要导入模块: from foobnix.helpers.image import ImageBase [as 别名]
# 或者: from foobnix.helpers.image.ImageBase import set_from_pixbuf [as 别名]
class CoverLyricsPanel(gtk.Frame):
def __init__(self, controls):
gtk.Frame.__init__(self)
vbox = gtk.VBox(False, 5)
self.controls = controls
self.album_title = gtk.Label(_("Album title"))
image_size = FC().main_window_size[2] - (FC().hpaned_right + 16)
self.image = ImageBase(ICON_BLANK_DISK, size=image_size)
image_frame = gtk.Frame()
image_frame.add(self.image)
image_frame.set_label_widget(gtk.Label(_("Cover:")))
vbox.pack_start(image_frame, False)
self.lyrics = TextArea()
lyrics_frame = gtk.Frame()
lyrics_frame.add(self.lyrics)
lyrics_frame.set_label_widget(gtk.Label(_("Lyric:")))
vbox.pack_start(lyrics_frame, True)
self.add(vbox)
self.set_label_widget(self.album_title)
self.show_all()
def get_pixbuf(self):
return self.controls.info_panel.image.pixbuf
def set_cover(self):
pixbuf = self.get_pixbuf()
self.image.set_from_pixbuf(pixbuf)
示例3: CoverLyricsPanel
# 需要导入模块: from foobnix.helpers.image import ImageBase [as 别名]
# 或者: from foobnix.helpers.image.ImageBase import set_from_pixbuf [as 别名]
class CoverLyricsPanel(Gtk.Frame):
def __init__(self, controls):
Gtk.Frame.__init__(self)
vbox = Gtk.VBox(False, 5)
self.controls = controls
self.set_size_request(100, 200)
self.album_title = Gtk.Label(_("Album title"))
image_size = FC().main_window_size[2] - (FC().hpaned_right + 16)
self.image = ImageBase(ICON_BLANK_DISK, size=image_size)
image_frame = Gtk.Frame()
image_frame.add(self.image)
image_frame.set_label_widget(Gtk.Label(_("Cover:")))
vbox.pack_start(image_frame, False, False, 0)
self.lyrics = TextArea()
self.lyrics.connect("size-allocate", self.adapt_image)
lyrics_frame = Gtk.Frame()
lyrics_frame.add(self.lyrics)
lyrics_frame.set_label_widget(Gtk.Label(_("Lyric:")))
vbox.pack_start(lyrics_frame, True, True, 0)
self.add(vbox)
self.set_label_widget(self.album_title)
self.show_all()
def get_pixbuf(self):
return self.controls.perspectives.get_perspective('info').get_widget().image.pixbuf
def set_cover(self):
pixbuf = self.get_pixbuf()
self.image.size = FC().info_panel_image_size
self.image.set_from_pixbuf(pixbuf)
def adapt_image(self, *a):
dif = self.lyrics.get_allocation().width - self.image.get_allocation().width
if self.lyrics.get_property("visible") and dif < 2:
self.image.size = self.lyrics.get_allocation().width - 20
self.image.set_from_pixbuf(self.controls.coverlyrics.get_pixbuf())