Fixed types and imports
This commit is contained in:
parent
c78a48bd10
commit
e3265b0817
6 changed files with 15 additions and 17 deletions
21
syng/gui.py
21
syng/gui.py
|
@ -1,12 +1,10 @@
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
import sys
|
|
||||||
import logging
|
import logging
|
||||||
from logging.handlers import QueueListener
|
from logging.handlers import QueueListener
|
||||||
from multiprocessing import Process, Queue
|
from multiprocessing import Process, Queue
|
||||||
from collections.abc import Callable
|
from collections.abc import Callable
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import os
|
import os
|
||||||
import builtins
|
|
||||||
from functools import partial
|
from functools import partial
|
||||||
import random
|
import random
|
||||||
from typing import TYPE_CHECKING, Any, Optional
|
from typing import TYPE_CHECKING, Any, Optional
|
||||||
|
@ -45,6 +43,7 @@ from PyQt6.QtWidgets import (
|
||||||
QSizePolicy,
|
QSizePolicy,
|
||||||
QSpacerItem,
|
QSpacerItem,
|
||||||
QSpinBox,
|
QSpinBox,
|
||||||
|
QTabBar,
|
||||||
QTabWidget,
|
QTabWidget,
|
||||||
QVBoxLayout,
|
QVBoxLayout,
|
||||||
QWidget,
|
QWidget,
|
||||||
|
@ -336,8 +335,8 @@ class OptionFrame(QWidget):
|
||||||
for name, textbox in self.string_options.items():
|
for name, textbox in self.string_options.items():
|
||||||
config[name] = textbox.text().strip()
|
config[name] = textbox.text().strip()
|
||||||
|
|
||||||
for name, textbox in self.int_options.items():
|
for name, spinner in self.int_options.items():
|
||||||
config[name] = textbox.value()
|
config[name] = spinner.value()
|
||||||
|
|
||||||
for name, optionmenu in self.choose_options.items():
|
for name, optionmenu in self.choose_options.items():
|
||||||
config[name] = optionmenu.currentText().strip()
|
config[name] = optionmenu.currentText().strip()
|
||||||
|
@ -365,11 +364,11 @@ class OptionFrame(QWidget):
|
||||||
for name, textbox in self.string_options.items():
|
for name, textbox in self.string_options.items():
|
||||||
textbox.setText(config[name])
|
textbox.setText(config[name])
|
||||||
|
|
||||||
for name, textbox in self.int_options.items():
|
for name, spinner in self.int_options.items():
|
||||||
try:
|
try:
|
||||||
textbox.setValue(config[name])
|
spinner.setValue(config[name])
|
||||||
except ValueError:
|
except ValueError:
|
||||||
textbox.setValue(0)
|
spinner.setValue(0)
|
||||||
|
|
||||||
for name, optionmenu in self.choose_options.items():
|
for name, optionmenu in self.choose_options.items():
|
||||||
optionmenu.setCurrentText(str(config[name]))
|
optionmenu.setCurrentText(str(config[name]))
|
||||||
|
@ -547,7 +546,7 @@ class SyngGui(QMainWindow):
|
||||||
if widget:
|
if widget:
|
||||||
widget.setVisible(state)
|
widget.setVisible(state)
|
||||||
|
|
||||||
tabbar = self.tabview.tabBar()
|
tabbar: Optional[QTabBar] = self.tabview.tabBar()
|
||||||
if not state:
|
if not state:
|
||||||
if tabbar is not None:
|
if tabbar is not None:
|
||||||
tabbar.hide()
|
tabbar.hide()
|
||||||
|
@ -561,7 +560,7 @@ class SyngGui(QMainWindow):
|
||||||
self.central_layout.addLayout(self.frm)
|
self.central_layout.addLayout(self.frm)
|
||||||
|
|
||||||
def init_tabs(self, show_advanced: bool) -> None:
|
def init_tabs(self, show_advanced: bool) -> None:
|
||||||
self.tabview = QTabWidget(parent=self.central_widget)
|
self.tabview: QTabWidget = QTabWidget(parent=self.central_widget)
|
||||||
self.tabview.setAcceptDrops(False)
|
self.tabview.setAcceptDrops(False)
|
||||||
self.tabview.setTabPosition(QTabWidget.TabPosition.West)
|
self.tabview.setTabPosition(QTabWidget.TabPosition.West)
|
||||||
self.tabview.setTabShape(QTabWidget.TabShape.Rounded)
|
self.tabview.setTabShape(QTabWidget.TabShape.Rounded)
|
||||||
|
@ -833,10 +832,6 @@ class LoggingLabelHandler(logging.Handler):
|
||||||
|
|
||||||
|
|
||||||
def run_gui() -> None:
|
def run_gui() -> None:
|
||||||
base_dir = os.path.dirname(__file__)
|
|
||||||
if getattr(sys, "frozen", False) and hasattr(sys, "_MEIPASS"):
|
|
||||||
base_dir = sys._MEIPASS
|
|
||||||
|
|
||||||
# initialize cache dir
|
# initialize cache dir
|
||||||
os.makedirs(platformdirs.user_cache_dir("syng"), exist_ok=True)
|
os.makedirs(platformdirs.user_cache_dir("syng"), exist_ok=True)
|
||||||
|
|
||||||
|
|
|
@ -2339,10 +2339,13 @@ qt_resource_struct = b"\
|
||||||
\x00\x00\x01\x92^\xb1\x10\xa9\
|
\x00\x00\x01\x92^\xb1\x10\xa9\
|
||||||
"
|
"
|
||||||
|
|
||||||
def qInitResources():
|
|
||||||
|
def qInitResources() -> None:
|
||||||
QtCore.qRegisterResourceData(0x03, qt_resource_struct, qt_resource_name, qt_resource_data)
|
QtCore.qRegisterResourceData(0x03, qt_resource_struct, qt_resource_name, qt_resource_data)
|
||||||
|
|
||||||
def qCleanupResources():
|
|
||||||
|
def qCleanupResources() -> None:
|
||||||
QtCore.qUnregisterResourceData(0x03, qt_resource_struct, qt_resource_name, qt_resource_data)
|
QtCore.qUnregisterResourceData(0x03, qt_resource_struct, qt_resource_name, qt_resource_data)
|
||||||
|
|
||||||
|
|
||||||
qInitResources()
|
qInitResources()
|
||||||
|
|
|
@ -4,7 +4,6 @@ import asyncio
|
||||||
import os
|
import os
|
||||||
from typing import Any, Optional
|
from typing import Any, Optional
|
||||||
from typing import Tuple
|
from typing import Tuple
|
||||||
from platformdirs import user_cache_dir
|
|
||||||
|
|
||||||
|
|
||||||
from ..entry import Entry
|
from ..entry import Entry
|
||||||
|
|
|
@ -22,7 +22,7 @@ from platformdirs import user_cache_dir
|
||||||
from ..entry import Entry
|
from ..entry import Entry
|
||||||
from ..result import Result
|
from ..result import Result
|
||||||
from .source import Source, available_sources
|
from .source import Source, available_sources
|
||||||
from ..config import BoolOption, ChoiceOption, FolderOption, ListStrOption, Option, ConfigOption
|
from ..config import BoolOption, ChoiceOption, FolderOption, ListStrOption, ConfigOption
|
||||||
|
|
||||||
|
|
||||||
class YouTube:
|
class YouTube:
|
||||||
|
|
1
typings/socketio/exceptions.pyi
Normal file
1
typings/socketio/exceptions.pyi
Normal file
|
@ -0,0 +1 @@
|
||||||
|
class ConnectionError(Exception): ...
|
Loading…
Add table
Reference in a new issue