From 0f6674b33d7a2c8bc90f342ad0d5202168399e98 Mon Sep 17 00:00:00 2001 From: Leonardo Date: Sun, 9 May 2010 11:58:20 +0200 Subject: [PATCH] Il pulsante stampa cambia etichetta durante la stampa per comunicare all'utente che sta facendo qualcosa. --- DrPrintBackend.py | 2 ++ DrPrintGui/Input.py | 13 +++++++++++++ DrPrintGui/MainWin.py | 6 ++++++ debian/changelog | 12 ++++++++++++ 4 files changed, 33 insertions(+) diff --git a/DrPrintBackend.py b/DrPrintBackend.py index 4884615..867396e 100644 --- a/DrPrintBackend.py +++ b/DrPrintBackend.py @@ -35,6 +35,8 @@ class Backend(gobject.GObject): password=password) except paramiko.AuthenticationException, e: raise PrintingError('Autenticazione fallita') + except Exception, e: + raise PrintingError('Connessione fallita (%s)' % e) t = client.get_transport() sftp = paramiko.SFTPClient.from_transport(t) diff --git a/DrPrintGui/Input.py b/DrPrintGui/Input.py index 4ff017e..5b2b07a 100644 --- a/DrPrintGui/Input.py +++ b/DrPrintGui/Input.py @@ -1,4 +1,5 @@ ## This library provides User Input fields +# -*- coding: utf-8 -*- import gtk, pygtk, gobject, os @@ -91,6 +92,18 @@ class PrintButton(gtk.Button): gtk.Button.__init__(self, "Stampa") + def set_state(self, state): + if state is "idle": + self.set_label ("Stampa") + elif state is "printing": + self.set_label ("Stampa in corso") + # Questa è una sporca soluzione per fare in modo che + # il cambio di stato si veda. + while gtk.events_pending(): + gtk.main_iteration (False) + else: + raise RuntimeError('Invalid state %s' % state) + class SelectFileWidget(gtk.HBox): diff --git a/DrPrintGui/MainWin.py b/DrPrintGui/MainWin.py index 9182372..426a8e6 100644 --- a/DrPrintGui/MainWin.py +++ b/DrPrintGui/MainWin.py @@ -124,6 +124,10 @@ class MainWin(gtk.Window): def print_button_clicked_callback(self, widget): if not self.backend == None: + + # Comunichiamo all'utente che qualcosa sta succedendo + self.print_button.set_state ("printing") + printer = self.printer_settings_block.get_printer() username = self.auth_block.get_username() password = self.auth_block.get_password() @@ -173,6 +177,8 @@ Se vuoi continuare premi OK") % (filename, printer)) dialog.run() dialog.destroy() + + self.print_button.set_state("idle") else: self.debug( "Sembra che non ci sia un backend attaccato\ a questa interfaccia, quindi non faccio nulla") diff --git a/debian/changelog b/debian/changelog index 70d89d8..09310d6 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,15 @@ +drprint (0.8-3) lucid; urgency=low + + * Il pulsante Stampa cambia etichetta durante la stampa + + -- Leonardo Robol Sun, 09 May 2010 11:57:58 +0200 + +drprint (0.8-2) karmic; urgency=low + + * Corrette incongruenze nella gestione degli errori + + -- Leonardo Robol Wed, 10 Feb 2010 11:48:13 +0100 + drprint (0.8-1) karmic; urgency=low * Cambiato il backend. Ora non manda più il file in pipe, -- 2.1.4