[Stoq-devel] [Bug 3428] Permitir seleção de logotipo pela empresa usuária do sistema

bugzilla-daemon at async.com.br bugzilla-daemon at async.com.br
Tue Mar 4 17:02:28 BRT 2008


http://bugs.async.com.br/show_bug.cgi?id=3428


Johan Dahlin <jdahlin at async.com.br> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Attachment #4600|review?(jdahlin at async.com.br|review-
               Flag|)                           |




--- Comment #6 from Johan Dahlin <jdahlin at async.com.br>  2008-03-04 17:02:27 BRT ---
(From update of attachment 4600)
>Index: stoqlib/gui/editors/parameterseditor.py

>+    def _on_yes_radio__toggled(self, widget):
>+        if widget.get_active():
>+            self.model.field_value = "1"
>+        else:
>+            self.model.field_value = "0"

Como faz em uma linha só?

dica: str(int(...))


>Index: stoqlib/lib/imageutils.py

>+from kiwi.environ import environ
>+
>+import gtk
>+import gobject
>+
>+import imghdr
>+import os.path
>+

ou ordem dos imports é o invertido aqui

>+class ImageHelper(object):
>+

>+    def _get_image_type(self):
>+        try:
>+            image_type = imghdr.what(str(self.image_path))
>+        except IOError:
>+            return

IOError do que?

precisa filtar o IOError specifico, eg:

except IOError, e:
   if e.errno == ???:
      return
   raise

Não pode pegar todos os IOError.

OU

só use os.path.exists() para ver se o arquivo existe...

>+        try:
>+            if not self._check_image_type():
>+                return False
>+            if self._image is None:
>+                self._image = gtk.gdk.pixbuf_new_from_file(self.image_path)
>+        except gobject.GError:
>+            return False

->

        try:
            self._image = gtk.gdk.pixbuf_new_from_file(self.image_path)
        except gobject.GError:
            return False

>+            params = size + (gtk.gdk.INTERP_BILINEAR,)
>+            self._image = self._image.scale_simple(*params)

->
            w, h = size
            self._image = self._image.scale_simple(w, h,
gtk.gdk.INTERP_BILINEAR)


-- 
Configure bugmail: http://bugs.async.com.br/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the Stoq-devel mailing list