Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: gnome-manual-duplex.glade
- ===================================================================
- --- gnome-manual-duplex.glade (revision 331)
- +++ gnome-manual-duplex.glade (working copy)
- @@ -72,6 +72,7 @@
- <property name="active">True</property>
- <property name="draw_indicator">True</property>
- <property name="group">radiobutton1</property>
- + <signal handler="radiobutton2_toggled_cb" name="toggled"/>
- </widget>
- <packing>
- <property name="top_attach">1</property>
- @@ -79,6 +80,22 @@
- </packing>
- </child>
- <child>
- + <widget class="GtkRadioButton" id="radiobutton3">
- + <property name="visible">True</property>
- + <property name="can_focus">True</property>
- + <property name="label" translatable="yes">Manual Brochure</property>
- + <property name="response_id">0</property>
- + <property name="active">True</property>
- + <property name="draw_indicator">True</property>
- + <property name="group">radiobutton1</property>
- + <signal handler="radiobutton3_toggled_cb" name="toggled"/>
- + </widget>
- + <packing>
- + <property name="top_attach">2</property>
- + <property name="bottom_attach">3</property>
- + </packing>
- + </child>
- + <child>
- <widget class="GtkImage" id="image1">
- <property name="visible">True</property>
- <property name="pixbuf">long_edge.xpm</property>
- @@ -100,6 +117,18 @@
- <property name="bottom_attach">2</property>
- </packing>
- </child>
- + <child>
- + <widget class="GtkImage" id="image3">
- + <property name="visible">True</property>
- + <property name="pixbuf">brochure.xpm</property>
- + </widget>
- + <packing>
- + <property name="left_attach">1</property>
- + <property name="right_attach">2</property>
- + <property name="top_attach">2</property>
- + <property name="bottom_attach">3</property>
- + </packing>
- + </child>
- </widget>
- </child>
- </widget>
- Index: gnome-manual-duplex.py
- ===================================================================
- --- gnome-manual-duplex.py (revision 331)
- +++ gnome-manual-duplex.py (working copy)
- @@ -143,7 +143,7 @@
- self.printdialog = builder.get_object("printdialog1")
- self.evenok = builder.get_object("even-pages-ok")
- - self.LongEdge = 1;
- + self.printMode = 1;
- self.SkipOddPages = 0;
- builder.connect_signals(self)
- self.window.show()
- @@ -220,8 +220,26 @@
- print "clicked"
- def radiobutton1_toggled_cb(self, widget, data=None):
- - self.LongEdge = not self.LongEdge
- + if widget.get_active():
- + print "radiobutton1 active"
- + self.printMode = 1 # Long edge
- + else:
- + print "radiobutton1 inactive"
- + def radiobutton2_toggled_cb(self, widget, data=None):
- + if widget.get_active():
- + print "radiobutton2 active"
- + self.printMode = 2 # Short edge
- + else:
- + print "radiobutton2 inactive"
- +
- + def radiobutton3_toggled_cb(self, widget, data=None):
- + if widget.get_active():
- + print "radiobutton3 active"
- + self.printMode = 3 # Brochure
- + else:
- + print "radiobutton3 inactive"
- +
- def checkbutton1_toggled_cb(self, widget, data=None):
- self.SkipOddPages = not self.SkipOddPages
- @@ -240,6 +258,25 @@
- gtk.main_quit()
- if data == gtk.RESPONSE_OK:
- self.tempfile = tempfile.NamedTemporaryFile()
- + rc = os.system("file " + self.filename + " | grep -q PDF")
- + if rc == 256:
- + self.is_pdf = 0
- + else:
- + self.is_pdf = 1
- + if self.printMode == 3: #Brochure
- + self.tempfileBrochure = tempfile.NamedTemporaryFile()
- + # Convert into brochure
- + if self.is_pdf == 1:
- + os.system("pdftops '" + self.filename
- + + "' - | psbook "
- + + " | psnup -2 > "
- + + self.tempfileBrochure.name)
- + else:
- + os.system("psbook '" + self.filename
- + + "' | psnup -2 > "
- + + self.tempfileBrochure.name)
- + self.filename = self.tempfileBrochure.name
- + self.is_pdf = 0 #now converted to ps (if it was not ps already)
- if not self.SkipOddPages:
- # Print out odd pages
- # print self.filename
- @@ -277,7 +314,7 @@
- def even_ok_clicked_cb(self, widget, data=None):
- printer = self.printdialog.get_selected_printer()
- - if self.LongEdge == 1:
- + if self.printMode == 1: # Long edge
- try:
- config = int( Config.get(printer.get_name(),
- 'long_edge_config', 0) )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement