Re: [Sugar-devel] How to have "CellRenderer.props" take effect, without a UI refresh?
Hi all. The issue has been solved !! :) The patch link :: http://git.sugarlabs.org/dextrose/mainline/commit/381e706de7e7309d27a44ed064794a44d50aad4a Thanks for everyone's help. Thanks and Regards, Ajay On Wed, Aug 1, 2012 at 1:33 PM, Ajay Garg wrote: > Thanks Sascha and Flavio. > > > a) > I modified the code to :: > > > > > def __favorite_set_data_cb(self, column, cell, tree_model, tree_iter): > favorite = tree_model[tree_iter][ListModel.COLUMN_FAVORITE] > > if favorite: > client = gconf.client_get_default() > color = XoColor(client.get_string('/desktop/sugar/user/color')) > cell.props.xo_color = color > else: > cell.props.xo_color = None > > > .get_property('window').invalidate_rect(.get_allocation(), False) > .get_property('window').process_updates(True) > > > > where I tried with values of to :: > > * self > * self.tree_view > > However, it made no difference. > > > > > b) > I modified the code to :: > > > > > def __favorite_set_data_cb(self, column, cell, tree_model, tree_iter): > favorite = tree_model[tree_iter][ListModel.COLUMN_FAVORITE] > > if favorite: > client = gconf.client_get_default() > color = XoColor(client.get_string('/desktop/sugar/user/color')) > cell.props.xo_color = color > else: > cell.props.xo_color = None > > > .get_property('window').invalidate_rect(.get_allocation(), True) > .get_property('window').process_updates(True) > > > > where I tried with values of to :: > > * self > * self.tree_view > > However, it caused an infinite recursive loop, and the journal never > loaded. > > > > > c) > I modified the code to :: > > > > > def __favorite_set_data_cb(self, column, cell, tree_model, tree_iter): > favorite = tree_model[tree_iter][ListModel.COLUMN_FAVORITE] > > if favorite: > client = gconf.client_get_default() > color = XoColor(client.get_string('/desktop/sugar/user/color')) > cell.props.xo_color = color > else: > cell.props.xo_color = None > > > .get_property('window').invalidate_rect(.get_allocation(), False) > .get_property('window').process_updates(True) > > > > where I tried with values of to :: > > * column > * cell > > However, it caused the following traceback :: > > Traceback (most recent call last): > File > "/home/ajay/sugar-jhbuild-dx3/install/lib/python2.7/site-packages/jarabe/journal/listview.py", > line 329, in __favorite_set_data_cb > column.get_property('window').invalidate_rect(column.get_allocation(), > False) > TypeError: object of type `GtkTreeViewColumn' does not have property > `window' > > > > > d) > I modified the code to :: > > > > > def __favorite_set_data_cb(self, column, cell, tree_model, tree_iter): > favorite = tree_model[tree_iter][ListModel.COLUMN_FAVORITE] > > if favorite: > client = gconf.client_get_default() > color = XoColor(client.get_string('/desktop/sugar/user/color')) > cell.props.xo_color = color > else: > cell.props.xo_color = None > > > .get_property('window').invalidate_rect(.get_allocation(), True) > .get_property('window').process_updates(True) > > > > where I tried with values of to :: > > * column > * cell > > Same as before - it caused the following traceback :: > > Traceback (most recent call last): > File > "/home/ajay/sugar-jhbuild-dx3/install/lib/python2.7/site-packages/jarabe/journal/listview.py", > line 329, in __favorite_set_data_cb > column.get_property('window').invalidate_rect(column.get_allocation(), > False) > TypeError: object of type `GtkTreeViewColumn' does not have property > `window' > > > > :-\ > > > > Regards, > Ajay > > > > > > On Tue, Jul 31, 2012 at 7:07 AM, Flavio Danesse wrote: > >> self.get_property('window').invalidate_rect(self.get_allocation(), True) >> self.get_property('window').process_updates(True) >> >> >> >> >> 2012/7/30 Sascha Silbe >> >>> Ajay Garg writes: >>> >>>
Re: [Sugar-devel] How to have "CellRenderer.props" take effect, without a UI refresh?
Thanks Sascha and Flavio. a) I modified the code to :: def __favorite_set_data_cb(self, column, cell, tree_model, tree_iter): favorite = tree_model[tree_iter][ListModel.COLUMN_FAVORITE] if favorite: client = gconf.client_get_default() color = XoColor(client.get_string('/desktop/sugar/user/color')) cell.props.xo_color = color else: cell.props.xo_color = None .get_property('window').invalidate_rect(.get_allocation(), False) .get_property('window').process_updates(True) where I tried with values of to :: * self * self.tree_view However, it made no difference. b) I modified the code to :: def __favorite_set_data_cb(self, column, cell, tree_model, tree_iter): favorite = tree_model[tree_iter][ListModel.COLUMN_FAVORITE] if favorite: client = gconf.client_get_default() color = XoColor(client.get_string('/desktop/sugar/user/color')) cell.props.xo_color = color else: cell.props.xo_color = None .get_property('window').invalidate_rect(.get_allocation(), True) .get_property('window').process_updates(True) where I tried with values of to :: * self * self.tree_view However, it caused an infinite recursive loop, and the journal never loaded. c) I modified the code to :: def __favorite_set_data_cb(self, column, cell, tree_model, tree_iter): favorite = tree_model[tree_iter][ListModel.COLUMN_FAVORITE] if favorite: client = gconf.client_get_default() color = XoColor(client.get_string('/desktop/sugar/user/color')) cell.props.xo_color = color else: cell.props.xo_color = None .get_property('window').invalidate_rect(.get_allocation(), False) .get_property('window').process_updates(True) where I tried with values of to :: * column * cell However, it caused the following traceback :: Traceback (most recent call last): File "/home/ajay/sugar-jhbuild-dx3/install/lib/python2.7/site-packages/jarabe/journal/listview.py", line 329, in __favorite_set_data_cb column.get_property('window').invalidate_rect(column.get_allocation(), False) TypeError: object of type `GtkTreeViewColumn' does not have property `window' d) I modified the code to :: def __favorite_set_data_cb(self, column, cell, tree_model, tree_iter): favorite = tree_model[tree_iter][ListModel.COLUMN_FAVORITE] if favorite: client = gconf.client_get_default() color = XoColor(client.get_string('/desktop/sugar/user/color')) cell.props.xo_color = color else: cell.props.xo_color = None .get_property('window').invalidate_rect(.get_allocation(), True) .get_property('window').process_updates(True) where I tried with values of to :: * column * cell Same as before - it caused the following traceback :: Traceback (most recent call last): File "/home/ajay/sugar-jhbuild-dx3/install/lib/python2.7/site-packages/jarabe/journal/listview.py", line 329, in __favorite_set_data_cb column.get_property('window').invalidate_rect(column.get_allocation(), False) TypeError: object of type `GtkTreeViewColumn' does not have property `window' :-\ Regards, Ajay On Tue, Jul 31, 2012 at 7:07 AM, Flavio Danesse wrote: > self.get_property('window').invalidate_rect(self.get_allocation(), True) > self.get_property('window').process_updates(True) > > > > > 2012/7/30 Sascha Silbe > >> Ajay Garg writes: >> >> >> [adding short-circuit logic to >> >> jarabe.journal.listview.BaseListView.refresh()] >> [...] >> >> What we should do is enhancing the logic to >> >> >> >> a) just redraw instead of querying the back-end again for changes we >> >>triggered ourselves and / or >> >> b) update our model based on the change notifications rather than >> >>throwing away our state. >> >> >> > >> > Well, that's exactly what I did, via the patch >> > >> http://git.sugarlabs.org/dextrose/mainline/commit/ad3897946e013f1ff4020aeab35375ccb122758b >> >>
Re: [Sugar-devel] How to have "CellRenderer.props" take effect, without a UI refresh?
self.get_property('window').invalidate_rect(self.get_allocation(), True) self.get_property('window').process_updates(True) 2012/7/30 Sascha Silbe > Ajay Garg writes: > > >> [adding short-circuit logic to > >> jarabe.journal.listview.BaseListView.refresh()] > [...] > >> What we should do is enhancing the logic to > >> > >> a) just redraw instead of querying the back-end again for changes we > >>triggered ourselves and / or > >> b) update our model based on the change notifications rather than > >>throwing away our state. > >> > > > > Well, that's exactly what I did, via the patch > > > http://git.sugarlabs.org/dextrose/mainline/commit/ad3897946e013f1ff4020aeab35375ccb122758b > > Not really AFAICT. You're still inhibiting the refresh completely, > without doing a redraw. You're also doing a gratuitous data store query > for each favourite star. I'm expecting that to have considerable impact > on performance. > > > > I guess, if we could somehow cause the mouse to PROGRAMMATICALLY > > hover-away/disappear-momentarily when the star/favorite-icon is clicked, > we > > could be done. > > However, I am not able to find a way to do this via pygtk. > > Fortunately. :-P > > As discussed on IRC, the way to _trigger_ _a_ _redraw_ (not: move the > pointer) is something like this: > > x_, y_, width, height = self.allocation > area = (0, 0, width, height) > self.window.invalidate_rect(area, False) > > > Sascha > -- > http://sascha.silbe.org/ > http://www.infra-silbe.de/ > > ___ > Sugar-devel mailing list > Sugar-devel@lists.sugarlabs.org > http://lists.sugarlabs.org/listinfo/sugar-devel > > ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] How to have "CellRenderer.props" take effect, without a UI refresh?
Ajay Garg writes: >> [adding short-circuit logic to >> jarabe.journal.listview.BaseListView.refresh()] [...] >> What we should do is enhancing the logic to >> >> a) just redraw instead of querying the back-end again for changes we >>triggered ourselves and / or >> b) update our model based on the change notifications rather than >>throwing away our state. >> > > Well, that's exactly what I did, via the patch > http://git.sugarlabs.org/dextrose/mainline/commit/ad3897946e013f1ff4020aeab35375ccb122758b Not really AFAICT. You're still inhibiting the refresh completely, without doing a redraw. You're also doing a gratuitous data store query for each favourite star. I'm expecting that to have considerable impact on performance. > I guess, if we could somehow cause the mouse to PROGRAMMATICALLY > hover-away/disappear-momentarily when the star/favorite-icon is clicked, we > could be done. > However, I am not able to find a way to do this via pygtk. Fortunately. :-P As discussed on IRC, the way to _trigger_ _a_ _redraw_ (not: move the pointer) is something like this: x_, y_, width, height = self.allocation area = (0, 0, width, height) self.window.invalidate_rect(area, False) Sascha -- http://sascha.silbe.org/ http://www.infra-silbe.de/ pgpkGEtFdwIpJ.pgp Description: PGP signature ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] How to have "CellRenderer.props" take effect, without a UI refresh?
Anyways, posted the query at pygtk mailing-list :: http://www.daa.com.au/pipermail/pygtk/2012-July/020425.html Regards, Ajay On Wed, Jul 25, 2012 at 11:38 AM, Ajay Garg wrote: > Thanks Frederick for the reply. > > On Wed, Jul 25, 2012 at 11:33 AM, Frederick Grose wrote: > >> On Wed, Jul 25, 2012 at 1:48 AM, Ajay Garg wrote: >> >>> >>> >>> On Tue, Jul 24, 2012 at 7:12 PM, Sascha Silbe >> > wrote: >>> Ajay Garg writes: [toggling favourite star causes a "listview-refresh"] >>> >>> >> >>> {...} >>> >>> >> >>> ...the favorite-status IS updated by clicking the star/favorite-icon (without needing the refresh). >>> >>> >>> However, this causes our original issue: the favorite-status is updated >>> (graphically), only when the mouse is hovered away from the >>> star/favorite-icon. >>> >> >> The interaction design for the changing the favorite status might be >> changed as noted in this bug report: >> http://bugs.sugarlabs.org/ticket/3147#comment:3 >> > > > Fred, this ticket tackles a different design-discussion (what should the > prelit-color be). > However, mine query is a different one :) > > > Thanks anyways for the interest. I am obliged. > > > Thanks and Regards, > Ajay > > >> >> --Fred >> >> >>> >>> I guess, if we could somehow cause the mouse to PROGRAMMATICALLY >>> hover-away/disappear-momentarily when the star/favorite-icon is clicked, we >>> could be done. >>> However, I am not able to find a way to do this via pygtk. >>> >>> >>> Regards, >>> Ajay >>> >> >> ___ >> Sugar-devel mailing list >> Sugar-devel@lists.sugarlabs.org >> http://lists.sugarlabs.org/listinfo/sugar-devel >> >> > ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] How to have "CellRenderer.props" take effect, without a UI refresh?
Thanks Frederick for the reply. On Wed, Jul 25, 2012 at 11:33 AM, Frederick Grose wrote: > On Wed, Jul 25, 2012 at 1:48 AM, Ajay Garg wrote: > >> >> >> On Tue, Jul 24, 2012 at 7:12 PM, Sascha Silbe >> wrote: >> >>> Ajay Garg writes: >>> >>> [toggling favourite star causes a "listview-refresh"] >> >> > >> {...} >> >> > >> ...the favorite-status IS updated by clicking the star/favorite-icon >>> (without needing the refresh). >> >> >> However, this causes our original issue: the favorite-status is updated >> (graphically), only when the mouse is hovered away from the >> star/favorite-icon. >> > > The interaction design for the changing the favorite status might be > changed as noted in this bug report: > http://bugs.sugarlabs.org/ticket/3147#comment:3 > Fred, this ticket tackles a different design-discussion (what should the prelit-color be). However, mine query is a different one :) Thanks anyways for the interest. I am obliged. Thanks and Regards, Ajay > > --Fred > > >> >> I guess, if we could somehow cause the mouse to PROGRAMMATICALLY >> hover-away/disappear-momentarily when the star/favorite-icon is clicked, we >> could be done. >> However, I am not able to find a way to do this via pygtk. >> >> >> Regards, >> Ajay >> > > ___ > Sugar-devel mailing list > Sugar-devel@lists.sugarlabs.org > http://lists.sugarlabs.org/listinfo/sugar-devel > > ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] How to have "CellRenderer.props" take effect, without a UI refresh?
On Wed, Jul 25, 2012 at 1:48 AM, Ajay Garg wrote: > > > On Tue, Jul 24, 2012 at 7:12 PM, Sascha Silbe > wrote: > >> Ajay Garg writes: >> >> [toggling favourite star causes a "listview-refresh"] > > > {...} > > > ...the favorite-status IS updated by clicking the star/favorite-icon >> (without needing the refresh). > > > However, this causes our original issue: the favorite-status is updated > (graphically), only when the mouse is hovered away from the > star/favorite-icon. > The interaction design for the changing the favorite status might be changed as noted in this bug report: http://bugs.sugarlabs.org/ticket/3147#comment:3 --Fred > > I guess, if we could somehow cause the mouse to PROGRAMMATICALLY > hover-away/disappear-momentarily when the star/favorite-icon is clicked, we > could be done. > However, I am not able to find a way to do this via pygtk. > > > Regards, > Ajay > ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] How to have "CellRenderer.props" take effect, without a UI refresh?
On Tue, Jul 24, 2012 at 7:12 PM, Sascha Silbe wrote: > Ajay Garg writes: > > [toggling favourite star causes a "listview-refresh"] > >> What exactly do you mean by "listview-refresh"? Do you mean a) a redraw > >> of the current content or b) some operation that causes us to query the > >> data store (or file system)? > > > > By refresh, I mean to say that the data store is re-queried. > > OK. We should try to avoid that; see below. > > > > More clearly, I changed the code (in src/jarabe/journal/listview) from :: > [adding short-circuit logic to > jarabe.journal.listview.BaseListView.refresh()] > > Well, if you inhibit our current way of refreshing the view, it's kind > of expected that it doesn't work anymore. ;) > > What we should do is enhancing the logic to > > a) just redraw instead of querying the back-end again for changes we >triggered ourselves and / or > b) update our model based on the change notifications rather than >throwing away our state. > Well, that's exactly what I did, via the patch http://git.sugarlabs.org/dextrose/mainline/commit/ad3897946e013f1ff4020aeab35375ccb122758b Herein, while in multi-select, the refresh is inhibited (as already stated before). So, as a result, the favorite-status IS updated by clicking the star/favorite-icon (without needing the refresh). However, this causes our original issue: the favorite-status is updated (graphically), only when the mouse is hovered away from the star/favorite-icon. I guess, if we could somehow cause the mouse to PROGRAMMATICALLY hover-away/disappear-momentarily when the star/favorite-icon is clicked, we could be done. However, I am not able to find a way to do this via pygtk. Regards, Ajay > > Sascha > -- > http://sascha.silbe.org/ > http://www.infra-silbe.de/ > ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] How to have "CellRenderer.props" take effect, without a UI refresh?
Ajay Garg writes: [toggling favourite star causes a "listview-refresh"] >> What exactly do you mean by "listview-refresh"? Do you mean a) a redraw >> of the current content or b) some operation that causes us to query the >> data store (or file system)? > > By refresh, I mean to say that the data store is re-queried. OK. We should try to avoid that; see below. > More clearly, I changed the code (in src/jarabe/journal/listview) from :: [adding short-circuit logic to jarabe.journal.listview.BaseListView.refresh()] Well, if you inhibit our current way of refreshing the view, it's kind of expected that it doesn't work anymore. ;) What we should do is enhancing the logic to a) just redraw instead of querying the back-end again for changes we triggered ourselves and / or b) update our model based on the change notifications rather than throwing away our state. Sascha -- http://sascha.silbe.org/ http://www.infra-silbe.de/ pgpHNxELo7S95.pgp Description: PGP signature ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] How to have "CellRenderer.props" take effect, without a UI refresh?
Sir, Regards. Thanks for the reply. On Tue, Jul 24, 2012 at 6:36 PM, Sascha Silbe wrote: > Ajay Garg writes: > > > This piece of code works as expected, and the toggling-UI-effect takes > > place as soon as the star/favorite-icon is clicked (that is, the > > mouse-pointer need not be hovered away). > > But note that, there is listview-refresh involved after each toggling of > > the star/favorite-icon. > > What exactly do you mean by "listview-refresh"? Do you mean a) a redraw > of the current content or b) some operation that causes us to query the > data store (or file system)? > By refresh, I mean to say that the data store is re-queried. More clearly, I changed the code (in src/jarabe/journal/listview) from :: ## def refresh(self): logging.debug('ListView.refresh query %r', self._query) self._stop_progress_bar() if self._model is not None: self._model.stop() self._dirty = False self._model = ListModel(self._query) self._model.connect('ready', self.__model_ready_cb) self._model.connect('progress', self.__model_progress_cb) self._model.setup() ## TO ## def refresh(self): if not self._inhibit_refresh: self.proceed_with_refresh() def proceed_with_refresh(self): logging.debug('ListView.refresh query %r', self._query) self._stop_progress_bar() if self._model is not None: self._model.stop() self._dirty = False self._model = ListModel(self._query) self._model.connect('ready', self.__model_ready_cb) self._model.connect('progress', self.__model_progress_cb) self._model.setup() ## where "self._inhibit_refresh = False", in multi-select mode. Regards, Ajay > > > If the listview-refresh is inhibited, the toggling-UI-effect does take > > place, but ONLY AFTER the mouse-pointer is hovered away from the > > star/favorite-icon. > > What exactly do you mean by "listview-refresh is inhibited"? How did you > inhibit it? > > Sascha > -- > http://sascha.silbe.org/ > http://www.infra-silbe.de/ > ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] How to have "CellRenderer.props" take effect, without a UI refresh?
Ajay Garg writes: > This piece of code works as expected, and the toggling-UI-effect takes > place as soon as the star/favorite-icon is clicked (that is, the > mouse-pointer need not be hovered away). > But note that, there is listview-refresh involved after each toggling of > the star/favorite-icon. What exactly do you mean by "listview-refresh"? Do you mean a) a redraw of the current content or b) some operation that causes us to query the data store (or file system)? > If the listview-refresh is inhibited, the toggling-UI-effect does take > place, but ONLY AFTER the mouse-pointer is hovered away from the > star/favorite-icon. What exactly do you mean by "listview-refresh is inhibited"? How did you inhibit it? Sascha -- http://sascha.silbe.org/ http://www.infra-silbe.de/ pgpwipKY9Pam9.pgp Description: PGP signature ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
[Sugar-devel] How to have "CellRenderer.props" take effect, without a UI refresh?
Hi all. I have been investigating the following piece of code, from "src/jarabe/journal/listview.py" :: def __favorite_set_data_cb(self, column, cell, tree_model, tree_iter): favorite = tree_model[tree_iter][ListModel.COLUMN_FAVORITE] if favorite: client = gconf.client_get_default() color = XoColor(client.get_string('/desktop/sugar/user/color')) cell.props.xo_color = color else: cell.props.xo_color = None This piece of code works as expected, and the toggling-UI-effect takes place as soon as the star/favorite-icon is clicked (that is, the mouse-pointer need not be hovered away). But note that, there is listview-refresh involved after each toggling of the star/favorite-icon. If the listview-refresh is inhibited, the toggling-UI-effect does take place, but ONLY AFTER the mouse-pointer is hovered away from the star/favorite-icon. This becomes all the more important, since the listview-refresh is inhibited in multi-select mode (as part of the feature being proposed/discussed at http://lists.sugarlabs.org/archive/sugar-devel/2012-July/038558.html). The same observations stand true, for the checkbox icon (as part of multi-select feature). So, * Is it feasible to have the toggling-UI-effect takes place, without the need for hovering the mouse-pointer away from the star/favorite-icon, when listview-refresh is inhibited?* I will be grateful for any ideas. Thanks and Regards, Ajay ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel