예제 #1
0
 def endSoundPlayButtonClicked(self) -> None:
     if self.endSoundFileLabel.text():
         sound.play(
             self.trigger.package.audio_data.get(
                 self.endSoundFileLabel.text(), None),
             self.endSoundVolumeSlider.value(),
         )
예제 #2
0
 def _update(self):
     if self._active:
         remaining = self.end_time - datetime.datetime.now()
         remaining_seconds = max(remaining.total_seconds(), 0)
         self.progress.setValue(
             remaining.seconds if self._direction ==
             NDirection.DOWN else self.progress.maximum() -
             remaining_seconds)
         if remaining_seconds <= 30:
             self.setStyleSheet(self.styleSheet() + styles.spell_warning())
             if not self._alert:
                 self._alert = True
                 if self._sound:
                     sound.play(self._sound)
         else:
             self._alert = False
         if remaining_seconds <= 0:
             if self.persistent:
                 self._time_label.setText("")
             else:
                 self._remove()
         else:
             self._time_label.setText(format_time(remaining))
         self.progress.update()
     QTimer.singleShot(1000, self._update)
예제 #3
0
파일: __init__.py 프로젝트: wckdtrb/nparse
 def _triggered(self,
                trigger: Trigger,
                action: TriggerAction,
                timestamp,
                re_groups: dict = None) -> None:
     if action.sound.enabled:
         sound.play(
             trigger.package.audio_data.get(action.sound.name, None),
             action.sound.volume,
         )
     if action.timer.enabled:
         group = None
         for g in self.container.groups():
             if g.name == trigger.name:
                 group = g
         if not group:
             group = NGroup(group_name=trigger.name, hide_title=True)
         text = action.timer.text if action.timer.text else trigger.name
         if action.timer.text and re_groups:
             text = replace_from_regex_groups(action.timer.text, re_groups)
         self.container.add_timer(
             group,
             NTimer(
                 name=text,
                 style=styles.trigger(
                     action.timer.bar_color,
                     action.timer.text_color,
                 ),
                 duration=text_time_to_seconds(action.timer.duration),
                 icon=action.timer.icon,
                 timestamp=timestamp,
                 direction=NDirection.DOWN,
                 persistent=action.timer.persistent,
                 noreplace=action.timer.noreplace,
             ),
         )
     if action.text.enabled:
         self._text_parser.display(trigger_text=action.text,
                                   re_groups=re_groups)
예제 #4
0
파일: __init__.py 프로젝트: wckdtrb/nparse
 def spellsSoundPlayButtonClicked(self):
     sound.play(mp3_to_data(self.spellsSoundFileLabel.text()))
예제 #5
0
파일: __init__.py 프로젝트: wckdtrb/nparse
 def ttsPlayButtonClicked(self) -> None:
     sound.play(
         mp3_to_data(
             os.path.join("data/tts", self.ttsFileCombo.currentText())))