def make_user_choose_paths(self) -> bool: # return False if user cancelled xml_path = try_select_xml() if not xml_path: text = "You need to provide your Etterna.xml!" QMessageBox.critical(None, text, text) return False self._prefs.xml_path = xml_path replays_dir = os.path.abspath( os.path.join(os.path.dirname(xml_path), "../../ReplaysV2")) if os.path.exists(replays_dir): self._prefs.replays_dir = replays_dir songs_root = os.path.abspath( os.path.join(os.path.dirname(xml_path), "../../../Songs")) if os.path.exists(songs_root): self._prefs.songs_root = songs_root if self._prefs.replays_dir is None or self._prefs.songs_root is None: QMessageBox.information( None, "Couldn't locate game data", "The ReplaysV2 directory and/or root songs directory could not be found. " + "Please select it manually in the following dialog") SettingsDialog().exec_() return True
def showSettingsDialog(self): if self.settingsDialog: return self.settingsDialog = SettingsDialog() self.settingsDialog.finished.connect(self.onSettingsDialogFinished) self.settingsDialog.show()
def showConfigurationInterface(self): """Show settings dialog""" self.settings_dialog = SettingsDialog(self) dialog = KPageDialog() dialog.setFaceType(KPageDialog.Plain) dialog.setButtons(KDialog.ButtonCode(KDialog.Ok | KDialog.Cancel)) page = dialog.addPage(self.settings_dialog, "Settings") self.connect(dialog, SIGNAL("okClicked()"), self.configAccepted) self.connect(dialog, SIGNAL("cancelClicked()"), self.configDenied) dialog.resize(350, 200) dialog.exec_()
def __init__(self): # Construct app, root widget and layout self.qapp = QApplication(["Kangalioo's Etterna stats analyzer"]) # Prepare area for the widgets window = QMainWindow() root = QWidget() layout = QVBoxLayout(root) # setup style root.setStyleSheet(f""" background-color: {util.bg_color()}; color: {util.text_color()}; """) pg.setConfigOption("background", util.bg_color()) pg.setConfigOption("foreground", util.text_color()) main_menu = window.menuBar().addMenu("File") main_menu.addAction("Settings").triggered.connect( lambda: SettingsDialog().exec_()) main_menu.addAction("About").triggered.connect( lambda: QMessageBox.about(None, "About", ABOUT_TEXT)) # Put the widgets in self.setup_widgets(layout, window) # QScrollArea wrapper with scroll wheel scrolling disabled on plots. I did this to prevent # simultaneous scrolling and panning when hovering a plot while scrolling class ScrollArea(QScrollArea): def eventFilter(self, _obj, event) -> bool: if event.type() == QEvent.Wheel and any( w.underMouse() for w in app.app.get_pg_plots()): return True return False scroll = ScrollArea(window) scroll.setWidget(root) scroll.setWidgetResizable(True) window.setCentralWidget(scroll) # Start w, h = 1600, 3100 if app.app.prefs.enable_all_plots: h += 1300 # More plots -> more room # ~ root.setMinimumSize(1000, h) root.setMinimumHeight(h) window.resize(w, h) window.show() util.keep(window)
def __init__(self): QMainWindow.__init__(self) Ui_Main.__init__(self) self.setupUi(self) self.get_saved_ingredients() self.update_drink_list() self.serial = QtSerialPort.QSerialPort('/dev/ttyACM0', readyRead=self.receive) self.serial.open(QtCore.QIODevice.OpenModeFlag.ReadWrite) if not self.serial.isOpen(): print("Initializing without Serial.") self.loadingDialog = LoadingDialog(self) self.passwordDialog = PasswordDialog(self) self.settingsDialog = SettingsDialog(self) self.init_animations() self.setWindowTitle("Choisissez une boisson!") self.settings.clicked.connect(self.open_password)
def __init__(self): super().__init__() # UI self.ui = uic.loadUi("nobs_ui.ui", self) self.ui.setWindowTitle("NOBS Player") self.settings_dialog = SettingsDialog(self) self.settings = self.settings_dialog.settings # Variables self.sort_ascending = False # Library object self.lib = LibGrabber() self.lib.load_lib() # Player object self.player = QMediaPlayer() self.main_playlist = QMediaPlaylist() # Setup self.connect_slots() self.populate_podcast_list() self.view_all_episodes() # Go! self.show()
def show_settings(self): settingsDialog = SettingsDialog(self.settings_dict, self) settingsDialog.settings_accepted.connect(self.updateSettings) settingsDialog.show()
def setupUi(self): self.resize(QSize(826, 330)) self.setWindowTitle("PyQt5: Multithreading Example") self.centralwidget = QWidget(self) self.gridLayout1 = QGridLayout(self.centralwidget) self.gridLayout1.setContentsMargins(0, 0, 0, 0) self.scrollArea = QScrollArea(self.centralwidget) self.scrollArea.setWidgetResizable(True) self.scrollAreaWidget = QWidget() self.scrollAreaWidget.setGeometry(0, 0, 1000, 1000) self.gridLayout2 = QFormLayout(self.scrollAreaWidget) self.scrollArea.setWidget(self.scrollAreaWidget) self.frame = QFrame(self.scrollAreaWidget) self.gridLayout = QGridLayout(self.frame) self.gridLayout.setContentsMargins(-1, -1, 320, -1) self.gridLayout.setSizeConstraint(QLayout.SetFixedSize) self.gridLayout2.addWidget(self.frame) self.normal_palette = QPalette() brush = QBrush(QColor(0, 0, 0)) brush.setStyle(Qt.SolidPattern) self.normal_palette.setBrush(QPalette.Active, QPalette.WindowText, brush) brush = QBrush(QColor(0, 0, 0)) brush.setStyle(Qt.SolidPattern) self.normal_palette.setBrush(QPalette.Inactive, QPalette.WindowText, brush) brush = QBrush(QColor(120, 120, 120)) brush.setStyle(Qt.SolidPattern) self.normal_palette.setBrush(QPalette.Disabled, QPalette.WindowText, brush) self.green_palette = QPalette() brush = QBrush(QColor(19, 138, 15)) brush.setStyle(Qt.SolidPattern) self.green_palette.setBrush(QPalette.Active, QPalette.WindowText, brush) brush = QBrush(QColor(19, 138, 15)) brush.setStyle(Qt.SolidPattern) self.green_palette.setBrush(QPalette.Inactive, QPalette.WindowText, brush) brush = QBrush(QColor(120, 120, 120)) brush.setStyle(Qt.SolidPattern) self.green_palette.setBrush(QPalette.Disabled, QPalette.WindowText, brush) self.red_palette = QPalette() brush = QBrush(QColor(200, 0, 26)) brush.setStyle(Qt.SolidPattern) self.red_palette.setBrush(QPalette.Active, QPalette.WindowText, brush) brush = QBrush(QColor(200, 0, 26)) brush.setStyle(Qt.SolidPattern) self.red_palette.setBrush(QPalette.Inactive, QPalette.WindowText, brush) brush = QBrush(QColor(120, 120, 120)) brush.setStyle(Qt.SolidPattern) self.red_palette.setBrush(QPalette.Disabled, QPalette.WindowText, brush) self.setCounters(10) self.gridLayout1.addWidget(self.scrollArea) self.setCentralWidget(self.centralwidget) self.menubar = QMenuBar(self) self.menubar.setGeometry(QRect(0, 0, 491, 21)) self.editMenu = QMenu(self.menubar) self.editMenu.setTitle("Edit") self.config = QAction(self) self.config.setText("Configure") self.config.triggered.connect(lambda: SettingsDialog(self)) self.startAll = QAction(self) self.startAll.setText("Start All") self.startAll.triggered.connect(self.startAllCounters) self.startAll.setShortcut("Ctrl+S") self.stopAll = QAction(self) self.stopAll.setText("Stop All") self.stopAll.triggered.connect(self.stopAllCounters) self.stopAll.setShortcut("Ctrl+T") self.resetAll = QAction(self) self.resetAll.setText("Reset All") self.resetAll.triggered.connect(self.resetAllCounters) self.resetAll.setShortcut("Ctrl+R") self.setMenuBar(self.menubar) self.editMenu.addAction(self.config) self.editMenu.addSeparator() self.editMenu.addAction(self.startAll) self.editMenu.addAction(self.stopAll) self.editMenu.addAction(self.resetAll) self.menubar.addAction(self.editMenu.menuAction()) self.statusbar = QStatusBar(self) self.setStatusBar(self.statusbar) QMetaObject.connectSlotsByName(self)
def openSettings(self): settings_dialog = SettingsDialog(self) settings_dialog.exec()
def openSettings(self): settings_dialog = SettingsDialog(self) settings_dialog.show()