Exemplo n.º 1
0
 def updateItemDescription(self, iter, item, gtkLock=True):
     """
     @summary: Update description of an item.
     @param iter: GtkTreeIter that represents an item.
     @param item: CamItem to update.
     @param gtkLock: True to do the action with gtklock.
     """
     UIUtils.setIterData(self.getModel(), iter, self.COLUMN_OPERATIONS, item.getDescription(), doGObject=gtkLock)
Exemplo n.º 2
0
 def updateItemTarget(self, iter, item, gtkLock=True):
     """
     @summary: Update target of an item.
     @param iter: GtkTreeIter that represents an item.
     @param item: CamItem to update.
     @param gtkLock: True to do the action with gtklock
     """
     UIUtils.setIterData(self.getModel(), iter, self.COLUMN_TARGET, item.getTarget(), doGObject=gtkLock)
Exemplo n.º 3
0
 def stepOperation(self, iter):
     """
     @summary: Does a step.
     @param iter: Do a step on a iter.
     """
     value = float(self.__opsModel__.get_value(iter, self.__VALUE_COLUMN__)) / 100
     step = self.__opsModel__.get_value(iter, self.__STEP_COLUMN__)
     value += step
     UIUtils.setIterData(self.__opsModel__, iter, self.__VALUE_COLUMN__, value * 100)
Exemplo n.º 4
0
 def updateItemDate(self, iter, item, gtkLock=True):
     """
     @summary: Update target of an item.
     @param iter: GtkTreeIter that represents an item.
     @param item: CamItem to update.
     @param gtkLock: True to do the action with gtklock
     @return: true if operation is done.
     """
     item.waitLoadThumbnail()
     if (item.getMetadata() == None):
         __log__.warn("There is not metadata in %s. Skip file" % item.getPath())
         UIUtils.setIterData(self.getModel(), iter, self.COLUMN_DATE, _("Unknown"), doGObject=gtkLock)
         
         return False
     else:
         UIUtils.setIterData(self.getModel(), iter, self.COLUMN_DATE, item.getMetadata().getDateTimeDigitized(), doGObject=gtkLock)
     
     return True
Exemplo n.º 5
0
    def __updateImageTarget__(self, iter, item, delMetadata=False):
        """
        @summary: Updates image of target file.
        @param iter: Iter of listview that matches with target file.
        @param item: CamItem to update.
        @param delMetadata: True to delete metadata at the end of function
        """
        little = None
        big = None
        
        item.waitLoadThumbnail()
        imgPil = item.doPreview()
        if (imgPil != None):
            metaData = ImgMeta(item.getPath(), image=imgPil)
        else:
            metaData = item.getMetadata()
        
        UIUtils.setIterData(self.getModel(), iter, self.COLUMN_LOADING, True)
        
        if (self.__doPreviewList__):
            if (not self.__model__.get_value(iter, self.COLUMN_DO_IMG)):
                __log__.debug("Get thumbnail from %s" % file)
                little = metaData.getIcon(maxHeight=self.__maxHeight__, rescale=self.__rescalePercent__)

                if (little):
                    UIUtils.setIterData(self.__model__, iter, self.COLUMN_IMAGE, little)
                    UIUtils.setIterData(self.__model__, iter, self.COLUMN_DO_IMG, True)
            
        __log__.debug("Doing preview image of %s" % self.__model__.get_value(iter, self.COLUMN_SOURCE))
        if (metaData != None):
            big = metaData.getIcon(rescale=100, maxHeight=self.__maxHeightImageIconView__)
        if (big):
            __log__.debug("Updating data on model for %s." % self.__model__.get_value(iter, self.COLUMN_SOURCE))
            UIUtils.setIterData(self.__model__, iter, self.COLUMN_PREVIEW, big)
            
        if (delMetadata and (metaData != None)):
            del metaData
            
        UIUtils.setIterData(self.getModel(), iter, self.COLUMN_LOADING, False)
Exemplo n.º 6
0
 def addElements(self, iter, elements, gtkLock=True):
     """
     @summary: Sets new values of progress bar.
     @param iter: GtkTreeIter where progress bar is.
     @param elements: New number of elements.
     @param gtkLock: True when lock gtk-loop.
     """               
     newValue = 0.00
     newStep = 1
     if (elements > 0):
         currElems = self.__opsModel__.get_value(iter, self.__ELEMNS_COLUMN__)
         newStep = float(1) / (float(currElems) + float(elements))
         
         currValue = float(self.__opsModel__.get_value(iter, self.__VALUE_COLUMN__)) / 100
         currStep = self.__opsModel__.get_value(iter, self.__STEP_COLUMN__)
         
         newValue = newStep * (currValue / currStep)
         
         UIUtils.setIterData(self.__opsModel__, iter, self.__ELEMNS_COLUMN__, float(currElems) + float(elements), doGObject=gtkLock)
         UIUtils.setIterData(self.__opsModel__, iter, self.__STEP_COLUMN__, newStep, doGObject=gtkLock)
         UIUtils.setIterData(self.__opsModel__, iter, self.__VALUE_COLUMN__, newValue, doGObject=gtkLock)
     else:
         __log__.warning("It can not set 0 elements on a operation")