[main] use constants for app info
This commit is contained in:
parent
2d3991ae48
commit
f30c2eb36e
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,2 +1,3 @@
|
||||
*.pyc
|
||||
*__pycache__
|
||||
*__pycache__
|
||||
resources.py
|
||||
|
@ -2,13 +2,20 @@ import os
|
||||
import glob
|
||||
from PyQt5.QtGui import QIcon
|
||||
from PyQt5.QtMultimedia import QMediaContent
|
||||
from PyQt5.QtCore import QUrl
|
||||
from PyQt5.QtCore import QDirIterator, QUrl
|
||||
|
||||
import resources
|
||||
|
||||
organization = "neuroetho.uni-tuebingen.de"
|
||||
application = "blipblop"
|
||||
version = 0.1
|
||||
SNDS_DICT = {}
|
||||
it = QDirIterator(":", QDirIterator.Subdirectories);
|
||||
while it.hasNext():
|
||||
name = it.next()
|
||||
if "sounds/" in name:
|
||||
SNDS_DICT[name.split("/")[-1]] = "qrc" + name
|
||||
|
||||
organization_name = "de.uni-tuebingen.neuroetho"
|
||||
application_name = "BlipBlop"
|
||||
application_version = 0.1
|
||||
|
||||
PACKAGE_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir))
|
||||
ICONS_FOLDER = os.path.join(PACKAGE_ROOT, "icons")
|
||||
@ -20,20 +27,12 @@ ICONS_PATHS.extend(glob.glob(os.path.join(ICONS_FOLDER, "*.icns")))
|
||||
ICONS_PATHS = sorted(ICONS_PATHS)
|
||||
ICON_DICT = {}
|
||||
|
||||
SNDS_PATHS = glob.glob(os.path.join(SNDS_FOLDER, "*.wav"))
|
||||
SNDS_PATHS = sorted(SNDS_PATHS)
|
||||
SNDS_DICT = {}
|
||||
|
||||
for icon in ICONS_PATHS:
|
||||
ICON_DICT[icon.split(os.sep)[-1].split(".")[0]] = icon
|
||||
|
||||
for snd in SNDS_PATHS:
|
||||
SNDS_DICT[snd.split(os.sep)[-1].split(".")[0]] = snd
|
||||
|
||||
|
||||
def get_sound(name):
|
||||
if name in SNDS_DICT.keys():
|
||||
return QMediaContent(QUrl.fromLocalFile(os.path.abspath(SNDS_DICT[name])))
|
||||
return QMediaContent(QUrl(SNDS_DICT[name]))
|
||||
else:
|
||||
print("Sound %s not found!" % name)
|
||||
return None
|
||||
@ -43,5 +42,5 @@ def get_icon(name):
|
||||
if name in ICON_DICT.keys():
|
||||
return QIcon(ICON_DICT[name])
|
||||
else:
|
||||
return QIcon("nix_logo.png")
|
||||
return QIcon("blipblop_logo.png")
|
||||
|
||||
|
@ -16,9 +16,9 @@ except ImportError:
|
||||
|
||||
def main():
|
||||
app = QApplication(sys.argv)
|
||||
app.setApplicationName("blipblop")
|
||||
app.setApplicationVersion("0.1")
|
||||
app.setOrganizationDomain("neuroetho.uni-tuebingen.de")
|
||||
app.setApplicationName(cnst.application_name)
|
||||
app.setApplicationVersion(cnst.application_version)
|
||||
app.setOrganizationDomain(cnst.organization_name)
|
||||
app.setWindowIcon(QIcon(":/icons/app_icon_png"))
|
||||
settings = QSettings()
|
||||
width = int(settings.value("app/width", 1024))
|
||||
|
@ -1,5 +1,5 @@
|
||||
from PyQt5.QtWidgets import QAction, QComboBox, QFormLayout, QGridLayout, QLabel, QPushButton, QSizePolicy, QSlider, QSpinBox, QSplitter, QTextEdit, QVBoxLayout, QWidget
|
||||
from PyQt5.QtCore import QPoint, QRandomGenerator, QTimer, Qt, pyqtSignal
|
||||
from PyQt5.QtCore import QPoint, QRandomGenerator, QTimer, Qt, endl, pyqtSignal
|
||||
from PyQt5.QtGui import QColor, QFont, QIcon, QKeySequence, QPainter, QPen, QPixmap
|
||||
from PyQt5.QtMultimedia import QMediaPlayer
|
||||
|
||||
@ -98,7 +98,7 @@ class SettingsPanel(QWidget):
|
||||
self._countdown_spinner.setEnabled(enabled)
|
||||
self._min_delay_spinner.setEnabled(enabled)
|
||||
self._max_delay_spinner.setEnabled(enabled)
|
||||
self._sound_combo.setEnabled(False)
|
||||
self._sound_combo.setEnabled(enabled)
|
||||
|
||||
|
||||
class AudioBlop(QWidget):
|
||||
@ -135,10 +135,10 @@ class AudioBlop(QWidget):
|
||||
grid.addWidget(settings_btn, 0, 3, Qt.AlignRight)
|
||||
|
||||
self._status_label = QLabel("Ready to start, press enter ...")
|
||||
grid.addWidget(self._status_label, 3, 0, Qt.AlignLeft)
|
||||
grid.addWidget(self._status_label, 4, 0, Qt.AlignLeft)
|
||||
|
||||
self._countdown_label = CountdownLabel(text="Next trial in:")
|
||||
grid.addWidget(self._countdown_label, 3, 1, Qt.AlignCenter)
|
||||
grid.addWidget(self._countdown_label, 4, 1, Qt.AlignCenter)
|
||||
self._countdown_label.countdown_done.connect(self.run_trial)
|
||||
|
||||
self._draw_area = QLabel()
|
||||
|
@ -16,12 +16,12 @@ class HelpDialog(QDialog):
|
||||
|
||||
self.help._edit.historyChanged.connect(self._on_history_changed)
|
||||
|
||||
self.back_btn = QPushButton(QIcon(":/icons/back_btn"), "back")
|
||||
self.back_btn = QPushButton(QIcon(":/icons/docs_back"), "back")
|
||||
self.back_btn.setEnabled(False)
|
||||
self.back_btn.clicked.connect(self.help._edit.backward)
|
||||
self.home_btn = QPushButton(QIcon(":/icons/home_btn"),"home")
|
||||
self.home_btn = QPushButton(QIcon(":/icons/docs_home"),"home")
|
||||
self.home_btn.clicked.connect(self.help._edit.home)
|
||||
self.fwd_btn = QPushButton(QIcon(":/icons/fwd_btn"),"forward")
|
||||
self.fwd_btn = QPushButton(QIcon(":/icons/docs_fwd"),"forward")
|
||||
self.fwd_btn.setEnabled(False)
|
||||
self.fwd_btn.clicked.connect(self.help._edit.forward)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user