示例#1
0
	def extract_bitmap(self):
		doc_file = 'image.tiff'
		doc_file = os.path.join(config.save_dir, doc_file)
		doc_file = dialogs.get_save_file_name(self.mw, self, doc_file,
							_('Extract selected bitmap as...'),
							file_types=[data.TIF])[0]
		if doc_file:
			try:
				pixmap = self.current_doc.selection.objs[0]
				libimg.extract_bitmap(pixmap, doc_file)
			except:
				first = _('Cannot save document')
				msg = ("%s '%s'.") % (first, self.current_doc.doc_name) + '\n'
				msg += _('Please check file name and write permissions')
				dialogs.error_dialog(self.mw, self.appdata.app_name, msg)
				self.print_stacktrace()
				return
			config.save_dir = str(os.path.dirname(doc_file))
			events.emit(events.APP_STATUS, _('Bitmap is successfully extracted'))
示例#2
0
 def extract_bitmap(self):
     doc_file = 'image'
     doc_file = os.path.join(config.save_dir, doc_file)
     msg = _('Extract selected bitmap as...')
     doc_file = dialogs.get_save_file_name(self.mw,
                                           doc_file,
                                           msg,
                                           file_types=[uc2const.PNG],
                                           path_only=True)
     if doc_file:
         try:
             pixmap = self.current_doc.selection.objs[0]
             libimg.extract_bitmap(pixmap, doc_file)
         except Exception as e:
             first = _('Cannot save bitmap:')
             msg = "%s\n'%s'." % (first, doc_file) + '\n'
             msg += _('Please check file name and write permissions')
             dialogs.error_dialog(self.mw, self.appdata.app_name, msg)
             LOG.warn('Cannot save bitmap in <%s>', doc_file, e)
             return
         config.save_dir = str(os.path.dirname(doc_file))
         events.emit(events.APP_STATUS,
                     _('Bitmap is successfully extracted'))
示例#3
0
 def extract_bitmap(self):
     doc_file = 'image.tiff'
     doc_file = os.path.join(config.save_dir, doc_file)
     doc_file = dialogs.get_save_file_name(
         self.mw,
         self,
         doc_file,
         _('Extract selected bitmap as...'),
         file_types=[data.TIF])[0]
     if doc_file:
         try:
             pixmap = self.current_doc.selection.objs[0]
             libimg.extract_bitmap(pixmap, doc_file)
         except:
             first = _('Cannot save document')
             msg = ("%s '%s'.") % (first, self.current_doc.doc_name) + '\n'
             msg += _('Please check file name and write permissions')
             dialogs.error_dialog(self.mw, self.appdata.app_name, msg)
             self.print_stacktrace()
             return
         config.save_dir = str(os.path.dirname(doc_file))
         events.emit(events.APP_STATUS,
                     _('Bitmap is successfully extracted'))