Browse Source

split input/gui.py into recording/guiy.py and utils/log.py

Noah Vogt 1 year ago
parent
commit
6901e1cd13

+ 2 - 4
force_song.py

@@ -23,11 +23,9 @@ from PyQt5.QtWidgets import (  # pylint: disable=no-name-in-module
     QMessageBox,
 )
 
-from utils import (
-    make_sure_file_exists,
-)
+from utils import make_sure_file_exists, InfoMsgBox
 from song_switcher import switch_to_song
-from input import validate_obs_song_scene_switcher_config, InfoMsgBox
+from input import validate_obs_song_scene_switcher_config
 import config as const
 
 

+ 0 - 7
input/__init__.py

@@ -32,10 +32,3 @@ from .validate_config import (
     validate_cd_burn_config,
 )
 from .slide_selection_iterator import slide_selection_iterator
-from .gui import (
-    RadioButtonDialog,
-    choose_cd_day,
-    choose_sermon_day,
-    InfoMsgBox,
-    WaveAndSheetPreviewChooserGUI,
-)

+ 1 - 1
input/parse_file.py

@@ -27,8 +27,8 @@ from utils import (
     get_unique_structure_elements,
     get_songtext_by_structure,
     expand_dir,
+    InfoMsgBox,
 )
-from input import InfoMsgBox
 import config as const
 
 

+ 1 - 2
input/validate_config.py

@@ -20,8 +20,7 @@ from PyQt5.QtWidgets import (  # pylint: disable=no-name-in-module
     QMessageBox,
 )
 
-from utils import log, error_msg
-from input import InfoMsgBox
+from utils import log, error_msg, InfoMsgBox
 import config as const
 
 

+ 2 - 4
recording/cd.py

@@ -29,18 +29,16 @@ from PyQt5.QtCore import (  # pylint: disable=no-name-in-module
 
 import config as const
 from input import (
-    InfoMsgBox,
-    RadioButtonDialog,
     validate_cd_burn_config,
-    WaveAndSheetPreviewChooserGUI,
 )
-from utils import expand_dir, log, make_sure_file_exists
+from utils import expand_dir, log, make_sure_file_exists, InfoMsgBox
 from os_agnostic import get_cd_drives, eject_drive
 from audio import AudioSourceFileType
 from .verify import (
     is_legal_sheet_filename,
     get_padded_cd_num_from_sheet_filename,
 )
+from .gui import RadioButtonDialog, WaveAndSheetPreviewChooserGUI
 
 
 def get_burn_cmd(cd_drive: str, yyyy_mm_dd, padded_zfill_num: str) -> str:

+ 0 - 23
input/gui.py → recording/gui.py

@@ -61,25 +61,6 @@ class CheckBoxConstruct:
     check_box: QCheckBox
 
 
-# pylint: disable=too-few-public-methods
-class InfoMsgBox:
-    def __init__(self, icon: QMessageBox.Icon, title: str, text: str) -> None:
-        self.app = QApplication([])
-        self.title = title
-        self.text = text
-        self.icon = icon
-        self.show_msg_box()
-        self.app.exec_()
-
-    def show_msg_box(self):
-        self.message_box = QMessageBox()
-        self.message_box.setIcon(self.icon)
-        self.message_box.setWindowTitle(self.title)
-        self.message_box.setText(self.text)
-
-        self.message_box.show()
-
-
 class RadioButtonDialog(QDialog):  # pylint: disable=too-few-public-methods
     def __init__(self, options: list[str], window_title: str):
         super().__init__()
@@ -399,7 +380,3 @@ def choose_archive_day(strings: ArchiveTypeStrings) -> list[str]:
         f"Failed to access directory: {const.CD_RECORD_OUTPUT_BASEDIR}.",
         "",
     ]
-
-
-# class SheetAndPreviewChooser(WaveAndSheetPreviewChooserGUI):
-#     def __init__(self, )

+ 2 - 3
recording/sermon.py

@@ -27,8 +27,7 @@ from PyQt5.QtWidgets import (  # pylint: disable=no-name-in-module
     QDialog,
 )
 
-from utils import CustomException, expand_dir, log
-from input import InfoMsgBox
+from utils import CustomException, expand_dir, log, InfoMsgBox
 from audio import (
     get_ffmpeg_timestamp_from_frame,
     SermonSegment,
@@ -36,12 +35,12 @@ from audio import (
     get_index_line_as_frames,
     AudioSourceFileType,
 )
-from input import WaveAndSheetPreviewChooserGUI
 import config as const
 from .verify import (
     get_padded_cd_num_from_sheet_filename,
     is_legal_sheet_filename,
 )
+from .gui import WaveAndSheetPreviewChooserGUI
 
 
 def get_full_wav_path(segment: SermonSegment) -> str:

+ 2 - 2
recording/verify.py

@@ -22,8 +22,8 @@ from PyQt5.QtWidgets import (  # pylint: disable=no-name-in-module
 )
 
 import config as const
-from utils import get_yyyy_mm_dd_date
-from input import InfoMsgBox, get_cachefile_content
+from utils import get_yyyy_mm_dd_date, InfoMsgBox
+from input import get_cachefile_content
 
 
 def is_valid_cd_record_checkfile(

+ 2 - 1
set_cd_marker.py

@@ -34,8 +34,9 @@ from utils import (
     log,
     warn,
     expand_dir,
+    InfoMsgBox,
 )
-from input import get_cachefile_content, validate_cd_record_config, InfoMsgBox
+from input import get_cachefile_content, validate_cd_record_config
 import config as const
 from recording import is_valid_cd_record_checkfile, mark_end_of_recording
 

+ 2 - 1
song_switcher/switch.py

@@ -25,8 +25,9 @@ from utils import (
     log,
     get_yyyy_mm_dd_date,
     expand_dir,
+    InfoMsgBox,
 )
-from input import get_cachefile_content, InfoMsgBox
+from input import get_cachefile_content
 import config as const
 from .obs import safe_send_hotkey
 

+ 2 - 1
stop_cd_recording.py

@@ -32,8 +32,9 @@ from utils import (
     get_unix_milis,
     warn,
     expand_dir,
+    InfoMsgBox,
 )
-from input import get_cachefile_content, validate_cd_record_config, InfoMsgBox
+from input import get_cachefile_content, validate_cd_record_config
 import config as const
 from recording import is_valid_cd_record_checkfile, mark_end_of_recording
 

+ 1 - 1
utils/__init__.py

@@ -13,7 +13,7 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-from .log import error_msg, warn, log, CustomException
+from .log import error_msg, warn, log, CustomException, InfoMsgBox
 from .strings import (
     get_songtext_by_structure,
     structure_as_list,

+ 23 - 0
utils/log.py

@@ -16,6 +16,29 @@
 import sys
 
 from termcolor import colored
+from PyQt5.QtWidgets import (  # pylint: disable=no-name-in-module
+    QApplication,
+    QMessageBox,
+)
+
+
+# pylint: disable=too-few-public-methods
+class InfoMsgBox:
+    def __init__(self, icon: QMessageBox.Icon, title: str, text: str) -> None:
+        self.app = QApplication([])
+        self.title = title
+        self.text = text
+        self.icon = icon
+        self.show_msg_box()
+        self.app.exec_()
+
+    def show_msg_box(self):
+        self.message_box = QMessageBox()
+        self.message_box.setIcon(self.icon)
+        self.message_box.setWindowTitle(self.title)
+        self.message_box.setText(self.text)
+
+        self.message_box.show()
 
 
 def error_msg(msg: str):

+ 1 - 2
utils/path.py

@@ -21,8 +21,7 @@ from PyQt5.QtWidgets import (  # pylint: disable=no-name-in-module
     QMessageBox,
 )
 
-from input import InfoMsgBox
-from .log import error_msg
+from .log import error_msg, InfoMsgBox
 
 
 def expand_dir(directory: str) -> str: