def export(exports, args): '''A shortcut to load a set of files and export them.''' import veusz.document as document for expfn, vsz in zip(exports, args[1:]): doc = document.Document() ci = document.CommandInterpreter(doc) ci.Load(vsz) ci.run('Export(%s)' % repr(expfn))
def export(exports, docs): '''A shortcut to load a set of files and export them.''' from veusz import document from veusz import utils for expfn, vsz in czip(exports, docs): doc = document.Document() ci = document.CommandInterpreter(doc) ci.Load(vsz) ci.run('Export(%s)' % repr(expfn))
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) # start an interpreter instance to the document self.interpreter = document.CommandInterpreter(thedocument) self.document = thedocument # output from the interpreter goes to self.output_stdxxx self.con_stdout = _Writer(self.output_stdout) self.con_stderr = _Writer(self.output_stderr) self.interpreter.setOutputs(self.con_stdout, self.con_stderr) self.stdoutbuffer = "" self.stderrbuffer = "" # (mostly) hidden notification self._hiddennotify = qt4.QLabel() vlayout.addWidget(self._hiddennotify) self._hiddennotify.hide() # the output from the console goes here self._outputdisplay = qt4.QTextEdit() self._outputdisplay.setReadOnly(True) self._outputdisplay.insertHtml(introtext) vlayout.addWidget(self._outputdisplay) self._hbox = qt4.QWidget() hlayout = qt4.QHBoxLayout(self._hbox) hlayout.setMargin(0) vlayout.addWidget(self._hbox) self._prompt = qt4.QLabel(">>>") hlayout.addWidget(self._prompt) # where commands are typed in self._inputedit = _CommandEdit() hlayout.addWidget(self._inputedit) self._inputedit.setFocus() # keep track of multiple line commands self.command_build = '' # get called if enter is pressed in the input control self.connect(self._inputedit, qt4.SIGNAL("sigEnter"), self.slotEnter) # called if document logs something self.connect(thedocument, qt4.SIGNAL("sigLog"), self.slotDocumentLog)
def export(exports, docs, options): '''A shortcut to load a set of files and export them.''' from veusz import document from veusz import utils # TODO: validate options opttxt = ', '.join(options) if options else '' for expfn, vsz in czip(exports, docs): doc = document.Document() ci = document.CommandInterpreter(doc) ci.Load(vsz) ci.run('Export(%s, %s)' % (repr(expfn), opttxt))
def __init__(self, title, doc=None): """Construct window with title given.""" self.window = SimpleWindow(title, doc=doc) self.window.show() self.document = self.window.document self.plot = self.window.plot # use time based checking by default self.plot.setTimeout(250) self.ci = document.CommandInterpreter(self.document) self.ci.addCommand('Close', self.cmdClose) self.ci.addCommand('Zoom', self.cmdZoom) self.ci.addCommand('EnableToolbar', self.cmdEnableToolbar) self.ci.addCommand('ForceUpdate', self.cmdForceUpdate) self.ci.addCommand('GetClick', self.cmdGetClick) self.ci.addCommand('ResizeWindow', self.cmdResizeWindow) self.ci.addCommand('SetUpdateInterval', self.cmdSetUpdateInterval) self.ci.addCommand('MoveToPage', self.cmdMoveToPage) self.ci.addCommand('IsClosed', self.cmdIsClosed) self.ci.addCommand('SetAntiAliasing', self.cmdSetAntiAliasing) self.ci.addCommand('_apiVersion', self.cmd_apiVersion)
def set_doc(self, doc=False): self.treeedit.close() self.lay.removeWidget(self.plot) self.plot.hide() self.plot.close() del self.plot # Adding Veusz objects if not doc: doc = filedata.MisuraDocument() self.document = doc self.cmd = document.CommandInterface(self.document) self.ci = document.CommandInterpreter(self.document) self.plot = VeuszPlotWindow(self.document, self) self.lay.addWidget(self.plot) self.enable_shortcuts() # Faking mainwindow self.treeedit = treeeditwindow.TreeEditDock(doc, self) self.treeedit.hide() self.vinit = 0 # Loading Stylesheet if os.path.exists('/opt/misura/misura/client/art/plot.vst'): self.ci.run("Load('/opt/misura/misura/client/art/plot.vst')") plugin.makeDefaultDoc(self.cmd) # Override the zoompage action in order to fit the plot into widget # dimension. zp = self.plot.vzactions['view.zoompage'] self.plot.disconnect(zp, QtCore.SIGNAL('triggered()'), self.plot.slotViewZoomPage) self.plot.connect(zp, QtCore.SIGNAL('triggered()'), self.fitSize) self.delayed = QtCore.QTimer() self.zoompageAct = zp self.plot.sigWidgetClicked.connect(self.treeedit.selectWidget) self.treeedit.widgetsSelected.connect(self.plot.selectedWidgets) self.treeedit.sigPageChanged.connect(self.plot.setPageNumber) self.document.model.sigPageChanged.connect(self.sync_page)