def setup_rest_action_list(self): rest_action_list = model.RestActionsM.get_all() for rest_action in rest_action_list: rest_action_title_qll = QtWidgets.QLabel(rest_action.title) rest_action_title_qll.setWordWrap(True) rest_action_title_qll.setFont(mc_global.get_font_large()) rest_action_title_qll.setContentsMargins(10, 5, 10, 5) self.actions_list_vbox_l4.addWidget(rest_action_title_qll)
def setup_rest_action_list(self): first_iteration_bool = True rest_action_list = model.RestActionsM.get_all() for rest_action in rest_action_list: # if not first_iteration_bool: # self.actions_list_vbox_l4.addSpacing(10) first_iteration_bool = False rest_action_title_qll = QtWidgets.QLabel(rest_action.title) rest_action_title_qll.setWordWrap(True) rest_action_title_qll.setFont(mc_global.get_font_large()) rest_action_title_qll.setContentsMargins(10, 5, 10, 5) self.actions_list_vbox_l4.addWidget(rest_action_title_qll)
def update_gui(self): if mc_global.active_rest_action_id_it == mc_global.NO_REST_ACTION_SELECTED_INT: return self.updating_gui_bool = True rest_action = model.RestActionsM.get(mc_global.active_rest_action_id_it) if rest_action.image_path_str and os.path.isfile(rest_action.image_path_str): self.image_qll.show() self.image_qll.setPixmap( QtGui.QPixmap( rest_action.image_path_str ) ) self.resize_image() else: self.image_qll.hide() self.image_qll.clear() self.title_qll.setText(rest_action.title_str) self.title_qll.setFont(mc_global.get_font_large()) self.title_qll.setWordWrap(True) self.updating_gui_bool = False
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_large(i_underscore=True)) self.bo_text_qll.setFont(mc_global.get_font_large()) elif mc_global.breathing_state == mc_global.BreathingState.breathing_out: # ob_formatted_str += " ←" self.bi_text_qll.setFont(mc_global.get_font_large()) self.bo_text_qll.setFont( mc_global.get_font_large(i_underscore=True)) elif mc_global.breathing_state == mc_global.BreathingState.inactive: self.bi_text_qll.setFont(mc_global.get_font_large()) self.bo_text_qll.setFont(mc_global.get_font_large()) 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.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()
def __init__(self): super().__init__() self.show() self.updating_gui_bool = False self.rest_actions_qbg = QtWidgets.QButtonGroup() # self.setWindowTitle("Please take care of yourself") # self.setWindowIcon(QtGui.QIcon(mc.mc_global.get_app_icon_path())) # self.setMinimumWidth(IMAGE_GOAL_WIDTH_INT * 2) # self.setMinimumHeight(IMAGE_GOAL_WIDTH_INT) # self.setSizePolicy(asdf) vbox_l2 = QtWidgets.QVBoxLayout() self.setLayout(vbox_l2) # Main area title_qll = QtWidgets.QLabel("Please take good care of yourself") vbox_l2.addWidget(title_qll) vbox_l2.addStretch(1) # Image (or text if image is missing) self.image_qll = QtWidgets.QLabel() vbox_l2.addWidget(self.image_qll) self.image_qll.setScaledContents(True) self.image_qll.setMinimumWidth(IMAGE_GOAL_WIDTH_INT) self.image_qll.setMinimumHeight(IMAGE_GOAL_HEIGHT_INT) self.title_qll = QtWidgets.QLabel() vbox_l2.addWidget(self.title_qll) # self.image_qll.setPixmap(QtGui.QPixmap(mc_global.active_rest_image_full_path_str)) # self.resize_image() vbox_l2.addStretch(1) # Line of buttons (and widgets) at the bottom of the widget hbox_l3 = QtWidgets.QHBoxLayout() vbox_l2.addLayout(hbox_l3) wait_qpb = QtWidgets.QPushButton("Wait") hbox_l3.addWidget(wait_qpb) wait_qpb.clicked.connect(self.on_wait_clicked) hbox_l3.addWidget(QtWidgets.QLabel("for")) self.wait_qsb = QtWidgets.QSpinBox() self.wait_qsb.setMinimum(1) hbox_l3.addWidget(self.wait_qsb) hbox_l3.addWidget(QtWidgets.QLabel("minutes")) hbox_l3.addStretch(1) self.close_qpb = QtWidgets.QPushButton("Close and Reset Rest Timer") hbox_l3 = QtWidgets.QHBoxLayout() vbox_l2.addLayout(hbox_l3) hbox_l3.addWidget(self.close_qpb) self.close_qpb.clicked.connect(self.on_close_button_clicked) self.close_qpb.setFont(mc_global.get_font_large()) hbox_l3.addStretch(1) self.start_breathing_qcb = QtWidgets.QCheckBox("Start breathing automatically") vbox_l2.addWidget(self.start_breathing_qcb)
def __init__(self): super().__init__() self.show() self.setMinimumHeight(270) self.setMinimumWidth(400) self.ib_qtimer = None self.ob_qtimer = None self.updating_gui_bool = False # self.breathing_rest_counter_int = 0 # self.breath_counter_int = 0 self.new_cycle_bool = True 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 breathing phrase from the list to the left") vbox_l2.addWidget(self.help_text_qll) self.help_text_qll.setFont(mc_global.get_font_large(i_italics=True)) self.bi_text_qll = CustomLabel(mc_global.BreathingState.breathing_in) self.bo_text_qll = CustomLabel(mc_global.BreathingState.breathing_out) vbox_l2.addWidget(self.bi_text_qll) vbox_l2.addWidget(self.bo_text_qll) self.bi_text_qll.setFont(mc_global.get_font_xlarge()) self.bo_text_qll.setFont(mc_global.get_font_xlarge()) self.bi_text_qll.setWordWrap(True) self.bo_text_qll.setWordWrap(True) # self.bi_text_qll.widget_entered_signal.connect(self.on_io_widget_entered) # self.bo_text_qll.widget_entered_signal.connect(self.on_io_widget_entered) 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) 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 = CustomLabel( 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_io_widget_entered) self.ob_icon_cqll = CustomLabel( 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_io_widget_entered) vbox_l5 = QtWidgets.QVBoxLayout() hbox_l4.addLayout(vbox_l5) vbox_l5.addWidget(QtWidgets.QLabel("shift key down")) hbox_l4.addLayout(vbox_l5) vbox_l5.addWidget(QtWidgets.QLabel("shift key up")) """ 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) # alignment can be set with "setAlignment" self.breathing_graphicsview.setDragMode( QtWidgets.QGraphicsView.ScrollHandDrag) self.update_gui()