Compare commits
No commits in common. "5d95748640c5189715f36cdc435bbe4b87524cef" and "af6e0f69be51effb881a3dafb858bf3dde1ca0be" have entirely different histories.
5d95748640
...
af6e0f69be
@ -226,8 +226,12 @@ class Window(QMainWindow, Ui_MainWindow):
|
||||
self.move_source_rows: Optional[List[int]] = None
|
||||
self.move_source_model: Optional[PlaylistProxyModel] = None
|
||||
self.audacity_file_path: Optional[str] = None
|
||||
self.audacity_client: Optional[pipeclient.PipeClient] = None
|
||||
self.initialise_audacity()
|
||||
# Initialise Audacity access
|
||||
try:
|
||||
self.audacity_client = pipeclient.PipeClient()
|
||||
log.info(f"{hex(id(self.audacity_client))=}")
|
||||
except RuntimeError as e:
|
||||
log.error(f"Unable to initialise Audacity: {str(e)}")
|
||||
|
||||
if Config.CARTS_HIDE:
|
||||
self.cartsWidget.hide()
|
||||
@ -861,17 +865,6 @@ class Window(QMainWindow, Ui_MainWindow):
|
||||
self.import_thread.finished.connect(self.import_thread.deleteLater)
|
||||
self.import_thread.start()
|
||||
|
||||
def initialise_audacity(self) -> None:
|
||||
"""
|
||||
Initialise access to audacity
|
||||
"""
|
||||
|
||||
try:
|
||||
self.audacity_client = pipeclient.PipeClient()
|
||||
log.info(f"{hex(id(self.audacity_client))=}")
|
||||
except RuntimeError as e:
|
||||
log.error(f"Unable to initialise Audacity: {str(e)}")
|
||||
|
||||
def insert_header(self) -> None:
|
||||
"""Show dialog box to enter header text and add to playlist"""
|
||||
|
||||
|
||||
@ -370,15 +370,11 @@ class PlaylistModel(QAbstractTableModel):
|
||||
with Session() as session:
|
||||
for row_number in row_numbers:
|
||||
super().beginRemoveRows(QModelIndex(), row_number, row_number)
|
||||
# We need to remove data from the underlying data store,
|
||||
# which is the database, but we cache in
|
||||
# self.playlist_rows, which is what calls to data()
|
||||
# reads, so fixup that too.
|
||||
PlaylistRows.delete_row(session, self.playlist_id, row_number)
|
||||
PlaylistRows.fixup_rownumbers(session, self.playlist_id)
|
||||
self.refresh_data(session)
|
||||
super().endRemoveRows()
|
||||
|
||||
PlaylistRows.fixup_rownumbers(session, self.playlist_id)
|
||||
self.refresh_data(session)
|
||||
self.reset_track_sequence_row_numbers()
|
||||
|
||||
def display_role(self, row: int, column: int, prd: PlaylistRowData) -> QVariant:
|
||||
@ -574,11 +570,7 @@ class PlaylistModel(QAbstractTableModel):
|
||||
Return a list of unplayed row numbers
|
||||
"""
|
||||
|
||||
result = [
|
||||
a.plr_rownum
|
||||
for a in self.playlist_rows.values()
|
||||
if not a.played and a.track_id is not None
|
||||
]
|
||||
result = [a.plr_rownum for a in self.playlist_rows.values() if not a.played]
|
||||
log.info(f"get_unplayed_rows() returned: {result=}")
|
||||
return result
|
||||
|
||||
@ -1426,7 +1418,7 @@ class PlaylistProxyModel(QSortFilterProxyModel):
|
||||
self.setFilterKeyColumn(-1)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
return f"<PlaylistProxyModel: source_model={self.source_model}>"
|
||||
return (f"<PlaylistProxyModel: source_model={self.source_model}>")
|
||||
|
||||
def filterAcceptsRow(self, source_row: int, source_parent: QModelIndex) -> bool:
|
||||
"""
|
||||
|
||||
@ -209,6 +209,10 @@ class PlaylistTab(QTableView):
|
||||
h_header.sectionResized.connect(self._column_resize)
|
||||
h_header.setStretchLastSection(True)
|
||||
# Setting ResizeToContents causes screen flash on load
|
||||
# v_header = self.verticalHeader()
|
||||
# if v_header:
|
||||
# print("HEADER")
|
||||
# v_header.setSectionResizeMode(QHeaderView.ResizeMode.ResizeToContents)
|
||||
QTimer.singleShot(300, self.resizeRowsToContents)
|
||||
|
||||
# ########## Overridden class functions ##########
|
||||
@ -358,12 +362,6 @@ class PlaylistTab(QTableView):
|
||||
show_warning(self.musicmuster, "Audacity", "Audacity is not running")
|
||||
return False
|
||||
|
||||
if not self.musicmuster.audacity_client:
|
||||
self.musicmuster.initialise_audacity()
|
||||
if not self.musicmuster.audacity_client:
|
||||
log.error("Unable to access Audacity client")
|
||||
return False
|
||||
|
||||
self.musicmuster.audacity_client.write(cmd, timer=True)
|
||||
|
||||
reply = ""
|
||||
@ -677,19 +675,15 @@ class PlaylistTab(QTableView):
|
||||
Open track in passed row in Audacity
|
||||
"""
|
||||
|
||||
if not self.musicmuster.audacity_client:
|
||||
self.musicmuster.initialise_audacity()
|
||||
|
||||
path = self.source_model.get_row_track_path(row_number)
|
||||
if not path:
|
||||
log.error(f"_open_in_audacity: can't get path for {row_number=}")
|
||||
return
|
||||
|
||||
self.musicmuster.audacity_file_path = path
|
||||
escaped_path = path.replace('"', '\\"')
|
||||
cmd = f'Import2: Filename="{escaped_path}"'
|
||||
status = self._audactity_command(cmd)
|
||||
if status:
|
||||
self.musicmuster.audacity_file_path = path
|
||||
|
||||
log.info(f"_open_in_audacity {path=}, {status=}")
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user