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

ProgressDialogBase
class ProgressDialogBase
Undocumented in source.

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
mixintemplate 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.

Variables

is_sdl2_loadable
bool is_sdl2_loadable;
Undocumented in source.
use_log
bool use_log;
Undocumented in source.

Examples

import std.stdio : stdout, stderr;
import progress_dialog : ProgressDialog, RUN_MAIN;

mixin RUN_MAIN;

extern (C) int UIAppMain(string[] args) {
	import core.thread;

	// Create the dialog
	auto dialog = new ProgressDialog("It's waitin' time!", "Waiting ...");

	// Set the error handler
	dialog.onError((Throwable err) {
		stderr.writefln("Failed to show progress dialog: %s", err);
		dialog.close();
	});

	// Show the progress dialog
	dialog.show({
		// Update the progress for 5 seconds
		int percent = 0;
		while (percent < 100) {
			dialog.setPercent(percent);
			percent += 20;
			Thread.sleep(1.seconds);
			stdout.writefln("percent: %s", percent);
			stdout.flush();
		}

		// Close the dialog
		dialog.close();
	});

	return 0;
}

Meta

Version

0.3.0

License

Boost Software License - Version 1.0