Sign up

Help with advice setting up for a new project…

The Point:

Right now, I rather need advice on all the usual stuff that should precede the writing of mygtkdprogram.d.

The Short:

I'm putting together a small-ish utility for a non-programming friend who does a whole lot of very tedious game modding, by hand. For the last week or two, several times over now, they've complained about their most recent tedium, I've spent 20 minutes getting them to explain it to me sufficiently (getting better at that, slowly), 10 minutes belting together and testing a small task-specific utility, sent it over to them (mostly just Python scripts, so pastebin!), and suddenly the remaining hour or two of tedium just vanishes. My plan, is to firstly rewrite them in D (pastebin not so good), and secondly collect these together into a toolkit utility with a simple GUI. Which is where GTK comes in.

The Present:

So, what I'm looking for, is an intermediate programmer's guide to getting started on what I figure will be a medium-sized GtkD project intended for small distribution to someone who's good with Photoshop, but has a hard time with the command line; eg. "A command prompt flashed up briefly then went away, and it didn't do anything." (Yeah, so then I had to walk them through opening up the command prompt, and running the utility from said command prompt, so they could actually tell me what the error message was, a minute or two fixing things up, pastebin them (it's a verb now) a new copy, and success! Task done. Rinse and repeat a couple hours later with their new task, and new chunk of Python code. They finally get the "just run it from the command prompt" thing, so it's getting better.) Now, I'm moderately new to D, I know enough to have had no real trouble converting those Python utilities, but I've never actually tried to write anything of any significant size in D, always so far just been a single .d file, run on the spot with rdmd. And while I had no trouble with a short tutorial series of little Hello World style GtkD programs (labels, buttons, check boxes, tree views, the canvas, that sort of thing), GTK3 is still a relatively new beastie to me.

The History:

(probably best to skip this part) I last used GTK2, way back when Vala was so new it couldn't actually compile a complete useful program yet. There was also this GTK3 thing, Glade was a thing, and along with Vala when it became a useful thing, they looked like a really nice environment. So I watched Vala's development, but otherwise kept using GTK2 which I was nice and familiar with, and most of my existing code used. Then life happened. And for the past however long it's been, I've been on a Windows machine (presently a 6yo laptop running tight on resources), and the only programming I've done has been tiny little personal hacks in Python here and there. Along the way I watched D, and when I ran headlong into the rather significant issues of Python's TCL/TK bindings, I decided it might be time to look for something better. Most of the little utilities I wrote in Python, were pretty straight forward to port to D, so I think it's time to start the toolkit utility fresh before it gets too much further, with a real GUI where I won't have to write most of the widgets myself using a canvas; I was actually getting to the point with TK, that I was just going to scrap the whole UI and do exactly that. I'd written a fairly significant UI toolkit previously over the years for my personal use, back in the 16-bit Borland Pascal days, with buttons, check boxes, entry fields, widget layout containers, windowing, and a syntax highlighting text editor with undo/redo, all the usual stuff, so I'm pretty sure it'd have been quicker to just write the basic UI and widgets I needed from scratch, then belt my head against that TCL-TK-Python monstrosity. Or even better, just bite the bullet and switch to something decent.

Brief Recap:

So. I'm on Windows, constrained resources (no Visual D, I'm actually using gvim and a web browser, which really takes me back to my GTK2 days…), I've got D, the GTK3 runtime, and GtkD, and have successfully put together a rather grotesque single-file conglomeration of an entire tutorial series on learning GtkD (it's got menu's that do nothing, buttons that print "Hello", a tree view with buttons and entry fields that sort of does something that's utterly useless, and a canvas with circles and boxes and jumpy dots). Good times.

The Why:

I'm planning to try use DUB for this (because it seems appropriate from what little I know of it — I could be wrong, though — more so however, I don't have anything else, and it seems like something else I should probably learn about), and I need to end up with a zip file my friend can simply unzip and click the one ending in .exe (in actual fact, my distribution method of choice will probably be Dropbox — it's a little past pastebin, I think — so I'll just share the "distribution" folder for now and they can run it directly). But, they've got a friend they've been collaborating with a bit, too, which they're probably going to want to give it to also, so I'll need to get it into a point-and-shoot zip at least in short order.

The Pointier:

I'm therefore looking for advice on how to lay out the build environment, configure DUB, where to put extra GTK resources like icons, Glade files (I presume there's a version of Glade for Windows? I haven't actually looked yet. Also part of "lay out the build environment"), all with a mind to eventually having a "publish distribution packages" button, including a self-installing Windows version, probably shoving it all up on GitHub, and moving into a cave in the mountains before the hate mail and angry tweets overtake what's left of my life and sanity.

Re: Help with advice setting up for a new project …

On 27-07-17 18:22, Fredderic U wrote:

Brief Recap:

So. I'm on Windows, constrained resources (no Visual D, I'm actually using gvim and a web browser, which really takes me back to my GTK2 days…), I've got D, the GTK3 runtime, and GtkD, and have successfully put together a rather grotesque single-file conglomeration of an entire tutorial series on learning GtkD (it's got menu's that do nothing, buttons that print "Hello", a tree view with buttons and entry fields that sort of does something that's utterly useless, and a canvas with circles and boxes and jumpy dots). Good times.

The Why:

I'm planning to try use DUB for this (because it seems appropriate from what little I know of it — I could be wrong, though — more so however, I don't have anything else, and it seems like something else I should probably learn about), and I need to end up with a zip file my friend can simply unzip and click the one ending in .exe (in actual fact, my distribution method of choice will probably be Dropbox — it's a little past pastebin, I think — so I'll just share the "distribution" folder for now and they can run it directly). But, they've got a friend they've been collaborating with a bit, too, which they're probably going to want to give it to also, so I'll need to get it into a point-and-shoot zip at least in short order.

The Pointier:

I'm therefore looking for advice on how to lay out the build environment, configure DUB, where to put extra GTK resources like icons, Glade files (I presume there's a version of Glade for Windows? I haven't actually looked yet. Also part of "lay out the build environment"), all with a mind to eventually having a "publish distribution packages" button, including a self-installing Windows version, probably shoving it all up on GitHub, and moving into a cave in the mountains before the hate mail and angry tweets overtake what's left of my life and sanity.

I might be the wrong person to ask as i haven't written a sizable gtk(d)
application, and rarely use Windows. But structure it as any other project.

There used to be a sample project on Bitbucket but i can't seem to find it.

Distributing a zip with a single exe might be troublesome as GtkD
expects to find the GTK libraries on your PATH.

dub is probably the way to go, on windows you will run into a optlink
issue, https://issues.dlang.org/show_bug.cgi?id=15418 to get around that
pass --build=plain to dub so it doesn't build a debug version, which
is the default for dub.

There in a windows download for glade on https://glade.gnome.org

Re: Help with advice setting up for a new project …

On Thu, 27 Jul 2017 22:40:59 +0200, Mike Wey wrote:

I might be the wrong person to ask as i haven't written a sizable gtk(d)
application, and rarely use Windows. But structure it as any other project.

Was wondering mostly, if there are any preferred location for additional resources for Glade and the likes. I never really used it much back in the old days, but I do recall it had some pesky resources mechanism for loading images and the likes, and was wondering if it had a preferred directory structure that would just make things simpler (going with a default path, vs. having to type the path in for every resource, type of thing).

Distributing a zip with a single exe might be troublesome as GtkD
expects to find the GTK libraries on your PATH.

Well, I can include the GTK3 runtime in the zip. They can manage to double-click and install — except, the runtime seems to have vanished. (I eventually tracked it down, they installed it, and the demo works just fine.)

But, now it's all about some MSYS2 thing, that gave me a headache trying to figure out, and I'm still not sure I've got the full grasp on it. Anyone knows what that's all about, particularly in relation to GtkD/DUB? I'm just getting back into GTK after over a decade, plus a relatively new language on top. I'd rather not have to tackle a whole new build system if I can avoid it. lol

dub is probably the way to go, on windows you will run into a optlink
issue, https://issues.dlang.org/show_bug.cgi?id=15418 to get around that
pass --build=plain to dub so it doesn't build a debug version, which
is the default for dub.

That issue is still from 2015…? That is depressing. Otherwise, it works great. Thank You. And for the glade link, too.

Re: Help with advice setting up for a new project …

On 31-07-17 19:41, Fredderic U wrote:

On Thu, 27 Jul 2017 22:40:59 +0200, Mike Wey wrote:

I might be the wrong person to ask as i haven't written a sizable gtk(d)
application, and rarely use Windows. But structure it as any other project.

Was wondering mostly, if there are any preferred location for additional resources for Glade and the likes. I never really used it much back in the old days, but I do recall it had some pesky resources mechanism for loading images and the likes, and was wondering if it had a preferred directory structure that would just make things simpler (going with a default path, vs. having to type the path in for every resource, type of thing).

On linux that would be /usr/share/appname/*.ui but i don't think there
is a default on windows.

You might be able to use D's import feature in combination with
addFromString to embed the glade file in the binary.

Distributing a zip with a single exe might be troublesome as GtkD
expects to find the GTK libraries on your PATH.

Well, I can include the GTK3 runtime in the zip. They can manage to double-click and install — except, the runtime seems to have vanished. (I eventually tracked it down, they installed it, and the demo works just fine.)

But, now it's all about some MSYS2 thing, that gave me a headache trying to figure out, and I'm still not sure I've got the full grasp on it. Anyone knows what that's all about, particularly in relation to GtkD/DUB? I'm just getting back into GTK after over a decade, plus a relatively new language on top. I'd rather not have to tackle a whole new build system if I can avoid it. lol

I think that 3.8 was the last GTK version that had an "official" windows
installer. After that is started building my own installer, first by
compiling GTK myself. But now i use the binaries from msys2 for the
installer.

The official way the install gtk on windows seems to be msys2 nowadays,
i don't know when that switch was made.

dub is probably the way to go, on windows you will run into a optlink
issue, https://issues.dlang.org/show_bug.cgi?id=15418 to get around that
pass --build=plain to dub so it doesn't build a debug version, which
is the default for dub.

That issue is still from 2015…? That is depressing. Otherwise, it works great. Thank You. And for the glade link, too.

And AFAIK no way to tell dub to build the plain version by default, at
least not by the project.

Re: Help with advice setting up for a new project …

On Mon, 31 Jul 2017 22:54:17 +0200, Mike Wey wrote:

On 31-07-17 19:41, Fredderic U wrote:

Was wondering mostly, if there are any preferred location for additional resources for Glade and the likes. I never really used it much back in the old days, but I do recall it had some pesky resources mechanism for loading images and the likes, and was wondering if it had a preferred directory structure that would just make things simpler (going with a default path, vs. having to type the path in for every resource, type of thing).
On linux that would be /usr/share/appname/*.ui but i don't think there
is a default on windows.
You might be able to use D's import feature in combination with
addFromString to embed the glade file in the binary.

Ah, now that's certainly an option to keep in mind. At least until the project starts getting a little unwieldy. (I might want to reconsider that approach when the executable is pushing the 1GB mark… Although there's zlib in the core too, right? :D ) Hopefully by then I'll have had a chance to wrap my head around this msys2 stuff a bit more…

Well, I can include the GTK3 runtime in the zip. They can manage to double-click and install — except, the runtime seems to have vanished. (I eventually tracked it down, they installed it, and the demo works just fine.)
But, now it's all about some MSYS2 thing, that gave me a headache trying to figure out, and I'm still not sure I've got the full grasp on it. Anyone knows what that's all about, particularly in relation to GtkD/DUB? I'm just getting back into GTK after over a decade, plus a relatively new language on top. I'd rather not have to tackle a whole new build system if I can avoid it. lol
I think that 3.8 was the last GTK version that had an "official" windows
installer. After that is started building my own installer, first by
compiling GTK myself. But now i use the binaries from msys2 for the
installer.
The official way the install gtk on windows seems to be msys2 nowadays,
i don't know when that switch was made.

Okay. For now, I think I'll just upgrade myself to the 3.8 that I tracked down for my friend, and just stick with that for the time being, then. Perhaps by the time I need to update, msys2 will have become a more integrated experience anyhow. If I'm lucky.

dub is probably the way to go, on windows you will run into a optlink
issue, https://issues.dlang.org/show_bug.cgi?id=15418 to get around that
pass --build=plain to dub so it doesn't build a debug version, which
is the default for dub.
That issue is still from 2015…? That is depressing. Otherwise, it works great. Thank You. And for the glade link, too.
And AFAIK no way to tell dub to build the plain version by default, at
least not by the project.

meh… I whacked that line in a file and called it run.bat, so all good.

Okay. Once again, Thank You for the help, I did like GTK back in the day, and it's nice to be back into it again (and a heck of a lot better to work with than Tkinter).

Re: Help with advice setting up for a new project …

On 02-08-17 06:52, Fredderic U wrote:

Okay. For now, I think I'll just upgrade myself to the 3.8 that I tracked down for my friend, and just stick with that for the time being, then. Perhaps by the time I need to update, msys2 will have become a more integrated experience anyhow. If I'm lucky.

As long as you don't use any of the newer functionality, that should
work fine.

For the most recent version of GTK there is also an installer available
on gtkd.org: https://gtkd.org/download.html