def on_PB_goBack_clicked(self): self.close() self.sensorValveProgramWindow = QtWidgets.QMainWindow() self.uiMainWindow = mainWindow.Ui_MainWindow() self.uiMainWindow.setupUi(self.sensorValveProgramWindow, self.db, self.actualRoomIndex) self.sensorValveProgramWindow.showMaximized()
def __init__(self): QMainWindow.__init__(self) self.ui = mainWindow.Ui_MainWindow() self.ui.setupUi(self) self.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) # 创建QMenu信号事件 self.customContextMenuRequested.connect(self.showMenu)
def Login(self): username = self.userName.text() password = self.password.text() if username == "" or password == "": messageWin.pop_up_window(messages.errorTitle, messages.emptyFieldError) else: if username == res.vars.adminID and password == res.vars.adminPass: self.ui = mainWindow.Ui_MainWindow() self.ui.setupUi(self.MainWindow) self.MainWindow.show() else: query = "SELECT CLASSES, COORDINATED_CLASSES FROM TEACHERS WHERE ID='{0}' AND PASSWORD='******'".format( username, password) cur.execute(query) data = cur.fetchone() if data is None: messageWin.pop_up_window(messages.SQLErrorTitle, messages.noUserFound) else: classes = data[0].split(',') coordClasses = data[1].split(',') count = 0 branch = [] year = [] section = [] b = y = s = "" for doc in classes: b = y = s = "" doc = doc.strip() count = 0 for i in range(len(doc)): if doc[i] == '-': count += 1 elif count == 0: b += doc[i] elif count == 1: y += doc[i] elif count == 2: s += doc[i] branch.append(b) year.append(y) section.append(s) self.ui = selectClass.Ui_Dialog( self.removeDuplicate(branch), self.removeDuplicate(year), self.removeDuplicate(section)) self.ui.setupUi(self.Dialog) self.Dialog.show()
def main(): def myExitHandler(): controller.peer.client_peer.kill() controller.peer.server_peer.kill() controller.peer.play_input.kill() sys.exit(0) app = QtWidgets.QApplication(sys.argv) room_window = QtWidgets.QMainWindow() main_window = QtWidgets.QMainWindow() game_over_window = QtWidgets.QMainWindow() room_ui = room.Ui_Dialog() ui = mainWindow.Ui_MainWindow() game_over_ui = gameOver.Ui_Dialog() controller = Controller(ui, room_ui, game_over_ui) room_ui.setupUi(room_window, controller) ui.setupUi(main_window, controller) game_over_ui.setupUi(game_over_window, controller) room_window.show() app.aboutToQuit.connect(myExitHandler) sys.exit(app.exec_())
def __init__(self): super(TestWindow, self).__init__() self.MainWindow = QtWidgets.QMainWindow() self.MainWindow.setStyleSheet(open('test.qss').read()) self.MainWindow.showMaximized() self.ui = mainWindow.Ui_MainWindow() self.ui.setupUi(self.MainWindow) self.statsWidget = QtWidgets.QWidget() self.statsWidget_obj = mainWidgetWrapper() self.statsWidget_obj.setupUi(self.statsWidget) self.ui.appWidgets.addWidget(self.statsWidget) # self.ui.appWidgets.setCurrentIndex(0) self.statsWidget_obj.back.clicked.connect(self.exitStats) self.ui.kawhiButton.clicked.connect( lambda: self.ui.appWidgets.setCurrentIndex(1)) self.statsWidget_obj.Settings.clicked.connect(self.switchControl) mqtt_client.record_widget = self.statsWidget_obj.record_widget #Recording Buttons self.statsWidget_obj.record_widget.startRecord.clicked.connect( lambda: (mqtt_client.setWriteToFile( True, self.statsWidget_obj.record_widget.CSV_output.toPlainText()))) self.statsWidget_obj.record_widget.stopRecord.clicked.connect( lambda: (mqtt_client.setWriteToFile(False, ""))) #Stats LCD screens self.statsWidget_obj.pStats_widget.NumSteps.display(self.numSteps) self.statsWidget_obj.pStats_widget.NumRun.display(self.numRun) self.statsWidget_obj.pStats_widget.NumWalk.display(self.numWalk) self.statsWidget_obj.pStats_widget.NumSprint.display(self.numSprint) self.statsWidget_obj.pStats_widget.jumpHeight.display( self.maxJumpHeight) self.statsWidget_obj.pStats_widget.NumJumps.display(self.numJumps)
def on_PB_goBack_clicked(self): self.close() self.settingsWindow = QtWidgets.QMainWindow() self.uiMainWindow = mainWindow.Ui_MainWindow() self.uiMainWindow.setupUi(self.settingsWindow, self.db, 0) self.settingsWindow.showMaximized()
def setTime(ui,gameObj): # 显示用时 gameObj.time = gameObj.time + 1 ui.timer.setText('用时 '+str(gameObj.time)) if __name__ == '__main__': # try: # subprocess.call('pyuic5 -o ./mainWindow.py ./mainWindow.ui') # subprocess.call('pyuic5 -o ./settingWindow.py ./settingWindow.ui') # except BaseException: # print("UI升级失败!") app = QApplication(sys.argv) # 创建主窗口对象 MainWindow = QMainWindow() ui = mainWindow.Ui_MainWindow() ui.setupUi(MainWindow) # 创建设置窗口对象 Dialog = QDialog() setting = settingWindow.Ui_Dialog() setting.setupUi(Dialog) MainWindow.show() gameObj = gameClass.game(ui,setting,app) timer = QTimer() timer.timeout.connect(partial(setTime,ui,gameObj)) # 计时结束调用operate()方法 timer.start(1000) # 设置计时间隔并启动 listener(ui,setting,gameObj) sys.exit(app.exec_())
def __init__(self, parent=None, app=None, musicbase=None, player=None, translator=None): QtWidgets.QMainWindow.__init__(self, parent) self.app = app self.translator = translator self.musicBase = musicbase self.player = player self.settings = QtCore.QSettings('pyzik', 'pyzik') self.firstShow = True self.playList = None self.currentArtist = artist("", 0) self.currentAlbum = album("") self.coverPixmap = QtGui.QPixmap() self.defaultPixmap = QtGui.QPixmap() self.ui = mainWindow.Ui_MainWindow() self.ui.setupUi(self) self.setTitleLabel("") self.setWindowTitle("PyZik") self.initAlbumTableWidget() self.initTrackTableWidget() self.showArtists() self.loadSettings() #Connect UI triggers self.ui.listViewArtists.selectionModel().currentChanged.connect( self.onArtistChange) self.ui.actionMusic_directories.triggered.connect( self.onMenuMusicDirectories) self.ui.actionExplore_music_directories.triggered.connect( self.onMenuExplore) self.ui.actionRandom_album.triggered.connect(self.ramdomAlbum) self.ui.actionDelete_database.triggered.connect( self.onMenuDeleteDatabase) self.ui.actionFuzzyGroovy.triggered.connect(self.onPlayFuzzyGroovy) self.ui.actionPlaylist.triggered.connect(self.showPlaylist) self.ui.actionLanguageSpanish.triggered.connect( functools.partial(self.changeLanguage, 'es')) self.ui.actionLanguageFrench.triggered.connect( functools.partial(self.changeLanguage, 'fr')) self.ui.actionLanguageEnglish.triggered.connect( functools.partial(self.changeLanguage, 'en')) self.ui.playButton.clicked.connect(self.onPlayAlbum) self.ui.addAlbumButton.clicked.connect(self.onAddAlbum) self.ui.pauseButton.clicked.connect(self.onPauseAlbum) #self.ui.nextButton.clicked.connect(self.player.mediaListPlayer.next) self.ui.openDirButton.clicked.connect(self.onOpenDir) #self.ui.previousButton.clicked.connect(self.player.mediaListPlayer.previous) self.ui.searchEdit.textChanged.connect(self.onSearchChange) self.ui.searchEdit.returnPressed.connect(self.onSearchEnter) self.ui.tableWidgetAlbums.selectionModel().currentRowChanged.connect( self.onAlbumChange) self.ui.tableWidgetAlbums.customContextMenuRequested.connect( self.handleHeaderMenu) self.shortcutRandomAlbum = QtWidgets.QShortcut( QtGui.QKeySequence("Ctrl+R"), self) self.shortcutRandomAlbum.activated.connect(self.ramdomAlbum) #Connect VLC triggers self.player.mpEnventManager.event_attach( vlc.EventType.MediaPlayerMediaChanged, self.onPlayerMediaChangedVLC) self.player.mpEnventManager.event_attach( vlc.EventType.MediaPlayerPaused, self.paused) self.player.mpEnventManager.event_attach( vlc.EventType.MediaPlayerPlaying, self.isPlaying) #self.player.mpEnventManager.event_attach(vlc.EventType.MediaPlayerPositionChanged, self.onPlayerPositionChanged) #self.player.mpEnventManager.event_attach(vlc.EventType.MediaPlayerAudioVolume , self.setVolumeSliderFromPlayer) self.ui.volumeSlider.setMaximum(100) self.ui.volumeSlider.setValue(self.volume) self.player.setVolume(self.volume) self.ui.volumeSlider.valueChanged.connect(self.setVolume) #Write message in status bar self.ui.statusBar.showMessage("PyZik") self.threadStreamObserver = streamObserver() self.threadStreamObserver.player = self.player self.threadStreamObserver.titleChanged.connect(self.setStatus) self.player.mpEnventManager.event_attach( vlc.EventType.MediaPlayerStopped, self.threadStreamObserver.resetPreviousTitle) self.threadStreamObserver.start() self.loadAlbumFilesThread = loadAlbumFilesThread() self.loadAlbumFilesThread.setTerminationEnabled(True) self.loadAlbumFilesThread.imagesLoaded.connect(self.showAlbumCover) self.loadAlbumFilesThread.tracksLoaded.connect(self.showAlbumTracks) self.exploreAlbumsDirectoriesThread = exploreAlbumsDirectoriesThread() #self.exploreAlbumsDirectoriesThread.progressChanged.connect(self.showAlbumTracks) self.exploreAlbumsDirectoriesThread.exploreCompleted.connect( self.showArtists) self.ui.coverWidget.resizeEvent = self.resizeEvent