diff options
author | Christian Pointner <equinox@helsinki.at> | 2010-04-19 10:34:41 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2010-04-19 10:34:41 (GMT) |
commit | 5bf539bc9fe4aea3ad2e9115f551c9b2e330c88e (patch) | |
tree | 53b6538b0b8a7138eb71a475d3951729468b428d | |
parent | de92273e6de01bf9bada5cb89d72118943d23b51 (diff) |
added message dialog at import end
disabling buttons while importing
git-svn-id: https://svn.helsinki.at/rhimport/trunk@53 7c65635b-ec39-4f67-a626-873dbafdd612
-rwxr-xr-x | rhimport | 45 | ||||
-rw-r--r-- | rhimport.pm | 6 |
2 files changed, 42 insertions, 9 deletions
@@ -220,12 +220,19 @@ sub start_import_gui() exit 2; } + my $b_apply = $guixml->get_widget('b_apply'); + my $b_close = $guixml->get_widget('b_close'); + $b_apply->set_sensitive(0); + $b_close->set_sensitive(0); + if(!rhimport::check_key_file()) { my $parent_window = $guixml->get_widget('appwin'); my $dialog = Gtk2::MessageDialog->new ($parent_window, 'destroy-with-parent', 'error', 'ok', "Es wurde kein Import Key gefunden."); $dialog->run; $dialog->destroy; + $b_apply->set_sensitive(1); + $b_close->set_sensitive(1); return 0; } @@ -239,6 +246,8 @@ sub start_import_gui() } else { $l_status->set_label("Keine Audio Datei ausgewählt!"); } + $b_apply->set_sensitive(1); + $b_close->set_sensitive(1); return 0; } $filechooser->unselect_all; @@ -255,18 +264,34 @@ sub start_import_gui() if($POOL) { my $cb_clear_carts = $guixml->get_widget('cb_clear_carts'); if($cb_clear_carts->get_active) { - rhimport::clear_carts($dbh, $group, $to_cart, $gui_progress_cb); + $log = rhimport::clear_carts($dbh, $group, $to_cart, $gui_progress_cb); } - ($ret, $log) = rhimport::import_playlist($file, $dropbox, $gui_progress_cb, $gui_error_cb); + my $import_log; + ($ret, $import_log) = rhimport::import_playlist($file, $dropbox, $gui_progress_cb, $gui_error_cb); + $log .= $import_log; } else { - rhimport::clear_carts($dbh, $group, $to_cart, $gui_progress_cb); - ($ret, $log) = rhimport::import_single($file, $dropbox, $gui_progress_cb, $gui_error_cb); + $log = rhimport::clear_carts($dbh, $group, $to_cart, $gui_progress_cb); + my $import_log; + ($ret, $import_log) = rhimport::import_single($file, $dropbox, $gui_progress_cb, $gui_error_cb); + $log .= $import_log; } + my $parent_window = $guixml->get_widget('appwin'); + my $dialog; if(!$ret) { $l_status->set_label("Fehler beim Importieren"); + $dialog = Gtk2::MessageDialog->new ($parent_window, 'destroy-with-parent', + 'error', 'ok', "Fehler beim Importieren."); + } else { + $l_status->set_label(""); + $dialog = Gtk2::MessageDialog->new ($parent_window, 'destroy-with-parent', + 'info', 'ok', "Der Import wurde erfolgreich abgeschlossen!"); } + $dialog->run; + $dialog->destroy; + $b_apply->set_sensitive(1); + $b_close->set_sensitive(1); return $ret; } @@ -405,13 +430,17 @@ my $ret; my $log; if($POOL) { if(!$KEEPCARTS) { - rhimport::clear_carts($dbh, $group, $to_cart); + $log = rhimport::clear_carts($dbh, $group, $to_cart); } - ($ret, $log) = rhimport::import_playlist($FILE, $DROPBOX, 0, $cl_error_cb); + my $import_log; + ($ret, $import_log) = rhimport::import_playlist($FILE, $DROPBOX, 0, $cl_error_cb); + $log .= $import_log; } else { - rhimport::clear_carts($dbh, $group, $to_cart); - ($ret, $log) = rhimport::import_single($FILE, $DROPBOX, 0); + $log = rhimport::clear_carts($dbh, $group, $to_cart); + my $import_log; + ($ret, $import_log) = rhimport::import_single($FILE, $DROPBOX, 0); + $log .= $import_log; } $dbh->disconnect(); diff --git a/rhimport.pm b/rhimport.pm index df67f74..948d675 100644 --- a/rhimport.pm +++ b/rhimport.pm @@ -117,7 +117,8 @@ sub clear_carts ($low_cart, $high_cart) = get_cart_range($dbh, $group); } - print "clearing Carts $low_cart - $high_cart\n"; + my $log = "clearing Carts $low_cart - $high_cart\n"; + print $log; my $cart = $low_cart; while($cart <= $high_cart) { $progress_cb->($cart - $low_cart, $high_cart + 1 - $low_cart, "deleting $cart") if($progress_cb); @@ -127,6 +128,7 @@ sub clear_carts $sth->execute(); while(my $cut_name = $sth->fetchrow_array()) { delete_file("/var/snd/$cut_name.wav"); + $log .= " - deleting file /var/snd/$cut_name.wav"; } $sth->finish(); @@ -142,6 +144,8 @@ sub clear_carts $cart++; } + + return $log; } sub import_playlist |