Ejemplo n.º 1
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)
Ejemplo 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)
Ejemplo n.º 3
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)
Ejemplo n.º 4
0
 def __init__(self):
     QtGui.QWidget.__init__(self)
     l = QtGui.QHBoxLayout()
     self.setLayout(l)
     l.setContentsMargins(0, 0, 0, 0)
     l.setSpacing(0)
     l.setDirection(QtGui.QBoxLayout.RightToLeft)
Ejemplo n.º 5
0
    def __init__(self, MEDIA_FOLDER):
        QtGui.QWidget.__init__(self)
        
        self.is_active = True
        self.max_hist_len = 5
        self._c = 0#count all added backups
        
        self.reset()
        self.setContentsMargins (0, 0, 0, 0)

        #HISTORY MENU
        self.menu = QtGui.QMenu()
        self.menu.aboutToShow.connect(self._showMenu)

        hl = QtGui.QHBoxLayout()
        hl.setContentsMargins (0, 0, 0, 0)

        self.setLayout(hl)

        icon_path = MEDIA_FOLDER.join("icons")
        
        #UNDO BUTTON
        self.btn_undo = QtGui.QToolButton()
        self.btn_undo.setAutoRaise(True)
        self.btn_undo.setToolTip('Undo')
        self.btn_undo.setIcon(QtGui.QIcon(icon_path.join('undo.svg')))
        self.btn_undo.setShortcut (QtGui.QKeySequence.Undo)
        self.btn_undo.clicked.connect(self.undo)
        self.btn_undo.setEnabled(False)
        
        #MENU BUTTON
        self.btn_menu = QtGui.QToolButton()
        self.btn_menu.setAutoRaise(True)
        self.btn_menu.setFixedWidth(9)
        self.btn_menu.setToolTip('Undo/Redo options')
        self.btn_menu.setMenu(self.menu)
        self.btn_menu.setPopupMode(QtGui.QToolButton.InstantPopup)
        
        self.menu_options = _MenuOptions()
        self.menu_options.activate.stateChanged.connect(self.setActive)
        
        action = QtGui.QWidgetAction(self)
        action.setDefaultWidget(self.menu_options)
        self.menu.addAction(action)      

        #REDO BUTTON
        self.btn_redo = QtGui.QToolButton()
        self.btn_redo.setAutoRaise(True)
        self.btn_redo.setToolTip('Redo')
        self.btn_redo.setIcon(QtGui.QIcon(icon_path.join('redo.svg')))
        self.btn_redo.clicked.connect(self.redo)
        self.btn_redo.setShortcut (QtGui.QKeySequence.Redo)
        self.btn_redo.setEnabled(False)

        hl.addWidget(self.btn_undo)
        hl.addWidget(self.btn_menu)
        hl.addWidget(self.btn_redo)
Ejemplo n.º 6
0
    def __init__(self, fnPrevious, fnNext):
        QtGui.QWidget.__init__(self)
        #make frameles:
        self.setWindowFlags(QtCore.Qt.FramelessWindowHint | QtCore.Qt.WindowStaysOnTopHint)

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

        btn_previous = QtGui.QPushButton('Previous')  
        btn_previous.clicked.connect(fnPrevious)   
        btn_next = QtGui.QPushButton('Next')
        btn_next.clicked.connect(fnNext)   

        layout.addWidget(btn_previous)
        layout.addWidget(btn_next)
Ejemplo n.º 7
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)
Ejemplo n.º 8
0
    def __init__(self, statusbar):
        QtGui.QWidget.__init__(self)

        self.statusbar = statusbar

        layout = QtGui.QHBoxLayout()
        layout.setContentsMargins(0, 0, 0, 0)
        self.setLayout(layout)
        self.bar = QtGui.QProgressBar()
        self.cancel = QtGui.QPushButton('Cancel')
        self.label = QtGui.QLabel()
        layout.addWidget(self.label)
        layout.addWidget(self.bar)
        layout.addWidget(self.cancel)
        self.statusbar.addPermanentWidget(self, stretch=1)

        self.hide()
Ejemplo n.º 9
0
    def __init__(self, gui):

        QtGui.QWidget.__init__(self)

        self.gui = gui
        self._last_active_display = None
        self._import_display = None
        self._n_displays = 0  #number of opened displays
        #BUILD MAIN DOCKAREAS:
        self.console = Console(self.gui.app.session.streamOut.message,
                               self.gui.app.session.streamErr.message)
        self.console.setMinimumHeight(25)

        self.displayPrefTabs = DisplayPrefTabs()
        self.displayPrefTabs.currentChanged.connect(self.tabChanged)

        self.area_middle = MiddleDockArea()

        #LAYOUT:
        layout = QtGui.QHBoxLayout()
        #remove space between statusbar and console:
        m = layout.contentsMargins()
        m.setBottom(0)
        layout.setContentsMargins(m)
        self.setLayout(layout)
        #middle - displays and message
        self.middle_splitter = QtGui.QSplitter(
            QtCore.Qt.Orientation(0))  #0=horiz, 1=vert
        self.middle_splitter.addWidget(self.area_middle)
        self.middle_splitter.addWidget(self.console)
        #hide console by default
        self.middle_splitter.moveSplitter(0, 0)  # (410, 1)
        #add areas to centralWidget
        self.vert_splitter = QtGui.QSplitter(
            QtCore.Qt.Orientation(1))  #0=horiz, 1=vert
        layout.addWidget(self.vert_splitter)
        self.vert_splitter.addWidget(self.displayPrefTabs)
        self.vert_splitter.addWidget(self.middle_splitter)
        #display pref tabs with fixed size:
        self.vert_splitter.setStretchFactor(1, 1)

        self.setActive()
Ejemplo n.º 10
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)
Ejemplo n.º 11
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()
Ejemplo n.º 12
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)
Ejemplo n.º 13
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