Skip to content
This repository has been archived by the owner on Nov 7, 2022. It is now read-only.

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
IT und Entwicklung - FG committed Nov 16, 2021
2 parents e464a7f + 75735e7 commit 29c56a5
Show file tree
Hide file tree
Showing 74 changed files with 173 additions and 276 deletions.
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
__pycache__/
busylight-menu_**.deb
busylight-menu_**.build
busylight-menu_**.buildinfo
busylight-menu_**.changes
busylight-menu_**.dsc
busylight-menu_*.tar.gz
busylight-menu.debhelper.log
busylight-menu.substvars
Package/debian/files
Package/debian/.debhelper
Package/debian/busylight-menu
busylight-menu_*.ppa.upload
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Basic Makefile

deb:
cd ./Package; \
debuild -b -kC3FBBEC27B2A17AE

package:
cd ./Package; \
debuild -S -sa -kC3FBBEC27B2A17AE
3 changes: 3 additions & 0 deletions Package/debian/busylight-menu.install
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/etc/xdg/autostart
/usr/share/busylight-menu
/usr/share/icons
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
busylight-menu (1.4.3) focal hirsute impish; urgency=low
busylight-menu (2.0.0) focal; urgency=low

* Cleaned up code
* Removed unneeded dependencies
Expand Down
File renamed without changes.
8 changes: 4 additions & 4 deletions busylight-menu/debian/control → Package/debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ Section: misc
Priority: optional
Maintainer: IT und Entwicklung - FG <kontakt@it-und-entwicklung-fg.de>
Build-Depends: debhelper, dh-make
build-arch: any
build-arch: all

Architecture: any
Architecture: all
Package: busylight-menu
Version: 1.4.2
Depends: python3, python3-pyqt5, python3-hid, qtwayland5
Version: 2.0.0
Depends: busylight, python3, python3-pyqt5, qtwayland5
Description: A menu to control the busylight omega modell.
File renamed without changes.
6 changes: 6 additions & 0 deletions Package/debian/postinst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
# This `DEBIAN/postinst` script is run post-installation
echo "Create links"
ln -s /usr/share/busylight-menu/busylight-menu.py /usr/bin/busylight-menu
chmod a+rx /usr/share/busylight-menu/busylight-menu.py
chmod a+rx /usr/bin/busylight-menu
4 changes: 4 additions & 0 deletions Package/debian/postrm
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
# This `DEBIAN/postremove` script is run post-remove
echo "Remove links"
rm /usr/bin/busylight-menu
File renamed without changes.
11 changes: 11 additions & 0 deletions Package/etc/xdg/autostart/busylight-menu.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[Desktop Entry]
Version=1.0
Encoding=UTF-8
Type=Application
Categories=Utility;

Name=Busylight Menu
Comment=Controll Busylight from Kuando.
Exec=busylight-menu

Icon=busylight-green
122 changes: 122 additions & 0 deletions Package/usr/share/busylight-menu/busylight-menu.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
#!/usr/bin/python3
import os.path
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from configparser import ConfigParser

app = QApplication([])
app.setQuitOnLastWindowClosed(False)

config_file = "/var/local/busylight/config.conf"
config = ConfigParser()

# Icons
icons = {
"off": QIcon.fromTheme("busylight-off"),
"red": QIcon.fromTheme("busylight-red"),
"green": QIcon.fromTheme("busylight-green"),
"blue": QIcon.fromTheme("busylight-blue"),
"yellow": QIcon.fromTheme("busylight-yellow"),
"white": QIcon.fromTheme("busylight-white")
}

# Adding item on the menu bar
tray = QSystemTrayIcon()
tray.setIcon(icons["off"])
tray.setVisible(True)

# Creating the options
menu = QMenu()
option1 = QAction(icons["green"], "Frei")
option2 = QAction(icons["red"], "Am Telefon")
option3 = QAction(icons["blue"], "In Fernwartung")
option4 = QAction(icons["yellow"], "Beschäftigt")
option1.triggered.connect(lambda: color(icons["green"], 0, 255, 0))
option2.triggered.connect(lambda: color(icons["red"], 255, 0, 0))
option3.triggered.connect(lambda: color(icons["blue"], 0, 0, 255))
option4.triggered.connect(lambda: color(icons["yellow"], 255, 255, 0))
menu.addAction(option1)
menu.addAction(option2)
menu.addAction(option3)
menu.addAction(option4)

menu.addSeparator()

# Farben
submenu = QMenu("Farben")
suboption1 = QAction(icons["green"], "Grün")
suboption2 = QAction(icons["red"], "Rot")
suboption3 = QAction(icons["blue"], "Blau")
suboption4 = QAction(icons["yellow"], "Gelb")
suboption5 = QAction(icons["white"], "Weiß")
suboption1.triggered.connect(lambda: color(icons["green"], 0, 255, 0))
suboption2.triggered.connect(lambda: color(icons["red"], 255, 0, 0))
suboption3.triggered.connect(lambda: color(icons["blue"], 0, 0, 255))
suboption4.triggered.connect(lambda: color(icons["yellow"], 255, 255, 0))
suboption5.triggered.connect(lambda: color(icons["white"], 255, 255, 255))
submenu.addAction(suboption1)
submenu.addAction(suboption2)
submenu.addAction(suboption3)
submenu.addAction(suboption4)
submenu.addAction(suboption5)
menu.addMenu(submenu)

menu.addSeparator()

# Aus
optionOff = QAction(icons["off"], "Aus")
menu.addAction(optionOff)
optionOff.triggered.connect(lambda: color(icons["off"]))

# To quit the app
option_exit = QAction("Beenden")
option_exit.triggered.connect(lambda: quit_app())
menu.addAction(option_exit)

# Adding options to the System Tray
tray.setContextMenu(menu)


# Function to exit app
def quit_app():
if os.path.isfile(config_file):
config.read(config_file)
rgb = config["RGB"]
rgb["red"] = "0"
rgb["green"] = "0"
rgb["blue"] = "0"
with open(config_file, "w+") as conf:
config.write(conf)
else:
msg = QMessageBox()
msg.setIcon(QMessageBox.Critical)
msg.setText("Service not running")
msg.setInformativeText("The background servive that is needed is not running")
msg.setWindowTitle("ERROR")
msg.setStandardButtons(QMessageBox.Close)
msg.exec_()
app.quit()


# Function to change color
def color(icon=icons["off"], red=0, green=0, blue=0):
if os.path.isfile(config_file):
tray.setIcon(QIcon(icon))
config.read(config_file)
rgb = config["RGB"]
rgb["red"] = str(red)
rgb["green"] = str(green)
rgb["blue"] = str(blue)
with open(config_file, "w+") as conf:
config.write(conf)
else:
msg = QMessageBox()
msg.setIcon(QMessageBox.Critical)
msg.setText("Service not running")
msg.setInformativeText("The background servive that is needed is not running")
msg.setWindowTitle("ERROR")
msg.setStandardButtons(QMessageBox.Close)
msg.exec_()


app.exec_()
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 0 additions & 2 deletions busylight-menu/debian/busylight-menu.install

This file was deleted.

1 change: 0 additions & 1 deletion busylight-menu/debian/files

This file was deleted.

14 changes: 0 additions & 14 deletions busylight-menu/debian/postinst

This file was deleted.

6 changes: 0 additions & 6 deletions busylight-menu/debian/postrm

This file was deleted.

1 change: 0 additions & 1 deletion busylight-menu/etc/udev/rules.d/30-busylight.rules

This file was deleted.

135 changes: 0 additions & 135 deletions busylight-menu/usr/share/busylight-menu/BusyLight.py

This file was deleted.

Loading

0 comments on commit 29c56a5

Please sign in to comment.