Ora capisce l'utente che sta lanciando il programma e ha l'immagine

Leonardo Robol [2009-10-15 08:38]
Ora capisce l'utente che sta lanciando il programma e ha l'immagine
Filename
DrPrintBackend.py
DrPrintGui/Input.py
DrPrintGui/MainWin.py
setup.py
diff --git a/DrPrintBackend.py b/DrPrintBackend.py
index afa790a..190f5f2 100644
--- a/DrPrintBackend.py
+++ b/DrPrintBackend.py
@@ -54,7 +54,7 @@ class Backend(gobject.GObject):

         ## Da a
         if not page_range == None:
-            cmd_opts += "-o page-ranges=%s" % page_range
+            cmd_opts += "-o page-ranges=%s " % page_range

         ## Orientazione (se è vuoto è verticale)
         if not orientation == "":
diff --git a/DrPrintGui/Input.py b/DrPrintGui/Input.py
index 27cedbf..d7a6ac3 100644
--- a/DrPrintGui/Input.py
+++ b/DrPrintGui/Input.py
@@ -1,6 +1,6 @@
 ## This library provides User Input fields

-import gtk, pygtk, gobject
+import gtk, pygtk, gobject, os

 class LeftAlignedLabel(gtk.Alignment):

@@ -35,7 +35,7 @@ class UsernameField(gtk.Entry):

         gtk.Entry.__init__(self)

-        self.set_text( "Utente" )
+        self.set_text( os.getlogin() )


 class PasswordField(gtk.Entry):
diff --git a/DrPrintGui/MainWin.py b/DrPrintGui/MainWin.py
index e8258f2..0d4903d 100644
--- a/DrPrintGui/MainWin.py
+++ b/DrPrintGui/MainWin.py
@@ -8,6 +8,8 @@
 __author__ = 'Leonardo Robol <leo@robol.it>'

 import gtk, pygtk
+import os
+import sys

 from Input import AuthBlock, PrinterSettingsBlock, PrintButton, LeftAlignedLabel, PageRangeBlock, OrientationSelect, SidesSelect
 from Dialogs import ErrorDialog
@@ -40,14 +42,26 @@ class MainWin(gtk.Window):
         layout_box = gtk.VBox()
         layout_box.set_spacing( self.default_spacing )

+        # Inseriamo l'immagine di Dr Print
+        drprint_img = gtk.image_new_from_file("/usr/share/drprint/drprint_gui.png")
+
         # Qualche istruzinoe preliminare
         label = gtk.Label()
         label.set_markup("<b>Come usare questo programma:</b>\n\
 <b>1)</b> Inserire nome utente e password \n<b>2)</b> Scegliere il file da stampare e la\
  stampante \n<b>3)</b> Premere il tasto stampa")

-        layout_box.pack_start( label , 20 )
+        hbox = gtk.HBox();
+        hbox.show()
+        hbox.set_spacing(self.default_spacing)
+
+        hbox.pack_start(drprint_img)
+        drprint_img.show()
+
+        hbox.pack_start( label )
         label.show()
+
+        layout_box.pack_start(hbox, 20)

         label = LeftAlignedLabel("<b>Autenticazione (sui computer dell'Aula 4)</b>")
         layout_box.pack_start( label )
diff --git a/setup.py b/setup.py
index e1d6774..9286b82 100644
--- a/setup.py
+++ b/setup.py
@@ -9,6 +9,7 @@ setup (name='DrPrint',
        packages = ['DrPrintGui'],
        py_modules=['DrPrintBackend'],
        data_files=[('bin', ['drprint']),
+                   ('share/drprint',['drprint_gui.png']),
                    ('share/applications',['drprint.desktop']),
-                   ('share/pixmaps', ['drprint.svg']) ],
+                   ('share/pixmaps', ['drprint.png']) ],
        )
ViewGit