Esempio n. 1
0
    def __init__(self, session):
        QtGui.QWidget.__init__(self)

        lab = QtGui.QLabel('Profile:')
        tt = '''The chosen profile influences the visibility of tool bars.
Changes are only effective after restarting the program.'''
        lab.setToolTip(tt)

        cb = QtGui.QComboBox()
        cb.setToolTip(tt)
        items = ('simple', 'advanced')
        cb.addItems(items)
        try:
            cb.setCurrentIndex(items.index(session.app_opts['profile']))
        except KeyError:
            session.app_opts['profile'] = 'simple'
            pass
        cb.currentIndexChanged.connect(lambda i: session.app_opts.__setitem__(
            'profile', str(cb.currentText())))

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

        l.addWidget(lab)
        l.addWidget(cb)
Esempio n. 2
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)
Esempio n. 3
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)
Esempio n. 4
0
    def __init__(self, tool):
        QtGui.QWidget.__init__(self)
        self.tool = tool
        self.display = tool.display

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

        d = QtGui.QLabel('Set distance in')
        self.combo = QtGui.QComboBox()
        self.combo.addItems(['x', 'y', 'distance'])
        self.editor = QtGui.QLineEdit()
        self.editor.setValidator(QtGui.QDoubleValidator(0.0, 9999.0, 3))
        l.addWidget(d)
        l.addWidget(self.combo)
        l.addWidget(self.editor)

        self.setGeometry(100, 100, 200, 40)
        self.setAutoFillBackground(True)
        p = self.palette()
        p.setColor(self.backgroundRole(), QtCore.Qt.lightGray)
        self.setPalette(p)

        self.hide()
Esempio n. 5
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