Ejemplo n.º 1
0
 def __init__(self, user, pacient: Pacient = None):
     super().__init__()
     GUI_Resources.get_prueba_dialog_ui(self)
     self.prueba = Prueba()
     self.fecha: QDateEdit = self.fecha
     self.pacient_nom: QLabel = self.pacient_nom
     self.lap1_notes: QTextEdit = self.lap1_notes
     self.lap2_notes: QTextEdit = self.lap2_notes
     self.lap3_notes: QTextEdit = self.lap3_notes
     self.lap1_time: QTimeEdit = self.lap1_time
     self.lap2_time: QTimeEdit = self.lap2_time
     self.lap3_time: QTimeEdit = self.lap3_time
     self.lap_header_1: QLabel = self.lap_header_1
     self.lap_header_2: QLabel = self.lap_header_2
     self.lap_header_3: QLabel = self.lap_header_3
     self.fecha: QDateEdit = self.fecha
     self.fecha: QDateEdit = self.fecha
     settings = UserSettings(user)
     self.lap_header_1.setText(settings.value(settings.LAP0_NAME))
     self.lap_header_2.setText(settings.value(settings.LAP1_NAME))
     self.lap_header_3.setText(settings.value(settings.LAP2_NAME))
     self.fecha.setDateTime(datetime.now())
     if pacient:
         self.pacient_nom.setText(pacient.get_fomatted_name())
         self.prueba.pacient_id = pacient.id
Ejemplo n.º 2
0
 def __init__(self, json: dict or ColumnDict, editable: bool = True):
     super(SimpleForm, self).__init__()
     GUI_Resources.get_basic_form(self)
     dictionary = json
     if isinstance(json, ColumnDict):
         dictionary = {}
         for column in json:
             dictionary[column] = json[column]["type"]
     self.json = dictionary
     self.values = {}
     self.formLayout: QFormLayout = self.formLayout
     self.init(editable)
Ejemplo n.º 3
0
    def __init__(self, conn):
        super(LoginRegisterWindow, self).__init__()
        self.setWindowTitle("Autenticador")
        self.result = {}
        self.conn = conn
        self.tab: QTabWidget = QTabWidget()
        layout = QVBoxLayout()
        layout.addWidget(self.tab)
        self._login_validator = self.validator_debug  # method
        self._user_checker = self.validator_debug
        self.login_widget = GUI_Resources.get_login_tab()
        self.register_widget = GUI_Resources.get_register_tab()

        self.oculto_login: QPushButton = self.login_widget.oculto
        self.oculto_register: QPushButton = self.register_widget.oculto
        self.oculto_confirm: QPushButton = self.register_widget.oculto_confirm
        self.tab.addTab(self.login_widget, "Login")
        self.tab.addTab(self.register_widget, "Registro")
        self.setLayout(layout)
        self.shown: QIcon = get_shown_icon()
        self.hidden: QIcon = get_hidden_icon()
        self.login_widget.positive.clicked.connect(self.__positive_login)
        self.login_widget.negative.clicked.connect(self.__cancel_buttons)
        self.register_widget.Rnegative.clicked.connect(self.__cancel_buttons)
        self.register_widget.Rpositive.clicked.connect(
            self.__positive_register)
        self.oculto_confirm.pressed.connect(self.show_handler)
        self.oculto_confirm.released.connect(self.hide_handler)
        self.oculto_login.pressed.connect(self.show_handler)
        self.oculto_login.released.connect(self.hide_handler)
        self.oculto_register.released.connect(self.hide_handler)
        self.oculto_register.pressed.connect(self.show_handler)
        self.login_widget.passwordfield.textEdited.connect(self.hide_handler)
        self.register_widget.passwordfield.textEdited.connect(
            self.hide_handler)
        self.register_widget.confirm_password.textEdited.connect(
            self.hide_handler)

        self.login_widget.usernamefield.returnPressed.connect(
            self.__positive_login)
        self.login_widget.passwordfield.returnPressed.connect(
            self.__positive_login)

        self.register_widget.passwordfield.returnPressed.connect(
            self.__positive_register)
        self.register_widget.confirm_password.returnPressed.connect(
            self.__positive_register)
        self.register_widget.usernamefield.returnPressed.connect(
            self.__positive_register)
Ejemplo n.º 4
0
 def handle_actions(self):
     if self.sender() == self.edit_prueba and self.prueba:
         dialog = PruebaDialog(self.user)
         dialog.set_prueba(self.pacient, self.prueba)
         if dialog.exec_() == 1:
             self.model.update(dialog.get_prueba(), self.prueba)
         StaticActions.del_prueba_action.setEnabled(False)
         StaticActions.edit_prueba_action.setEnabled(False)
     elif self.sender() == self.add_prueba:
         dialog = PruebaDialog(self.user)
         dialog.set_prueba(self.pacient)
         if dialog.exec_() == 1:
             prueba = dialog.get_prueba()
             self.model.append(prueba)
             self.pruebas.append(prueba)
     elif self.sender() == self.del_prueba and self.prueba:
         dialog = GUI_Resources.get_confirmation_dialog_ui(f"Quieres eliminar la prueba seleccionada? \nPaciente: {self.pacient.get_fomatted_name()}")
         if dialog.exec_() == 1:
             StaticActions.del_prueba_action.setEnabled(False)
             StaticActions.edit_prueba_action.setEnabled(False)
             self.pruebas.remove(self.prueba)
             self.model.delete(self.prueba)
             self.prueba = None
             self.on_reload()
     self.pruebas.sort()
     self.load_graph(self.pruebas)
Ejemplo n.º 5
0
 def button_clicked(self, *args):  # Llevar esto a la clase pacientsform
     pacient_index = self.central.parent_tab_widget.indexOf(
         self.central.pacients_tab)
     self.central.parent_tab_widget.setCurrentIndex(pacient_index)
     if self.sender() == self.menu_bar.add_pacient:
         self.central.pacients_tab.pacientSelected(Pacient(), -1)
         self.central.pacients_tab.set_enabled(True)
         self.central.parent_tab_widget.setEnabled(True)
     elif self.sender() == self.menu_bar.del_pacient:
         if len(self.listview_model
                ) > 0 and self.central.pacients_tab.pacient_selected():
             pacient = self.listview_model.entities[
                 self.central.pacients_tab.index]
             dialog = GUI_Resources.get_confirmation_dialog_ui(
                 f"Quieres eliminar el usuario {pacient}")
             if dialog.exec_() == 1:
                 self.listview_model.delete(pacient)
     elif self.sender() == self.menu_bar.edit_pacient:
         if len(self.listview_model.entities
                ) > 0 and self.central.pacients_tab.pacient_selected():
             self.central.pacients_tab.set_enabled(True)
     elif self.sender() == self.menu_bar.recargar:
         instances = self.listview_model.get_user_instances(
             self.user_credentials["username"])
         for instance in instances:
             instance.reload()
         self.on_reload.emit(True)
Ejemplo n.º 6
0
 def __init__(self, user: str):
     super(EvolutionTab, self).__init__()
     PacientInterface.__init__(self)
     GUI_Resources.get_evolution_tab(self)
     self.settings: UserSettings = UserSettings(user)
     self.evolution_listview: QListView = self.evolution_listview
     self.target_layout: QHBoxLayout = self.target_layout
     self.pacient_name: QLabel = self.pacient_name
     self.todos: QRadioButton = self.todos
     self.semanal: QRadioButton = self.semanal
     self.mensual: QRadioButton = self.mensual
     self.anual: QRadioButton = self.anual
     self.custom: QRadioButton = self.custom
     self.anual.clicked.connect(self.radio_handler)
     self.mensual.clicked.connect(self.radio_handler)
     self.semanal.clicked.connect(self.radio_handler)
     self.todos.clicked.connect(self.radio_handler)
     self.graph = Grafica()
     self.prueba: Prueba = ...
     self.pruebas: list = ...
     self.graph_test_1 = Grafica()
     self.graph_test_2 = Grafica()
     self.graph_test_3 = Grafica()
     self.graph_test_total = Grafica()
     self.user = user
     self.graph_lay_1: QVBoxLayout = self.graph_lay_1
     self.graph_lay_2: QVBoxLayout = self.graph_lay_2
     self.graph_lay_3: QVBoxLayout = self.graph_lay_3
     self.graph_lay_1.addWidget(self.graph_test_1)
     self.graph_lay_2.addWidget(self.graph_test_2)
     self.graph_lay_3.addWidget(self.graph_test_3)
     self.graph_lay_total.addWidget(self.graph_test_total)
     self.target_layout.addWidget(self.graph)
     self.notas_lap3.setVisible(False)
     self.notas_lap2.setVisible(False)
     self.notas_lap1.setVisible(False)
     self.notas_total.setVisible(False)
     self.tiempo_total: QLabel = self.tiempo_total
     self.tiempo_1: QLabel = self.tiempo_1
     self.tiempo_2: QLabel = self.tiempo_2
     self.tiempo_3: QLabel = self.tiempo_3
     #self.notas_lap_total.setVisible(False)
     self.model: PruebasListModel = PruebasListModel.get_instance(user)
     self.evolution_listview.setModel(self.model)
     self.model.change_model_list([])
     self.evolution_listview.clicked.connect(self.onPruebaClicked)
     self.title_test1: QLabel = self.title_test1
     self.title_test2: QLabel = self.title_test2
     self.title_test3: QLabel = self.title_test3
     self.title_test_total: QLabel = self.title_test_total
     self.title_test1.setText(self.settings.value(self.settings.LAP0_NAME))
     self.title_test2.setText(self.settings.value(self.settings.LAP1_NAME))
     self.title_test3.setText(self.settings.value(self.settings.LAP2_NAME))
     self.title_test_total.setText("Total")
     self.filter = get_selector_widget()
     self.buscar.clicked.connect(self.handle_filter)
     self.filter.buscar.clicked.connect(self.handle_filter)
     self.evolution_listview.customContextMenuRequested.connect(self.custom_context_menu)
     self.menu = Menu()
     self.edit_prueba = self.menu.addAction(StaticActions.edit_prueba_action)
     self.del_prueba = self.menu.addAction(StaticActions.del_prueba_action)
     self.add_prueba = self.menu.addAction(StaticActions.add_prueba_action)
     self.add_prueba.setEnabled(False)
     self.edit_prueba.setEnabled(False)
     self.del_prueba.setEnabled(False)
     self.add_prueba.triggered.connect(self.handle_actions)
     self.edit_prueba.triggered.connect(self.handle_actions)
     self.del_prueba.triggered.connect(self.handle_actions)
Ejemplo n.º 7
0
    def __init__(self, debug=False):
        super().__init__()
        self.setObjectName("Main_window")
        self.settings = None
        Utils.debug = debug
        # TODO SINGLETONS ?¿?¿?¿?¿
        UI.instance = self
        UI.threadpool = QThreadPool()
        UI.DEBUG = debug
        # TODO SINGLETONS ?¿?¿?¿?¿ THEY ARE REALLY NEEDED?
        self.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Ignored)
        self.connection = AuthConnection()
        self.login_form = GUI_Resources.get_login_register_dialog(
            self.connection)
        self.user_credentials = {"result": False}
        self.credentials()
        if self.user_credentials["result"]:
            if self.user_credentials["order"] == "login":
                self.show()
            elif self.user_credentials["order"] == "register":
                self.connection.register_user(
                    self.user_credentials["username"],
                    self.user_credentials["password"])
                self.show()
            else:
                sys.exit(1)
        else:
            sys.exit(0)
        # Recogemos el Central widget, lo añadimos y luego lo inicializamos
        if debug:
            self.user_credentials["username"] = AuthConnection.default_user
        self.settings = UserSettings(self.user_credentials["username"])
        self.setWindowTitle(self.settings.applicationName())
        self.central = CentralWidgetParkingson(
            self.user_credentials["username"])
        self.setCentralWidget(self.central)
        # Creamos el objeto settings

        if self.settings.value(self.settings.SIZE):
            rect = self.settings.value(self.settings.SIZE, type=QSize)
            self.resize(rect.width(), rect.height())
        if self.settings.value(self.settings.FULLSCREEN, False, bool):
            self.showMaximized()

        pos = self.settings.value(self.settings.POSITION, QPoint(50, 50),
                                  QPoint)
        self.move(pos)

        PruebasListModel.get_instance(self.user_credentials["username"])
        self.listview_model: AbstractEntityModel = PacientsListModel.get_instance(
            self.user_credentials["username"])
        self.central.pacients_list_view.setModel(self.listview_model)

        self.setCentralWidget(self.central)
        self.menu_bar = MenuBar()
        self.status_bar = QStatusBar()
        self.toolbar = ToolBar()
        self.addToolBar(self.toolbar)
        self.setStatusBar(self.status_bar)
        self.setMenuBar(self.menu_bar)

        self.set_up_actions()

        self.central.pacients_list_view.clicked.connect(
            self.on_listview_pacient_click)
        self.central.pacients_list_view.doubleClicked.connect(
            self.on_pacient_double_click)
        self.central.pacients_tab.finishedSignal.connect(self.on_finished)
        self.central.pacients_tab.resultSignal.connect(self.on_result)
        self.central.cronometro_tab.finishedSignal.connect(
            self.on_crono_finished)
        self.changeStatusBar.connect(self.changeStatus)

        self.central.pacients_tab.set_signal_pacient_selected(
            self.pacientSelected)
        self.central.cronometro_tab.set_signal_pacient_selected(
            self.pacientSelected)
        self.central.evolution_tab.set_signal_pacient_selected(
            self.pacientSelected)

        self.central.pacients_tab.set_change_status_bar(self.changeStatusBar)
        self.central.cronometro_tab.set_change_status_bar(self.changeStatusBar)
        self.central.evolution_tab.set_change_status_bar(self.changeStatusBar)

        self.central.pacients_tab.set_key_pressed(self.key_press)
        self.central.cronometro_tab.set_key_pressed(self.key_press)
        self.central.evolution_tab.set_key_pressed(self.key_press)

        self.central.pacients_tab.set_signal_current_changed(
            self.central.parent_tab_widget.currentChanged)
        self.central.cronometro_tab.set_signal_current_changed(
            self.central.parent_tab_widget.currentChanged)
        self.central.evolution_tab.set_signal_current_changed(
            self.central.parent_tab_widget.currentChanged)

        self.central.evolution_tab.set_on_reload_signal(self.on_reload)
        self.central.pacients_tab.set_on_reload_signal(self.on_reload)
        self.central.cronometro_tab.set_on_reload_signal(self.on_reload)

        self.hideViews.connect(self.hide_view)

        self.menu_bar.view_pacientes.setCheckable(True)
        self.menu_bar.view_toolbar.setCheckable(True)
        self.menu_bar.view_crono.setCheckable(True)
        self.menu_bar.view_rendimiento.setCheckable(True)

        self.menu_bar.view_pacientes.setChecked(True)
        self.menu_bar.view_toolbar.setChecked(True)
        self.menu_bar.view_crono.setChecked(True)
        self.menu_bar.view_rendimiento.setChecked(True)

        self.menu_bar.view_pacientes.changed.connect(self.hide_view)
        self.menu_bar.view_toolbar.changed.connect(self.hide_view)
        self.menu_bar.view_crono.changed.connect(self.hide_view)
        self.menu_bar.view_rendimiento.changed.connect(self.hide_view)

        self.central.parent_tab_widget.setEnabled(False)

        # INIT Tab Components

        self.central.pacients_tab.init()
        self.central.cronometro_tab.init()
        self.central.evolution_tab.init()

        # El tab de pacientes sera el por defecto.

        pacient_index = self.central.parent_tab_widget.indexOf(
            self.central.pacients_tab)
        self.central.parent_tab_widget.setCurrentIndex(pacient_index)
        self.iconSizeChanged.connect(self.iconSizeChanged)

        threading.Thread(target=self.check_camera_worker).start()
        self.inited = True