Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added zukeUI/__init__.py
Empty file.
5 changes: 5 additions & 0 deletions zukeUI/assets/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"zukebox_user": "MOHI",
"zukebox_ip": "10.30.255.175",
"zukebox_port": "5000"
}
Binary file added zukeUI/assets/default.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
305 changes: 305 additions & 0 deletions zukeUI/assets/zukeUI.ui
Original file line number Diff line number Diff line change
@@ -0,0 +1,305 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Form</class>
<widget class="QWidget" name="Form">
<property name="windowModality">
<enum>Qt::ApplicationModal</enum>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>569</width>
<height>708</height>
</rect>
</property>
<property name="contextMenuPolicy">
<enum>Qt::DefaultContextMenu</enum>
</property>
<property name="windowTitle">
<string>ZukeUI</string>
</property>
<property name="windowIcon">
<iconset>
<normaloff>zukebox.jpg</normaloff>zukebox.jpg</iconset>
</property>
<widget class="QWidget" name="widget" native="true">
<property name="geometry">
<rect>
<x>40</x>
<y>50</y>
<width>491</width>
<height>311</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="0">
<widget class="QLabel" name="track_picture">
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap>default.jpg</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QLabel" name="track_title">
<property name="geometry">
<rect>
<x>30</x>
<y>9</y>
<width>511</width>
<height>31</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
<widget class="QFrame" name="frame_2">
<property name="geometry">
<rect>
<x>40</x>
<y>480</y>
<width>491</width>
<height>171</height>
</rect>
</property>
<property name="frameShape">
<enum>QFrame::WinPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<widget class="QTextEdit" name="link_edit">
<property name="geometry">
<rect>
<x>20</x>
<y>10</y>
<width>461</width>
<height>31</height>
</rect>
</property>
<property name="placeholderText" stdset="0">
<string>URL:</string>
</property>
</widget>
<widget class="QTextEdit" name="message_edit">
<property name="geometry">
<rect>
<x>20</x>
<y>50</y>
<width>461</width>
<height>31</height>
</rect>
</property>
<property name="placeholderText" stdset="0">
<string>Message:</string>
</property>
</widget>
<widget class="QFrame" name="frame">
<property name="geometry">
<rect>
<x>10</x>
<y>90</y>
<width>471</width>
<height>71</height>
</rect>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QPushButton" name="playorpause_button">
<property name="text">
<string>Play/Pause</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="send_button">
<property name="text">
<string>Send</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<widget class="QSlider" name="volume_slider">
<property name="geometry">
<rect>
<x>130</x>
<y>410</y>
<width>381</width>
<height>20</height>
</rect>
</property>
<property name="accessibleName">
<string/>
</property>
<property name="tracking">
<bool>false</bool>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
<widget class="QSlider" name="seek_slider">
<property name="geometry">
<rect>
<x>130</x>
<y>440</y>
<width>381</width>
<height>20</height>
</rect>
</property>
<property name="accessibleName">
<string/>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="tracking">
<bool>false</bool>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
<widget class="QLabel" name="track_sender">
<property name="geometry">
<rect>
<x>142</x>
<y>380</y>
<width>381</width>
<height>21</height>
</rect>
</property>
<property name="font">
<font>
<family>DejaVu Sans</family>
<pointsize>12</pointsize>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
</font>
</property>
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
<widget class="QLabel" name="error_message">
<property name="geometry">
<rect>
<x>60</x>
<y>670</y>
<width>441</width>
<height>31</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>12</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<widget class="QLabel" name="volume_label">
<property name="geometry">
<rect>
<x>65</x>
<y>410</y>
<width>61</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Volume:</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>65</x>
<y>440</y>
<width>61</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Seek:</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
<widget class="QLabel" name="sentby_label">
<property name="geometry">
<rect>
<x>65</x>
<y>380</y>
<width>61</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>Sent by:</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
<zorder>frame_2</zorder>
<zorder>widget</zorder>
<zorder>track_title</zorder>
<zorder>volume_slider</zorder>
<zorder>seek_slider</zorder>
<zorder>track_sender</zorder>
<zorder>error_message</zorder>
<zorder>volume_label</zorder>
<zorder>label_2</zorder>
<zorder>sentby_label</zorder>
</widget>
<resources/>
<connections/>
</ui>
Binary file added zukeUI/assets/zukebox.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions zukeUI/assets/zukebox.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file added zukeUI/driver/__init__.py
Empty file.
Binary file added zukeUI/driver/__pycache__/__init__.cpython-35.pyc
Binary file not shown.
6 changes: 6 additions & 0 deletions zukeUI/driver/driver.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<module version="4">
<component name="NewModuleRootManager" inherit-compiler-output="false">
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
Empty file added zukeUI/driver/utils/__init__.py
Empty file.
Binary file not shown.
Empty file.
Binary file not shown.
Binary file not shown.
74 changes: 74 additions & 0 deletions zukeUI/driver/utils/configuration/zukeconfiguration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
import json
import os
from json import JSONDecodeError


class ZukeConfigNotExistsError(Exception):
pass


class InvalidZukeConfigFormatError(Exception):
pass


class InvalidZukeConfigError(Exception):
pass

_ZUKE_IP = "zukebox_ip"
_ZUKE_PORT = "zukebox_port"
_ZUKE_USER = "zukebox_user"

class ZukeConfigManager:

def __init__(self, config_path: str):
self.__config_path = config_path
self.__config = {}

def init_config(self):
self.__config = ZukeConfigInitializer.init_config(self.__config_path)

@property
def config(self):
return self.__config

@property
def zuke_ip(self):
return self.__config[_ZUKE_IP]

@property
def zuke_port(self):
return self.__config[_ZUKE_PORT]

@property
def zuke_user(self):
return self.__config[_ZUKE_USER]

@property
def config_keys(self):
return self.config.keys()


class ZukeConfigInitializer:

@staticmethod
def init_config(config_path: str) -> dict:
try:
config = json.load(open(config_path, 'r'))
ZukeConfigValidator.validate_zuke_config(config)
return config
except JSONDecodeError:
raise InvalidZukeConfigFormatError("Invalid zuke configuration format (not json)")
except IOError:
raise ZukeConfigNotExistsError("Zuke configuration not exists {path}".format(path=config_path))


class ZukeConfigValidator:

@staticmethod
def validate_zuke_config(config: dict):
if sorted(
(_ZUKE_USER,
_ZUKE_PORT,
_ZUKE_IP)
) != sorted(config.keys()):
raise InvalidZukeConfigError("Config contains invalid keys")
Empty file.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading