Коммит e063f9d3 создал по автору Леляев Петр Алексеевич's avatar Леляев Петр Алексеевич
Просмотр файлов

Добавлена ссылка на инструкцию

владелец 6f5d1611
......@@ -6,9 +6,11 @@ import time
from multiprocessing import Process
from threading import Thread
from PyQt5.QtCore import QThread, pyqtSignal, Qt
from PyQt5 import QtGui
from PyQt5.QtCore import QThread, pyqtSignal, Qt, QUrl
from PyQt5.QtGui import QCloseEvent
from PyQt5.QtWidgets import QGridLayout, QPushButton, QWidget, QLabel, QMessageBox
from qtpy import QtCore
from school_ringer_modules.calendar_editor import CalendarEditor, is_holiday_today
from school_ringer_modules.config import sound_path, debug
......@@ -299,14 +301,29 @@ class CallsSettings(QWidget):
subprocess.run('pkill play', shell=True)
self.play_music_on_breaks_btn.setText('Играть музыку на переменах')
def download_instructions(self):
try:
current_user_on_x = run_command('who | grep tty').strip().split()[0]
if current_user_on_x:
run_command(f'su - {current_user_on_x} -c "DISPLAY=:0 chromium-browser '
f'https://hub.mos.ru/mos/src/school-ringer/-/blob/master/instruction.pdf"')
else:
logging.info('Не найден пользователь с графической оболочкой. Невозможно открыть инструкцию')
except Exception as e:
logging.info(f'Возникло исключение: {e}. Невозможно открыть инструкцию.')
def initUI(self) -> None:
"""
Инициализация графического интерфейса
"""
grid = QGridLayout()
self.setLayout(grid)
self.holidaysLabel = QLabel()
grid.addWidget(self.holidaysLabel, 0, 0, 1, 2)
self.instructions_link = QLabel('Скачать инструкцию')
self.instructions_link.setOpenExternalLinks(True)
self.instructions_link.setStyleSheet('color: blue; text-decoration: underline; cursor: hand')
self.instructions_link.mousePressEvent = lambda event: self.download_instructions()
self.instructions_link.setCursor(Qt.PointingHandCursor)
grid.addWidget(self.instructions_link, 0, 0, 1, 2)
# notification_button = QPushButton('🎤 Выполнить оповещение')
# notification_button.clicked.connect(self.make_notification)
# grid.addWidget(notification_button, 0, 2, 1, 2)
......
Поддерживает Markdown
0% или .
You are about to add 0 people to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Пожалуйста, зарегистрируйтесь или чтобы прокомментировать