Skip to content

Commit

Permalink
Add version label to preferences and tweak window size (#378)
Browse files Browse the repository at this point in the history
* Add version label in preferences

* Add message when version was not detected, change preferences title

* Update translation strings

* Fix type checker warning

* Include version in PyInstaller build and fix package name

* Fix qt test

* Fetch entire repo history in PyInstaller build
  • Loading branch information
sanjacob authored Sep 19, 2024
1 parent b09f7a1 commit 8158277
Show file tree
Hide file tree
Showing 14 changed files with 129 additions and 54 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/pyinstaller.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ jobs:
runs-on: ${{ inputs.runs-on }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true

- uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}
Expand All @@ -24,6 +28,9 @@ jobs:
from-pipfile: true
dev: true

- name: Install current package
run: pip install .

- name: Run PyInstaller
run: "pyinstaller BlackboardSync.spec --noconfirm --clean"

Expand Down
5 changes: 4 additions & 1 deletion BlackboardSync.spec
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- mode: python ; coding: utf-8 -*-

import platform
from PyInstaller.utils.hooks import copy_metadata


def get_icon():
Expand All @@ -11,11 +12,13 @@ def get_icon():

def get_datas():
s = "\\" if platform.system() == "Windows" else "/"
metadata = copy_metadata('blackboardsync')[0]

return [
(f"blackboard_sync{s}assets", f"blackboard_sync{s}assets"),
(f"blackboard_sync{s}qt", f"blackboard_sync{s}qt"),
(f"blackboard_sync{s}universities.json", f"blackboard_sync")
(f"blackboard_sync{s}universities.json", f"blackboard_sync"),
metadata
]

a = Analysis(
Expand Down
11 changes: 11 additions & 0 deletions blackboard_sync/qt/SettingsWindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def __init__(self) -> None:
self.frequency_combo: QComboBox
self.current_session_label: QLabel
self.download_location_hint: QLabel
self.version_label: QLabel
self.select_download_location: QPushButton
self.log_out_button: QPushButton
self.setup_button: QPushButton
Expand Down Expand Up @@ -108,3 +109,13 @@ def username(self, username: str) -> None:
else:
self.current_session_label.setText(
self.tr("Not currently logged in"))

@property
def version(self) -> str | None:
return self.version_label.text()

@version.setter
def version(self, value: str | None) -> None:
if value is None:
value = self.tr("No version detected")
self.version_label.setText(value)
76 changes: 67 additions & 9 deletions blackboard_sync/qt/SettingsWindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,24 @@
<rect>
<x>0</x>
<y>0</y>
<width>480</width>
<height>580</height>
<width>420</width>
<height>500</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>360</width>
<height>540</height>
<width>400</width>
<height>450</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>480</width>
<height>580</height>
<width>500</width>
<height>600</height>
</size>
</property>
<property name="windowTitle">
<string>Settings</string>
<string>Preferences</string>
</property>
<property name="windowIcon">
<iconset>
Expand All @@ -48,6 +48,22 @@
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="download_location_label">
<property name="font">
Expand All @@ -73,7 +89,7 @@
</font>
</property>
<property name="text">
<string>Location to be shown here</string>
<string/>
</property>
<property name="wordWrap">
<bool>true</bool>
Expand All @@ -93,6 +109,22 @@
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="frequency_label">
<property name="font">
Expand Down Expand Up @@ -134,6 +166,22 @@
</item>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="session_label">
<property name="font">
Expand All @@ -159,7 +207,17 @@
</font>
</property>
<property name="text">
<string>Logged in as</string>
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="version_label">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
Expand Down
5 changes: 3 additions & 2 deletions blackboard_sync/qt/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,12 @@ def slot_quit(self) -> None:
self.login_window.cancel_watchdog()
self.app.quit()

def open_settings(self, download_location: Path,
username: str, sync_interval: int) -> None:
def open_settings(self, download_location: Path, username: str,
sync_interval: int, version: str | None) -> None:
self.config_window.download_location = download_location
self.config_window.username = username
self.config_window.sync_frequency = sync_interval
self.config_window.version = version
self.show(self.config_window)

def open_menu(self, last_sync: datetime,
Expand Down
Binary file modified blackboard_sync/qt/translations/de.qm
Binary file not shown.
21 changes: 8 additions & 13 deletions blackboard_sync/qt/translations/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,19 +71,14 @@
<name>SettingsWindow</name>
<message>
<location filename="../SettingsWindow.ui" line="0"/>
<source>Settings</source>
<source>Preferences</source>
<translation>Einstellungen</translation>
</message>
<message>
<location filename="../SettingsWindow.ui" line="0"/>
<source>Download location</source>
<translation>Download-Ordner</translation>
</message>
<message>
<location filename="../SettingsWindow.ui" line="0"/>
<source>Location to be shown here</source>
<translation>Ort wird hier angezeigt</translation>
</message>
<message>
<location filename="../SettingsWindow.ui" line="0"/>
<source>Change location</source>
Expand Down Expand Up @@ -114,11 +109,6 @@
<source>User session</source>
<translation>Benutzersitzung</translation>
</message>
<message>
<location filename="../SettingsWindow.ui" line="0"/>
<source>Logged in as</source>
<translation>Angemeldet als</translation>
</message>
<message>
<location filename="../SettingsWindow.ui" line="0"/>
<source>Log out</source>
Expand All @@ -130,15 +120,20 @@
<translation>Konfiguration</translation>
</message>
<message>
<location filename="../SettingsWindow.py" line="107"/>
<location filename="../SettingsWindow.py" line="108"/>
<source>Logged in as </source>
<translation>Angemeldet als </translation>
</message>
<message>
<location filename="../SettingsWindow.py" line="110"/>
<location filename="../SettingsWindow.py" line="111"/>
<source>Not currently logged in</source>
<translation>Derzeit nicht angemeldet</translation>
</message>
<message>
<location filename="../SettingsWindow.py" line="120"/>
<source>No version detected</source>
<translation>Version nicht erkannt</translation>
</message>
</context>
<context>
<name>SetupWizard</name>
Expand Down
Binary file modified blackboard_sync/qt/translations/es.qm
Binary file not shown.
21 changes: 8 additions & 13 deletions blackboard_sync/qt/translations/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,19 +71,14 @@
<name>SettingsWindow</name>
<message>
<location filename="../SettingsWindow.ui" line="0"/>
<source>Settings</source>
<source>Preferences</source>
<translation>Preferencias</translation>
</message>
<message>
<location filename="../SettingsWindow.ui" line="0"/>
<source>Download location</source>
<translation>Ubicación de descarga</translation>
</message>
<message>
<location filename="../SettingsWindow.ui" line="0"/>
<source>Location to be shown here</source>
<translation>Ubicación se mostrará aquí</translation>
</message>
<message>
<location filename="../SettingsWindow.ui" line="0"/>
<source>Change location</source>
Expand Down Expand Up @@ -114,11 +109,6 @@
<source>User session</source>
<translation>Sesión de usuario</translation>
</message>
<message>
<location filename="../SettingsWindow.ui" line="0"/>
<source>Logged in as</source>
<translation>Ingresaste como</translation>
</message>
<message>
<location filename="../SettingsWindow.ui" line="0"/>
<source>Log out</source>
Expand All @@ -130,15 +120,20 @@
<translation>Configuración</translation>
</message>
<message>
<location filename="../SettingsWindow.py" line="107"/>
<location filename="../SettingsWindow.py" line="108"/>
<source>Logged in as </source>
<translation>Ingresaste como </translation>
</message>
<message>
<location filename="../SettingsWindow.py" line="110"/>
<location filename="../SettingsWindow.py" line="111"/>
<source>Not currently logged in</source>
<translation>No has ingresado</translation>
</message>
<message>
<location filename="../SettingsWindow.py" line="120"/>
<source>No version detected</source>
<translation>Versión desconocida</translation>
</message>
</context>
<context>
<name>SetupWizard</name>
Expand Down
Binary file modified blackboard_sync/qt/translations/fr.qm
Binary file not shown.
21 changes: 8 additions & 13 deletions blackboard_sync/qt/translations/fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,19 +71,14 @@
<name>SettingsWindow</name>
<message>
<location filename="../SettingsWindow.ui" line="0"/>
<source>Settings</source>
<source>Preferences</source>
<translation>Préférences</translation>
</message>
<message>
<location filename="../SettingsWindow.ui" line="0"/>
<source>Download location</source>
<translation>Emplacement de téléchargement</translation>
</message>
<message>
<location filename="../SettingsWindow.ui" line="0"/>
<source>Location to be shown here</source>
<translation>Emplacement à afficher ici</translation>
</message>
<message>
<location filename="../SettingsWindow.ui" line="0"/>
<source>Change location</source>
Expand Down Expand Up @@ -114,11 +109,6 @@
<source>User session</source>
<translation>Session utilisateur</translation>
</message>
<message>
<location filename="../SettingsWindow.ui" line="0"/>
<source>Logged in as</source>
<translation>Connecté en tant que</translation>
</message>
<message>
<location filename="../SettingsWindow.ui" line="0"/>
<source>Log out</source>
Expand All @@ -130,15 +120,20 @@
<translation>Paramètres</translation>
</message>
<message>
<location filename="../SettingsWindow.py" line="107"/>
<location filename="../SettingsWindow.py" line="108"/>
<source>Logged in as </source>
<translation>Connecté en tant que </translation>
</message>
<message>
<location filename="../SettingsWindow.py" line="110"/>
<location filename="../SettingsWindow.py" line="111"/>
<source>Not currently logged in</source>
<translation>Vous n&apos;êtes pas connecté</translation>
</message>
<message>
<location filename="../SettingsWindow.py" line="120"/>
<source>No version detected</source>
<translation>Version non détectée</translation>
</message>
</context>
<context>
<name>SetupWizard</name>
Expand Down
Loading

0 comments on commit 8158277

Please sign in to comment.