class SettingsWindow(QWidget): def eventFilter(self, object, event): if event.type() == QEvent.FocusIn: self.customspeedRB.setChecked(True) return super(SettingsWindow, self).eventFilter(object, event) def setupUi(self, Form, host='192.168.2.171'): Form.resize(250, 900) Form.setStyleSheet('font: 10pt \"Tahoma\";') self.host = host self.downtimechecked = 0 self.default = defaultsettings self.defaultcutbacks = defaultcutbacksettings db = connector.connect(host=self.host, user="******", passwd="Sequal1234", database="simulation", use_pure=True) buttonSS = "QPushButton {\n" \ " background-color: ;\n" \ " background-color: qlineargradient(spread:pad, x1:0, y1:0, " \ "x2:1, y2:1, stop:0 rgba(0, 115, 119, 255), stop:1 rgb(4, 147, " \ "131));\n" \ " color: white;\n" \ " height: 25px;\n" \ " border: None;\n" \ " border-radius: 2px;\n" \ " \n" \ " font: 11pt \"Tahoma\";\n" \ " width: " self.mainlayout = QVBoxLayout(Form) hlayout = QHBoxLayout() self.titlelabel = QLabel(Form) self.titlelabel.setStyleSheet( 'font: 12pt \"Tahoma\"; font-weight: bold;') hlayout.addWidget(self.titlelabel) hspacer = QSpacerItem(40, 25, QSizePolicy.Expanding, QSizePolicy.Minimum) hlayout.addItem(hspacer) self.resetbutton = QPushButton(Form) self.resetbutton.setStyleSheet(buttonSS + "140px;}") self.resetbutton.setCursor(QCursor(Qt.PointingHandCursor)) hlayout.addWidget(self.resetbutton) self.mainlayout.addLayout(hlayout) self.hlayout = QVBoxLayout() # ################ # # GENERAL SETTINGS # # ################ # self.generalGB = QGroupBox(Form) self.generalGB.setStyleSheet('QGroupBox {font: 11pt \"Tahoma\";}') self.hlayout2 = QVBoxLayout(self.generalGB) self.hlayout2.setSpacing(15) self.gridlayout = QGridLayout() self.gridlayout.setHorizontalSpacing(2) self.loggaplabel = QLabel(self.generalGB) self.gridlayout.addWidget(self.loggaplabel, 0, 0, 1, 1) self.loggapTB = QDoubleSpinBox(self.generalGB) self.loggapTB.setButtonSymbols(QAbstractSpinBox.NoButtons) self.loggapTB.setSingleStep(0.1) self.loggapTB.setMinimum(0.3) self.loggapTB.setStyleSheet( 'QDoubleSpinBox::disabled {color: rgb(200, 200, 200);}') self.gridlayout.addWidget(self.loggapTB, 0, 1, 1, 1) self.loggapAuto = QCheckBox(self.generalGB) self.gridlayout.addWidget(self.loggapAuto, 0, 2, 1, 1) self.numbinslabel = QLabel(self.generalGB) self.gridlayout.addWidget(self.numbinslabel, 1, 0, 1, 1) self.numbinsTB = QSpinBox(self.generalGB) self.numbinsTB.setMinimum(1) self.numbinsTB.setMaximum(40) self.gridlayout.addWidget(self.numbinsTB, 1, 1, 1, 1) vspacer = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding) self.gridlayout.addItem(vspacer, 2, 0, 1, 1) self.hlayout2.addLayout(self.gridlayout) # hspacer = QSpacerItem( # 20, 40, QSizePolicy.Expanding, QSizePolicy.Minimum) # self.hlayout2.addItem(hspacer) # Line speed group box self.linespeedGB = QGroupBox(self.generalGB) self.linespeedGB.setStyleSheet('QGroupBox {font: 11pt \"Tahoma\";}') vlayout = QVBoxLayout(self.linespeedGB) self.highspeedRB = QRadioButton(self.linespeedGB) vlayout.addWidget(self.highspeedRB) self.lowspeedRB = QRadioButton(self.linespeedGB) vlayout.addWidget(self.lowspeedRB) self.autospeedRB = QRadioButton(self.linespeedGB) vlayout.addWidget(self.autospeedRB) hlayout = QHBoxLayout() hlayout.setSpacing(0) self.customspeedRB = QRadioButton(self.linespeedGB) self.customspeedRB.setMinimumWidth(17) self.customspeedRB.setMaximumWidth(17) hlayout.addWidget(self.customspeedRB) self.customspeedTB = QDoubleSpinBox(self.linespeedGB) self.customspeedTB.setButtonSymbols(QAbstractSpinBox.NoButtons) self.customspeedTB.setDecimals(1) self.customspeedTB.setMaximum(200) self.customspeedTB.installEventFilter(self) hlayout.addWidget(self.customspeedTB) vlayout.addLayout(hlayout) vspacer = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding) vlayout.addItem(vspacer) self.hlayout2.addWidget(self.linespeedGB) self.hlayout.addWidget(self.generalGB) # ################# # # DOWNTIME SETTINGS # # ################# # self.downtimeGB = QGroupBox(Form) self.downtimeGB.setStyleSheet('QGroupBox {font: 11pt \"Tahoma\";}') gridlayout = QGridLayout(self.downtimeGB) self.downtimeCBall = QCheckBox(self.downtimeGB) gridlayout.addWidget(self.downtimeCBall, 0, 0, 1, 1) self.downtimeCBtexts = list( read_sql('SELECT * From DowntimeSettings Where SimID = -1;', db).head())[1:] self.downtimeCBs = [] for i in range(len(self.downtimeCBtexts)): self.downtimeCBs.append(QCheckBox(self.downtimeGB)) row = int(i / 2) col = i % 2 gridlayout.addWidget(self.downtimeCBs[i], row + 1, col, 1, 1) vspacer = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding) gridlayout.addItem(vspacer, row + 1, 0, 1, 1) self.hlayout.addWidget(self.downtimeGB) # ################ # # CUTBACK SETTINGS # # ################ # self.cutbackGB = QGroupBox(Form) self.cutbackGB.setStyleSheet('QGroupBox {font: 11pt \"Tahoma\";}') gridlayout = QGridLayout(self.cutbackGB) self.cutbackCBtexts = list( read_sql('SELECT * From CutbackSettings Where SimID = -1;', db).head())[1:] self.cutbackCBs = [] for i in range(len(self.cutbackCBtexts)): self.cutbackCBs.append(QCheckBox(self.cutbackGB)) row = int(i / 2) col = i % 2 gridlayout.addWidget(self.cutbackCBs[i], row, col, 1, 1) vspacer = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding) gridlayout.addItem(vspacer, row + 1, 0, 1, 1) self.hlayout.addWidget(self.cutbackGB) self.mainlayout.addLayout(self.hlayout) self.buttonbox = QDialogButtonBox(Form) self.buttonbox.setStandardButtons(QDialogButtonBox.Cancel | QDialogButtonBox.Ok) self.buttonbox.setStyleSheet("QDialogButtonBox " + buttonSS + "70px;}") for w in self.buttonbox.children(): if w.metaObject().className() == "QPushButton": w.setCursor(QCursor(Qt.PointingHandCursor)) self.mainlayout.addWidget(self.buttonbox) vspacer = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding) self.mainlayout.addItem(vspacer) self.retranslateUi(Form) self.SetDefaultSettings() # ####### # # SIGNALS # # ####### # self.resetbutton.clicked.connect(self.SetDefaultSettings) self.loggapAuto.stateChanged.connect(self.onLogGapAuto) self.downtimeCBall.stateChanged.connect(self.onDowntimeAll) for cb in self.downtimeCBs: cb.stateChanged.connect(self.onDowntimeCB) for cb in self.cutbackCBs: cb.stateChanged.connect(self.onCutbackCB) self.numbinsTB.valueChanged.connect(self.showResetButton) self.loggapTB.valueChanged.connect(self.showResetButton) if defaultsettings[3] == 55.0: self.highspeedRB.toggled.connect(self.showResetButton) elif defaultsettings[3] == 35.0: self.lowspeedRB.toggled.connect(self.showResetButton) else: self.autospeedRB.toggled.connect(self.showResetButton) def SetDefaultSettings(self): if defaultsettings[3] == 55.0: self.highspeedRB.setChecked(True) elif defaultsettings[3] == 35.0: self.lowspeedRB.setChecked(True) else: self.autospeedRB.setChecked(True) if defaultsettings[0] > 0: self.loggapTB.setValue(defaultsettings[0]) self.loggapAuto.setChecked(False) else: self.loggapAuto.setChecked(True) self.numbinsTB.setValue(defaultsettings[2]) self.downtimeCBall.setChecked(Qt.Checked) self.downtimechecked = 4 for cb in self.downtimeCBs: cb.setChecked(True) for cb in self.cutbackCBs: cb.setChecked(False) for cb in self.defaultcutbacks: self.cutbackCBs[self.cutbackCBtexts.index(cb)].setChecked(True) self.resetbutton.setVisible(False) def onCutbackCB(self, state): self.showResetButton() def onDowntimeAll(self, state): self.showResetButton() if state == Qt.Unchecked: for cb in self.downtimeCBs: cb.setChecked(False) elif state == Qt.Checked: for cb in self.downtimeCBs: cb.setChecked(True) elif state == Qt.PartiallyChecked and self.downtimechecked == 0: for cb in self.downtimeCBs: cb.setChecked(True) def onDowntimeCB(self, state): self.showResetButton() if state == Qt.Checked: self.downtimechecked += 1 else: self.downtimechecked -= 1 if self.downtimechecked == len(self.downtimeCBs): self.downtimeCBall.setCheckState(Qt.Checked) elif self.downtimechecked == 0: self.downtimeCBall.setCheckState(Qt.Unchecked) else: self.downtimeCBall.setCheckState(Qt.PartiallyChecked) def onLogGapAuto(self, state): self.showResetButton() self.loggapTB.setDisabled(state) def showResetButton(self): self.resetbutton.setVisible(True) def setupReadOnly(self): self.highspeedRB.setDisabled(True) self.lowspeedRB.setDisabled(True) self.autospeedRB.setDisabled(True) self.customspeedRB.setDisabled(True) self.customspeedTB.setDisabled(True) self.loggapAuto.setDisabled(True) self.loggapTB.setDisabled(True) self.loggapTB.setStyleSheet('') self.numbinsTB.setDisabled(True) for cb in self.downtimeCBs: cb.setDisabled(True) self.downtimeCBall.setDisabled(True) for cb in self.cutbackCBs: cb.setDisabled(True) self.resetbutton.setVisible(False) def retranslateUi(self, Form): _translate = QCoreApplication.translate self.titlelabel.setText(_translate('Form', 'Settings')) self.resetbutton.setText(_translate('Form', 'Reset to Default')) self.generalGB.setTitle(_translate('Form', 'General')) self.linespeedGB.setTitle(_translate('Form', 'Line Speed')) self.highspeedRB.setText(_translate('Form', '55 m/min')) self.lowspeedRB.setText(_translate('Form', '35 m/min')) self.autospeedRB.setText(_translate('Form', 'Auto')) self.customspeedRB.setText('') self.customspeedTB.setSuffix(_translate('Form', ' m/min')) self.loggaplabel.setText(_translate('Form', 'Log Gap: ')) self.loggapTB.setValue(defaultsettings[0]) self.loggapTB.setSuffix(_translate('Form', ' m')) self.loggapAuto.setText(_translate('Form', 'Auto')) self.numbinslabel.setText(_translate('Form', 'Number\nof Bins: ')) self.downtimeGB.setTitle(_translate('Form', 'Simulated Downtime')) for i in range(len(self.downtimeCBtexts)): self.downtimeCBs[i].setText( _translate('Form', self.downtimeCBtexts[i])) self.downtimeCBall.setText(_translate('Form', 'All')) self.cutbackGB.setTitle(_translate('Form', 'Cutbacks')) for i in range(len(self.cutbackCBtexts)): self.cutbackCBs[i].setText( _translate('Form', self.cutbackCBtexts[i]))
class SettingsUI: # create settings form window def __init__(self, conf, conffile, icn): self.conf = conf self.conffile = conffile self.icon = icn self.scroll = QScrollArea() self.window = QWidget() self.separator = QFrame() self.scroll.setWindowIcon(QIcon(icn)) self.layoutV = QVBoxLayout() self.layoutH0 = QHBoxLayout() self.layoutH0a = QHBoxLayout() self.layoutH1 = QHBoxLayout() self.layoutH2 = QHBoxLayout() self.layoutH3 = QHBoxLayout() self.layoutH4 = QHBoxLayout() self.layoutH5 = QHBoxLayout() self.layoutH6a = QHBoxLayout() self.layoutH6b = QHBoxLayout() self.layoutH6c = QHBoxLayout() self.layoutH6d = QHBoxLayout() self.fBold = QFont() self.fBold.setBold(True) self.scroll.setWindowTitle('Now Playing v1.4.0 - Settings') self.scroll.setWidgetResizable(True) self.scroll.setWindowFlag(Qt.CustomizeWindowHint, True) self.scroll.setWindowFlag(Qt.WindowCloseButtonHint, False) # self.scroll.setWindowFlag(Qt.WindowMinMaxButtonsHint, False) self.scroll.setWindowFlag(Qt.WindowMinimizeButtonHint, False) self.scroll.setWidget(self.window) self.scroll.setMinimumWidth(625) self.scroll.resize(625, 825) # error section self.errLabel = QLabel() self.errLabel.setStyleSheet('color: red') # remote self.localLabel = QLabel('Track Retrieval Mode') self.localLabel.setFont(self.fBold) self.layoutV.addWidget(self.localLabel) self.remoteDesc = QLabel( 'Local mode (default) uses Serato\'s local history log for track data.\ \nRemote mode retrieves remote track data from Serato Live Playlists.') self.remoteDesc.setStyleSheet('color: grey') self.layoutV.addWidget(self.remoteDesc) # radios self.localRadio = QRadioButton('Local') self.localRadio.setChecked(True) self.localRadio.toggled.connect( lambda: self.on_radiobutton_select(self.localRadio)) self.localRadio.setMaximumWidth(60) self.remoteRadio = QRadioButton('Remote') self.remoteRadio.toggled.connect( lambda: self.on_radiobutton_select(self.remoteRadio)) self.layoutH0.addWidget(self.localRadio) self.layoutH0.addWidget(self.remoteRadio) self.layoutV.addLayout(self.layoutH0) # library path self.libLabel = QLabel('Serato Library Path') self.libLabel.setFont(self.fBold) self.libDesc = QLabel( 'Location of Serato library folder.\ni.e., \\THE_PATH_TO\\_Serato_' ) self.libDesc.setStyleSheet('color: grey') self.layoutV.addWidget(self.libLabel) self.layoutV.addWidget(self.libDesc) self.libButton = QPushButton('Browse for folder') self.layoutH0a.addWidget(self.libButton) self.libButton.clicked.connect(self.on_libbutton_clicked) self.libEdit = QLineEdit() self.layoutH0a.addWidget(self.libEdit) self.layoutV.addLayout(self.layoutH0a) # url self.urlLabel = QLabel('URL') self.urlLabel.setFont(self.fBold) self.urlDesc = QLabel( 'Web address of your Serato Playlist.\ne.g., https://serato.com/playlists/USERNAME/live' ) self.urlDesc.setStyleSheet('color: grey') self.layoutV.addWidget(self.urlLabel) self.urlEdit = QLineEdit() self.layoutV.addWidget(self.urlDesc) self.layoutV.addWidget(self.urlEdit) self.urlLabel.setHidden(True) self.urlEdit.setHidden(True) self.urlDesc.setHidden(True) # separator line self.separator.setFrameShape(QFrame.HLine) # self.separator.setFrameShadow(QFrame.Sunken) self.layoutV.addWidget(self.separator) # file self.fileLabel = QLabel('File') self.fileLabel.setFont(self.fBold) self.fileDesc = QLabel( 'The file to which current track info is written. (Must be plain text: .txt)' ) self.fileDesc.setStyleSheet('color: grey') self.layoutV.addWidget(self.fileLabel) self.layoutV.addWidget(self.fileDesc) self.fileButton = QPushButton('Browse for file') self.layoutH1.addWidget(self.fileButton) self.fileButton.clicked.connect(self.on_filebutton_clicked) self.fileEdit = QLineEdit() self.layoutH1.addWidget(self.fileEdit) self.layoutV.addLayout(self.layoutH1) # interval self.intervalLabel = QLabel('Polling Interval') self.intervalLabel.setFont(self.fBold) self.intervalDesc = QLabel('Amount of time, in seconds, \ that must elapse before checking for new track info. (Default = 10.0)') self.intervalDesc.setStyleSheet('color: grey') self.layoutV.addWidget(self.intervalLabel) self.layoutV.addWidget(self.intervalDesc) self.intervalEdit = QLineEdit() self.intervalEdit.setMaximumSize(40, 35) self.layoutV.addWidget(self.intervalEdit) self.intervalLabel.setHidden(True) self.intervalDesc.setHidden(True) self.intervalEdit.setHidden(True) # delay self.delayLabel = QLabel('Write Delay') self.delayLabel.setFont(self.fBold) self.delayDesc = QLabel('Amount of time, in seconds, \ to delay writing the new track info once it\'s retrieved. (Default = 0)') self.delayDesc.setStyleSheet('color: grey') self.layoutV.addWidget(self.delayLabel) self.layoutV.addWidget(self.delayDesc) self.delayEdit = QLineEdit() self.delayEdit.setMaximumWidth(40) self.layoutV.addWidget(self.delayEdit) # multi-line self.multiLabel = QLabel('Multiple Line Indicator') self.multiLabel.setFont(self.fBold) self.layoutV.addWidget(self.multiLabel) self.multiCbox = QCheckBox() self.multiCbox.setMaximumWidth(25) self.layoutH2.addWidget(self.multiCbox) self.multiDesc = QLabel('Write Artist and Song \ data on separate lines.') self.multiDesc.setStyleSheet('color: grey') self.layoutH2.addWidget(self.multiDesc) self.layoutV.addLayout(self.layoutH2) # quotes self.quoteLabel = QLabel('Song Quote Indicator') self.quoteLabel.setFont(self.fBold) self.layoutV.addWidget(self.quoteLabel) self.quoteCbox = QCheckBox() self.quoteCbox.setMaximumWidth(25) self.layoutH3.addWidget(self.quoteCbox) self.quoteDesc = QLabel('Surround the song title \ with quotes.') self.quoteDesc.setStyleSheet('color: grey') self.layoutH3.addWidget(self.quoteDesc) self.layoutV.addLayout(self.layoutH3) # prefixes self.prefixLabel = QLabel('Prefixes') self.prefixLabel.setFont(self.fBold) self.layoutV.addWidget(self.prefixLabel) self.a_prefixDesc = QLabel( 'Artist - String to be written before artist info.') self.a_prefixDesc.setStyleSheet('color: grey') self.s_prefixDesc = QLabel( 'Song - String to be written before song info.') self.s_prefixDesc.setStyleSheet('color: grey') self.layoutH6a.addWidget(self.a_prefixDesc) self.layoutH6a.addWidget(self.s_prefixDesc) self.a_prefixEdit = QLineEdit() self.s_prefixEdit = QLineEdit() self.layoutH6b.addWidget(self.a_prefixEdit) self.layoutH6b.addWidget(self.s_prefixEdit) self.layoutV.addLayout(self.layoutH6a) self.layoutV.addLayout(self.layoutH6b) # suffixes self.suffixLabel = QLabel('Suffixes') self.suffixLabel.setFont(self.fBold) self.layoutV.addWidget(self.suffixLabel) self.a_suffixDesc = QLabel( 'Artist - String to be written after artist info.') self.a_suffixDesc.setStyleSheet('color: grey') self.s_suffixDesc = QLabel( 'Song - String to be written after song info.') self.s_suffixDesc.setStyleSheet('color: grey') self.layoutH6c.addWidget(self.a_suffixDesc) self.layoutH6c.addWidget(self.s_suffixDesc) self.a_suffixEdit = QLineEdit() self.s_suffixEdit = QLineEdit() self.layoutH6d.addWidget(self.a_suffixEdit) self.layoutH6d.addWidget(self.s_suffixEdit) self.layoutV.addLayout(self.layoutH6c) self.layoutV.addLayout(self.layoutH6d) # notify self.notifLabel = QLabel('Notification Indicator') self.notifLabel.setFont(self.fBold) self.layoutV.addWidget(self.notifLabel) self.notifCbox = QCheckBox() self.notifCbox.setMaximumWidth(25) self.layoutH5.addWidget(self.notifCbox) self.notifDesc = QLabel('Show OS system notification \ when new song is retrieved.') self.notifDesc.setStyleSheet('color: grey') self.layoutH5.addWidget(self.notifDesc) self.layoutV.addLayout(self.layoutH5) # error area self.layoutV.addWidget(self.errLabel) # cancel btn self.cancelButton = QPushButton('Cancel') self.cancelButton.setMaximumSize(80, 35) self.layoutH4.addWidget(self.cancelButton) self.cancelButton.clicked.connect(self.on_cancelbutton_clicked) # save btn self.saveButton = QPushButton('Save') self.saveButton.setMaximumSize(80, 35) self.layoutH4.addWidget(self.saveButton) self.saveButton.clicked.connect(self.on_savebutton_clicked) self.layoutV.addLayout(self.layoutH4) self.window.setLayout(self.layoutV) def upd_win(self): c = ConfigFile(self.conf, self.conffile) if c.local: self.localRadio.setChecked(True) self.remoteRadio.setChecked(False) else: self.localRadio.setChecked(False) self.remoteRadio.setChecked(True) self.libEdit.setText(c.libpath) self.urlEdit.setText(c.url) self.fileEdit.setText(c.file) self.intervalEdit.setText(str(c.interval)) self.delayEdit.setText(str(c.delay)) self.multiCbox.setChecked(c.multi) self.quoteCbox.setChecked(c.quote) self.a_prefixEdit.setText(c.a_pref) self.a_suffixEdit.setText(c.a_suff) self.s_prefixEdit.setText(c.s_pref) self.s_suffixEdit.setText(c.s_suff) self.notifCbox.setChecked(c.notif) def upd_conf(self): local = str(self.localRadio.isChecked()) libpath = self.libEdit.text() url = self.urlEdit.text() file = self.fileEdit.text() interval = self.intervalEdit.text() delay = self.delayEdit.text() multi = str(self.multiCbox.isChecked()) quote = str(self.quoteCbox.isChecked()) a_pref = self.a_prefixEdit.text().replace(" ", "|_0") a_suff = self.a_suffixEdit.text().replace(" ", "|_0") s_pref = self.s_prefixEdit.text().replace(" ", "|_0") s_suff = self.s_suffixEdit.text().replace(" ", "|_0") notif = str(self.notifCbox.isChecked()) c = ConfigFile(self.conf, self.conffile) c.put(local, libpath, url, file, interval, delay, multi, quote, a_pref, a_suff, s_pref, s_suff, notif) # radio button action def on_radiobutton_select(self, b): if b.text() == 'Local': self.urlLabel.setHidden(True) self.urlEdit.setHidden(True) self.urlDesc.setHidden(True) self.intervalLabel.setHidden(True) self.intervalDesc.setHidden(True) self.intervalEdit.setHidden(True) self.libLabel.setHidden(False) self.libEdit.setHidden(False) self.libDesc.setHidden(False) self.libButton.setHidden(False) self.window.hide() self.errLabel.setText('') self.window.show() else: self.urlLabel.setHidden(False) self.urlEdit.setHidden(False) self.urlDesc.setHidden(False) self.intervalLabel.setHidden(False) self.intervalDesc.setHidden(False) self.intervalEdit.setHidden(False) self.libLabel.setHidden(True) self.libEdit.setHidden(True) self.libDesc.setHidden(True) self.libButton.setHidden(True) self.window.hide() self.errLabel.setText('') self.window.show() # file button action def on_filebutton_clicked(self): filename = QFileDialog.getOpenFileName(self.window, 'Open file', '.', '*.txt') if filename: self.fileEdit.setText(filename[0]) # file button action def on_libbutton_clicked(self): libdir = QFileDialog.getExistingDirectory(self.window, 'Select directory') if libdir: self.libEdit.setText(libdir) # cancel button action def on_cancelbutton_clicked(self): tray.actConfig.setEnabled(True) self.upd_win() self.close() self.errLabel.setText('') # save button action def on_savebutton_clicked(self): if self.remoteRadio.isChecked(): if 'https://serato.com/playlists' not in self.urlEdit.text() and \ 'https://www.serato.com/playlists' not in self.urlEdit.text() or \ len(self.urlEdit.text()) < 30: self.errLabel.setText('* URL is invalid') self.window.hide() self.window.show() return if self.localRadio.isChecked(): if '_Serato_' not in self.libEdit.text(): self.errLabel.setText( '* Serato Library Path is required. Should point to "_Serato_" folder' ) self.window.hide() self.window.show() return if self.fileEdit.text() == "": self.errLabel.setText('* File is required') self.window.hide() self.window.show() return self.upd_conf() self.close() self.errLabel.setText('') global ini if ini == 0: ini = 1 tray.actPause.setText('Pause') tray.actPause.setEnabled(True) main_thread.start() def show(self): tray.actConfig.setEnabled(False) self.upd_win() self.scroll.show() self.scroll.setFocus() def close(self): tray.actConfig.setEnabled(True) self.scroll.hide() def exit(self): self.scroll.close()