Example #1
0
def main():
    os.environ["QT_IM_MODULE"] = "qtvirtualkeyboard"

    app = QtWidgets.QApplication(sys.argv)

    # class instance
    chartManager1 = ChartManager1()
    chartManager2 = ChartManager2()
    chartManager3 = ChartManager3()
    alarmManager = AlarmManager()
    # patient = Patient()
    userInput = UserInput()
    modeSelect = ms.ModeSelect()

    # connect signal
    app.aboutToQuit.connect(chartManager1.stop)
    app.aboutToQuit.connect(chartManager2.stop)
    app.aboutToQuit.connect(chartManager3.stop)
    app.aboutToQuit.connect(modeSelect.stop)
    app.aboutToQuit.connect(alarmManager.stop)

    dp = 0

    # start thread
    chartManager1.start()
    modeSelect.start()
    alarmManager.start()

    engine = QtQml.QQmlApplicationEngine()
    ctx = engine.rootContext()

    ctx.setContextProperty("ChartManager1", chartManager1)
    ctx.setContextProperty("ChartManager2", chartManager2)
    ctx.setContextProperty("ChartManager3", chartManager3)

    ctx.setContextProperty("ModeSelect", modeSelect)
    # ctx.setContextProperty("Patient", patient)
    ctx.setContextProperty("UserInput", userInput)
    ctx.setContextProperty("AlarmManager", alarmManager)

    ctx.setContextProperty("dp", dp)
    ctx.setContextProperty("fs", False)

    # if redis exists take the userinput
    if config.useredis:
        params = config.r.get("PARAMS")
        params = json.loads(params)
        ctx.setContextProperty("Params", params)

    if config.args.fullscreen:
        logging.debug("Runnin in full screen")
        ctx.setContextProperty("fs", True)

    # engine.load('main.qml')
    engine.load('./qml/MainQt.qml')
    if not engine.rootObjects():
        sys.exit(-1)

    sys.exit(app.exec_())
Example #2
0
 def setup(self, registry):
     alarm_manager = AlarmManager()
     msg_store = MessageStore()
     registry.add(
         'http:app', {
             'name': self.ext_name,
             'factory': factory_decorator(alarm_manager, msg_store),
         })
Example #3
0
    def __init__(self):
        """Initializing main class"""
        super(MzAlarmy, self).__init__()

        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)

        # Removing any numbers from lcd's for enhanced user experience at starting of application
        self.ui.hrsLabel.display('')
        self.ui.minsLabel.display('')
        self.ui.secsLabel.display('')

        self.clock = Clock(self.ui.hrsLabel, self.ui.minsLabel, self.ui.secsLabel)
        self.clock.start()
        self.background_changer = BackgroundChanger(self, 'offline', 'backgrounds/*.jpg')
        self.background_changer.sleep(5) # Making sleep to fix bugs during assigning background
        self.background_changer.start()

        # Setting events
        self.set_events()

        self.alarm_manager = AlarmManager('alarms.txt')
        self.alarm_manager.load_alarms()
Example #4
0
class MzAlarmy(QtWidgets.QMainWindow):
    """Main application class"""

    def __init__(self):
        """Initializing main class"""
        super(MzAlarmy, self).__init__()

        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)

        # Removing any numbers from lcd's for enhanced user experience at starting of application
        self.ui.hrsLabel.display('')
        self.ui.minsLabel.display('')
        self.ui.secsLabel.display('')

        self.clock = Clock(self.ui.hrsLabel, self.ui.minsLabel, self.ui.secsLabel)
        self.clock.start()
        self.background_changer = BackgroundChanger(self, 'offline', 'backgrounds/*.jpg')
        self.background_changer.sleep(5) # Making sleep to fix bugs during assigning background
        self.background_changer.start()

        # Setting events
        self.set_events()

        self.alarm_manager = AlarmManager('alarms.txt')
        self.alarm_manager.load_alarms()

        # Setting alarms
        #self.initialize_alarms()

        # Setting alarm mp3
        #self.p = vlc.MediaPlayer("ring.mp3")



    def set_events(self):
        # Menu events
        self.ui.actionSet_Alarms.triggered.connect(self.open_set_alarms)

    def keyPressEvent(self, event):
        if event.key() == QtCore.Qt.Key_Space:
            self.alarm_manager.stop_alarm()

    def open_set_alarms(self):
        from set_alarms import SetAlarms

        dialog = SetAlarms()
        self.alarm_manager.load_alarms()
Example #5
0
 def __init__(self, alarm_manager=AlarmManager()):
     self.__alarm_manager = alarm_manager
Example #6
0
 def setUp(self):
     self.dm = AlarmManager('removeme.json',
                            Path.cwd() / 'tests' / 'resources')