class TSongInfo(TestCase): def setUp(self): self.info = SongInfo(SongLibrary(), NullPlayer(), "") def test_ctr(self): pass def tearDown(self): self.info.destroy()
class TSongInfo(TestCase): def setUp(self): init_fake_app() fd, self.filename = mkstemp() os.close(fd) self.info = SongInfo(SongLibrary(), NullPlayer(), self.filename) def test_save(self): fake_edit = FakePatternEdit() self.info._on_set_pattern(None, fake_edit, app.player) with open(self.filename, "r") as f: contents = f.read() self.failUnlessEqual(contents, SOME_PATTERN + "\n") def tearDown(self): destroy_fake_app() self.info.destroy() os.unlink(self.filename)
def __init__(self, parent, player, library): super(TopBar, self).__init__() # play controls control_item = Gtk.ToolItem() self.insert(control_item, 0) t = PlayControls(player, library.librarian) self.volume = t.volume # only restore the volume in case it is managed locally, otherwise # this could affect the system volume if not player.has_external_volume: player.volume = config.getfloat("memory", "volume") connect_destroy(player, "notify::volume", self._on_volume_changed) control_item.add(t) self.insert(Gtk.SeparatorToolItem(), 1) info_item = Gtk.ToolItem() self.insert(info_item, 2) info_item.set_expand(True) box = Gtk.Box(spacing=6) info_item.add(box) qltk.add_css(self, "GtkToolbar {padding: 3px;}") self._pattern_box = Gtk.VBox() # song text info_pattern_path = os.path.join(quodlibet.get_user_dir(), "songinfo") text = SongInfo(library.librarian, player, info_pattern_path) self._pattern_box.pack_start(Align(text, border=3), True, True, 0) box.pack_start(self._pattern_box, True, True, 0) # cover image self.image = CoverImage(resize=True) connect_destroy(player, 'song-started', self.__new_song) # FIXME: makes testing easier if app.cover_manager: connect_destroy( app.cover_manager, 'cover-changed', self.__song_art_changed, library) box.pack_start(Align(self.image, border=2), False, True, 0) # On older Gtk+ (3.4, at least) # setting a margin on CoverImage leads to errors and result in the # QL window not being visible for some reason. assert self.image.props.margin == 0 for child in self.get_children(): child.show_all() context = self.get_style_context() context.add_class("primary-toolbar")
def __init__(self, parent, player, library): super(TopBar, self).__init__() # play controls control_item = Gtk.ToolItem() self.insert(control_item, 0) t = PlayControls(player, library.librarian) self.volume = t.volume # only restore the volume in case it is managed locally, otherwise # this could affect the system volume if not player.has_external_volume: player.volume = config.getfloat("memory", "volume") self.volume.connect("value-changed", self._on_volume_changed) control_item.add(t) self.insert(Gtk.SeparatorToolItem(), 1) info_item = Gtk.ToolItem() self.insert(info_item, 2) info_item.set_expand(True) box = Gtk.Box(spacing=6) info_item.add(box) qltk.add_css(self, "GtkToolbar {padding: 3px;}") # song text info_pattern_path = os.path.join(const.USERDIR, "songinfo") text = SongInfo(library.librarian, player, info_pattern_path) box.pack_start(Align(text, border=3), True, True, 0) # cover image self.image = CoverImage(resize=True) connect_destroy(player, 'song-started', self.__new_song) # FIXME: makes testing easier if app.cover_manager: connect_destroy(app.cover_manager, 'cover-changed', self.__song_art_changed, library) self.image.props.margin = 2 box.pack_start(self.image, False, True, 0) for child in self.get_children(): child.show_all() context = self.get_style_context() context.add_class("primary-toolbar")
def __init__(self, parent, player, library): super(TopBar, self).__init__() # play controls control_item = Gtk.ToolItem() self.insert(control_item, 0) t = PlayControls(player, library.librarian) self.volume = t.volume control_item.add(t) self.insert(Gtk.SeparatorToolItem(), 1) info_item = Gtk.ToolItem() self.insert(info_item, 2) info_item.set_expand(True) box = Gtk.Box(spacing=6) info_item.add(box) qltk.add_css(self, "GtkToolbar {padding: 3px;}") # song text text = SongInfo(library.librarian, player) box.pack_start(Alignment(text, border=3), True, True, 0) # cover image self.image = CoverImage(resize=True) gobject_weak(player.connect, 'song-started', self.__new_song, parent=self) gobject_weak(parent.connect, 'artwork-changed', self.__song_art_changed, library, parent=self) # CoverImage doesn't behave in a Alignment, so wrap it coverbox = Gtk.Box() coverbox.pack_start(self.image, True, True, 0) box.pack_start(Alignment(coverbox, border=2), False, True, 0) for child in self.get_children(): child.show_all() context = self.get_style_context() context.add_class("primary-toolbar")
def setUp(self): init_fake_app() fd, self.filename = mkstemp() os.close(fd) self.info = SongInfo(SongLibrary(), NullPlayer(), self.filename)
def setUp(self): self.info = SongInfo(SongLibrary(), NullPlayer(), "")