def initUI(self, uiname, mode): # release mode # TODO: convert .ui to py code app = QApplication(sys.argv) # debug mode if mode == 'debug': ui_file_name = uiname ui_file = QFile(ui_file_name) if not ui_file.open(QIODevice.ReadOnly): print(f"Cannot open {ui_file_name}: {ui_file.errorString()}") sys.exit(-1) loader = QUiLoader() window = loader.load(ui_file) ui_file.close() if not window: print(loader.errorString()) sys.exit(-1) window.show() return app, window
def __init__(self): QCoreApplication.setAttribute(Qt.AA_ShareOpenGLContexts) app = QApplication(sys.argv) app.setStyle(QStyleFactory.create('Fusion')) ui_file_name = '%s.ui' % Path(__file__).stem ui_file = QFile(ui_file_name) if not ui_file.open(QIODevice.ReadOnly): print('Cannot open %s: %s' % (ui_file_name, ui_file.errorString())) sys.exit(-1) loader = QUiLoader() self.window = loader.load(ui_file) ui_file.close() if not self.window: print(loader.errorString()) sys.exit(-1) self.connect() self.setting() self.window.show() sys.exit(app.exec())
def __init__(self, parent=None): super().__init__(parent) self.cfg = read_config(Path(BASE_PATH, "config.json")) ui_file_name = str(Path(BASE_PATH, "resources", "gui.ui")) ui_file = QtCore.QFile(ui_file_name) if not ui_file.open(QtCore.QIODevice.ReadOnly): print(f"Cannot open {ui_file_name}: {ui_file.errorString()}") sys.exit(-1) loader = QUiLoader() window = loader.load(ui_file) ui_file.close() if not window: print(loader.errorString()) sys.exit(-1) self.ui = window self.current_folder = self.cfg.default_album_folder self.slider_start_position = self.cfg.default_channel_volume self.player_status = None self.albums = [] self.current_album = None self.used_channels = [] self.ui.setWindowTitle(WindowProp.TITLE) self.ui.setWindowIcon( QtGui.QIcon( str(Path(BASE_PATH, self.cfg.svg_path, self.cfg.svg_app_icon)))) self.ui.setGeometry(WindowProp.LEFT, WindowProp.TOP, WindowProp.WIDTH, WindowProp.HEIGHT) self.center() self.sliders_reset() self.sliders_disable() self.ui.vertical_slider_0a.valueChanged.connect( lambda position, channel=0: self.sliders_change(position, channel)) self.ui.vertical_slider_1a.valueChanged.connect( lambda position, channel=1: self.sliders_change(position, channel)) self.ui.vertical_slider_2a.valueChanged.connect( lambda position, channel=2: self.sliders_change(position, channel)) self.ui.vertical_slider_3a.valueChanged.connect( lambda position, channel=3: self.sliders_change(position, channel)) self.ui.vertical_slider_4a.valueChanged.connect( lambda position, channel=4: self.sliders_change(position, channel)) self.ui.vertical_slider_5a.valueChanged.connect( lambda position, channel=5: self.sliders_change(position, channel)) self.ui.vertical_slider_6a.valueChanged.connect( lambda position, channel=6: self.sliders_change(position, channel)) self.ui.vertical_slider_7a.valueChanged.connect( lambda position, channel=7: self.sliders_change(position, channel)) self.ui.vertical_slider_8a.valueChanged.connect( lambda position, channel=8: self.sliders_change(position, channel)) self.ui.vertical_slider_9a.valueChanged.connect( lambda position, channel=9: self.sliders_change(position, channel)) self.combobox_populate() self.ui.btn_pause_play.clicked.connect(self.player_play) self.ui.btn_pause_play.setIcon( QtGui.QIcon( str(Path(BASE_PATH, self.cfg.svg_path, self.cfg.svg_btn_play)))) self.ui.btn_stop.clicked.connect(self.player_stop) self.ui.btn_stop.setIcon( QtGui.QIcon( str(Path(BASE_PATH, self.cfg.svg_path, self.cfg.svg_btn_stop)))) self.ui.btn_reset.clicked.connect(self.sliders_reset) self.ui.btn_all_up_volume.clicked.connect(self.sliders_up) self.ui.btn_all_down_volume.clicked.connect(self.sliders_down) self.ui.btn_random.clicked.connect(self.sliders_random) self.ui.select_album.currentIndexChanged.connect( self.combobox_on_change) self.ui.show() if self.cfg.auto_play: self.player_play()
from PySide6.QtWidgets import QApplication from PySide6.QtCore import QFile, QIODevice if __name__ == "__main__": app = QApplication(sys.argv) ui_file_name = "./qt-ui-files/osl-chord-generator-main.ui" ui_file = QFile(ui_file_name) if not ui_file.open(QIODevice.ReadOnly): print(f"Cannot open {ui_file_name}: {ui_file.errorString()}") sys.exit(-1) loader = QUiLoader() window = loader.load(ui_file) ui_file.close() if not window: print(loader.errorString()) sys.exit(-1) window.show() sys.exit(app.exec_()) # from pathlib import Path # baseNoteLength = "quarter" # baseMidiDirectory = "/Users/duke/Downloads/OSL_BeatPatterns/" #OK Here's the Key Map for FLStudio 20 FPC # Lite Crash G4 # Tambourine F#4