Пример #1
0
 def __init__(self, parent=None):
     super(signalTable, self).__init__(parent)
     self.setMaximumHeight(100)
     self.magInit = mag.init()
     self.magnets = self.magInit.virtual_VELA_INJ_Magnet_Controller()
     self.bpms = vbpmc.velaINJBeamPositionMonitorController(False, False)
     self.stripTool = parent
     self.rowNumber = 0
     self.penColors = {}
     self.rowWidgets = {}
     for i in range(len(Qtableau20)):
         self.penColors[i] = Qtableau20[2 * i % 20]
     ''' create selectionBox '''
     self.selectBox = self.selectionBox()
     ''' create tableWidget and pushButton '''
     vBoxlayoutParameters = QVBoxLayout()
     vBoxlayoutParameters.addWidget(self.selectBox, 1)
     self.setLayout(vBoxlayoutParameters)
     self.connect(
         self,
         QtCore.SIGNAL(
             "firstColumnComboBoxChanged(PyQt_PyObject, PyQt_PyObject)"),
         self.changeSecondCombo)
     self.connect(
         self,
         QtCore.SIGNAL(
             "firstColumnComboBoxChanged(PyQt_PyObject, PyQt_PyObject)"),
         self.changeThirdComboFromFirst)
     self.connect(self,
                  QtCore.SIGNAL("colourPickerButtonPushed(PyQt_PyObject)"),
                  self.colorPicker)
     self.stripTool.signalAdded.connect(self.updateColourBox)
Пример #2
0
 def setupSlots(self):
     self.connect(self.dSBAmountLTC, QtCore.SIGNAL('valueChanged(double)'),
                  self.checkValueLTC)
     self.connect(self.dSBFee, QtCore.SIGNAL('valueChanged(double)'),
                  self.checkValueFees)
     self.connect(self.actionConnect, QtCore.SIGNAL('triggered()'),
                  self.tryConnect)
Пример #3
0
    def __init__(self, parent = None):
        self.parent = parent

        self.stackStart = 0
        self.stackSizeMax = 120
        self.stackSize = 20

        ## Dock 7: Image Stack
        self.d7 = Dock("Image Scroll", size=(1, 1))
        self.w7L = pg.LayoutWidget()
        self.w7 = pg.ImageView(view=pg.PlotItem())
        self.w7.getView().invertY(False)
        self.scroll = np.random.random((5, 10, 10))
        self.w7.setImage(self.scroll, xvals=np.linspace(0., self.scroll.shape[0] - 1, self.scroll.shape[0]))
        self.spinBox = QtGui.QSpinBox()
        self.spinBox.setValue(0)
        self.label = QtGui.QLabel("Event Number:")
        self.stackSizeBox = QtGui.QSpinBox()
        self.stackSizeBox.setMaximum(self.stackSizeMax)
        self.stackSizeBox.setValue(self.stackSize)
        self.startBtn = QtGui.QPushButton("&Load image stack")
        # Connect listeners to functions
        self.w7L.addWidget(self.w7, row=0, colspan=4)
        self.w7L.addWidget(self.label, 1, 0)
        self.w7L.addWidget(self.spinBox, 1, 1)
        self.w7L.addWidget(self.stackSizeBox, 1, 2)
        self.w7L.addWidget(self.startBtn, 1, 3)
        self.d7.addWidget(self.w7L)

        self.threadpool = LaunchStackProducer.StackProducer(self.parent) # send parent parameters
        self.parent.connect(self.threadpool, QtCore.SIGNAL("finished()"), self.displayImageStack)
        self.parent.connect(self.startBtn, QtCore.SIGNAL("clicked()"), self.loadStack)
Пример #4
0
    def startSpecialTask(self):
        """Starts a special task. This is triggered by the user with a special combination of actions, for example clicking
        with the mouse on a plot, draggin a crosshair, etc."""
        if not self.specialTaskRunning:
            if self.acquiring:
                self.stopMovie()
                self.acquiring = False

            X = self.camWidget.crosshair[0].getPos()
            Y = self.camWidget.crosshair[1].getPos()
            self.centroidX = np.array([])
            self.centroidY = np.array([])
            self.trajectories = np.zeros(
                (self.tempImage.shape[0], self.tempImage.shape[1], 3))
            self.specialTaskWorker = specialTaskWorker(self._session,
                                                       self.camera, X, Y)
            self.connect(self.specialTaskWorker, QtCore.SIGNAL('Image'),
                         self.getData)
            self.connect(self.specialTaskWorker, QtCore.SIGNAL('Coordinates'),
                         self.getCoordinates)
            self.specialTaskWorker.start()
            self.specialTaskRunning = True
            self.messageWidget.appendLog('i', 'Started special task')
        else:
            print('special task already running')
Пример #5
0
    def startSpecialTask(self):
        """Starts a special task. This is triggered by the user with a special combination of actions, for example clicking
        with the mouse on a plot, draggin a crosshair, etc."""
        if not self.specialtask_running:
            if self.acquiring:
                self.stopMovie()
                self.acquiring = False

            locy = self.camWidget.crosshair[0].getPos()[1]
            locx = self.camWidget.crosshair[1].getPos()[0]
            self.trackinfo = np.zeros((1, 5))
            self.trajectoryWidget.plot.clear()
            imgsize = self.tempimage.shape
            iniloc = [locx, locy]
            self.specialTaskWorker = specialTaskTracking(
                self._session, self.camera, self.noiselvl, imgsize, iniloc)
            self.connect(self.specialTaskWorker, QtCore.SIGNAL('image'),
                         self.getData)
            self.connect(self.specialTaskWorker, QtCore.SIGNAL('coordinates'),
                         self.getParticleLocation)
            self.specialTaskWorker.start()
            self.specialtask_running = True
            self.messageWidget.appendLog('i', 'Live tracking started')
        else:
            print('Special task already running')
Пример #6
0
 def run(self):
     """ Performs a task, for example acquires an image and computes the centroid.
     """
     first = True
     while self.keep_running:
         if first:
             self.camera.setAcquisitionMode(self.camera.MODE_CONTINUOUS)
             self.camera.triggerCamera()  # Triggers the camera only once
             first = False
         img = self.camera.readCamera()
         if isinstance(img, list):
             X = np.zeros((2, len(img)))
             n = 0
             for i in img:
                 X[:, n] = center_of_mass(i / np.max(np.max(i)))
                 n += 1
         else:
             X = np.array(center_of_mass(img / np.max(np.max(img))))
         # print(X)
         # print('Special task running... Coordinate X: %sCoordinate Y: %s'%(X[0], X[1]))
         self.emit(QtCore.SIGNAL('Image'), img, 'SpecialTask')
         self.emit(QtCore.SIGNAL('Coordinates'), X)
     self.camera.stopAcq()
     print('Special task finished')
     return
Пример #7
0
    def __init__(self, window, gas_or_air, parent):
        super(BorderLessDiaglogs, self).__init__(parent)
        self.setWindowFlags(QtCore.Qt.FramelessWindowHint
                            | QtCore.Qt.WindowStaysOnTopHint)

        self.window = window
        self.gas_or_air = gas_or_air
        #set font size
        self.font = QtGui.QFont()
        self.font.setPointSize(16)
        #set placeholder text and resize
        self.text = QtGui.QLineEdit("", self)
        self.text.setFont(self.font)
        self.text.setPlaceholderText("Enter Level")
        self.text.setMinimumSize(120, 20)

        #ensure user can only enter doubles
        regexp = QtCore.QRegExp(
            '^0*(?:[1-9][0-9]?|100)$')  # regex expression from 0 - 100
        self.validator = QtGui.QRegExpValidator(regexp)
        self.text.setValidator(self.validator)
        self.resize(self.text.width(), self.text.height())

        # Connecting key events to functions
        self.connect(
            QtGui.QShortcut(QtGui.QKeySequence(QtCore.Qt.Key_Escape), self),
            QtCore.SIGNAL('activated()'), self.Exit)
        self.connect(
            QtGui.QShortcut(QtGui.QKeySequence(QtCore.Qt.Key_Return), self),
            QtCore.SIGNAL('activated()'), self.Return)
        self.installEventFilter(self)

        self.setFocus()
        self.show()
Пример #8
0
    def __init__(self):
        QtCore.QThread.__init__(self)
        self.signal_fr_e = QtCore.SIGNAL("signal_e")
        self.signal_fr_i = QtCore.SIGNAL("signal_i")

        self.fr_e_slot_in = nett.slot_in_float_vector_message()
        self.fr_i_slot_in = nett.slot_in_float_vector_message()
        ip = helper.obtain_ip_address_compute()
        self.fr_e_slot_in.connect('tcp://' + ip + ':8000', 'fr_e')
        self.fr_i_slot_in.connect('tcp://' + ip + ':8000', 'fr_i')
Пример #9
0
 def startCamera(self):
     """Starts a continuous acquisition of the camera.
     """
     self.emit(QtCore.SIGNAL('stopMainAcquisition'))
     if self.acquiring:
         self.stopCamera()
     else:
         self.acquiring = True
         self.workerThread = workThread(self._session,self.camera)
         self.connect(self.workerThread,QtCore.SIGNAL('image'),self.getData)
         self.workerThread.start()
Пример #10
0
Файл: DSSUI.py Проект: lext/DSS
    def __init__(self):
        super(DSSUI, self).__init__()
        self.build_gui()

        self.connect(self.pbOpen, QtCore.SIGNAL('clicked()'), self.open_signal_slot)
        self.connect(self.pbSave, QtCore.SIGNAL('clicked()'), self.save_segments_slot)
        self.connect(self.pbAdd, QtCore.SIGNAL('clicked()'), self.add_segment_slot)
        self.connect(self.pbRem, QtCore.SIGNAL('clicked()'), self.rem_segment_slot)

        self._x = None
        self._dt = None
        self._t = None
Пример #11
0
    def __init__(self):
        QtCore.QThread.__init__(self)
        self.signal_conn_e = QtCore.SIGNAL("signal_e")
        self.signal_conn_i = QtCore.SIGNAL("signal_i")

        self.connection_slot_e_in = nett.slot_in_float_vector_message()
        self.connection_slot_i_in = nett.slot_in_float_vector_message()
        ip = helper_simple.obtain_ip_address_compute()
        self.connection_slot_e_in.connect('tcp://' + ip + ':8000',
                                          'total_connections_e')
        self.connection_slot_i_in.connect('tcp://' + ip + ':8000',
                                          'total_connections_i')
Пример #12
0
    def __init__(self, processing_process, get_data_process, generic_file):
        QtGui.QMainWindow.__init__(self)
        uic.loadUi(uifile, self)
        self.generic_file = generic_file
        #self.tet_plus_selec
        #diagolo q da mas info del canal
        #self.dialogo=Dialog_Tet()
        #self.matriz_tetrodos=tets_display(self.espacio_pg)
        #for i in range((config.CANT_CANALES)/4):
        #self.tet_plus_selec.addItem('T%s' % (i + 1))
        self.processing_process = processing_process
        self.get_data_process = get_data_process
        self.signal_config = Config_processing(
            False,
            DISPLAY_LIMY / 2 * np.ones([config.CANT_CANALES, 1]))  #HARDCODE
        self.active_channels = [False for j in range(config.CANT_CANALES)]
        try:
            processing_process.ui_config_queue.put(self.signal_config)
        except:
            pass
        self.info_tetrodo = plus_display(self.plus_grid, self.plus_grid_fr,
                                         self.signal_config)
        self.matriz_tetrodos = general_display(self.espacio_pg,
                                               self.info_tetrodo)
        self.data_handler = bci_data_handler()
        #QtCore.QObject.connect(self.autoRange, QtCore.SIGNAL("clicked()"), self.set_autoRange)
        QtCore.QObject.connect(self.tet_plus_mode,
                               QtCore.SIGNAL("currentIndexChanged(int)"),
                               self.info_tetrodo.change_display_mode)
        #QtCore.QObject.connect(self.c_auto_umbral, QtCore.SIGNAL("stateChanged(int)"), self.info_tetrodo.change_tmode)
        QtCore.QObject.connect(self.display_scale,
                               QtCore.SIGNAL("valueChanged(int)"),
                               self.matriz_tetrodos.change_Yrange)
        QtCore.QObject.connect(self.paq_view,
                               QtCore.SIGNAL("valueChanged(int)"),
                               self.changeXrange)
        QtCore.QObject.connect(self.active_channel_cb,
                               QtCore.SIGNAL("clicked( bool)"),
                               self.activate_channel)
        self.get_data_warning_time = 0
        self.processing_process_warning_time = 0
        self.file_label.setText(NOT_SAVING_MESSAGE)
        self.contador_registro = -1
        self.timer = QtCore.QTimer()

        self.timer.timeout.connect(self.update)
        processing_process.process.start()
        get_data_process.process.start()
        self.timer.start(0)  #si va demasiado lento deberia bajarse el tiempo
        self.t1 = time.time()
Пример #13
0
    def updateMon(self):
        """Function that gets the data from the ADQ and prepares it for updating the GUI.
        """

        final_data = self.trap.readMonitor(
        )  # Have to be sure it is an ND array
        final_data = np.reshape(final_data,
                                (self.trap.devsMonitor,
                                 int(len(final_data) / self.trap.devsMonitor)))
        mean_data = np.mean(final_data, 1)
        varData = np.var(final_data, 1)
        self.emit(QtCore.SIGNAL('TimeTraces'), final_data)
        self.emit(QtCore.SIGNAL('varData'), varData)
        self.emit(QtCore.SIGNAL('MeanData'),
                  mean_data)  # For updating values in an external dialog
Пример #14
0
    def __init__(self, parent = None):
        self.parent = parent

        ## Dock: Quantifier
        self.dock = Dock("Small Data", size=(100, 100))
        self.win = ParameterTree()
        self.dock.addWidget(self.win)
        self.winL = pg.LayoutWidget()
        self.refreshBtn = QtGui.QPushButton('Refresh')
        self.winL.addWidget(self.refreshBtn, row=0, col=0)
        self.peakogramBtn = QtGui.QPushButton('Peakogram')
        self.winL.addWidget(self.peakogramBtn, row=0, col=1)
        self.dock.addWidget(self.winL)
        # Add plot
        self.winP = pg.PlotWidget(title="Metric")
        self.dock.addWidget(self.winP)

        # Quantifier parameter tree
        self.quantifier_grp = 'Small data'
        self.quantifier_filename_str = 'filename'
        self.quantifier_dataset_str = 'dataset'
        self.quantifier_sort_str = 'sort'

        # Quantifier
        self.quantifier_filename = ''
        self.quantifier_dataset = '/entry_1/result_1/'
        self.quantifier_sort = False
        self.quantifierFileOpen = False
        self.quantifierHasData = False

        self.params = [
            {'name': self.quantifier_grp, 'type': 'group', 'children': [
                {'name': self.quantifier_filename_str, 'type': 'str', 'value': self.quantifier_filename, 'tip': "Full path Hdf5 filename"},
                {'name': self.quantifier_dataset_str, 'type': 'str', 'value': self.quantifier_dataset, 'tip': "Hdf5 dataset metric, nPeaksAll or nHitsAll"},
                {'name': self.quantifier_sort_str, 'type': 'bool', 'value': self.quantifier_sort, 'tip': "Ascending sort metric"},
            ]},
        ]

        self.pSmall = Parameter.create(name='paramsQuantifier', type='group', \
                                       children=self.params, expanded=True)
        self.win.setParameters(self.pSmall, showTop=False)
        self.pSmall.sigTreeStateChanged.connect(self.change)
        if using_pyqt4:
            self.parent.connect(self.refreshBtn, QtCore.SIGNAL("clicked()"), self.reloadQuantifier)
            self.parent.connect(self.peakogramBtn, QtCore.SIGNAL("clicked()"), self.showPeakogram)
        else:
            self.refreshBtn.clicked.connect(self.reloadQuantifier)
            self.peakogramBtn.clicked.connect(self.showPeakogram)
Пример #15
0
	def setData(self, index, value, role):
	    if (role == QtCore.Qt.CheckStateRole and index.column() == 0):
	        self.checks[index] = value
	        self.emit(QtCore.SIGNAL("dataChanged(QModelIndex,QModelIndex)"), index, index)
	        return True 

	    return QtGui.QDirModel.setData(self, index, value, role)
Пример #16
0
 def run(self):
     print 'hola'
     #time.sleep(10)
     self.running = True
     while self.running:
         self.emit(QtCore.SIGNAL("thread_readdata()"))
         time.sleep(0.1)
Пример #17
0
    def __init__(self,
                 text,
                 parent,
                 dataRange=[-100, 0],
                 color=QtGui.QColor(0, 0, 0)):
        QtGui.QWidget.__init__(self, parent=parent)
        self.myParent = parent
        self.color = color

        self.sources = [
            DropTarget("x", self, color=self.color, class_filter="ValueNode"),
            DropTarget("y", self, color=self.color, class_filter="ValueNode")
        ]
        self.curveTypeCombo = gui_elements.PlainComboField(
            parent=self,
            label="curve",
            value="Line",
            choices=["Line", "Scatter"])
        self.curveType = "Line"
        self.connect(self.curveTypeCombo.combo,
                     QtCore.SIGNAL("currentIndexChanged(QString)"),
                     self.updateCurveType)
        self.layout = QtGui.QVBoxLayout()
        self.layout.setMargin(0)
        self.layout.setContentsMargins(0, 0, 0, 0)
        self.layout.setSpacing(0)
        #self.layout.addStretch()
        self.setLayout(self.layout)
        for s in self.sources:
            self.layout.addWidget(s)
        self.layout.addWidget(self.curveTypeCombo)
        self.curve = None
        self.setAcceptDrops(True)
        self.dataRange = dataRange
Пример #18
0
    def initialize(self):
        # Starts gui, assuming signal source has been set

        if not self._signal_source:
            print(
                'No Signal Source Assigned. Use signal_viewer.set_signal_source().\n'
            )
            return

        print('Initializing Signal Viewer.\n')

        # TODO: Update mode select property

        # TODO: Make channel select method

        # Timer
        self._timer = QtCore.QTimer(self)
        self.connect(self._timer, QtCore.SIGNAL("timeout()"), self._update)

        # TODO: Make _update_figure() method which syncs properties with UI objects
        #self._update_figure()

        self._update()

        # Start timer
        self._timer.start(100)

        # Execute App (no code after this wil run)
        self.run()
  def __init__(self):
    QtCore.QThread.__init__(self)
    self.signal = QtCore.SIGNAL("signal")

    self.connection_slot_in = nett.slot_in_float_vector_message()
    ip = helper.obtain_ip_address_compute()
    self.connection_slot_in.connect('tcp://'+ip+':8000', 'total_connections')
Пример #20
0
 def __init__(self, comboID, mainForm):
     super(signalElementComboBox, self).__init__()
     self.__comboID = comboID
     self.__mainForm = mainForm
     self.connect(self,
                  QtCore.SIGNAL("currentIndexChanged (const QString&)"),
                  self.indexChanged)
Пример #21
0
 def indexChanged(self, ind):
     # send signal to MainForm class, self.__comboID is actually row number, ind is what is selected
     print 'comboID = ', self.__comboID, 'ind = ', ind
     self.__mainForm.emit(
         QtCore.SIGNAL(
             "firstColumnComboBoxChanged(PyQt_PyObject,PyQt_PyObject)"),
         self.__comboID, ind)
Пример #22
0
    def __init__(self, rows, cols, titles):
        super(GraphWindow, self).__init__()

        # Code to draw the GUI
        self.rows = rows
        self.cols = cols
        self.titles = titles
        self.plots = []  # List of PlotItems
        self.curves = []  # List of PlotDataItems in each PlotItem
        self.data = [[] for i in range(self.rows * self.cols)]
        self.dataD = [[] for i in range(self.rows * self.cols)]

        for i in range(self.rows):
            for j in range(self.cols):
                p = self.addPlot()
                self.plots.append(p)
                if titles != [] or len(titles) == 1:
                    p.setLabel('left', self.titles[i + j + 1])
                p.setDownsampling(mode='peak')
                p.setClipToView(True)
                pp = p.plot(pen=(155, 255, 50))
                pp1 = p.plot(pen=(55, 130, 255))
                self.curves.append((pp, pp1))
            self.nextRow()

        # Timer to redraw plots
        self.timer = QtCore.QTimer(self)
        self.connect(self.timer, QtCore.SIGNAL('timeout()'), self.update_plots)
        self.timer.start(100)
Пример #23
0
 def snap(self):
     """Function for acquiring a single frame from the camera. It is triggered by the user.
     It gets the data the GUI will be updated at a fixed framerate.
     """
     if self.acquiring:  #If it is itself acquiring a message is displayed to the user warning him
         msgBox = QtGui.QMessageBox()
         msgBox.setIcon(QtGui.QMessageBox.Critical)
         msgBox.setText("You cant snap a photo while in free run")
         msgBox.setInformativeText("The program is already acquiring data")
         msgBox.setWindowTitle("Already acquiring")
         msgBox.setDetailedText(
             """When in free run, you can\'t trigger another acquisition. \n
             You should stop the free run acquisition and then snap a photo."""
         )
         msgBox.setStandardButtons(QtGui.QMessageBox.Ok)
         retval = msgBox.exec_()
         self.messageWidget.appendLog('e',
                                      'Tried to snap while in free run')
     else:
         self.workerThread = workThread(self._session, self.camera)
         self.connect(self.workerThread, QtCore.SIGNAL('image'),
                      self.getData)
         self.workerThread.origin = 'snap'
         self.workerThread.start()
         self.acquiring = True
         self.messageWidget.appendLog('i', 'Snapped photo')
Пример #24
0
    def __init__(self,
                 text,
                 parent,
                 color=QtGui.QColor(0, 0, 0),
                 class_filter=None):
        QtGui.QWidget.__init__(self, parent=parent)
        self.myParent = parent
        self.class_filter = class_filter
        self.originalName = text
        self.currentName = self.originalName
        self.color = color
        self.label = QtGui.QLabel(text, self)
        self.removeButton = QtGui.QPushButton("-")
        #self.removeButton.setAutoFillBackground(True)
        #self.removeButton.setStyleSheet("background-color: rgba(%i, %i, %i, %i); "%(color.red(),  color.green(),  color.blue(),  255))

        self.removeButton.setFixedSize(15, 15)
        self.connect(self.removeButton, QtCore.SIGNAL("clicked()"),
                     self.remove)
        self.layout = QtGui.QHBoxLayout()
        self.setLayout(self.layout)
        self.layout.setMargin(0)

        self.layout.addWidget(self.label)
        self.layout.addWidget(self.removeButton)
        self.layout.addStretch()
        self.setAcceptDrops(True)
        self.source = None
        self.curve = None
Пример #25
0
 def __init__(self, *args):
     QtGui.QMainWindow.__init__(self, *args)
     self.cw = QtGui.QWidget(self)
     self.setCentralWidget(self.cw)
     self.btn1 = QtGui.QPushButton("Click me", self.cw)
     self.btn1.setGeometry(QtCore.QRect(0, 0, 100, 30))
     self.connect(self.btn1, QtCore.SIGNAL("clicked()"), self.doit)
     self.w = None
Пример #26
0
 def startMovie(self):
     if self._session.Debug['to_screen']:
         print('Start Movie')
     else:
         if self.acquiring:
             self.stopMovie()
         else:
             self.emit(QtCore.SIGNAL('stopChildMovie'))
             self.messageWidget.appendLog('i', 'Continuous run started')
             # Worker thread to acquire images. Specially useful for long exposure time images
             self.workerThread = workThread(self._session, self.camera)
             self.connect(self.workerThread, QtCore.SIGNAL('image'),
                          self.getData)
             self.connect(self.workerThread, QtCore.SIGNAL('finished()'),
                          self.done)
             self.workerThread.start()
             self.acquiring = True
Пример #27
0
 def __init__(self, loading_widget, parent=None, *args, **kwargs):
     super(ThreadQDialog, self).__init__(parent, *args, **kwargs)
     self.dialog = QtGui.QMessageBox()
     self.dialog.setWindowTitle('Info:Loading')
     self.dialog.setModal(True)
     self.dialog.hide()
     self.loading_widget = loading_widget
     self.connect(self.loading_widget, QtCore.SIGNAL('loadFinished(bool)'),
                  self.callback_close)
Пример #28
0
 def __init__(self, parent):
     super(TerminalGraphicsView, self).__init__()
     self.connect(parent, QtCore.SIGNAL("resize"), self.resize)
     self.setScene(QtGui.QGraphicsScene())
     self.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
     self.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
     self.setAttribute(QtCore.Qt.WA_TranslucentBackground)
     self.viewport().setAutoFillBackground(False)
     self.setStyleSheet("border: none")
     self.setInteractive(False)
Пример #29
0
 def closeEvent(self,evnt):
     """Triggered at closing. If it is running as main window or not.
     """
     if self.parent == None:
         self.emit(QtCore.SIGNAL('closeAll'))
         self.camera.stopCamera()
         self.workerThread.terminate()
         self.close()
     else:
         self.closeViewer()
Пример #30
0
    def __init__(self,session,camera,parent=None):
        super(cameraViewer,self).__init__()

        self._session = session
        self.camera = camera
        self.parent = parent
        self.setWindowTitle('On-Demand Camera Terminal')
        self.viewerWidget = viewerWidget()
        self.setCentralWidget(self.viewerWidget)

        QtCore.QObject.connect(self.viewerWidget.startButton,QtCore.SIGNAL('clicked()'),self.startCamera)
        QtCore.QObject.connect(self.viewerWidget.stopButton,QtCore.SIGNAL('clicked()'),self.startCamera)
        self.acquiring = False

        self.tempImage = []

        self.refreshTimer = QtCore.QTimer()
        self.refreshTimer.start(self._session.GUI['refresh_time']) # In milliseconds

        self.connect(self.refreshTimer,QtCore.SIGNAL("timeout()"),self.updateGUI)