Пример #1
0
    def __init__(self, empty: bool = False):
        QMdiSubWindow.__init__(self)
        self.setWindowFlag(Qt.WindowMaximizeButtonHint, False)
        if not empty:
            self.setLayout(QHBoxLayout())
            self.main_frame = EasyFrame()
            self.main_frame.setMouseTracking(True)
            super().layout().addWidget(self.main_frame)
            self.main_frame.setLayout(QGridLayout())
            self.layout = self.new_layout

            self._icon = QIcon(image_file_path + "rs_icon.png")
            self.setWindowIcon(self._icon)
Пример #2
0
    def button_test_1(self):
        print("button 1 pressed")
        msg_box = QDialog()
        # msg_box.setModal(True)
        msg_box.setWindowTitle("Test message box")
        # msg_box.setText("This is a message")
        test_frame = EasyFrame()
        test_layout = QVBoxLayout(test_frame)

        test_button = ClickAnimationButton(test_frame)
        test_button.setText("test button")
        test_button.clicked.connect(self.button_test_2)

        test_layout.addWidget(test_button)

        # msg_box.layout().addWidget(test_layout)
        # msg_box.setStandardButtons(QMessageBox.Ok)
        msg_box.setLayout(test_layout)

        # msg_box.exec_()
        msg_box.exec()
Пример #3
0
    def __init__(self,
                 name: str = "VOG_NONE",
                 log_handlers: [StreamHandler] = None):
        self._logger = getLogger(__name__)
        if log_handlers:
            for h in log_handlers:
                self._logger.addHandler(h)
        self._logger.debug("Initializing")
        super().__init__(name)
        """ Min size for the VOG window """
        self._subwindow_height = 222
        self._subwindow_width = 518
        """ min and max sizes for the configuration popup (width, height) """
        self._popup_min = (229, 409)
        self._popup_max = (300, 409)
        """ Set configuration value display area"""
        self._config_frame = EasyFrame()
        self._config_vertical_layout = QVBoxLayout(self._config_frame)
        self._config_label = QLabel(self._config_frame)
        self._config_label.setAlignment(Qt.AlignCenter)
        self._config_val_line_edit = QLineEdit(self._config_frame)
        self._config_val_line_edit.setAlignment(Qt.AlignCenter)

        self._config_vertical_layout.addWidget(self._config_label)
        self._config_vertical_layout.addWidget(self._config_val_line_edit)
        """ Set preset button selection area. """
        self._nhtsa_button = ClickAnimationButton()
        self._eblindfold_button = ClickAnimationButton()
        self._direct_control_button = ClickAnimationButton()
        """ Set open duration, close duration, and debounce time settings display area. """
        self._input_box_frame = EasyFrame()
        self._input_box_grid_layout = QGridLayout(self._input_box_frame)
        self._input_box_grid_layout.setContentsMargins(0, 6, 0, 6)

        self._open_dur_label = QLabel(self._input_box_frame)
        self._open_dur_line_edit = QLineEdit(self._input_box_frame)
        self._open_dur_line_edit.setFixedWidth(80)
        self._open_inf_check_box = QCheckBox(self._input_box_frame)

        self._close_dur_label = QLabel(self._input_box_frame)
        self._close_dur_line_edit = QLineEdit(self._input_box_frame)
        self._close_dur_line_edit.setFixedWidth(80)
        self._close_inf_check_box = QCheckBox(self._input_box_frame)

        self._debounce_label = QLabel(self._input_box_frame)
        self._debounce_time_line_edit = QLineEdit(self._input_box_frame)
        self._debounce_time_line_edit.setFixedWidth(80)

        self._input_box_grid_layout.addWidget(self._open_dur_label, 0, 0, 1, 1)
        self._input_box_grid_layout.addWidget(self._open_dur_line_edit, 0, 1,
                                              1, 1)
        self._input_box_grid_layout.addWidget(self._open_inf_check_box, 0, 2,
                                              1, 1)
        self._input_box_grid_layout.addWidget(self._close_dur_label, 1, 0, 1,
                                              1)
        self._input_box_grid_layout.addWidget(self._close_dur_line_edit, 1, 1,
                                              1, 1)
        self._input_box_grid_layout.addWidget(self._close_inf_check_box, 1, 2,
                                              1, 1)
        self._input_box_grid_layout.addWidget(self._debounce_label, 2, 0, 1, 1)
        self._input_box_grid_layout.addWidget(self._debounce_time_line_edit, 2,
                                              1, 1, 1)
        """ Set button mode setting display area. """
        self._button_mode_frame = EasyFrame()
        self._button_mode_horiz_layout = QGridLayout(self._button_mode_frame)
        self._button_mode_horiz_layout.setContentsMargins(0, 6, 0, 6)
        self._button_mode_label = QLabel(self._button_mode_frame)
        self._button_mode_selector = QComboBox(self._button_mode_frame)

        self._button_mode_selector.addItem("")
        self._button_mode_selector.addItem("")

        self._button_mode_horiz_layout.addWidget(self._button_mode_label, 0, 0,
                                                 1, 1)
        self._button_mode_horiz_layout.addWidget(self._button_mode_selector, 0,
                                                 1, 1, 1)
        """ Set control mode setting display area. """
        self._control_mode_label = QLabel(self._button_mode_frame)
        self._control_mode_selector = QComboBox(self._button_mode_frame)

        self._control_mode_selector.addItem("")
        self._control_mode_selector.addItem("")

        self._button_mode_horiz_layout.addWidget(self._control_mode_label, 1,
                                                 0, 1, 1)
        self._button_mode_horiz_layout.addWidget(self._control_mode_selector,
                                                 1, 1, 1, 1)
        """ Set upload button selection area. """
        self._upload_settings_button = ClickAnimationButton()
        """ Set manual control selection area. """
        self._manual_control_button_frame = EasyFrame()
        self._manual_control_button_layout = QHBoxLayout(
            self._manual_control_button_frame)

        self._manual_control_open_button = ClickAnimationButton()
        self._manual_control_close_button = ClickAnimationButton()

        self._manual_control_button_layout.addWidget(
            self._manual_control_open_button)
        self._manual_control_button_layout.addWidget(
            self._manual_control_close_button)
        self._manual_control_button_layout.setMargin(0)
        """ device settings display """
        self._dev_sets_frame = EasyFrame()

        self._dev_sets_layout = QVBoxLayout(self._dev_sets_frame)

        self.config_button = ClickAnimationButton()
        self.config_button.clicked.connect(self._config_button_handler)

        self._config_win = ConfigPopUp()
        self._config_win.setMinimumSize(self._popup_min[0], self._popup_min[1])
        self._config_win.setMaximumSize(self._popup_max[0], self._popup_max[1])
        self._config_win.setLayout(self._dev_sets_layout)
        """ Add widgets to layout. """
        self._dev_sets_layout.addWidget(self._config_frame)
        self._dev_sets_layout.addWidget(self._input_box_frame)
        self._dev_sets_layout.addWidget(self._button_mode_frame)
        self._dev_sets_layout.addWidget(self._nhtsa_button)
        self._dev_sets_layout.addWidget(self._eblindfold_button)
        self._dev_sets_layout.addWidget(self._direct_control_button)
        self._dev_sets_layout.addWidget(self._upload_settings_button)

        self.layout().addWidget(self.config_button, 0, 0,
                                Qt.AlignTop | Qt.AlignRight)
        self.config_button.setFixedSize(30, 25)

        self.layout().addWidget(self._manual_control_button_frame, 0, 0,
                                Qt.AlignBottom | Qt.AlignLeft)
        self._manual_control_open_button.setFixedSize(70, 25)
        self._manual_control_close_button.setFixedSize(70, 25)

        self.layout().setMargin(0)

        self._strings = dict()
        self._lang_enum = LangEnum.ENG
        self.setMinimumSize(self._subwindow_width, self._subwindow_height)
        self.resize(self._subwindow_width, self._subwindow_height)
        self._logger.debug("Initialized")
Пример #4
0
    def __init__(self,
                 name: str = "CAM_NONE",
                 log_handlers: [StreamHandler] = None):
        self._logger = getLogger(__name__)
        if log_handlers:
            for h in log_handlers:
                self._logger.addHandler(h)
        self._logger.debug("Initializing")
        super().__init__(name)
        """ Min size for cam window """
        self._subwindow_height = 222
        self._subwindow_width = 518

        self._initialization_bar_frame = EasyFrame()
        self._initialization_bar_frame.setMouseTracking(True)
        self._initialization_bar_frame.setMaximumHeight(70)
        self._initialization_bar_layout = QVBoxLayout(
            self._initialization_bar_frame)

        self._initialization_bar_label = QLabel(self._initialization_bar_frame)
        self._initialization_bar_label.setMouseTracking(True)
        self._initialization_bar = QProgressBar(self._initialization_bar_frame)
        self._initialization_bar.setMouseTracking(True)
        self._initialization_bar.setMaximumHeight(15)
        self._initialization_bar.setTextVisible(True)
        self._initialization_bar.setAlignment(Qt.AlignHCenter)

        self._initialization_bar_layout.addWidget(
            self._initialization_bar_label)
        self._initialization_bar_layout.addWidget(self._initialization_bar)

        self._cam_settings_frame = EasyFrame()
        self._cam_settings_layout = QGridLayout(self._cam_settings_frame)

        self._resolution_selector_label = QLabel(self._cam_settings_frame)
        self._resolution_selector_label.setAlignment(Qt.AlignLeft)

        self._resolution_selector = QComboBox(self._cam_settings_frame)
        self._resolution_selector.setMaximumHeight(22)

        self._cam_settings_layout.addWidget(self._resolution_selector_label, 0,
                                            0)
        self._cam_settings_layout.addWidget(self._resolution_selector, 0, 1)

        self._fps_selector_label = QLabel(self._cam_settings_frame)
        self._fps_selector_label.setAlignment(Qt.AlignLeft)

        self._fps_selector = QComboBox(self._cam_settings_frame)
        self._fps_selector.setMaximumHeight(22)

        self._cam_settings_layout.addWidget(self._fps_selector_label, 1, 0)
        self._cam_settings_layout.addWidget(self._fps_selector, 1, 1)

        self._show_feed_checkbox_label = QLabel(self._cam_settings_frame)
        self._show_feed_checkbox_label.setAlignment(Qt.AlignLeft)

        self._show_feed_checkbox = QCheckBox()
        self._show_feed_checkbox.setChecked(True)
        self._show_feed_checkbox.setLayoutDirection(Qt.RightToLeft)

        self._cam_settings_layout.addWidget(self._show_feed_checkbox_label, 2,
                                            0)
        self._cam_settings_layout.addWidget(self._show_feed_checkbox, 2, 1)

        self._use_cam_checkbox_label = QLabel(self._cam_settings_frame)
        self._use_cam_checkbox_label.setAlignment(Qt.AlignLeft)

        self._use_cam_checkbox = QCheckBox()
        self._use_cam_checkbox.setChecked(True)
        self._use_cam_checkbox.setLayoutDirection(Qt.RightToLeft)

        self._cam_settings_layout.addWidget(self._use_cam_checkbox_label, 3, 0)
        self._cam_settings_layout.addWidget(self._use_cam_checkbox, 3, 1)

        self._use_overlay_checkbox_label = QLabel(self._cam_settings_frame)
        self._use_overlay_checkbox_label.setAlignment(Qt.AlignLeft)

        self._use_overlay_checkbox = QCheckBox()
        self._use_overlay_checkbox.setChecked(True)
        self._use_overlay_checkbox.setLayoutDirection(Qt.RightToLeft)

        self._cam_settings_layout.addWidget(self._use_overlay_checkbox_label,
                                            4, 0)
        self._cam_settings_layout.addWidget(self._use_overlay_checkbox, 4, 1)

        self._image_display_frame = EasyFrame()
        self._image_display_layout = QVBoxLayout(self._image_display_frame)

        self._image_display_label = QLabel(self._image_display_frame)
        self._image_display_label.setAlignment(Qt.AlignHCenter)
        self._image_display = QLabel(self._image_display_frame)
        self._image_display.setAlignment(Qt.AlignCenter)
        self._image_display.setMouseTracking(True)
        self._image_display_layout.addWidget(self._image_display_label)
        self._image_display_layout.addWidget(self._image_display)

        spacer = QSpacerItem(1, 1, vData=QSizePolicy.Expanding)

        self._dev_sets_frame = EasyFrame()
        self._dev_sets_layout = QVBoxLayout(self._dev_sets_frame)

        self.config_button = ClickAnimationButton()
        self.config_button.clicked.connect(self._config_button_handler)

        self.layout().addWidget(self.config_button, 0, 0,
                                Qt.AlignTop | Qt.AlignRight)
        self.config_button.setFixedSize(30, 25)
        self.config_button.setStyleSheet(
            "background-color: rgba(200, 200, 200, 50%)")

        self._dev_sets_layout.addWidget(self._cam_settings_frame)
        self._dev_sets_layout.addItem(spacer)
        self.layout().addWidget(self._image_display, 0, 0)
        self.layout().addWidget(self._initialization_bar_frame, 0, 0)

        self._config_items = [
            self._resolution_selector,
            self._fps_selector,
            self._use_cam_checkbox,
            self._show_feed_checkbox,
            self._use_overlay_checkbox,
        ]

        config_win_w = 350
        config_win_h = len(self._config_items) * 30

        self.config_button.raise_()

        self._config_win = ConfigPopUp()
        self._config_win.setLayout(self._dev_sets_layout)
        self._config_win.setFixedSize(config_win_w, config_win_h)

        self._rec_label = QLabel()
        self._rec_label.setStyleSheet(
            "background-color: rgba(0, 0, 0, 0%); color: red; font: 20px")
        self._rec_label.hide()

        self.layout().addWidget(self._rec_label, 0, 0,
                                Qt.AlignBottom | Qt.AlignRight)

        self.layout().setMargin(0)

        self._window_changing = False
        self._showing_images = False
        self._hidden = False
        w = 320
        self._aspect_ratio = 9 / 16
        self.resize(w, self.heightForWidth(w))
        self._strings = dict()
        self._lang_enum = LangEnum.ENG
        self.setMinimumSize(self._subwindow_width, self._subwindow_height)
        self.old_size = QSize(self.width(), self.height())

        self._logger.debug("Initialized")
Пример #5
0
    def __init__(self,
                 name: str = "DRT_NONE",
                 log_handlers: [StreamHandler] = None):
        self._logger = getLogger(__name__)
        if log_handlers:
            for h in log_handlers:
                self._logger.addHandler(h)
        self._logger.debug("Initializing")
        super().__init__(name)
        """ Min size for the DRT window """
        self._subwindow_height = 222
        self._subwindow_width = 518
        """ min and max sizes for the configuration popup """
        self._popup_min = (168, 313)
        self._popup_max = (300, 313)
        """ Set configuration value display area """
        self._config_frame = EasyFrame()
        self._config_layout = QVBoxLayout(self._config_frame)

        self._config_label = QLabel(self._config_frame)
        self._config_label.setAlignment(Qt.AlignCenter)

        self._config_val = QLabel(self._config_frame)
        self._config_val.setAlignment(Qt.AlignCenter)

        self._config_layout.addWidget(self._config_label)
        self._config_layout.addWidget(self._config_val)
        """ Set preset button selection area. """
        self._iso_button = ClickAnimationButton()
        """ Set stim intensity settings display area. """
        self._slider_frame = EasyFrame()
        self._slider_layout = QVBoxLayout(self._slider_frame)
        self._slider_label_layout = QHBoxLayout(self._slider_frame)

        self._stim_intens_label = QLabel(self._slider_frame)
        self._stim_intens_label.setAlignment(Qt.AlignLeft)
        self._stim_intens_val = QLabel(self._slider_frame)
        self._stim_intens_val.setAlignment(Qt.AlignRight | Qt.AlignTrailing
                                           | Qt.AlignVCenter)

        self._slider_layout.addLayout(self._slider_label_layout)

        self._stim_intens_slider = QSlider(self._slider_frame)
        self._stim_intens_slider.setMinimum(1)
        self._stim_intens_slider.setMaximum(100)
        self._stim_intens_slider.setSliderPosition(100)
        self._stim_intens_slider.setOrientation(Qt.Horizontal)
        self._stim_intens_slider.setTickPosition(QSlider.TicksBelow)
        self._stim_intens_slider.setTickInterval(10)

        self._slider_label_layout.addWidget(self._stim_intens_label)
        self._slider_label_layout.addWidget(self._stim_intens_val)
        self._slider_layout.addWidget(self._stim_intens_slider)
        """ Set stim duration, upper isi and lower isi settings display area. """
        self._input_box_frame = EasyFrame()
        self._input_box_layout = QGridLayout(self._input_box_frame)

        self._stim_dur_line_edit = QLineEdit(self._input_box_frame)
        self._stim_dur_line_edit.setMaximumSize(QSize(100, 16777215))
        self._stim_dur_label = QLabel(self._input_box_frame)

        self._upper_isi_label = QLabel(self._input_box_frame)
        self._upper_isi_line_edit = QLineEdit(self._input_box_frame)
        self._upper_isi_line_edit.setMaximumSize(QSize(100, 16777215))

        self._lower_isi_line_edit = QLineEdit(self._input_box_frame)
        self._lower_isi_line_edit.setMaximumSize(QSize(100, 16777215))
        self._lower_isi_label = QLabel(self._input_box_frame)

        self._input_box_layout.addWidget(self._stim_dur_line_edit, 0, 1, 1, 1)
        self._input_box_layout.addWidget(self._upper_isi_label, 1, 0, 1, 1)
        self._input_box_layout.addWidget(self._upper_isi_line_edit, 1, 1, 1, 1)
        self._input_box_layout.addWidget(self._stim_dur_label, 0, 0, 1, 1)
        self._input_box_layout.addWidget(self._lower_isi_line_edit, 2, 1, 1, 1)
        self._input_box_layout.addWidget(self._lower_isi_label, 2, 0, 1, 1)
        """ Set upload button selection area. """
        self._upload_settings_button = ClickAnimationButton()
        self._upload_settings_button.setEnabled(False)
        """ device settings display """
        self._dev_sets_frame = EasyFrame()
        self._dev_sets_layout = QVBoxLayout(self._dev_sets_frame)
        self._config_horizontal_layout = QHBoxLayout()

        self.config_button = ClickAnimationButton()
        self.config_button.clicked.connect(self._config_button_handler)

        self.layout().addWidget(self.config_button, 0, 0,
                                Qt.AlignTop | Qt.AlignRight)
        self.config_button.setFixedSize(30, 25)

        self._config_win = ConfigPopUp()
        self._config_win.setMinimumSize(self._popup_min[0], self._popup_min[1])
        self._config_win.setMaximumSize(self._popup_max[0], self._popup_max[1])
        self._config_win.setLayout(self._dev_sets_layout)
        """ Add all of the widgets to the layout. """
        self._dev_sets_layout.addWidget(self._config_frame)
        self._dev_sets_layout.addWidget(self._input_box_frame)
        self._dev_sets_layout.addWidget(self._slider_frame)
        self._dev_sets_layout.addWidget(EasyFrame(line=True))
        self._dev_sets_layout.addWidget(self._iso_button)
        self._dev_sets_layout.addWidget(self._upload_settings_button)

        self.layout().setMargin(0)

        self._strings = dict()
        self._lang_enum = LangEnum.ENG
        self.setMinimumSize(self._subwindow_width, self._subwindow_height)
        self.resize(self._subwindow_width, self._subwindow_height)
        self._logger.debug("Initialized")
Пример #6
0
    def __init__(self):
        QMainWindow.__init__(self)
        self.setFixedSize(300, 200)
        self.setCentralWidget(CentralWidget(self))
        self.myLayout = QHBoxLayout(self)

        self.tab1 = QTabWidget(self)
        self.tab3 = QTabWidget(self)
        self.tab3.setTabPosition(QTabWidget.East)
        self.tab3.tabBarClicked.connect(self.tab_pressed_3)
        self.tab3_minimized = False
        self.tab1.setTabPosition(QTabWidget.East)
        self.tab1.tabBarClicked.connect(self.tab_pressed_1)
        self.tab1_minimized = False

        self.widget1 = EasyFrame()

        self.button1 = ClickAnimationButton()
        self.button1.setText("button 1")
        self.button1.clicked.connect(self.button_test_1)

        self.widget2 = EasyFrame()

        self.button2 = ClickAnimationButton()
        self.button2.setText("button 2")
        self.button2.clicked.connect(self.button_test_2)

        self.widget3 = EasyFrame()

        self.button3 = ClickAnimationButton()
        self.button3.setText("button 3")
        self.button3.clicked.connect(self.button_test_3)

        self.radio_test1 = QRadioButton(self)
        self.radio_test1.setText("radio 1")
        self.radio_test1.toggled.connect(self.radio_toggled_1)

        self.radio_test2 = QRadioButton(self)
        self.radio_test2.setText("radio 2")
        self.radio_test2.toggled.connect(self.radio_toggled_2)

        self.radio_test3 = QRadioButton(self)
        self.radio_test3.setText("radio 3")
        self.radio_test3.toggled.connect(self.radio_toggled_3)

        self.tab1_layout = QVBoxLayout(self.widget1)
        self.tab1_layout.addWidget(self.button1)
        self.tab1_layout.addWidget(self.radio_test1)
        self.tab1_layout.addWidget(self.radio_test2)
        self.tab1_layout.addWidget(self.radio_test3)

        self.tab2_layout = QVBoxLayout(self.widget2)
        self.tab2_layout.addWidget(self.button2)

        self.tab3_layout = QVBoxLayout(self.widget3)
        self.tab3_layout.addWidget(self.button3)

        self.tab1.addTab(self.widget1, "tab 1")
        self.tab1.addTab(self.widget2, "tab 2")
        self.tab3.addTab(self.widget3, "tab 3")

        self.myLayout.addWidget(self.tab1)
        self.myLayout.addWidget(self.tab3)
        # self.myLayout.addWidget(self.button1)
        # self.myLayout.addWidget(self.button2)
        # self.myLayout.addWidget(self.button3)

        self.centralWidget().layout().addLayout(self.myLayout)