[GRASS-dev] Updating colorrules.py

Hi All,

gui/wxpython/modules/colorrules.py, providing inteface for setting colortable for raster and vector.

As I reported on trac[1] several weeks ago there is a bug in the code which happens if no. color rules for raster map is big (eg: 32763 This for nc_spm_08/landsat 4,3,2 color composite) . This will result in crashing the whole wxGUI!

The problem is for each rule colorrules.py create a checkbox,textCtrl and ColorSelect.

Creating these widgets will hangup the UI.

A solution is to use a list control agw provides one such thing called ultimatelistCtrl.

I had updated the colorrules.py and made a patch for it. Anyone Please review and update the file

PFA patch

[0] http://trac.osgeo.org/grass/ticket/1816

Regards,
Rashad

(attachments)

colorrules_py.patch (15.4 KB)

On Wed, Dec 19, 2012 at 4:39 PM, Mohammed Rashad
<mohammedrashadkm@gmail.com> wrote:

Hi All,

gui/wxpython/modules/colorrules.py, providing inteface for setting
colortable for raster and vector.

As I reported on trac[1] several weeks ago there is a bug in the code which
happens if no. color rules for raster map is big (eg: 32763 This for
nc_spm_08/landsat 4,3,2 color composite) . This will result in crashing the
whole wxGUI!

The problem is for each rule colorrules.py create a checkbox,textCtrl and
ColorSelect.

Creating these widgets will hangup the UI.

A solution is to use a list control agw provides one such thing called
ultimatelistCtrl.

I had updated the colorrules.py and made a patch for it. Anyone Please
review and update the file

Hi Rashad,

I can't even test your patch at the moment because UltimateListCtrl is
not supported in wxPython 2.8.10.1 (which is installed on my
computer). It seems that it is available from 2.8.11, however in the
grass requirements, there is wxPython >= 2.8.1.1. I agree that this
one is pretty old but still we must decide if it is worth changing the
requirements. I think that the version I have is still used a lot so
we should support it. You are using this widget to show the color I
suppose. I am not aware of any other good solution. Maybe you can a
condition on wxPython version and if it is high enough use this
widget, otherwise use the current implementation?

Anna

PFA patch

[0] http://trac.osgeo.org/grass/ticket/1816

--
Regards,
   Rashad

_______________________________________________
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

Hi Anna,

Adding a check for ultimatelistctrl widget and if not available can be done. But remember using the old implementation will crash wxGUI.

How about If no ultimatelistctrl is not available we can add a copy of it our own with a warning

Btw, I dont have a source build of wxpython. This comes with Ubuntu 12.04 LTS

···

On Thu, Dec 20, 2012 at 4:56 AM, Anna Kratochvílová <kratochanna@gmail.com> wrote:

On Wed, Dec 19, 2012 at 4:39 PM, Mohammed Rashad
<mohammedrashadkm@gmail.com> wrote:

Hi All,

gui/wxpython/modules/colorrules.py, providing inteface for setting
colortable for raster and vector.

As I reported on trac[1] several weeks ago there is a bug in the code which
happens if no. color rules for raster map is big (eg: 32763 This for
nc_spm_08/landsat 4,3,2 color composite) . This will result in crashing the
whole wxGUI!

The problem is for each rule colorrules.py create a checkbox,textCtrl and
ColorSelect.

Creating these widgets will hangup the UI.

A solution is to use a list control agw provides one such thing called
ultimatelistCtrl.

I had updated the colorrules.py and made a patch for it. Anyone Please
review and update the file

Hi Rashad,

I can’t even test your patch at the moment because UltimateListCtrl is
not supported in wxPython 2.8.10.1 (which is installed on my
computer). It seems that it is available from 2.8.11, however in the
grass requirements, there is wxPython >= 2.8.1.1. I agree that this
one is pretty old but still we must decide if it is worth changing the
requirements. I think that the version I have is still used a lot so
we should support it. You are using this widget to show the color I
suppose. I am not aware of any other good solution. Maybe you can a
condition on wxPython version and if it is high enough use this
widget, otherwise use the current implementation?

Anna

PFA patch

[0] http://trac.osgeo.org/grass/ticket/1816


Regards,
Rashad


grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

Regards,
Rashad

updated the patch. PFA

Do you think its necessary to update the file in trac ?

(attachments)

colorrules_py.patch (16.8 KB)

···

On Thu, Dec 20, 2012 at 8:50 AM, Mohammed Rashad <mohammedrashadkm@gmail.com> wrote:

Hi Anna,

Adding a check for ultimatelistctrl widget and if not available can be done. But remember using the old implementation will crash wxGUI.

How about If no ultimatelistctrl is not available we can add a copy of it our own with a warning

Btw, I dont have a source build of wxpython. This comes with Ubuntu 12.04 LTS

Regards,
Rashad

On Thu, Dec 20, 2012 at 4:56 AM, Anna Kratochvílová <kratochanna@gmail.com> wrote:

On Wed, Dec 19, 2012 at 4:39 PM, Mohammed Rashad
<mohammedrashadkm@gmail.com> wrote:

Hi All,

gui/wxpython/modules/colorrules.py, providing inteface for setting
colortable for raster and vector.

As I reported on trac[1] several weeks ago there is a bug in the code which
happens if no. color rules for raster map is big (eg: 32763 This for
nc_spm_08/landsat 4,3,2 color composite) . This will result in crashing the
whole wxGUI!

The problem is for each rule colorrules.py create a checkbox,textCtrl and
ColorSelect.

Creating these widgets will hangup the UI.

A solution is to use a list control agw provides one such thing called
ultimatelistCtrl.

I had updated the colorrules.py and made a patch for it. Anyone Please
review and update the file

Hi Rashad,

I can’t even test your patch at the moment because UltimateListCtrl is
not supported in wxPython 2.8.10.1 (which is installed on my
computer). It seems that it is available from 2.8.11, however in the
grass requirements, there is wxPython >= 2.8.1.1. I agree that this
one is pretty old but still we must decide if it is worth changing the
requirements. I think that the version I have is still used a lot so
we should support it. You are using this widget to show the color I
suppose. I am not aware of any other good solution. Maybe you can a
condition on wxPython version and if it is high enough use this
widget, otherwise use the current implementation?

Anna

PFA patch

[0] http://trac.osgeo.org/grass/ticket/1816


Regards,
Rashad


grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

Regards,
Rashad

On Thu, Dec 20, 2012 at 11:45 AM, Mohammed Rashad
<mohammedrashadkm@gmail.com> wrote:

updated the patch. PFA

Do you think its necessary to update the file in trac ?

Yes, please. It can be substituted.

Markus

On Thu, Dec 20, 2012 at 11:45 AM, Mohammed Rashad
<mohammedrashadkm@gmail.com> wrote:

updated the patch. PFA

I've tested it on Ubuntu 12.04 (running in virtaul machine) with
wxPython 2.8.12.1 and there are some bugs. I've attached a screenshot.

As you can see I have a problem with strange background of
checkboxes. I tried wxPython demo and this problem is there too so
probably we cannot do much about it. Do you have the same problem or
it's just me?

Then, when you change the color table (above the rules, there is 'Load
color table'; e.g. from rainbow to aspect) the original numbers in the
list ctrl are still there below the new ones.

I also had sometimes problems to uncheck the items but I am not sure
under which conditions (maybe after changing colortable).

In the beginning when there is no map loaded there are the two
original wx.TextCtrl widgtes

Have you tried to avoid the dialog for setting values? Ideally, user
could edit the rule's value directly in the listctrl and click (or
double click) on the color would launch the wx color dialog.

I think that this solution with ultimatelistctrl looks much better
than the original, however we must first make it work properly.

Anna

(attachments)

colorrules_ubuntu_1204.png

On Sat, Dec 22, 2012 at 5:46 PM, Anna Kratochvílová
<kratochanna@gmail.com>wrote:

> On Thu, Dec 20, 2012 at 11:45 AM, Mohammed Rashad
> <mohammedrashadkm@gmail.com> wrote:
>> updated the patch. PFA

I've tested it on Ubuntu 12.04 (running in virtaul machine) with
wxPython 2.8.12.1 and there are some bugs. I've attached a screenshot.

As you can see I have a problem with strange background of
checkboxes. I tried wxPython demo and this problem is there too so
probably we cannot do much about it. Do you have the same problem or
it's just me?

Same happens for me. But sometimes only !. see the screenshot

Then, when you change the color table (above the rules, there is 'Load
color table'; e.g. from rainbow to aspect) the original numbers in the
list ctrl are still there below the new ones.

I also had sometimes problems to uncheck the items but I am not sure
under which conditions (maybe after changing colortable).

Fixed in the new version

In the beginning when there is no map loaded there are the two
original wx.TextCtrl widgtes

Have you tried to avoid the dialog for setting values? Ideally, user
could edit the rule's value directly in the listctrl and click (or

double click) on the color would launch the wx color dialog.

I sincerly tried a lot for this but ultimatelistctrl has no such provision

or there is a bug in my version

I think that this solution with ultimatelistctrl looks much better
than the original, however we must first make it work properly.

Anna

PFA colorrules.py. If things are looking good. I will provide a patch

--
Regards,
   Rashad

(attachments)

colorrules.py (83.2 KB)
colortable_ubuntu12.04.png