def __init__(self): QtWidgets.QWidget.__init__(self) uic.loadUi('ControlPanel.ui', self) self.show() self.playing = True self.muted = False self.sound = QtMultimedia.QSoundEffect() self.noteList = {} self.pathList = {} self.colours = {} self.defaultPen = [255, 255, 255] self.times = [] self.frame = 0 self.timer = QtCore.QTimer() self.timer.timeout.connect(self.update) self.setupPlot() self.setupAudio() self.setupUI() self.parseData() self.timer.start(100)
def __init__(self): super().__init__() self.sys_tray = SystemTray() self.rest_reminder_dialog = None self.rest_widget = None self.tray_icon = None self.rest_reminder_qtimer = None self.breathing_qtimer = None self.rest_prepare_dialog = None self.intro_dlg = None self.breathing_notification = None self.breathing_dialog = None self.sound_effect = None try: self.sound_effect = QtMultimedia.QSoundEffect(self) # -PLEASE NOTE: A parent has to be given here, otherwise we will not hear anything except NameError: logging.debug( "NameError - Cannot play audio since QtMultimedia has not been imported" ) self.active_breathing_phrase_qgb = QtWidgets.QGroupBox( "Active Breathing Phrase") self.br_settings_wt = mc.gui.breathing_settings_wt.BreathingSettingsWt( ) self.br_phrase_list_wt = mc.gui.breathing_phrase_list_wt.BreathingPhraseListWt( ) self.rest_settings_wt = mc.gui.rest_settings_wt.RestSettingsWt() self.rest_action_list_wt = mc.gui.rest_action_list_wt.RestActionListWt( ) self.breathing_history_wt = mc.gui.breathing_history_wt.BreathingHistoryWt( ) self._setup_initialize() main_container_hbox_l3 = self._setup_main_container() self._setup_add_first_panel_to_main_container(main_container_hbox_l3) self._setup_add_breathing_phrase_list_to_main_container( main_container_hbox_l3) self._setup_add_rest_action_list_to_main_container( main_container_hbox_l3) # Setup of Menu self.menu_bar = self.menuBar() self.update_menu() # Setup of Timers self.on_breathing_settings_changed() self.update_rest_timer() # Startup actions if not mc.mc_global.db_file_exists_at_application_startup_bl and not mc.mc_global.testing_bool: self.show_intro_dialog() self.open_breathing_dialog() self.setup_systray() self.minimize_to_tray()
def __init__(self, parent=None): super(MessageArea, self).__init__(parent) self.setReadOnly(True) self.sender_format = _StandardTextFormat(Qt.gray, self.fontWeight()) self.time_format = _StandardTextFormat(Qt.gray, self.fontWeight()) self.text_format = _StandardTextFormat() # styling self.setWindowFlags(Qt.FramelessWindowHint) self.setAttribute(Qt.WA_TranslucentBackground) self.viewport().setAutoFillBackground(False) self.name_formats = {} self.listeners = [] sound_filepath = path.join(path.dirname(__file__), 'resources', 'click.wav') # sound_filepath = path.abspath(sound_filepath) sound_filepath = QtCore.QUrl.fromLocalFile(sound_filepath) self.sound = QtMultimedia.QSoundEffect() self.sound.setSource(sound_filepath) self.sound.setVolume(0.5) self.sound.setLoopCount(1)
def __init__(self): super().__init__() self.timer = QtCore.QTimer() self.timer.timeout.connect(self.tick) self.sound1, self.sound2 = QtMultimedia.QSoundEffect( ), QtMultimedia.QSoundEffect() self.sound1.setSource(QtCore.QUrl.fromLocalFile('tick.wav')) self.sound2.setSource(QtCore.QUrl.fromLocalFile('tick_f.wav')) self.bgm = QtMultimedia.QMediaPlayer() self.bgm.setMedia( QtMultimedia.QMediaContent(QtCore.QUrl.fromLocalFile('bgm.mp3'))) self.bgm.setVolume(70) self.bgm.play() self.get_ready()
def __init__(self, parent=None): super(ExampleApp, self).__init__(parent) self.raw_time = 0 self.timer = QtCore.QTimer() self.timer.timeout.connect(self.count_down) self.effect = mm.QSoundEffect() self.effect.setSource( QtCore.QUrl.fromLocalFile(f"{RESOURCE_PATH}/Sounds/gameover1.wav")) self.effect.setLoopCount(10)
def initSound(self): if SOUND: self._log.warning( 'Setting up sound, system volume may go to 100% ... COVER YOUR EARS' ) url = QtCore.QUrl.fromLocalFile( os.path.abspath('resources/click1.wav')) if url.isValid(): self._click1 = QtMultimedia.QSoundEffect(self) self._click1.setSource(url)
def play_audio(self, i_audio_path: str, i_volume: int) -> None: try: sound_effect = QtMultimedia.QSoundEffect(self) # -PLEASE NOTE: A parent has to be given here, otherwise we will not hear anything sound_effect.setSource(QtCore.QUrl.fromLocalFile(i_audio_path)) sound_effect.setVolume(float(i_volume / 100)) sound_effect.play() except NameError: logging.debug( "NameError - Cannot play audio since QtMultimedia has not been imported" )
def play_audio(self) -> None: settings = mc.model.SettingsM.get() audio_path_str = settings.breathing_reminder_audio_path_str volume_int = settings.breathing_reminder_volume_int sound_effect = QtMultimedia.QSoundEffect(self) # -PLEASE NOTE: A parent has to be given here, otherwise we will not hear anything sound_effect.setSource(QtCore.QUrl.fromLocalFile(audio_path_str)) sound_effect.setVolume(float(volume_int / 100)) sound_effect.play()
def alert_knife(self): self.alert_box = QtWidgets.QMessageBox() self.alert_box.setIcon(QtWidgets.QMessageBox.Critical) self.alert_box.setText("Knife Detected!") self.alert_box.show() self.alert_sound = QtMultimedia.QSoundEffect() self.alert_sound.setSource(QtCore.QUrl.fromLocalFile('siren.wav')) self.alert_sound.play() self.ig.populate(pics, QtCore.QSize(200, 200)) logger_msg.warning( "Suspicious activity involving knives detected @ " + str(datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")))
def __init__(self, *args, **kwargs): super().__init__() self.setupUi(self) self._flip.clicked.connect(self._flipCard) self._next.clicked.connect(self._nextCard) self._previous.clicked.connect(self._prevCard) self._shuffle.clicked.connect(self._shuffleCards) self.flip_audio = QtMultimedia.QSoundEffect() flip_audio_link = QtCore.QUrl.fromLocalFile(f"{AUDIO_DIR}/flip.wav") # self.flip_audio.setMedia(QtMultimedia.QMediaContent(flip_audio_link)) self.flip_audio.setSource(flip_audio_link) # self._practice.clicked.connect(self._practiceDeck) # self._refresh.clicked.connect(self._refreshCards) self._refresh.hide()
def play_audio(self) -> None: try: settings = mc.model.SettingsM.get() audio_path_str = settings.breathing_reminder_audio_path_str volume_int = settings.breathing_reminder_volume_int sound_effect = QtMultimedia.QSoundEffect(self) # -PLEASE NOTE: A parent has to be given here, otherwise we will not hear anything sound_effect.setSource(QtCore.QUrl.fromLocalFile(audio_path_str)) sound_effect.setVolume(float(volume_int / 100)) sound_effect.play() except NameError: logging.debug( "NameError - Cannot play audio since QtMultimedia has not been imported" )
def timer_check(self): t = time.localtime(time.time()) local_h, local_m, local_s = t[3], t[4], t[5] if local_s == self.past_local_s_timer: return self.past_local_s_timer = local_s data = self.cur.execute("SELECT * FROM Timer").fetchall() for i in data: TimerId, tms, RingId, title, status, volume, timer_out = i[0], i[1], i[2], str(i[3]), \ i[4], i[5], i[6] if tms == "00:00:00": continue if timer_out: timer_out += 1 else: timer_out = 1 if status and tms and RingId: RingPath = self.cur.execute( f"SELECT Link FROM Ringtone WHERE RingId = {RingId}" ).fetchone()[0] tms = int(tms.split(":")[0]) * 3600 + int( tms.split(":")[1]) * 60 + int(tms.split(":")[2]) tms_out = tms - timer_out self.cur.execute( f"UPDATE Timer SET TimeOut = {timer_out} WHERE TimerId = {TimerId}" ) self.con.commit() index = self.timer_indexs[TimerId] self.timer_table_widget.setItem( index, 2, QtWidgets.QTableWidgetItem( str( time.strftime("%H:%M:%S", time.gmtime(tms - timer_out))))) if tms_out == 0: sound = QtMultimedia.QSoundEffect() sound.setSource(QtCore.QUrl.fromLocalFile(str(RingPath))) sound.setLoopCount(QtMultimedia.QSoundEffect.Infinite) sound.setVolume(volume) sound.play() self.timer_table_widget.cellWidget( self.timer_indexs[TimerId], 6).click() QMessageBox.information(self, str(title), "Время вышло!") sound.stop() break
def __init__(self, mainwindow, melody="", id=None, alarm_or_timer=True): super().__init__() self.rs = melody self.signal.connect(self.closeEvent) self.backwidget = QtWidgets.QWidget(self) self.backwidget.setGeometry(QtCore.QRect(0, 0, 3000, 3000)) self.setStyleSheet(self.qss) self.setupUi(self) self.mainwindow = mainwindow self.buttonBox.accepted.connect(self.ok_pressed) self.buttonBox.rejected.connect(self.cancel_pressed) self.pushButton_2.clicked.connect(self.plus) self.pushButton_3.clicked.connect(self.delete) self.con = sqlite3.connect("clock.sqlite") self.cur = self.con.cursor() res = self.cur.execute("select Title, Link from Ringtone").fetchall() self.res = {k: v for k, v in res} self.listWidget.addItems(self.res.keys()) self.pushButton.clicked.connect(self.play) self.sound = QtMultimedia.QSoundEffect() self.horizontalSlider.setRange(0, 100) if id: if alarm_or_timer: volume = self.cur.execute( f"SELECT Volume FROM Alarm WHERE AlarmId = {id}").fetchone( )[0] if volume: self.horizontalSlider.setValue(volume) else: self.horizontalSlider.setValue(100) else: volume = self.cur.execute( f"SELECT Volume FROM Timer WHERE TimerId = {id}").fetchone( )[0] if volume: self.horizontalSlider.setValue(volume) else: self.horizontalSlider.setValue(100) else: self.horizontalSlider.setValue(100) self.horizontalSlider.valueChanged.connect(self.volumeChangeEvent) self.state = 0 self.pushButton.setIcon(QtGui.QIcon("play.png")) self.pushButton_2.setIcon(QtGui.QIcon("plus.png")) self.pushButton_3.setIcon(QtGui.QIcon("minus.png"))
def play_audio(self) -> None: # , i_file_name: str """ Qt audio overview: http://doc.qt.io/qt-5/audiooverview.html Please note that the audio file must be wav, if we want to play compressed audio files it will be more complicated (see docs page above) """ settings = mc.model.SettingsM.get() audio_path_str = settings.breathing_reminder_audio_path_str # mc.mc_global.get_user_audio_path(settings.breathing_reminder_audio_path_str) volume_int = settings.breathing_reminder_volume_int # QtMultimedia.QSound.play(audio_path_str) sound_effect = QtMultimedia.QSoundEffect(self) # -PLEASE NOTE: A parent has to be given here, otherwise we will not hear anything sound_effect.setSource(QtCore.QUrl.fromLocalFile(audio_path_str)) sound_effect.setVolume(float(volume_int / 100)) sound_effect.play()
def __init__(self, defaultSize, defaultGain): # State self.isAudio = False self.isAnim = False # Animation data self.pos = np.array([(-100, -100)]) self.pens = [pg.mkPen(color=[0, 0, 0, 0])] self.sizes = [1] self.shapes = ["o"] self.adj = [] self.defaultSize = defaultSize * 100 # Audio data self.audio = QtMultimedia.QSoundEffect() self.audio.setLoopCount(0) self.audio.setVolume(defaultGain * 100) self.audOffset = 0 self.defaultOffset = 0
def alarm_check(self): t = time.localtime(time.time()) local_h, local_m, local_s, local_day = t[3], t[4], t[5], t[6] if local_s == self.past_local_s_alarm: return self.past_local_s_alarm = local_s if local_s != 1: return data = self.cur.execute("SELECT * FROM Alarm").fetchall() for i in data: AlarmId, tm, RingId, title, days, status, volume = i[0], i[1], i[2], str(i[3]), \ i[4], i[5], i[6] if status and tm and RingId: RingPath = self.cur.execute( f"SELECT Link FROM Ringtone WHERE RingId = {RingId}" ).fetchone()[0] if local_h == int(i[1].split(":")[0]) and local_m == int( i[1].split(":")[1]): sound = QtMultimedia.QSoundEffect() sound.setSource(QtCore.QUrl.fromLocalFile(str(RingPath))) sound.setLoopCount(QtMultimedia.QSoundEffect.Infinite) sound.setVolume(volume) if days: days = "0" * (7 - len(str(days))) + str(days) days = [ index for index, i in enumerate(days) if i == "1" ] if local_day in days: sound.play() QMessageBox.information(self, str(title), f"{tm}") sound.stop() self.alarm_update() else: sound.play() QMessageBox.information(self, str(title), f"{tm}") self.cur.execute( f"UPDATE Alarm SET Status = 0 WHERE AlarmId = {AlarmId}" ) self.con.commit() sound.stop() self.alarm_update()
def on_submit(self): string_to_wav(self.text.text(), self.bpm.value()) self.sound = QtMultimedia.QSoundEffect() self.sound.setSource(QtCore.QUrl.fromLocalFile('doorbell.wav')) self.sound.setVolume(50) self.sound.play()
def __init__(self): super().__init__() self.sys_tray = SystemTray() self.rest_reminder_dialog = None self.rest_widget = None self.tray_icon = None self.rest_reminder_qtimer = None self.breathing_qtimer = None self.suspend_qtimer = None self.rest_prepare_dialog = None self.intro_dlg = None self.breathing_notification = None self.breathing_dialog = None self._suspend_time_dlg = None self.sound_effect = None self.settings_page_wt = mc.gui.settings_page_wt.SettingsPageWt() try: self.sound_effect = QtMultimedia.QSoundEffect(self) # -PLEASE NOTE: A parent has to be given here, otherwise we will not hear anything except NameError: logging.debug( "NameError - Cannot play audio since QtMultimedia has not been imported" ) # self.active_breathing_phrase_qgb = QtWidgets.QGroupBox("Active Breathing Phrase") self._setup_initialize() self.setCentralWidget(self.settings_page_wt) self._connect_slots_to_signals() self.setup_systray() # Setup of Menu self.menu_bar = self.menuBar() self.update_menu() # Setup of Timers self.on_breathing_settings_changed() self.update_rest_timer() # Startup actions if not mc.mc_global.db_file_exists_at_application_startup_bl and not mc.mc_global.testing_bool: self.show_intro_dialog() self.open_breathing_prepare() self.show() self.minimize_to_tray() settings = mc.model.SettingsM.get() if settings.nr_times_started_since_last_feedback_notif != mc.mc_global.FEEDBACK_DIALOG_NOT_SHOWN_AT_STARTUP: if (settings.nr_times_started_since_last_feedback_notif >= mc.mc_global.NR_OF_TIMES_UNTIL_FEEDBACK_SHOWN_INT - 1): self.show_feedback_dialog() settings.nr_times_started_since_last_feedback_notif = 0 else: settings.nr_times_started_since_last_feedback_notif += 1 else: pass
def __init__(self): QtWidgets.QWidget.__init__(self) # use main_ui for window setup self.ui = threepio_ui.Ui_MainWindow() with open("stylesheet.qss") as f: self.setStyleSheet(f.read()) self.ui.setupUi(self) self.setWindowTitle("threepio") # hide the close/minimize/fullscreen buttons self.setWindowFlags(QtCore.Qt.Window | QtCore.Qt.WindowTitleHint | QtCore.Qt.CustomizeWindowHint) # mode self.legacy_mode = False self.mode = Threepio.Mode.NORMAL # "console" output self.message_log: list[LogTask] = [] self.log(">>> THREEPIO") self.update_console() # clock self.clock = SuperClock() with open("ra-cal.txt", "r") as f: # get data from file i = f.readline().strip() e = float(f.readline()) self.clock.calibrate(i, e) # initialize stripchart self.stripchart_display_seconds = 8 self.should_clear_stripchart = False self.channel_visibility = (True, True) stripchart_log_task = self.log("Initializing stripchart...") self.stripchart_series_a = QtChart.QLineSeries() self.stripchart_series_b = QtChart.QLineSeries() self.axis_y = QtChart.QValueAxis() self.chart = QtChart.QChart() self.ui.stripchart.setRenderHint(QtGui.QPainter.Antialiasing) self.initialize_stripchart() # should this include more of the above? stripchart_log_task.set_status(0) self.update_stripchart_speed() stripchart_log_task = self.log("Initializing buttons...") # connect buttons self.ui.stripchart_speed_slider.valueChanged.connect( self.update_stripchart_speed) self.ui.actionInfo.triggered.connect(self.handle_credits) self.ui.actionScan.triggered.connect(self.handle_scan) self.ui.actionSurvey.triggered.connect(self.handle_survey) self.ui.actionSpectrum.triggered.connect(self.handle_spectrum) self.ui.actionGetInfo.triggered.connect(self.handle_get_info) self.ui.actionDec.triggered.connect(self.dec_calibration) self.ui.actionRA.triggered.connect(self.ra_calibration) self.ui.actionNormal.triggered.connect(self.set_state_normal) self.ui.actionTesting.triggered.connect(self.set_state_testing) self.ui.actionLegacy.triggered.connect(self.toggle_state_legacy) self.ui.toggle_channel_button.clicked.connect(self.toggle_channels) self.ui.chart_clear_button.clicked.connect(self.clear_stripchart) stripchart_log_task.set_status(0) # Tars/DATAQ dataq, arduino = discovery() self.tars = Tars(parent=self, device=dataq) self.tars.start() self.minitars = MiniTars(parent=self, device=arduino) self.minitars.start() # bleeps and bloops stripchart_log_task = self.log("Initializing audio...") self.beep_sound = QtMultimedia.QSoundEffect() url = QtCore.QUrl() self.beep_sound.setSource(url.fromLocalFile("assets/beep3.wav")) self.beep_sound.setVolume(0.5) # self.click_sound.play() self.last_beep_time = 0.0 self.tobeepornottobeep = False stripchart_log_task.set_status(0) # alerts self.open_alert = None self.alert_thread: set[QtCore.QThread] = set() self.worker = None # establish observation self.obs = None self.obs_state = False self.completed_one_calibration = False # establish data array & most recent dec self.data = [] self.current_dec = 0.0 self.current_data_point = None # tars communication interpretation self.previous_transmission = None # telescope visualization self.dec_scene = QtWidgets.QGraphicsScene() self.ui.dec_view.setScene(self.dec_scene) self.update_dec_view() # run initial calibration self.dec_calc = DecCalc() self.dec_calc.load_dec_cal() # primary clock stripchart_log_task = self.log("Initializing clock...") self.timer = QtCore.QTimer(self) self.timer.timeout.connect(self.tick) # do everything self.timer.start(self.BASE_PERIOD) # set refresh rate # assign timers to functions meant to fire periodically self.clock.add_timer(1000, self.update_gui) self.data_timer = self.clock.add_timer(1000, self.update_data) stripchart_log_task.set_status(0) # measure refresh rate self.time_of_last_fps_update = time.perf_counter() self.ticks_since_last_fps_update = 0 # alert user that threepio is done initializing self.message("Ready!!!")
def __init__(self): super(Window, self).__init__() self.setWindowTitle("Crime Predict") self.setStyleSheet("background-color: white;") self.thread_pistol = None self.thread_knife = None self.worker_pistol = None self.worker_knife = None # Setting up pistol buttons self.push_button_pistol_start = QtWidgets.QPushButton( 'Start Pistol_Detect') self.push_button_pistol_start.clicked.connect(self.start_pistol_detect) self.push_button_pistol_wait = QtWidgets.QPushButton( 'Please wait... Pistol_Detect is loading...') self.push_button_pistol_stop = QtWidgets.QPushButton( 'Stop Pistol_Detect') self.push_button_pistol_wait.hide() self.push_button_pistol_stop.hide() # Setting up knife buttons self.push_button_knife_start = QtWidgets.QPushButton( 'Start Knife_Detect') self.push_button_knife_start.clicked.connect(self.start_knife_detect) self.push_button_knife_wait = QtWidgets.QPushButton( 'Please Wait... Knife_Detect is loading...') self.push_button_knife_stop = QtWidgets.QPushButton( 'Stop Knife_Detect') self.push_button_knife_wait.hide() self.push_button_knife_stop.hide() # Show initialised cam feed (offline) self.w1 = QtWidgets.QLabel() self.w1.setPixmap(QtGui.QPixmap("gun.jpeg")) self.w2 = QtWidgets.QLabel() self.w2.setPixmap(QtGui.QPixmap("knife.jpg")) # Vertical layout for pistol-related widgets self.pistol_buttons = QtWidgets.QVBoxLayout() self.pistol_buttons.addWidget(self.push_button_pistol_start) self.pistol_buttons.addWidget(self.push_button_pistol_wait) self.pistol_buttons.addWidget(self.push_button_pistol_stop) self.pistol_buttons.addWidget(self.w1) # Vertical layout for knife-related widgets self.knife_buttons = QtWidgets.QVBoxLayout() self.knife_buttons.addWidget(self.push_button_knife_start) self.knife_buttons.addWidget(self.push_button_knife_wait) self.knife_buttons.addWidget(self.push_button_knife_stop) self.knife_buttons.addWidget(self.w2) # Horizontal layout for both pistol and knife vertical layouts self.horizontal_layout_buttons = QtWidgets.QHBoxLayout() self.horizontal_layout_buttons.addLayout(self.pistol_buttons) self.horizontal_layout_buttons.addLayout(self.knife_buttons) # Text Browser Box for messages self.message_box = QtWidgets.QTextBrowser() self.message_box.setFixedSize(800, 200) self.message_box.setFontFamily("Tahoma") XStream.stdout().messageWritten.connect( self.message_box.insertPlainText) self.message_box.insertPlainText('WELCOME TO CRIME_PREDICT\n') # Initialize tab screen self.tabs = QtWidgets.QTabWidget() self.tab1 = QtWidgets.QWidget() self.tab2 = QtWidgets.QWidget() # Add tabs self.tabs.addTab(self.tab1, "Camera Feeds") self.tabs.addTab(self.tab2, "Alerts and Events Center") # Set Tab 1 layout self.tab1.layout = QtWidgets.QVBoxLayout() self.tab1.layout.addLayout(self.horizontal_layout_buttons) self.tab1.layout.addWidget(self.message_box) self.tab1.setLayout(self.tab1.layout) # Image gallery self.ig = ImageGallery() self.ig.populate(pics, QtCore.QSize(200, 200)) self.ig.show() # Set Tab 2 layout self.tab2.layout = QtWidgets.QVBoxLayout() # self.tab2.layout.addLayout(self.horizontal_layout_buttons) self.tab2.layout.addWidget(self.ig) self.tab2.setLayout(self.tab2.layout) # Play start-up sound self.start_up_sound = QtMultimedia.QSoundEffect() self.start_up_sound.setSource( QtCore.QUrl.fromLocalFile('start-up.wav')) self.start_up_sound.play() # Initialise sounds FX self.info_start = QtMultimedia.QSoundEffect() self.info_start.setSource(QtCore.QUrl.fromLocalFile('info-start.wav')) self.info_stop = QtMultimedia.QSoundEffect() self.info_stop.setSource(QtCore.QUrl.fromLocalFile('info-stop.wav')) self.setCentralWidget(self.tabs)
def __init__(self): super().__init__() self.sys_tray = SystemTray() self.rest_reminder_dialog = None self.rest_widget = None self.tray_icon = None self.rest_reminder_qtimer = None self.breathing_qtimer = None self.suspend_qtimer = None self.rest_prepare_dialog = None self.intro_dlg = None self.breathing_notification = None self.breathing_dialog = None self._suspend_time_dlg = None self.sound_effect = None try: self.sound_effect = QtMultimedia.QSoundEffect(self) # -PLEASE NOTE: A parent has to be given here, otherwise we will not hear anything except NameError: logging.debug( "NameError - Cannot play audio since QtMultimedia has not been imported" ) self.active_breathing_phrase_qgb = QtWidgets.QGroupBox( "Active Breathing Phrase") self.br_settings_wt = mc.gui.breathing_settings_wt.BreathingSettingsWt( ) self.br_phrase_list_wt = mc.gui.breathing_phrase_list_wt.BreathingPhraseListWt( ) self.rest_settings_wt = mc.gui.rest_settings_wt.RestSettingsWt() self.rest_action_list_wt = mc.gui.rest_action_list_wt.RestActionListWt( ) self.breathing_history_wt = mc.gui.breathing_history_wt.BreathingHistoryWt( ) if QtCore.QSysInfo.kernelType() == 'darwin': self.run_on_startup_wt = mc.gui.general_settings_wt.RunOnStartupWt( ) self.run_on_startup_wt.run_on_startup_qcb.toggled.connect( self.run_on_startup_wt.on_run_on_startup_toggled) self._setup_initialize() main_container_hbox_l3 = self._setup_main_container() self._setup_add_first_panel_to_main_container(main_container_hbox_l3) self._setup_add_breathing_phrase_list_to_main_container( main_container_hbox_l3) self._setup_add_rest_action_list_to_main_container( main_container_hbox_l3) self.setup_systray() # Setup of Menu self.menu_bar = self.menuBar() self.update_menu() # Setup of Timers self.on_breathing_settings_changed() self.update_rest_timer() # Startup actions if not mc.mc_global.db_file_exists_at_application_startup_bl and not mc.mc_global.testing_bool: self.show_intro_dialog() self.open_breathing_prepare() self.show() self.minimize_to_tray() settings = mc.model.SettingsM.get() if settings.nr_times_started_since_last_feedback_notif != mc.mc_global.FEEDBACK_DIALOG_NOT_SHOWN_AT_STARTUP: if (settings.nr_times_started_since_last_feedback_notif >= mc.mc_global.NR_OF_TIMES_UNTIL_FEEDBACK_SHOWN_INT - 1): self.show_feedback_dialog() settings.nr_times_started_since_last_feedback_notif = 0 else: settings.nr_times_started_since_last_feedback_notif += 1 else: pass
def __init__(self, wav_file, *args, **kwargs): super().__init__(*args, **kwargs) self.wav_file = wav_file self.player = qtmm.QSoundEffect() self.player.setSource(qtc.QUrl.fromLocalFile(wav_file)) self.clicked.connect(self.player.play)
def __init__(self): QtWidgets.QWidget.__init__(self) # use main_ui for window setup self.ui = threepio_ui.Ui_MainWindow() self.setStyleSheet(open('stylesheet.qss').read()) self.ui.setupUi(self) self.setWindowTitle("Threepio") # hide the close/minimize/fullscreen buttons self.setWindowFlags(QtCore.Qt.Window | QtCore.Qt.WindowTitleHint | QtCore.Qt.CustomizeWindowHint) # connect buttons self.ui.stripchart_speed_slider.valueChanged.connect(self.update_speed) # self.ui.speed_slower_radio.clicked.connect(self.update_speed) # self.ui.speed_default_radio.clicked.connect(self.update_speed) self.ui.actionInfo.triggered.connect(self.handle_credits) self.ui.actionScan.triggered.connect(self.handle_scan) self.ui.actionSurvey.triggered.connect(self.handle_survey) self.ui.actionSpectrum.triggered.connect(self.handle_spectrum) self.ui.actionDec.triggered.connect(self.dec_calibration) self.ui.actionRA.triggered.connect(self.ra_calibration) self.ui.actionNormal.triggered.connect(self.set_state_normal) self.ui.actionTesting.triggered.connect(self.set_state_testing) self.ui.actionLegacy.triggered.connect(self.legacy_mode) self.ui.chart_clear_button.clicked.connect(self.clear_stripchart) self.ui.chart_legacy_button.clicked.connect(self.legacy_mode) # DATAQ stuff self.tars = Tars(parent=self) self.tars.setup() self.tars.start() # clock self.clock = None self.set_time() # bleeps and bloops self.click_sound = QtMultimedia.QSoundEffect() url = QtCore.QUrl() self.click_sound.setSource(url.fromLocalFile("assets/beep5.wav")) self.click_sound.setVolume(0.5) self.click_sound.play() self.last_beep_time = 0.0 # initialize stripchart self.stripchart_series_a = QtChart.QLineSeries() self.stripchart_series_b = QtChart.QLineSeries() self.axis_y = QtChart.QValueAxis() self.chart = QtChart.QChart() self.ui.stripchart.setRenderHint(QtGui.QPainter.Antialiasing) pen = QtGui.QPen(QtGui.QColor(self.BLUE)) pen.setWidth(1) self.stripchart_series_a.setPen(pen) pen.setColor(QtGui.QColor(self.RED)) self.stripchart_series_b.setPen(pen) self.initialize_stripchart() self.update_speed() # establish observation self.observation = None # establish data array & most recent dec self.data = [] self.current_dec = 0.0 # run initial calibration self.load_dec_cal() # refresh timer self.timer = QtCore.QTimer(self) self.timer.timeout.connect(self.tick) # do everything self.timer.start(self.timer_rate) # set refresh rate