Beispiel #1
0
 def __init__(self, minimal=False):
     """
         Init artist infos
         @param minimal as bool
     """
     Popover.__init__(self)
     self.__minimal = minimal
     self.__view = InformationView(minimal)
     self.__view.show()
     self.connect("map", self.__on_map)
     self.add(self.__view)
Beispiel #2
0
 def _get_view_info(self):
     """
         Get view for information
         @return InformationView
     """
     from lollypop.view_information import InformationView
     view = InformationView(True)
     view.populate()
     view.set_margin_top(MARGIN_SMALL)
     view.set_margin_start(MARGIN_SMALL)
     view.show()
     return view
Beispiel #3
0
 def __init__(self, minimal=False):
     """
         Init artist infos
         @param minimal as bool
     """
     Popover.__init__(self)
     self.__minimal = minimal
     self.__width = 10
     self.__view = InformationView(ViewType.SCROLLED, minimal)
     self.__view.show()
     self.connect("map", self.__on_map)
     self.get_style_context().add_class("padding")
     self.add(self.__view)
Beispiel #4
0
class InformationPopover(Popover):
    """
        Popover with artist information
    """
    def __init__(self, minimal=False):
        """
            Init artist infos
            @param minimal as bool
        """
        Popover.__init__(self)
        self.__minimal = minimal
        self.__width = 10
        self.__view = InformationView(ViewType.SCROLLED, minimal)
        self.__view.show()
        self.connect("map", self.__on_map)
        self.get_style_context().add_class("padding")
        self.add(self.__view)

    def populate(self, artist_id=None):
        """
            Show information for artists
            @param artist_id as int
        """
        self.__view.populate(artist_id)

    def do_get_preferred_width(self):
        return (self.__width, self.__width)

#######################
# PROTECTED           #
#######################

#######################
# PRIVATE             #
#######################

    def __on_map(self, widget):
        """
            Connect signal and resize
            @param widget as Gtk.Widget
        """
        size = App().window.get_size()
        if self.__minimal:
            self.__width = min(size[0] * 0.95, 500)
            self.set_size_request(self.__width, min(size[1] * 0.5, 600))
        else:
            self.__width = Size.NORMAL
            self.set_size_request(self.__width, min(size[1] * 0.7, 800))
Beispiel #5
0
class InformationPopover(Popover):
    """
        Popover with artist information
    """

    def __init__(self, minimal=False):
        """
            Init artist infos
            @param minimal as bool
        """
        Popover.__init__(self)
        self.__minimal = minimal
        self.__view = InformationView(minimal)
        self.__view.show()
        self.connect("map", self.__on_map)
        self.add(self.__view)

    def populate(self, artist_id=None):
        """
            Show information for artists
            @param artist_id as int
        """
        self.__view.populate(artist_id)

#######################
# PROTECTED           #
#######################

#######################
# PRIVATE             #
#######################
    def __on_map(self, widget):
        """
            Connect signal and resize
            @param widget as Gtk.Widget
        """
        size = App().window.get_size()
        if self.__minimal:
            self.set_size_request(min(size[0] * 0.6, 500),
                                  min(size[1] * 0.5, 600))
        else:
            self.set_size_request(min(size[0] * 0.6, 1000),
                                  min(size[1] * 0.7, 800))
 def _get_view_info(self):
     """
         Get view for information
         @return InformationView
     """
     view_type = ViewType.SCROLLED
     from lollypop.view_information import InformationView
     view = InformationView(view_type, True)
     view.populate()
     view.set_margin_top(MARGIN_SMALL)
     view.set_margin_start(MARGIN_SMALL)
     return view