Skip to content

Commit

Permalink
Merge branch 'saschaludwig:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
kdev authored Sep 27, 2024
2 parents 3373f5d + 5fc2a32 commit 2c06460
Show file tree
Hide file tree
Showing 11 changed files with 88 additions and 31 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# Changelog
All notable changes to this project will be documented in this file.

## [TBA]
### Added
- Show version, distribution and settings path in about dialog
### Changed
- fixed crash when UDP/HTTP ports are empty
- update copyright strings

## [0.9.6 beta2]
### Added
- options to change icons on all 4 timers
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#############################################################################
#
# OnAirScreen
# Copyright (c) 2012-2023 Sascha Ludwig, astrastudio.de
# Copyright (c) 2012-2024 Sascha Ludwig, astrastudio.de
# All rights reserved.
#
# You may use this file under the terms of the BSD license as follows:
Expand Down
2 changes: 1 addition & 1 deletion clockplugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#############################################################################
#
# OnAirScreen Analog Clock QtDesigner Plugin
# Copyright (c) 2012-2022 Sascha Ludwig, astrastudio.de
# Copyright (c) 2012-2024 Sascha Ludwig, astrastudio.de
# All rights reserved.
#

Expand Down
2 changes: 1 addition & 1 deletion clockwidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#############################################################################
#
# OnAirScreen Analog / Digital Clock implementation
# Copyright (c) 2012-2023 Sascha Ludwig, astrastudio.de
# Copyright (c) 2012-2024 Sascha Ludwig, astrastudio.de
# All rights reserved.
#
# start.py
Expand Down
46 changes: 36 additions & 10 deletions settings.ui
Original file line number Diff line number Diff line change
Expand Up @@ -2521,7 +2521,7 @@ p, li { white-space: pre-wrap; }
<property name="bottomMargin">
<number>0</number>
</property>
<item row="4" column="0">
<item row="5" column="0">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
Expand All @@ -2534,7 +2534,7 @@ p, li { white-space: pre-wrap; }
</property>
</spacer>
</item>
<item row="2" column="0">
<item row="3" column="0">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
Expand Down Expand Up @@ -2567,14 +2567,17 @@ p, li { white-space: pre-wrap; }
<item row="1" column="0">
<widget class="QLabel" name="versionLabel">
<property name="text">
<string>Version ???</string>
<string>Version: ???</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="3" column="0">
<item row="4" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string/>
Expand All @@ -2587,7 +2590,7 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item row="10" column="0">
<item row="12" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<layout class="QVBoxLayout" name="verticalLayout_12">
Expand Down Expand Up @@ -2764,7 +2767,7 @@ p, li { white-space: pre-wrap; }
<item>
<widget class="QLabel" name="label_7">
<property name="text">
<string>© 2012-2022 Sascha Ludwig</string>
<string>© 2012-2024 Sascha Ludwig</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
Expand All @@ -2775,7 +2778,7 @@ p, li { white-space: pre-wrap; }
</item>
</layout>
</item>
<item row="6" column="0">
<item row="8" column="0">
<widget class="QPushButton" name="ResetSettingsButton">
<property name="enabled">
<bool>false</bool>
Expand All @@ -2785,13 +2788,36 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item row="5" column="0">
<item row="7" column="0">
<widget class="QCheckBox" name="enableResetButton">
<property name="text">
<string>Enable Reset all settings button</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="distributionLabel">
<property name="text">
<string>Distribution: ???</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="settingspathLabel">
<property name="text">
<string>Settings Path: ???</string>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_license">
Expand All @@ -2817,7 +2843,7 @@ p, li { white-space: pre-wrap; }
<string>##################################################################
#
# OnAirScreen
# Copyright (c) 2012-2022 Sascha Ludwig, astrastudio.de
# Copyright (c) 2012-2024 Sascha Ludwig, astrastudio.de
# All rights reserved.
#
# You may use this file under the terms of the BSD license as follows:
Expand Down Expand Up @@ -4981,8 +5007,8 @@ Parts of analog clockwidget:
</connection>
</connections>
<buttongroups>
<buttongroup name="buttonGroup_clock_mode"/>
<buttongroup name="buttonGroup_logo_position"/>
<buttongroup name="buttonGroup_show_seconds"/>
<buttongroup name="buttonGroup_clock_mode"/>
</buttongroups>
</ui>
26 changes: 19 additions & 7 deletions settings_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#############################################################################
#
# OnAirScreen
# Copyright (c) 2012-2023 Sascha Ludwig, astrastudio.de
# Copyright (c) 2012-2024 Sascha Ludwig, astrastudio.de
# All rights reserved.
#
# settings_functions.py
Expand Down Expand Up @@ -80,6 +80,9 @@ def value(self, name, default=None):
except KeyError:
return QVariant(default)

def fileName(self):
return "OAC Mode"


class Settings(QWidget, Ui_Settings):
sigConfigChanged = pyqtSignal(int, str)
Expand All @@ -94,6 +97,7 @@ class Settings(QWidget, Ui_Settings):
sigCheckForUpdate = pyqtSignal()

def __init__(self, oacmode=False):
self.settingsPath = None
self.row = -1
QWidget.__init__(self)
Ui_Settings.__init__(self)
Expand Down Expand Up @@ -123,20 +127,26 @@ def __init__(self, oacmode=False):
self.sigConfigFinished.emit()

# set version string
self.versionLabel.setText("Version %s" % versionString)
self.versionLabel.setText("Version: %s" % versionString)
# set distribution string
self.distributionLabel.setText("Distribution: %s" % distributionString)
# set settings path
self.settingspathLabel.setText("Settings Path: %s" % self.settingsPath )
# set update check mode
self.manual_update_check = False
self.sigCheckForUpdate.connect(self.check_for_updates)

def showsettings(self):
def show_settings(self):
self.restoreSettingsFromConfig()
self.sigConfigFinished.emit()
self.show()

def closeEvent(self, event):
# emit config finished signal
self.sigConfigFinished.emit()
self.sigConfigClosed.emit()

def exitOnAirScreen(self):
def exit_on_air_screen(self):
if not self.oacmode:
# emit app close signal
self.sigExitOAS.emit()
Expand Down Expand Up @@ -166,7 +176,7 @@ def resetSettings(self):
def _connectSlots(self):
self.ApplyButton.clicked.connect(self.applySettings)
self.CloseButton.clicked.connect(self.closeSettings)
self.ExitButton.clicked.connect(self.exitOnAirScreen)
self.ExitButton.clicked.connect(self.exit_on_air_screen)
self.RebootButton.clicked.connect(self.rebootHost)
self.ShutdownButton.clicked.connect(self.shutdownHost)
self.LEDInactiveBGColor.clicked.connect(self.setLEDInactiveBGColor)
Expand Down Expand Up @@ -246,6 +256,8 @@ def restoreSettingsFromConfig(self):
settings = self.settings
else:
settings = QSettings(QSettings.UserScope, "astrastudio", "OnAirScreen")

self.settingsPath = settings.fileName()

# populate text clock languages
self.textClockLanguage.clear()
Expand Down Expand Up @@ -349,8 +361,8 @@ def restoreSettingsFromConfig(self):
settings.endGroup()

settings.beginGroup("Network")
self.udpport.setText(settings.value('udpport', '3310'))
self.httpport.setText(settings.value('httpport', '8010'))
self.udpport.setText(str(settings.value('udpport', '3310')))
self.httpport.setText(str(settings.value('httpport', '8010')))
self.multicast_group.setText(settings.value('multicast_address', "239.194.0.1"))
settings.endGroup()

Expand Down
26 changes: 19 additions & 7 deletions start.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#############################################################################
#
# OnAirScreen
# Copyright (c) 2012-2023 Sascha Ludwig, astrastudio.de
# Copyright (c) 2012-2024 Sascha Ludwig, astrastudio.de
# All rights reserved.
#
# start.py
Expand Down Expand Up @@ -48,7 +48,7 @@
from PyQt5.QtCore import Qt, QSettings, QCoreApplication, QTimer, QDate, QLocale, QThread
from PyQt5.QtGui import QCursor, QPalette, QKeySequence, QIcon, QPixmap, QFont
from PyQt5.QtNetwork import QUdpSocket, QNetworkInterface, QHostAddress
from PyQt5.QtWidgets import QApplication, QWidget, QShortcut, QDialog, QLineEdit, QVBoxLayout, QLabel
from PyQt5.QtWidgets import QApplication, QWidget, QShortcut, QDialog, QLineEdit, QVBoxLayout, QLabel, QMessageBox

from mainscreen import Ui_MainScreen
from settings_functions import Settings, versionString
Expand Down Expand Up @@ -189,10 +189,18 @@ def __init__(self):
self.udpsock = QUdpSocket()
settings = QSettings(QSettings.UserScope, "astrastudio", "OnAirScreen")
settings.beginGroup("Network")
port = int(settings.value('udpport', 3310))
try:
port = int(settings.value('udpport', "3310"))
except ValueError:
port = "3310"
settings.setValue('udpport', "3310")
multicast_address = settings.value('multicast_address', "239.194.0.1")
if not QHostAddress(multicast_address).isMulticast():
multicast_address = "239.194.0.1"
settings.setValue('multicast_address', "239.194.0.1")
settings.endGroup()
self.udpsock.bind(QHostAddress.AnyIPv4, port, QUdpSocket.ShareAddress)

self.udpsock.bind(QHostAddress.AnyIPv4, int(port), QUdpSocket.ShareAddress)
if QHostAddress(multicast_address).isMulticast():
print(multicast_address, "is Multicast, joining multicast group")
self.udpsock.joinMulticastGroup(QHostAddress(multicast_address))
Expand Down Expand Up @@ -285,7 +293,7 @@ def show_settings(self):
global app
# un-hide mouse cursor
app.setOverrideCursor(QCursor(Qt.ArrowCursor))
self.settings.showsettings()
self.settings.show_settings()

def display_all_hostaddresses(self):
v4addrs = list()
Expand Down Expand Up @@ -1448,7 +1456,11 @@ class HttpDaemon(QThread):
def run(self):
settings = QSettings(QSettings.UserScope, "astrastudio", "OnAirScreen")
settings.beginGroup("Network")
port = int(settings.value('httpport', 8010))
try:
port = int(settings.value('httpport', "8010"))
except ValueError:
port = 8010
settings.setValue("httpport", "8010")
settings.endGroup()

try:
Expand Down Expand Up @@ -1492,7 +1504,7 @@ def do_GET(self):

settings = QSettings(QSettings.UserScope, "astrastudio", "OnAirScreen")
settings.beginGroup("Network")
port = int(settings.value('udpport', 3310))
port = int(settings.value('udpport', "3310"))
settings.endGroup()

sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
Expand Down
2 changes: 1 addition & 1 deletion utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#############################################################################
#
# OnAirScreen
# Copyright (c) 2012-2023 Sascha Ludwig, astrastudio.de
# Copyright (c) 2012-2024 Sascha Ludwig, astrastudio.de
# All rights reserved.
#
# utils.py
Expand Down
2 changes: 1 addition & 1 deletion utils/keypress.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
# OnAirScreen Keypress Tool
# tool to display keyboard keycodes
# Copyright (c) 2012-2023 Sascha Ludwig, astrastudio.de
# Copyright (c) 2012-2024 Sascha Ludwig, astrastudio.de
# All rights reserved.
#
# keypress.py
Expand Down
2 changes: 1 addition & 1 deletion utils/oas_send.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#############################################################################
#
# OnAirScreen
# Copyright (c) 2012-2023 Sascha Ludwig, astrastudio.de
# Copyright (c) 2012-2024 Sascha Ludwig, astrastudio.de
# All rights reserved.
#
# oas_send.py
Expand Down
2 changes: 1 addition & 1 deletion weatherwidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#############################################################################
#
# OnAirScreen
# Copyright (c) 2012-2023 Sascha Ludwig, astrastudio.de
# Copyright (c) 2012-2024 Sascha Ludwig, astrastudio.de
# All rights reserved.
#
# start.py
Expand Down

0 comments on commit 2c06460

Please sign in to comment.