Exemplo n.º 1
0
    def __init__(
        self,
        parent=None,
    ):
        QMenu.__init__(self, parent)
        self.options = {}

        for name, action in SYSTEM_TRAY_MENU:
            menu_action = self.addAction(name)
            self.connect(menu_action, SIGNAL('triggered()'), action)
            self.options[name] = menu_action

        self.connect(self, SIGNAL("aboutToShow()"),
                     lambda: self.update_options())
Exemplo n.º 2
0
    def __init__(self):
        # init main panel
        QMainWindow.__init__(self, None)
        #        QMainWindow.__init__(self, None, QtCore.Qt.WindowStaysOnTopHint)
        Thread.__init__(self)
        widget = QWidget()
        self.setCentralWidget(widget)
        self.setWindowTitle('3D tracking')
        self.move(600, 150)
        # define main objects
        self.tracking = tracking_3d.Tracking3D.getInstance()

        # init dataset from gui_construction
        self.gb_sequence = DataSetEditGroupBox(
            "Sequence", gui_construction.RemoteParameters, comment='')
        self.gb_sample = DataSetEditGroupBox("Sample",
                                             gui_construction.SampleParameters,
                                             comment='')
        self.gb_tracking = DataSetEditGroupBox(
            "Tracking", gui_construction.TrackingParameters, comment='')

        self.btn_process = QPushButton("Start tracking", self)
        self.btn_process.clicked.connect(self.start_tracking)

        # associate events to dataset apply buttons
        self.connect(self.gb_sequence, SIGNAL("apply_button_clicked()"),
                     self.update_remote_params)
        self.connect(self.gb_tracking, SIGNAL("apply_button_clicked()"),
                     self.update_tracking_params)
        self.connect(self.gb_sample, SIGNAL("apply_button_clicked()"),
                     self.update_sample_parameters)

        # organize the app panels
        splitter1 = QSplitter(QtCore.Qt.Vertical)
        splitter1.addWidget(self.gb_sequence)
        splitter1.addWidget(self.gb_sample)
        splitter1.addWidget(self.gb_tracking)
        splitter1.addWidget(self.btn_process)

        splitter = QSplitter(self)
        splitter.addWidget(splitter1)
        self.setCentralWidget(splitter)
        self.setContentsMargins(10, 5, 10, 5)

        # get all params from datasets
        self.gb_sequence.get()
        self.gb_sample.get()
        self.gb_tracking.get()
Exemplo n.º 3
0
 def register_window(self, windows):
     if not isinstance(windows, (tuple, list)):
         windows = (windows, )
     for window in windows:
         self.windows.append(window)
         self.emit(SIGNAL("window_registred"), window)
         window.show()
Exemplo n.º 4
0
    def start_compute(self,
                      name,
                      func,
                      param=None,
                      suffix=None,
                      interactive=True):
        self.QProxy.emit(SIGNAL("computing"))
        if interactive and param is not None:
            if interactive == 'text' and not param.text_edit():
                return
            elif not param.edit():
                return
        QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))

        try:
            processing = name
            if suffix is not None:
                processing += " | " + suffix(param)

            result = Measurement()
            result.copy_param(self.measurement)
            result.set_rawdata(self.apply_func(func, param))
            result['processing'] += processing + "\n"
        except Exception, msg:
            import traceback
            traceback.print_exc()
            QMessageBox.critical(
                None, APP_NAME,
                _(u"An error occured:") + "\n%s" % unicode(msg))
            raise ComputationError, msg
Exemplo n.º 5
0
    def fit_bcs(self):
        from guiqwt.fit import FitParam, FitDialog
        import bcs
        from numpy import sum

        def fit(x, param):
            return bcs.BCS(param[1], param[0], x)

        T = FitParam("Temperature [K]", 2, 0.1, 20)
        gap = FitParam("Gap [meV]", 1.28, 1, 10)  # in meV, value for NbSe_2
        params = [T, gap]

        x, y = self.get_data()
        # FIXME : not a very good way to proceed
        # Normalize with 20 point from the left of the curve
        normalisation_range = y[:20]
        normalisation = sum(normalisation_range) / len(normalisation_range)
        y = y / normalisation
        #values = guifit(x, y, fit, params, auto_fit=True)
        win = FitDialog(edit=True,
                        wintitle='BCS fitting',
                        toolbar=True,
                        param_cols=1,
                        auto_fit=True,
                        options=dict(title="BCS",
                                     xlabel="Energy",
                                     ylabel="DOS"))
        win.set_data(x, y, fit, params, fitargs=None, fitkwargs=None)
        self.QProxy.emit(SIGNAL("new_window"), win)
        win.autofit()
        win.show()

        return win
Exemplo n.º 6
0
    def __init__(self, parent=None):
        QMenu.__init__(self, parent)
        self.options = {}
        system_tray_menu = [
            (self.START, lambda: agent_manager("start")),
            (self.STOP, lambda: agent_manager("stop")),
            (self.RESTART, lambda: agent_manager("restart")),
        ]
        # First the version
        self.addAction(self.ABOUT.format(get_version())).setEnabled(False)
        self.addSeparator()

        for name, action in system_tray_menu:
            self.add_option(name, action)

        # enable or disable mac login
        if Platform.is_mac():
            self.add_option(
                self.MAC_LOGIN.format(self.enable_or_disable_mac()),
                lambda: self.enable_or_disable_login())

        # And finally the exit
        self.add_option(self.EXIT, lambda: sys.exit(0))

        self.connect(self, SIGNAL("aboutToShow()"),
                     lambda: self.update_options())
Exemplo n.º 7
0
 def create_autofit_group(self):
     auto_button = QPushButton(get_icon('apply.png'), _("Run"), self)
     self.connect(auto_button, SIGNAL("clicked()"), self.autofit)
     autoprm_button = QPushButton(get_icon('settings.png'), _("Settings"),
                                  self)
     self.connect(autoprm_button, SIGNAL("clicked()"), self.edit_parameters)
     xrange_button = QPushButton(get_icon('xrange.png'), _("Bounds"), self)
     xrange_button.setCheckable(True)
     self.connect(xrange_button, SIGNAL("toggled(bool)"),
                  self.toggle_xrange)
     auto_layout = QVBoxLayout()
     auto_layout.addWidget(auto_button)
     auto_layout.addWidget(autoprm_button)
     auto_layout.addWidget(xrange_button)
     self.button_list += [auto_button, autoprm_button, xrange_button]
     return create_groupbox(self, _("Automatic fit"), layout=auto_layout)
Exemplo n.º 8
0
    def session_stop(self):
        if self.appsettings.dataset.use_virtual_serial is True:
            self.zephyr_connect.pause()

        for a in self.appsettings.dataset.bh_packets:
            if a == 0: self.zephyr_connect.disablePacket('RRDATA')
            elif a == 1: self.zephyr_connect.disablePacket('BREATHING')
            elif a == 2: self.zephyr_connect.disablePacket('ECG')
            elif a == 3: self.zephyr_connect.disablePacket('SUMMARY')

        self.timer.stop()
        # handle graphical change:
        self.playAction.setEnabled( True )
        self.timedAction.setEnabled( True )
        self.stopAction.setEnabled( False )
        self.connectAction.setEnabled( True )

        # update session with the duration
        if self.appsettings.dataset.enable_database is True:
            self.datastorage.update_duration(self.timer.getRunningTime())

        # store more info for the current session?
        if self.appsettings.dataset.enable_database or self.appsettings.dataset.enable_files:
            self.infosdialog = SessionInfos( self, self.datastorage )
            self.connect(self.infosdialog, SIGNAL('accepted()'), self.add_more_infos )
            self.infosdialog.exec_()
   def __init__(self, name, instanceId, widgetList, dataFunc, inactivityTimeout = True):
      dspWidget.__init__(self, name, instanceId, widgetList, inactivityTimeout = inactivityTimeout)

      self.dataFunc = dataFunc
      self.Fs = 2000
      self.sample_rate = 5333
      self.pascal_constant=2*10**-5

      self.pcm =[]

      self.layout = QGridLayout()
      self.setLayout(self.layout) 
      
      self.pcmPlotW = dspCurveWidget(title="Monitor Mic Data", show_itemlist=False)
      self.layout.addWidget(self.pcmPlotW, 1, 0, 1, 1)

      self.resize(1000, 300)



      self.Button1 = QPushButton("Level")

      self.layout.addWidget(self.Button1, 1,1,1,1)

      self.connect(self.Button1, SIGNAL('clicked()'), self.Button1Pressed)
Exemplo n.º 10
0
    def __init__(self, settings, parent=None,):
        QMenu.__init__(self, parent)
        self.options = {}

        for name, action in settings:
            menu_action = self.addAction(name)
            self.connect(menu_action, SIGNAL('triggered()'), action)
            self.options[name] = menu_action
Exemplo n.º 11
0
 def create_list_dock(self):
     list_dock = QDockWidget(_('Files'))
     self.addDockWidget(Qt.RightDockWidgetArea, list_dock)
     self.list_widget = QListWidget()
     self.connect(
         self.list_widget,
         SIGNAL("currentItemChanged( QListWidgetItem, QListWidgetItem)"),
         self.change_selection)
     list_dock.setWidget(self.list_widget)
Exemplo n.º 12
0
    def __init__(self, parent=None):

        QSplitter.__init__(self, parent)
        self.setWindowTitle(MAIN_WINDOW_TITLE)
        self.setWindowIcon(get_icon("agent.svg"))
        
        self.sysTray = SystemTray(self)

        self.connect(self.sysTray, SIGNAL("activated(QSystemTrayIcon::ActivationReason)"), self.__icon_activated)

        checks = get_checks()
        datadog_conf = DatadogConf(get_config_path(), description="Agent settings file: datadog.conf")
        self.log_file = LogFile()

        listwidget = QListWidget(self)
        listwidget.addItems([osp.basename(check.module_name).replace("_", " ").title() for check in checks])
        
        self.properties = PropertiesWidget(self)
        
        self.addWidget(listwidget)
        self.addWidget(self.properties)
        
        self.connect(self.properties.enable_button, SIGNAL("clicked()"),
                     lambda: enable_check(self.properties))

        self.connect(self.properties.disable_button, SIGNAL("clicked()"),
                     lambda: disable_check(self.properties))

        self.connect(self.properties.save_button, SIGNAL("clicked()"),
                     lambda: save_file(self.properties))

        self.connect(listwidget, SIGNAL('currentRowChanged(int)'),
                     lambda row: self.properties.set_item(checks[row]))

        self.connect(self.properties.edit_datadog_conf_button, SIGNAL('clicked()'),
                     lambda: self.properties.set_datadog_conf(datadog_conf))

        self.connect(self.properties.view_log_button, SIGNAL('clicked()'),
                     lambda: self.properties.set_log_file(self.log_file))

        self.manager_menu = Menu(self)
        self.connect(self.properties.menu_button, SIGNAL("clicked()"),
            lambda: self.manager_menu.popup(self.properties.menu_button.mapToGlobal(QPoint(0,0))))


        listwidget.setCurrentRow(0)
        
        self.setSizes([150, 1])
        self.setStretchFactor(1, 1)
        self.resize(QSize(950, 600))
        self.properties.set_datadog_conf(datadog_conf)

        self.do_refresh()
Exemplo n.º 13
0
    def __init__(self, parent=None):
        QSplitter.__init__(self, parent)
        self.setOrientation(Qt.Vertical)
        self.optimization_input = DataSetEditGroupBox("Optimization",
                                                      OptimizationInput)
        self.addWidget(self.optimization_input)
        self.connect(self.optimization_input, SIGNAL("apply_button_clicked()"),
                     self.start_opt)

        plot.ioff()
        figure = plot.figure()
        self.addWidget(figure.canvas.manager.window)
Exemplo n.º 14
0
 def run( self ):
     self.stopped = False
     while not self.stopped:
         time.sleep(1)
         if self.asc is True:
             self.currsecond += 1
         else :
             if self.currsecond > 0:
                 self.currsecond -= 1
             else:
                 self.emit( SIGNAL( 'SessionStop' ) )
                 self.stop()
         self.update_timer_display( self.currsecond )
Exemplo n.º 15
0
    def create_plot(self, options):
        self.filter_gbox = DataSetEditGroupBox(_("Filter parameters"),
                                               FilterParam)
        self.filter_gbox.setEnabled(False)
        self.connect(self.filter_gbox, SIGNAL("apply_button_clicked()"),
                     self.apply_filter)
        self.plot_layout.addWidget(self.filter_gbox, 0, 0)
        self.param_gbox = DataSetShowGroupBox(_("Image parameters"),
                                              ImageParam)
        self.plot_layout.addWidget(self.param_gbox, 0, 1)

        options = dict(title=_("Image title"), zlabel=_("z-axis scale label"))
        ImageDialog.create_plot(self, options, 1, 0, 1, 0)
Exemplo n.º 16
0
 def add_actions_to_toolbar(self):
     other = self.manager.get_panel(self.OTHER_PANEL_ID)
     if other is None:
         add_actions(
             self.toolbar,
             (self.peritem_ac, self.applylut_ac, None, self.export_ac,
              self.autoscale_ac, self.refresh_ac, self.autorefresh_ac))
     else:
         add_actions(
             self.toolbar,
             (other.peritem_ac, other.applylut_ac, None, self.export_ac,
              other.autoscale_ac, other.refresh_ac, other.autorefresh_ac))
         self.connect(other.peritem_ac, SIGNAL("toggled(bool)"),
                      self.cs_plot.toggle_perimage_mode)
         self.connect(other.applylut_ac, SIGNAL("toggled(bool)"),
                      self.cs_plot.toggle_apply_lut)
         self.connect(other.autoscale_ac, SIGNAL("toggled(bool)"),
                      self.cs_plot.toggle_autoscale)
         self.connect(other.refresh_ac, SIGNAL("triggered()"),
                      lambda: self.cs_plot.update_plot())
         self.connect(other.autorefresh_ac, SIGNAL("toggled(bool)"),
                      self.cs_plot.toggle_autorefresh)
Exemplo n.º 17
0
   def __init__(self, name, instanceId, widgetList, dataFunc, inactivityTimeout = True):
      dspWidget.__init__(self, name, instanceId, widgetList, inactivityTimeout = inactivityTimeout)

      self.dataFunc = dataFunc

      self.Fs = 2000

      layout = QGridLayout()
      self.setLayout(layout)

      self.resize(1024, 800)

      self.refPlotW = dspCurveWidget(mode="Freq",title="Reference PCM", show_itemlist=False)
      layout.addWidget(self.refPlotW, 1, 1, 1, 1)
      self.refExitButton = QPushButton("Hide")
      layout.addWidget(self.refExitButton, 1,0,1,1)
      self.connect(self.refExitButton, SIGNAL('clicked()'), self.refExitButtonPressed)

      self.errPlotW = dspCurveWidget(mode="Freq",title="Error Mic PCM", show_itemlist=False)
      layout.addWidget(self.errPlotW, 2, 1, 1, 1)
      self.errExitButton = QPushButton("Hide")
      layout.addWidget(self.errExitButton, 2,0,1,1)
      self.connect(self.errExitButton, SIGNAL('clicked()'), self.errExitButtonPressed)

      self.outPlotW = dspCurveWidget(mode="Freq",title="ANC Output", show_itemlist=False)
      layout.addWidget(self.outPlotW, 3, 1, 1, 1)
      self.outExitButton = QPushButton("Hide")
      layout.addWidget(self.outExitButton, 3,0,1,1)
      self.connect(self.outExitButton, SIGNAL('clicked()'), self.outExitButtonPressed)

      self.coefPlotW = dspCurveWidget(title="ANC Filter", mode="Freq", show_buttons=False, show_itemlist=True)
      self.coefPlotW.customCurve = self.updateFilterCurve
      self.coefPlotW.plotPoints = 1024
      layout.addWidget(self.coefPlotW, 4, 1, 1, 1)
      self.coefExitButton = QPushButton("Hide")
      layout.addWidget(self.coefExitButton, 4,0,1,1)
      self.connect(self.coefExitButton, SIGNAL('clicked()'), self.coefExitButtonPressed)
Exemplo n.º 18
0
    def __init__(self, io, params_read, params_write, parent):
        super(ParamDialog, self).__init__(parent)

        self.setWindowTitle('Options for %s' % (io.name or io.__name__))
        self.io = io

        self.setModal(True)
        self.mainLayout = QVBoxLayout()
        self.setLayout(self.mainLayout)

        buttons = QDialogButtonBox(QDialogButtonBox.Ok
                                   | QDialogButtonBox.Cancel)
        self.connect(buttons, SIGNAL("accepted()"), SLOT("accept()"))
        self.connect(buttons, SIGNAL("rejected()"), SLOT("reject()"))

        self.read_params_edit = None
        self.read_params = params_read
        if valid_params(io.read_params):
            params = self.neo_to_guidata(io.read_params.values()[0],
                                         self.read_params)
            self.read_params_edit = DataSetEditGroupBox("Read",
                                                        params,
                                                        show_button=False)
            self.mainLayout.addWidget(self.read_params_edit)

        self.write_params_edit = None
        self.write_params = params_write
        if valid_params(io.write_params):
            params = self.neo_to_guidata(io.write_params.values()[0],
                                         self.write_params)
            self.write_params_edit = DataSetEditGroupBox("Write",
                                                         params,
                                                         show_button=False)
            self.mainLayout.addWidget(self.write_params_edit)

        self.mainLayout.addWidget(buttons)
Exemplo n.º 19
0
    def setup_widget(self, title):
        #---Create the plot widget:
        self.plot = CurvePlot(self)
        self.curve_item = make.curve([], [], color='b')
        self.plot.add_item(self.curve_item)
        self.plot.set_antialiasing(True)
        #---

        button = QPushButton(u"Test filter: %s" % title)
        self.connect(button, SIGNAL('clicked()'), self.process_data)
        vlayout = QVBoxLayout()
        vlayout.addWidget(self.plot)
        vlayout.addWidget(button)
        self.setLayout(vlayout)

        self.update_curve()
Exemplo n.º 20
0
    def start_timed_session_button(self):

        if not self.timeout:
            self.sessiontype = 'timed'
            self.timer.initialize( self.appsettings.dataset.timedsession * 60 )
            # the session will start after 'X' seconds
            X = 20
            self.timeout = QTimer( self )
            self.connect( self.timeout, SIGNAL( 'timeout()' ), self.session_start )
            self.timeout.setSingleShot(True)
            self.timeout.start(X*1000)
            self.logmessage('The session will start in %d seconds.' % X)
        else:
             # the button is pressed a second time
            self.timeout.stop()
            self.timeout = None
            self.session_start()
Exemplo n.º 21
0
    def _setup_menu(self):
        # File menu
        file_menu = self.menuBar().addMenu(_("File"))
        settings_action = create_action(self, _("Settings"),
                                   icon=get_icon('settings.png'),
                                   tip=_("Settings"),
                                   triggered=self.edit_settings)
        quit_action = create_action(self, _("Quit"),
                                    shortcut="Ctrl+Q",
                                    icon=get_std_icon("DialogCloseButton"),
                                    tip=_("Quit application"),
                                    triggered=self.close)
        add_actions(file_menu, (settings_action, None, quit_action))

        # View menu
        view_menu = self.createPopupMenu()
        view_menu.setTitle(_(u"&View"))
        self.menuBar().addMenu(view_menu)

        # Help menu
        help_menu = self.menuBar().addMenu("?")
        about_action = create_action(self, _("About..."),
                                     icon=get_std_icon('MessageBoxInformation'),
                                     triggered=self.about)
        add_actions(help_menu, (about_action,))

        # Base toolbar
        self.connectAction = QAction(QIcon('common/disconnected.png'), 'Connect', self)
        self.connectAction.triggered.connect( self.connect_button )
        self.playAction = QAction(QIcon('common/play.png'), 'Play free', self)
        self.playAction.triggered.connect( self.start_free_session_button )
        self.stopAction = QAction(QIcon('common/stop.png'), 'Stop', self)
        self.stopAction.triggered.connect( self.stop_button )
        self.timedAction = QAction(QIcon('common/timed.png'), 'Start', self)
        self.timedAction.triggered.connect( self.start_timed_session_button )

        self.toolbar = self.addToolBar('Controls')
        self.toolbar.addAction( self.connectAction )
        self.toolbar.addAction( self.playAction )
        self.toolbar.addAction( self.stopAction )
        self.toolbar.addAction( self.timedAction )
        self.toolbar.setObjectName('Controls')

        # Time toolbar
        self.timer = Timer( self )
        self.connect( self.timer, SIGNAL( 'SessionStop' ), self.session_stop )
Exemplo n.º 22
0
 def connect_button(self):
     # The connect button is first trying to open the com port. If the port can be opened,
     # the zephyr protocol functions are instancied and a message is send to the device
     # (the thread is started for this purpose and to let the reception of the response).
     # The device has 3 seconds to respond (a timeout is started to close the serial
     # and terminate the thread in case of no response). When the device responds a signal 'Message'
     # is sent to the GUI (the message is the Serial Number of the device).
     if self.zephyr_connect.connectTo( self.appsettings.dataset.serialport,
                                       self.appsettings.dataset.use_virtual_serial):
         self.zephyr_connect.start()
         if self.appsettings.dataset.use_virtual_serial is False:
             self.timeout = QTimer( self )
             self.connect( self.timeout, SIGNAL( 'timeout()' ), self.connectionTimeout )
             self.timeout.setSingleShot(True)
             self.timeout.start(3000)
         else:
             self.logmessage("Serial virtualization in use.")
             self._toggle_connect_button()
     else:
         self.logmessage( "Fail to open port '%s' !" % self.appsettings.dataset.serialport, 'error' )
Exemplo n.º 23
0
 def create_plot(self, options):
     logo_path = configtools.get_image_file_path("guiqwt.svg")
     logo = QtGui.QLabel()
     logo.setPixmap(QtGui.QPixmap(logo_path))
     logo.setAlignment(QtCore.Qt.AlignCenter)
     self.plot_layout.addWidget(logo, 1, 1)
     logo_txt = QtGui.QLabel("Powered by <b>guiqwt</b>")
     logo_txt.setAlignment(QtCore.Qt.AlignHCenter | QtCore.Qt.AlignTop)
     self.plot_layout.addWidget(logo_txt, 2, 1)
     self.stamp_gbox = gdq.DataSetEditGroupBox("Dots", DotArrayParam)
     try:
         # guiqwt v3:
         self.stamp_gbox.SIG_APPLY_BUTTON_CLICKED.connect(self.apply_params)
     except AttributeError:
         # guiqwt v2:
         from guidata.qt.QtCore import SIGNAL
         self.connect(self.stamp_gbox, SIGNAL("apply_button_clicked()"),
                      self.apply_params)
     self.plot_layout.addWidget(self.stamp_gbox, 0, 1)
     options = dict(title="Main plot")
     gqp.ImageDialog.create_plot(self, options, 0, 0, 3, 1)
Exemplo n.º 24
0
    def __init__(self):
        QThread.__init__(self)
        self.running = False
        self.tsc = TimeSeriesContainer()
        self.timer = QTimer()
        self.seconds_elapsed = 0
        self.timer.timeout.connect( self.counter_seconds )

        self.zephyr_connect = ZephyrDevice()
        self.zephyr_connect.connectTo(4)
        
        self.connect( self.zephyr_connect, SIGNAL( 'Message' ), self.printmessage )
        self.connect( self.zephyr_connect, SIGNAL( 'newRRI' ), self.addRR )
        self.connect( self.zephyr_connect, SIGNAL( 'newBW' ), self.addBW )
        self.connect( self.zephyr_connect, SIGNAL( 'heart_rate' ), self.add_heart_rate )
        self.connect( self.zephyr_connect, SIGNAL( 'respiration_rate' ), self.add_respiration_rate )
        self.connect( self.zephyr_connect, SIGNAL( 'breathing_wave_amplitude' ), self.add_breathing_wave_amplitude )
        self.connect( self.zephyr_connect, SIGNAL( 'activity' ), self.add_activity )
        self.connect( self.zephyr_connect, SIGNAL( 'posture' ), self.add_posture )

        self.db = influxdb.InfluxDBClient('10.0.0.25', 8086, 'root', 'root', 'rrintervals')

        self.starttime = time.time()*1000
        self.accval = 0
Exemplo n.º 25
0
 def extractArray(self):
     self.emit(SIGNAL("EXTRACT_ARRAY"))
Exemplo n.º 26
0
    def __init__(self):
        # init main panel
        QMainWindow.__init__(self)
        Thread.__init__(self)
        widget = QWidget()
        self.setCentralWidget(widget)

        # define main objects
        self.remoteKoala = None
        self.aberrationCorrection = None
        self.stackDistance = None
        self.tracking = None
        self.db = None
        self.focusPoint = None
        self.trackingMode = 0  # 0 - Automatic, 1 - Single
        self.unwrapK = None
        self.setWindowTitle('3D tracking')

        # init dataset from gui_construction
        self.gb_dhm = DataSetEditGroupBox("DHM",
                                          gui_construction.DHMParameters,
                                          comment='')
        self.gb_sample = DataSetEditGroupBox("Sample",
                                             gui_construction.SampleParameters,
                                             comment='')
        self.gb_remote = DataSetEditGroupBox("Sequence",
                                             gui_construction.RemoteParameters,
                                             comment='')
        self.gb_holder = DataSetEditGroupBox("Focus",
                                             gui_construction.HolderParameters,
                                             comment='')
        self.gb_rec = DataSetEditGroupBox(
            "Preprocessing Parameters",
            gui_construction.ReconstructionParameters,
            comment='')
        #        self.gb_proc = DataSetEditGroupBox("Process",
        #                    gui_construction.ProcessParameters, comment='')
        #        self.gb_partchoice = DataSetEditGroupBox("Particle Choice",
        #                    gui_construction.ParticuleChoice, comment='')

        # associate events to dataset apply buttons
        self.connect(self.gb_dhm, SIGNAL("apply_button_clicked()"),
                     self.update_dhm_params)
        self.connect(self.gb_sample, SIGNAL("apply_button_clicked()"),
                     self.update_sample_params)
        self.connect(self.gb_remote, SIGNAL("apply_button_clicked()"),
                     self.update_remote_params)
        self.connect(self.gb_holder, SIGNAL("apply_button_clicked()"),
                     self.update_holder_params)

        # organize the subpanels
        splitter1 = QSplitter(QtCore.Qt.Vertical)
        splitter1.addWidget(self.gb_dhm)
        splitter1.addWidget(self.gb_sample)
        splitter1.addWidget(self.gb_remote)
        splitter1.addWidget(self.gb_holder)

        splitter2 = QSplitter(QtCore.Qt.Vertical)

        splitter = QSplitter(self)
        splitter.addWidget(splitter1)
        splitter.addWidget(splitter2)
        self.setCentralWidget(splitter)
        self.setContentsMargins(10, 5, 10, 5)

        # get all params from datasets
        self.gb_dhm.get()
Exemplo n.º 27
0
    def __init__(self, parent=None):
        log_conf = get_logging_config()

        QSplitter.__init__(self, parent)
        self.setWindowTitle(MAIN_WINDOW_TITLE)
        self.setWindowIcon(get_icon("agent.svg"))

        self.sysTray = SystemTray(self)

        self.connect(self.sysTray,
                     SIGNAL("activated(QSystemTrayIcon::ActivationReason)"),
                     self.__icon_activated)

        checks = get_checks()
        datadog_conf = DatadogConf(get_config_path())
        self.create_logs_files_windows(log_conf)

        listwidget = QListWidget(self)
        listwidget.addItems([
            osp.basename(check.module_name).replace("_", " ").title()
            for check in checks
        ])

        self.properties = PropertiesWidget(self)

        self.setting_button = QPushButton(get_icon("info.png"),
                                          "Logs and Status", self)
        self.menu_button = QPushButton(get_icon("settings.png"), "Actions",
                                       self)
        self.settings = [
            ("Forwarder Logs", lambda: [
                self.properties.set_log_file(self.forwarder_log_file),
                self.show_html(self.properties.group_code, self.properties.
                               html_window, False)
            ]),
            ("Collector Logs", lambda: [
                self.properties.set_log_file(self.collector_log_file),
                self.show_html(self.properties.group_code, self.properties.
                               html_window, False)
            ]),
            ("Dogstatsd Logs", lambda: [
                self.properties.set_log_file(self.dogstatsd_log_file),
                self.show_html(self.properties.group_code, self.properties.
                               html_window, False)
            ]),
            ("JMX Fetch Logs", lambda: [
                self.properties.set_log_file(self.jmxfetch_log_file),
                self.show_html(self.properties.group_code, self.properties.
                               html_window, False)
            ]),
        ]

        if Platform.is_windows():
            self.settings.extend([
                ("Service Logs", lambda: [
                    self.properties.set_log_file(self.service_log_file),
                    self.show_html(self.properties.group_code, self.properties.
                                   html_window, False)
                ]),
            ])

        self.settings.extend([
            ("Agent Status", lambda: [
                self.properties.html_window.setHtml(self.properties.html_window
                                                    .latest_status()),
                self.show_html(self.properties.group_code, self.properties.
                               html_window, True),
                self.properties.set_status()
            ]),
        ])

        self.agent_settings = QPushButton(get_icon("edit.png"), "Settings",
                                          self)
        self.connect(
            self.agent_settings, SIGNAL("clicked()"), lambda: [
                self.properties.set_datadog_conf(datadog_conf),
                self.show_html(self.properties.group_code, self.properties.
                               html_window, False)
            ])

        self.setting_menu = SettingMenu(self.settings)
        self.connect(
            self.setting_button, SIGNAL("clicked()"),
            lambda: self.setting_menu.popup(
                self.setting_button.mapToGlobal(QPoint(0, 0))))

        self.manager_menu = Menu(self)
        self.connect(
            self.menu_button, SIGNAL("clicked()"),
            lambda: self.manager_menu.popup(
                self.menu_button.mapToGlobal(QPoint(0, 0))))

        holdingBox = QGroupBox("", self)
        Box = QVBoxLayout(self)
        Box.addWidget(self.agent_settings)
        Box.addWidget(self.setting_button)
        Box.addWidget(self.menu_button)
        Box.addWidget(listwidget)
        holdingBox.setLayout(Box)

        self.addWidget(holdingBox)
        self.addWidget(self.properties)

        self.connect(self.properties.enable_button, SIGNAL("clicked()"),
                     lambda: enable_check(self.properties))

        self.connect(self.properties.disable_button, SIGNAL("clicked()"),
                     lambda: disable_check(self.properties))

        self.connect(self.properties.save_button, SIGNAL("clicked()"),
                     lambda: save_file(self.properties))

        self.connect(
            self.properties.refresh_button, SIGNAL("clicked()"), lambda: [
                self.properties.set_log_file(self.properties.current_file),
                self.properties.html_window.setHtml(self.properties.html_window
                                                    .latest_status())
            ])

        self.connect(
            listwidget, SIGNAL('currentRowChanged(int)'), lambda row: [
                self.properties.set_item(checks[row]),
                self.show_html(self.properties.group_code, self.properties.
                               html_window, False)
            ])

        listwidget.setCurrentRow(0)

        self.setSizes([150, 1])
        self.setStretchFactor(1, 1)
        self.resize(QSize(950, 600))
        self.properties.set_datadog_conf(datadog_conf)

        self.do_refresh()
Exemplo n.º 28
0
        Arguments: MaskedImageItem object
    :py:data:`guiqwt.signals.SIG_VISIBILITY_CHANGED`
        Emitted for example by panels when their visibility has changed

        Arguments: state (boolean)
    :py:data:`guiqwt.signals.SIG_VALIDATE_TOOL`
        Emitted by an interactive tool to notify that the tool has just been 
        "validated", i.e. <ENTER>, <RETURN> or <SPACE> was pressed

        Arguments: filter
"""
from guidata.qt.QtCore import SIGNAL

# Emitted by plot when an IBasePlotItem object was moved (args: x0, y0, x1, y1)
SIG_ITEM_MOVED = SIGNAL("item_moved(PyQt_PyObject,double,double,double,double)")

# Emitted by plot when a shapes.Marker position changes
SIG_MARKER_CHANGED = SIGNAL("marker_changed(PyQt_PyObject)")

# Emitted by plot when a shapes.Axes position (or the angle) changes
SIG_AXES_CHANGED = SIGNAL("axes_changed(PyQt_PyObject)")

# Emitted by plot when an annotation.AnnotatedShape position changes
SIG_ANNOTATION_CHANGED = SIGNAL("annotation_changed(PyQt_PyObject)")

# Emitted by plot when the a shapes.XRangeSelection range changes
SIG_RANGE_CHANGED = SIGNAL("range_changed(PyQt_PyObject,double,double)")

# Emitted by plot when item list has changed (item removed, added, ...)
SIG_ITEMS_CHANGED = SIGNAL('items_changed(PyQt_PyObject)')
Exemplo n.º 29
0
 def add_option(self, name, action):
     menu_action = self.addAction(name)
     self.connect(menu_action, SIGNAL('triggered()'), action)
     self.options[name] = menu_action
Exemplo n.º 30
0
 def register_tools(self):
     opentool = self.add_tool(OpenImageTool)
     self.connect(opentool, SIGNAL("openfile(QString*)"), self.open_image)
     self.register_all_image_tools()
     self.activate_default_tool()