Don't check Audacity; save splitter position

This commit is contained in:
Keith Edmunds 2022-08-13 11:05:39 +01:00
parent 7d71e8ce64
commit 568dc1ef68

View File

@ -2,12 +2,9 @@
from log import log
# import argparse
# import psutil
import sys
# import threading
# import webbrowser
#
#
from datetime import datetime, timedelta
# from typing import Callable, Dict, List, Optional, Tuple
#
@ -78,38 +75,41 @@ class Window(QMainWindow, Ui_MainWindow):
self.previous_track: Optional[TrackData] = None
self.previous_track_position: Optional[int] = None
# self.set_main_window_size()
self.set_main_window_size()
self.lblSumPlaytime = QLabel("")
self.statusbar.addPermanentWidget(self.lblSumPlaytime)
# self.txtSearch = QLineEdit()
# self.statusbar.addWidget(self.txtSearch)
# self.txtSearch.setHidden(True)
self.hide_played_tracks = False
#
self.splitter.setSizes([200, 200])
self.visible_playlist_tab: Callable[[], PlaylistTab] = \
self.tabPlaylist.currentWidget
self._load_last_playlists()
self.enable_play_next_controls()
# self.check_audacity()
self.timer.start(Config.TIMER_MS)
self.connect_signals_slots()
#
# def set_main_window_size(self) -> None:
# """Set size of window from database"""
#
# with Session() as session:
# record = Settings.get_int_settings(session, "mainwindow_x")
# x = record.f_int or 1
# record = Settings.get_int_settings(session, "mainwindow_y")
# y = record.f_int or 1
# record = Settings.get_int_settings(session, "mainwindow_width")
# width = record.f_int or 1599
# record = Settings.get_int_settings(session, "mainwindow_height")
# height = record.f_int or 981
# self.setGeometry(x, y, width, height)
# return
def set_main_window_size(self) -> None:
"""Set size of window from database"""
with Session() as session:
record = Settings.get_int_settings(session, "mainwindow_x")
x = record.f_int or 1
record = Settings.get_int_settings(session, "mainwindow_y")
y = record.f_int or 1
record = Settings.get_int_settings(session, "mainwindow_width")
width = record.f_int or 1599
record = Settings.get_int_settings(session, "mainwindow_height")
height = record.f_int or 981
self.setGeometry(x, y, width, height)
record = Settings.get_int_settings(session, "splitter_top")
splitter_top = record.f_int or 256
record = Settings.get_int_settings(session, "splitter_bottom")
splitter_bottom = record.f_int or 256
self.splitter.setSizes([splitter_top, splitter_bottom])
return
#
# @staticmethod
# def print_current_database():
@ -117,18 +117,6 @@ class Window(QMainWindow, Ui_MainWindow):
# db = session.bind.engine.url.database
# print(f"{db=}")
#
# @staticmethod
# def check_audacity() -> None:
# """Offer to run Audacity if not running"""
#
# if not Config.CHECK_AUDACITY_AT_STARTUP:
# return
#
# if "audacity" in [i.name() for i in psutil.process_iter()]:
# return
#
# if helpers.ask_yes_no("Audacity not running", "Start Audacity?"):
# QProcess.startDetached(Config.AUDACITY_COMMAND, [])
def clear_selection(self) -> None:
""" Clear selected row"""
@ -695,27 +683,6 @@ class Window(QMainWindow, Ui_MainWindow):
idx = self.tabPlaylist.indexOf(widget)
self.tabPlaylist.tabBar().setTabTextColor(idx, colour)
#
# def song_info_search(self) -> None:
# """
# Open browser tab for Wikipedia, searching for
# the first that exists of:
# - selected track
# - next track
# - current track
# """
#
# title: Optional[str] = self.visible_playlist_tab().get_selected_title()
# if not title:
# if self.next_track:
# title = self.next_track.title
# if not title:
# if self.current_track:
# title = self.current_track.title
# if title:
# txt = urllib.parse.quote_plus(title)
# url = Config.TAB_URL % txt
# webbrowser.open(url, new=2)
def stop(self) -> None:
"""Stop playing immediately"""