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)
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()
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")
class VOGView(AbstractView): 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") def add_graph(self, graph) -> None: """ Add Graph to view. :return None: """ self._logger.debug("running") self.layout().addWidget(graph, 0, 0) self.config_button.raise_() self._manual_control_button_frame.raise_() self._logger.debug("done") def _config_button_handler(self) -> None: """ handles the config button :return None: """ self._logger.debug("running") self._config_win.exec_() self._logger.debug("done") def set_config_val_line_edit_handler(self, func: classmethod) -> None: """ Sets the config val line handler. :param func: classmethod that handles the config val line. :return None: """ self._logger.debug("running") self._config_val_line_edit.textChanged.connect(func) self._logger.debug("done") def set_nhtsa_button_handler(self, func: classmethod) -> None: """ Sets NHTSA button press handler. :param func: classmethod that handles the NHTSA button. :return None: """ self._logger.debug("running") self._nhtsa_button.clicked.connect(func) self._logger.debug("done") def set_eblindfold_button_handler(self, func: classmethod) -> None: """ Sets eBlindfold button press handler. :param func: classmethod that handles the eBlindfold button. :return None: """ self._logger.debug("running") self._eblindfold_button.clicked.connect(func) self._logger.debug("done") def set_direct_control_button_handler(self, func: classmethod) -> None: """ Sets Direct Control button press handler. :param func: classmethod that handles the Direct Control button. :return None: """ self._logger.debug("running") self._direct_control_button.clicked.connect(func) self._logger.debug("done") def set_open_dur_line_edit_handler(self, func: classmethod) -> None: """ Sets open duration line edit handler. :param func: classmethod that handles the line edit. :return None: """ self._logger.debug("running") self._open_dur_line_edit.textChanged.connect(func) self._logger.debug("done") def set_close_dur_line_edit_handler(self, func: classmethod) -> None: """ Sets close duration line edit handler. :param func: classmethod that handles the line edit. :return None: """ self._logger.debug("running") self._close_dur_line_edit.textChanged.connect(func) self._logger.debug("done") def set_open_inf_check_box_handler(self, func: classmethod) -> None: """ Sets open INF checkbox handler. :param func: classmethod that handles the checkbox, requires bool param. :return None: """ self._logger.debug("running") self._open_inf_check_box.stateChanged.connect(func) self._logger.debug("done") def set_close_inf_check_box_handler(self, func: classmethod) -> None: """ Sets close INF checkbox handler. :param func: classmethod that handles the checkbox, requires bool param. :return None: """ self._logger.debug("running") self._close_inf_check_box.stateChanged.connect(func) self._logger.debug("done") def set_debounce_time_line_edit_handler(self, func: classmethod) -> None: """ Sets debounce time line edit handler. :param func: classmethod that handles the line edit. :return None: """ self._logger.debug("running") self._debounce_time_line_edit.textChanged.connect(func) self._logger.debug("done") def set_button_mode_selector_handler(self, func: classmethod) -> None: """ Sets button mode combo box handler. :param func: classmethod that handles the combo. :return None: """ self._logger.debug("running") self._button_mode_selector.currentIndexChanged.connect(func) self._logger.debug("done") def set_control_mode_selector_handler(self, func: classmethod) -> None: """ Sets button mode combo box handler. :param func: classmethod that handles the combo. :return None: """ self._logger.debug("running") self._control_mode_selector.currentIndexChanged.connect(func) self._logger.debug("done") def set_upload_settings_button_handler(self, func: classmethod) -> None: """ Sets upload settings button handler. :param func: classmethod that handles the button. :return None: """ self._logger.debug("running") self._upload_settings_button.clicked.connect(func) self._logger.debug("done") def set_manual_control_open_button_handler(self, func: classmethod) -> None: """ Sets manual open button handler. :param func: classmethod that handles the button. :return None: """ self._logger.debug("running") self._manual_control_open_button.clicked.connect(func) self._logger.debug("done") def set_manual_control_close_button_handler(self, func: classmethod) -> None: """ Sets manual close button handler. :param func: classmethod that handles the button. :return None: """ self._logger.debug("running") self._manual_control_close_button.clicked.connect(func) self._logger.debug("done") @property def config_text(self) -> str: """ Get the string value found in the config text box. :return str: string value in the text box. """ return self._config_val_line_edit.text() @config_text.setter def config_text(self, val: str) -> None: """ Set the string value found in the config text box. :param val: string value to set the config text box. :return None: """ self._logger.debug("running") self._config_val_line_edit.setText(val) self._logger.debug("done") @property def open_duration(self) -> str: """ Get the string value found in the open duration text box. :return str: string value in the text box. """ return self._open_dur_line_edit.text() @open_duration.setter def open_duration(self, val: str) -> None: """ Set the string value found in the open duration text box. :param val: string value to set the open duration text box. :return None: """ self._logger.debug("running") self._open_dur_line_edit.setText(val) self._logger.debug("done") @property def close_duration(self) -> str: """ Get the string value found in the close duration text box. :return str: string value in the text box. """ return self._close_dur_line_edit.text() @close_duration.setter def close_duration(self, val: str) -> None: """ Set the string value found in the close duration text box. :param val: string value to set the close duration text box. :return None: """ self._logger.debug("running") self._close_dur_line_edit.setText(val) self._logger.debug("done") @property def debounce_val(self) -> str: """ Get the string value found in the debounce time text box. :return str: string value in the text box. """ return self._debounce_time_line_edit.text() @debounce_val.setter def debounce_val(self, val: str) -> None: """ Set the string value found in the debounce time text box. :param val: string value to set the debounce text box. :return None: """ self._logger.debug("running") self._debounce_time_line_edit.setText(val) self._logger.debug("done") @property def open_inf_check_box(self) -> bool: """ Get the check box state. :return bool: returns true if the box is checked. """ return self._open_inf_check_box.isChecked() @open_inf_check_box.setter def open_inf_check_box(self, val: bool) -> None: """ Set the check box state. :param val: bool value to set the check box. :return None: """ self._logger.debug("running") self._open_inf_check_box.setChecked(val) self._logger.debug("done") @property def close_inf_check_box(self) -> bool: """ Get the check box state. :return bool: returns true if the box is checked. """ return self._close_inf_check_box.isChecked() @close_inf_check_box.setter def close_inf_check_box(self, val: bool) -> None: """ Set the check box state. :param val: bool value to set the check box. :return None: """ self._logger.debug("running") self._close_inf_check_box.setChecked(val) self._logger.debug("done") @property def button_mode(self) -> int: """ Get index of button mode. :return int: index of current button mode. """ return self._button_mode_selector.currentIndex() @button_mode.setter def button_mode(self, val: int) -> None: """ Set index of button mode. :return None: """ self._logger.debug("running") self._button_mode_selector.setCurrentIndex(val) self._logger.debug("done") @property def control_mode(self) -> int: """ Get index of button mode. :return int: index of current button mode. """ return self._control_mode_selector.currentIndex() @control_mode.setter def control_mode(self, val: int) -> None: """ Set index of button mode. :return None: """ self._logger.debug("running") self._control_mode_selector.setCurrentIndex(val) self._logger.debug("done") def set_open_dur_err(self, err: bool) -> None: """ Set this text entry to error style depending on err. :param err: If this text entry needs to be error styel :return None: """ self._logger.debug("running") if err: self._open_dur_line_edit.setStyleSheet(tab_line_edit_error_style) else: self._open_dur_line_edit.setStyleSheet( tab_line_edit_compliant_style) self._logger.debug("done") def set_close_dur_err(self, err: bool) -> None: """ Set this text entry to error style depending on err. :param err: If this text entry needs to be error styel :return None: """ self._logger.debug("running") if err: self._close_dur_line_edit.setStyleSheet(tab_line_edit_error_style) else: self._close_dur_line_edit.setStyleSheet( tab_line_edit_compliant_style) self._logger.debug("done") def set_debounce_err(self, err: bool) -> None: """ Set this text entry to error style depending on err. :param err: If this text entry needs to be error styel :return None: """ self._logger.debug("running") if err: self._debounce_time_line_edit.setStyleSheet( tab_line_edit_error_style) else: self._debounce_time_line_edit.setStyleSheet( tab_line_edit_compliant_style) self._logger.debug("done") @property def language(self) -> LangEnum: """ Get the current language setting :return LangEnum: The current language enumerator being used """ return self._lang_enum @language.setter def language(self, lang: LangEnum) -> None: """ Set the language for this view object and reload the text and tooltips. :param lang: the language to use. :return None: """ self._logger.debug("running") self._strings = strings[lang] self._set_texts() self._set_tooltips() self._logger.debug("done") def set_upload_button(self, is_active: bool) -> None: """ Set upload button activity to is_active. :param is_active: Whether this button should be active. :return None: """ self._logger.debug("running") self._upload_settings_button.setEnabled(is_active) self._logger.debug("done") def _set_texts(self) -> None: """ Set text fields of view object. :return None: """ self._logger.debug("running") self._config_label.setText(self._strings[StringsEnum.CONFIG_LABEL]) self._config_val_line_edit.setText( self._strings[StringsEnum.CONFIG_LABEL]) self._nhtsa_button.setText(self._strings[StringsEnum.NHTSA_LABEL]) self._eblindfold_button.setText( self._strings[StringsEnum.EBLIND_LABEL]) self._direct_control_button.setText( self._strings[StringsEnum.DCON_LABEL]) self._open_dur_label.setText( self._strings[StringsEnum.OPEN_DURATION_LABEL]) self._open_inf_check_box.setText(self._strings[StringsEnum.INF_LABEL]) self._close_dur_label.setText( self._strings[StringsEnum.CLOSE_DURATION_LABEL]) self._close_inf_check_box.setText(self._strings[StringsEnum.INF_LABEL]) self._debounce_label.setText(self._strings[StringsEnum.DEBOUNCE_LABEL]) self._button_mode_label.setText( self._strings[StringsEnum.BUTTON_MODE_LABEL]) self._button_mode_selector.setItemText( 0, self._strings[StringsEnum.HOLD_VAL_LABEL]) self._button_mode_selector.setItemText( 1, self._strings[StringsEnum.CLICK_VAL_LABEL]) self._control_mode_label.setText( self._strings[StringsEnum.CONTROL_MODE_LABEL]) self._control_mode_selector.setItemText( 0, self._strings[StringsEnum.LENS_VAL_LABEL]) self._control_mode_selector.setItemText( 1, self._strings[StringsEnum.TRIAL_VAL_LABEL]) self._upload_settings_button.setText( self._strings[StringsEnum.UPLOAD_BUTTON_LABEL]) self._manual_control_open_button.setText( self._strings[StringsEnum.MANUAL_OPEN_LABEL]) self._manual_control_close_button.setText( self._strings[StringsEnum.MANUAL_CLOSE_LABEL]) self.config_button.setText(self._strings[StringsEnum.CONFIG_TAB_LABEL]) self.config_button.setText("...") self._config_win.setWindowTitle( self.get_name() + " " + self._strings[StringsEnum.CONFIG_TAB_LABEL]) self._logger.debug("done") def _set_tooltips(self) -> None: """ Set tooltip text fields of view object. :return None: """ self._logger.debug("running") self._config_label.setToolTip( self._strings[StringsEnum.CONFIG_LABEL_TOOLTIP]) self._config_val_line_edit.setToolTip( self._strings[StringsEnum.CONFIG_LABEL_TOOLTIP]) self._open_dur_label.setToolTip( self._strings[StringsEnum.OPEN_DURATION_TOOLTIP]) self._close_dur_label.setToolTip( self._strings[StringsEnum.CLOSE_DURATION_TOOLTIP]) self._debounce_label.setToolTip( self._strings[StringsEnum.DEBOUNCE_TOOLTIP]) self._button_mode_label.setToolTip( self._strings[StringsEnum.BUTTON_MODE_TOOLTIP]) self._control_mode_label.setToolTip( self._strings[StringsEnum.CONTROL_MODE_TOOLTIP]) self._upload_settings_button.setToolTip( self._strings[StringsEnum.UPLOAD_BUTTON_TOOLTIP]) self._manual_control_open_button.setToolTip( self._strings[StringsEnum.MANUAL_OPEN_TOOLTIP]) self._manual_control_close_button.setToolTip( self._strings[StringsEnum.MANUAL_CLOSE_TOOLTIP]) self.config_button.setToolTip( self._strings[StringsEnum.CONFIG_TAB_TOOLTIP]) self._logger.debug("done")
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")
class CamView(AbstractView): 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") def set_show_feed_button_handler(self, func) -> None: """ Add handler for show camera selector. :param func: The handler. :return None: """ self._logger.debug("running") self._show_feed_checkbox.toggled.connect(func) self._logger.debug("done") def set_resolution_selector_handler(self, func) -> None: """ Add handler for resolution selector. :param func: The handler. :return None: """ self._logger.debug("running") self._resolution_selector.activated.connect(func) self._logger.debug("done") def set_fps_selector_handler(self, func) -> None: """ Add handler for resolution selector. :param func: The handler. :return None: """ self._logger.debug("running") self._fps_selector.activated.connect(func) self._logger.debug("done") def set_use_cam_button_handler(self, func) -> None: """ Add handler for use camera selector. :param func: The handler. :return None: """ self._logger.debug("running") self._use_cam_checkbox.toggled.connect(func) self._logger.debug("done") def set_use_overlay_button_handler(self, func) -> None: """ Add handler for use camera selector. :param func: The handler. :return None: """ self._logger.debug("running") self._use_overlay_checkbox.toggled.connect(func) self._logger.debug("done") def _config_button_handler(self) -> None: """ Show config pop up. :return None: """ self._logger.debug("running") self.config_button.setStyleSheet( "background-color: rgba(200, 200, 200, 50%)") self._config_win.exec_() self._logger.debug("done") @property def language(self) -> LangEnum: """ :return: The current lang enum being used. """ return self._lang_enum @language.setter def language(self, lang: LangEnum) -> None: """ Set the language for this view object. :param lang: The language to use. :return None: """ self._logger.debug("running") self._lang_enum = lang self._strings = strings[lang] self._set_texts() self._set_tooltips() self._logger.debug("done") @property def resolution_list(self) -> list: """ Get list of resolutions. :return list: The list of resolutions. """ ret = list() return ret @resolution_list.setter def resolution_list(self, res_list: list) -> None: """ Set list of resolutions available to res_list. :param res_list: The list of available resolutions. :return None: """ self._logger.debug("running") self._resolution_selector.clear() for item in res_list: self._resolution_selector.addItem(str(item)) self._logger.debug("done") @property def resolution(self) -> str: """ Get the current resolution selection. :return str: The current resolution. """ return self._resolution_selector.currentText() @resolution.setter def resolution(self, res: str) -> None: """ Set the current resolution selection. :param res: The resolution to set to. :return None: """ self._resolution_selector.setCurrentIndex( self._resolution_selector.findText(res)) @property def fps_list(self) -> list: """ Get list of fps options. :return list: The list of fps options. """ ret = list() return ret @fps_list.setter def fps_list(self, fps_list: list) -> None: """ Set list of available fps to fps_list. :param fps_list: :return None: """ self._logger.debug("running") self._fps_selector.clear() for item in fps_list: self._fps_selector.addItem(str(item)) self._logger.debug("done") @property def fps(self) -> str: """ Get the current fps selection. :return str: The current fps selection. """ return self._fps_selector.currentText() @fps.setter def fps(self, fps: str) -> None: """ Set the current fps selection. :param fps: The fps to set to. :return None: """ self._logger.debug("running") self._fps_selector.setCurrentIndex(self._fps_selector.findText(fps)) self._logger.debug("done") @property def use_feed(self) -> bool: """ Get the current use_cam setting. :return bool: User selection for using cam. """ return self._show_feed_checkbox.isChecked() @use_feed.setter def use_feed(self, useable: bool) -> None: """ Set use_cam setting. :param useable: The setting to set to. :return None: """ self._logger.debug("running") self._show_feed_checkbox.setChecked(useable) self._logger.debug("Done") @property def use_cam(self) -> bool: """ Get the current use_cam setting. :return bool: User selection for using cam. """ return self._use_cam_checkbox.isChecked() @use_cam.setter def use_cam(self, useable: bool) -> None: """ Set use_cam setting. :param useable: The setting to set to. :return None: """ self._logger.debug("running") self._use_cam_checkbox.setChecked(useable) self._logger.debug("Done") @property def use_overlay(self) -> bool: """ Get the current use_overlay setting. :return bool: User selection for using overlay. """ return self._use_overlay_checkbox.isChecked() @use_overlay.setter def use_overlay(self, useable: bool) -> None: """ Set use_overlay setting. :param useable: The setting to set to. :return None: """ self._logger.debug("running") self._use_overlay_checkbox.setChecked(useable) self._logger.debug("Done") def heightForWidth(self, w: int) -> int: return int(w * self._aspect_ratio) def widthForHeight(self, h: int) -> int: return int(h / self._aspect_ratio) def hideEvent(self, hideEvent: QHideEvent): """ Track minimize event. :param hideEvent: :return None: """ self._hidden = True def showEvent(self, showEvent: QShowEvent): """ Track restore event. :param showEvent: :return None: """ self._hidden = False def update_image(self, image: QPixmap = None, msg: str = None) -> None: """ Update image viewer with new image. :param image: The new image to show. :param msg: The text to show if no image. :return None: """ self._logger.debug("running") if not self._window_changing: if image is not None: temp_image_w = image.scaledToWidth(self.width() - 15) temp_image_h = image.scaledToHeight(self.height() - 35) if temp_image_w.height() > self.height() - 35: self._image_display.setPixmap(temp_image_h) else: self._image_display.setPixmap(temp_image_w) elif msg is not None: self._image_display.setText(msg) self._logger.debug("done") def show_images(self) -> None: """ Show image display and hide initialization bar. :return None: """ self._logger.debug("running") geo = self.geometry() self._showing_images = True self._initialization_bar_frame.hide() self._image_display.show() self.config_button.show() self.setStyleSheet("background-color: black") self.setGeometry(geo) self._logger.debug("done") def show_initialization(self) -> None: """ Show initialization bar and hide image display. :return None: """ self._logger.debug("running") self._showing_images = False self._image_display.hide() self.config_button.hide() self._initialization_bar_frame.show() self._logger.debug("done") def update_init_bar(self, progress: int) -> None: """ set progress bar value to progress. :param progress: The value to set progress bar to. :return None: """ self._logger.debug("running") if progress > 100: progress = 100 elif progress < 0: progress = 0 self._initialization_bar.setValue(progress) self._logger.debug("done") def set_config_active(self, is_active: bool) -> None: """ Set whether this camera config options are usable. :param is_active: Usable. :return None: """ self._logger.debug("running") if self._showing_images: if is_active: self._rec_label.hide() elif self.use_cam: self._rec_label.show() for item in self._config_items: item.setEnabled(is_active) self._logger.debug("done") def _set_texts(self) -> None: """ Set the texts in this view object. :return None: """ self._logger.debug("running") self._initialization_bar_label.setText( self._strings[StringsEnum.INITIALIZATION_BAR_LABEL]) self._initialization_bar.setValue(0) self._image_display_label.setText( self._strings[StringsEnum.IMAGE_DISPLAY_LABEL]) self._image_display.setText(self._strings[StringsEnum.IMAGE_DISPLAY]) self._show_feed_checkbox_label.setText( self._strings[StringsEnum.SHOW_FEED_CHECKBOX_LABEL]) self._use_cam_checkbox_label.setText( self._strings[StringsEnum.USE_CAM_CHECKBOX_LABEL]) self._use_overlay_checkbox_label.setText( self._strings[StringsEnum.USE_OVERLAY_CHECKBOX_LABEL]) self._resolution_selector_label.setText( self._strings[StringsEnum.RESOLUTION_SELECTOR_LABEL]) self._fps_selector_label.setText( self._strings[StringsEnum.FPS_SELECTOR_LABEL]) self._config_win.setWindowTitle( self.get_name() + " " + self._strings[StringsEnum.CONFIG_TAB_LABEL]) self.config_button.setText("...") self._rec_label.setText("rec ●") self._logger.debug("done") def _set_tooltips(self) -> None: """ Set the tooltips in this view object. :return None: """ self._logger.debug("running") self._resolution_selector_label.setToolTip( self._strings[StringsEnum.RESOLUTION_SELECTOR_TOOLTIP]) self._resolution_selector.setToolTip( self._strings[StringsEnum.RESOLUTION_SELECTOR_TOOLTIP]) self._fps_selector_label.setToolTip( self._strings[StringsEnum.FPS_SELECTOR_TOOLTIP]) self._fps_selector.setToolTip( self._strings[StringsEnum.FPS_SELECTOR_TOOLTIP]) self._show_feed_checkbox_label.setToolTip( self._strings[StringsEnum.SHOW_FEED_CHECKBOX_TOOLTIP]) self._show_feed_checkbox.setToolTip( self._strings[StringsEnum.SHOW_FEED_CHECKBOX_TOOLTIP]) self._use_cam_checkbox_label.setToolTip( self._strings[StringsEnum.USE_CAM_CHECKBOX_TOOLTIP]) self._use_cam_checkbox.setToolTip( self._strings[StringsEnum.USE_CAM_CHECKBOX_TOOLTIP]) self._use_overlay_checkbox_label.setToolTip( self._strings[StringsEnum.USE_OVERLAY_TOOLTIP]) self._use_overlay_checkbox.setToolTip( self._strings[StringsEnum.USE_OVERLAY_TOOLTIP]) self._image_display.setToolTip( self._strings[StringsEnum.IMAGE_DISPLAY_TOOLTIP]) self._logger.debug("done")
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")
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)