Re: [PATCH 1/2] Improve CheckList class.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Do you have a screenshot handy?  If not it's no big deal - I should be
able to make one.

> diff --git a/pyanaconda/iw/checklist.py b/pyanaconda/iw/checklist.py
> index 50026a1..304978a 100644
> --- a/pyanaconda/iw/checklist.py
> +++ b/pyanaconda/iw/checklist.py
> @@ -31,15 +31,16 @@ class CheckList (gtk.TreeView):
>      # override this to make your own columns if necessary
>      def create_columns(self, columns):
>          # add the string columns to the tree view widget
> -        for i in range(1, columns + 1):
> +        titles = [''] + columns
> +        for i in range(1, len(titles)):
>              renderer = gtk.CellRendererText()
> -            column = gtk.TreeViewColumn('Text', renderer, text=i,
> +            column = gtk.TreeViewColumn(titles[i], renderer, text=i,
>                                          **self.sensitivity_args)
>              column.set_clickable(False)
>              self.append_column(column)
>  
>      # XXX need to handle the multicolumn case better still....
> -    def __init__ (self, columns = 1, custom_store=None, sensitivity=False):
> +    def __init__ (self, columns = [''], custom_store=None, sensitivity=False):
>  	if custom_store is None:
>  	    self.store = gtk.TreeStore(gobject.TYPE_BOOLEAN,
>  				       gobject.TYPE_STRING,

You don't want to use a list as a default in an argument list like this,
or you will be entering a world of pain.  It's better to have
columns=None, and then in your function do something like this:

if not columns:
   columns = ['']

I think it's a little odd to change what "columns" means throughout the
code, though.  In some places, you have it referring to a list of column
titles and in other places, to the number of columns.  It'd be a little
more straightforward to replace the latter usage with ncolumns or the
like.

- Chris

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux