def __init__(self, soundfile, parent): self.soundfile = soundfile self.isplaying = False self.time = 0 # current audio position in frames self.audio = QMediaPlayer() self.decoder = QAudioDecoder() self.is_loaded = False self.volume = 100 self.isplaying = False self.decoded_audio = {} self.only_samples = [] self.decoding_is_finished = False self.max_bits = 32768 self.signed = False # File Loading is Asynchronous, so we need to be creative here, doesn't need to be duration but it works self.audio.durationChanged.connect(self.on_durationChanged) self.decoder.finished.connect(self.decode_finished_signal) self.audio.setMedia(QUrl.fromLocalFile(soundfile)) self.decoder.setSourceFilename(soundfile) # strangely inconsistent file-handling # It will hang here forever if we don't process the events. while not self.is_loaded: QCoreApplication.processEvents() time.sleep(0.1) self.decode_audio() self.np_data = np.array(self.only_samples) if not self.signed: # don't ask me why this fixes 8 bit samples... self.np_data = self.np_data - self.max_bits / 2 print(len(self.only_samples)) print(self.max_bits) self.isvalid = True
class ProducerConsumer(unittest.TestCase): '''Basic test case for producer-consumer QThread''' def setUp(self): #Create fixtures self.app = QCoreApplication([]) def tearDown(self): #Destroy fixtures del self.app def finishCb(self): #Quits the application self.app.exit(0) def testProdCon(self): #QThread producer-consumer example bucket = Bucket() prod = Producer(bucket) cons = Consumer(bucket) prod.start() cons.start() QObject.connect(prod, SIGNAL('finished()'), self.finishCb) QObject.connect(cons, SIGNAL('finished()'), self.finishCb) self.app.exec_() prod.wait() cons.wait() self.assertEqual(prod.production_list, cons.consumption_list)
def __init__(self, parent=None): QOpenGLWidget.__init__(self, parent) QOpenGLFunctions.__init__(self) self.core = "--coreprofile" in QCoreApplication.arguments() self.xRot = 0 self.yRot = 0 self.zRot = 0 self.lastPos = 0 self.logo = Logo() self.vao = QOpenGLVertexArrayObject() self.logoVbo = QOpenGLBuffer() self.program = QOpenGLShaderProgram() self.projMatrixLoc = 0 self.mvMatrixLoc = 0 self.normalMatrixLoc = 0 self.lightPosLoc = 0 self.proj = QMatrix4x4() self.camera = QMatrix4x4() self.world = QMatrix4x4() self.transparent = "--transparent" in QCoreApplication.arguments() if self.transparent: fmt = self.format() fmt.setAlphaBufferSize(8) self.setFormat(fmt)
def decode_audio(self): self.decoder.start() while not self.decoding_is_finished: QCoreApplication.processEvents() if self.decoder.bufferAvailable(): tempdata = self.decoder.read() # We use the Pointer Address to get a cffi Pointer to the data (hopefully) cast_data = self.audioformat_to_datatype(tempdata.format()) possible_data = ffi.cast("{1}[{0}]".format(tempdata.sampleCount(), cast_data), int(tempdata.constData())) self.only_samples.extend(possible_data) self.decoded_audio[self.decoder.position()] = [possible_data, len(possible_data), tempdata.byteCount(), tempdata.format()]
def _wait_for_segment_end(self, newstart, newlength): start = newstart * 1000.0 length = newlength * 1000.0 end = start + length print(start) print(length) print(end) while self.audio.position() < end: QCoreApplication.processEvents() print(self.audio.position()) time.sleep(0.001) self.audio.stop() self.isplaying = False
def testPythonSlot(self): self._sucess = False view = View() view.called.connect(self.done) view.show() QTimer.singleShot(300, QCoreApplication.instance().quit) self.app.exec_() self.assertTrue(self._sucess)
def setUp(self): #Acquire resources self.called = False self.app = QCoreApplication([]) self.socket = QUdpSocket() self.server = QUdpSocket() self.server.bind(QHostAddress(QHostAddress.LocalHost), 45454)
def testEmitOutsideThread(self): global thread_run app = QCoreApplication([]) source = Source() thread = ThreadJustConnects(source) QObject.connect(thread, SIGNAL('finished()'), lambda: app.exit(0)) thread.start() while not thread_run: pass source.emit_sig() app.exec_() thread.wait() self.assert_(thread.target.called)
def testBlockingSignal(self): app = QCoreApplication.instance() or QCoreApplication([]) eventloop = QEventLoop() emitter = Emitter() receiver = Receiver(eventloop) emitter.connect(emitter, SIGNAL("signal(int)"), receiver.receive, Qt.BlockingQueuedConnection) emitter.start() retval = eventloop.exec_() emitter.wait() self.assertEqual(retval, 0)
class HttpSignalsCase(unittest.TestCase): '''Test case for bug #124 - readDatagram signature QUdpSocket.readDatagram must return a tuple with the datagram, host and port, while receiving only the max payload size.''' def setUp(self): #Acquire resources self.called = False self.app = QCoreApplication([]) self.socket = QUdpSocket() self.server = QUdpSocket() self.server.bind(QHostAddress(QHostAddress.LocalHost), 45454) def tearDown(self): #Release resources del self.socket del self.server del self.app def sendPackage(self): addr = QHostAddress(QHostAddress.LocalHost) self.socket.writeDatagram('datagram', addr, 45454) def callback(self): while self.server.hasPendingDatagrams(): datagram, host, port = self.server.readDatagram(self.server.pendingDatagramSize()) self.called = True self.app.quit() def testDefaultArgs(self): #QUdpSocket.readDatagram pythonic return # @bug 124 QObject.connect(self.server, SIGNAL('readyRead()'), self.callback) self.sendPackage() self.app.exec_() self.assert_(self.called)
def __init__(self): QCoreApplication.setOrganizationName('DynArt') QCoreApplication.setApplicationName('TilePad') QCoreApplication.setApplicationVersion('0.4.0') if getattr(sys, 'frozen', False): self.dir = os.path.dirname(sys.executable) else: self.dir = os.path.dirname(__file__) self.dir = self.dir.replace('\\', '/') self.qApp = QApplication(sys.argv) self.mainWindow = MainWindow(self)
if event.buttons() & Qt.LeftButton: self.setXRotation(self.xRot + 8 * dy) self.setYRotation(self.yRot + 8 * dx) elif event.buttons() & Qt.RightButton: self.setXRotation(self.xRot + 8 * dy) self.setZRotation(self.zRot + 8 * dx) self.lastPos = QPoint(event.pos()) if __name__ == '__main__': app = QApplication(sys.argv) fmt = QSurfaceFormat() fmt.setDepthBufferSize(24) if "--multisample" in QCoreApplication.arguments(): fmt.setSamples(4) if "--coreprofile" in QCoreApplication.arguments(): fmt.setVersion(3, 2) fmt.setProfile(QSurfaceFormat.CoreProfile) QSurfaceFormat.setDefaultFormat(fmt) mainWindow = Window() if "--transparent" in QCoreApplication.arguments(): mainWindow.setAttribute(Qt.WA_TranslucentBackground) mainWindow.setAttribute(Qt.WA_NoSystemBackground, False) mainWindow.resize(mainWindow.sizeHint()) mainWindow.show() res = app.exec_()
def handle_object_created(obj, objUrl): if not obj and url == objUrl: QCoreApplication.exit(-1)
def _ok_clicked(self): self._ok_to_close = True self.cmdDo() self.bk.savePrefs(self.prefs) QCoreApplication.instance().quit()
def testTranslateWithNoneDisambiguation(self): value = 'String here' obj = QCoreApplication.translate('context', value, None, QCoreApplication.UnicodeUTF8) self.assertTrue(isinstance(obj, py3k.unicode)) self.assertEqual(obj, value)
def retranslateUi(self, Form): Form.setWindowTitle(QCoreApplication.translate("Form", u"Form", None))
def retranslateUi(self, Dialog): Dialog.setWindowTitle(QCoreApplication.translate("Dialog", u"Dialog", None)) self.German.setText(QCoreApplication.translate("Dialog", u"\u041d\u0435\u043c\u0435\u0446\u043a\u0438\u0439", None)) self.English.setText(QCoreApplication.translate("Dialog", u"\u0410\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u0438\u0439", None)) self.Russia.setText(QCoreApplication.translate("Dialog", u"\u0420\u0443\u0441\u0441\u043a\u0438\u0439", None)) self.Arbitrary.setText(QCoreApplication.translate("Dialog", u"\u0412\u0432\u0435\u0441\u0442\u0438 \u0441\u0432\u043e\u0439", None)) self.label.setText(QCoreApplication.translate("Dialog", u"2. \u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u0430\u043b\u0444\u0430\u0432\u0438\u0442", None)) self.label_2.setText(QCoreApplication.translate("Dialog", u"\u0428\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0438 \u0434\u0435\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438 \u0413\u0440\u043e\u043d\u0441\u0432\u0435\u043b\u044c\u0434\u0430/\u0426\u0435\u0437\u0430\u0440\u044f", None)) self.label_3.setText(QCoreApplication.translate("Dialog", u"3.\u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u0440\u0435\u0436\u0438\u043c \u0440\u0430\u0431\u043e\u0442\u044b", None)) self.encryption.setText(QCoreApplication.translate("Dialog", u"\u0428\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u0435", None)) self.decryption.setText(QCoreApplication.translate("Dialog", u"\u0414\u0435\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u0435", None)) self.label_4.setText(QCoreApplication.translate("Dialog", u"4.\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0438 \u043a\u043b\u044e\u0447", None)) self.label_5.setText(QCoreApplication.translate("Dialog", u"\u041a\u043b\u044e\u0447:", None)) self.label_6.setText(QCoreApplication.translate("Dialog", u"\u0421\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435:", None)) self.message_field.setText("") self.label_7.setText(QCoreApplication.translate("Dialog", u"\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:", None)) self.alphabet_field.setText("") self.pushButton.setText(QCoreApplication.translate("Dialog", u"\u0412\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c", None)) self.error_label.setText("") self.gronsfeld.setText(QCoreApplication.translate("Dialog", u"\u0413\u0440\u043e\u043d\u0441\u0432\u0435\u043b\u044c\u0434\u0430", None)) self.label_8.setText(QCoreApplication.translate("Dialog", u"1. \u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u043c\u0435\u0442\u043e\u0434 \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u044f", None)) self.caesar.setText(QCoreApplication.translate("Dialog", u"\u0426\u0435\u0437\u0430\u0440\u044f", None)) self.error_label_2.setText("") self.error_label_3.setText(QCoreApplication.translate("Dialog", u"", None))
def event_quit_callback(self, **kwargs): QCoreApplication.quit()
def retranslateUi(self, MainWindow): MainWindow.setWindowTitle(QCoreApplication.translate("MainWindow", u"PyChess", None)) self.groupBox_3.setTitle(QCoreApplication.translate("MainWindow", u"Black", None)) self.radioButton_black_human.setText(QCoreApplication.translate("MainWindow", u"Human", None)) self.radioButton_black_computer.setText(QCoreApplication.translate("MainWindow", u"Computer", None)) self.groupBox_2.setTitle(QCoreApplication.translate("MainWindow", u"White", None)) self.radioButton_white_human.setText(QCoreApplication.translate("MainWindow", u"Human", None)) self.radioButton_white_computer.setText(QCoreApplication.translate("MainWindow", u"Computer", None)) self.groupBox.setTitle(QCoreApplication.translate("MainWindow", u"Controls", None)) self.pushButton_flip.setText(QCoreApplication.translate("MainWindow", u"Flip sides", None)) self.pushButton_start.setText(QCoreApplication.translate("MainWindow", u"New Game", None)) self.pushButton_stop.setText(QCoreApplication.translate("MainWindow", u"Stop Game", None))
self.repaint() def reset(self) -> None: self.events = [] self.text = ' '.join([ choice(list(self.config['dictionary'])).lower() for _ in range(self.settings.value('wordsCount', 20)) ]) self.pointer = 0 def setupWindow(self) -> None: self.setWindowTitle('Typetific') self.setMinimumSize(1100, 620) self.setUnifiedTitleAndToolBarOnMac(True) self.setStyleSheet('background: {}; color: {};'.format( self.config['background_color'].name(), self.config['primary_color'].name())) if __name__ == '__main__': app = QApplication() window = TypingWindow() QCoreApplication.setApplicationName(window.windowTitle()) QCoreApplication.setOrganizationName('Breitburg Ilya') QCoreApplication.setOrganizationDomain('breitburg.com') window.show() app.exec_()
def eventFilter(self, editor, event): if event.type() == QEvent.FocusOut: super().eventFilter(editor, event) return QCoreApplication.sendEvent(self.parent(), event) return super().eventFilter(editor, event)
def retranslateUi(self, SignUp): SignUp.setWindowTitle( QCoreApplication.translate("SignUp", u"MainWindow", None)) self.buttonHome.setText( QCoreApplication.translate("SignUp", u"HH", None)) self.labelMenu.setText( QCoreApplication.translate("SignUp", u"\uc0ac\uc6a9\uc790 \ub4f1\ub85d", None)) self.labelHome.setText( QCoreApplication.translate("SignUp", u"\ud648", None)) self.labelName.setText( QCoreApplication.translate("SignUp", u"\uc774\ub984", None)) self.labelID.setText( QCoreApplication.translate("SignUp", u"\ud559\ubc88", None)) self.labelContact.setText( QCoreApplication.translate("SignUp", u"\uc804\ud654\ubc88\ud638", None)) self.buttonRegister.setText( QCoreApplication.translate("SignUp", u"\ub4f1\ub85d", None)) #if QT_CONFIG(whatsthis) self.editContact3.setWhatsThis( QCoreApplication.translate( "SignUp", u"<html><head/><body><p><br/></p></body></html>", None)) #endif // QT_CONFIG(whatsthis) self.buttonTemp.setText("") self.labelDash1.setText( QCoreApplication.translate("SignUp", u"-", None)) self.labelDash2.setText( QCoreApplication.translate("SignUp", u"-", None)) self.labelTemp.setText( QCoreApplication.translate( "SignUp", u"\uc784\uc2dc \ub4f1\ub85d\uc744 \ud558\ub824 \ud569\ub2c8\ub2e4.", None))
def retranslateUi(self, MainWindow): MainWindow.setWindowTitle(QCoreApplication.translate("MainWindow", u"RadioPicker", None)) self.dockWidget.setWindowTitle("")
def retranslateUi(self, ParameterValueEditor): ParameterValueEditor.setWindowTitle(QCoreApplication.translate("ParameterValueEditor", u"Edit parameter_value", None)) self.parameter_type_selector_label.setText(QCoreApplication.translate("ParameterValueEditor", u"Parameter type", None))
def retranslateUi(self, MainWindow): MainWindow.setWindowTitle(QCoreApplication.translate("MainWindow", u"MainWindow", None))
def retranslateUi(self, MainWindow): MainWindow.setWindowTitle(QCoreApplication.translate("MainWindow", u"MainWindow", None)) self.pushButton_2.setText(QCoreApplication.translate("MainWindow", u"POWR\u00d3T", None))
def retranslateUi(self, MainWindow): MainWindow.setWindowTitle(QCoreApplication.translate("MainWindow", u"MainWindow", None)) self.message_box.setPlaceholderText(QCoreApplication.translate("MainWindow", u"Connecting...", None)) self.pushButton.setText(QCoreApplication.translate("MainWindow", u"Send", None))
def retranslateUi(self, Dialog): Dialog.setWindowTitle( QCoreApplication.translate("Dialog", u"Dialog", None)) self.label.setText( QCoreApplication.translate("Dialog", u"LB Server", None)) self.label_2.setText( QCoreApplication.translate("Dialog", u"Standard-Login", None)) #if QT_CONFIG(tooltip) self.lineEdit_StdLogin.setToolTip( QCoreApplication.translate( "Dialog", u"Benutzername der Pr\u00fcfungskandidaten auf Client PC, sollte student sein", None)) #endif // QT_CONFIG(tooltip) self.lineEdit_StdLogin.setText( QCoreApplication.translate("Dialog", u"student", None)) self.label_9.setText( QCoreApplication.translate("Dialog", u"Online-Wiki", None)) self.lineEdit_OnlineWiki.setText( QCoreApplication.translate( "Dialog", u"https://github.com/greenorca/ECMan/wiki", None)) self.label_5.setText( QCoreApplication.translate("Dialog", u"WinRM-Port", None)) self.lineEdit_winRmPort.setText( QCoreApplication.translate("Dialog", u"5986", None)) self.label_3.setText( QCoreApplication.translate("Dialog", u"WinRM-Login", None)) #if QT_CONFIG(tooltip) self.lineEdit_winRmUser.setToolTip( QCoreApplication.translate( "Dialog", u"Benutzername f\u00fcr Remotezugriff (wie im Konfigskript f\u00fcr Client-PCs)", None)) #endif // QT_CONFIG(tooltip) self.lineEdit_winRmUser.setText( QCoreApplication.translate("Dialog", u"winrm", None)) self.label_4.setText( QCoreApplication.translate("Dialog", u"WinRM-Passwort", None)) #if QT_CONFIG(tooltip) self.lineEdit_winRmPwd.setToolTip( QCoreApplication.translate( "Dialog", u"Passwort f\u00fcr Remotezugriff (wie im Konfigskript f\u00fcr Client-PCs)", None)) #endif // QT_CONFIG(tooltip) self.lineEdit_winRmPwd.setText("") #if QT_CONFIG(tooltip) self.label_6.setToolTip( QCoreApplication.translate( "Dialog", u"Hier Limite f\u00fcr die maximale Dateigr\u00f6sse der L\u00f6sungsdaten setzen.", None)) #endif // QT_CONFIG(tooltip) self.label_6.setText( QCoreApplication.translate("Dialog", u"max. Dateigr\u00f6sse (MB)", None)) self.lineEdit_MaxFileSize.setText( QCoreApplication.translate("Dialog", u"1000", None)) #if QT_CONFIG(tooltip) self.label_7.setToolTip( QCoreApplication.translate( "Dialog", u"Hier Limite f\u00fcr die maximale Anzahl L\u00f6sungsdateien setzen.", None)) #endif // QT_CONFIG(tooltip) self.label_7.setText( QCoreApplication.translate("Dialog", u"max. Dateien", None)) self.lineEdit_MaxFiles.setText( QCoreApplication.translate("Dialog", u"1000", None)) self.label_8.setText( QCoreApplication.translate("Dialog", u"versteckte Dateien", None)) #if QT_CONFIG(tooltip) self.checkBox_HiddenFiles.setToolTip( QCoreApplication.translate( "Dialog", u"versteckte Dateien und Ordner (.*) werden derzeit ignoriert.", None)) #endif // QT_CONFIG(tooltip) self.checkBox_HiddenFiles.setText( QCoreApplication.translate("Dialog", u"ignorieren", None)) self.label_10.setText( QCoreApplication.translate("Dialog", u"Pr\u00fcfungsergebnisse abholen:", None)) self.label_11.setText( QCoreApplication.translate("Dialog", u"zus\u00e4tzliche Features", None)) self.checkBox_advancedFeatures.setText( QCoreApplication.translate("Dialog", u"aktivieren", None))
def g_tr(context, text): return QCoreApplication.translate(context, text)
def retranslateUi(self, Form): Form.setWindowTitle(QCoreApplication.translate("Form", u"Form", None)) self.title_lineEdit.setText(QCoreApplication.translate("Form", u"new node", None)) self.title_lineEdit.setPlaceholderText(QCoreApplication.translate("Form", u"Title", None)) self.name_problems_detected_label.setText(QCoreApplication.translate("Form", u"Name Problems Detected: None", None)) self.internal_name_lineEdit.setPlaceholderText(QCoreApplication.translate("Form", u"Internal Name", None)) self.use_title_as_internal_name_checkBox.setText(QCoreApplication.translate("Form", u"use title as intern name", None)) self.type_comboBox.setItemText(0, QCoreApplication.translate("Form", u"custom", None)) self.type_comboBox.setItemText(1, QCoreApplication.translate("Form", u"control structure", None)) self.type_comboBox.setCurrentText(QCoreApplication.translate("Form", u"custom", None)) self.custom_type_lineEdit.setPlaceholderText(QCoreApplication.translate("Form", u"Custom Type", None)) self.edit_node_metacode_pushButton.setText(QCoreApplication.translate("Form", u"edit node metacode", None)) self.description_textEdit.setPlaceholderText(QCoreApplication.translate("Form", u"Node Description", None)) self.input_widgets_groupBox.setTitle(QCoreApplication.translate("Form", u"Input Widgets", None)) self.add_new_input_widget_pushButton.setText(QCoreApplication.translate("Form", u"add new", None)) self.groupBox.setTitle(QCoreApplication.translate("Form", u"Main Widget", None)) self.main_widget_checkBox.setText(QCoreApplication.translate("Form", u"None", None)) self.main_widget_under_ports_radioButton.setText(QCoreApplication.translate("Form", u"main widget under ports", None)) self.main_widget_between_ports_radioButton.setText(QCoreApplication.translate("Form", u"main widget between ports", None)) self.edit_main_widget_metacode_pushButton.setText(QCoreApplication.translate("Form", u"edit metacode", None)) self.design_style_groupBox.setTitle(QCoreApplication.translate("Form", u"Design Style", None)) self.design_style_extended_radioButton.setText(QCoreApplication.translate("Form", u"Extended", None)) self.design_style_minimalistic_radioButton.setText(QCoreApplication.translate("Form", u"Minimalistic", None)) self.node_color_groupBox.setTitle(QCoreApplication.translate("Form", u"Node Color", None)) self.select_color_pushButton.setText(QCoreApplication.translate("Form", u"select color", None)) self.color_sample_pushButton.setText("") self.inputs_groupBox.setTitle(QCoreApplication.translate("Form", u"Inputs", None)) self.add_new_input_pushButton.setText(QCoreApplication.translate("Form", u"add new", None)) self.outputs_groupBox.setTitle(QCoreApplication.translate("Form", u"Outputs", None)) self.add_new_output_pushButton.setText(QCoreApplication.translate("Form", u"add new", None))
def __init__(self, node_set: NodeSet, system_tray): super().__init__() self.node_set = node_set self.system_tray = system_tray # Bitcoind self.bitcoind_status_action = self.addAction('bitcoind off') self.bitcoind_status_action.setEnabled(False) self.node_set.bitcoind_node.process.status.connect( lambda line: self.bitcoind_status_action.setText(line)) self.bitcoind_manager_tabs_dialog = BitcoindManagerTabsDialog( bitcoind_node=self.node_set.bitcoind_node, system_tray=self.system_tray) self.bitcoin_manage_action = self.addAction('Manage Bitcoind') self.bitcoin_manage_action.triggered.connect( self.bitcoind_manager_tabs_dialog.show) self.addSeparator() # LND self.lnd_status_action = self.addAction('lnd off') self.lnd_status_action.setEnabled(False) self.node_set.lnd_node.process.status.connect( lambda line: self.lnd_status_action.setText(line)) self.lnd_manager_tabs_dialog = LndManagerTabsDialog( lnd_node=self.node_set.lnd_node, system_tray=self.system_tray) self.lnd_manage_action = self.addAction('Manage LND') self.lnd_manage_action.triggered.connect( self.lnd_manager_tabs_dialog.show) self.addSeparator() # Joule self.joule_status_action = self.addAction('Joule Browser UI') self.joule_status_action.setEnabled(False) self.joule_url_action = self.addAction('Copy Node URL (REST)') self.joule_macaroons_action = self.addAction('Show Macaroons') self.joule_url_action.triggered.connect(self.copy_rest_url) self.joule_macaroons_action.triggered.connect( self.reveal_macaroon_path) self.addSeparator() # Zap self.zap_status_action = self.addAction('Zap Desktop UI') self.zap_status_action.setEnabled(False) self.zap_open_action = self.addAction('Open Zap Desktop') self.zap_open_action.triggered.connect( lambda: webbrowser.open(self.node_set.lnd_node.lndconnect_url)) self.zap_qr_code_label = ZapQrcodeLabel( configuration=self.node_set.lnd_node.configuration) self.show_zap_qrcode_action = self.addAction('Pair Zap Mobile') self.show_zap_qrcode_action.triggered.connect( self.zap_qr_code_label.show) self.addSeparator() # Quit self.quit_action = self.addAction('Quit') self.quit_action.triggered.connect(lambda _: QCoreApplication.exit(0))
def retranslateUi(self, Dialoge): Dialoge.setWindowTitle( QCoreApplication.translate("Dialoge", u"Translator", None)) self.comboBox.setItemText( 0, QCoreApplication.translate( "Dialoge", u"\u0410\u043b\u0431\u0430\u043d\u0441\u043a\u0438\u0439", None)) self.comboBox.setItemText( 1, QCoreApplication.translate( "Dialoge", u"\u0410\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u0438\u0439", None)) self.comboBox.setItemText( 2, QCoreApplication.translate( "Dialoge", u"\u0410\u0440\u0430\u0431\u0441\u043a\u0438\u0439", None)) self.comboBox.setItemText( 3, QCoreApplication.translate( "Dialoge", u"\u0410\u0440\u043c\u044f\u043d\u0441\u043a\u0438\u0439", None)) self.comboBox.setItemText( 4, QCoreApplication.translate( "Dialoge", u"\u0411\u0435\u043b\u043e\u0440\u0443\u0441\u0441\u043a\u0438\u0439", None)) self.comboBox.setItemText( 5, QCoreApplication.translate( "Dialoge", u"\u0411\u043e\u043b\u0433\u0430\u0440\u0441\u043a\u0438\u0439", None)) self.comboBox.setItemText( 6, QCoreApplication.translate( "Dialoge", u"\u0412\u0435\u043d\u0433\u0435\u0440\u0441\u043a\u0438\u0439", None)) self.comboBox.setItemText( 7, QCoreApplication.translate( "Dialoge", u"\u0412\u044c\u0435\u0442\u043d\u0430\u043c\u0441\u043a\u0438\u0439", None)) self.comboBox.setItemText( 8, QCoreApplication.translate( "Dialoge", u"\u0413\u0440\u0443\u0437\u0438\u043d\u0441\u043a\u0438\u0439", None)) self.comboBox.setItemText( 9, QCoreApplication.translate( "Dialoge", u"\u0418\u0441\u043f\u0430\u043d\u0441\u043a\u0438\u0439", None)) self.comboBox.setItemText( 10, QCoreApplication.translate( "Dialoge", u"\u0418\u0442\u0430\u043b\u044c\u044f\u043d\u0441\u043a\u0438\u0439", None)) self.comboBox.setItemText( 11, QCoreApplication.translate( "Dialoge", u"\u041a\u0438\u0442\u0430\u0439\u0441\u043a\u0438\u0439", None)) self.comboBox.setItemText( 12, QCoreApplication.translate( "Dialoge", u"\u041a\u043e\u0440\u0435\u0439\u0441\u043a\u0438\u0439", None)) self.comboBox.setItemText( 13, QCoreApplication.translate( "Dialoge", u"\u041d\u0435\u043c\u0435\u0446\u043a\u0438\u0439", None)) self.comboBox.setItemText( 14, QCoreApplication.translate( "Dialoge", u"\u041f\u043e\u0440\u0442\u0443\u0433\u0430\u043b\u044c\u0441\u043a\u0438\u0439", None)) self.comboBox.setItemText( 15, QCoreApplication.translate( "Dialoge", u"\u0420\u0443\u0441\u0441\u043a\u0438\u0439", None)) self.comboBox.setItemText( 16, QCoreApplication.translate( "Dialoge", u"\u0422\u0443\u0440\u0435\u0446\u043a\u0438\u0439", None)) self.comboBox.setItemText( 17, QCoreApplication.translate( "Dialoge", u"\u0423\u043a\u0440\u0430\u0438\u043d\u0441\u043a\u0438\u0439", None)) self.comboBox.setItemText( 18, QCoreApplication.translate( "Dialoge", u"\u0424\u0440\u0430\u043d\u0446\u0443\u0437\u043a\u0438\u0439", None)) self.comboBox.setItemText( 19, QCoreApplication.translate( "Dialoge", u"\u042f\u043f\u043e\u043d\u0441\u043a\u0438\u0439", None)) self.textEdit.setHtml( QCoreApplication.translate( "Dialoge", u"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n" "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n" "p, li { white-space: pre-wrap; }\n" "</style></head><body style=\" font-family:'Times New Roman'; font-size:12pt; font-weight:400; font-style:normal;\">\n" "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:'MS Shell Dlg 2'; font-size:10pt;\">\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0442\u0435\u043a\u0441\u0442</span></p></body></html>", None)) self.pushButton.setText( QCoreApplication.translate( "Dialoge", u"\u041f\u0435\u0440\u0435\u0432\u0435\u0441\u0442\u0438", None)) self.label_3.setText( QCoreApplication.translate( "Dialoge", u"\u041f\u0435\u0440\u0435\u0432\u0435\u0441\u0442\u0438 \u043d\u0430", None)) self.textBrowser.setHtml( QCoreApplication.translate( "Dialoge", u"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n" "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n" "p, li { white-space: pre-wrap; }\n" "</style></head><body style=\" font-family:'Times New Roman'; font-size:12pt; font-weight:400; font-style:normal;\">\n" "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:'MS Shell Dlg 2'; font-size:10pt;\">\u041f\u0435\u0440\u0435\u0432\u043e\u0434</span></p></body></html>", None)) self.label_2.setText( QCoreApplication.translate( "Dialoge", u"\u041f\u0435\u0440\u0435\u0432\u0435\u0441\u0442\u0438 \u0441", None)) self.comboBox_2.setItemText( 0, QCoreApplication.translate( "Dialoge", u"\u0410\u043b\u0431\u0430\u043d\u0441\u043a\u0438\u0439", None)) self.comboBox_2.setItemText( 1, QCoreApplication.translate( "Dialoge", u"\u0410\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u0438\u0439", None)) self.comboBox_2.setItemText( 2, QCoreApplication.translate( "Dialoge", u"\u0410\u0440\u0430\u0431\u0441\u043a\u0438\u0439", None)) self.comboBox_2.setItemText( 3, QCoreApplication.translate( "Dialoge", u"\u0410\u0440\u043c\u044f\u043d\u0441\u043a\u0438\u0439", None)) self.comboBox_2.setItemText( 4, QCoreApplication.translate( "Dialoge", u"\u0411\u0435\u043b\u043e\u0440\u0443\u0441\u0441\u043a\u0438\u0439", None)) self.comboBox_2.setItemText( 5, QCoreApplication.translate( "Dialoge", u"\u0411\u043e\u043b\u0433\u0430\u0440\u0441\u043a\u0438\u0439", None)) self.comboBox_2.setItemText( 6, QCoreApplication.translate( "Dialoge", u"\u0412\u0435\u043d\u0433\u0435\u0440\u0441\u043a\u0438\u0439", None)) self.comboBox_2.setItemText( 7, QCoreApplication.translate( "Dialoge", u"\u0412\u044c\u0435\u0442\u043d\u0430\u043c\u0441\u043a\u0438\u0439", None)) self.comboBox_2.setItemText( 8, QCoreApplication.translate( "Dialoge", u"\u0413\u0440\u0443\u0437\u0438\u043d\u0441\u043a\u0438\u0439", None)) self.comboBox_2.setItemText( 9, QCoreApplication.translate( "Dialoge", u"\u0418\u0441\u043f\u0430\u043d\u0441\u043a\u0438\u0439", None)) self.comboBox_2.setItemText( 10, QCoreApplication.translate( "Dialoge", u"\u0418\u0442\u0430\u043b\u044c\u044f\u043d\u0441\u043a\u0438\u0439", None)) self.comboBox_2.setItemText( 11, QCoreApplication.translate( "Dialoge", u"\u041a\u0438\u0442\u0430\u0439\u0441\u043a\u0438\u0439", None)) self.comboBox_2.setItemText( 12, QCoreApplication.translate( "Dialoge", u"\u041a\u043e\u0440\u0435\u0439\u0441\u043a\u0438\u0439", None)) self.comboBox_2.setItemText( 13, QCoreApplication.translate( "Dialoge", u"\u041d\u0435\u043c\u0435\u0446\u043a\u0438\u0439", None)) self.comboBox_2.setItemText( 14, QCoreApplication.translate( "Dialoge", u"\u041f\u043e\u0440\u0442\u0443\u0433\u0430\u043b\u044c\u0441\u043a\u0438\u0439", None)) self.comboBox_2.setItemText( 15, QCoreApplication.translate( "Dialoge", u"\u0420\u0443\u0441\u0441\u043a\u0438\u0439", None)) self.comboBox_2.setItemText( 16, QCoreApplication.translate( "Dialoge", u"\u0422\u0443\u0440\u0435\u0446\u043a\u0438\u0439", None)) self.comboBox_2.setItemText( 17, QCoreApplication.translate( "Dialoge", u"\u0423\u043a\u0440\u0430\u0438\u043d\u0441\u043a\u0438\u0439", None)) self.comboBox_2.setItemText( 18, QCoreApplication.translate( "Dialoge", u"\u0424\u0440\u0430\u043d\u0446\u0443\u0437\u043a\u0438\u0439", None)) self.comboBox_2.setItemText( 19, QCoreApplication.translate( "Dialoge", u"\u042f\u043f\u043e\u043d\u0441\u043a\u0438\u0439", None))
def retranslateUi(self, Form): Form.setWindowTitle( QCoreApplication.translate("Form", u"MAC Table", None)) self.grboxSave.setTitle( QCoreApplication.translate("Form", u"View Table", None)) self.btSave.setText( QCoreApplication.translate("Form", u"Save to File...", None)) self.btSelTgl.setText( QCoreApplication.translate("Form", u"Select / Unselect All", None)) self.gbxDevice.setTitle( QCoreApplication.translate("Form", u"Device Table", None)) self.btRead.setText(QCoreApplication.translate("Form", u"Read", None)) self.btDelSelected.setText( QCoreApplication.translate("Form", u"Delete Selected", None)) self.grBoxTableRd.setTitle( QCoreApplication.translate("Form", u"Table", None)) ___qtablewidgetitem = self.tblTableRd.horizontalHeaderItem(0) ___qtablewidgetitem.setText( QCoreApplication.translate("Form", u"sel", None)) ___qtablewidgetitem1 = self.tblTableRd.horizontalHeaderItem(1) ___qtablewidgetitem1.setText( QCoreApplication.translate("Form", u"VLAN_ID", None)) ___qtablewidgetitem2 = self.tblTableRd.horizontalHeaderItem(2) ___qtablewidgetitem2.setText( QCoreApplication.translate("Form", u"MAC", None)) ___qtablewidgetitem3 = self.tblTableRd.horizontalHeaderItem(3) ___qtablewidgetitem3.setText( QCoreApplication.translate("Form", u"isFresh", None)) ___qtablewidgetitem4 = self.tblTableRd.horizontalHeaderItem(4) ___qtablewidgetitem4.setText( QCoreApplication.translate("Form", u"isStatic", None)) ___qtablewidgetitem5 = self.tblTableRd.horizontalHeaderItem(5) ___qtablewidgetitem5.setText( QCoreApplication.translate("Form", u"TC", None)) ___qtablewidgetitem6 = self.tblTableRd.horizontalHeaderItem(6) ___qtablewidgetitem6.setText( QCoreApplication.translate("Form", u"ForwPorts", None)) ___qtablewidgetitem7 = self.tblTableRd.horizontalHeaderItem(7) ___qtablewidgetitem7.setText( QCoreApplication.translate("Form", u"Action", None)) self.grbxAddItem.setTitle( QCoreApplication.translate("Form", u"Add Items", None)) ___qtablewidgetitem8 = self.tblCtrl.horizontalHeaderItem(0) ___qtablewidgetitem8.setText( QCoreApplication.translate("Form", u" VLAN_ID ", None)) ___qtablewidgetitem9 = self.tblCtrl.horizontalHeaderItem(1) ___qtablewidgetitem9.setText( QCoreApplication.translate("Form", u"MAC", None)) ___qtablewidgetitem10 = self.tblCtrl.horizontalHeaderItem(2) ___qtablewidgetitem10.setText( QCoreApplication.translate("Form", u" isStatis ", None)) ___qtablewidgetitem11 = self.tblCtrl.horizontalHeaderItem(3) ___qtablewidgetitem11.setText( QCoreApplication.translate("Form", u"Action", None)) ___qtablewidgetitem12 = self.tblCtrl.horizontalHeaderItem(4) ___qtablewidgetitem12.setText( QCoreApplication.translate("Form", u" TC ", None)) ___qtablewidgetitem13 = self.tblCtrl.horizontalHeaderItem(5) ___qtablewidgetitem13.setText( QCoreApplication.translate("Form", u"ForwPorts", None)) ___qtablewidgetitem14 = self.tblCtrl.horizontalHeaderItem(6) ___qtablewidgetitem14.setText( QCoreApplication.translate("Form", u"Apply", None))
def retranslateUi(self, MainWindow): MainWindow.setWindowTitle( QCoreApplication.translate("MainWindow", u"MainWindow", None)) self.menu_help_help.setText( QCoreApplication.translate("MainWindow", u"N\u00e1pov\u011bda programu", None)) #if QT_CONFIG(tooltip) self.menu_help_help.setToolTip( QCoreApplication.translate( "MainWindow", u"Zobraz\u00ed n\u00e1pov\u011bdu programu.", None)) #endif // QT_CONFIG(tooltip) #if QT_CONFIG(statustip) self.menu_help_help.setStatusTip( QCoreApplication.translate( "MainWindow", u"Zobraz\u00ed n\u00e1pov\u011bdu programu.", None)) #endif // QT_CONFIG(statustip) #if QT_CONFIG(shortcut) self.menu_help_help.setShortcut( QCoreApplication.translate("MainWindow", u"F1", None)) #endif // QT_CONFIG(shortcut) self.menu_help_about.setText( QCoreApplication.translate("MainWindow", u"O projektu", None)) #if QT_CONFIG(tooltip) self.menu_help_about.setToolTip( QCoreApplication.translate( "MainWindow", u"Zobraz\u00ed v\u00edce informac\u00ed o projektu.", None)) #endif // QT_CONFIG(tooltip) #if QT_CONFIG(statustip) self.menu_help_about.setStatusTip( QCoreApplication.translate( "MainWindow", u"Zobraz\u00ed v\u00edce informac\u00ed o projektu.", None)) #endif // QT_CONFIG(statustip) self.menu_tools_reduce.setText( QCoreApplication.translate("MainWindow", u"Fejka\u0159 Otto", None)) #if QT_CONFIG(tooltip) self.menu_tools_reduce.setToolTip( QCoreApplication.translate( "MainWindow", u"N\u00e1stroj pro zjednodu\u0161en\u00ed datab\u00e1ze.", None)) #endif // QT_CONFIG(tooltip) #if QT_CONFIG(statustip) self.menu_tools_reduce.setStatusTip( QCoreApplication.translate( "MainWindow", u"Sjednot\u00ed p\u0159isp\u011bvatele co maj\u00e9 m\u00e9n\u011b ne\u017e 50 zpr\u00e1v a chaty co maj\u00ed m\u00e9n\u011b ne\u017e 100 zpr\u00e1v.", None)) #endif // QT_CONFIG(statustip) self.menu_tools_clean.setText( QCoreApplication.translate("MainWindow", u"Vymazat", None)) #if QT_CONFIG(tooltip) self.menu_tools_clean.setToolTip( QCoreApplication.translate( "MainWindow", u"Sma\u017ee v\u0161echna na\u010dten\u00e1 data.", None)) #endif // QT_CONFIG(tooltip) #if QT_CONFIG(statustip) self.menu_tools_clean.setStatusTip( QCoreApplication.translate( "MainWindow", u"Sma\u017ee v\u0161echna na\u010dten\u00e1 data.", None)) #endif // QT_CONFIG(statustip) self.menu_file_open.setText( QCoreApplication.translate("MainWindow", u"Otev\u0159\u00edt", None)) #if QT_CONFIG(tooltip) self.menu_file_open.setToolTip( QCoreApplication.translate( "MainWindow", u"Otev\u0159\u00edt soubor JSON s daty o va\u0161ich konverzac\u00edch.", None)) #endif // QT_CONFIG(tooltip) #if QT_CONFIG(statustip) self.menu_file_open.setStatusTip( QCoreApplication.translate( "MainWindow", u"Otev\u0159\u00edt soubor JSON s daty o va\u0161ich konverzac\u00edch.", None)) #endif // QT_CONFIG(statustip) #if QT_CONFIG(shortcut) self.menu_file_open.setShortcut( QCoreApplication.translate("MainWindow", u"Ctrl+O", None)) #endif // QT_CONFIG(shortcut) self.tabwidget.setTabText( self.tabwidget.indexOf(self.tab_chats), QCoreApplication.translate("MainWindow", u"Chaty", None)) self.tabwidget.setTabText( self.tabwidget.indexOf(self.tab_participants), QCoreApplication.translate("MainWindow", u"\u00da\u010dastn\u00edci", None)) self.tabwidget.setTabText( self.tabwidget.indexOf(self.tab_more), QCoreApplication.translate("MainWindow", u"V\u00edce", None)) self.group_who.setTitle( QCoreApplication.translate("MainWindow", u"Kdo poskytene data?", None)) self.radio_button_who_all.setText( QCoreApplication.translate( "MainWindow", u"V\u0161ichni \u00fa\u010dastn\u00edci", None)) self.radio_button_who_one.setText( QCoreApplication.translate("MainWindow", u"J\u00e1", None)) #if QT_CONFIG(tooltip) self.line_edit_participant.setToolTip( QCoreApplication.translate( "MainWindow", u"\u00da\u010dastn\u00edku, zadejte sv\u00e9 jm\u00e9no.", None)) #endif // QT_CONFIG(tooltip) #if QT_CONFIG(statustip) self.line_edit_participant.setStatusTip( QCoreApplication.translate("MainWindow", u"Zadejte sv\u00e9m jm\u00e9no.", None)) #endif // QT_CONFIG(statustip) self.group_date.setTitle( QCoreApplication.translate("MainWindow", u"\u010casov\u011b omezit data?", None)) self.radio_button_date_no.setText( QCoreApplication.translate("MainWindow", u"Ne", None)) self.radio_button_date_yes.setText( QCoreApplication.translate("MainWindow", u"Ano", None)) self.checkbox_from.setText( QCoreApplication.translate("MainWindow", u"Od", None)) self.date_from.setDisplayFormat( QCoreApplication.translate("MainWindow", u"dd.MM.yyyy", None)) self.checkbox_to.setText( QCoreApplication.translate("MainWindow", u"Do", None)) self.date_to.setDisplayFormat( QCoreApplication.translate("MainWindow", u"dd.MM.yyyy", None)) self.groupbox_select.setTitle( QCoreApplication.translate("MainWindow", u"Pomocn\u00edk s v\u00fdb\u011bry.", None)) self.btn_select_all.setText( QCoreApplication.translate("MainWindow", u"Onzna\u010dit v\u0161e", None)) #if QT_CONFIG(statustip) self.btn_deselect_all.setStatusTip( QCoreApplication.translate( "MainWindow", u"Zru\u0161\u00ed aktu\u00e1ln\u00ed v\u00fdb\u011br.", None)) #endif // QT_CONFIG(statustip) self.btn_deselect_all.setText( QCoreApplication.translate("MainWindow", u"Odzna\u010dit v\u0161e", None)) self.group_export.setTitle( QCoreApplication.translate( "MainWindow", u"P\u0159isp\u011bte na olt\u00e1\u0159 v\u011bdy.", None)) #if QT_CONFIG(statustip) self.checkbox_export_format.setStatusTip( QCoreApplication.translate( "MainWindow", u"Pokud je tato volba aktivn\u00ed, tak v\u00fdsledn\u00e9 soubory budou rozd\u011bleny dle chat\u016f.", None)) #endif // QT_CONFIG(statustip) self.checkbox_export_format.setText( QCoreApplication.translate("MainWindow", u"Rozd\u011blit na chaty", None)) #if QT_CONFIG(statustip) self.btn_export.setStatusTip( QCoreApplication.translate("MainWindow", u"Vegeneruje data pro korpus.", None)) #endif // QT_CONFIG(statustip) self.btn_export.setText( QCoreApplication.translate("MainWindow", u"Exportovat", None)) self.menu_file.setTitle( QCoreApplication.translate("MainWindow", u"Soubor", None)) self.menu_help.setTitle( QCoreApplication.translate("MainWindow", u"N\u00e1pov\u011bda", None)) self.menu_tools.setTitle( QCoreApplication.translate("MainWindow", u"N\u00e1stroje", None))
Lendo arquivo de interface XML QMainWindow. """ import sys from PySide2.QtCore import QCoreApplication, Qt, QDir from PySide2.QtUiTools import QUiLoader from PySide2.QtWidgets import QApplication, QMainWindow class MainWindow(QMainWindow): def __init__(self): super(MainWindow, self).__init__() # Caminho até o arquivo de interface. # path = QDir(__file__).currentPath() # ui_file = QDir(path).filePath('MainWindow.ui') ui_file = QDir(QDir(__file__).currentPath()).filePath('MainWindow.ui') self.ui = QUiLoader().load(ui_file, None) self.ui.show() if __name__ == "__main__": # Para evitar o alerta: # `Qt WebEngine seems to be initialized from a plugin`. QCoreApplication.setAttribute(Qt.AA_ShareOpenGLContexts) app = QApplication(sys.argv) window = MainWindow() sys.exit(app.exec_())
def handle_object_created(obj, obj_url): if obj is None and url == obj_url: QCoreApplication.exit(-1)
def __init__(self, soundfile, parent): self.soundfile = soundfile self.isplaying = False self.time = 0 # current audio position in frames self.audio = QMediaPlayer() self.decoder = QAudioDecoder() self.is_loaded = False self.volume = 100 self.isplaying = False self.decoded_audio = {} self.only_samples = [] self.decoding_is_finished = False self.max_bits = 32768 # File Loading is Asynchronous, so we need to be creative here, doesn't need to be duration but it works self.audio.durationChanged.connect(self.on_durationChanged) #self.decoder.finished.connect(self.decode_finished_signal) self.audio.setMedia(QUrl.fromLocalFile(soundfile)) #self.decoder.setSourceFilename(soundfile) # strangely inconsistent file-handling # It will hang here forever if we don't process the events. while not self.is_loaded: QCoreApplication.processEvents() time.sleep(0.1) #self.decode_audio() #self.np_data = np.array(self.only_samples) #self.np_data = np.abs(self.np_data / self.max_bits) # A simple normalisation, with this the samples should all be between 0 and 1 # for i in self.decoded_audio.items(): # self.only_samples.extend(i[1][0]) # t = [] # for i in self.only_samples: # if i != []: # t.append(i + -(min(self.only_samples))) # # t2 = [] # for i in t: # t2.append(i / max(t)) # self.only_samples = t2 #print(len(self.only_samples)) #print(self.max_bits) self.isvalid = True self.pydubfile = None if AudioSegment: if which("ffmpeg") is not None: AudioSegment.converter = which("ffmpeg") elif which("avconv") is not None: AudioSegment.converter = which("avconv") else: if platform.system() == "Windows": AudioSegment.converter = os.path.join(get_main_dir(), "ffmpeg.exe") #AudioSegment.converter = os.path.dirname(os.path.realpath(__file__)) + "\\ffmpeg.exe" else: # TODO: Check if we have ffmpeg or avconv installed AudioSegment.converter = "ffmpeg" try: if AudioSegment: print(self.soundfile) self.pydubfile = AudioSegment.from_file(self.soundfile, format=os.path.splitext(self.soundfile)[1][1:]) else: self.wave_reference = wave.open(self.soundfile) self.isvalid = True except: traceback.print_exc() self.wave_reference = None self.isvalid = False
def testQCoreApplicationInstance(self): #Tests QCoreApplication.instance() self.assertEqual(QCoreApplication.instance(), None) app = QCoreApplication([]) self.assertEqual(QCoreApplication.instance(), app)
def setUp(self): #Create fixtures self.app = QCoreApplication([])
def retranslateUi(self, MainWindow): MainWindow.setWindowTitle( QCoreApplication.translate("MainWindow", u"MainWindow", None)) self.pushButton_2.setText( QCoreApplication.translate("MainWindow", u"POWR\u00d3T", None)) self.pushButton_3.setText( QCoreApplication.translate("MainWindow", u"USU\u0143", None)) self.label_3.setText( QCoreApplication.translate("MainWindow", u"NAZWISKO", None)) self.label_5.setText( QCoreApplication.translate("MainWindow", u"NUMER TELEFONU", None)) self.label_6.setText( QCoreApplication.translate("MainWindow", u"STANOWISKO", None)) self.label_4.setText( QCoreApplication.translate("MainWindow", u"E-MAIL", None)) self.label_2.setText( QCoreApplication.translate("MainWindow", u"IMI\u0118", None)) self.label.setText( QCoreApplication.translate("MainWindow", u"ID", None)) self.pushButton_5.setText( QCoreApplication.translate("MainWindow", u"EDYTUJ", None)) self.pushButton_4.setText( QCoreApplication.translate("MainWindow", u"DODAJ", None)) self.textEdit_2.setHtml( QCoreApplication.translate( "MainWindow", u"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n" "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n" "p, li { white-space: pre-wrap; }\n" "</style></head><body style=\" font-family:'MS Shell Dlg 2'; font-size:9.75pt; font-weight:400; font-style:normal;\">\n" "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:8pt; font-weight:600;\">INSTRUKCJA:</span></p>\n" "<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt; font-weight:600;\"><br /></p>\n" "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:8pt; color:#00ff48;\">DODAWANIE</span><span style=\" font-size:8pt;\"> - wype\u0142nij IMI\u0118, NAZWISKO, E-MAIL, ADRES, STANOWISKO</span></p>\n" "" "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:8pt; color:#0000ff;\">EDYTOWANIE</span><span style=\" font-size:8pt;\"> - wype\u0142nij WSZYSTKO</span></p>\n" "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:8pt; color:#ff0000;\">USUWANIE</span><span style=\" font-size:8pt;\"> - wype\u0142nij ID</span></p></body></html>", None)) self.label_9.setText( QCoreApplication.translate("MainWindow", u"PANEL ZARZ\u0104DZANIA PRACOWNIKAMI", None))
def setTitle(self): p = ' - ' + os.path.basename(self.path) if self.path else '' self.setWindowTitle(QCoreApplication.applicationName() + ' ' + QCoreApplication.applicationVersion() + p)
def sendkeys(self, char, modifier=Qt.NoModifier): event = QKeyEvent(QEvent.KeyPress, char, modifier) QCoreApplication.postEvent(self.gameWidget, event)
def testMockQCoreApplication(self): mock = Mock() setattr(QCoreApplication, 'instance', mock) QCoreApplication.instance() self.assert_(mock.called)
def retranslateUi(self, MainWindow): MainWindow.setWindowTitle( QCoreApplication.translate("MainWindow", u"MainWindow", None)) self.actionImport_Nodes.setText( QCoreApplication.translate("MainWindow", u"Import Nodes", None)) self.actionSave_Project.setText( QCoreApplication.translate("MainWindow", u"Save Project", None)) self.actionDesignDark_Std.setText( QCoreApplication.translate("MainWindow", u"Dark Std", None)) self.actionDesignDark_Tron.setText( QCoreApplication.translate("MainWindow", u"Dark Tron", None)) self.actionEnableDebugging.setText( QCoreApplication.translate("MainWindow", u"Enable", None)) self.actionDisableDebugging.setText( QCoreApplication.translate("MainWindow", u"Disable", None)) self.actionSave_Pic_Viewport.setText( QCoreApplication.translate("MainWindow", u"Save Pic - Viewport", None)) #if QT_CONFIG(tooltip) self.actionSave_Pic_Viewport.setToolTip( QCoreApplication.translate( "MainWindow", u"Save a picture of the current scene's viewport.\n" "This will save exactly what you see in the same resolution.", None)) #endif // QT_CONFIG(tooltip) self.actionSave_Pic_Whole_Scene_scaled.setText( QCoreApplication.translate("MainWindow", u"Save Pic - Whole Scene (scaled)", None)) #if QT_CONFIG(tooltip) self.actionSave_Pic_Whole_Scene_scaled.setToolTip( QCoreApplication.translate( "MainWindow", u"Saves a picture of the whole current scene. \n" "The more you zoomed in, the sharper the picture.\n" "This will take a few seconds.", None)) #endif // QT_CONFIG(tooltip) self.scripts_groupBox.setTitle( QCoreApplication.translate("MainWindow", u"Scripts", None)) self.new_script_name_lineEdit.setPlaceholderText( QCoreApplication.translate("MainWindow", u"script title", None)) self.add_new_script_pushButton.setText( QCoreApplication.translate("MainWindow", u"add new", None)) self.scripts_tab_widget.setTabText( self.scripts_tab_widget.indexOf(self.tab), QCoreApplication.translate("MainWindow", u"Main", None)) self.menuFile.setTitle( QCoreApplication.translate("MainWindow", u"File", None)) self.menuView.setTitle( QCoreApplication.translate("MainWindow", u"View", None)) self.menuFlow_Design_Style.setTitle( QCoreApplication.translate("MainWindow", u"Flow Theme", None)) self.menuSave_Picture.setTitle( QCoreApplication.translate("MainWindow", u"Save Picture", None)) self.menuDebugging.setTitle( QCoreApplication.translate("MainWindow", u"Debugging", None)) self.menuDebugging_Messages.setTitle( QCoreApplication.translate("MainWindow", u"Debugging Messages", None))
def retranslateassignment2Ui(self, diabatese): diabatese.setWindowTitle( QCoreApplication.translate("diabatese", u"Asiignment2", None)) self.actionexit.setText( QCoreApplication.translate("diabatese", u"exit", None)) self.actiondid_not_finish_lol.setText( QCoreApplication.translate("diabatese", u"did not finish lol", None)) self.label_selectfile.setText( QCoreApplication.translate("diabatese", u"Select Diabates .csv fileloc", None)) self.pushButton_selectdiabatese.setText( QCoreApplication.translate("diabatese", u"Select file", None)) self.radioButton_useANN.setText( QCoreApplication.translate("diabatese", u"Use ANN (needs more tuning)", None)) self.label_enter.setText( QCoreApplication.translate("diabatese", u"Enter values", None)) self.label_listentry.setText( QCoreApplication.translate( "diabatese", u"Pregnant insulin bmi age glucose bp pedigree", None)) self.checkBox_dt.setText( QCoreApplication.translate( "diabatese", u"Set criterion=\"entropy\" and max_depth=3 in dt model", None)) self.label.setText( QCoreApplication.translate("diabatese", u"Result", None)) self.pushButton_back.setText( QCoreApplication.translate("diabatese", u"Back", None)) self.menufile.setTitle( QCoreApplication.translate("diabatese", u"file", None))
def retranslateUi(self, DescomplicadaMente): DescomplicadaMente.setWindowTitle(QCoreApplication.translate("DescomplicadaMente", u"Descomplicada Mente", None)) self.btnHome.setText(QCoreApplication.translate("DescomplicadaMente", u"Home", None)) self.btnBiblioteca.setText(QCoreApplication.translate("DescomplicadaMente", u"Biblioteca", None)) self.btnConteudos.setText(QCoreApplication.translate("DescomplicadaMente", u"Conte\u00fados", None)) self.btnEmocoes.setText(QCoreApplication.translate("DescomplicadaMente", u"Emo\u00e7\u00f5es", None)) self.btnLogout.setText(QCoreApplication.translate("DescomplicadaMente", u"Sair", None)) self.btnRaiva.setText(QCoreApplication.translate("DescomplicadaMente", u"Raiva", None)) self.btnTristeza.setText(QCoreApplication.translate("DescomplicadaMente", u"Tristeza", None)) self.btnDesespero.setText(QCoreApplication.translate("DescomplicadaMente", u"Desespero", None)) self.btnFilmes.setText(QCoreApplication.translate("DescomplicadaMente", u"Filmes", None)) self.btnArtigos.setText(QCoreApplication.translate("DescomplicadaMente", u"Artigos", None)) self.btnLivros.setText(QCoreApplication.translate("DescomplicadaMente", u"Livros", None)) self.btnCanais.setText(QCoreApplication.translate("DescomplicadaMente", u"Canais", None)) self.btnNotifica.setText("") self.btnPesquisar.setText(QCoreApplication.translate("DescomplicadaMente", u"Pesquisar", None)) self.lnEmail.setPlaceholderText(QCoreApplication.translate("DescomplicadaMente", u"Email", None)) self.lnSenha.setPlaceholderText(QCoreApplication.translate("DescomplicadaMente", u"Senha", None)) self.btnEntrar.setText(QCoreApplication.translate("DescomplicadaMente", u"Entrar", None))
def sendKbdEvent(self): ev = QKeyEvent(QEvent.KeyPress, Qt.Key_A, Qt.NoModifier, 'a') QCoreApplication.sendEvent(self.box, ev)
def run(self): for i in range(3): e=MyEvent(i); QCoreApplication.postEvent(self.owner,e)