Aggiunta le feature numero di pagine, e anche qualeh stampante

Leonardo Robol [2009-09-21 14:34]
Aggiunta le feature numero di pagine, e anche qualeh stampante
Filename
DrPrintBackend.py
DrPrintGui/Input.py
DrPrintGui/Input.pyc
DrPrintGui/MainWin.py
DrPrintGui/MainWin.pyc
diff --git a/DrPrintBackend.py b/DrPrintBackend.py
index 3438add..82bc2cb 100644
--- a/DrPrintBackend.py
+++ b/DrPrintBackend.py
@@ -11,7 +11,7 @@ class Backend(gobject.GObject):
         gobject.signal_new("auth_failed", Backend, gobject.SIGNAL_RUN_FIRST, None, ())
         gobject.signal_new('io_error', Backend, gobject.SIGNAL_RUN_FIRST, None, ())

-    def send_print(self, printer, username, password, page_per_page, filename, page_range):
+    def send_print(self, printer, username, password, page_per_page, filename, page_range, copies):
         # Get printer name
         print "Selected printer: %s" % printer

@@ -41,6 +41,11 @@ class Backend(gobject.GObject):
         # Questo è inevitabile.. :)
         cmd = "lpr -P%s " % printer

+        # Nunmero di pagine
+        if copies.isdigit():
+            cmd = cmd + "-# %s " % copies
+
+
         cmd_opts = ""

         ## Pagine logiche per pagine
@@ -54,6 +59,8 @@ class Backend(gobject.GObject):
         ## Se ci sono opzioni dai il -o e specificale
         if not cmd_opts == "":
             cmd = cmd + "-o %s" % cmd_opts
+
+

         ## Diamo il comando sul canale e infiliamo il file
         ## dentro lo stdin :)
diff --git a/DrPrintGui/Input.py b/DrPrintGui/Input.py
index af1330a..cf0201d 100644
--- a/DrPrintGui/Input.py
+++ b/DrPrintGui/Input.py
@@ -84,7 +84,7 @@ class SelectFileWidget(gtk.HBox):
         self.set_spacing (5)

         self.Filename = gtk.Entry()
-        self.Browser = gtk.Button("Seleziona File")
+        self.Browser = gtk.Button("Sfoglia")

         self.Browser.connect('clicked', self.SelectFile)

@@ -117,6 +117,8 @@ class PrinterComboBox(gtk.HBox):
         self.combobox = gtk.combo_box_new_text()
         self.combobox.append_text("cdc7")
         self.combobox.append_text("cdcpt")
+        self.combobox.append_text("cdc8")
+        self.combobox.append_text("cdc4")

         self.combobox.set_active(1)

@@ -179,6 +181,14 @@ class PrinterSettingsBlock(gtk.HBox):
         vbox2.pack_start(self.page_per_page)
         self.page_per_page.show()

+        label = LeftAlignedLabel("Numero di copie", 2)
+        vbox1.pack_start(label)
+        label.show()
+
+        self.copies = CopiesField()
+        vbox2.pack_start(self.copies)
+        self.copies.show()
+
         self.pack_start(vbox1)
         self.pack_start(vbox2)

@@ -194,6 +204,9 @@ class PrinterSettingsBlock(gtk.HBox):
     def get_page_per_page(self):
         return self.page_per_page.get_page_per_page()

+    def get_copies(self):
+        return self.copies.get_copies()
+


 class PageRangeBlock(gtk.VBox):
@@ -243,6 +256,16 @@ class PageRangeBlock(gtk.VBox):

         return self.range_field.get_text()

+
+class CopiesField(gtk.Entry):
+
+    def __init__(self):
+
+        gtk.Entry.__init__(self)
+
+    def get_copies(self):
+        return self.get_text()
+



diff --git a/DrPrintGui/Input.pyc b/DrPrintGui/Input.pyc
index 803b8dd..4635d04 100644
Binary files a/DrPrintGui/Input.pyc and b/DrPrintGui/Input.pyc differ
diff --git a/DrPrintGui/MainWin.py b/DrPrintGui/MainWin.py
index 282f2ec..bc72837 100644
--- a/DrPrintGui/MainWin.py
+++ b/DrPrintGui/MainWin.py
@@ -21,7 +21,7 @@ class MainWin(gtk.Window):

         gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL)

-        self.set_title = "DrPrint 0.1"
+        self.set_title = "DrPrint 0.2"
         self.set_border_width(10)

         self.default_spacing = 5
@@ -36,7 +36,7 @@ class MainWin(gtk.Window):
         """This function builds up the interface using pieces
         from DrPrintGui"""

-        # The main LayOut VBox
+        # The main Layout VBox
         layout_box = gtk.VBox()
         layout_box.set_spacing( self.default_spacing )

@@ -96,13 +96,15 @@ class MainWin(gtk.Window):
             filename = self.printer_settings_block.get_filename()
             page_per_page = self.printer_settings_block.get_page_per_page()
             page_range = self.page_range_block.get_page_range()
+            copies = self.printer_settings_block.get_copies()

             self.backend.send_print(printer = printer,
                                     username = username,
                                     password = password,
                                     filename = filename,
                                     page_per_page = page_per_page,
-                                    page_range = page_range)
+                                    page_range = page_range,
+                                    copies = copies)
         else:
             self.debug( "Sembra che non ci sia un backend attaccato\
  a questa interfaccia, quindi non faccio nulla")
diff --git a/DrPrintGui/MainWin.pyc b/DrPrintGui/MainWin.pyc
index ffaef11..1c0b35e 100644
Binary files a/DrPrintGui/MainWin.pyc and b/DrPrintGui/MainWin.pyc differ
ViewGit