def update_gui(self):
        self.updating_gui_bool = True

        # Buttons and shortcut descriptions
        if mc_global.breathing_state == mc_global.BreathingState.inactive:
            self.ib_toggle_qpb.setEnabled(False)
            self.ob_toggle_qpb.setEnabled(False)
            self.start_pause_qpb.setText("Start")
            self.start_pause_qpb.setFont(mc_global.get_font_medium(i_bold=True))

            # self.start_stop_shortcut_qll.setText("Press and hold shift key to start")
            # self.iob_shortcut_qll.setText("")
        else:
            self.ib_toggle_qpb.setEnabled(True)
            self.ob_toggle_qpb.setEnabled(True)
            self.start_pause_qpb.setText("Pause")
            self.start_pause_qpb.setFont(mc_global.get_font_medium())

            # self.start_stop_shortcut_qll.setText("shortcut")

            if mc_global.breathing_state == mc_global.BreathingState.breathing_in:
                # self.iob_toggle_qpb.setText("Breathing In")
                self.ib_toggle_qpb.setChecked(True)
                self.ob_toggle_qpb.setChecked(False)
                # self.iob_shortcut_qll.setText("Press and hold shift to breathe in")

            elif mc_global.breathing_state == mc_global.BreathingState.breathing_out:
                # self.iob_toggle_qpb.setText("Breathing Out")
                self.ib_toggle_qpb.setChecked(False)
                self.ob_toggle_qpb.setChecked(True)
                # self.iob_shortcut_qll.setText("Release the shift key to breathe out")

        if mc_global.active_phrase_id_it != mc_global.NO_PHRASE_SELECTED_INT:
            self.help_text_qll.hide()

            active_phrase = model.PhrasesM.get(mc_global.active_phrase_id_it)

            ib_formatted_str = active_phrase.ib_str
            ob_formatted_str = active_phrase.ob_str
            if mc_global.breathing_state == mc_global.BreathingState.breathing_in:
                # ib_formatted_str += " ←"
                self.bi_text_qll.setFont(mc_global.get_font_xlarge(i_underscore=True))
                self.bo_text_qll.setFont(mc_global.get_font_xlarge())
            elif mc_global.breathing_state == mc_global.BreathingState.breathing_out:
                # ob_formatted_str += " ←"
                self.bi_text_qll.setFont(mc_global.get_font_xlarge())
                self.bo_text_qll.setFont(mc_global.get_font_xlarge(i_underscore=True))
            elif mc_global.breathing_state == mc_global.BreathingState.inactive:
                self.bi_text_qll.setFont(mc_global.get_font_xlarge())
                self.bo_text_qll.setFont(mc_global.get_font_xlarge())
            self.bi_text_qll.setText(ib_formatted_str)
            self.bo_text_qll.setText(ob_formatted_str)
            if ob_formatted_str:
                self.bo_text_qll.show()
            else:
                self.bo_text_qll.hide()

        self.updating_gui_bool = False
    def __init__(self):
        super().__init__()
        self.show()
        self.raise_()
        self.showNormal()

        self.updating_gui_bool = False
        # self.rest_actions_qbg = QtWidgets.QButtonGroup()
        vbox_l2 = QtWidgets.QVBoxLayout()
        self.setLayout(vbox_l2)

        hbox_l3 = QtWidgets.QHBoxLayout()
        vbox_l2.addStretch(1)
        vbox_l2.addLayout(hbox_l3)
        vbox_l2.addStretch(1)

        # Main area
        self.main_area_qgb = QtWidgets.QGroupBox("Rest Actions")
        hbox_l3.addWidget(self.main_area_qgb)

        self.actions_list_vbox_l4 = QtWidgets.QVBoxLayout()
        self.main_area_qgb.setLayout(self.actions_list_vbox_l4)

        walking_mindfully_qll = QtWidgets.QLabel(
            "Please move and walk mindfully when leaving the computer")
        walking_mindfully_qll.setFont(mc_global.get_font_medium())
        vbox_l2.addWidget(walking_mindfully_qll)
        vbox_l2.addStretch(1)

        self.close_qpb = QtWidgets.QPushButton("Close")
        vbox_l2.addWidget(self.close_qpb)
        self.close_qpb.clicked.connect(self.on_close_clicked)

        self.setup_rest_action_list()
    def __init__(self):
        super().__init__()
        self.show()
        self.raise_()
        self.showNormal()

        self.updating_gui_bool = False
        # self.rest_actions_qbg = QtWidgets.QButtonGroup()
        vbox_l2 = QtWidgets.QVBoxLayout()
        self.setLayout(vbox_l2)

        # Centering vertically and horizontally
        hbox_l3 = QtWidgets.QHBoxLayout()
        vbox_l2.addStretch(1)
        vbox_l2.addLayout(hbox_l3)
        vbox_l2.addStretch(1)
        vbox_l4 = QtWidgets.QVBoxLayout()
        hbox_l3.addStretch(1)
        hbox_l3.addLayout(vbox_l4)
        hbox_l3.addStretch(1)

        # Main area
        self.main_area_qgb = QtWidgets.QGroupBox("Rest Actions")
        vbox_l4.addWidget(self.main_area_qgb)

        self.actions_list_vbox_l4 = QtWidgets.QVBoxLayout()
        self.main_area_qgb.setLayout(self.actions_list_vbox_l4)

        walking_mindfully_qll = QtWidgets.QLabel(
            "Please move and walk mindfully when leaving the computer")
        walking_mindfully_qll.setFont(mc_global.get_font_medium())
        vbox_l4.addWidget(walking_mindfully_qll)
        vbox_l4.addStretch(1)

        buttons_hbox_l3 = QtWidgets.QHBoxLayout()
        vbox_l4.addLayout(buttons_hbox_l3)

        self.close_qpb = QtWidgets.QPushButton("Close")
        buttons_hbox_l3.addWidget(self.close_qpb)
        self.close_qpb.clicked.connect(self.on_close_clicked)

        self.close_and_breathe_qpb = QtWidgets.QPushButton("Close and Breathe")
        buttons_hbox_l3.addWidget(self.close_and_breathe_qpb)
        self.close_and_breathe_qpb.clicked.connect(
            self.on_close_and_breathe_clicked)

        self.setup_rest_action_list()

        self.setStyleSheet("background-color:#101010;"
                           "color: #999999;"
                           "selection-background-color:" +
                           mc_global.MC_LIGHT_GREEN_COLOR_STR + ";"
                           "selection-color:#000000;")

        self.showFullScreen()

        mc_global.rest_window_shown_bool = True
    def __init__(self):
        super().__init__()

        self.show()
        self.raise_()
        self.showNormal()

        self.updating_gui_bool = False
        # self.rest_actions_qbg = QtWidgets.QButtonGroup()
        vbox_l2 = QtWidgets.QVBoxLayout()
        self.setLayout(vbox_l2)

        # Centering vertically and horizontally
        hbox_l3 = QtWidgets.QHBoxLayout()
        vbox_l2.addStretch(1)
        vbox_l2.addLayout(hbox_l3)
        vbox_l2.addStretch(1)
        vbox_l4 = QtWidgets.QVBoxLayout()
        hbox_l3.addStretch(1)
        hbox_l3.addLayout(vbox_l4)
        hbox_l3.addStretch(1)

        # Main area
        self.main_area_qgb = QtWidgets.QGroupBox("Rest Actions")
        vbox_l4.addWidget(self.main_area_qgb)

        self.actions_list_vbox_l4 = QtWidgets.QVBoxLayout()
        self.main_area_qgb.setLayout(self.actions_list_vbox_l4)

        walking_mindfully_qll = QtWidgets.QLabel("Please move and walk mindfully when leaving the computer")
        walking_mindfully_qll.setFont(mc_global.get_font_medium())
        vbox_l4.addWidget(walking_mindfully_qll)
        vbox_l4.addStretch(1)

        buttons_hbox_l3 = QtWidgets.QHBoxLayout()
        vbox_l4.addLayout(buttons_hbox_l3)

        self.close_qpb = QtWidgets.QPushButton("Close")
        buttons_hbox_l3.addWidget(self.close_qpb)
        self.close_qpb.clicked.connect(self.on_close_clicked)

        self.close_and_breathe_qpb = QtWidgets.QPushButton("Close and Breathe")
        buttons_hbox_l3.addWidget(self.close_and_breathe_qpb)
        self.close_and_breathe_qpb.clicked.connect(self.on_close_and_breathe_clicked)

        self.setup_rest_action_list()

        self.setStyleSheet(
            "background-color:#101010;"
            "color: #999999;"
            "selection-background-color:" + mc_global.MC_LIGHT_GREEN_COLOR_STR + ";"
            "selection-color:#000000;"
        )

        self.showFullScreen()

        mc_global.rest_window_shown_bool = True
예제 #5
0
    def __init__(self):
        super().__init__()
        self.show()
        ###self.setGeometry(100, 100, -1, -1)
        self.setMinimumHeight(270)
        self.setMinimumWidth(400)

        self.ib_qtimer = None
        self.ob_qtimer = None
        self.updating_gui_bool = False
        self.breath_counter_int = 0
        self.in_breath_graphics_qgri_list = []
        self.out_breath_graphics_qgri_list = []

        vbox_l2 = QtWidgets.QVBoxLayout()
        self.setLayout(vbox_l2)

        self.help_text_qll = QtWidgets.QLabel(
            "Please select a row from the list to the left")
        vbox_l2.addWidget(self.help_text_qll)
        self.help_text_qll.setFont(mc_global.get_font_medium(i_italics=True))

        self.bi_text_qll = QtWidgets.QLabel()
        self.bo_text_qll = QtWidgets.QLabel()
        vbox_l2.addWidget(self.bi_text_qll)
        vbox_l2.addWidget(self.bo_text_qll)
        self.bi_text_qll.setFont(mc_global.get_font_large())
        self.bo_text_qll.setFont(mc_global.get_font_large())
        self.bi_text_qll.setWordWrap(True)
        self.bo_text_qll.setWordWrap(True)

        hbox_l3 = QtWidgets.QHBoxLayout()
        vbox_l2.addLayout(hbox_l3)

        sps_qgb = QtWidgets.QGroupBox()
        hbox_l3.addWidget(sps_qgb)
        vbox_l4 = QtWidgets.QVBoxLayout()
        sps_qgb.setLayout(vbox_l4)
        self.start_pause_qpb = QtWidgets.QPushButton("Start")
        vbox_l4.addWidget(self.start_pause_qpb)
        # TODO: Change font
        self.start_pause_qpb.clicked.connect(self.on_start_pause_clicked)
        self.stop_qpb = QtWidgets.QPushButton("Stop/Clear")
        vbox_l4.addWidget(self.stop_qpb)
        self.stop_qpb.clicked.connect(self.on_stop_button_clicked)

        io_qgb = QtWidgets.QGroupBox()
        hbox_l3.addWidget(io_qgb)
        hbox_l4 = QtWidgets.QHBoxLayout()
        io_qgb.setLayout(hbox_l4)

        vbox_l5 = QtWidgets.QVBoxLayout()
        hbox_l4.addLayout(vbox_l5)
        # self.btn_descr_qll = QtWidgets.QLabel("In")
        self.ib_toggle_qpb = QtWidgets.QPushButton("In")
        vbox_l5.addWidget(self.ib_toggle_qpb)
        self.ib_toggle_qpb.setCheckable(True)
        self.ib_toggle_qpb.toggled.connect(self.on_ib_toggled)
        self.ob_toggle_qpb = QtWidgets.QPushButton("Out")
        vbox_l5.addWidget(self.ob_toggle_qpb)
        self.ob_toggle_qpb.setCheckable(True)
        self.ob_toggle_qpb.toggled.connect(self.on_ob_toggled)

        vbox_l5 = QtWidgets.QVBoxLayout()
        hbox_l4.addLayout(vbox_l5)
        self.ib_icon_cqll = CustomIconLabel(
            mc_global.BreathingState.breathing_in,
            mc_global.get_icon_path("arrow-circle-top-4x.png"))
        vbox_l5.addWidget(self.ib_icon_cqll)
        self.ib_icon_cqll.widget_entered_signal.connect(
            self.on_icon_widget_entered)
        self.ob_icon_cqll = CustomIconLabel(
            mc_global.BreathingState.breathing_out,
            mc_global.get_icon_path("arrow-circle-bottom-4x.png"))
        vbox_l5.addWidget(self.ob_icon_cqll)
        self.ob_icon_cqll.widget_entered_signal.connect(
            self.on_icon_widget_entered)
        """
        start_stop_vbox = QtWidgets.QVBoxLayout()
        hbox.addLayout(start_stop_vbox)
        start_stop_vbox.addWidget(self.start_pause_qpb)
        self.start_stop_shortcut_qll = QtWidgets.QLabel()
        start_stop_vbox.addWidget(self.start_stop_shortcut_qll)
        """

        self.breathing_graphicsview = QtWidgets.QGraphicsView(
        )  # QGraphicsScene
        vbox_l2.addWidget(self.breathing_graphicsview)
        self.breathing_graphicsscene = QtWidgets.QGraphicsScene()
        self.breathing_graphicsview.setScene(self.breathing_graphicsscene)
        ##self.breathing_graphicsview.centerOn(QtCore.Qt.AlignRight)

        self.update_gui()