progress_dialog

A simple progress dialog for the D programming language

It should work without requiring any 3rd party GUI toolkits. But will work with what it can find on your OS at runtime.

Tries to make a progress dialog with:

* DlangUI (win32 on Windows or SDL2 on Linux)

* Zenity (Gtk/Gnome)

* Kdialog (KDE)

Home page: https://github.com/workhorsy/d-progress-dialog

Members

Classes

ProgressDialog
class ProgressDialog

The ProgressDialog class

Functions

getUseLog
bool getUseLog()

Returns if external program logging is on or off.

setUseLog
void setUseLog(bool is_logging)

If true will print output of external program to console.

Mixin templates

RUN_MAIN
mixin template RUN_MAIN()

This should be called once at the start of a program. It generates the proper main function for your environment (win32/posix/dmain) and boot straps the main loop for the GUI. This will call your UIAppMain function when ready.

Examples

1 import std.stdio : stdout, stderr;
2 import progress_dialog : ProgressDialog, RUN_MAIN;
3 
4 mixin RUN_MAIN;
5 
6 extern (C) int UIAppMain(string[] args) {
7 	import core.thread;
8 
9 	// Create the dialog
10 	auto dialog = new ProgressDialog("It's waitin' time!", "Waiting ...");
11 
12 	// Set the error handler
13 	dialog.onError((Throwable err) {
14 		stderr.writefln("Failed to show progress dialog: %s", err);
15 		dialog.close();
16 	});
17 
18 	// Show the progress dialog
19 	dialog.show({
20 		// Update the progress for 5 seconds
21 		int percent = 0;
22 		while (percent < 100) {
23 			dialog.setPercent(percent);
24 			percent += 20;
25 			Thread.sleep(1.seconds);
26 			stdout.writefln("percent: %s", percent);
27 			stdout.flush();
28 		}
29 
30 		// Close the dialog
31 		dialog.close();
32 	});
33 
34 	return 0;
35 }

Meta

Version

0.3.0

License

Boost Software License - Version 1.0