def __init__(self, document, setting, setnsproxy): """Initialise button, passing document, setting, and parent widget.""" qt4.QWidget.__init__(self) self.setFocusPolicy(qt4.Qt.StrongFocus) self.document = document self.connect(document, qt4.SIGNAL('sigModified'), self.slotDocModified) self.setting = setting self.setnsproxy = setnsproxy self.layout = qt4.QHBoxLayout(self) self.layout.setMargin(2) if setting.usertext: text = setting.usertext else: text = setting.name self.labelicon = qt4.QLabel(text) self.layout.addWidget(self.labelicon) self.iconlabel = qt4.QLabel() self.layout.addWidget(self.iconlabel) self.connect(self, qt4.SIGNAL('clicked'), self.settingMenu) self.infocus = False self.inmouse = False self.inmenu = False # initialise settings self.slotDocModified()
def processNextJob(self): """Take a job from the queue and process it. emits renderfinished(jobid, img, painthelper) when done, if job has not been superseded """ self.mutex.lock() jobid, helper = self.latestjobs[-1] del self.latestjobs[-1] lastadded = self.latestaddedjob self.mutex.unlock() # don't process jobs which have been superseded if lastadded == jobid: img = qt4.QImage(helper.pagesize[0], helper.pagesize[1], qt4.QImage.Format_ARGB32_Premultiplied) img.fill(setting.settingdb.color('page').rgb()) painter = qt4.QPainter(img) aa = self.plotwindow.antialias painter.setRenderHint(qt4.QPainter.Antialiasing, aa) painter.setRenderHint(qt4.QPainter.TextAntialiasing, aa) helper.renderToPainter(painter) painter.end() self.mutex.lock() # just throw away result if it older than the latest one if jobid > self.latestdrawnjob: self.emit(qt4.SIGNAL("renderfinished"), jobid, img, helper) self.latestdrawnjob = jobid self.mutex.unlock() # tell any listeners that a job has been processed self.plotwindow.emit(qt4.SIGNAL("queuechange"), -1)
def __init__(self, *args): """Initialise the line edit.""" qt4.QLineEdit.__init__(self, *args) # the clear button itself, with no padding self.clearbutton = cb = qt4.QToolButton(self) cb.setIcon(utils.getIcon('kde-edit-delete')) cb.setCursor(qt4.Qt.ArrowCursor) cb.setStyleSheet('QToolButton { border: none; padding: 0px; }') cb.setToolTip("Clear text") cb.hide() # make clicking on the button clear the text self.connect(cb, qt4.SIGNAL('clicked()'), self, qt4.SLOT("clear()")) # button should appear if there is text self.connect(self, qt4.SIGNAL('textChanged(const QString&)'), self.updateCloseButton) # positioning of the button fw = self.style().pixelMetric(qt4.QStyle.PM_DefaultFrameWidth) self.setStyleSheet("QLineEdit { padding-right: %ipx; } " % (cb.sizeHint().width() + fw + 1)) msz = self.minimumSizeHint() mx = cb.sizeHint().height() + fw * 2 + 2 self.setMinimumSize(max(msz.width(), mx), max(msz.height(), mx))
def loadUi(self): """Load user interface and setup panel.""" ImportTab.loadUi(self) self.connect(self.csvhelpbutton, qt4.SIGNAL('clicked()'), self.slotHelp) self.connect(self.csvdelimitercombo, qt4.SIGNAL('editTextChanged(const QString&)'), self.dialog.slotUpdatePreview) self.connect(self.csvtextdelimitercombo, qt4.SIGNAL('editTextChanged(const QString&)'), self.dialog.slotUpdatePreview) self.csvdelimitercombo.default = [ ',', '{tab}', '{space}', '|', ':', ';' ] self.csvtextdelimitercombo.default = ['"', "'"] self.csvdatefmtcombo.default = [ 'YYYY-MM-DD|T|hh:mm:ss', 'DD/MM/YY| |hh:mm:ss', 'M/D/YY| |hh:mm:ss' ] self.csvnumfmtcombo.defaultlist = [ _('System'), _('English'), _('European') ] self.csvheadermodecombo.defaultlist = [ _('Multiple'), _('1st row'), _('None') ]
def __init__(self, parent, document): VeuszDialog.__init__(self, parent, 'stylesheet.ui') self.document = document self.stylesheet = document.basewidget.settings.StyleSheet self.stylesListWidget.setMinimumWidth(100) # initial properties widget self.tabformat = None self.properties = None self.fillStyleList() self.connect( self.stylesListWidget, qt4.SIGNAL( 'currentItemChanged(QListWidgetItem *,QListWidgetItem *)'), self.slotStyleItemChanged) self.stylesListWidget.setCurrentRow(0) # we disable default buttons as they keep grabbing the enter key close = self.buttonBox.button(qt4.QDialogButtonBox.Close) close.setDefault(False) close.setAutoDefault(False) self.connect(self.saveButton, qt4.SIGNAL('clicked()'), self.slotSaveStyleSheet) self.connect(self.loadButton, qt4.SIGNAL('clicked()'), self.slotLoadStyleSheet) # recent button shows list of recently used files for loading self.connect(self.recentButton, qt4.SIGNAL('filechosen'), self.loadStyleSheet) self.recentButton.setSetting('stylesheetdialog_recent')
def changeStep(self, stepklass): '''Apply the next step.''' # this is the current text self.step = stepklass(self.mainwin) # listen to step for next step self.connect(self.step, qt4.SIGNAL('nextStep'), self.slotNext) # update text self.textedit.setHtml(self.step.text) # handle requests for flashing self.flashct = 20 self.flashon = True self.flash = self.step.flash if self.flash is not None: self.ensureShowFlashWidgets() # enable/disable next button self.nextb.setEnabled(not self.step.disablenext) # add a close button if requested if self.step.closestep: closeb = self.buttonbox.addButton('Close', qt4.QDialogButtonBox.ActionRole) self.connect(closeb, qt4.SIGNAL('clicked()'), self.close)
def __init__(self, parent, document): VeuszDialog.__init__(self, parent, 'dataedit.ui') self.document = document # set up dataset list self.dsbrowser = DatasetBrowser(document, parent, parent) self.splitter.insertWidget(0, self.dsbrowser) # actions for data table for text, slot in ( (_('Copy'), self.slotCopy), (_('Delete row'), self.slotDeleteRow), (_('Insert row'), self.slotInsertRow), ): act = qt4.QAction(text, self) self.connect(act, qt4.SIGNAL('triggered()'), slot) self.datatableview.addAction(act) self.datatableview.setContextMenuPolicy(qt4.Qt.ActionsContextMenu) # layout edit dialog improvement self.splitter.setStretchFactor(0, 3) self.splitter.setStretchFactor(1, 4) # don't want text to look editable or special self.linkedlabel.setFrameShape(qt4.QFrame.NoFrame) self.linkedlabel.viewport().setBackgroundRole(qt4.QPalette.Window) # document changes self.connect(document, qt4.SIGNAL('sigModified'), self.slotDocumentModified) # select first item, if any or initialise if none if len(self.document.data) > 0: self.selectDataset(sorted(self.document.data.keys())[0]) else: self.slotDatasetSelected("") self.connect(self.dsbrowser.navtree, qt4.SIGNAL("selecteditem"), self.slotDatasetSelected) # connect buttons for btn, slot in ( (self.deletebutton, self.slotDatasetDelete), (self.unlinkbutton, self.slotDatasetUnlink), (self.duplicatebutton, self.slotDatasetDuplicate), (self.importbutton, self.slotDatasetImport), (self.createbutton, self.slotDatasetCreate), (self.editbutton, self.slotDatasetEdit), ): self.connect(btn, qt4.SIGNAL('clicked()'), slot) # menu for new button self.newmenu = qt4.QMenu() for text, slot in ((_('Numerical dataset'), self.slotNewNumericalDataset), (_('Text dataset'), self.slotNewTextDataset), (_('Date/time dataset'), self.slotNewDateDataset)): a = self.newmenu.addAction(text) self.connect(a, qt4.SIGNAL('triggered()'), slot) self.newbutton.setMenu(self.newmenu)
def slotSelectMode(self, action): """Called when the selection mode has changed.""" modecnvt = { self.vzactions['view.select']: 'select', self.vzactions['view.pick']: 'pick', self.vzactions['view.zoomgraph']: 'graphzoom' } # close the current picker self.pickeritem.hide() self.emit(qt4.SIGNAL('sigPickerEnabled'), False) # convert action into clicking mode self.clickmode = modecnvt[action] if self.clickmode == 'select': self.pixmapitem.unsetCursor() #self.label.setCursor(qt4.Qt.ArrowCursor) elif self.clickmode == 'graphzoom': self.pixmapitem.unsetCursor() #self.label.setCursor(qt4.Qt.CrossCursor) elif self.clickmode == 'pick': self.pixmapitem.setCursor(qt4.Qt.CrossCursor) self.emit(qt4.SIGNAL('sigPickerEnabled'), True)
def _addGroupedSettingsControl(self, grpdsetting, row): """Add a control for a set of grouped settings.""" slist = grpdsetting.settingList() # make first widget with expandable button # this is a label with a + button by this side setnlab = SettingLabel(self.document, slist[0], grpdsetting) expandbutton = qt4.QPushButton("+", checkable=True, flat=True, maximumWidth=16) l = qt4.QHBoxLayout(spacing=0) l.setContentsMargins(0,0,0,0) l.addWidget( expandbutton ) l.addWidget( setnlab ) lw = qt4.QWidget() lw.setLayout(l) self.layout.addWidget(lw, row, 0) self.childlist.append(lw) # make main control cntrl = slist[0].makeControl(None) self.connect(cntrl, qt4.SIGNAL('settingChanged'), grpdsetting.onSettingChanged) self.layout.addWidget(cntrl, row, 1) self.childlist.append(cntrl) row += 1 # set of controls for remaining settings l = qt4.QGridLayout() grp_row = 0 for setn in slist[1:]: cntrl = setn.makeControl(None) if cntrl: lab = SettingLabel(self.document, setn, grpdsetting) l.addWidget(lab, grp_row, 0) self.connect(cntrl, qt4.SIGNAL('settingChanged'), grpdsetting.onSettingChanged) l.addWidget(cntrl, grp_row, 1) grp_row += 1 grpwidget = qt4.QFrame( frameShape = qt4.QFrame.Panel, frameShadow = qt4.QFrame.Raised, visible=False ) grpwidget.setLayout(l) def ontoggle(checked): """Toggle button text and make grp visible/invisible.""" expandbutton.setText( ("+","-")[checked] ) grpwidget.setVisible( checked ) self.connect(expandbutton, qt4.SIGNAL("toggled(bool)"), ontoggle) # add group to standard layout self.layout.addWidget(grpwidget, row, 0, 1, -1) self.childlist.append(grpwidget) row += 1 return row
def __init__(self, doc, mainwin, grouping, parent, readonly=False, filterdims=None, filterdtype=None): """Initialise the dataset tree view. doc: veusz document mainwin: veusz main window (or None if readonly) grouping: grouping mode of datasets parent: parent window or None filterdims: if set, only show datasets with dimensions given filterdtype: if set, only show datasets with type given """ qt4.QTreeView.__init__(self, parent) self.doc = doc self.mainwindow = mainwin self.model = DatasetRelationModel(doc, grouping, readonly=readonly, filterdims=filterdims, filterdtype=filterdtype) self.setModel(self.model) self.setSelectionMode(qt4.QTreeView.ExtendedSelection) self.setSelectionBehavior(qt4.QTreeView.SelectRows) self.setUniformRowHeights(True) self.setContextMenuPolicy(qt4.Qt.CustomContextMenu) if not readonly: self.connect(self, qt4.SIGNAL("customContextMenuRequested(QPoint)"), self.showContextMenu) self.model.refresh() self.expandAll() # stretch of columns hdr = self.header() hdr.setStretchLastSection(False) hdr.setResizeMode(0, qt4.QHeaderView.Stretch) for col in xrange(1, 3): hdr.setResizeMode(col, qt4.QHeaderView.ResizeToContents) # when documents have finished opening, expand all nodes if mainwin is not None: self.connect(mainwin, qt4.SIGNAL("documentopened"), self.expandAll) # keep track of selection self.connect( self.selectionModel(), qt4.SIGNAL("selectionChanged(const QItemSelection&, " "const QItemSelection&)"), self.slotNewSelection) # expand nodes by default self.connect(self.model, qt4.SIGNAL("rowsInserted(const QModelIndex&, int, int)"), self.slotNewRow)
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 loadUi(self): ImportTab.loadUi(self) # if different items are selected in fits tab self.connect(self.fitshdulist, qt4.SIGNAL('itemSelectionChanged()'), self.slotFitsUpdateCombos) self.connect(self.fitsdatasetname, qt4.SIGNAL('editTextChanged(const QString&)'), self.dialog.enableDisableImport) self.connect(self.fitsdatacolumn, qt4.SIGNAL('currentIndexChanged(int)'), self.dialog.enableDisableImport)
def __init__(self, document, simpleread, stream, parent, updateinterval = None): """Initialse capture dialog: document: document to send data to simpleread: object to interpret data stream: capturestream to read data from parent: parent widget updateinterval: if set, interval of seconds to update data in doc """ VeuszDialog.__init__(self, parent, 'capturing.ui') self.document = document self.simpleread = simpleread self.stream = stream # connect buttons self.connect( self.finishButton, qt4.SIGNAL('clicked()'), self.slotFinish ) self.connect( self.cancelButton, qt4.SIGNAL('clicked()'), self.slotCancel ) # timer which governs reading from source self.readtimer = qt4.QTimer(self) self.connect( self.readtimer, qt4.SIGNAL('timeout()'), self.slotReadTimer ) # record time capture started self.starttime = qt4.QTime() self.starttime.start() # sort tree by dataset name self.datasetTreeWidget.sortItems(0, qt4.Qt.AscendingOrder) # timer for updating display self.displaytimer = qt4.QTimer(self) self.connect( self.displaytimer, qt4.SIGNAL('timeout()'), self.slotDisplayTimer ) self.sourceLabel.setText( unicode(self.sourceLabel.text()) % stream.name ) self.txt_statusLabel = unicode(self.statusLabel.text()) self.slotDisplayTimer() # initialise label # timer to update document self.updatetimer = qt4.QTimer(self) self.updateoperation = None if updateinterval: self.connect( self.updatetimer, qt4.SIGNAL('timeout()'), self.slotUpdateTimer ) self.updatetimer.start( int(updateinterval*1000) ) # start display and read timers self.displaytimer.start(1000) self.readtimer.start(10)
def __init__(self, document, parent=None): """Initialise using document.""" qt4.QAbstractItemModel.__init__(self, parent) self.document = document self.connect(self.document, qt4.SIGNAL("sigModified"), self.slotDocumentModified) self.connect(self.document, qt4.SIGNAL("sigWiped"), self.slotDocumentModified) # suspend signals to the view that the model has changed self.suspendmodified = False
def __init__(self, document, parentwin): """Initialise dock given document and parent widget.""" qt4.QDockWidget.__init__(self, parentwin) self.parentwin = parentwin self.setWindowTitle(_("Editing - Veusz")) self.setObjectName("veuszeditingwindow") self.selwidgets = [] self.document = document self.connect( self.document, qt4.SIGNAL("sigWiped"), self.slotDocumentWiped ) # construct tree self.treemodel = WidgetTreeModel(document) self.treeview = WidgetTreeView(self.treemodel) # receive change in selection self.connect(self.treeview.selectionModel(), qt4.SIGNAL('selectionChanged(const QItemSelection &,' ' const QItemSelection &)'), self.slotTreeItemsSelected) # set tree as main widget self.setWidget(self.treeview) # toolbar to create widgets self.addtoolbar = qt4.QToolBar(_("Insert toolbar - Veusz"), parentwin) # note wrong description!: backwards compatibility self.addtoolbar.setObjectName("veuszeditingtoolbar") # toolbar for editting widgets self.edittoolbar = qt4.QToolBar(_("Edit toolbar - Veusz"), parentwin) self.edittoolbar.setObjectName("veuszedittoolbar") self._constructToolbarMenu() parentwin.addToolBarBreak(qt4.Qt.TopToolBarArea) parentwin.addToolBar(qt4.Qt.TopToolBarArea, self.addtoolbar) parentwin.addToolBar(qt4.Qt.TopToolBarArea, self.edittoolbar) # this sets various things up self.selectWidget(document.basewidget) # update paste button when clipboard changes self.connect(qt4.QApplication.clipboard(), qt4.SIGNAL('dataChanged()'), self.updatePasteButton) self.updatePasteButton()
def populateMenuToolbars(items, toolbar, menus): """Construct the menus and toolbar from the list of items. toolbar is a QToolbar object menus is a dict of menus to add to Items are tuples consisting of: (actioname, status bar text, menu text, menu id, slot, icon filename, add to toolbar (bool), shortcut text) Returns a dict of actions """ actions = {} parent = toolbar.parent() for i in items: if len(i) == 1: if menus is not None: menus[i[0]].addSeparator() continue menuid, descr, menutext, menu, slot, icon, addtool, key = i # create action action = qt4.QAction(parent) action.setText(menutext) action.setStatusTip(descr) action.setToolTip(descr) # set shortcut if set if key: action.setShortcut(qt4.QKeySequence(key)) # load icon if set if icon: action.setIcon(getIcon(icon)) if callable(slot): # connect the action to the slot if slot is not None: qt4.QObject.connect(action, qt4.SIGNAL('triggered()'), slot) # add to menu if menus is not None: menus[menu].addAction(action) elif slot is not None: if menus is not None: submenu = menus[menu].addMenu(menutext) menus["%s.%s" % (menu, menuid)] = submenu populateMenuToolbars(slot, toolbar, menus) else: if menus is not None: menus[menu].addAction(action) # add to toolbar if addtool and toolbar is not None: toolbar.addAction(action) # save for later actions[menuid] = action return actions
def slotCheckDelete(self, *args): d = self.mainwin.document try: d.resolve(d.basewidget, '/page1/graph1') except ValueError: # success! self.emit(qt4.SIGNAL('nextStep'))
def __init__(self, parent, document, datasetname): qt4.QAbstractTableModel.__init__(self, parent) self.document = document self.dsname = datasetname self.connect(document, qt4.SIGNAL('sigModified'), self.slotDocumentModified)
def __init__(self, document, dsname, parent, filterdims=None, filterdtype=None): """Open popup window for document dsname: dataset name parent: window parent filterdims: if set, only show datasets with dimensions given filterdtype: if set, only show datasets with type given """ DatasetBrowser.__init__(self, document, None, parent, readonly=True, filterdims=filterdims, filterdtype=filterdtype) self.setWindowFlags(qt4.Qt.Popup) self.setAttribute(qt4.Qt.WA_DeleteOnClose) self.spacing = self.fontMetrics().height() utils.positionFloatingPopup(self, parent) self.selectDataset(dsname) self.installEventFilter(self) self.navtree.setFocus() self.connect(self.navtree, qt4.SIGNAL("updateitem"), self.slotUpdateItem)
def loadUi(self): """Load the user interface.""" ImportTab.loadUi(self) # fill plugin combo names = list(sorted([p.name for p in plugins.importpluginregistry])) self.pluginType.addItems(names) self.connect(self.pluginType, qt4.SIGNAL('currentIndexChanged(int)'), self.pluginChanged) self.fields = [] # load previous plugin idx = -1 if self.promote is None: if 'import_plugin' in setting.settingdb: try: idx = names.index(setting.settingdb['import_plugin']) except ValueError: pass else: # set the correct entry for the plugin idx = names.index(self.promote) # then hide the widget so it can't be changed self.pluginchoicewidget.hide() if idx >= 0: self.pluginType.setCurrentIndex(idx) self.pluginChanged(-1)
def slotUpdateItem(self): """Emit new dataset signal.""" selected = self.navtree.selectionModel().currentIndex() if selected.isValid(): n = self.navtree.model.objFromIndex(selected) if isinstance(n, DatasetNode): self.emit(qt4.SIGNAL("newdataset"), n.data[0]) self.close()
def wipe(self): """Wipe out any stored data.""" self.data = {} self.basewidget = widgetfactory.thefactory.makeWidget( 'document', None, None) self.basewidget.document = self self.setModified(False) self.emit(qt4.SIGNAL("sigWiped"))
def keyReleaseEvent(self, event): """Emit clicked(pos) on key release.""" if event.key() == qt4.Qt.Key_Space: self.emit( qt4.SIGNAL('clicked'), self.mapToGlobal(self.iconlabel.pos()) ) event.accept() else: return qt4.QWidget.keyReleaseEvent(self, event)
def __init__(self, document, mainwin, *args): qt4.QDockWidget.__init__(self, *args) self.setAttribute(qt4.Qt.WA_DeleteOnClose) self.setMinimumHeight(300) self.setWindowTitle('Tutorial - Veusz') self.setObjectName('veusztutorialwindow') self.setStyleSheet('background: lightyellow;') self.document = document self.mainwin = mainwin self.layout = l = qt4.QVBoxLayout() txtdoc = qt4.QTextDocument(self) txtdoc.setDefaultStyleSheet("p.usercmd { color: blue; } " "h1 { font-size: x-large;} " "code { color: green;} ") self.textedit = qt4.QTextEdit(readOnly=True) self.textedit.setDocument(txtdoc) l.addWidget(self.textedit) self.buttonbox = qt4.QDialogButtonBox() self.nextb = self.buttonbox.addButton('Next', qt4.QDialogButtonBox.ActionRole) self.connect(self.nextb, qt4.SIGNAL('clicked()'), self.slotNext) l.addWidget(self.buttonbox) # have to use a separate widget as dialog already has layout self.widget = qt4.QWidget() self.widget.setLayout(l) self.setWidget(self.widget) # timer for controlling flashing self.flashtimer = qt4.QTimer(self) self.connect(self.flashtimer, qt4.SIGNAL('timeout()'), self.slotFlashTimeout) self.flash = self.oldflash = None self.flashon = False self.flashct = 0 self.flashtimer.start(500) self.changeStep(StepIntro)
def slotTimeout(self): from veusz.dialogs.importdialog import ImportDialog closed = True for dialog in self.mainwin.dialogs: if isinstance(dialog, ImportDialog): closed = False if closed: # move forward if no import dialog open self.emit(qt4.SIGNAL('nextStep'))
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 slotNextSetting(self, *args): """Check setting to emit next.""" try: setn = self.mainwin.document.basewidget.prefLookup( self.nextonsetting[0]).get() if self.nextonsetting[1](setn): self.emit(qt4.SIGNAL('nextStep')) except ValueError: pass
def setData(self, index, value, role): if role == qt4.Qt.EditRole: val, ok = value.toDouble() if ok: self.data[index.row()] = val self.emit( qt4.SIGNAL("dataChanged(const QModelIndex &," " const QModelIndex &)"), index, index) return True return False
def __init__(self, *args): qt4.QLineEdit.__init__(self, *args) self.history = [] self.history_posn = 0 self.entered_text = '' qt4.QObject.connect(self, qt4.SIGNAL("returnPressed()"), self.slotReturnPressed) self.setToolTip(_("Input a python expression here and press enter"))
def slotDialogShown(self, dialog): """Called when a dialog is opened in the main window.""" from veusz.dialogs.importdialog import ImportDialog if isinstance(dialog, ImportDialog): # make life easy by sticking in filename dialog.filenameedit.setText( os.path.join(utils.exampleDirectory, 'tutorialdata.csv')) # and choosing tab dialog.guessImportTab() # get rid of existing values self.emit(qt4.SIGNAL('nextStep'))