示例#1
0
    def __init__(self, gui):
        #TODO: make pyqtgraph optics(colortheme...) directly changeable - not just
        #      at reload
        QtGui.QWidget.__init__(self)
        self.gui = gui
        session = gui.app.session
        #CONNECT SAVE/RESTORE:
        session.sigSave.connect(self._save)
        session.sigRestore.connect(self._restore)
        #LAYOUT:
        layout = QtGui.QVBoxLayout()
        layout.setAlignment(QtCore.Qt.AlignTop)
        self.setLayout(layout)

        hlayout = QtGui.QHBoxLayout()
        layout.addLayout(hlayout)
        self.label_colorTheme = QtGui.QLabel('Color theme')
        hlayout.addWidget(self.label_colorTheme)

        self.combo_colorTheme = QtGui.QComboBox()
        hlayout.addWidget(self.combo_colorTheme)
        self.combo_colorTheme.addItems(('dark', 'bright'))
        self.combo_colorTheme.currentIndexChanged.connect(
            lambda i, self=self: self.setColorTheme(self.combo_colorTheme.
                                                    currentText()))

        self.check_antialiasting = QtGui.QCheckBox('Antialiasting')
        layout.addWidget(self.check_antialiasting)
        self.check_antialiasting.stateChanged.connect(self._setAntialiasting)

        combo_profile = ChooseProfile(session)
        layout.addWidget(combo_profile)
示例#2
0
    def __init__(self):
        QtGui.QWidget.__init__(self)  
        
        l = QtGui.QVBoxLayout()
        self.setLayout(l)
        
        title = QtGui.QLabel('<b>Undo / Redo</b>')
        
        self.activate = QtGui.QCheckBox('Activate')
        self.activate.setChecked(True)
        
        self.activate.stateChanged.connect(self._enableLenHistory)

        self._label_lenHist = QtGui.QLabel('History Length')
        self.lenHistory = QtGui.QSpinBox()
        self.lenHistory.setRange(1, 100)
        self.lenHistory.setValue(5)
        
        l_history = QtGui.QHBoxLayout()
        l_history.addWidget(self._label_lenHist)
        l_history.addWidget(self.lenHistory)
        
        l.addWidget(title)
        l.addWidget(self.activate)
        l.addLayout(l_history)
示例#3
0
 def __init__(self, display):
     QtGui.QWidget.__init__(self)
     l = QtGui.QVBoxLayout()
     self.setLayout(l)
     #PAREMETERTREE
     pref = ParameterTree(display.p, showHeader=False)
     h = pref.header()
     h.setResizeMode(0, QtGui.QHeaderView.Stretch)
     h.setStretchLastSection(False)
     #TITLE
     l.addWidget(QtGui.QLabel('<b>Preferences</b'))
     l.addWidget(pref)
示例#4
0
    def __init__(self, layerlabel, shape1, shape2):
        QtGui.QDialog.__init__(self)

        labTxt = QtGui.QLabel(
            '''the latest layer %s has a different shape than the other layers:
        %s != %s
        How would you like to proceed?''' % (layerlabel, shape1, shape2))
        btnR = QtGui.QPushButton("Resize")
        btnR.clicked.connect(
            lambda: [self.__setattr__('opt', self.optResize),
                     self.close()])
        btnR.setToolTip(
            'Resize the new image to fit the shape of the existent ones.')
        btnC = QtGui.QPushButton("Cut")
        btnC.clicked.connect(
            lambda: [self.__setattr__('opt', self.optCut),
                     self.close()])
        btnC.setToolTip(
            'Cut the new image to fit the shape of the existent ones.')

        btnW = QtGui.QPushButton("Warp")
        btnW.clicked.connect(
            lambda: [self.__setattr__('opt', self.optWarp),
                     self.close()])
        btnW.setToolTip(
            '''To a perspective transformation fo fit the last image 
        with the new one using pattern recognition''')

        btnN = QtGui.QPushButton("New display")
        btnN.clicked.connect(
            lambda:
            [self.__setattr__('opt', self.optNewDisplay),
             self.close()])
        btnN.setToolTip('Put the new image in a new display.')

        lv = QtGui.QVBoxLayout()
        lh = QtGui.QHBoxLayout()

        lv.addWidget(labTxt)
        lv.addLayout(lh)

        lh.addWidget(btnR)
        lh.addWidget(btnC)
        lh.addWidget(btnW)
        lh.addWidget(btnN)

        self.setLayout(lv)
示例#5
0
    def __init__(self, gui):
        QtGui.QWidget.__init__(self)
        self.gui = gui
        #CONNECT SAVE/RESTORE:
        gui.app.session.sigSave.connect(self._save)
        gui.app.session.sigRestore.connect(self._restore)
        #LAYOUT:
        layout = QtGui.QVBoxLayout()
        layout.setAlignment(QtCore.Qt.AlignTop)
        self.setLayout(layout)

        hlayout = QtGui.QHBoxLayout()
        layout.addLayout(hlayout)
        self.label_multifiles = QtGui.QLabel('Import files')
        hlayout.addWidget(self.label_multifiles)

        self.combo_import = QtGui.QComboBox()
        hlayout.addWidget(self.combo_import)

        #         self.combo_import.addItems(( 'separated',
        #                                      'together',
        #                                      'in current display',
        #                                      'in import display'))
        self.combo_import.addItems(
            ('SPLIT into MULTIPLE displays', 'ALL in NEW display',
             'ALL in CURRENT display', 'ALL in IMPORT display'))

        self.combo_import.setCurrentIndex(self.importFilesPolicy)
        self.combo_import.currentIndexChanged.connect(self._importChanged)

        self.btn_loadFiles = QtGui.QCheckBox('load files')
        self.btn_loadFiles.setChecked(True)
        self.btn_loadFiles.toggled.connect(
            lambda checked, self=self: self.__setattr__(
                'loadImportedFiles', checked))
        layout.addWidget(self.btn_loadFiles)

        self.btn_ask = QtGui.QCheckBox('Show import dialog')
        self.btn_ask.setChecked(self.showImportDialog)
        self.btn_ask.toggled.connect(lambda checked, self=self: self.
                                     __setattr__('showImportDialog', checked))
        layout.addWidget(self.btn_ask)
示例#6
0
    def __init__(self, import_pref, fnames):
        QtGui.QDialog.__init__(self)

        l = QtGui.QVBoxLayout()
        self.setLayout(l)

        p = self.pref = import_pref
        self.dial_pref = p.__class__(p.gui)
        p.updateSettings(self.dial_pref)

        l.addWidget(self.dial_pref)
        if len(fnames) > 1:
            self.setWindowTitle('Import %s File(s)' % len(fnames))
        else:
            self.setWindowTitle('Import File')

        self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)

        self.btn_done = QtGui.QPushButton('Done')
        self.btn_done.clicked.connect(self.accept)
        l.addWidget(self.btn_done)
示例#7
0
    def start(self, filenames):
        self.filenames = filenames

        if self.preferences and self.forceSetup and self._firstTime:
            d = QtGui.QDialog()
            d.setWindowTitle('Import preferences')

            l = QtGui.QVBoxLayout()
            t = ParameterTree(self.preferences)
            b = QtGui.QPushButton('OK')
            b.clicked.connect(d.accept)

            l.addWidget(t)
            l.addWidget(b)

            d.setLayout(l)

            d.accepted.connect(self._start)
            d.exec_()
        else:
            self._start()
示例#8
0
    def __init__(self, gui):
        QtGui.QWidget.__init__(self)

        self.gui = gui

        rab = self.rabbitMQServer = RabbitMQServer(gui)
        self._wf = wf = WatchFolder(gui)

        s = gui.app.session
        #CONNECT SAVE/RESTORE:
        s.sigSave.connect(self._save)
        s.sigRestore.connect(self._restore)
        #CONNECT CLOSE
        gui.app.lastWindowClosed.connect(rab.stop)

        #LAYOUT:
        layout = QtGui.QVBoxLayout()
        layout.setAlignment(QtCore.Qt.AlignTop)
        self.setLayout(layout)

        #WATCH FOLDER
        #############
        self.cb_watchFolder = QtGui.QCheckBox('Watch folder')
        self.cb_watchFolder.toggled.connect(self._watchFolderChanged)
        layout.addWidget(self.cb_watchFolder)

        self._folder_opts = QtGui.QWidget()
        layout.addWidget(self._folder_opts)
        gl = QtGui.QGridLayout()
        self._folder_opts.setLayout(gl)
        self._folder_opts.hide()

        self._wf_folderEdit = QtGui.QLineEdit('-')
        self._wf_folderEdit.setReadOnly(True)
        gl.addWidget(self._wf_folderEdit, 0, 0)
        btn = QtGui.QPushButton('Change')
        btn.clicked.connect(self._wf_folderChanged)
        gl.addWidget(btn, 0, 1)

        self._cb_filesOnly = QtGui.QCheckBox('Files only')
        self._cb_filesOnly.setChecked(wf.opts['files only'])
        self.cb_watchFolder.toggled.connect(
            lambda val: wf.opts.__setitem__('files only', val))
        gl.addWidget(self._cb_filesOnly, 1, 0)

        gl.addWidget(QtGui.QLabel('refreshrate [msec]'), 2, 0)
        self._wf_refRate = QtGui.QSpinBox()
        self._wf_refRate.setRange(1, 100000)
        self._wf_refRate.setValue(wf.opts['refreshrate'])
        self._wf_refRate.valueChanged.connect(self._wf_refRateChanged)
        gl.addWidget(self._wf_refRate, 2, 1)

        #RABBIT MQ
        ##########
        hlayout = QtGui.QHBoxLayout()
        layout.addLayout(hlayout)

        self.cb_allowRabbit = QtGui.QCheckBox(
            'Allow inter-process communication\nusing the RabbitMQ server')
        self.cb_allowRabbit.toggled.connect(self._allowRabbitMQchanged)
        hlayout.addWidget(self.cb_allowRabbit)

        self.cb_confirm = QtGui.QCheckBox('Confirm received messages')
        self.cb_confirm.hide()
        self.cb_confirm.setChecked(rab.opts['corfirmPosts'])
        self.cb_confirm.toggled.connect(
            lambda val: rab.opts.__setitem__('corfirmPosts', val))
        hlayout.addWidget(self.cb_confirm)

        self._rab_opts = QtGui.QWidget()
        layout.addWidget(self._rab_opts)
        gl = QtGui.QGridLayout()
        self._rab_opts.setLayout(gl)
        self._rab_opts.hide()

        gl.addWidget(QtGui.QLabel('refreshrate [msec]'), 0, 0)
        self._rab_refRate = QtGui.QSpinBox()
        self._rab_refRate.setRange(1, 1000)
        self._rab_refRate.setValue(rab.opts['refreshrate'])
        self._rab_refRate.valueChanged.connect(
            lambda val: rab.opts.__setitem__('refreshrate', val))
        gl.addWidget(self._rab_refRate, 0, 1)

        gl.addWidget(QtGui.QLabel('host'), 1, 0)
        self.le_host = QtGui.QLineEdit()
        self.le_host.setText(rab.opts['host'])
        self.le_host.textChanged.connect(
            lambda val: rab.opts.__setitem__('host', val))
        gl.addWidget(self.le_host, 1, 1)

        gl.addWidget(QtGui.QLabel('timeout [msec]'), 2, 0)
        self.sb_timeout = QtGui.QSpinBox()
        self.sb_timeout.setRange(0, 1000)
        self.sb_timeout.setValue(rab.opts['timeout'])
        self.sb_timeout.valueChanged.connect(
            lambda val: rab.opts.__setitem__('timeout', val))
        gl.addWidget(self.sb_timeout, 2, 1)

        gl.addWidget(QtGui.QLabel('<b>....listen to queues named:</b>'), 3, 0)
        for n, (queue, action) in enumerate(rab.listenTo.iteritems()):
            gl.addWidget(QtGui.QLabel(queue), 4 + n, 0)
            gl.addWidget(QtGui.QLabel(action.__doc__), 4 + n, 1)
示例#9
0
    def __init__(self, display, splitter):
        QtGui.QWidget.__init__(self)

        self.display = display
        display.sigLayerChanged.connect(self.toggleDataChanged)
        display.sigNewLayer.connect(self.toggleNewData)

        self.splitter = splitter

        refreshR = 20

        self._collect = False
        self._activeWidgets = []
        #BUTTON: OF/OFF
        self.btn_show = QtGui.QRadioButton('Console')
        f = self.btn_show.font()
        f.setBold(True)
        self.btn_show.setFont(f)
        self.btn_show.clicked.connect(self._toggleShow)
        #COMBOBOX: IMPORT
        self.combo_import = QtGui.QComboBox()
        self.combo_import.addItems(('<import>', 'from file'))
        self.combo_import.addItems(
            #don't show '.py' and hide __init__.py
            [
                x[:-3] for x in SPRIPT_PATH.listdir()
                if (x[0] != '_' and x.endswith('.py'))
            ])
        self.combo_import.currentIndexChanged.connect(self._importScript)
        #BUTTON: COLLECT
        self.btn_collect = QtGui.QPushButton('Collect')
        self.btn_collect.setToolTip(
            'click on all tool parameters you want to change during the batch process'
        )
        self.btn_collect.setCheckable(True)
        self.btn_collect.clicked.connect(self.collectWidgets)
        #TABWIDGET: SCRIPT
        self.tabs = FwTabWidget()
        self.tabs.hide()
        self.tabs.setTabsAddable(True)
        self.tabs.setTabsClosable(True)
        self.tabs.setTabsRenamable(True)

        self.tabs.defaultTabWidget = lambda: ScriptTab(self, refreshR)
        self.tabs.addEmptyTab('New')
        #BUTTON: RUN AT NEW INPUT
        self.label_run_on = QtGui.QLabel('Activate on')
        self.cb_run_on = QtGui.QComboBox()
        self.cb_run_on.addItems(['-', 'New Data', 'Data Changed'])

        #SPINBOX REFRESHRATE
        self.label_refresh = QtGui.QLabel('Refresh rate:')
        self.sb_refreshrate = QtGui.QSpinBox()
        self.sb_refreshrate.setSuffix(" Hz")
        self.sb_refreshrate.setMinimum(0)
        self.sb_refreshrate.setMaximum(100)
        self.sb_refreshrate.setValue(refreshR)
        self.sb_refreshrate.valueChanged.connect(
            lambda hz: self.tabs.currentWidget().thread.setRefreshrate(hz))
        #BUTTON: RUN
        self.btn_run_now = QtGui.QPushButton('Run')
        self.btn_run_now.setCheckable(True)
        self.btn_run_now.clicked.connect(self.toggle)
        #LAYOUT
        layout = QtGui.QVBoxLayout()
        layout.setAlignment(QtCore.Qt.AlignTop)
        layout.setMargin(0)
        self.setLayout(layout)
        #top layout
        hl = QtGui.QHBoxLayout()
        hl.addWidget(self.btn_show)
        hl.addWidget(self.btn_collect)
        #fill layout
        layout.addLayout(hl)
        layout.addWidget(self.combo_import)
        layout.addWidget(self.tabs)

        hl2 = QtGui.QHBoxLayout()
        hl2.addWidget(self.label_run_on)
        hl2.addWidget(self.cb_run_on)
        hl2.addWidget(self.label_refresh)
        hl2.addWidget(self.sb_refreshrate)
        hl2.insertStretch(1, 0)
        hl2.insertStretch(2, 0)
        layout.addLayout(hl2)
        layout.addWidget(self.btn_run_now)

        self._toggleShow(False)  #automation disabled by default