January 23, 2020 Re: Blog Post #0099: A Special Request | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ron Tarrant | On Wednesday, 22 January 2020 at 21:22:57 UTC, Ron Tarrant wrote: > On Tuesday, 21 January 2020 at 22:12:10 UTC, Antonio Corbi wrote: >> On Tuesday, 21 January 2020 at 22:06:30 UTC, Ron Tarrant wrote: > >> Do you still have the Maurer Rose example? > > I had to look this up. I'd never heard of it before. That being said... > >> Do you think it could fit this kind of example? > > When I say "demo" I'm talking about examples of how to do various GTK GUI stuff rather than mathematical exercises. Trying to do this mathematical/drawing exercise, I'd be waaaaaaay out of my element. The few simple math/draw examples I did in Cairo (posts #0057 to #0064) is about my limit as far as math goes. > > However, I can point you at this repository of Java examples: https://github.com/iabin/Maurer-Rose/tree/master/src > > Using the methods outlined in the posts I've listed, you should be able to port it over from Java to D. I'm not a mathematician, so I wouldn't be of much help. > > I wish you the best of luck on this endeavour. I was referring to this example I made some time ago: https://gitlab.com/amcorbi/dmaurerrose I think this is somewhat related to what te OP was asking for. Assuming you are on GNU/Linux, a simple 'dub run' is all you have to do to make it compile and run. Antonio |
January 23, 2020 Re: Blog Post #0099: A Special Request | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ron Tarrant | On Wednesday, 22 January 2020 at 21:26:40 UTC, Ron Tarrant wrote: > On Wednesday, 22 January 2020 at 09:18:51 UTC, Ferhat Kurtulmuş wrote: > >> Another useful tutorial would be something using bindProperty and/or bindPropertyWithClosures. Once I used bindProperty with vala, but I think there is no any example to do it with gtkd. > > I found a bindProperty() function in gobject/ObjectG.d. Is this what you're referring to? Yes that one. Let me define a use case. We have a button spawning a thread doing some time consuming job (we can use Thread.sleep(5.seconds)). I want this button disabled so that user cannot spawn another thread while the first one is on duty. In the same time, we show a spinner while job is running. After completion, we want to set button enabled and to make the spinner invisible. Instead of setting properties of button and spinner separately, we can bind disabled property of the button and visible property of the spinner each other. In vala, we can use something like (pseudo code): "this" may refer to a self pointer to an instance of derived spinner class: this.bind_property("customWorkingProperty", somebutton, "sensitive", BindingFlags.INVERT_BOOLEAN); bool customWorkingProperty() will be responsible for showing and hiding the spinner. |
January 23, 2020 Re: Blog Post #0099: A Special Request | ||||
---|---|---|---|---|
| ||||
Posted in reply to Antonio Corbi | On Thursday, 23 January 2020 at 08:33:39 UTC, Antonio Corbi wrote: > https://gitlab.com/amcorbi/dmaurerrose > > I think this is somewhat related to what te OP was asking for. I'm confused. I was the OP, so I'm not sure who you're referring to. > Assuming you are on GNU/Linux, a simple 'dub run' is all you have to do to make it compile and run. On Windows, `dub run` yielded the following output: Performing "debug" build using C:\D\dmd2\windows\bin\dmd.exe for x86_64. gtk-d:gtkd 3.9.0: target for configuration "library" is up to date. gtk-d:gstreamer 3.9.0: target for configuration "library" is up to date. gtk-d:peas 3.9.0: target for configuration "library" is up to date. gtk-d:sv 3.9.0: target for configuration "library" is up to date. gtk-d:vte 3.9.0: target for configuration "library" is up to date. maurerrose-d ~master: building configuration "application"... Running pre-build commands... source/constants.d.in was unexpected at this time. Command failed with exit code 1: if [ source/constants.d.in -nt source/constants.d ]; then sed -e 's#topdir#D:\temp\dmaurerrose-master#' source/constants.d.in > source/constants.d; fi |
January 23, 2020 Re: Blog Post #0099: A Special Request | ||||
---|---|---|---|---|
| ||||
Posted in reply to Antonio Corbi | On Thursday, 23 January 2020 at 08:33:39 UTC, Antonio Corbi wrote: > https://gitlab.com/amcorbi/dmaurerrose > > I think this is somewhat related to what te OP was asking for. I'm confused. I was the OP, so I'm not sure who you're referring to. > Assuming you are on GNU/Linux, a simple 'dub run' is all you have to do to make it compile and run. On Windows, `dub run` yielded the following output: Performing "debug" build using C:\D\dmd2\windows\bin\dmd.exe for x86_64. gtk-d:gtkd 3.9.0: target for configuration "library" is up to date. gtk-d:gstreamer 3.9.0: target for configuration "library" is up to date. gtk-d:peas 3.9.0: target for configuration "library" is up to date. gtk-d:sv 3.9.0: target for configuration "library" is up to date. gtk-d:vte 3.9.0: target for configuration "library" is up to date. maurerrose-d ~master: building configuration "application"... Running pre-build commands... source/constants.d.in was unexpected at this time. Command failed with exit code 1: if [ source/constants.d.in -nt source/constants.d ]; then sed -e 's#topdir#D:\temp\dmaurerrose-master#' source/constants.d.in > source/constants.d; fi |
January 23, 2020 Re: Blog Post #0099: A Special Request | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ferhat Kurtulmuş | On Thursday, 23 January 2020 at 09:27:45 UTC, Ferhat Kurtulmuş wrote:
> I want this button disabled so that user cannot spawn another thread while the first one is on duty.
This is actually the subject of an up-coming post which is scheduled to go live on Feb. 25, 2020. It uses setSensitive() rather than bindProperty(), but it has the same effect.
|
January 23, 2020 Re: Blog Post #0099: A Special Request | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ron Tarrant | On Thursday, 23 January 2020 at 12:29:11 UTC, Ron Tarrant wrote: > On Thursday, 23 January 2020 at 08:33:39 UTC, Antonio Corbi wrote: > >> https://gitlab.com/amcorbi/dmaurerrose >> >> I think this is somewhat related to what te OP was asking for. > > I'm confused. I was the OP, so I'm not sure who you're referring to. Ooops, sorry, my bad! > >> Assuming you are on GNU/Linux, a simple 'dub run' is all you have to do to make it compile and run. > > On Windows, `dub run` yielded the following output: > > Performing "debug" build using C:\D\dmd2\windows\bin\dmd.exe for x86_64. > gtk-d:gtkd 3.9.0: target for configuration "library" is up to date. > gtk-d:gstreamer 3.9.0: target for configuration "library" is up to date. > gtk-d:peas 3.9.0: target for configuration "library" is up to date. > gtk-d:sv 3.9.0: target for configuration "library" is up to date. > gtk-d:vte 3.9.0: target for configuration "library" is up to date. > maurerrose-d ~master: building configuration "application"... > Running pre-build commands... > source/constants.d.in was unexpected at this time. > Command failed with exit code 1: if [ source/constants.d.in -nt source/constants.d ]; then sed -e 's#topdir#D:\temp\dmaurerrose-master#' source/constants.d.in > source/constants.d; fi Yes, it uses 'sed' to get 'constants.d' from 'constants.d.in' at configuration time. So you can write your own 'constants.d' with the appropiate values for UIDIR and DATADIR and delete/comment the the preBuildCommands in dub.sdl. Hope this helps. Antonio |
January 23, 2020 Re: Blog Post #0099: A Special Request | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ron Tarrant | On Thursday, 23 January 2020 at 12:32:57 UTC, Ron Tarrant wrote:
> On Thursday, 23 January 2020 at 09:27:45 UTC, Ferhat Kurtulmuş wrote:
>
>> I want this button disabled so that user cannot spawn another thread while the first one is on duty.
>
> This is actually the subject of an up-coming post which is scheduled to go live on Feb. 25, 2020. It uses setSensitive() rather than bindProperty(), but it has the same effect.
Yes, but what if you set sensitive properties of a bunch of the widgets in the same time. Each time you have to write and call setSensitive() for each widgets. If you bind their sensitivity property to one single widget, you can only switch one widget's property, and others will set automatically.
void doWhenDownloadIsComplete1(){// a lot of code pollution
but1.setSensitive(false);
but2.setSensitive(false);
.
.
entry2.setSensitive(false);
}
...
void doWhenDownloadIsComplete2(){ // nicer
but1.setSensitive(false);
// other widgets' sensitive properties are binded to of but1. No extra code needed.
}
|
January 23, 2020 Re: Blog Post #0099: A Special Request | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ferhat Kurtulmuş | On Thursday, 23 January 2020 at 13:41:34 UTC, Ferhat Kurtulmuş wrote: > On Thursday, 23 January 2020 at 12:32:57 UTC, Ron Tarrant wrote: >> [...] > > Yes, but what if you set sensitive properties of a bunch of the widgets in the same time. Each time you have to write and call setSensitive() for each widgets. If you bind their sensitivity property to one single widget, you can only switch one widget's property, and others will set automatically. > > void doWhenDownloadIsComplete1(){// a lot of code pollution > but1.setSensitive(false); > but2.setSensitive(false); > . > . > entry2.setSensitive(false); > } > > ... > > void doWhenDownloadIsComplete2(){ // nicer > but1.setSensitive(false); > // other widgets' sensitive properties are binded to of but1. No extra code needed. > } Actually I have just tried this with gtkd and working: button1.bindProperty("sensitive", entry1, "sensitive", GBindingFlags.DEFAULT); |
January 23, 2020 Re: Blog Post #0099: A Special Request | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ferhat Kurtulmuş | On Thursday, 23 January 2020 at 14:10:37 UTC, Ferhat Kurtulmuş wrote:
> Actually I have just tried this with gtkd and working:
>
> button1.bindProperty("sensitive", entry1, "sensitive", GBindingFlags.DEFAULT);
That's pretty cool, Ferhat. I'll add this to the todo list.
|
January 23, 2020 Re: Blog Post #0099: A Special Request | ||||
---|---|---|---|---|
| ||||
Posted in reply to Antonio Corbi | On Thursday, 23 January 2020 at 12:43:24 UTC, Antonio Corbi wrote: > Yes, it uses 'sed' to get 'constants.d' from 'constants.d.in' at configuration time. > So you can write your own 'constants.d' with the appropiate values for UIDIR and DATADIR and delete/comment the the preBuildCommands in dub.sdl. This is beginning to sound like it's beyond the scope of the blog. |
Copyright © 1999-2021 by the D Language Foundation