Ejemplo n.º 1
0
 def load_image (self, image, width=0, height=0):
     """ Loads an image from the file.
     width and height are processed as follows:
       -1 : follow the loaded image size
        0 : follow the size set on widget instantiation
        * : use that specific size"""
     if width == 0:
         width = self.width
     if height == 0:
         height = self.height
     if not isinstance(image, SliderCreator):
         self.image = utils.resize_image(image, width, height)
     else:
         self.image = image
     self.filename = True
     self.full_refresh()
Ejemplo n.º 2
0
 def load_image(self, image, width=0, height=0):
     """ Loads an image from the file.
     width and height are processed as follows:
       -1 : follow the loaded image size
        0 : follow the size set on widget instantiation
        * : use that specific size"""
     if width == 0:
         width = self.width
     if height == 0:
         height = self.height
     if not isinstance(image, SliderCreator):
         self.image = utils.resize_image(image, width, height)
     else:
         self.image = image
     self.filename = True
     self.full_refresh()
    def set_nr_pieces(self,
                      btn=None,
                      nr_pieces=None,
                      path=None,
                      path_from_journal=None):
        # if isinstance(btn, Gtk.ToggleButton) and not btn.get_active():
        #    return
        logger.debug('final path')
        if self.is_contest_mode() and nr_pieces == self.game.get_nr_pieces():
            return

        if nr_pieces is None:
            nr_pieces = self.game.get_nr_pieces()
        if btn is None:
            if self._contest_mode:
                self.set_game_state(GAME_STARTED)
                return

        if not self.game_wrapper.get_parent():
            self.game_box.pop()

        if not path:
            self.yy = self.pre_path
        else:
            self.yy = path
        if self.from_journal:
            self.yy = path_from_journal
        if self.from_journal and not path_from_journal:
            self.yy = self.pth_frm_jrnl

        self.px = utils.load_image(self.yy)
        self.game.load_image(self.px)
        self.game.set_nr_pieces(nr_pieces)
        self.timer.reset(False)
        # set the current thumbnail
        self.pbb = utils.load_image(self.yy)
        self.fnpbb = utils.resize_image(self.pbb, 200, 200, method=2)
        self.thumb.image.set_from_pixbuf(self.fnpbb)