bugzilla-daemon | 25 Nov 2011 19:23
Picon

[Bug 4769] New: Add a way to get the whole object in objectlist.Column's format_func

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

             Bug #: 4769
           Summary: Add a way to get the whole object in
                    objectlist.Column's format_func
    Classification: Unclassified
           Product: Kiwi
           Version: SVN trunk
          Platform: PC
        OS/Version: Linux
            Status: ASSIGNED
          Severity: (unset)
          Priority: (unset)
         Component: ObjectList
        AssignedTo: romaia <at> async.com.br
        ReportedBy: romaia <at> async.com.br
         QAContact: kiwi <at> async.com.br
            Blocks: 4729

Ronaldo Maia <romaia <at> async.com.br> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Attachment #5803|                            |review?(jdahlin <at> async.com.b
              Flags|                            |r)

Created attachment 5803
  --> http://bugs.async.com.br/attachment.cgi?id=5803
v1 - romaia

(Continue reading)

bugzilla-daemon | 28 Nov 2011 13:35
Picon

[Bug 4769] Add a way to get the whole object in objectlist.Column's format_func

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

Johan Dahlin (not reading bugmail) <jdahlin <at> async.com.br> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Attachment #5803|review?(jdahlin <at> async.com.b |review-
              Flags|r)                          |

--- Comment #1 from Johan Dahlin (not reading bugmail) <jdahlin <at> async.com.br> 2011-11-28 10:35:40 BRST ---
Comment on attachment 5803
  --> http://bugs.async.com.br/attachment.cgi?id=5803
v1 - romaia

>=== modified file 'kiwi/ui/objectlist.py'
> 
> def str2bool(value, from_string=converter.from_string):

>+      - B{extra_data}: object I{None}
>+        -  any data to be passed to format_func.
>+      - B{format_func_data}: bool I{False}
>+        -  If format_func will receive the row object instead of just the column
>+           value

I think this api is better as;

format_func_data: object - with a default value as None.

If it's none None pass it in as the second argument, that way you don't need
two properties
(Continue reading)

bugzilla-daemon | 28 Nov 2011 14:07
Picon

[Bug 4769] Add a way to get the whole object in objectlist.Column's format_func

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

Ronaldo Maia <romaia <at> async.com.br> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Attachment #5803|0                           |1
        is obsolete|                            |
   Attachment #5804|                            |review?(jdahlin <at> async.com.b
              Flags|                            |r)

--- Comment #2 from Ronaldo Maia <romaia <at> async.com.br> 2011-11-28 11:07:38 BRST ---
Created attachment 5804
  --> http://bugs.async.com.br/attachment.cgi?id=5804
v2 - romaia

correçoes e sem mudanças do pyflakes

--

-- 
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.
_______________________________________________
Kiwi mailing list
Kiwi <at> www.async.com.br
http://www.async.com.br/mailman/listinfo/kiwi
bugzilla-daemon | 28 Nov 2011 14:18
Picon

[Bug 4769] Add a way to get the whole object in objectlist.Column's format_func

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

--- Comment #3 from Johan Dahlin (not reading bugmail) <jdahlin <at> async.com.br> 2011-11-28 11:18:32 BRST ---
Comment on attachment 5804
  --> http://bugs.async.com.br/attachment.cgi?id=5804
v2 - romaia

>=== modified file 'kiwi/ui/objectlist.py'
>--- kiwi/ui/objectlist.py	2011-11-23 17:17:32 +0000
>+++ kiwi/ui/objectlist.py	2011-11-28 13:02:21 +0000
> <at>  <at>  -107,6 +107,10  <at>  <at> 
>            I{Note}: that you cannot use format and format_func at the same time,
>            if you provide a format function you'll be responsible for
>            converting the value to a string.
>+      - B{format_func_data}: object I{None}
>+        -  If format_func_data is not None, format_func will receive the row
>+           object instead of just the column value, and also receive this value
>+           as a second argument.
>       - B{editable}: bool I{False}
>         - if true the field is editable and when you modify the contents of
>           the cell the model will be updated.
> <at>  <at>  -164,6 +168,7  <at>  <at> 
>     expand = gobject.property(type=bool, default=False)
>     tooltip = gobject.property(type=str)
>     format_func = gobject.property(type=object)
>+    format_func_data = gobject.property(type=object, default=None)
>     editable = gobject.property(type=bool, default=False)
>     searchable = gobject.property(type=bool, default=False)
>     radio = gobject.property(type=bool, default=False)
> <at>  <at>  -470,10 +475,9  <at>  <at> 
(Continue reading)

bugzilla-daemon | 28 Nov 2011 14:28
Picon

[Bug 4769] Add a way to get the whole object in objectlist.Column's format_func

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

--- Comment #4 from Ronaldo Maia <romaia <at> async.com.br> 2011-11-28 11:28:24 BRST ---
(In reply to comment #3)

> >         data_type = self.data_type
> >         if data is None and data_type != gdk.Pixbuf:
> >             text = ''
> >         elif self.format_func:
> >-            text = self.format_func(data)
> >+            if self.format_func_data is not None:
> >+                text = self.format_func(obj, self.format_func_data)
> >+            else:
> >+                text = self.format_func(data)
> 
> That can be replaced with:
> 
>               text = self.format_func(data, self.format_func_data)

That not only is not necessary (self.format_func_data will be None in this case
- se the if), but it would also break anywhere that already uses format_func
(they do not expect a second argument).

> >     def renderer_func(self, renderer, data):
> >-        if self._use_data_model:
> >+        if not self._use_data_model:
> >+            data = self.get_attribute(data, self.attribute, None)
> >+
> >+        if self.format_func_data is not None:
> >+            ret = self._data_func(data, self.format_func_data)
(Continue reading)

bugzilla-daemon | 28 Nov 2011 15:29
Picon

[Bug 4769] Add a way to get the whole object in objectlist.Column's format_func

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

Ronaldo Maia <romaia <at> async.com.br> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED

--- Comment #5 from Ronaldo Maia <romaia <at> async.com.br> 2011-11-28 12:29:54 BRST ---
revno: 1721

--

-- 
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.
bugzilla-daemon | 6 Feb 2012 18:31
Picon

[Bug 4769] Add a way to get the whole object in objectlist.Column's format_func

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

Ronaldo Maia <romaia <at> async.com.br> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Attachment #5804|review?(jdahlin <at> async.com.b |
              Flags|r)                          |

--

-- 
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.

Gmane