Generalized animated info
This commit is contained in:
parent
53fe5511e0
commit
33ccf7d8f0
73
source/app.d
73
source/app.d
@ -22,7 +22,8 @@ import gtk.AccelGroup;
|
|||||||
|
|
||||||
import gtk.HBox;
|
import gtk.HBox;
|
||||||
|
|
||||||
MainWindow window;
|
__gshared MainWindow window;
|
||||||
|
__gshared HBox statusbar;
|
||||||
|
|
||||||
void main(string[] args)
|
void main(string[] args)
|
||||||
{
|
{
|
||||||
@ -87,7 +88,7 @@ void main(string[] args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Status bar
|
//Status bar
|
||||||
auto statusbar = new HBox(false, 0);
|
statusbar = new HBox(false, 0);
|
||||||
cont.packEnd(statusbar, false, false, 5);
|
cont.packEnd(statusbar, false, false, 5);
|
||||||
statusbar.packStart(buttonRenumber, false, false, 5);
|
statusbar.packStart(buttonRenumber, false, false, 5);
|
||||||
statusbar.packStart(buttonInsert, false, false, 5);
|
statusbar.packStart(buttonInsert, false, false, 5);
|
||||||
@ -126,31 +127,6 @@ void main(string[] args)
|
|||||||
//Configure button callbacks
|
//Configure button callbacks
|
||||||
buttonSave.addOnClicked((Button){
|
buttonSave.addOnClicked((Button){
|
||||||
Save(tree);
|
Save(tree);
|
||||||
|
|
||||||
import core.thread;
|
|
||||||
new Thread({
|
|
||||||
Thread.getThis.sleep(dur!"msecs"(100));
|
|
||||||
|
|
||||||
auto lbl = new Label("");
|
|
||||||
lbl.setMarkup("<i>File saved</i>");
|
|
||||||
statusbar.packEnd(lbl, false, false, 5);
|
|
||||||
|
|
||||||
//Wow, much animation, very badass
|
|
||||||
lbl.setOpacity(0.0);
|
|
||||||
lbl.show();
|
|
||||||
foreach(i ; 0..20){
|
|
||||||
lbl.setOpacity(i/20.0);
|
|
||||||
Thread.getThis.sleep(dur!"msecs"(10));
|
|
||||||
}
|
|
||||||
Thread.getThis.sleep(dur!"msecs"(1500));
|
|
||||||
foreach(i ; 1..20){
|
|
||||||
lbl.setOpacity(1.0-i/20.0);
|
|
||||||
Thread.getThis.sleep(dur!"msecs"(10));
|
|
||||||
}
|
|
||||||
//Destroy
|
|
||||||
lbl.destroy();
|
|
||||||
}).start();
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
buttonOpen.addOnClicked((Button){
|
buttonOpen.addOnClicked((Button){
|
||||||
@ -219,8 +195,6 @@ void main(string[] args)
|
|||||||
types~=GType.STRING;
|
types~=GType.STRING;
|
||||||
titles~="new_col";
|
titles~="new_col";
|
||||||
|
|
||||||
writeln(types);
|
|
||||||
|
|
||||||
auto store = new ListStore(types);
|
auto store = new ListStore(types);
|
||||||
tree.setModel(store);
|
tree.setModel(store);
|
||||||
|
|
||||||
@ -273,6 +247,32 @@ int GetColumnStoreIndex(TreeView tree, int colindex){
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SaySomething(string msg){
|
||||||
|
import core.thread;
|
||||||
|
new Thread({
|
||||||
|
Thread.getThis.sleep(dur!"msecs"(100));
|
||||||
|
|
||||||
|
auto lbl = new Label("");
|
||||||
|
lbl.setMarkup("<i>"~msg~"</i>");
|
||||||
|
statusbar.packEnd(lbl, false, false, 5);
|
||||||
|
|
||||||
|
//Wow, much animation, very badass
|
||||||
|
lbl.setOpacity(0.0);
|
||||||
|
lbl.show();
|
||||||
|
foreach(i ; 0..20){
|
||||||
|
lbl.setOpacity(i/20.0);
|
||||||
|
Thread.getThis.sleep(dur!"msecs"(10));
|
||||||
|
}
|
||||||
|
Thread.getThis.sleep(dur!"msecs"(1500));
|
||||||
|
foreach(i ; 1..20){
|
||||||
|
lbl.setOpacity(1.0-i/20.0);
|
||||||
|
Thread.getThis.sleep(dur!"msecs"(10));
|
||||||
|
}
|
||||||
|
//Destroy
|
||||||
|
lbl.destroy();
|
||||||
|
}).start();
|
||||||
|
}
|
||||||
|
|
||||||
void Save(ref TreeView tree){
|
void Save(ref TreeView tree){
|
||||||
auto store = cast(ListStore)tree.getModel();
|
auto store = cast(ListStore)tree.getModel();
|
||||||
if(store !is null){
|
if(store !is null){
|
||||||
@ -292,14 +292,15 @@ void Save(ref TreeView tree){
|
|||||||
}
|
}
|
||||||
file.write("\n");
|
file.write("\n");
|
||||||
}while(store.iterNext(it));
|
}while(store.iterNext(it));
|
||||||
|
|
||||||
file.flush();
|
|
||||||
file.close();
|
|
||||||
writeln("File written: ",openedFile);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
file.flush();
|
||||||
|
file.close();
|
||||||
|
|
||||||
|
SaySomething("Saved to "~openedFile);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
writeln("Nothing to save !");
|
SaySomething("Nothing to save !");
|
||||||
}
|
}
|
||||||
|
|
||||||
string openedFile;
|
string openedFile;
|
||||||
@ -384,7 +385,7 @@ auto ref SetupColumn(TreeView tree, string sName, size_t index){
|
|||||||
store.setValue(t, cast(int)crt.getData("colnumber"), n);
|
store.setValue(t, cast(int)crt.getData("colnumber"), n);
|
||||||
}
|
}
|
||||||
catch(Exception e){
|
catch(Exception e){
|
||||||
writeln("Not a number");
|
SaySomething("Not a number !");
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
@ -417,7 +418,7 @@ auto ref SetupColumn(TreeView tree, string sName, size_t index){
|
|||||||
if(newname.countchars(" \t\n\r")==0)
|
if(newname.countchars(" \t\n\r")==0)
|
||||||
col.setTitle(newname);
|
col.setTitle(newname);
|
||||||
else
|
else
|
||||||
writeln("Unauthorized caracters in column name");
|
SaySomething("Spaces are forbidden in column name");
|
||||||
}
|
}
|
||||||
|
|
||||||
dlg.destroy();
|
dlg.destroy();
|
||||||
|
Loading…
Reference in New Issue
Block a user