def makeSplashLogo(): '''Make a splash screen logo.''' splash = qt4.QSplashScreen() splash.setStyleSheet("background-color:white;") # draw logo on pixmap layout = qt4.QVBoxLayout(splash) pm = utils.getPixmap('logo.png') logo = qt4.QLabel() logo.setPixmap(pm) logo.setAlignment(qt4.Qt.AlignCenter) layout.addWidget(logo) # add copyright text message = qt4.QLabel() message.setText(splashcopyr % utils.version()) message.setAlignment(qt4.Qt.AlignCenter) # increase size of font font = message.font() font.setPointSize(font.pointSize()*1.5) message.setFont(font) layout.addWidget(message) h = qt4.QFontMetrics(font).height() layout.setContentsMargins(h,h,h,h) # Center the spash screen screen = qt4.QDesktopWidget().screenGeometry() splash.move((screen.width()-layout.sizeHint().width())/2, (screen.height()-layout.sizeHint().height())/2) return splash
def checkVeuszVersion(self): """See whether there is a later version of veusz and inform the user.""" try: p = urllib2.urlopen('http://download.gna.org/veusz/').read() versions = re.findall('veusz-([0-9.]+).tar.gz', p) except urllib2.URLError: versions = [] if not versions: msg = _('Could not check the latest Veusz version') else: vsort = sorted([[int(i) for i in v.split('.')] for v in versions]) latest = '.'.join([str(x) for x in vsort[-1]]) current = [int(i) for i in utils.version().split('.')] if current == vsort[-1]: msg = _('You are running the latest released Veusz version') elif current > vsort[-1]: msg = _('You are running an unreleased Veusz version') else: msg = (_('<b>Your current version of Veusz is old. ' 'Veusz %s is available.</b>') % latest) self.veuszversionlabel.setText(msg)
def makeSplashLogo(): '''Make a splash screen logo.''' splash = qt4.QSplashScreen() splash.setStyleSheet("background-color:whitesmoke;") # draw logo on pixmap layout = qt4.QVBoxLayout(splash) pm = utils.getPixmap('logo.png') logo = qt4.QLabel() logo.setPixmap(pm) logo.setAlignment(qt4.Qt.AlignCenter) layout.addWidget(logo) # add copyright text message = qt4.QLabel() message.setText(splashcopyr % utils.version()) message.setAlignment(qt4.Qt.AlignCenter) # increase size of font font = message.font() font.setPointSize(font.pointSize() * 1.5) message.setFont(font) layout.addWidget(message) h = qt4.QFontMetrics(font).height() layout.setContentsMargins(h, h, h, h) # Center the spash screen splash.setGeometry(5, 5, 100, 100) screen = qt4.QDesktopWidget().screenGeometry() splash.move((screen.width() - layout.sizeHint().width()) / 2, (screen.height() - layout.sizeHint().height()) / 2) return splash
def run(): '''Run the main application.''' # jump to the embedding client entry point if required if len(sys.argv) == 2 and sys.argv[1] == '--embed-remote': from veusz.embed_remote import runremote runremote() return # this function is spaghetti-like and has nasty code paths. # the idea is to postpone the imports until the splash screen # is shown app = qt4.QApplication(sys.argv) app.connect(app, qt4.SIGNAL('lastWindowClosed()'), app, qt4.SLOT('quit()')) # register a signal handler to catch ctrl+C signal.signal(signal.SIGINT, handleIntSignal) # parse command line options parser = optparse.OptionParser(usage='%prog [options] filename.vsz ...', version=copyr % utils.version()) parser.add_option('--unsafe-mode', action='store_true', help='disable safety checks when running documents' ' or scripts') parser.add_option('--listen', action='store_true', help='read and execute Veusz commands from stdin,' ' replacing veusz_listen') parser.add_option('--quiet', action='store_true', help='if in listening mode, do not open a window but' ' execute commands quietly') parser.add_option('--export', action='append', metavar='FILE', help='export the next document to this' ' output image file, exiting when finished') parser.add_option('--embed-remote', action='store_true', help=optparse.SUPPRESS_HELP) parser.add_option('--plugin', action='append', metavar='FILE', help='load the plugin from the file given for ' 'the session') parser.add_option('--translation', metavar='FILE', help='load the translation .qm file given') options, args = parser.parse_args(app.argv()) # convert args to unicode from filesystem strings args = convertArgsUnicode(args) s = AppRunner(options, args) app.exec_()
def __init__(self, args): qt4.QApplication.__init__(self, args) self.lastWindowClosed.connect(self.quit) # register a signal handler to catch ctrl+C signal.signal(signal.SIGINT, handleIntSignal) # parse command line options parser = optparse.OptionParser( usage='%prog [options] filename.ore ...', version=copyr % utils.version()) parser.add_option('--unsafe-mode', action='store_true', help='disable safety checks when running documents' ' or scripts') parser.add_option( '--listen', action='store_true', help='read and execute OpenReliability commands from stdin,' ' replacing veusz_listen') parser.add_option('--quiet', action='store_true', help='if in listening mode, do not open a window but' ' execute commands quietly') parser.add_option('--export', action='append', metavar='FILE', help='export the next document to this' ' output image file, exiting when finished') parser.add_option('--embed-remote', action='store_true', help=optparse.SUPPRESS_HELP) parser.add_option('--plugin', action='append', metavar='FILE', help='load the plugin from the file given for ' 'the session') parser.add_option('--translation', metavar='FILE', help='load the translation .qm file given') options, args = parser.parse_args(self.arguments()) # export files to make images if options.export and len(options.export) != len(args) - 1: parser.error('export option needs same number of documents and ' 'output files') # convert args to unicode from filesystem strings self.args = convertArgsUnicode(args) self.options = options self.openeventfiles = [] self.startupdone = False self.splash = None
def __init__(self, exception, parent): VeuszDialog.__init__(self, parent, 'exceptionsend.ui') # debugging report text self.text = _reportformat % ( utils.version(), sys.version, sys.platform, numpy.__version__, qt4.qVersion(), qt4.PYQT_VERSION_STR, sip.SIP_VERSION_STR, time.strftime('%a, %d %b %Y %H:%M:%S +0000', time.gmtime()), exception) self.detailstosend.setPlainText(self.text)
def _writeFileHeader(self, fileobj, type): """Write a header to a saved file of type.""" fileobj.write('# Veusz %s (version %s)\n' % (type, utils.version())) try: fileobj.write('# User: %s\n' % os.environ['LOGNAME'] ) except KeyError: pass fileobj.write('# Date: %s\n\n' % time.strftime("%d/%m/%Y %H:%M:%S +0000", time.gmtime()) )
def run(): '''Run the main application.''' # jump to the embedding client entry point if required if len(sys.argv) == 2 and sys.argv[1] == '--embed-remote': from veusz.embed_remote import runremote runremote() return # this function is spaghetti-like and has nasty code paths. # the idea is to postpone the imports until the splash screen # is shown app = qt4.QApplication(sys.argv) app.connect(app, qt4.SIGNAL('lastWindowClosed()'), app, qt4.SLOT('quit()')) # register a signal handler to catch ctrl+C signal.signal(signal.SIGINT, handleIntSignal) # parse command line options parser = optparse.OptionParser( usage='%prog [options] filename.vsz ...', version=copyr % utils.version()) parser.add_option('--unsafe-mode', action='store_true', help='disable safety checks when running documents' ' or scripts') parser.add_option('--listen', action='store_true', help='read and execute Veusz commands from stdin,' ' replacing veusz_listen') parser.add_option('--quiet', action='store_true', help='if in listening mode, do not open a window but' ' execute commands quietly') parser.add_option('--export', action='append', metavar='FILE', help='export the next document to this' ' output image file, exiting when finished') parser.add_option('--embed-remote', action='store_true', help=optparse.SUPPRESS_HELP) parser.add_option('--plugin', action='append', metavar='FILE', help='load the plugin from the file given for ' 'the session') parser.add_option('--translation', metavar='FILE', help='load the translation .qm file given') options, args = parser.parse_args( app.argv() ) # convert args to unicode from filesystem strings args = convertArgsUnicode(args) s = AppRunner(options, args) app.exec_()
def __init__(self, mainwindow): VeuszDialog.__init__(self, mainwindow, 'about.ui', modal=True) # draw logo in dialog self.frame.setBackgroundRole(qt4.QPalette.Base) self.frame.setAutoFillBackground(True) self.logolabel.setPixmap(utils.getPixmap('logo.png')) # add version to copyright text copyrighttext = unicode(self.copyrightlabel.text()) copyrighttext = copyrighttext % {'version': utils.version()} self.copyrightlabel.setText(copyrighttext) self.connect(self.licenseButton, qt4.SIGNAL('clicked()'), self.licenseClicked)
def __init__(self, mainwindow): VeuszDialog.__init__(self, mainwindow, 'about.ui', modal=True) # draw logo in dialog self.frame.setBackgroundRole(qt4.QPalette.Base) self.frame.setAutoFillBackground(True) self.logolabel.setPixmap( utils.getPixmap('logo.png') ) # add version to copyright text copyrighttext = unicode(self.copyrightlabel.text()) copyrighttext = copyrighttext % {'version': utils.version()} self.copyrightlabel.setText(copyrighttext) self.connect(self.licenseButton, qt4.SIGNAL('clicked()'), self.licenseClicked)
def __init__(self, args): qt4.QApplication.__init__(self, args) self.connect(self, qt4.SIGNAL('lastWindowClosed()'), self, qt4.SLOT('quit()')) # register a signal handler to catch ctrl+C signal.signal(signal.SIGINT, handleIntSignal) # parse command line options parser = optparse.OptionParser( usage='%prog [options] filename.vsz ...', version=copyr % utils.version()) parser.add_option('--unsafe-mode', action='store_true', help='disable safety checks when running documents' ' or scripts') parser.add_option('--listen', action='store_true', help='read and execute Veusz commands from stdin,' ' replacing veusz_listen') parser.add_option('--quiet', action='store_true', help='if in listening mode, do not open a window but' ' execute commands quietly') parser.add_option('--export', action='append', metavar='FILE', help='export the next document to this' ' output image file, exiting when finished') parser.add_option('--embed-remote', action='store_true', help=optparse.SUPPRESS_HELP) parser.add_option('--plugin', action='append', metavar='FILE', help='load the plugin from the file given for ' 'the session') parser.add_option('--translation', metavar='FILE', help='load the translation .qm file given') options, args = parser.parse_args(self.argv()) # export files to make images if options.export and len(options.export) != len(args)-1: parser.error( 'export option needs same number of documents and ' 'output files') # convert args to unicode from filesystem strings self.args = convertArgsUnicode(args) self.options = options self.openeventfiles = [] self.startupdone = False self.splash = None
def __init__(self, exception, parent): VeuszDialog.__init__(self, parent, 'exceptionsend.ui') # debugging report text self.text = _reportformat % ( utils.version(), sys.version, sys.platform, numpy.__version__, qt4.qVersion(), qt4.PYQT_VERSION_STR, sip.SIP_VERSION_STR, time.strftime('%a, %d %b %Y %H:%M:%S +0000', time.gmtime()), exception ) self.detailstosend.setPlainText(self.text)
def printDialog(parentwindow, document, filename=None): """Open a print dialog and print document.""" if document.getNumberPages() == 0: qt4.QMessageBox.warning(parentwindow, _("Error - Veusz"), _("No pages to print")) return prnt = qt4.QPrinter(qt4.QPrinter.HighResolution) prnt.setColorMode(qt4.QPrinter.Color) prnt.setCreator(_('Veusz %s') % utils.version()) if filename: prnt.setDocName(filename) dialog = qt4.QPrintDialog(prnt, parentwindow) dialog.setMinMax(1, document.getNumberPages()) if dialog.exec_(): # get page range if dialog.printRange() == qt4.QAbstractPrintDialog.PageRange: # page range minval, maxval = dialog.fromPage(), dialog.toPage() else: # all pages minval, maxval = 1, document.getNumberPages() # pages are relative to zero minval -= 1 maxval -= 1 # reverse or forward order if prnt.pageOrder() == qt4.QPrinter.FirstPageFirst: pages = range(minval, maxval+1) else: pages = range(maxval, minval-1, -1) # if more copies are requested pages *= prnt.numCopies() # do the printing document.printTo( prnt, pages )
def slotFilePrint(self): """Print the document.""" if self.document.getNumberPages() == 0: qt4.QMessageBox.warning(self, "Veusz", "No pages to print") return prnt = qt4.QPrinter(qt4.QPrinter.HighResolution) prnt.setColorMode(qt4.QPrinter.Color) prnt.setCreator('Veusz %s' % utils.version()) prnt.setDocName(self.filename) dialog = qt4.QPrintDialog(prnt, self) dialog.setMinMax(1, self.document.getNumberPages()) if dialog.exec_(): # get page range if dialog.printRange() == qt4.QAbstractPrintDialog.PageRange: # page range minval, maxval = dialog.fromPage(), dialog.toPage() else: # all pages minval, maxval = 1, self.document.getNumberPages() # pages are relative to zero minval -= 1 maxval -= 1 # reverse or forward order if prnt.pageOrder() == qt4.QPrinter.FirstPageFirst: pages = range(minval, maxval+1) else: pages = range(maxval, minval-1, -1) # if more copies are requested pages *= prnt.numCopies() # do the printing self.document.printTo( prnt, pages )
def makeSplash(app): '''Make a splash screen logo.''' splash = qt.QSplashScreen() splash.setStyleSheet("background-color:white; color: black;") # draw logo on pixmap layout = qt.QVBoxLayout(splash) logo = qt.QLabel() logo.setPixmap(utils.getPixmap('logo.png')) logo.setAlignment(qt.Qt.AlignCenter) layout.addWidget(logo) # add copyright text message = qt.QLabel() message.setText(splashcopyr % utils.version()) message.setAlignment(qt.Qt.AlignCenter) # increase size of font font = message.font() font.setPointSizeF(font.pointSize()*1.5) message.setFont(font) layout.addWidget(message) h = qt.QFontMetrics(font).height() layout.setContentsMargins(h,h,h,h) # Center the spash screen splash.setGeometry(5, 5, 100, 100) screen = qt.QDesktopWidget().screenGeometry() splash.move( (screen.width()-layout.sizeHint().width())//2, (screen.height()-layout.sizeHint().height())//2 ) # make sure dialog goes away - avoid problem if a message box pops # up before it is removed qt.QTimer.singleShot(2000, splash.hide) return splash
def makeSplashLogo(): '''Make a splash screen logo.''' border = 16 xw, yw = 520, 240 pix = qt4.QPixmap(xw, yw) pix.fill() p = qt4.QPainter(pix) # draw logo on pixmap logo = utils.getPixmap('logo.png') p.drawPixmap(xw / 2 - logo.width() / 2, border, logo) # add copyright text doc = qt4.QTextDocument() doc.setPageSize(qt4.QSizeF(xw, yw - 3 * border - logo.height())) f = qt4.qApp.font() f.setPointSize(14) doc.setDefaultFont(f) doc.setDefaultTextOption(qt4.QTextOption(qt4.Qt.AlignCenter)) doc.setHtml(splashcopyr % utils.version()) p.translate(0, 2 * border + logo.height()) doc.drawContents(p) p.end() return pix
def makeSplashLogo(): '''Make a splash screen logo.''' border = 16 xw, yw = 520, 240 pix = qt4.QPixmap(xw, yw) pix.fill() p = qt4.QPainter(pix) # draw logo on pixmap logo = utils.getPixmap('logo.png') p.drawPixmap( xw/2 - logo.width()/2, border, logo ) # add copyright text doc = qt4.QTextDocument() doc.setPageSize( qt4.QSizeF(xw, yw - 3*border - logo.height()) ) f = qt4.qApp.font() f.setPointSize(14) doc.setDefaultFont(f) doc.setDefaultTextOption( qt4.QTextOption(qt4.Qt.AlignCenter) ) doc.setHtml(splashcopyr % utils.version()) p.translate(0, 2*border + logo.height()) doc.drawContents(p) p.end() return pix
def exportPS(self, ext): """Export to EPS or PDF format.""" printer = qt4.QPrinter() printer.setFullPage(True) # set printer parameters printer.setColorMode( (qt4.QPrinter.GrayScale, qt4.QPrinter.Color)[self.color]) if ext == '.pdf': fmt = qt4.QPrinter.PdfFormat else: fmt = qt4.QPrinter.PostScriptFormat printer.setOutputFormat(fmt) printer.setOutputFileName(self.filename) printer.setCreator('Veusz %s' % utils.version()) printer.setResolution(self.pdfdpi) # setup for printing printer.newPage() painter = qt4.QPainter(printer) # write to printer with correct dpi dpi = (printer.logicalDpiX(), printer.logicalDpiY()) width, height = size = self.doc.pageSize(self.pagenumber, dpi=dpi) self.renderPage(size, dpi, painter) # fixup eps/pdf file - yuck HACK! - hope qt gets fixed # this makes the bounding box correct # copy output to a temporary file tmpfile = "%s.tmp.%i" % (self.filename, random.randint(0, 1000000)) fout = open(tmpfile, 'wb') fin = open(self.filename, 'rb') if ext == '.eps': # adjust bounding box for line in fin: if line[:14] == '%%BoundingBox:': # replace bounding box line by calculated one parts = line.split() widthfactor = float(parts[3]) / printer.width() origheight = float(parts[4]) line = "%s %i %i %i %i\n" % ( parts[0], 0, int(math.floor(origheight - widthfactor * height)), int(math.ceil( widthfactor * width)), int(math.ceil(origheight))) fout.write(line) elif ext == '.pdf': # change pdf bounding box and correct pdf index text = fin.read() text = utils.scalePDFMediaBox(text, printer.width(), width, height) text = utils.fixupPDFIndices(text) fout.write(text) fout.close() fin.close() os.remove(self.filename) os.rename(tmpfile, self.filename)
def _writeFileHeader(self, fileobj, type): """Write a header to a saved file of type.""" fileobj.write('# Veusz %s (version %s)\n' % (type, utils.version())) fileobj.write('# Saved at %s\n\n' % datetime.datetime.utcnow().isoformat())
def run(): '''Run the main application.''' # jump to the embedding client entry point if required if len(sys.argv) == 2 and sys.argv[1] == '--embed-remote': from veusz.embed_remote import runremote runremote() return # this function is spaghetti-like and has nasty code paths. # the idea is to postpone the imports until the splash screen # is shown app = qt4.QApplication(sys.argv) app.connect(app, qt4.SIGNAL("lastWindowClosed()"), app, qt4.SLOT("quit()")) sys.excepthook = excepthook # register a signal handler to catch ctrl+C signal.signal(signal.SIGINT, handleIntSignal) # parse command line options parser = optparse.OptionParser( usage="%prog [options] filename.vsz ...", version=copyr % utils.version()) parser.add_option('--unsafe-mode', action='store_true', help='disable safety checks when running documents' ' or scripts') parser.add_option('--listen', action='store_true', help='read and execute Veusz commands from stdin,' ' replacing veusz_listen') parser.add_option('--quiet', action='store_true', help='if in listening mode, do not open a window but' ' execute commands quietly') parser.add_option('--export', action='append', metavar='FILE', help='export the next document to this' ' output image file, exiting when finished') parser.add_option('--embed-remote', action='store_true', help=optparse.SUPPRESS_HELP) parser.add_option('--plugin', action='append', metavar='FILE', help='load the plugin from the file given for ' 'the session') options, args = parser.parse_args( app.argv() ) # convert args to unicode from filesystem strings args = convertArgsUnicode(args) splash = None if options.listen or options.export: # do not show splash screen spash = None else: splash = qt4.QSplashScreen(makeSplashLogo()) splash.show() app.processEvents() # import these after showing splash screen so we don't # have too long a wait before it shows import veusz.setting import veusz.widgets # for people who want to run any old script veusz.setting.transient_settings['unsafe_mode'] = bool( options.unsafe_mode) # load any requested plugins if options.plugin: import veusz.document veusz.document.Document.loadPlugins(pluginlist=options.plugin) # different modes if options.listen: # listen to incoming commands listen(args, quiet=options.quiet) elif options.export: # export files to make images if len(options.export) != len(args)-1: parser.error( 'export option needs same number of documents and output files') export(options.export, args) return else: # standard start main window mainwindow(args) # clear splash when startup done if splash is not None: splash.finish(app.topLevelWidgets()[0]) # wait for application to exit app.exec_()
def exportPS(self, ext): """Export to EPS or PDF format.""" printer = qt4.QPrinter() printer.setFullPage(True) # set printer parameters printer.setColorMode( (qt4.QPrinter.GrayScale, qt4.QPrinter.Color)[ self.color] ) if ext == '.pdf': fmt = qt4.QPrinter.PdfFormat else: fmt = qt4.QPrinter.PostScriptFormat printer.setOutputFormat(fmt) printer.setOutputFileName(self.filename) printer.setCreator('Veusz %s' % utils.version()) printer.setResolution(self.pdfdpi) # setup for printing printer.newPage() painter = painthelper.DirectPainter(printer) # write to printer with correct dpi dpi = (printer.logicalDpiX(), printer.logicalDpiY()) width, height = size = self.doc.pageSize(self.pagenumber, dpi=dpi) self.renderPage(size, dpi, painter) # fixup eps/pdf file - yuck HACK! - hope qt gets fixed # this makes the bounding box correct # copy output to a temporary file tmpfile = "%s.tmp.%i" % (self.filename, random.randint(0,1000000)) fout = open(tmpfile, 'wb') fin = open(self.filename, 'rb') if ext == '.eps': # adjust bounding box for line in fin: if line[:14] == '%%BoundingBox:': # replace bounding box line by calculated one parts = line.split() widthfactor = float(parts[3]) / printer.width() origheight = float(parts[4]) line = "%s %i %i %i %i\n" % ( parts[0], 0, int(math.floor(origheight-widthfactor*height)), int(math.ceil(widthfactor*width)), int(math.ceil(origheight)) ) fout.write(line) elif ext == '.pdf': # change pdf bounding box and correct pdf index text = fin.read() text = utils.scalePDFMediaBox(text, printer.width(), width, height) text = utils.fixupPDFIndices(text) fout.write(text) fout.close() fin.close() os.remove(self.filename) os.rename(tmpfile, self.filename)
self.history_posn = newpos # user has modified text since last set if self.isModified(): self.entered_text = text # replace the text in the control text = self.history[ self.history_posn ] self.setText(text) introtext=u'''Welcome to <b><font color="purple">Veusz %s</font></b> --- a scientific plotting application.<br> Copyright \u00a9 2003-2011 Jeremy Sanders <[email protected]> and contributors.<br> Veusz comes with ABSOLUTELY NO WARRANTY. Veusz is Free Software, and you are<br> welcome to redistribute it under certain conditions. Enter "GPL()" for details.<br> This window is a Python command line console and acts as a calculator.<br> ''' % utils.version() class ConsoleWindow(qt4.QDockWidget): """ A python-like qt console.""" def __init__(self, thedocument, *args): qt4.QDockWidget.__init__(self, *args) self.setWindowTitle("Console - Veusz") self.setObjectName("veuszconsolewindow") # arrange sub-widgets in a vbox self.vbox = qt4.QWidget() self.setWidget(self.vbox) vlayout = qt4.QVBoxLayout(self.vbox) vlayout.setMargin( vlayout.margin()/4 ) vlayout.setSpacing( vlayout.spacing()/4 )
def __init__(self): qt.QApplication.__init__(self, sys.argv) self.lastWindowClosed.connect(self.quit) self.signalException.connect(self.showException) # register a signal handler to catch ctrl+C signal.signal(signal.SIGINT, handleIntSignal) # parse command line options parser = argparse.ArgumentParser( description='Veusz scientific plotting package') parser.add_argument('--version', action='version', version=copyr % utils.version()) parser.add_argument('--unsafe-mode', action='store_true', help='disable safety checks when running documents' ' or scripts') parser.add_argument('--listen', action='store_true', help='read and execute Veusz commands from stdin,' ' replacing veusz_listen') parser.add_argument( '--quiet', action='store_true', help='if in listening mode, do not open a window but' ' execute commands quietly') parser.add_argument('--export', action='append', metavar='FILE', help='export the next document to this' ' output image file, exiting when finished') parser.add_argument('--export-option', action='append', metavar='VAL', help='add option when exporting file') parser.add_argument('--embed-remote', action='store_true', help='(internal - not for external use)') parser.add_argument('--plugin', action='append', metavar='FILE', help='load the plugin from the file given for ' 'the session') parser.add_argument('--translation', metavar='FILE', help='load the translation .qm file given') parser.add_argument('docs', metavar='FILE', nargs='*', help='document to load') self.args = args = parser.parse_args() args.docs = convertArgsUnicode(args.docs) # export files to make images if args.export: if len(args.export) != len(args.docs): parser.error( 'export option needs same number of documents and ' 'output files') args.export = convertArgsUnicode(args.export) self.openeventfiles = [] self.startupdone = False self.splash = None self.trans = None
# user has modified text since last set if self.isModified(): self.entered_text = text # replace the text in the control text = self.history[self.history_posn] self.setText(text) introtext = _( u'''Welcome to <b><font color="purple">Veusz %s</font></b> --- a scientific plotting application.<br> Copyright \u00a9 2003-2012 Jeremy Sanders <[email protected]> and contributors.<br> Veusz comes with ABSOLUTELY NO WARRANTY. Veusz is Free Software, and you are<br> welcome to redistribute it under certain conditions. Enter "GPL()" for details.<br> This window is a Python command line console and acts as a calculator.<br> ''') % utils.version() class ConsoleWindow(qt4.QDockWidget): """ A python-like qt console.""" def __init__(self, thedocument, *args): qt4.QDockWidget.__init__(self, *args) self.setWindowTitle(_("Console - Veusz")) self.setObjectName("veuszconsolewindow") # arrange sub-widgets in a vbox self.vbox = qt4.QWidget() self.setWidget(self.vbox) vlayout = qt4.QVBoxLayout(self.vbox) vlayout.setMargin(vlayout.margin() / 4) vlayout.setSpacing(vlayout.spacing() / 4)
self.history_posn = newpos # user has modified text since last set if self.isModified(): self.entered_text = text # replace the text in the control text = self.history[ self.history_posn ] self.setText(text) introtext=_(u'''Welcome to <b><font color="purple">Veusz %s</font></b> --- a scientific plotting application.<br> Copyright \u00a9 2003-2012 Jeremy Sanders <[email protected]> and contributors.<br> Veusz comes with ABSOLUTELY NO WARRANTY. Veusz is Free Software, and you are<br> welcome to redistribute it under certain conditions. Enter "GPL()" for details.<br> This window is a Python command line console and acts as a calculator.<br> ''') % utils.version() class ConsoleWindow(qt4.QDockWidget): """ A python-like qt console.""" def __init__(self, thedocument, *args): qt4.QDockWidget.__init__(self, *args) self.setWindowTitle(_("Console - Veusz")) self.setObjectName("veuszconsolewindow") # arrange sub-widgets in a vbox self.vbox = qt4.QWidget() self.setWidget(self.vbox) vlayout = qt4.QVBoxLayout(self.vbox) vlayout.setMargin( vlayout.margin()/4 ) vlayout.setSpacing( vlayout.spacing()/4 )