Example #1
0
 def ask_user(self):
     # Ask the user for a factor by which to multiply all font sizes
     factor, ok = QInputDialog.getDouble(
         self.gui,
         'Enter a magnification factor',
         'Allow font sizes in the book will be multiplied by the specified factor',
         value=2,
         min=0.1,
         max=4)
     if ok:
         # Ensure any in progress editing the user is doing is present in the container
         self.boss.commit_all_editors_to_container()
         try:
             self.magnify_fonts(factor)
         except Exception:
             # Something bad happened report the error to the user
             import traceback
             error_dialog(
                 self.gui,
                 _('Failed to magnify fonts'),
                 _('Failed to magnify fonts, click "Show details" for more info'
                   ),
                 det_msg=traceback.format_exc(),
                 show=True)
             # Revert to the saved restore point
             self.boss.revert_requested(
                 self.boss.global_undo.previous_container)
         else:
             # Show the user what changes we have made, allowing her to
             # revert them if necessary
             self.boss.show_current_diff()
             # Update the editor UI to take into account all the changes we
             # have made
             self.boss.apply_container_update_to_gui()
Example #2
0
 def oilify_image(self):
     val, ok = QInputDialog.getDouble(
         self,
         _('Oilify image'),
         _('The strength of the operation (higher numbers have larger effects)'
           ),
         value=4,
         min=0.1,
         max=20)
     if ok:
         self.canvas.oilify_image(radius=val)