Advertisement
Guest User

Untitled

a guest
Apr 20th, 2013
31
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 5.12 KB | None | 0 0
  1. Index: gnome-manual-duplex.glade
  2. ===================================================================
  3. --- gnome-manual-duplex.glade   (revision 331)
  4. +++ gnome-manual-duplex.glade   (working copy)
  5. @@ -72,6 +72,7 @@
  6.                          <property name="active">True</property>
  7.                          <property name="draw_indicator">True</property>
  8.                          <property name="group">radiobutton1</property>
  9. +                        <signal handler="radiobutton2_toggled_cb" name="toggled"/>
  10.                        </widget>
  11.                        <packing>
  12.                          <property name="top_attach">1</property>
  13. @@ -79,6 +80,22 @@
  14.                        </packing>
  15.                      </child>
  16.                      <child>
  17. +                      <widget class="GtkRadioButton" id="radiobutton3">
  18. +                        <property name="visible">True</property>
  19. +                        <property name="can_focus">True</property>
  20. +                        <property name="label" translatable="yes">Manual Brochure</property>
  21. +                        <property name="response_id">0</property>
  22. +                        <property name="active">True</property>
  23. +                        <property name="draw_indicator">True</property>
  24. +                        <property name="group">radiobutton1</property>
  25. +                        <signal handler="radiobutton3_toggled_cb" name="toggled"/>
  26. +                      </widget>
  27. +                      <packing>
  28. +                        <property name="top_attach">2</property>
  29. +                        <property name="bottom_attach">3</property>
  30. +                      </packing>
  31. +                    </child>
  32. +                    <child>
  33.                        <widget class="GtkImage" id="image1">
  34.                          <property name="visible">True</property>
  35.                          <property name="pixbuf">long_edge.xpm</property>
  36. @@ -100,6 +117,18 @@
  37.                          <property name="bottom_attach">2</property>
  38.                        </packing>
  39.                      </child>
  40. +                    <child>
  41. +                      <widget class="GtkImage" id="image3">
  42. +                        <property name="visible">True</property>
  43. +                        <property name="pixbuf">brochure.xpm</property>
  44. +                      </widget>
  45. +                      <packing>
  46. +                        <property name="left_attach">1</property>
  47. +                        <property name="right_attach">2</property>
  48. +                        <property name="top_attach">2</property>
  49. +                        <property name="bottom_attach">3</property>
  50. +                      </packing>
  51. +                    </child>
  52.                    </widget>
  53.                  </child>
  54.                </widget>
  55. Index: gnome-manual-duplex.py
  56. ===================================================================
  57. --- gnome-manual-duplex.py  (revision 331)
  58. +++ gnome-manual-duplex.py  (working copy)
  59. @@ -143,7 +143,7 @@
  60.  
  61.     self.printdialog = builder.get_object("printdialog1")
  62.     self.evenok = builder.get_object("even-pages-ok")
  63. -   self.LongEdge = 1;
  64. +   self.printMode = 1;
  65.     self.SkipOddPages = 0;
  66.     builder.connect_signals(self)
  67.     self.window.show()
  68. @@ -220,8 +220,26 @@
  69.     print "clicked"
  70.  
  71.      def radiobutton1_toggled_cb(self, widget, data=None):
  72. -   self.LongEdge = not self.LongEdge
  73. +   if widget.get_active():
  74. +       print "radiobutton1 active"
  75. +       self.printMode = 1 # Long edge
  76. +   else:
  77. +       print "radiobutton1 inactive"
  78.  
  79. +    def radiobutton2_toggled_cb(self, widget, data=None):
  80. +   if widget.get_active():
  81. +       print "radiobutton2 active"
  82. +       self.printMode = 2 # Short edge
  83. +   else:
  84. +       print "radiobutton2 inactive"
  85. +
  86. +    def radiobutton3_toggled_cb(self, widget, data=None):
  87. +   if widget.get_active():
  88. +       print "radiobutton3 active"
  89. +       self.printMode = 3 # Brochure
  90. +   else:
  91. +       print "radiobutton3 inactive"
  92. +
  93.      def checkbutton1_toggled_cb(self, widget, data=None):
  94.     self.SkipOddPages = not self.SkipOddPages
  95.  
  96. @@ -240,6 +258,25 @@
  97.         gtk.main_quit()
  98.     if data == gtk.RESPONSE_OK:
  99.         self.tempfile = tempfile.NamedTemporaryFile()
  100. +       rc = os.system("file " + self.filename + " | grep -q PDF")
  101. +       if rc == 256:
  102. +       self.is_pdf = 0
  103. +       else:
  104. +       self.is_pdf = 1
  105. +       if self.printMode == 3: #Brochure
  106. +       self.tempfileBrochure = tempfile.NamedTemporaryFile()
  107. +       # Convert into brochure
  108. +       if self.is_pdf == 1:
  109. +           os.system("pdftops '" + self.filename
  110. +           + "' - | psbook "
  111. +           + " | psnup -2 > "
  112. +           + self.tempfileBrochure.name)
  113. +       else:
  114. +           os.system("psbook '" + self.filename
  115. +           + "' | psnup -2 > "
  116. +           + self.tempfileBrochure.name)
  117. +       self.filename = self.tempfileBrochure.name
  118. +       self.is_pdf = 0 #now converted to ps (if it was not ps already)
  119.         if not self.SkipOddPages:
  120.         # Print out odd pages
  121.         # print self.filename
  122. @@ -277,7 +314,7 @@
  123.  
  124.      def even_ok_clicked_cb(self, widget, data=None):
  125.     printer = self.printdialog.get_selected_printer()
  126. -   if self.LongEdge == 1:
  127. +   if self.printMode == 1: # Long edge
  128.         try:
  129.         config = int( Config.get(printer.get_name(),
  130.                         'long_edge_config', 0) )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement