Пример #1
0
    def __init__(self):
        QMainWindow.__init__(self)
        self.setWindowIcon(get_icon(os.path.join(APP_RESOURCES, 'icons',
                                                  'python.png')))
        self.setupUi(self)
        
        # Redirect output to GUI's QTextEdit
        sys.stdout = OutLog(self.outputTextEdit, sys.stdout)
        sys.stderr = OutLog(self.outputTextEdit, sys.stderr, QColor(255,0,0) )
        
        settings = QSettings()
        size = settings.value("MainWindow/Size",
                              QVariant(QSize(600, 500))).toSize()
        self.resize(size)
        position = settings.value("MainWindow/Position",
                                  QVariant(QPoint(0, 0))).toPoint()
        self.move(position)
        self.restoreState(
        settings.value("MainWindow/State").toByteArray())
    
        self.logger = Logger('Zupport.GUIloader')
        self.logger.debugging = settings.value("Logging/debugging").toBool()
         
        # Set up a ZupportManager to deal with the plugins
        self.manager = Manager(self)
        self.plugins = {}

        # Set up the extents menu
        self.extent = ExtentContainer()
        self.menuExtent = QMenu("Extent")
        resolutions = self.extent.resolutions
        self.extenactiongroup = QActionGroup(self.menuExtent)  
        noneaction = QAction("None", self.menuExtent)
        self.extenactiongroup.addAction(noneaction)
        self.menuExtent.addAction(noneaction)
        for resolution in resolutions:
            resolution_text = str(resolution)
            submenu = self.menuExtent.addMenu(resolution_text) 
            self.menuExtent.addMenu(submenu)
            for area in self.extent.get_names(resolution):
                subaction = QAction(str(area) + ": %s" % resolution_text, 
                                    submenu)
                subaction.setCheckable(True)
                self.extenactiongroup.addAction(subaction)
                submenu.addAction(subaction)
        
        noneaction.isChecked()
        self.menuSettings.addMenu(self.menuExtent)
        
        self.actionDebugging_messages.setChecked(self.logger.debugging)

        self.setWindowTitle("Zupport GUI")
        
        self.load_tools()
        
        self.toolTreeWidget.itemSelectionChanged.connect(self.update_ui)
        self.actionDebugging_messages.toggled.connect(self._set_debugging)
        self.menuExtent.triggered.connect(self.update_ui)
        self.actionLoad_tool.triggered.connect(self.show_tool_gui)
        self.toolTreeWidget.doubleClicked.connect(self.show_tool_gui)
Пример #2
0
 def closeEvent(self, event):
     # Closing panels (necessary if at least one of these panels has no
     # parent widget: otherwise, this panel will stay open after the main
     # window has been closed which is not the expected behavior)
     for panel in self.panels:
         self.get_panel(panel).close()
     QMainWindow.closeEvent(self, event)
Пример #3
0
 def closeEvent(self, event):
     # Closing panels (necessary if at least one of these panels has no 
     # parent widget: otherwise, this panel will stay open after the main
     # window has been closed which is not the expected behavior)
     for panel in self.panels:
         self.get_panel(panel).close()
     QMainWindow.closeEvent(self, event)
Пример #4
0
    def __init__(self):
        QMainWindow.__init__(self)

        icons = myIcons()
        self.getIcon = icons.getIcon

        self.setWindowTitle('IRAM GUI')
        self.resize(QSize(1200, 800))
        self.setWindowIcon(self.getIcon('Jupiter'))

        self.measurements = None

        self.centralwidget = CentralWidget(self)
        self.setCentralWidget(self.centralwidget)

        self.HKvalues = self.centralwidget.HKvalues
        self.Controlvalues = self.centralwidget.Controlvalues
        self.sBar = self.centralwidget.sBar

        self.init = False
        self.running = False

        self.measureThread = measure(self)

        self.timer = QTimer()
        self.timer.timeout.connect(self.updateTimer)
        self.timer.start(200)

        self.time = localtime()

        self.closeEvent = self.closeApp
Пример #5
0
    def __init__(self):
        QMainWindow.__init__(self)
        self.setWindowIcon(get_icon(os.path.join(APP_RESOURCES, 'icons',
                                                  'python.png')))
        self.setupUi(self)
        
        # Redirect output to GUI's QTextEdit
        sys.stdout = OutLog(self.outputTextEdit, sys.stdout)
        sys.stderr = OutLog(self.outputTextEdit, sys.stderr, QColor(255,0,0) )
        
        settings = QSettings()
        size = settings.value("MainWindow/Size",
                              QVariant(QSize(600, 500))).toSize()
        self.resize(size)
        position = settings.value("MainWindow/Position",
                                  QVariant(QPoint(0, 0))).toPoint()
        self.move(position)
        self.restoreState(
        settings.value("MainWindow/State").toByteArray())
    
        self.logger = Logger('Zupport.GUIloader')
        self.logger.debugging = settings.value("Logging/debugging").toBool()
         
        # Set up a ZupportManager to deal with the plugins
        self.manager = Manager(self)
        self.plugins = {}

        # Set up the extents menu
        self.extent = ExtentContainer()
        self.menuExtent = QMenu("Extent")
        resolutions = self.extent.resolutions
        self.extenactiongroup = QActionGroup(self.menuExtent)  
        noneaction = QAction("None", self.menuExtent)
        self.extenactiongroup.addAction(noneaction)
        self.menuExtent.addAction(noneaction)
        for resolution in resolutions:
            resolution_text = str(resolution)
            submenu = self.menuExtent.addMenu(resolution_text) 
            self.menuExtent.addMenu(submenu)
            for area in self.extent.get_names(resolution):
                subaction = QAction(str(area) + ": %s" % resolution_text, 
                                    submenu)
                subaction.setCheckable(True)
                self.extenactiongroup.addAction(subaction)
                submenu.addAction(subaction)
        
        noneaction.isChecked()
        self.menuSettings.addMenu(self.menuExtent)
        
        self.actionDebugging_messages.setChecked(self.logger.debugging)

        self.setWindowTitle("Zupport GUI")
        
        self.load_tools()
        
        self.toolTreeWidget.itemSelectionChanged.connect(self.update_ui)
        self.actionDebugging_messages.toggled.connect(self._set_debugging)
        self.menuExtent.triggered.connect(self.update_ui)
        self.actionLoad_tool.triggered.connect(self.show_tool_gui)
        self.toolTreeWidget.doubleClicked.connect(self.show_tool_gui)
Пример #6
0
	def __init__(self):
		QMainWindow.__init__(self)
		self.setWindowTitle("Application example")
		self.groupbox = DataSetEditGroupBox("Standard dataset", OtherDataSet, comment='')
		#self.dialog = guidata.dataset.qtwidgets.DataSetEditDialog(self.groupbox)
		splitter = QSplitter(self)
		splitter.addWidget(self.groupbox)
Пример #7
0
 def __init__(self, reset=False, start_freq=None,
                     bandwidth=None, numpts=None, max_hold=None):
     QMainWindow.__init__(self)
     self.settings = QSettings("Darkstar007", "signal_generator")
     if reset:
         self.settings.clear()
         
     self.setup(start_freq, bandwidth, numpts, max_hold)
Пример #8
0
 def __init__(self, wintitle="guiqwt plot", icon="guiqwt.svg",
              toolbar=False, options=None, parent=None, panels=None):
     if PYQT5:
         super(CurveWindow, self).__init__(parent, wintitle=wintitle,
                 icon=icon, toolbar=toolbar, options=options, panels=panels)
     else:
         QMainWindow.__init__(self, parent)
         CurveWidgetMixin.__init__(self, wintitle=wintitle, icon=icon, 
                                  toolbar=toolbar, options=options,
                                  panels=panels)
Пример #9
0
 def __init__(self, wintitle="guiqwt plot", icon="guiqwt.svg",
              toolbar=False, options=None, parent=None, panels=None):
     if PYQT5:
         super(CurveWindow, self).__init__(parent, wintitle=wintitle,
                 icon=icon, toolbar=toolbar, options=options, panels=panels)
     else:
         QMainWindow.__init__(self, parent)
         CurveWidgetMixin.__init__(self, wintitle=wintitle, icon=icon, 
                                  toolbar=toolbar, options=options,
                                  panels=panels)
Пример #10
0
    def __init__(self):
        QMainWindow.__init__(self)
        self.setWindowTitle("Test")
        a = 600
        self.resize(int(a), int(a / 1.338))

        hlayout = QHBoxLayout()
        central_widget = QWidget(self)
        central_widget.setLayout(hlayout)
        self.setCentralWidget(central_widget)
Пример #11
0
 def __init__(self):
     QMainWindow.__init__(self)
     self.setWindowTitle("Signal filtering 2 (guiqwt)")
     self.setWindowIcon(get_icon('guiqwt.svg'))
     
     hlayout = QHBoxLayout()
     central_widget = QWidget(self)
     central_widget.setLayout(hlayout)
     self.setCentralWidget(central_widget)
     #---guiqwt plot manager
     self.manager = PlotManager(self)
Пример #12
0
    def __init__(self):
        QMainWindow.__init__(self)
        self.setWindowTitle("Signal filtering 2 (guiqwt)")
        self.setWindowIcon(get_icon('guiqwt.svg'))

        hlayout = QHBoxLayout()
        central_widget = QWidget(self)
        central_widget.setLayout(hlayout)
        self.setCentralWidget(central_widget)
        #---guiqwt plot manager
        self.manager = PlotManager(self)
Пример #13
0
    def __init__(self,
                 start_freq,
                 bandwidth,
                 numpts,
                 bg7dev,
                 mdev,
                 max_cycle_count=5,
                 atten_step=2):
        QMainWindow.__init__(self)

        self.setWindowIcon(get_icon('python.png'))
        self.setWindowTitle(APP_NAME + ' ' + VERS + ' Running on ' + bg7dev +
                            ' & ' + mdev)
        dt = QDesktopWidget()
        print(dt.numScreens(), dt.screenGeometry())
        sz = dt.screenGeometry()

        self.resize(QSize(sz.width() * 6 / 10, 256))

        # Welcome message in statusbar:
        status = self.statusBar()
        status.showMessage(
            _("Welcome to the NetworkAnalyser Calibration application!"), 5000)

        self.prog = QProgressBar(self)
        self.prog.setMaximumHeight(32)
        self.mainwidget = self.prog
        self.prog.show()

        self.bg7 = BG7(start_freq, bandwidth, numpts, sport=bg7dev)

        self.reset_data()

        self.fp_micro = serial.Serial(mdev, 115200, timeout=4)

        self.bg7.measurement_progress.connect(self.measurement_progress)
        self.bg7.measurement_complete.connect(self.measurement_complete)

        self.fname = 'cal_' + str(start_freq) + '_' + str(
            bandwidth) + '_' + str(numpts) + '.pkl'

        self.max_cycle_count = max_cycle_count

        self.max_atten_val = 62
        self.atten_val = 0
        self.atten_step = atten_step
        self.update_atten()

        self.count_data = 0
        self.show()
        self.bg7.start()
        print('done BG7 start')
Пример #14
0
    def __init__(self):
        QMainWindow.__init__(self)

        icons = myIcons()
        self.getIcon = icons.getIcon

        self.setWindowTitle('IRAM GUI')
        self.resize(QSize(1200, 800))
        self.setWindowIcon(self.getIcon('Jupiter'))

        self.measurements = None

        self.centralwidget = CentralWidget(self)
        self.setCentralWidget(self.centralwidget)

        self.HKvalues = self.centralwidget.HKvalues
        self.Controlvalues = self.centralwidget.Controlvalues
        self.sBar = self.centralwidget.sBar

        self.init = False
        self.running = False

        try:
            self.dbr = dbr()
            self.dbr.init()
        except:
            self.dum_dbr = dummy_hardware('DBR')
            self.dum_dbr.init()

        try:
            self.sensors = sensors()
            self.sensors.init()
        except:
            self.dum_HK = dummy_hardware('HOUSEKEEPING')
            self.dum_HK.init()

        try:
            self.chopper = chopper()
            self.chopper.init()
        except:
            self.dum_chop = dummy_hardware('CHOPPER')
            self.dum_chop.init()

        self.measureThread = measure(self)

        self.timer = QTimer()
        self.timer.timeout.connect(self.updateTimer)
        self.timer.start(200)

        self.time = localtime()

        self.closeEvent = self.closeApp
Пример #15
0
    def __init__(self):
        QMainWindow.__init__(self)
        self.setWindowIcon(get_icon('python.png'))
        self.setWindowTitle("Application example")

        # Instantiate dataset-related widgets:
        self.groupbox1 = DataSetShowGroupBox("Activable dataset",
                                             ExampleDataSet,
                                             comment='')
        self.groupbox2 = DataSetShowGroupBox("Standard dataset",
                                             AnotherDataSet,
                                             comment='')
        self.groupbox3 = DataSetEditGroupBox("Standard dataset",
                                             OtherDataSet,
                                             comment='')
        self.groupbox4 = DataSetEditGroupBox("Standard dataset",
                                             ExampleMultiGroupDataSet,
                                             comment='')
        self.groupbox3.SIG_APPLY_BUTTON_CLICKED.connect(self.update_window)
        self.update_groupboxes()

        splitter = QSplitter(self)
        splitter.addWidget(self.groupbox1)
        splitter.addWidget(self.groupbox2)
        splitter.addWidget(self.groupbox3)
        splitter.addWidget(self.groupbox4)
        self.setCentralWidget(splitter)
        self.setContentsMargins(10, 5, 10, 5)

        # File menu
        file_menu = self.menuBar().addMenu("File")
        quit_action = create_action(self,
                                    "Quit",
                                    shortcut="Ctrl+Q",
                                    icon=get_std_icon("DialogCloseButton"),
                                    tip="Quit application",
                                    triggered=self.close)
        add_actions(file_menu, (quit_action, ))

        # Edit menu
        edit_menu = self.menuBar().addMenu("Edit")
        editparam1_action = create_action(self,
                                          "Edit dataset 1",
                                          triggered=self.edit_dataset1)
        editparam2_action = create_action(self,
                                          "Edit dataset 2",
                                          triggered=self.edit_dataset2)
        editparam4_action = create_action(self,
                                          "Edit dataset 4",
                                          triggered=self.edit_dataset4)
        add_actions(edit_menu,
                    (editparam1_action, editparam2_action, editparam4_action))
Пример #16
0
 def __init__(self):
     QMainWindow.__init__(self)
     for p in sys.path:
         if exists(p + '/data/DW.png'):
             icon_path = p + '/data/DW.png'
             break
         if exists(p + '/dw/data/DW.png'):
             icon_path = p + '/dw/data/DW.png'
             break
     self.setWindowIcon(get_icon(icon_path))
     self.setWindowTitle(APP_NAME)
     self.resize(QSize(1024, 768))
     self.data = None
    def __init__(self):
        QMainWindow.__init__(self)
        self.setWindowIcon(get_icon('python.png'))
        self.setWindowTitle("P3 Ctrl")
        # Instantiate dataset-related widgets:
        self.group1 = DataSetEditGroupBox("Activable dataset",
                                             Processing, comment='')
        self.group1.SIG_APPLY_BUTTON_CLICKED.connect(self.group1._items[0].hi)
        splitter = QSplitter(self)
        splitter.addWidget(self.group1)

        self.setCentralWidget(splitter)
        self.setContentsMargins(10, 5, 10, 5)
Пример #18
0
    def __init__(self, reset=False, start_freq=None,
                 bandwidth=None, numpts=None, max_hold=None,
                 dev='/dev/ttyUSB0'):
        QMainWindow.__init__(self)
        self.settings = QSettings("Darkstar007", "networkanalyser")
        if reset:
            self.settings.clear()

        self.file_dir = self.settings.value('spectrum/file_dir', os.getenv('HOME'))
        print 'File dir', self.file_dir
        self.dev = dev

        self.setup(start_freq, bandwidth, numpts, max_hold)
    def __init__(self):
        QMainWindow.__init__(self)
        self.setWindowIcon(get_icon('python.png'))
        self.setWindowTitle("P3 Ctrl")
        # Instantiate dataset-related widgets:
        self.group1 = DataSetEditGroupBox("Activable dataset",
                                          Processing,
                                          comment='')
        self.group1.SIG_APPLY_BUTTON_CLICKED.connect(self.group1._items[0].hi)
        splitter = QSplitter(self)
        splitter.addWidget(self.group1)

        self.setCentralWidget(splitter)
        self.setContentsMargins(10, 5, 10, 5)
Пример #20
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()
Пример #21
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()
Пример #22
0
 def __init__(self):
     QMainWindow.__init__(self)
     self.setWindowIcon(get_icon('python.png'))
     self.setWindowTitle("Application example")
     
     # Instantiate dataset-related widgets:
     self.groupbox1 = DataSetShowGroupBox("Activable dataset",
                                          ExampleDataSet, comment='')
     self.groupbox2 = DataSetShowGroupBox("Standard dataset",
                                          AnotherDataSet, comment='')
     self.groupbox3 = DataSetEditGroupBox("Standard dataset",
                                          OtherDataSet, comment='')
     self.groupbox4 = DataSetEditGroupBox("Standard dataset",
                                          ExampleMultiGroupDataSet, comment='')
     self.connect(self.groupbox3, SIGNAL("apply_button_clicked()"),
                  self.update_window)
     self.update_groupboxes()
     
     splitter = QSplitter(self)
     splitter.addWidget(self.groupbox1)
     splitter.addWidget(self.groupbox2)
     splitter.addWidget(self.groupbox3)
     splitter.addWidget(self.groupbox4)
     self.setCentralWidget(splitter)
     self.setContentsMargins(10, 5, 10, 5)
     
     # File menu
     file_menu = self.menuBar().addMenu("File")
     quit_action = create_action(self, "Quit",
                                 shortcut="Ctrl+Q",
                                 icon=get_std_icon("DialogCloseButton"),
                                 tip="Quit application",
                                 triggered=self.close)
     add_actions(file_menu, (quit_action, ))
     
     # Edit menu
     edit_menu = self.menuBar().addMenu("Edit")
     editparam1_action = create_action(self, "Edit dataset 1",
                                       triggered=self.edit_dataset1)
     editparam2_action = create_action(self, "Edit dataset 2",
                                       triggered=self.edit_dataset2)
     editparam4_action = create_action(self, "Edit dataset 4",
                                       triggered=self.edit_dataset4)
     add_actions(edit_menu, (editparam1_action,
                             editparam2_action,
                             editparam4_action))
Пример #23
0
    def __init__(self):
        QMainWindow.__init__(self)

        filename = osp.join(osp.dirname(__file__), "brain.png")
        image1 = make.image(filename=filename, title="Original", colormap='gray')
        
        from guiqwt.tests.image import compute_image
        image2 = make.image(compute_image())
        
        widget = CentralWidget(self)
        self.setCentralWidget(widget)
        
        widget.plot1.add_item(image1)
        widget.plot2.add_item(image2)
        
        toolbar = self.addToolBar("tools")
        widget.manager.add_toolbar(toolbar, id(toolbar))
#        widget.manager.set_default_toolbar(toolbar)
        widget.register_tools()
Пример #24
0
	def __init__(self):
		QMainWindow.__init__(self)
		self.setWindowTitle("Application example")
		file_menu = self.menuBar().addMenu("File")
		quit_action = create_action(self, "Quit",
		                            shortcut="Ctrl+Q",
		                            icon=get_std_icon("DialogCloseButton"),
		                            tip="Quit application",
		                            triggered=self.close)
		add_actions(file_menu, (quit_action,))
		edit_menu = self.menuBar().addMenu("Edit")
		
		self.groupbox = DataSetEditGroupBox("Standard dataset", OtherDataSet, comment='')
		self.groupbox.SIG_APPLY_BUTTON_CLICKED.connect(self.update_window)
		self.display = DataSetEditGroupBox("Read-only dataset", OtherDataSet, comment='')
		
		splitter = QSplitter(self)
		splitter.addWidget(self.groupbox)
		self.setCentralWidget(splitter)
		self.setContentsMargins(10, 5, 10, 5)
Пример #25
0
Файл: gui.py Проект: BD75/mpsrad
    def __init__(self):
        QMainWindow.__init__(self)

        icons = myIcons()
        self.getIcon = icons.getIcon

        self.setWindowTitle('WVR GUI')
        self.resize(QSize(1200, 800))
        self.setWindowIcon(self.getIcon('spectrum'))

        self.measurements = None

        self.centralwidget = CentralWidget(self)
        self.oem = oemWidget(self.centralwidget.tabs, [21, 23])
        self.setCentralWidget(self.centralwidget)

        self.HKvalues = self.centralwidget.HKvalues
        self.Controlvalues = self.centralwidget.Controlvalues
        self.sBar = self.centralwidget.sBar

        self.init = False
        self.running = False

        self.oeminit = False
        self.oemrunning = False

        self.oemThread = measure2(self.oem)
        self.measureThread = measure(self)

        self.timer = QTimer()
        self.timer.timeout.connect(self.updateTimer)
        self.timer.start(200)

        self.time = localtime()

        self.closeEvent = self.closeApp

        self._Tc = 0
        self._Th = 0
Пример #26
0
    def __init__(self):
        QMainWindow.__init__(self)
        self.setWindowTitle(APP_NAME)
        self.setWindowIcon(get_icon('python.png'))
        self.timeout = None

        # used to recognise the checkbox in settings
        self.bhpacketname = {
            'RR':0,
            'BREATHING':1,
            'ECG':2,
            'SUMMARY':3,
            'ACC':4,
        }

        # Welcome message in statusbar:
        status = self.statusBar()
        status.showMessage(_("Zephyr BioHarness 3.0"), 5000)

        self._setup_layout()
        self._setup_menu()
        self._load_settings()
        self._init_objects()
        self.show()
Пример #27
0
    def __init__(self):
        """Instantiate the main window and setup some parameter"""
        QMainWindow.__init__(self)
        for p in sys.path:
            if exists(p + '/data/'):
                self.icon_path = p + '/data/'
                break
            if exists(p + '/dw/data/'):
                self.icon_path = p + '/dw/data/'
                break
        self.setWindowIcon(get_icon(self.icon_path + 'DW.png'))
        self.setWindowTitle(APP_NAME)
        self.resize(QSize(1024, 768))

        # Welcome message in statusbar:
        status = self.statusBar()
        status.showMessage(_("Welcome to Dish Washer! Open a file to start."),
                           7000)

        # File menu & Main toolbar
        self.set_menu()

        # Set central widget:
        self.toolbar = self.addToolBar("Image")
Пример #28
0
    def show(self):
        # QT Stuff
        if self._app is None:
            self._app = QApplication([])
        if self._parentFrame is None:
            self._parentFrame = QMainWindow()

        # self._parentFrame.setWindowIcon(get_icon('python.png'))
        self._parentFrame.setWindowTitle(self.viewname)

         # Add the frame to this frame
        self._parentFrame.setCentralWidget(self.getFrame())
        self._parentFrame.setContentsMargins(10, 5, 10, 5)

        self._parentFrame.show()
        self._forceRefreshFromWidgets()
        self._previousValues = self._dumpValues()
Пример #29
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()
Пример #30
0
    def __init__(self):
        QMainWindow.__init__(self)
        self.setWindowIcon(get_icon('python.png'))
        self.setWindowTitle("PV Loop Simulation")

        pal = QtGui.QPalette()
        role = QtGui.QPalette.Background
        pal.setColor(role, QtGui.QColor(255, 255, 255))
        self.setPalette(pal)

        self.textEdit = QtGui.QLabel('None')

        self.loadButton = QtGui.QPushButton("Load")
        self.loadButton.clicked.connect(self.on_click)
        self.buttonSave = QtGui.QPushButton('Clear Plot', self)
        self.buttonSave.clicked.connect(self.clearPlots)
        #self.connect(self.smoothGB, SIGNAL("apply_button_clicked()"),
        #self.update_window)
        self.table1 = QtGui.QTableWidget()
        self.table2 = QtGui.QTableWidget()

        self.fileName = ''
        self.lastClicked = []
        self.number_plots = 0

        self.pw1 = PG.PlotWidget(name='VTC')
        self.pw1.setLabel('left', 'Volume', units='mL')
        self.pw1.setLabel('bottom', 'Time', units='s')
        self.pw1.setBackground((255, 255, 255))

        self.pw2 = PG.PlotWidget(name='VTC')
        self.pw2.setBackground((255, 255, 255))
        self.pw2.setLabel('left', 'Pressure', units='mmHg')
        self.pw2.setLabel('bottom', 'Time', units='s')

        self.pw3 = PG.PlotWidget(name='PV')
        self.pw3.setBackground((255, 255, 255))
        self.pw3.setLabel('left', 'Pressure', units='mmHg')
        self.pw3.setLabel('bottom', 'Volume', units='ml')

        #horizontalLayout = QtGui.QHBoxLayout(self)
        splitter = QSplitter(QtCore.Qt.Vertical)
        splitter2 = QSplitter(QtCore.Qt.Vertical)
        splitterH = QSplitter(QtCore.Qt.Horizontal)

        splitter.addWidget(self.loadButton)
        splitter.addWidget(self.pw1)
        splitter.addWidget(self.pw2)
        splitter.addWidget(self.pw3)

        splitter2.addWidget(self.table1)
        splitter2.addWidget(self.table2)
        splitter2.addWidget(self.buttonSave)

        splitterH.addWidget(splitter)
        splitterH.addWidget(splitter2)

        self.table1.setRowCount(5)
        self.table1.setColumnCount(2)

        self.table2.setRowCount(8)
        self.table2.setColumnCount(2)

        self.table1.setItem(0, 0,
                            QtGui.QTableWidgetItem("Number of Loops [-]"))
        self.table1.setItem(0, 1, QtGui.QTableWidgetItem("4"))
        self.table1.setItem(1, 0, QtGui.QTableWidgetItem("HR [bpm]"))
        self.table1.setItem(1, 1, QtGui.QTableWidgetItem("70"))
        self.table1.setItem(2, 0, QtGui.QTableWidgetItem("V (LV) start [ml]"))
        self.table1.setItem(2, 1, QtGui.QTableWidgetItem("135"))
        self.table1.setItem(3, 0, QtGui.QTableWidgetItem("Pa start [mmHg]"))
        self.table1.setItem(3, 1, QtGui.QTableWidgetItem("96"))
        self.table1.setItem(4, 0, QtGui.QTableWidgetItem("Pv start [mmHg]"))
        self.table1.setItem(4, 1, QtGui.QTableWidgetItem("6"))

        self.table2.setItem(0, 0, QtGui.QTableWidgetItem("Rp"))
        self.table2.setItem(0, 1, QtGui.QTableWidgetItem("1.3"))
        self.table2.setItem(1, 0, QtGui.QTableWidgetItem("Ra"))
        self.table2.setItem(1, 1, QtGui.QTableWidgetItem("0.1"))
        self.table2.setItem(2, 0, QtGui.QTableWidgetItem("Rin"))
        self.table2.setItem(2, 1, QtGui.QTableWidgetItem("0.08782"))
        self.table2.setItem(3, 0, QtGui.QTableWidgetItem("Ca"))
        self.table2.setItem(3, 1, QtGui.QTableWidgetItem("1.601"))
        self.table2.setItem(4, 0, QtGui.QTableWidgetItem("Cv"))
        self.table2.setItem(4, 1, QtGui.QTableWidgetItem("1.894"))
        self.table2.setItem(5, 0, QtGui.QTableWidgetItem("Vd"))
        self.table2.setItem(5, 1, QtGui.QTableWidgetItem("1.123"))
        self.table2.setItem(6, 0, QtGui.QTableWidgetItem("Emax"))
        self.table2.setItem(6, 1, QtGui.QTableWidgetItem("1.5"))
        self.table2.setItem(7, 0, QtGui.QTableWidgetItem("Emin"))
        self.table2.setItem(7, 1, QtGui.QTableWidgetItem("0.037"))

        self.setCentralWidget(splitterH)

        self.setContentsMargins(10, 5, 10, 5)
        self.setGeometry(100, 100, 1000, 800)

        # File menu
        file_menu = self.menuBar().addMenu("File")
        quit_action = create_action(self,
                                    "Quit",
                                    shortcut="Ctrl+Q",
                                    icon=get_std_icon("DialogCloseButton"),
                                    tip="Quit application",
                                    triggered=self.close)
        add_actions(file_menu, (quit_action, ))
Пример #31
0
 def closeEvent(self, event):
     QMainWindow.closeEvent(self, event)
Пример #32
0
    def __init__(self):
        QMainWindow.__init__(self)
        self.setWindowIcon(get_icon('python.png'))
        self.setWindowTitle("Electric motor simulator")

        # Dataset for editing motor parameters
        self.groupbox1 = DataSetShowGroupBox("Motor parameters",
                                             ExampleDataSet,
                                             comment='')
        self.groupbox2 = DataSetShowGroupBox("Controller parameters",
                                             AnotherDataSet,
                                             comment='')
        self.groupbox3 = DataSetEditGroupBox("Standard dataset",
                                             OtherDataSet,
                                             comment='')
        self.groupbox4 = DataSetEditGroupBox("Standard dataset",
                                             ExampleMultiGroupDataSet,
                                             comment='')
        #self.groupbox3.SIG_APPLY_BUTTON_CLICKED.connect(self.update_window)
        self.update_groupboxes()

        splitter = QSplitter(self)
        splitter.addWidget(self.groupbox1)
        splitter.addWidget(self.groupbox2)
        #splitter.addWidget(self.groupbox3)
        #splitter.addWidget(self.groupbox4)
        self.setCentralWidget(splitter)
        self.setContentsMargins(10, 5, 10, 5)

        # File menu
        file_menu = self.menuBar().addMenu("File")
        quit_action = create_action(self,
                                    "Quit",
                                    shortcut="Ctrl+Q",
                                    icon=get_std_icon("DialogCloseButton"),
                                    tip="Quit application",
                                    triggered=self.close)
        add_actions(file_menu, (quit_action, ))

        # Edit menu
        edit_menu = self.menuBar().addMenu("Edit")
        editparam1_action = create_action(self,
                                          "Edit dataset 1",
                                          triggered=self.edit_dataset1)
        editparam2_action = create_action(self,
                                          "Edit dataset 2",
                                          triggered=self.edit_dataset2)
        editparam4_action = create_action(self,
                                          "Edit dataset 4",
                                          triggered=self.edit_dataset4)
        add_actions(edit_menu,
                    (editparam1_action, editparam2_action, editparam4_action))

        # Toolbar
        tb = self.addToolBar("Tools")
        reset = QAction("Reset", self)
        tb.addAction(reset)
        pause = QAction("Pause", self)
        tb.addAction(pause)
        step = QAction("Step", self)
        tb.addAction(step)
        go = QAction("Go", self)
        tb.addAction(go)
Пример #33
0
    def __init__(self):
        QMainWindow.__init__(self)

        self.stage = None
        self.stopOsci = False
        self.stopMeasure = False

        self.setWindowTitle(APP_NAME)

        ###############
        # Powermeter record
        curveplot_toolbar = self.addToolBar(_("Curve Plotting Toolbar"))
        self.curveWidget1 = DockablePlotWidget(self, CurveWidget,
                                               curveplot_toolbar)
        self.curveWidget1.calcFun.addFun('s', lambda x: x, lambda x: x)
        self.curveWidget1.calcFun.addFun('min', lambda x: x / 60,
                                         lambda x: x * 60)
        self.curveWidget1.calcFun.addFun('hour', lambda x: x / 3600,
                                         lambda x: x * 3600)
        plot1 = self.curveWidget1.get_plot()
        self.signal1 = SignalFT(self, plot=plot1)

        ##############
        # Main window widgets
        self.tabwidget = DockableTabWidget(self)
        #self.tabwidget.setMaximumWidth(500)
        self.maestroUi = MaestroUi(self)
        self.fileUi = FileUi(self)
        self.tabwidget.addTab(self.maestroUi,
                              QIcon('icons/Handyscope_HS4.png'), _("Maestro"))
        self.tabwidget.addTab(self.fileUi, get_icon('filesave.png'), _('File'))
        self.add_dockwidget(self.tabwidget, _("Inst. sett."))
        #        self.setCentralWidget(self.tabwidget)
        self.dock1 = self.add_dockwidget(self.curveWidget1,
                                         title=_("Powermeter"))

        ################
        # connect signals
        self.maestroUi.newPlotData.connect(self.signal1.updatePlot)
        self.curveWidget1.calcFun.idxChanged.connect(self.signal1.funChanged)
        self.fileUi.saveTxtBtn.released.connect(self.saveDataTxt)
        self.fileUi.saveHdfBtn.released.connect(self.saveDataHDF5)
        '''
        self.piUi.startScanBtn.released.connect(self.startMeasureThr)
        self.piUi.stopScanBtn.released.connect(self.stopMeasureThr)
        self.piUi.xAxeChanged.connect(self.tdSignal.updateXAxe)
        self.piUi.xAxeChanged.connect(self.fdSignal.updateXAxe)
        self.piUi.niceBtn.released.connect(self.showMakeNicerWidget)
        self.tiepieUi.scpConnected.connect(self.startOsciThr)
        self.tiepieUi.xAxeChanged.connect(self.osciSignal.updateXAxe)
        self.tiepieUi.yAxeChanged.connect(self.osciSignal.updateYAxe)
        self.tiepieUi.triggLevelChanged.connect(self.osciSignal.setHCursor)
        #self.piUi.centerBtn.released.connect(
        #    lambda x=None: self.piUi.setCenter(self.tdSignal.getVCursor()))
        self.tdSignal.plot.SIG_MARKER_CHANGED.connect(
            lambda x=None: self.piUi.newOffset(self.tdSignal.getVCursor()))

        
        self.tdWidget.calcFun.idxChanged.connect(self.tdSignal.funChanged)
        self.fdWidget.calcFun.idxChanged.connect(self.fdSignal.funChanged)

        self.updateOsciPlot.connect(self.osciSignal.updatePlot)
        self.updateTdPlot.connect(self.tdSignal.updatePlot)
        self.updateFdPlot.connect(lambda data:
            self.fdSignal.updatePlot(self.fdSignal.computeFFT(data)))
        '''
        ################
        # create threads
        #self.osciThr = GenericThread(self.getOsciData)
        '''
        self.osciThr = QThread()
        self.osciThr.start()
        self.osciWorker = GenericWorker(self.getOsciData)
        self.osciWorker.moveToThread(self.osciThr)
        
        #self.measureThr = GenericThread(self.getMeasureData)
        self.measureThr = QThread()
        self.measureThr.start()
        self.measureWorker = GenericWorker(self.getMeasureData)
        self.measureWorker.moveToThread(self.measureThr)
        '''

        ################
        # File menu
        file_menu = self.menuBar().addMenu(_("File"))
        self.quit_action = create_action(
            self,
            _("Quit"),
            shortcut="Ctrl+Q",
            icon=get_std_icon("DialogCloseButton"),
            tip=_("Quit application"),
            triggered=self.close)
        saveData = create_action(self,
                                 _("Save"),
                                 shortcut="Ctrl+S",
                                 icon=get_std_icon("DialogSaveButton"),
                                 tip=_("Save data"),
                                 triggered=self.saveDataHDF5)
        #add_actions(file_menu, (triggerTest_action, saveData, None, self.quit_action))

        ##############
        # Eventually add an internal console (requires 'spyderlib')
        self.sift_proxy = SiftProxy(self)
        if DockableConsole is None:
            self.console = None
        else:
            import time, scipy.signal as sps, scipy.ndimage as spi
            ns = {
                'ftir': self.sift_proxy,
                'np': np,
                'sps': sps,
                'spi': spi,
                'os': os,
                'sys': sys,
                'osp': osp,
                'time': time
            }
            msg = "Example: ftir.s[0] returns signal object #0\n"\
                  "Modules imported at startup: "\
                  "os, sys, os.path as osp, time, "\
                  "numpy as np, scipy.signal as sps, scipy.ndimage as spi"
            self.console = DockableConsole(self, namespace=ns, message=msg)
            self.add_dockwidget(self.console, _("Console"))
            '''
            try:
                self.console.interpreter.widget_proxy.sig_new_prompt.connect(
                                            lambda txt: self.refresh_lists())
            except AttributeError:
                print('sift: spyderlib is outdated', file=sys.stderr)
            '''

        # Show main window and raise the signal plot panel
        self.show()
Пример #34
0
 def __init__(self, parent=None):
     QMainWindow.__init__(self, parent)
     self.thoth = Thoth()
     self._setup()
     self.file_menu_action = []
     self.console = None
Пример #35
0
    def __init__(self):
        QMainWindow.__init__(self)

        self.stage = None
        self.stopOsci = False
        self.stopMeasure = False
        
        self.setWindowTitle(APP_NAME)

        ###############
        # Osci live
        curveplot_toolbar = self.addToolBar(_("Curve Plotting Toolbar"))
        self.osciCurveWidget = DockablePlotWidget(self, CurveWidget,
                                              curveplot_toolbar)
        self.osciCurveWidget.calcFun.addFun('s', lambda x: x,
                                                 lambda x: x)
        self.osciCurveWidget.calcFun.addFun('ms', lambda x: x*1e3,
                                                  lambda x: x*1e-3)
        self.osciCurveWidget.calcFun.addFun('µs', lambda x: x*1e6,
                                                  lambda x: x*1e-6)
        osciPlot = self.osciCurveWidget.get_plot()
        #osciPlot.set_axis_title('bottom', 'Time (s)')
        #osciplot.add_item(make.legend("TR"))
        self.osciSignal = SignalFT(self, plot=osciPlot)
        self.osciSignal.addHCursor(0)
        self.osciSignal.addBounds()
        
        ##############
        # Time domain plot
        self.tdWidget = DockablePlotWidget(self, CurveWidget,
                                              curveplot_toolbar)
        self.tdWidget.calcFun.addFun('fs', lambda x: x,
                                           lambda x: x)
        self.tdWidget.calcFun.addFun('µm', lambda x: x*fsDelay*1e3,
                                           lambda x: x/fsDelay*1e-3)
        self.tdWidget.calcFun.addFun('mm', lambda x: x*fsDelay,
                                           lambda x: x/fsDelay)
        tdPlot = self.tdWidget.get_plot()
        #tdPlot.add_item(make.legend("TR"))
        self.tdSignal  = SignalFT(self, plot=tdPlot)
        self.tdSignal.addVCursor(0)

        ##################
        # Frequency domain plot
        self.fdWidget = DockablePlotWidget(self, CurveWidget,
                                              curveplot_toolbar)
        self.fdWidget.calcFun.addFun('PHz', lambda x: x,
                                            lambda x: x)
        self.fdWidget.calcFun.addFun('THz', lambda x: x*1e3,
                                            lambda x: x*1e-3)
        # x = PHz -> 1e15, µm = 1e-6
        self.fdWidget.calcFun.addFun('µm', lambda x: c0/x*1e-9,
                                           lambda x: c0/x*1e-9)
        self.fdWidget.calcFun.addFun('eV', lambda x: x,
                                           lambda x: x)
        fdplot = self.fdWidget.get_plot()
        #fqdplot.add_item(make.legend("TR"))
        self.fdSignal  = SignalFT(self, plot=fdplot)

        ##############
        # Main window widgets
        self.tabwidget = DockableTabWidget(self)
        #self.tabwidget.setMaximumWidth(500)
        self.tiepieUi = TiePieUi(self)
        self.piUi = PiStageUi(self)
        #self.stage = self.piUi.stage
        self.tabwidget.addTab(self.tiepieUi, QIcon('icons/Handyscope_HS4.png'),
                              _("Osci"))
        self.tabwidget.addTab(self.piUi, QIcon('icons/piController.png'),
                              _("Stage"))
        self.add_dockwidget(self.tabwidget, _("Inst. sett."))
#        self.setCentralWidget(self.tabwidget)
        self.osci_dock = self.add_dockwidget(self.osciCurveWidget,
                                              title=_("Osciloscope"))
        self.td_dock = self.add_dockwidget(self.tdWidget,
                                              title=_("Time Domain"))
        self.fd_dock = self.add_dockwidget(self.fdWidget,
                                              title=_("Frequency Domain"))

        ################
        # connect signals
        self.piUi.startScanBtn.released.connect(self.startMeasureThr)
        self.piUi.stopScanBtn.released.connect(self.stopMeasureThr)
        self.piUi.xAxeChanged.connect(self.tdSignal.updateXAxe)
        self.piUi.xAxeChanged.connect(self.fdSignal.updateXAxe)
        self.piUi.niceBtn.released.connect(self.showMakeNicerWidget)
        self.tiepieUi.scpConnected.connect(self.startOsciThr)
        self.tiepieUi.xAxeChanged.connect(self.osciSignal.updateXAxe)
        self.tiepieUi.yAxeChanged.connect(self.osciSignal.updateYAxe)
        self.tiepieUi.triggLevelChanged.connect(self.osciSignal.setHCursor)
        #self.piUi.centerBtn.released.connect(
        #    lambda x=None: self.piUi.setCenter(self.tdSignal.getVCursor()))
        self.tdSignal.plot.SIG_MARKER_CHANGED.connect(
            lambda x=None: self.piUi.newOffset(self.tdSignal.getVCursor()))

        self.osciCurveWidget.calcFun.idxChanged.connect(self.osciSignal.funChanged)
        self.tdWidget.calcFun.idxChanged.connect(self.tdSignal.funChanged)
        self.fdWidget.calcFun.idxChanged.connect(self.fdSignal.funChanged)

        self.updateOsciPlot.connect(self.osciSignal.updatePlot)
        self.updateTdPlot.connect(self.tdSignal.updatePlot)
        self.updateFdPlot.connect(lambda data:
            self.fdSignal.updatePlot(self.fdSignal.computeFFT(data)))
        
        ################
        # create threads
        #self.osciThr = GenericThread(self.getOsciData)
        self.osciThr = QThread()
        self.osciThr.start()
        self.osciWorker = GenericWorker(self.getOsciData)
        self.osciWorker.moveToThread(self.osciThr)
        
        #self.measureThr = GenericThread(self.getMeasureData)
        self.measureThr = QThread()
        self.measureThr.start()
        self.measureWorker = GenericWorker(self.getMeasureData)
        self.measureWorker.moveToThread(self.measureThr)        
        
        ################
        # File menu
        file_menu = self.menuBar().addMenu(_("File"))
        self.quit_action = create_action(self, _("Quit"), shortcut="Ctrl+Q",
                                    icon=get_std_icon("DialogCloseButton"),
                                    tip=_("Quit application"),
                                    triggered=self.close)
        saveData = create_action(self, _("Save"), shortcut="Ctrl+S",
                                    icon=get_std_icon("DialogSaveButton"),
                                    tip=_("Save data"),
                                    triggered=self.saveData)
        triggerTest_action = create_action(self, _("Stop Osci"),
                                    shortcut="Ctrl+O",
                                    icon=get_icon('fileopen.png'),
                                    tip=_("Open an image"),
                                    triggered=self.stopOsciThr)
        add_actions(file_menu, (triggerTest_action, saveData, None, self.quit_action))
        
        ##############
        # Eventually add an internal console (requires 'spyderlib')
        self.sift_proxy = SiftProxy(self)
        if DockableConsole is None:
            self.console = None
        else:
            import time, scipy.signal as sps, scipy.ndimage as spi
            ns = {'ftir': self.sift_proxy,
                  'np': np, 'sps': sps, 'spi': spi,
                  'os': os, 'sys': sys, 'osp': osp, 'time': time}
            msg = "Example: ftir.s[0] returns signal object #0\n"\
                  "Modules imported at startup: "\
                  "os, sys, os.path as osp, time, "\
                  "numpy as np, scipy.signal as sps, scipy.ndimage as spi"
            self.console = DockableConsole(self, namespace=ns, message=msg)
            self.add_dockwidget(self.console, _("Console"))
            '''
            try:
                self.console.interpreter.widget_proxy.sig_new_prompt.connect(
                                            lambda txt: self.refresh_lists())
            except AttributeError:
                print('sift: spyderlib is outdated', file=sys.stderr)
            '''

        # Show main window and raise the signal plot panel
        self.show()
Пример #36
0
 def __init__(self):
     QMainWindow.__init__(self)
     self.setup()
Пример #37
0
 def __init__(self):
     QMainWindow.__init__(self)
     self.setup()
Пример #38
0
 def closeEvent(self, event):
     self.settings_storage.setValue( 'docksGeometry', self.saveGeometry() )
     self.settings_storage.setValue( 'docksState', self.saveState() )
     QMainWindow.closeEvent(self, event)
Пример #39
0
 def __init__(self, parent=None):
     QMainWindow.__init__(self, parent)
     self.thoth = Thoth()
     self._setup()
     self.file_menu_action = []
     self.console = None
Пример #40
0
class GuidataView(view.GenericView):
    _CONST_Views = ['Splitter', 'Tabs', 'Standard']

    def __init__(self, viewname = '', viewtype ='Standard', qtapp=None):
        super().__init__(viewname)
        self._app = qtapp
        self._frame = None
        self._parentFrame = None
        self._viewtype = viewtype
        self._groupbox = None
        self._previousValues = OrderedDict()

    def getViewType(self):
        return self._viewtype

    viewtype = property(getViewType, doc='The view type, see _CONST_Views for available views. Readonly')

    def setParentView(self, parentview):
        '''
        Set the parent widget associated to this view (GenericView)
        :param parentview:
        :return:
        '''
        if self._parentFrame is not None:
            raise view.ViewInternalError(self, self._viewname, 'Parent was already set')
        # self._parentFrame = parentview.getViewContainer()
        self._parentFrame = parentview

    def show(self):
        # QT Stuff
        if self._app is None:
            self._app = QApplication([])
        if self._parentFrame is None:
            self._parentFrame = QMainWindow()

        # self._parentFrame.setWindowIcon(get_icon('python.png'))
        self._parentFrame.setWindowTitle(self.viewname)

         # Add the frame to this frame
        self._parentFrame.setCentralWidget(self.getFrame())
        self._parentFrame.setContentsMargins(10, 5, 10, 5)

        self._parentFrame.show()
        self._forceRefreshFromWidgets()
        self._previousValues = self._dumpValues()

    def close(self, closeapp=False):
        '''
        Implement the close view in the GerericView class, furthermore  close the QT application which this view belongs
        :param closeapp:
        :return:
        '''
        if self._parentFrame is not None:
            self._parentFrame.close()
            del self._parentFrame
        if self._app is not None and closeapp:
            del self._app

    def getFrame(self):
        '''
        Return the frame containing the presentation, check if the frame was created, otherwise it is created
        :return:
        '''
        if self._frame is None:
            self._generateFrame()
        return self._frame

    def _generateFrame(self):
        '''
        Return the frame containing the presentation, check if the frame was created, otherwise it is created
        :return:
        '''
        # generate the frame if necessary
        if self._frame is None:
            # Generate frame and define the layout based on the frame
            self._frame = QFrame(self._parentFrame)
            _layout = QVBoxLayout()
            self._frame.setLayout(_layout)

            # Add the "Main" group box for this view, if present. It is rendered in foreground
            if self._generateGroupBox() is not None:
                _layout.addWidget(self._groupbox)
            else:
                self._frame.setFrameStyle(QFrame.Panel|QFrame.Raised)
                self._frame.setLineWidth(1)

            # Add to layout eventually the other subview
            if self._viewtype == 'Tabs':
                _tabs = QTabWidget()
                _layout.addWidget(_tabs)
            elif self._viewtype == 'Splitter':
                _splitter =QSplitter()
                _layout.addWidget(_splitter)
            else:
                _sub_frame = QFrame()
                _sub_frame_layout = QHBoxLayout()
                _sub_frame.setLayout(_sub_frame_layout)
                _layout.addWidget(_sub_frame)

            # Add all the sub view as sub frames in the layout
            for sw in self._subViewDictionary.values():
                sw.setParentView(self._frame)
                if self._viewtype == 'Tabs':
                    _tabs.addTab(sw.getFrame(), sw.viewname)
                elif self._viewtype == 'Splitter':
                    _splitter.addWidget(sw.getFrame())
                else:
                    _sub_frame_layout.addWidget(sw.getFrame())

        return self._frame

    def _generateGroupBox(self):
        '''
        Generate if necessary the group box for this
        :return:
        '''
        if self._groupbox is None:
            # from  widgets create the view containing the datasets
            _dataSetView = self._generateGuidataDataset()
            if len(_dataSetView._items) > 0:
                if self._viewtype == 'Tabs':
                    self._groupbox = DataSetEditGroupBox(self.viewname, _dataSetView, comment='')
                else:
                    self._groupbox = DataSetEditGroupBox(self.viewname, _dataSetView, comment='')
                self._groupbox.SIG_APPLY_BUTTON_CLICKED.connect(self._updatedView)

        return self._groupbox

    def getViewContainer(self):
        '''
        This method must be reimplemented returning the proper window/frame etc.. It is based on the GUI implementation
        :return: a reference to the window container
        '''
        return self._parentFrame

    def getQTApp(self):
        '''
        Return the associated QT application, which is mandatory for guidata framework
        :return:
        '''
        return self._app

    def addWidget(self, widgetinstance):
        if not isinstance(widgetinstance, GuidataWidget):
            raise view.WrongWidgetClass(self, self._viewname, widgetinstance, GuidataWidget)
        super().addWidget(widgetinstance)

    def _dumpValues(self):
        widgetvalue = OrderedDict()

        for n, w in self._widgetDictionary.items():
            # I need to store the widget value and NOT the value returned (for example in a combo box I need to store
            # the index, not the value
            # widgetvalue[n] = w.getWidgetValue()
            widgetvalue[n] = GuidataWidget.convertValueToWidgetValue(w, w.getWidgetValue())

        return widgetvalue

    def _updatedViewHook(self):
        # En Widget ' + str(wtry point for a change...

        differences = {}
        differencesConverted = {}
        self._groupbox.get()
        dataset = self._groupbox.dataset

        for n, w in self._widgetDictionary.items():
            # if nameProp in  vars(dataset):
            # TODO: workaround,  the mechanism in the guidata framework is not very well documented.
            # TODO: then in order to get the proper value this is collected through the groupbox insteadm the value.
            # So i check in dataset every nameprop
            nameProp = w.name
            actualValue = getattr(dataset, nameProp) #, w.getWidgetValue())
            prevValue   = self._previousValues.get(n)
            logging.debug('--widgetname=' + w.name)

            if not (prevValue == actualValue):
                differences[n] = actualValue
                differencesConverted[n] = GuidataWidget.convertWidgetValueToValue(w, actualValue)
                #w._setWidgetValueHook(actualValue)
                logging.debug('  DIFFERENCE viewname={0}  prevvalue={1} - newvalue={2}'.format(n, prevValue, actualValue))
                logging.debug('  DIFFERENCE CONVERTED viewname={0}  prevvalue={1} - newvalue={2}'.format
                              (n, GuidataWidget.convertWidgetValueToValue(w, prevValue), differencesConverted[n]))
            else:
                logging.debug('  NO DIFFERENCE viewname={0}  prevvalue={1} - newvalue={2}'.format(n, prevValue, actualValue))

        if len(differences):
            self._forceRefreshToWidgets(differences)
            self._previousValues = self._dumpValues()
        return differencesConverted

    def _forceRefreshToWidgets(self, widget_to_set):
        '''
        A refresh to update the widget with the values stored in the groupbox associated
        This is a workaround relative to the guidata framework. (should be improved)
        :return:
        '''
        if self._groupbox == None:
            return

        #for key, w in self._widgetDictionary.items():
        for wname, valuetoconvert in widget_to_set.items():
            w = self.getWidget(wname)
            if w is None:
                raise RuntimeError('Widget cannot\'t be None')

            # TODO: this is horrible, but need a workaround for guidata to get the value from data set and force it in the GUI
            #valuetoconvert = getattr(self._groupbox.dataset, wname)
            converteddataset = GuidataWidget.convertWidgetValueToValue(w, valuetoconvert)
            logging.debug('For widget['+wname+'] Converted value from '+str(valuetoconvert)+' to ' + str(converteddataset))

            w.setWidgetValue(converteddataset) # Convertire from index to value
            logging.debug('\tValue set is '+str(w.getWidgetValue()))

    def _forceRefreshFromWidgets(self):
        '''
        A refresh to update the whole groupbox with the proper value associated in the widget
        A workaround in the bad documented guidata in order to  force the refresh from the data stored in the widget
        :return:
        '''
        if self._groupbox == None:
            return

        for key, w in self._widgetDictionary.items():
            value = w.getWidgetValue()
            valueconverted = w._getGuidataWidgetValue()
            logging.debug('For widget ['+key+'] Converted value from '+str(value)+' to ' + str(valueconverted))
            setattr(self._groupbox.dataset, key, valueconverted)
            logging.debug('\tRead back value  '+str(getattr(self._groupbox.dataset, key)))

        #PROBLEM IN GET!!! se faccio la get nelle combo box setto il valore del ITEM id e non del valore vero
        # in prarice il setattr dovrebbe settare l'ITEM ID per le combo box
        self._groupbox.get()

    def _userWidgetUpdatedHandler(self, sender):
        # WORKAROUND: the guidata need to be forced to update  the UI if the underlay widget is changed
        if not isinstance(sender, widget.GenericWidget):
            raise view.WrongWidgetClass(self,self.viewname, sender, widget.GenericWidget)
        self._forceRefreshFromWidgets()

        super()._userWidgetUpdatedHandler(sender)

    def _generateGuidataDataset(self):
        class DataSetView(DataSet):
            key = None
            value = None
            for key, value in self._widgetDictionary.items():
                locals()[key] = value.getDataSet()
            del key, value
        return DataSetView
Пример #41
0
 def __init__(self, TestGUI=True):
     QMainWindow.__init__(self)
     self.setup(TestGUI)
Пример #42
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()
Пример #43
0
 def __init__(self, parent = None):
     QMainWindow.__init__(self, parent)
     self.console = None
     self.setup()