Initial commit
This commit is contained in:
98
readdisk.py
Normal file
98
readdisk.py
Normal file
@ -0,0 +1,98 @@
|
||||
import sys
|
||||
from PySide6.QtWidgets import QApplication, QDialog, QButtonGroup
|
||||
from PySide6.QtCore import Slot
|
||||
from PySide6.QtGui import QIntValidator
|
||||
|
||||
# Import the generated UI class from the ui_form.py file
|
||||
from ui_read_disk import Ui_ReadDialog
|
||||
|
||||
class ReadDiskWindow(QDialog):
|
||||
def __init__(self, parent=None):
|
||||
super().__init__(parent)
|
||||
|
||||
self.ui = Ui_ReadDialog()
|
||||
self.ui.setupUi(self)
|
||||
|
||||
# --- Set up Logical Button Groups ---
|
||||
self.flippy_type_group = QButtonGroup(self)
|
||||
self.flippy_type_group.addButton(self.ui.rb_panasonic, 1)
|
||||
self.flippy_type_group.addButton(self.ui.rb_teac, 2)
|
||||
|
||||
self.pin2_setting_group = QButtonGroup(self)
|
||||
self.pin2_setting_group.addButton(self.ui.rb_pin2_high, 1)
|
||||
self.pin2_setting_group.addButton(self.ui.rb_pin2_low, 2)
|
||||
|
||||
# --- Connect Signals to Slots ---
|
||||
self.ui.cb_fake_index.toggled.connect(self.on_fake_index_toggled)
|
||||
self.on_fake_index_toggled(self.ui.cb_fake_index.isChecked())
|
||||
|
||||
self.ui.le_double_step.setValidator(QIntValidator(0, 9))
|
||||
self.ui.le_revs.setValidator(QIntValidator(0, 999999))
|
||||
self.ui.le_bitrate.setValidator(QIntValidator(0, 999999))
|
||||
self.ui.le_retries.setValidator(QIntValidator(0, 999999))
|
||||
self.ui.le_fake_index.setValidator(QIntValidator(0, 999999))
|
||||
self.ui.le_period.setValidator(QIntValidator(0, 999999))
|
||||
self.ui.le_phase.setValidator(QIntValidator(0, 999999))
|
||||
|
||||
# --- Connect Buttons to Dialog's Built-in Slots ---
|
||||
# The "Launch" button will "accept" the dialog (like OK)
|
||||
# The "Back" button will "reject" the dialog (like Cancel)
|
||||
self.ui.btn_launch.clicked.connect(self.on_launch)
|
||||
self.ui.btn_back.clicked.connect(self.reject)
|
||||
|
||||
@Slot(bool)
|
||||
def on_fake_index_toggled(self, checked):
|
||||
"""Enables or disables the Fake Index widgets."""
|
||||
self.ui.le_fake_index.setEnabled(checked)
|
||||
self.ui.combo_fake_index.setEnabled(checked)
|
||||
|
||||
@Slot()
|
||||
def on_launch(self):
|
||||
filename = "my_disk"
|
||||
tracks = ""
|
||||
|
||||
if self.ui.cb_double_step.isChecked():
|
||||
tracks = "step=" + self.ui.le_double_step.text()
|
||||
|
||||
if self.ui.cb_revs.isChecked():
|
||||
revs = " --revs=" + self.ui.le_revs.text()
|
||||
|
||||
if self.ui.cb_drive_select.isChecked():
|
||||
drive = " --drive=" + self.ui.combo_drive_select.currentText()
|
||||
|
||||
if self.ui.cb_bitrate.isChecked():
|
||||
bitrate = "bitrate=" + self.ui.le_bitrate.text()
|
||||
|
||||
if self.ui.cb_retries.isChecked():
|
||||
retries = " --retries=" + self.ui.le_retries.text()
|
||||
|
||||
if self.ui.cb_fake_index.isChecked():
|
||||
fake_index = " --fake-index=" + self.ui.le_fake_index.text() + self.ui.combo_fake_index.currentText()
|
||||
|
||||
if self.ui.cb_pllspec.isChecked():
|
||||
pll = " --pll=period=" + self.ui.le_period.text() + ":phase=" + self.ui.le_phase.text()
|
||||
|
||||
if tracks != "":
|
||||
tracks = " --tracks=" + tracks
|
||||
|
||||
if bitrate != "":
|
||||
filename = filename + "::" + bitrate
|
||||
|
||||
command = "gw read " + tracks + revs + drive + fake_index + pll + retries + ' "' + filename + '"'
|
||||
|
||||
self.ui.te_command_line.setPlainText(command)
|
||||
|
||||
def get_settings(self):
|
||||
"""
|
||||
A helper method to gather all settings from the UI into a dictionary.
|
||||
This is a clean way to pass the data out of the dialog.
|
||||
"""
|
||||
settings = {
|
||||
"filename": self.ui.le_filename.text(),
|
||||
"double_step_enabled": self.ui.cb_double_step.isChecked(),
|
||||
"double_step_value": self.ui.le_double_step.text(),
|
||||
"fake_index_enabled": self.ui.cb_fake_index.isChecked(),
|
||||
"fake_index_value": self.ui.le_fake_index.text(),
|
||||
# Add all other settings here...
|
||||
}
|
||||
return settings
|
||||
Reference in New Issue
Block a user