Пример #1
0
    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")
Пример #2
0
    def __init__(self, parent, document):
        """Initialise dialog with document."""

        VeuszDialog.__init__(self, parent, 'datacreate2d.ui')
        self.document = document

        self.createbutton = self.buttonBox.addButton(
            _("C&reate"), qt4.QDialogButtonBox.ApplyRole )
        self.connect( self.createbutton, qt4.SIGNAL('clicked()'),
                      self.createButtonClickedSlot )

        self.connect( self.fromxyfunc, qt4.SIGNAL('toggled(bool)'),
                      self.fromxyfuncSlot )
        self.connect( self.fromxyzexpr, qt4.SIGNAL('toggled(bool)'),
                      self.fromxyzexprSlot )
        self.connect( self.from2dexpr, qt4.SIGNAL('toggled(bool)'),
                      self.from2dexprSlot )

        self.connect(document, qt4.SIGNAL('sigModified'),
                     self.updateDatasetLists)

        for combo in (self.namecombo, self.xexprcombo, self.yexprcombo,
                      self.zexprcombo):
            self.connect(combo,
                         qt4.SIGNAL('editTextChanged(const QString&)'),
                         self.enableDisableCreate)

        self.fromxyzexpr.toggle()
        self.enableDisableCreate()
Пример #3
0
    def __init__(self, parent, document):
        """Initialise dialog with document."""

        VeuszDialog.__init__(self, parent, 'datacreate2d.ui')
        self.document = document

        self.createbutton = self.buttonBox.addButton(
            _("C&reate"), qt4.QDialogButtonBox.ApplyRole)
        self.connect(self.createbutton, qt4.SIGNAL('clicked()'),
                     self.createButtonClickedSlot)

        self.connect(self.fromxyfunc, qt4.SIGNAL('toggled(bool)'),
                     self.fromxyfuncSlot)
        self.connect(self.fromxyzexpr, qt4.SIGNAL('toggled(bool)'),
                     self.fromxyzexprSlot)
        self.connect(self.from2dexpr, qt4.SIGNAL('toggled(bool)'),
                     self.from2dexprSlot)

        self.connect(document, qt4.SIGNAL('sigModified'),
                     self.updateDatasetLists)

        for combo in (self.namecombo, self.xexprcombo, self.yexprcombo,
                      self.zexprcombo):
            self.connect(combo, qt4.SIGNAL('editTextChanged(const QString&)'),
                         self.enableDisableCreate)

        self.fromxyzexpr.toggle()
        self.enableDisableCreate()
Пример #4
0
    def __init__(self, parent, document):
        """Setup dialog."""
        VeuszDialog.__init__(self, parent, 'histodata.ui')
        self.document = document

        self.minval.default = self.maxval.default = ['Auto']
        regexp = qt4.QRegExp("^[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?|Auto$")
        validator = qt4.QRegExpValidator(regexp, self)
        self.minval.setValidator(validator)
        self.maxval.setValidator(validator)
        self.connect( self.buttonBox.button(qt4.QDialogButtonBox.Apply),
                      qt4.SIGNAL("clicked()"), self.applyClicked )
        self.connect( self.buttonBox.button(qt4.QDialogButtonBox.Reset),
                      qt4.SIGNAL('clicked()'), self.resetClicked )
        self.connect( self.bingenerate, qt4.SIGNAL('clicked()'),
                      self.generateManualBins )
        self.connect( self.binadd, qt4.SIGNAL('clicked()'), self.addManualBins )
        self.connect( self.binremove, qt4.SIGNAL('clicked()'),
                      self.removeManualBins )

        self.bindata = []
        self.binmodel = ManualBinModel(self.bindata)
        self.binmanuals.setModel(self.binmodel)

        self.connect(document, qt4.SIGNAL("sigModified"),
                     self.updateDatasetLists)
        self.updateDatasetLists()
Пример #5
0
    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)
Пример #6
0
    def accept(self):
        """Send text."""
        # build up the text of the message
        text = (_sendformat % (unicode(self.emailedit.text()), self.text,
                               unicode(self.detailsedit.toPlainText())))

        # send the message as base-64 encoded utf-8
        text = str(qt4.QString(text).toUtf8().toBase64())

        try:
            # send the message
            urllib2.urlopen('http://barmag.net/veusz-mail.php',
                            'message=%s' % text)

        except urllib2.URLError:
            # something went wrong...
            qt4.QMessageBox.critical(
                None, _("Veusz"),
                _("Failed to connect to error server "
                  "to send report. Is your internet "
                  "connected?"))
            return

        qt4.QMessageBox.information(
            self, _("Submitted"),
            _("Thank you for submitting an error report"))
        VeuszDialog.accept(self)
Пример #7
0
    def __init__(self, parent, document):
        """Setup dialog."""
        VeuszDialog.__init__(self, parent, 'histodata.ui')
        self.document = document

        self.minval.default = self.maxval.default = ['Auto']
        regexp = qt4.QRegExp("^[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?|Auto$")
        validator = qt4.QRegExpValidator(regexp, self)
        self.minval.setValidator(validator)
        self.maxval.setValidator(validator)
        self.connect(self.buttonBox.button(qt4.QDialogButtonBox.Apply),
                     qt4.SIGNAL("clicked()"), self.applyClicked)
        self.connect(self.buttonBox.button(qt4.QDialogButtonBox.Reset),
                     qt4.SIGNAL('clicked()'), self.resetClicked)
        self.connect(self.bingenerate, qt4.SIGNAL('clicked()'),
                     self.generateManualBins)
        self.connect(self.binadd, qt4.SIGNAL('clicked()'), self.addManualBins)
        self.connect(self.binremove, qt4.SIGNAL('clicked()'),
                     self.removeManualBins)

        self.bindata = []
        self.binmodel = ManualBinModel(self.bindata)
        self.binmanuals.setModel(self.binmodel)

        self.connect(document, qt4.SIGNAL("sigModified"),
                     self.updateDatasetLists)
        self.updateDatasetLists()
Пример #8
0
    def accept(self):
        """Send text."""
        # build up the text of the message
        text = ( _sendformat % (
                unicode(self.emailedit.text()),
                self.text,
                unicode(self.detailsedit.toPlainText())
                ))

        # send the message as base-64 encoded utf-8
        text = str( qt4.QString(text).toUtf8().toBase64() )

        try:
            # send the message
            urllib2.urlopen('http://barmag.net/veusz-mail.php',
                            'message=%s' % text)

        except urllib2.URLError:
            # something went wrong...
            qt4.QMessageBox.critical(None, _("Veusz"),
                                     _("Failed to connect to error server "
                                       "to send report. Is your internet "
                                       "connected?"))
            return

        qt4.QMessageBox.information(self, _("Submitted"),
                                    _("Thank you for submitting an error report"))
        VeuszDialog.accept(self)
Пример #9
0
    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')
Пример #10
0
    def done(self, r):
        """Dialog is closed."""
        VeuszDialog.done(self, r)

        # record values for next time dialog is opened
        d = setting.settingdb
        d['CaptureDialog_method'] = self.methodBG.checkedId()
        d['CaptureDialog_stop'] = self.stopBG.checkedId()
Пример #11
0
    def exec_(self):
        """Exec dialog if exception is not ignored."""
        if self.backtrace not in ExceptionDialog.ignore_exceptions:
            VeuszDialog.exec_(self)

        # send another exception shortly - this clears out the current one
        # so the stack frame of the current exception is released
        qt4.QTimer.singleShot(0, _raiseIgnoreException)
Пример #12
0
    def exec_(self):
        """Exec dialog if exception is not ignored."""
        if self.backtrace not in ExceptionDialog.ignore_exceptions:
            VeuszDialog.exec_(self)

        # send another exception shortly - this clears out the current one
        # so the stack frame of the current exception is released
        qt4.QTimer.singleShot(0, _raiseIgnoreException)
Пример #13
0
    def done(self, r):
        """Dialog is closed."""
        VeuszDialog.done(self, r)

        # record values for next time dialog is opened
        d = setting.settingdb
        d['CaptureDialog_method'] = self.methodBG.checkedId()
        d['CaptureDialog_stop'] = self.stopBG.checkedId()
Пример #14
0
    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)
Пример #15
0
    def __init__(self, parent):
        VeuszDialog.__init__(self, parent, 'license.ui')

        try:
            f = open(os.path.join(utils.veuszDirectory, 'COPYING'), 'rU')
            text = f.read()
        except IOError:
            text = 'Could not open the license file.'

        self.licenseEdit.setPlainText(text)
Пример #16
0
    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)
Пример #17
0
    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(updateinterval*1000)

        # start display and read timers
        self.displaytimer.start(1000)
        self.readtimer.start(10)
Пример #18
0
    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)
Пример #19
0
    def __init__(self, parent, document):
        """Initialise dialog with document."""

        VeuszDialog.__init__(self, parent, 'datacreate.ui')
        self.document = document

        # create button group to get notification of changes
        self.connect(self.methodGroup, qt4.SIGNAL('radioClicked'),
                     self.slotMethodChanged)

        # connect create button
        self.createbutton = self.buttonBox.addButton(
            _("C&reate"), qt4.QDialogButtonBox.ApplyRole)
        self.replacebutton = self.buttonBox.addButton(
            _("&Replace"), qt4.QDialogButtonBox.ApplyRole)

        self.connect(self.buttonBox.button(qt4.QDialogButtonBox.Reset),
                     qt4.SIGNAL('clicked()'), self.resetButtonClicked)

        self.connect(self.createbutton, qt4.SIGNAL('clicked()'),
                     self.createButtonClicked)
        self.connect(self.replacebutton, qt4.SIGNAL('clicked()'),
                     self.createButtonClicked)

        # connect notification of document change
        self.connect(self.document, qt4.SIGNAL("sigModified"),
                     self.modifiedDocSlot)

        # set validators for edit controls
        self.numstepsedit.setValidator(qt4.QIntValidator(1, 99999999, self))
        self.tstartedit.setValidator(qt4.QDoubleValidator(self))
        self.tendedit.setValidator(qt4.QDoubleValidator(self))
        self.tstepsedit.setValidator(qt4.QIntValidator(1, 99999999, self))

        # connect up edit control to update create button status
        for edit in (self.numstepsedit, self.tstartedit, self.tendedit,
                     self.tstepsedit, self.nameedit, self.valueedit):
            self.connect(edit, qt4.SIGNAL('editTextChanged(const QString &)'),
                         self.editsEditSlot)

        self.connect(self.nameedit, qt4.SIGNAL('currentIndexChanged(int)'),
                     self.datasetSelected)

        # edit controls for dataset
        self.dsedits = {
            'data': self.valueedit,
            'serr': self.symerroredit,
            'perr': self.poserroredit,
            'nerr': self.negerroredit
        }

        # update button state
        self.editsEditSlot('')
Пример #20
0
    def __init__(self, parent, document):
        """Initialise dialog with document."""

        VeuszDialog.__init__(self, parent, 'datacreate.ui')
        self.document = document

        # create button group to get notification of changes
        self.connect( self.methodGroup, qt4.SIGNAL('radioClicked'),
                      self.slotMethodChanged )

        # connect create button
        self.createbutton = self.buttonBox.addButton(
            "C&reate", qt4.QDialogButtonBox.ApplyRole )
        self.replacebutton = self.buttonBox.addButton(
            "&Replace", qt4.QDialogButtonBox.ApplyRole )

        self.connect( self.buttonBox.button(qt4.QDialogButtonBox.Reset),
                      qt4.SIGNAL('clicked()'), self.resetButtonClicked )

        self.connect( self.createbutton, qt4.SIGNAL('clicked()'),
                      self.createButtonClicked )
        self.connect( self.replacebutton, qt4.SIGNAL('clicked()'),
                      self.createButtonClicked )

        # connect notification of document change
        self.connect( self.document, qt4.SIGNAL("sigModified"),
                      self.modifiedDocSlot )

        # set validators for edit controls
        self.numstepsedit.setValidator( qt4.QIntValidator(1, 99999999, self) )
        self.tstartedit.setValidator( qt4.QDoubleValidator(self) )
        self.tendedit.setValidator( qt4.QDoubleValidator(self) )
        self.tstepsedit.setValidator( qt4.QIntValidator(1, 99999999, self) )

        # connect up edit control to update create button status
        for edit in (self.numstepsedit, self.tstartedit, self.tendedit,
                     self.tstepsedit, self.nameedit,
                     self.valueedit):
            self.connect( edit, qt4.SIGNAL('editTextChanged(const QString &)'),
                          self.editsEditSlot )

        self.connect( self.nameedit, qt4.SIGNAL('currentIndexChanged(int)'),
                      self.datasetSelected )

        # edit controls for dataset
        self.dsedits = { 'data': self.valueedit, 'serr': self.symerroredit,
                         'perr': self.poserroredit, 'nerr': self.negerroredit }
        
        # update button state
        self.editsEditSlot('')
Пример #21
0
    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)
Пример #22
0
    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)
Пример #23
0
    def __init__(self, parent, filename, error, traceback):
        VeuszDialog.__init__(self, parent, 'errorloading.ui')

        # insert filename into label
        text = unicode(self.errorlabel.text())
        text = text % filename
        self.errorlabel.setText(text)
        self.errormessagelabel.setText(error)

        # put backtrace into error edit box
        self.errortextedit.setPlainText(traceback)

        # set warning pixmap to left of dialog
        icon = qt4.qApp.style().standardIcon(qt4.QStyle.SP_MessageBoxWarning,
                                             None, self)
        self.iconlabel.setPixmap(icon.pixmap(32))
Пример #24
0
    def __init__(self, parent, filename, error, traceback):
        VeuszDialog.__init__(self, parent, 'errorloading.ui')

        # insert filename into label
        text = unicode(self.errorlabel.text())
        text = text % filename
        self.errorlabel.setText(text)
        self.errormessagelabel.setText(error)

        # put backtrace into error edit box
        self.errortextedit.setPlainText(traceback)

        # set warning pixmap to left of dialog
        icon = qt4.qApp.style().standardIcon(qt4.QStyle.SP_MessageBoxWarning,
                                             None, self)
        self.iconlabel.setPixmap(icon.pixmap(32))
Пример #25
0
    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)
Пример #26
0
    def __init__(self, exception, parent):

        VeuszDialog.__init__(self, parent, 'exceptionlist.ui')

        # create backtrace text from exception, and add to list
        self.backtrace = ''.join(traceback.format_exception(*exception)).strip()
        self.errortextedit.setPlainText(self.backtrace)

        # set critical pixmap to left of dialog
        icon = qt4.qApp.style().standardIcon(qt4.QStyle.SP_MessageBoxCritical,
                                             None, self)
        self.erroriconlabel.setPixmap(icon.pixmap(32))

        self.connect(self.ignoreSessionButton, qt4.SIGNAL('clicked()'),
                     self.ignoreSessionSlot)
       
        self.checkVeuszVersion()
Пример #27
0
    def __init__(self, exception, parent):

        VeuszDialog.__init__(self, parent, 'exceptionlist.ui')

        # get text for traceback and locals
        self.backtrace = (''.join(traceback.format_exception(*exception)) +
                          formatLocals(exception))

        self.errortextedit.setPlainText(self.backtrace)

        # set critical pixmap to left of dialog
        icon = qt4.qApp.style().standardIcon(qt4.QStyle.SP_MessageBoxCritical,
                                             None, self)
        self.erroriconlabel.setPixmap(icon.pixmap(32))

        self.connect(self.ignoreSessionButton, qt4.SIGNAL('clicked()'),
                     self.ignoreSessionSlot)

        self.checkVeuszVersion()
Пример #28
0
    def __init__(self, document, parent, filenames=None):
        """Initialise the dialog.

        document: veusz document
        parent: parent window
        filenames: if a set() only reload from these filenames
        """

        VeuszDialog.__init__(self, parent, 'reloaddata.ui')
        self.document = document
        self.filenames = filenames

        # update on reloading
        self.reloadct = 1

        # get a record of names, dates and sizes of files linked
        self.filestats = self.statLinkedFiles()

        # actually reload the data (and show the user)
        self.reloadData()

        # if interval changed or enabled update timer
        self.connect(self.intervalCheck, qt4.SIGNAL('clicked()'),
                     self.intervalUpdate)
        self.connect(self.intervalTime, qt4.SIGNAL('valueChanged(int)'),
                     self.intervalUpdate)

        # timer to reload data
        self.intervalTimer = qt4.QTimer()
        self.connect(self.intervalTimer, qt4.SIGNAL('timeout()'),
                     self.reloadIfChanged)

        # manual reload
        self.reloadbutton = self.buttonBox.addButton(
            "&Reload again", qt4.QDialogButtonBox.ApplyRole)
        self.connect(self.reloadbutton, qt4.SIGNAL('clicked()'),
                     self.reloadData)

        # close by default, not reload
        self.buttonBox.button(qt4.QDialogButtonBox.Close).setDefault(True)
Пример #29
0
    def __init__(self, document, parent, filenames=None):
        """Initialise the dialog.

        document: veusz document
        parent: parent window
        filenames: if a set() only reload from these filenames
        """

        VeuszDialog.__init__(self, parent, 'reloaddata.ui')
        self.document = document
        self.filenames = filenames

        # update on reloading
        self.reloadct = 1

        # get a record of names, dates and sizes of files linked
        self.filestats = self.statLinkedFiles()

        # actually reload the data (and show the user)
        self.reloadData()

        # if interval changed or enabled update timer
        self.connect(self.intervalCheck, qt4.SIGNAL('clicked()'),
                     self.intervalUpdate)
        self.connect(self.intervalTime, qt4.SIGNAL('valueChanged(int)'),
                     self.intervalUpdate)

        # timer to reload data
        self.intervalTimer = qt4.QTimer()
        self.connect(self.intervalTimer, qt4.SIGNAL('timeout()'),
                     self.reloadIfChanged)

        # manual reload
        self.reloadbutton = self.buttonBox.addButton(
            "&Reload again", qt4.QDialogButtonBox.ApplyRole)
        self.connect(self.reloadbutton, qt4.SIGNAL('clicked()'),
                     self.reloadData)

        # close by default, not reload
        self.buttonBox.button(qt4.QDialogButtonBox.Close).setDefault(True)
Пример #30
0
    def __init__(self, parent, document):
        VeuszDialog.__init__(self, parent, 'custom.ui')
        self.document = document

        self.model = CustomItemModel(self, document)
        self.definitionView.setModel(self.model)

        self.combodeligate = ComboTypeDeligate(self)
        self.definitionView.setItemDelegateForColumn(0, self.combodeligate)

        # connect buttons to slots
        self.connect(self.addButton, qt4.SIGNAL('clicked()'), self.slotAdd)
        self.connect(self.removeButton, qt4.SIGNAL('clicked()'),
                     self.slotRemove)
        self.connect(self.upButton, qt4.SIGNAL('clicked()'), self.slotUp)
        self.connect(self.downButton, qt4.SIGNAL('clicked()'), self.slotDown)

        self.connect(self.saveButton, qt4.SIGNAL('clicked()'), self.slotSave)
        self.connect(self.loadButton, qt4.SIGNAL('clicked()'), self.slotLoad)

        # recent button shows list of recently used files for loading
        self.connect(self.recentButton, qt4.SIGNAL('filechosen'),
                     self.loadFile)
        self.recentButton.setSetting('customdialog_recent')
Пример #31
0
    def __init__(self, parent, document):
        VeuszDialog.__init__(self, parent, 'custom.ui')
        self.document = document

        self.model = CustomItemModel(self, document)
        self.definitionView.setModel(self.model)

        self.combodeligate = ComboTypeDeligate(self)
        self.definitionView.setItemDelegateForColumn(0, self.combodeligate)

        # connect buttons to slots
        self.connect(self.addButton, qt4.SIGNAL('clicked()'), self.slotAdd)
        self.connect(self.removeButton, qt4.SIGNAL('clicked()'),
                     self.slotRemove)
        self.connect(self.upButton, qt4.SIGNAL('clicked()'), self.slotUp)
        self.connect(self.downButton, qt4.SIGNAL('clicked()'), self.slotDown)

        self.connect(self.saveButton, qt4.SIGNAL('clicked()'), self.slotSave)
        self.connect(self.loadButton, qt4.SIGNAL('clicked()'), self.slotLoad)

        # recent button shows list of recently used files for loading
        self.connect(self.recentButton, qt4.SIGNAL('filechosen'),
                     self.loadFile)
        self.recentButton.setSetting('customdialog_recent')
Пример #32
0
    def __init__(self, mainwindow, doc, plugininst, pluginkls):
        VeuszDialog.__init__(self, mainwindow, 'plugin.ui')

        reset = self.buttonBox.button(qt4.QDialogButtonBox.Reset)
        reset.setAutoDefault(False)
        reset.setDefault(False)
        self.connect(reset, qt4.SIGNAL('clicked()'), self.slotReset)
        self.connect(self.buttonBox.button(qt4.QDialogButtonBox.Apply),
                     qt4.SIGNAL('clicked()'), self.slotApply)

        self.pluginkls = pluginkls
        self.plugininst = plugininst
        self.document = doc

        title = ': '.join(list(plugininst.menu))
        self.setWindowTitle(title)
        descr = plugininst.description_full
        if plugininst.author:
            descr += '\n ' + _('Author: %s') % plugininst.author
        self.descriptionLabel.setText(wordwrap(descr))

        self.fieldcntrls = []
        self.fields = []
        self.addFields()
Пример #33
0
    def __init__(self, mainwindow, doc, plugininst, pluginkls):
        VeuszDialog.__init__(self, mainwindow, 'plugin.ui')

        reset = self.buttonBox.button(qt4.QDialogButtonBox.Reset)
        reset.setAutoDefault(False)
        reset.setDefault(False)
        self.connect(reset, qt4.SIGNAL('clicked()'), self.slotReset)
        self.connect( self.buttonBox.button(qt4.QDialogButtonBox.Apply),
                      qt4.SIGNAL('clicked()'), self.slotApply )

        self.pluginkls = pluginkls
        self.plugininst = plugininst
        self.document = doc

        title = ': '.join(list(plugininst.menu))
        self.setWindowTitle(title)
        descr = plugininst.description_full
        if plugininst.author:
            descr += '\n ' + _('Author: %s') % plugininst.author
        self.descriptionLabel.setText( wordwrap(descr) )

        self.fieldcntrls = []
        self.fields = []
        self.addFields()
Пример #34
0
 def __init__(self, parent):
     VeuszDialog.__init__(self, parent, 'license.ui')
     self.licenseEdit.setPlainText(utils.getLicense())
Пример #35
0
    def __init__(self, document, mainwindow):
        VeuszDialog.__init__(self, mainwindow, 'capture.ui')
        self.document = document

        # set values of edit controls from previous invocation (if any)
        d = setting.settingdb

        # Validate edit controls
        validator = qt4.QIntValidator(1, 65535, self)
        self.portEdit.setValidator(validator)
        validator = qt4.QIntValidator(1, 1000000000, self)
        self.numLinesStopEdit.setValidator(validator)
        self.timeStopEdit.setValidator(validator)
        self.updateIntervalsEdit.setValidator(validator)
        self.tailEdit.setValidator(validator)

        # add completion for filename if there is support in version of qt
        # (requires qt >= 4.3)
        if hasattr(qt4, 'QDirModel'):
            c = self.filenamecompleter = qt4.QCompleter(self)
            model = qt4.QDirModel(c)
            c.setModel(model)
            self.filenameEdit.setCompleter(c)

        # get notification of change of capture method
        self.methodBG = qt4.QButtonGroup(self)
        self.methodBG.addButton( self.captureFileButton, 0 )
        self.methodBG.addButton( self.captureInternetButton, 1 )
        self.methodBG.addButton( self.captureProgramButton, 2 )
        self.connect(self.methodBG, qt4.SIGNAL('buttonClicked(int)'),
                     self.slotMethodChanged)
        # restore previously clicked button
        self.methodBG.button( d.get('CaptureDialog_method', 0) ).click()

        # get notification of change of stop method
        self.stopBG = qt4.QButtonGroup(self)
        self.stopBG.addButton( self.clickingStopButton, 0 )
        self.stopBG.addButton( self.numLinesStopButton, 1 )
        self.stopBG.addButton( self.timeStopButton, 2 )
        self.connect(self.stopBG, qt4.SIGNAL('buttonClicked(int)'),
                     self.slotStopChanged)
        self.stopBG.button( d.get('CaptureDialog_stop', 0) ).click()

        # update interval
        self.connect(self.updateIntervalsCheck,
                     qt4.SIGNAL('toggled(bool)'),
                     self.updateIntervalsEdit.setEnabled)

        # tail data
        self.connect(self.tailCheck, qt4.SIGNAL('toggled(bool)'),
                     self.tailEdit.setEnabled)

        # user starts capture
        self.captureButton = self.buttonBox.addButton(
            "Ca&pture", qt4.QDialogButtonBox.ApplyRole )
        self.connect(self.captureButton, qt4.SIGNAL('clicked()'),
                     self.slotCaptureClicked)

        # filename browse button clicked
        self.connect(self.browseButton, qt4.SIGNAL('clicked()'),
                     self.slotBrowseClicked)
Пример #36
0
    def __init__(self, mainwindow):
        """Setup dialog."""
        VeuszDialog.__init__(self, mainwindow, "preferences.ui")

        self.plotwindow = mainwindow.plot

        # for ease of use
        setdb = setting.settingdb

        # view settings
        self.antialiasCheck.setChecked(setdb["plot_antialias"])
        self.englishCheck.setChecked(setdb["ui_english"])
        for intv in self.plotwindow.updateintervals:
            self.intervalCombo.addItem(intv[1])
        index = [i[0] for i in self.plotwindow.updateintervals].index(setdb["plot_updatepolicy"])
        self.intervalCombo.setCurrentIndex(index)
        self.threadSpinBox.setValue(setdb["plot_numthreads"])

        # disable thread option if not supported
        if not qt4.QFontDatabase.supportsThreadedFontRendering():
            self.threadSpinBox.setEnabled(False)
            self.threadSpinBox.setToolTip("Disabled because of lack of " "threaded drawing support")

        # use cwd for file dialogs
        self.cwdCheck.setChecked(setdb["dirname_usecwd"])

        # set icon size
        self.iconSizeCombo.setCurrentIndex(self.iconSizeCombo.findText(str(setdb["toolbar_size"])))

        # set export dpi
        dpis = ("75", "90", "100", "150", "200", "300")
        self.exportDPI.addItems(dpis)
        self.exportDPIPDF.addItems(dpis)

        self.exportDPI.setValidator(qt4.QIntValidator(10, 10000, self))
        self.exportDPI.setEditText(str(setdb["export_DPI"]))
        self.exportDPIPDF.setValidator(qt4.QIntValidator(10, 10000, self))
        self.exportDPIPDF.setEditText(str(setdb["export_DPI_PDF"]))

        # set export antialias
        self.exportAntialias.setChecked(setdb["export_antialias"])

        # quality of jpeg export
        self.exportQuality.setValue(setdb["export_quality"])

        # changing background color of bitmaps
        self.connect(self.exportBackgroundButton, qt4.SIGNAL("clicked()"), self.slotExportBackgroundChanged)
        self.updateExportBackground(setdb["export_background"])

        # set color setting
        self.exportColor.setCurrentIndex({True: 0, False: 1}[setdb["export_color"]])

        # default stylesheet
        self.styleLineEdit.setText(setdb["stylesheet_default"])
        self.connect(self.styleBrowseButton, qt4.SIGNAL("clicked()"), self.styleBrowseClicked)

        # default custom settings
        self.customLineEdit.setText(setdb["custom_default"])
        self.connect(self.customBrowseButton, qt4.SIGNAL("clicked()"), self.customBrowseClicked)

        # for plugins
        plugins = list(setdb.get("plugins", []))
        self.pluginmodel = qt4.QStringListModel(plugins)
        self.pluginList.setModel(self.pluginmodel)
        self.connect(self.pluginAddButton, qt4.SIGNAL("clicked()"), self.pluginAddClicked)
        self.connect(self.pluginRemoveButton, qt4.SIGNAL("clicked()"), self.pluginRemoveClicked)

        # specifics for color tab
        self.setupColorTab()
Пример #37
0
    def __init__(self, parent, document):

        VeuszDialog.__init__(self, parent, 'import.ui')
        self.document = document

        # whether file import looks likely to work
        self.filepreviewokay = False

        # tabs loaded currently in dialog
        self.tabs = {}
        for tabname, tabclass in (
            (_('&Standard'), ImportTabStandard),
            (_('CS&V'), ImportTabCSV),
            (_('FI&TS'), ImportTabFITS),
            (_('&2D'), ImportTab2D),
            (_('Plugins'), ImportTabPlugins),
            ):
            w = tabclass(self)
            self.methodtab.addTab(w, tabname)

        # add promoted plugins
        for p in plugins.importpluginregistry:
            if p.promote_tab is not None:
                w = ImportTabPlugins(self, promote=p.name)
                self.methodtab.addTab(w, p.promote_tab)

        self.connect( self.methodtab, qt4.SIGNAL('currentChanged(int)'),
                      self.slotUpdatePreview )

        self.connect(self.browsebutton, qt4.SIGNAL('clicked()'),
                     self.slotBrowseClicked)

        self.connect( self.filenameedit,
                      qt4.SIGNAL('editTextChanged(const QString&)'),
                      self.slotUpdatePreview )

        self.importbutton = self.buttonBox.addButton(_("&Import"),
                                                     qt4.QDialogButtonBox.ApplyRole)
        self.connect( self.importbutton, qt4.SIGNAL('clicked()'),
                      self.slotImport)

        self.connect( self.buttonBox.button(qt4.QDialogButtonBox.Reset),
                      qt4.SIGNAL('clicked()'), self.slotReset )

        self.connect( self.encodingcombo,
                      qt4.SIGNAL('currentIndexChanged(int)'),
                      self.slotUpdatePreview )

        # change to tab last used
        self.methodtab.setCurrentIndex(
            setting.settingdb.get('import_lasttab', 0))

        # add completion for filename if there is support in version of qt
        # (requires qt >= 4.3)
        if hasattr(qt4, 'QDirModel'):
            c = self.filenamecompleter = qt4.QCompleter(self)
            model = qt4.QDirModel(c)
            c.setModel(model)
            self.filenameedit.setCompleter(c)

        # defaults for prefix and suffix
        self.prefixcombo.default = self.suffixcombo.default = ['', '$FILENAME']

        # default state for check boxes
        self.linkcheckbox.default = True

        # further defaults
        self.encodingcombo.defaultlist = utils.encodings
        self.encodingcombo.defaultval = 'utf_8'

        # load icon for clipboard
        self.clipbutton.setIcon( utils.getIcon('kde-clipboard') )
        self.connect(qt4.QApplication.clipboard(), qt4.SIGNAL('dataChanged()'),
                     self.updateClipPreview)
        self.connect(
            self.clipbutton, qt4.SIGNAL("clicked()"), self.slotClipButtonClicked)
        self.updateClipPreview()
Пример #38
0
    def __init__(self, document, mainwindow):
        VeuszDialog.__init__(self, mainwindow, 'capture.ui')
        self.document = document

        # set values of edit controls from previous invocation (if any)
        d = setting.settingdb

        # Validate edit controls
        validator = qt4.QIntValidator(1, 65535, self)
        self.portEdit.setValidator(validator)
        validator = qt4.QIntValidator(1, 1000000000, self)
        self.numLinesStopEdit.setValidator(validator)
        self.timeStopEdit.setValidator(validator)
        self.tailEdit.setValidator(validator)

        # floating point values for interval
        self.updateIntervalsEdit.setValidator(
            qt4.QDoubleValidator(1e-2, 10000000, 2, self))

        # add completion for filename if there is support in version of qt
        # (requires qt >= 4.3)
        if hasattr(qt4, 'QDirModel'):
            c = self.filenamecompleter = qt4.QCompleter(self)
            model = qt4.QDirModel(c)
            c.setModel(model)
            self.filenameEdit.setCompleter(c)

        # get notification of change of capture method
        self.methodBG = qt4.QButtonGroup(self)
        self.methodBG.addButton( self.captureFileButton, 0 )
        self.methodBG.addButton( self.captureInternetButton, 1 )
        self.methodBG.addButton( self.captureProgramButton, 2 )
        self.connect(self.methodBG, qt4.SIGNAL('buttonClicked(int)'),
                     self.slotMethodChanged)
        # restore previously clicked button
        self.methodBG.button( d.get('CaptureDialog_method', 0) ).click()

        # get notification of change of stop method
        self.stopBG = qt4.QButtonGroup(self)
        self.stopBG.addButton( self.clickingStopButton, 0 )
        self.stopBG.addButton( self.numLinesStopButton, 1 )
        self.stopBG.addButton( self.timeStopButton, 2 )
        self.connect(self.stopBG, qt4.SIGNAL('buttonClicked(int)'),
                     self.slotStopChanged)
        self.stopBG.button( d.get('CaptureDialog_stop', 0) ).click()

        # update interval
        self.connect(self.updateIntervalsCheck,
                     qt4.SIGNAL('toggled(bool)'),
                     self.updateIntervalsEdit.setEnabled)

        # tail data
        self.connect(self.tailCheck, qt4.SIGNAL('toggled(bool)'),
                     self.tailEdit.setEnabled)

        # user starts capture
        self.captureButton = self.buttonBox.addButton(
            _("Ca&pture"), qt4.QDialogButtonBox.ApplyRole )
        self.connect(self.captureButton, qt4.SIGNAL('clicked()'),
                     self.slotCaptureClicked)

        # filename browse button clicked
        self.connect(self.browseButton, qt4.SIGNAL('clicked()'),
                     self.slotBrowseClicked)
Пример #39
0
 def slotHelp(self):
     """Asked for help."""
     d = VeuszDialog(self.dialog.mainwindow, 'importhelpcsv.ui')
     self.dialog.mainwindow.showDialog(d)
Пример #40
0
 def __init__(self, parent):
     VeuszDialog.__init__(self, parent, 'license.ui')
     self.licenseEdit.setPlainText(utils.getLicense())
Пример #41
0
 def accept(self):
     """Accept by opening send dialog."""
     d = ExceptionSendDialog(self.backtrace, self)
     if d.exec_() == qt4.QDialog.Accepted:
         VeuszDialog.accept(self)
Пример #42
0
    def __init__(self, parent, document):

        VeuszDialog.__init__(self, parent, 'import.ui')
        self.document = document

        # whether file import looks likely to work
        self.filepreviewokay = False

        # tabs loaded currently in dialog
        self.tabs = {}
        for tabname, tabclass in (
            (_('&Standard'), ImportTabStandard),
            (_('CS&V'), ImportTabCSV),
            (_('FI&TS'), ImportTabFITS),
            (_('&2D'), ImportTab2D),
            (_('Plugins'), ImportTabPlugins),
        ):
            w = tabclass(self)
            self.methodtab.addTab(w, tabname)

        # add promoted plugins
        for p in plugins.importpluginregistry:
            if p.promote_tab is not None:
                w = ImportTabPlugins(self, promote=p.name)
                self.methodtab.addTab(w, p.promote_tab)

        self.connect(self.methodtab, qt4.SIGNAL('currentChanged(int)'),
                     self.slotUpdatePreview)

        self.connect(self.browsebutton, qt4.SIGNAL('clicked()'),
                     self.slotBrowseClicked)

        self.connect(self.filenameedit,
                     qt4.SIGNAL('editTextChanged(const QString&)'),
                     self.slotUpdatePreview)

        self.importbutton = self.buttonBox.addButton(
            _("&Import"), qt4.QDialogButtonBox.ApplyRole)
        self.connect(self.importbutton, qt4.SIGNAL('clicked()'),
                     self.slotImport)

        self.connect(self.buttonBox.button(qt4.QDialogButtonBox.Reset),
                     qt4.SIGNAL('clicked()'), self.slotReset)

        self.connect(self.encodingcombo,
                     qt4.SIGNAL('currentIndexChanged(int)'),
                     self.slotUpdatePreview)

        # change to tab last used
        self.methodtab.setCurrentIndex(
            setting.settingdb.get('import_lasttab', 0))

        # add completion for filename if there is support in version of qt
        # (requires qt >= 4.3)
        if hasattr(qt4, 'QDirModel'):
            c = self.filenamecompleter = qt4.QCompleter(self)
            model = qt4.QDirModel(c)
            c.setModel(model)
            self.filenameedit.setCompleter(c)

        # defaults for prefix and suffix
        self.prefixcombo.default = self.suffixcombo.default = ['', '$FILENAME']

        # default state for check boxes
        self.linkcheckbox.default = True

        # further defaults
        self.encodingcombo.defaultlist = utils.encodings
        self.encodingcombo.defaultval = 'utf_8'

        # load icon for clipboard
        self.clipbutton.setIcon(utils.getIcon('kde-clipboard'))
        self.connect(qt4.QApplication.clipboard(), qt4.SIGNAL('dataChanged()'),
                     self.updateClipPreview)
        self.connect(self.clipbutton, qt4.SIGNAL("clicked()"),
                     self.slotClipButtonClicked)
        self.updateClipPreview()
Пример #43
0
 def accept(self):
     """Accept by opening send dialog."""
     d = ExceptionSendDialog(self.backtrace, self)
     if d.exec_() == qt4.QDialog.Accepted:
         VeuszDialog.accept(self)
Пример #44
0
    def __init__(self, mainwindow):
        """Setup dialog."""
        VeuszDialog.__init__(self, mainwindow, 'preferences.ui', modal=True)

        self.plotwindow = mainwindow.plot

        # for ease of use
        setdb = setting.settingdb

        # view settings
        self.antialiasCheck.setChecked( setdb['plot_antialias'] )
        self.englishCheck.setChecked( setdb['ui_english'] )
        for intv in self.plotwindow.updateintervals:
            self.intervalCombo.addItem(intv[1])
        index = [i[0] for i in self.plotwindow.updateintervals].index(
            setdb['plot_updatepolicy'])
        self.intervalCombo.setCurrentIndex(index)
        self.threadSpinBox.setValue( setdb['plot_numthreads'] )

        # disable thread option if not supported
        if not qt4.QFontDatabase.supportsThreadedFontRendering():
            self.threadSpinBox.setEnabled(False)
            self.threadSpinBox.setToolTip(_("Disabled because of lack of "
                                            "threaded drawing support"))

        # use cwd for file dialogs
        self.cwdCheck.setChecked( setdb['dirname_usecwd'] )

        # set icon size
        self.iconSizeCombo.setCurrentIndex(
            self.iconSizeCombo.findText(
                str(setdb['toolbar_size'])))

        # set export dpi
        dpis = ('75', '90', '100', '150', '200', '300')
        self.exportDPI.addItems(dpis)
        self.exportDPIPDF.addItems(dpis)

        self.exportDPI.setValidator( qt4.QIntValidator(10, 10000, self) )
        self.exportDPI.setEditText( str(setdb['export_DPI']) )
        self.exportDPIPDF.setValidator( qt4.QIntValidator(10, 10000, self) )
        self.exportDPIPDF.setEditText( str(setdb['export_DPI_PDF']) )
        self.exportSVGTextAsText.setChecked( setdb['export_SVG_text_as_text'] )

        # set export antialias
        self.exportAntialias.setChecked( setdb['export_antialias'])

        # quality of jpeg export
        self.exportQuality.setValue( setdb['export_quality'] )

        # changing background color of bitmaps
        self.connect( self.exportBackgroundButton, qt4.SIGNAL('clicked()'),
                      self.slotExportBackgroundChanged )
        self.updateExportBackground(setdb['export_background'])

        # set color setting
        self.exportColor.setCurrentIndex(
            {True:0, False:1}[setdb['export_color']])

        # default stylesheet
        self.styleLineEdit.setText(setdb['stylesheet_default'])
        self.connect( self.styleBrowseButton, qt4.SIGNAL('clicked()'),
                      self.styleBrowseClicked )

        # default custom settings
        self.customLineEdit.setText(setdb['custom_default'])
        self.connect( self.customBrowseButton, qt4.SIGNAL('clicked()'),
                      self.customBrowseClicked )

        # for plugins
        plugins = list( setdb.get('plugins', []) )
        self.pluginmodel = qt4.QStringListModel(plugins)
        self.pluginList.setModel(self.pluginmodel)
        self.connect( self.pluginAddButton, qt4.SIGNAL('clicked()'),
                      self.pluginAddClicked )
        self.connect( self.pluginRemoveButton, qt4.SIGNAL('clicked()'),
                      self.pluginRemoveClicked )

        # specifics for color tab
        self.setupColorTab()

        # for point picker
        self.pickerToConsoleCheck.setChecked( setdb['picker_to_console'] )
        self.pickerToClipboardCheck.setChecked( setdb['picker_to_clipboard'] )
Пример #45
0
    def __init__(self, mainwindow):
        """Setup dialog."""
        VeuszDialog.__init__(self, mainwindow, 'preferences.ui', modal=True)

        self.plotwindow = mainwindow.plot

        # for ease of use
        setdb = setting.settingdb

        # view settings
        self.antialiasCheck.setChecked(setdb['plot_antialias'])
        self.englishCheck.setChecked(setdb['ui_english'])
        for intv in self.plotwindow.updateintervals:
            self.intervalCombo.addItem(intv[1])
        index = [i[0] for i in self.plotwindow.updateintervals
                 ].index(setdb['plot_updatepolicy'])
        self.intervalCombo.setCurrentIndex(index)
        self.threadSpinBox.setValue(setdb['plot_numthreads'])

        # disable thread option if not supported
        if not qt4.QFontDatabase.supportsThreadedFontRendering():
            self.threadSpinBox.setEnabled(False)
            self.threadSpinBox.setToolTip(
                _("Disabled because of lack of "
                  "threaded drawing support"))

        # use cwd for file dialogs
        self.cwdCheck.setChecked(setdb['dirname_usecwd'])

        # set icon size
        self.iconSizeCombo.setCurrentIndex(
            self.iconSizeCombo.findText(str(setdb['toolbar_size'])))

        # set export dpi
        dpis = ('75', '90', '100', '150', '200', '300')
        self.exportDPI.addItems(dpis)
        self.exportDPIPDF.addItems(dpis)

        self.exportDPI.setValidator(qt4.QIntValidator(10, 10000, self))
        self.exportDPI.setEditText(str(setdb['export_DPI']))
        self.exportDPIPDF.setValidator(qt4.QIntValidator(10, 10000, self))
        self.exportDPIPDF.setEditText(str(setdb['export_DPI_PDF']))
        self.exportSVGTextAsText.setChecked(setdb['export_SVG_text_as_text'])

        # set export antialias
        self.exportAntialias.setChecked(setdb['export_antialias'])

        # quality of jpeg export
        self.exportQuality.setValue(setdb['export_quality'])

        # changing background color of bitmaps
        self.connect(self.exportBackgroundButton, qt4.SIGNAL('clicked()'),
                     self.slotExportBackgroundChanged)
        self.updateExportBackground(setdb['export_background'])

        # set color setting
        self.exportColor.setCurrentIndex({
            True: 0,
            False: 1
        }[setdb['export_color']])

        # default stylesheet
        self.styleLineEdit.setText(setdb['stylesheet_default'])
        self.connect(self.styleBrowseButton, qt4.SIGNAL('clicked()'),
                     self.styleBrowseClicked)

        # default custom settings
        self.customLineEdit.setText(setdb['custom_default'])
        self.connect(self.customBrowseButton, qt4.SIGNAL('clicked()'),
                     self.customBrowseClicked)

        # for plugins
        plugins = list(setdb.get('plugins', []))
        self.pluginmodel = qt4.QStringListModel(plugins)
        self.pluginList.setModel(self.pluginmodel)
        self.connect(self.pluginAddButton, qt4.SIGNAL('clicked()'),
                     self.pluginAddClicked)
        self.connect(self.pluginRemoveButton, qt4.SIGNAL('clicked()'),
                     self.pluginRemoveClicked)

        # specifics for color tab
        self.setupColorTab()