-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Feature] Add first-launch dialog, inor UI fixes
- Loading branch information
1 parent
90265fa
commit 4386713
Showing
11 changed files
with
342 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import sys | ||
import webbrowser | ||
|
||
from PyQt6.QtCore import pyqtSlot | ||
from PyQt6.QtWidgets import QDialog | ||
from qasync import asyncSlot | ||
|
||
import openfreebuds_backend | ||
from openfreebuds_qt.config import OfbQtConfigParser | ||
from openfreebuds_qt.constants import LINK_WEBSITE_HELP | ||
from openfreebuds_qt.designer.first_run_dialog import Ui_OfbQtFirstRunDialog | ||
from openfreebuds_qt.utils import get_img_colored, qt_error_handler | ||
|
||
|
||
class OfbQtFirstRunDialog(Ui_OfbQtFirstRunDialog, QDialog): | ||
def __init__(self, ctx): | ||
super().__init__(ctx.main_window) | ||
|
||
self.ctx = ctx | ||
self.config = OfbQtConfigParser.get_instance() | ||
|
||
self.setupUi(self) | ||
|
||
self.autostart_checkbox.setEnabled(not self.config.is_containerized_app) | ||
self.linux_notice.setVisible(sys.platform == 'linux') | ||
|
||
preview_fn = "ofb_linux_preview" if sys.platform == 'linux' else "ofb_win32_preview" | ||
preview_image = get_img_colored(preview_fn, | ||
color=self.palette().text().color().getRgb(), | ||
base_dir="image") | ||
self.preview_root.setPixmap(preview_image) | ||
|
||
@asyncSlot() | ||
async def on_confirm(self): | ||
async with qt_error_handler("OfbQtFirstRunDialog_Confirm", self.ctx): | ||
self.hide() | ||
|
||
if self.autostart_checkbox.isChecked(): | ||
openfreebuds_backend.set_run_at_boot(True) | ||
|
||
self.config.set("ui", "first_run_finished", True) | ||
self.config.save() | ||
|
||
@pyqtSlot() | ||
def on_faq_click(self): | ||
webbrowser.open(LINK_WEBSITE_HELP) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,278 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ui version="4.0"> | ||
<class>OfbQtFirstRunDialog</class> | ||
<widget class="QWidget" name="OfbQtFirstRunDialog"> | ||
<property name="geometry"> | ||
<rect> | ||
<x>0</x> | ||
<y>0</y> | ||
<width>570</width> | ||
<height>320</height> | ||
</rect> | ||
</property> | ||
<property name="maximumSize"> | ||
<size> | ||
<width>16777215</width> | ||
<height>320</height> | ||
</size> | ||
</property> | ||
<property name="windowTitle"> | ||
<string>Welcome</string> | ||
</property> | ||
<layout class="QVBoxLayout" name="verticalLayout"> | ||
<item> | ||
<widget class="QWidget" name="widget_2" native="true"> | ||
<layout class="QHBoxLayout" name="horizontalLayout_2"> | ||
<property name="leftMargin"> | ||
<number>0</number> | ||
</property> | ||
<property name="topMargin"> | ||
<number>0</number> | ||
</property> | ||
<property name="rightMargin"> | ||
<number>0</number> | ||
</property> | ||
<property name="bottomMargin"> | ||
<number>0</number> | ||
</property> | ||
<item> | ||
<widget class="QWidget" name="widget_4" native="true"> | ||
<property name="sizePolicy"> | ||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred"> | ||
<horstretch>0</horstretch> | ||
<verstretch>0</verstretch> | ||
</sizepolicy> | ||
</property> | ||
<layout class="QVBoxLayout" name="verticalLayout_3"> | ||
<property name="leftMargin"> | ||
<number>0</number> | ||
</property> | ||
<property name="topMargin"> | ||
<number>0</number> | ||
</property> | ||
<property name="rightMargin"> | ||
<number>0</number> | ||
</property> | ||
<property name="bottomMargin"> | ||
<number>0</number> | ||
</property> | ||
<item> | ||
<widget class="QLabel" name="preview_root"> | ||
<property name="sizePolicy"> | ||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred"> | ||
<horstretch>0</horstretch> | ||
<verstretch>0</verstretch> | ||
</sizepolicy> | ||
</property> | ||
<property name="minimumSize"> | ||
<size> | ||
<width>180</width> | ||
<height>120</height> | ||
</size> | ||
</property> | ||
<property name="maximumSize"> | ||
<size> | ||
<width>16777215</width> | ||
<height>16777215</height> | ||
</size> | ||
</property> | ||
<property name="text"> | ||
<string>Image</string> | ||
</property> | ||
</widget> | ||
</item> | ||
</layout> | ||
</widget> | ||
</item> | ||
<item> | ||
<widget class="QWidget" name="widget_3" native="true"> | ||
<layout class="QVBoxLayout" name="verticalLayout_2"> | ||
<property name="leftMargin"> | ||
<number>0</number> | ||
</property> | ||
<property name="topMargin"> | ||
<number>0</number> | ||
</property> | ||
<property name="rightMargin"> | ||
<number>0</number> | ||
</property> | ||
<property name="bottomMargin"> | ||
<number>0</number> | ||
</property> | ||
<item> | ||
<widget class="QLabel" name="label"> | ||
<property name="sizePolicy"> | ||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed"> | ||
<horstretch>0</horstretch> | ||
<verstretch>0</verstretch> | ||
</sizepolicy> | ||
</property> | ||
<property name="text"> | ||
<string>This application allows you to manage your HUAWEI Bluetooth earphones. To access them, look for headphones icon in system tray panel, near other icons.</string> | ||
</property> | ||
<property name="wordWrap"> | ||
<bool>true</bool> | ||
</property> | ||
</widget> | ||
</item> | ||
<item> | ||
<widget class="QLabel" name="label_2"> | ||
<property name="sizePolicy"> | ||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed"> | ||
<horstretch>0</horstretch> | ||
<verstretch>0</verstretch> | ||
</sizepolicy> | ||
</property> | ||
<property name="text"> | ||
<string>Left-click on this icon will cycle through noise cancellation modes (can be configured), right-click will provide access to full battery status and main options. Settings window provides access to all features.</string> | ||
</property> | ||
<property name="wordWrap"> | ||
<bool>true</bool> | ||
</property> | ||
</widget> | ||
</item> | ||
<item> | ||
<widget class="QLabel" name="linux_notice"> | ||
<property name="sizePolicy"> | ||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed"> | ||
<horstretch>0</horstretch> | ||
<verstretch>0</verstretch> | ||
</sizepolicy> | ||
</property> | ||
<property name="text"> | ||
<string>If you're running under GNOME shell and can't find tray icon, please, check FAQ.</string> | ||
</property> | ||
<property name="wordWrap"> | ||
<bool>true</bool> | ||
</property> | ||
</widget> | ||
</item> | ||
<item> | ||
<spacer name="verticalSpacer_2"> | ||
<property name="orientation"> | ||
<enum>Qt::Vertical</enum> | ||
</property> | ||
<property name="sizeHint" stdset="0"> | ||
<size> | ||
<width>20</width> | ||
<height>40</height> | ||
</size> | ||
</property> | ||
</spacer> | ||
</item> | ||
<item> | ||
<widget class="QCheckBox" name="autostart_checkbox"> | ||
<property name="text"> | ||
<string>Launch OpenFreebuds at system boot</string> | ||
</property> | ||
<property name="checked"> | ||
<bool>true</bool> | ||
</property> | ||
</widget> | ||
</item> | ||
<item> | ||
<widget class="QLabel" name="label_5"> | ||
<property name="text"> | ||
<string>You could change this options anytime later in settings.</string> | ||
</property> | ||
<property name="wordWrap"> | ||
<bool>true</bool> | ||
</property> | ||
</widget> | ||
</item> | ||
</layout> | ||
</widget> | ||
</item> | ||
</layout> | ||
</widget> | ||
</item> | ||
<item> | ||
<widget class="QWidget" name="widget" native="true"> | ||
<layout class="QHBoxLayout" name="horizontalLayout"> | ||
<property name="leftMargin"> | ||
<number>0</number> | ||
</property> | ||
<property name="topMargin"> | ||
<number>0</number> | ||
</property> | ||
<property name="rightMargin"> | ||
<number>0</number> | ||
</property> | ||
<property name="bottomMargin"> | ||
<number>0</number> | ||
</property> | ||
<item> | ||
<spacer name="horizontalSpacer"> | ||
<property name="orientation"> | ||
<enum>Qt::Horizontal</enum> | ||
</property> | ||
<property name="sizeHint" stdset="0"> | ||
<size> | ||
<width>40</width> | ||
<height>20</height> | ||
</size> | ||
</property> | ||
</spacer> | ||
</item> | ||
<item> | ||
<widget class="QPushButton" name="faq_btn"> | ||
<property name="text"> | ||
<string>FAQ</string> | ||
</property> | ||
<property name="flat"> | ||
<bool>true</bool> | ||
</property> | ||
</widget> | ||
</item> | ||
<item> | ||
<widget class="QPushButton" name="confirm_btn"> | ||
<property name="text"> | ||
<string>Get started</string> | ||
</property> | ||
</widget> | ||
</item> | ||
</layout> | ||
</widget> | ||
</item> | ||
</layout> | ||
</widget> | ||
<resources/> | ||
<connections> | ||
<connection> | ||
<sender>faq_btn</sender> | ||
<signal>clicked()</signal> | ||
<receiver>OfbQtFirstRunDialog</receiver> | ||
<slot>on_faq_click()</slot> | ||
<hints> | ||
<hint type="sourcelabel"> | ||
<x>436</x> | ||
<y>300</y> | ||
</hint> | ||
<hint type="destinationlabel"> | ||
<x>285</x> | ||
<y>160</y> | ||
</hint> | ||
</hints> | ||
</connection> | ||
<connection> | ||
<sender>confirm_btn</sender> | ||
<signal>clicked()</signal> | ||
<receiver>OfbQtFirstRunDialog</receiver> | ||
<slot>on_confirm()</slot> | ||
<hints> | ||
<hint type="sourcelabel"> | ||
<x>522</x> | ||
<y>300</y> | ||
</hint> | ||
<hint type="destinationlabel"> | ||
<x>285</x> | ||
<y>160</y> | ||
</hint> | ||
</hints> | ||
</connection> | ||
</connections> | ||
<slots> | ||
<slot>on_faq_click()</slot> | ||
<slot>on_confirm()</slot> | ||
</slots> | ||
</ui> |
Oops, something went wrong.