Does wxPython have a widget like "this"?

Hi,

Does wxpython have a widget like the one attached?

I know i can create one easily with listboxs and buttons but i wonder if this thing exists and maybe even have a name.

Many Thanks,

Yoav Glazner

widget.png

No.

···

On 9/13/10 2:28 PM, yoav glazner wrote:

Hi,

Does wxpython have a widget like the one attached?

--
Robin Dunn
Software Craftsman

Hi,

···

On Mon, Sep 13, 2010 at 4:28 PM, yoav glazner <yoavglazner@gmail.com> wrote:

Hi,
Does wxpython have a widget like the one attached?
I know i can create one easily with listboxs and buttons but i wonder if
this thing exists and maybe even have a name.
Many Thanks,
Yoav Glazner

There are 4 widgets in that screen shot 2 ListBoxes and 2 Buttons :wink:

I have an implementation of the above that can be found at
(http://svn.wxwidgets.org/viewvc/wx/wxPython/3rdParty/Editra/src/eclib/filterdlg.py?view=markup)
see the FilterPanel class.

Cody

Thanks, I’ll have a look, would anyone want a widget like this out of the box? since I’ll probably make it…

···

On Tue, Sep 14, 2010 at 3:38 AM, Cody Precord codyprecord@gmail.com wrote:

Hi,

On Mon, Sep 13, 2010 at 4:28 PM, yoav glazner yoavglazner@gmail.com wrote:

Hi,

Does wxpython have a widget like the one attached?

I know i can create one easily with listboxs and buttons but i wonder if

this thing exists and maybe even have a name.

Many Thanks,

Yoav Glazner

There are 4 widgets in that screen shot 2 ListBoxes and 2 Buttons :wink:

I have an implementation of the above that can be found at

(http://svn.wxwidgets.org/viewvc/wx/wxPython/3rdParty/Editra/src/eclib/filterdlg.py?view=markup)

see the FilterPanel class.

Yes, please !!

Karsten

···

On Tue, Sep 14, 2010 at 07:30:35AM +0200, yoav glazner wrote:

> > Does wxpython have a widget like the one attached?
> > I know i can create one easily with listboxs and buttons but i wonder if
> > this thing exists and maybe even have a name.
> > Many Thanks,
> > Yoav Glazner
> >
>
> There are 4 widgets in that screen shot 2 ListBoxes and 2 Buttons :wink:
>
> I have an implementation of the above that can be found at
> (
> http://svn.wxwidgets.org/viewvc/wx/wxPython/3rdParty/Editra/src/eclib/filterdlg.py?view=markup
> )
> see the FilterPanel class.
>
>
Thanks, I'll have a look, would anyone want a widget like this out of the
box? since I'll probably make it...

--
GPG key ID E4071346 @ wwwkeys.pgp.net
E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346

Hi again!

Does wxpython have a widget like the one attached?

I know i can create one easily with listboxs and buttons but i wonder if

this thing exists and maybe even have a name.

Many Thanks,

Yoav Glazner

There are 4 widgets in that screen shot 2 ListBoxes and 2 Buttons :wink:

I have an implementation of the above that can be found at

(

http://svn.wxwidgets.org/viewvc/wx/wxPython/3rdParty/Editra/src/eclib/filterdlg.py?view=markup

)

see the FilterPanel class.

Thanks, I’ll have a look, would anyone want a widget like this out of the

box? since I’ll probably make it…

Yes, please !!

Karsten

My team created a widget like we discussed!

I attached it here…

what do you think? can it get into wxPython?

note: the file is both the widget and a runnable example

items_picker.py (4.49 KB)

This is a great widget! Thank you Yoav Glazner and your team for creating it. I surely like it very much, but I think the implementation can be a little more simplified. Well, anyway, that’s up for Robin Dunn to decide. But hats off to you guys.

···

On Tue, Oct 12, 2010 at 11:11 AM, yoav glazner yoavglazner@gmail.com wrote:

Hi again!

Does wxpython have a widget like the one attached?

I know i can create one easily with listboxs and buttons but i wonder if

this thing exists and maybe even have a name.

Many Thanks,

Yoav Glazner

There are 4 widgets in that screen shot 2 ListBoxes and 2 Buttons :wink:

I have an implementation of the above that can be found at

(

http://svn.wxwidgets.org/viewvc/wx/wxPython/3rdParty/Editra/src/eclib/filterdlg.py?view=markup

)

see the FilterPanel class.

Thanks, I’ll have a look, would anyone want a widget like this out of the

box? since I’ll probably make it…

Yes, please !!

Karsten

My team created a widget like we discussed!

I attached it here…

what do you think? can it get into wxPython?

note: the file is both the widget and a runnable example

To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com

or visit http://groups.google.com/group/wxPython-users?hl=en

Yes, but I would like to see these changes made to it first:

* Add good docstrings for the module and class, and at least the getter and setter methods too.

* Add properties using the getter and setter methods.

* Double-click is not working on Mac... it looks like e.IsSelection() is always False. I'll check into that issue but you may be able to work around the problem in some way. My guess is that you can probably just remove the test as I think that the double-click will either always be a selection or the selection will have happened in the first click.

* Put some space between the buttons so there is room to draw the focus ring on Mac.

* Make a proper sample module that can be dropped into the demo framework. (See demo/template.py for the bare minimum.)

* When removing an item from the selected list it would be nice if the next item in the list is selected so it is not left with nothing selected.

* It would be nice if items in the selected list are kept in the order that they were added.

* Fix the coding style to follow the guidelines here, http://wxpython.org/codeguidelines.php, and PEP8. The main one that jumps out at me is the lack of a space after most of the commas and around some of the assignment operators.

* Change the __init__ method to take all the standard window init parameters, and pass them on to wx.Panel. My suggestion would be to have self, parent, ID, followed by the custom parameters needed for the widget, followed by the rest of the stock parameters: pos, size style, name, each with appropriate default values (except for parent).

* I would change the name of the "items" parameter to "choices", to match the other widgets that have items.

* I would change the label parameter names to "label" and "selectedLabel" but that is just my personal opinion and I am okay with them as-is if you like that better.

···

On 10/12/10 2:11 AM, yoav glazner wrote:

My team created a widget like we discussed!
I attached it here...
what do you think? can it get into wxPython?

--
Robin Dunn
Software Craftsman

My team created a widget like we discussed!

I attached it here…

what do you think? can it get into wxPython?

Yes, but I would like to see these changes made to it first:

  • Add good docstrings for the module and class, and at least the getter and setter methods too.

added

  • Add properties using the getter and setter methods.

done

  • Double-click is not working on Mac… it looks like e.IsSelection() is always False. I’ll check into that issue but you may be able to work around the problem in some way. My guess is that you can probably just remove the test as I think that the double-click will either always be a selection or the selection will have happened in the first click.

I hope it is now fixed, the problem is that when using CTRL+DCLICK you can de-select and item and still have another one chosen

  • Put some space between the buttons so there is room to draw the focus ring on Mac.

border = 5, have no idea if it works (no Mac here)

  • Make a proper sample module that can be dropped into the demo framework. (See demo/template.py for the bare minimum.)

done and attached

  • When removing an item from the selected list it would be nice if the next item in the list is selected so it is not left with nothing selected.

I don’t to do this since it will be weird with multi-selection

  • It would be nice if items in the selected list are kept in the order that they were added.

I like it sorted :frowning:

  • Fix the coding style to follow the guidelines here, http://wxpython.org/codeguidelines.php, and PEP8. The main one that jumps out at me is the lack of a space after most of the commas and around some of the assignment operators.

improved!

  • Change the init method to take all the standard window init parameters, and pass them on to wx.Panel. My suggestion would be to have self, parent, ID, followed by the custom parameters needed for the widget, followed by the rest of the stock parameters: pos, size style, name, each with appropriate default values (except for parent).

done , exra parameters are passed as (*args,**kw), id was added.

  • I would change the name of the “items” parameter to “choices”, to match the other widgets that have items.

done

  • I would change the label parameter names to “label” and “selectedLabel” but that is just my personal opinion and I am okay with them as-is if you like that better.

done!

Thanks for the quick reply!

ItemsPicker.py (1.64 KB)

items_picker.py (6.27 KB)

···

On Tue, Oct 12, 2010 at 2:01 PM, Robin Dunn robin@alldunn.com wrote:

On 10/12/10 2:11 AM, yoav glazner wrote:

Just add a setting that allows you to turn sorting off. Then you can
have it both ways!

···

On Oct 13, 6:09 am, yoav glazner <yoavglaz...@gmail.com> wrote:

On Tue, Oct 12, 2010 at 2:01 PM, Robin Dunn <ro...@alldunn.com> wrote:
> On 10/12/10 2:11 AM, yoav glazner wrote:

> My team created a widget like we discussed!
>> I attached it here...
>> what do you think? can it get into wxPython?

> Yes, but I would like to see these changes made to it first:

> * Add good docstrings for the module and class, and at least the getter and
> setter methods too.

added

> * Add properties using the getter and setter methods.

done

> * Double-click is not working on Mac... it looks like e.IsSelection() is
> always False. I'll check into that issue but you may be able to work around
> the problem in some way. My guess is that you can probably just remove the
> test as I think that the double-click will either always be a selection or
> the selection will have happened in the first click.

I hope it is now fixed, the problem is that when using CTRL+DCLICK you can
de-select and item and still have another one chosen

* Put some space between the buttons so there is room to draw the focus ring

> on Mac.

> border = 5, have no idea if it works (no Mac here)
> * Make a proper sample module that can be dropped into the demo framework.
> (See demo/template.py for the bare minimum.)

done and attached

> * When removing an item from the selected list it would be nice if the next
> item in the list is selected so it is not left with nothing selected.

I don't to do this since it will be weird with multi-selection

> * It would be nice if items in the selected list are kept in the order that
> they were added.

I like it sorted :frowning:

-------------------
Mike Driscoll

Blog: http://blog.pythonlibrary.org

Yeah, a style flag would be appropriate there.

···

On 10/14/10 9:17 AM, Mike Driscoll wrote:

On Oct 13, 6:09 am, yoav glazner<yoavglaz...@gmail.com> wrote:

On Tue, Oct 12, 2010 at 2:01 PM, Robin Dunn<ro...@alldunn.com> wrote:

* It would be nice if items in the selected list are kept in the order that
they were added.

I like it sorted :frowning:

Just add a setting that allows you to turn sorting off. Then you can
have it both ways!

--
Robin Dunn
Software Craftsman

It will change the implementation a lot, since I’m not allowing duplicated items on both sides of the widget.

Do you think order has meaning in this kind of widget? (sinces there is no option to change the order once you selected an item)

···

On Thu, Oct 14, 2010 at 7:15 PM, Robin Dunn robin@alldunn.com wrote:

On 10/14/10 9:17 AM, Mike Driscoll wrote:

On Oct 13, 6:09 am, yoav glazneryoavglaz...@gmail.com wrote:

On Tue, Oct 12, 2010 at 2:01 PM, Robin Dunnro...@alldunn.com wrote:

  • It would be nice if items in the selected list are kept in the order that

they were added.

I like it sorted :frowning:

Just add a setting that allows you to turn sorting off. Then you can

have it both ways!

Yeah, a style flag would be appropriate there.

I expect that if I add anything to a vertical list of things, the new
thing added appears on the bottom of the list, as one would do with a
handwritten shopping list. But by sorting the right-hand list, it
will make a newly added word appear in many cases in the middle of the
list. So, in this way, sorting breaks my expectation.

Che

···

On Thu, Oct 14, 2010 at 3:15 PM, yoav glazner <yoavglazner@gmail.com> wrote:

On Thu, Oct 14, 2010 at 7:15 PM, Robin Dunn <robin@alldunn.com> wrote:

On 10/14/10 9:17 AM, Mike Driscoll wrote:

On Oct 13, 6:09 am, yoav glazner<yoavglaz...@gmail.com> wrote:

On Tue, Oct 12, 2010 at 2:01 PM, Robin Dunn<ro...@alldunn.com> wrote:

* It would be nice if items in the selected list are kept in the order
that
they were added.

I like it sorted :frowning:

Just add a setting that allows you to turn sorting off. Then you can
have it both ways!

Yeah, a style flag would be appropriate there.

It will change the implementation a lot, since I'm not allowing duplicated
items on both sides of the widget.
Do you think order has meaning in this kind of widget? (sinces there is no
option to change the order once you selected an item)

Agreed. Also your reply has sparked another thought for me: Another style flag could control whether items are removed from the source list when they are added to the selected list. And another could control whether is is allowed to put an item in the selected list more than once.

···

On 10/14/10 12:37 PM, C M wrote:

On Thu, Oct 14, 2010 at 3:15 PM, yoav glazner<yoavglazner@gmail.com> wrote:

On Thu, Oct 14, 2010 at 7:15 PM, Robin Dunn<robin@alldunn.com> wrote:

On 10/14/10 9:17 AM, Mike Driscoll wrote:

On Oct 13, 6:09 am, yoav glazner<yoavglaz...@gmail.com> wrote:

On Tue, Oct 12, 2010 at 2:01 PM, Robin Dunn<ro...@alldunn.com> wrote:

* It would be nice if items in the selected list are kept in the order
that
they were added.

I like it sorted :frowning:

Just add a setting that allows you to turn sorting off. Then you can
have it both ways!

Yeah, a style flag would be appropriate there.

It will change the implementation a lot, since I'm not allowing duplicated
items on both sides of the widget.
Do you think order has meaning in this kind of widget? (sinces there is no
option to change the order once you selected an item)

I expect that if I add anything to a vertical list of things, the new
thing added appears on the bottom of the list, as one would do with a
handwritten shopping list. But by sorting the right-hand list, it
will make a newly added word appear in many cases in the middle of the
list. So, in this way, sorting breaks my expectation.

--
Robin Dunn
Software Craftsman

Just add a setting that allows you to turn sorting off. Then you can

have it both ways!

Yeah, a style flag would be appropriate there.

It will change the implementation a lot, since I’m not allowing duplicated

items on both sides of the widget.

Do you think order has meaning in this kind of widget? (sinces there is no

option to change the order once you selected an item)

I expect that if I add anything to a vertical list of things, the new

thing added appears on the bottom of the list, as one would do with a

handwritten shopping list. But by sorting the right-hand list, it

will make a newly added word appear in many cases in the middle of the

list. So, in this way, sorting breaks my expectation.

Agreed. Also your reply has sparked another thought for me: Another style flag could control whether items are removed from the source list when they are added to the selected list. And another could control whether is is allowed to put an item in the selected list more than once.

I’ll have a look on Sunday and see if it easy to manage, anyway I’m not sure this is the most agile approach since.

I expect that if I add anything to a vertical list of things, the new
thing added appears on the bottom of the list, as one would do with a
handwritten shopping list. But by sorting the right-hand list, it
will make a newly added word appear in many cases in the middle of the
list. So, in this way, sorting breaks my expectation.

I totally agree with you. It's annoying when a piece a
software is doing something different your eyes expect
to see.

There is also an abvious argument for a *default not sorting*:
the language. Usually, sorting is based on "ascii" and
suits the English language.

a = ['z', 'e', 'a', 'é', 'è']
a.sort()
a

['a', 'e', 'z', '\xe8', '\xe9']

print ''.join(a)

aezèé

jmf

You can use locale.strcol to implement language specific sorting based on the current locale settings.

···

On 10/15/10 12:18 AM, jmfauth wrote:

I expect that if I add anything to a vertical list of things, the new
thing added appears on the bottom of the list, as one would do with a
handwritten shopping list. But by sorting the right-hand list, it
will make a newly added word appear in many cases in the middle of the
list. So, in this way, sorting breaks my expectation.

I totally agree with you. It's annoying when a piece a
software is doing something different your eyes expect
to see.

There is also an abvious argument for a *default not sorting*:
the language. Usually, sorting is based on "ascii" and
suits the English language.

--
Robin Dunn
Software Craftsman

>> I expect that if I add anything to a vertical list of things, the new
>> thing added appears on the bottom of the list, as one would do with a
>> handwritten shopping list. But by sorting the right-hand list, it
>> will make a newly added word appear in many cases in the middle of the
>> list. So, in this way, sorting breaks my expectation.

> I totally agree with you. It's annoying when a piece a
> software is doing something different your eyes expect
> to see.

> There is also an abvious argument for a *default not sorting*:
> the language. Usually, sorting is based on "ascii" and
> suits the English language.

You can use locale.strcol to implement language specific sorting based
on the current locale settings.

Good point.

For casual readers: locale.strcoll (with two 'l').

···

On 15 oct, 20:16, Robin Dunn <ro...@alldunn.com> wrote:

On 10/15/10 12:18 AM, jmfauth wrote:

--
Robin Dunn
Software Craftsmanhttp://wxPython.org

I expect that if I add anything to a vertical list of things, the new

thing added appears on the bottom of the list, as one would do with a

handwritten shopping list. But by sorting the right-hand list, it

will make a newly added word appear in many cases in the middle of the

list. So, in this way, sorting breaks my expectation.

Agreed. Also your reply has sparked another thought for me: Another style flag could control whether items are removed from the source list when they are added to the selected list. And another could control whether is is allowed to put an item in the selected list more than once.

Ok, flags for sorting and Removal from the choice list were added.

Demo is updated as well.

ItemsPicker.py (2.97 KB)

items_picker.py (7.66 KB)

What I miss in this widget is that when I select an item and either Remove it or Add it, the shifted item is not highlighted (doesn’t have focus) in the other box that was shifted to. Is that by design or is this a feature in the making?

···

On Sun, Oct 17, 2010 at 3:37 PM, yoav glazner yoavglazner@gmail.com wrote:

I expect that if I add anything to a vertical list of things, the new

thing added appears on the bottom of the list, as one would do with a

handwritten shopping list. But by sorting the right-hand list, it

will make a newly added word appear in many cases in the middle of the

list. So, in this way, sorting breaks my expectation.

Agreed. Also your reply has sparked another thought for me: Another style flag could control whether items are removed from the source list when they are added to the selected list. And another could control whether is is allowed to put an item in the selected list more than once.

Ok, flags for sorting and Removal from the choice list were added.

Demo is updated as well.

To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com

or visit http://groups.google.com/group/wxPython-users?hl=en