Example #1
0
 def _load_uniconvertor(self):
     for p in sys.path:
         d = os.path.join(p, 'uniconvertor')
         if os.path.isdir(d):
             sys.path.append(d)
             from app.io import load
             from app.plugins import plugins
             import app
             from uniconvsaver import save
             app.init_lib()
             plugins.load_plugin_configuration()
             break
     else:
         raise ImportError
     return load, plugins, save
Example #2
0
 def _load_uniconvertor(self):
     for p in sys.path:
         d = os.path.join(p, 'uniconvertor')
         if os.path.isdir(d):
             sys.path.append(d)
             from app.io import load
             from app.plugins import plugins
             import app
             from uniconvsaver import save
             app.init_lib()
             plugins.load_plugin_configuration()
             break
     else:
         raise ImportError
     return load, plugins, save
Example #3
0
def uniconv():	
	_pkgdir = __path__[0]
	app_dir = os.path.join(_pkgdir, 'app')
	app_ver = string.strip(open(os.path.join(app_dir, 'VERSION')).read())

	if len(sys.argv)<3 or sys.argv[1]=='--help':
		print '\nUniConvertor',app_ver
		print __doc__
		sys.exit(0)
		
	options=[]
	input_file=sys.argv[-2]
	output_file=sys.argv[-1]
	
	if len(sys.argv)>3:
		options=sys.argv[1:-2]
		
	if not os.path.isfile(input_file):
		print '\nERROR: %s file is not found!' % input_file
		print '\nUniConvertor',app_ver
		print __doc__
		sys.exit(1)
	
	sys.path.insert(1, _pkgdir)
	
	from app.io import load
	from app.plugins import plugins
	import app
	
	app.init_lib()
	
	doc = load.load_drawing(input_file)
	extension = os.path.splitext(output_file)[1]
	plugins.load_plugin_configuration()
	fileformat = plugins.guess_export_plugin(extension)
	if fileformat:
		saver = plugins.find_export_plugin(fileformat)
		saver(doc, output_file)
	else:
		sys.stderr.write('ERROR: unrecognized extension %s\n' % extension)
		sys.exit(1)
	doc.Destroy()
	sys.exit(0)
Example #4
0
from reportlab.platypus import Flowable, Paragraph
from reportlab.lib.enums import TA_LEFT, TA_CENTER, TA_RIGHT

from log import log

try:
    for p in sys.path:
        d = os.path.join(p, 'uniconvertor')
        if os.path.isdir(d):
            sys.path.append(d)
            from app.io import load
            from app.plugins import plugins
            import app
            from uniconvsaver import save
            app.init_lib()
            plugins.load_plugin_configuration()
            break
    else:
        raise ImportError
except ImportError:
    load = None

try:
    from svglib import svglib
except ImportError:
    svglib = None


class SVGImage(Flowable):
    def __init__(self, filename, width=None, height=None, kind='direct'):
        Flowable.__init__(self)
Example #5
0
   def write( m):
      pass
 
sortida=sys.stdout
xungo=sys.exit
try:
    sys.stdout=DummyOut()
    sys.exit=lambda x:1 
    import uniconvertor
    sys.path.insert(1, os.path.dirname( uniconvertor.__file__))
    from app.io import load
    from app.plugins import plugins
    import app

    app.init_lib()
    plugins.load_plugin_configuration()
    HAS_UNICONVERTOR=True

## workaround for a bug that stops bgtrml2pdf from working with svg
## files winth font properties in style attributes, even if they apply
## to no text because all text is empty or transformed to paths
## see http://svn.berlios.de/viewcvs/bulmages/branches/docsMonolitic/bulmages/installbulmages/openreports/ca/

    class FakeFont(app.Graphics.font.Font):
      def __init__(self, name):
        self.name = name
        self.family = name
        self.font_attrs = 'Regular Italic'
        self.xlfd_start = '-adobe-Nimbus Roman No9 L-regular-i-normal'
        self.encoding_name = 'iso8859-1'
        self.outlines = None